yuantianjiao il y a 6 ans
Parent
révision
c91d8a2a88

+ 1
- 1
public/index.html Voir le fichier

@@ -6,7 +6,7 @@
6 6
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
7 7
   <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
8 8
     charset="utf-8" />
9
-  <link rel="stylesheet" href="//at.alicdn.com/t/font_681879_zlsjvjaiir.css">
9
+  <link rel="stylesheet" href="//at.alicdn.com/t/font_775069_clu263vfyod.css">
10 10
   <link rel="icon" href="<%= BASE_URL %>favicon.ico">
11 11
   <title>
12 12
     <%= htmlWebpackPlugin.options.title %>

+ 9
- 9
src/pages/user/App.vue Voir le fichier

@@ -12,7 +12,7 @@ export default {
12 12
   name: 'app',
13 13
   data () {
14 14
     return {
15
-      showPage: true
15
+      showPage: false
16 16
     }
17 17
   },
18 18
   components: {},
@@ -23,14 +23,14 @@ export default {
23 23
     })
24 24
   },
25 25
   created () {
26
-    // if (location.search && this.toolClass.UrlSearch(location.search).code) {
27
-    //   this.code = this.toolClass.UrlSearch(location.search).code
28
-    // } else {
29
-    //   this.code = null
30
-    // }
31
-    // this.getUserInfo({ org: this.org, code: this.code }).then(() => {
32
-    //   this.showPage = true
33
-    // })
26
+    if (location.search && this.toolClass.UrlSearch(location.search).code) {
27
+      this.code = this.toolClass.UrlSearch(location.search).code
28
+    } else {
29
+      this.code = null
30
+    }
31
+    this.getUserInfo({ org: this.org, code: this.code }).then(() => {
32
+      this.showPage = true
33
+    })
34 34
   },
35 35
   methods: {
36 36
     ...actions(['getUserInfo'])

+ 13
- 3
src/pages/user/bindMobile/bindMobile.vue Voir le fichier

@@ -20,10 +20,14 @@
20 20
             <span>{{salesName}}</span>
21 21
             <i class="iconfont icon-triangle-bottom"></i>
22 22
           </div>
23
-        </div> -->
24
-
23
+        </div>-->
25 24
         <div class="mobile">
26 25
           <i class="iconfont icon-zhanghu"></i>
26
+          <input type="tel" placeholder="真实姓名" v-model="postData.name">
27
+        </div>
28
+
29
+        <div class="mobile">
30
+          <i class="iconfont icon-mima"></i>
27 31
           <input type="tel" placeholder="推荐码 (非必填)" v-model="postData.recommendCode">
28 32
         </div>
29 33
 
@@ -61,7 +65,7 @@
61 65
             @confirm="onConfirmS"
62 66
           />
63 67
         </div>
64
-      </transition> -->
68
+      </transition>-->
65 69
     </div>
66 70
   </div>
67 71
 </template>
@@ -83,6 +87,7 @@ export default {
83 87
       seconds: 61,
84 88
       postData: {
85 89
         phone: '',
90
+        name: '',
86 91
         // case: '',
87 92
         // sales: '',
88 93
         recommendCode: '',
@@ -196,6 +201,11 @@ export default {
196 201
         this.canSubmit = true
197 202
         return
198 203
       }
204
+      if (!this.postData.name) {
205
+        this.$toast('请填真实姓名')
206
+        this.canSubmit = true
207
+        return
208
+      }
199 209
       if (this.postData.recommendCode) {
200 210
         this.recommendCode({ recommendCode: this.postData.recommendCode }).then((res) => {
201 211
           if (res) {

+ 1
- 1
src/pages/user/bindMobile/page.scss Voir le fichier

@@ -27,11 +27,11 @@
27 27
     }
28 28
     .box{
29 29
       width: 3.25rem;
30
-      height: 3.5rem;
31 30
       background:rgba(255,255,255,1);
32 31
       border-radius:8px;
33 32
       padding: .2rem;
34 33
       box-sizing: border-box;
34
+      margin-top: .5rem;
35 35
       .title{
36 36
         font-size: .16rem;
37 37
         font-weight: bold;

+ 37
- 15
src/pages/user/calendar/calendar.vue Voir le fichier

@@ -26,8 +26,9 @@
26 26
 </template>
27 27
 
28 28
 <script>
29
-import { createNamespacedHelpers } from 'vuex'
29
+import { mapState, createNamespacedHelpers } from 'vuex'
30 30
 const { mapActions: mapMakingActions } = createNamespacedHelpers('making')
31
+const { mapActions: actions } = createNamespacedHelpers('userCenter')
31 32
 import topImg from '@/common/icon/topImg.png'
32 33
 export default {
33 34
   data () {
@@ -37,25 +38,46 @@ export default {
37 38
     }
38 39
   },
39 40
   created () {
40
-    this.getCalendarCustomer().then((res) => {
41
-      if (res) {
42
-        this.state = 2
43
-      } else {
44
-        let stringTime = "2018-12-22 00:00:00"
45
-        let timestamp = Date.parse(new Date(stringTime))
46
-        let now = new Date().getTime()
47
-        if (timestamp >= now) {
48
-          this.state = 1
41
+    this.getUserInfo({ org: this.org }).then(() => {
42
+      this.getCalendarCustomer().then((res) => {
43
+        if (res) {
44
+          this.state = 2
49 45
         } else {
50
-          this.state = 3
46
+          let stringTime = "2018-12-22 00:00:00"
47
+          let timestamp = Date.parse(new Date(stringTime))
48
+          let now = new Date().getTime()
49
+          if (timestamp >= now) {
50
+            this.state = 1
51
+          } else {
52
+            this.state = 3
53
+          }
51 54
         }
52
-      }
55
+      })
56
+    })
57
+  },
58
+  computed: {
59
+    ...mapState({
60
+      org: x => x.app.orgId,
61
+      userInfo: x => x.userCenter.userInfo
53 62
     })
54 63
   },
55 64
   methods: {
65
+    ...actions(['getUserInfo']),
56 66
     ...mapMakingActions(['getCalendarCustomer']),
57 67
     toCheckModel () {
58
-      this.$router.push({ name: 'checkModel' })
68
+      if (!this.userInfo.customer.Phone) {
69
+        this.$dialog.confirm({
70
+          title: '标题',
71
+          message: '您还不是注册会员,注册成功后即可参与此活动'
72
+        }).then(() => {
73
+          // on confirm
74
+          this.$router.push({ name: 'bindMobile' })
75
+        }).catch(() => {
76
+          // on cancel
77
+        });
78
+      } else {
79
+        this.$router.push({ name: 'checkModel' })
80
+      }
59 81
     }
60 82
   }
61 83
 }
@@ -88,8 +110,8 @@ export default {
88 110
     padding-bottom: 0.05rem;
89 111
     font-weight: bold;
90 112
   }
91
-  div{
92
-    padding-bottom: .08rem;
113
+  div {
114
+    padding-bottom: 0.08rem;
93 115
   }
94 116
 }
95 117
 .btn {

+ 19
- 4
src/pages/user/calendar/making.vue Voir le fichier

@@ -56,6 +56,8 @@
56 56
       <div class="swiper-pagination" v-show="mainIndex !== 1"></div>
57 57
       <div class="swiper-cover" v-show="mainIndex === 1">封面</div>
58 58
     </div>
59
+    <div class="meassage" v-if="mainIndex !== 1">备注:为了美观效果请上传{{size}}尺寸照片,未按尺寸会默认裁剪</div>
60
+    <div class="meassage" v-else>&nbsp;</div>
59 61
     <div class="operation">
60 62
       <div>
61 63
         <van-uploader :after-read="onRead" v-show="mainIndex !== 1">
@@ -149,7 +151,14 @@ export default {
149 151
     ...mapMakingState({
150 152
       bannerBlack: item => item.bannerBlack,
151 153
       bannerRed: item => item.bannerRed
152
-    })
154
+    }),
155
+    size () {
156
+      if (this.mainIndex === 1 || this.mainIndex === 3 || this.mainIndex === 7 || this.mainIndex === 10) {
157
+        return '横'
158
+      } else {
159
+        return '竖'
160
+      }
161
+    }
153 162
   },
154 163
   created () {
155 164
     if (this.$route.query.type == 1) {
@@ -216,7 +225,7 @@ export default {
216 225
       }
217 226
       this.calendar({ Calendar: JSON.stringify(submitData) }).then(() => {
218 227
         this.$toast('日历已生成')
219
-        this.$router.push({ name: 'customizationList' })
228
+        this.$router.replace({ name: 'userCenter' })
220 229
       })
221 230
     },
222 231
     pre () {
@@ -328,6 +337,12 @@ export default {
328 337
     color: #fff;
329 338
   }
330 339
 }
340
+.meassage {
341
+  color: red;
342
+  padding: 0.1rem;
343
+  text-align: center;
344
+  font-size: 0.12rem;
345
+}
331 346
 .pop-box {
332 347
   width: 100%;
333 348
   height: 100%;
@@ -487,7 +502,7 @@ export default {
487 502
   display: flex;
488 503
   justify-content: center;
489 504
   align-items: center;
490
-  padding: 0.5rem 0.2rem;
505
+  padding: 0.2rem 0.2rem 0.3rem;
491 506
   > div {
492 507
     flex: 1;
493 508
     text-align: center;
@@ -513,7 +528,7 @@ export default {
513 528
   }
514 529
 }
515 530
 .btn {
516
-  margin-top: 0.3rem;
531
+  margin-top: 0.1rem;
517 532
   width: 100%;
518 533
   box-sizing: border-box;
519 534
   display: flex;

+ 10
- 1
src/pages/user/customization/customizationList.vue Voir le fichier

@@ -43,7 +43,16 @@ export default {
43 43
     toDetail (id) {
44 44
       this.$router.push({ name: 'customizationDetail', query: { id: id } })
45 45
     }
46
-  }
46
+  },
47
+  // beforeRouteLeave (to, from, next) {
48
+  //   console.log(to)
49
+  //   console.log(from)
50
+  //   if (to.name === 'making') {
51
+  //     next({ name: 'activeList' })
52
+  //   } else {
53
+  //     next()
54
+  //   }
55
+  // }
47 56
 }
48 57
 </script>
49 58
 

+ 34
- 7
src/pages/user/fiveA/index.vue Voir le fichier

@@ -1,7 +1,13 @@
1 1
 <template>
2 2
   <div class="mainPage flex-v">
3 3
     <nav class="flex-h">
4
-      <a class="flex-item" v-for="(item,index) in locations" :key="index" :class="{'active':index==active.index}" @click="changeLocation(item,index)">{{item.LocationName}}</a>
4
+      <a
5
+        class="flex-item"
6
+        v-for="(item,index) in locations"
7
+        :key="index"
8
+        :class="{'active':index==active.index}"
9
+        @click="changeLocation(item,index)"
10
+      >{{item.LocationName}}</a>
5 11
     </nav>
6 12
     <div class="flex-item">
7 13
       <div>
@@ -9,8 +15,18 @@
9 15
           <div class="banner flex-h">
10 16
             <div class="flex-item">
11 17
               <swiper :options="swiperOption" ref="mySwiper">
12
-                <swiper-slide class="swiper-slide" v-for="(banner,bindex) in item.Banners" :key="bindex">
13
-                  <img :src='banner.ImageUrl' class="cover" style="border-radius: .12rem;" alt=""  @click="jump(banner)">
18
+                <swiper-slide
19
+                  class="swiper-slide"
20
+                  v-for="(banner,bindex) in item.Banners"
21
+                  :key="bindex"
22
+                >
23
+                  <img
24
+                    :src="banner.ImageUrl"
25
+                    class="cover"
26
+                    style="border-radius: .12rem;"
27
+                    alt
28
+                    @click="jump(banner)"
29
+                  >
14 30
                 </swiper-slide>
15 31
               </swiper>
16 32
             </div>
@@ -18,7 +34,12 @@
18 34
           <h5>{{item.Title}}</h5>
19 35
           <div class="courseList flex-h">
20 36
             <ul class="flex-item" v-if="!fiveANoData">
21
-              <router-link tag="li" v-for="(course,cindex) in item.Courses" :key="cindex" :to="{name:'majorProjectsDetail',query:{id: course.CourseId}}">
37
+              <router-link
38
+                tag="li"
39
+                v-for="(course,cindex) in item.Courses"
40
+                :key="cindex"
41
+                :to="{name:'majorProjectsDetail',query:{id: course.CourseId}}"
42
+              >
22 43
                 <courseItem :data="courseInfo(course)"></courseItem>
23 44
               </router-link>
24 45
             </ul>
@@ -28,7 +49,13 @@
28 49
           <h5>{{item.Consult || '资讯'}}</h5>
29 50
           <div class="newsList flex-h">
30 51
             <ul class="flex-item">
31
-              <li tag="li" @click="jump(newinfo)" v-for="(newinfo,nindex) in item.News" v-if="nindex < 5" :key="nindex">
52
+              <li
53
+                tag="li"
54
+                @click="jump(newinfo)"
55
+                v-for="(newinfo,nindex) in item.News"
56
+                v-if="nindex < 5"
57
+                :key="nindex"
58
+              >
32 59
                 <newsItem :data="newinfo"></newsItem>
33 60
               </li>
34 61
             </ul>
@@ -107,7 +134,7 @@ export default {
107 134
         id: course.CourseId,
108 135
         title: course.CourseName,
109 136
         img: course.CourseImg,
110
-        remark: course.Remark,
137
+        remark: `${this.toolClass.dateFormat(course.BeginDate, 'yyyy-MM-dd')} ~ ${this.toolClass.dateFormat(course.EndDate, 'yyyy-MM-dd')}`,
111 138
         address: course.CaseAddress,
112 139
         tag: course.CourseTags || [],
113 140
         courseType: '',
@@ -126,7 +153,7 @@ export default {
126 153
       if (item.ForwardType === 'url') {
127 154
         window.location.href = item.ForwardUrl
128 155
       } else if (item.ForwardType === 'course') {
129
-        if (item.ForwardResourceId){
156
+        if (item.ForwardResourceId) {
130 157
           this.$router.push({ name: 'majorProjectsDetail', query: { id: item.ForwardResourceId } }) // 此处去课程详情
131 158
         } else {
132 159
           this.$router.push({ name: 'majorProjectsDetail', query: { id: item.ForwardCourseId } }) // 此处去课程详情

+ 70
- 30
src/pages/user/mainPage/indexPage/index.vue Voir le fichier

@@ -1,12 +1,12 @@
1 1
 <template>
2
-  <div class="mainPage">
2
+  <div class="mainPage" v-if="showPage">
3 3
     <div class="banner flex-h">
4 4
       <div class="flex-item">
5 5
         <div>
6 6
           <div>
7 7
             <swiper :options="swiperOption" ref="mySwiper">
8 8
               <swiper-slide class="swiper-slide" v-for="(item,index) in banner" :key="index">
9
-                <img :src='item.ImageUrl' class="cover" alt="" @click="jump(item)">
9
+                <img :src="item.ImageUrl" class="cover" alt @click="jump(item)">
10 10
               </swiper-slide>
11 11
             </swiper>
12 12
           </div>
@@ -15,8 +15,14 @@
15 15
     </div>
16 16
     <div class="subNav">
17 17
       <ul class="flex-h">
18
-        <router-link tag="li" class="flex-item" v-for="(item, index) in fiveA" :to="{name:'fiveA',query:{id:item.LocationId}}" :key="index">
19
-          <img :src="item.TypeImg" alt="">
18
+        <router-link
19
+          tag="li"
20
+          class="flex-item"
21
+          v-for="(item, index) in fiveA"
22
+          :to="{name:'fiveA',query:{id:item.LocationId}}"
23
+          :key="index"
24
+        >
25
+          <img :src="item.TypeImg" alt>
20 26
           <span>{{item.LocationName}}</span>
21 27
         </router-link>
22 28
       </ul>
@@ -30,9 +36,16 @@
30 36
         <div>
31 37
           <swiper :options="swiperHOption" ref="mySwiperH">
32 38
             <swiper-slide class="swiper-slide" v-for="(item,index) in project" :key="index">
33
-              <router-link tag="div" :to="{ name:'majorProjects', query:{ id: item.CmsCaseId } }" style="width:100%;height:100%;position:relative;">
34
-                <img :src='item.CaseImageUrl' class="cover" alt="">
35
-                <span><i class="iconfont icon-dingwei"></i>距离{{item.Coordinate}}米</span>
39
+              <router-link
40
+                tag="div"
41
+                :to="{ name:'majorProjects', query:{ id: item.CmsCaseId } }"
42
+                style="width:100%;height:100%;position:relative;"
43
+              >
44
+                <img :src="item.CaseImageUrl" class="cover" alt>
45
+                <span>
46
+                  <i class="iconfont icon-dingwei"></i>
47
+                  距离{{parseInt(toolClass.getGreatCircleDistance(latitude1, longitude1, item.Coordinate.split(',')[0], item.Coordinate.split(',')[1]))}}米
48
+                </span>
36 49
               </router-link>
37 50
             </swiper-slide>
38 51
           </swiper>
@@ -48,12 +61,18 @@
48 61
         <div>
49 62
           <swiper :options="swiperHOption" ref="mySwiperH">
50 63
             <swiper-slide class="swiper-slide" v-for="(item,index) in courseList" :key="index">
51
-              <router-link tag="div" :to="{ name:'majorProjectsDetail', query:{ id: item.CourseId } }" style="width:100%;position:relative;overflow:visible">
64
+              <router-link
65
+                tag="div"
66
+                :to="{ name:'majorProjectsDetail', query:{ id: item.CourseId } }"
67
+                style="width:100%;position:relative;overflow:visible"
68
+              >
52 69
                 <div class="img">
53
-                  <img :src='item.CourseImg' class="cover centerLabel" alt="">
70
+                  <img :src="item.CourseImg" class="cover centerLabel" alt>
54 71
                   <span>{{item.CourseName}}</span>
55 72
                 </div>
56
-                <div class="price"><span>¥{{item.Price}}</span></div>
73
+                <div class="price">
74
+                  <span>¥{{item.Price}}</span>
75
+                </div>
57 76
                 <span>{{toolClass.dateFormat(item.BeginDate)}}</span>
58 77
                 <span>{{item.CaseName}}</span>
59 78
               </router-link>
@@ -71,7 +90,7 @@
71 90
           <ul>
72 91
             <li class="flex-h" v-for="(item,index) in newsList" :key="index" @click="jump(item)">
73 92
               <a class="img">
74
-                <img :src="item.ImageUrl" class="centerLabel cover" alt="">
93
+                <img :src="item.ImageUrl" class="centerLabel cover" alt>
75 94
               </a>
76 95
               <div class="flex-item">
77 96
                 <div>
@@ -92,6 +111,8 @@ import { swiper, swiperSlide } from 'vue-awesome-swiper'
92 111
 import 'swiper/dist/css/swiper.css'
93 112
 import { mapState, createNamespacedHelpers } from 'vuex'
94 113
 const { mapState: mapIndexState, mapActions: mapIndexActions } = createNamespacedHelpers('index')
114
+const wx = require('weixin-js-sdk')
115
+import wxsdk from '@/util/share'
95 116
 export default {
96 117
   name: '',
97 118
   data () {
@@ -109,7 +130,8 @@ export default {
109 130
         freeMode: true,
110 131
         slidesPerView: 'auto',
111 132
       },
112
-      newsList: []
133
+      newsList: [],
134
+      showPage: false
113 135
     }
114 136
   },
115 137
   computed: {
@@ -120,6 +142,8 @@ export default {
120 142
       message: x => x.index.message,
121 143
       project: x => x.index.project,
122 144
       cms: x => x.index.cms,
145
+      longitude1: x => x.index.longitude1,
146
+      latitude1: x => x.index.latitude1
123 147
     }),
124 148
     ...mapIndexState({
125 149
       courseList: x => x.courseList
@@ -136,31 +160,47 @@ export default {
136 160
     swiperSlide
137 161
   },
138 162
   created () {
139
-    this.getIndexLocation({ orgid: this.orgid, issys: '0' }).then((res) => {
140
-      // this.data.fiveA = this.fiveA
141
-      this.locationId = 'index'
142
-      this.getIndexInfo({ orgid: this.orgid, locationid: this.locationId }).then((res) => {
143
-        this.newsList = this.cms
144
-        if (this.project !== undefined && this.project !== null) {
145
-          for (let i = 0; i < this.project.length; i++) {
146
-            if (this.project[i].CmsCaseImgs != null) {
147
-              for (let j = 0; j < this.project[i].CmsCaseImgs.length; j++) {
148
-                if (this.project[i].CmsCaseImgs[j].ImageType === 'cover') {
149
-                  this.project[i].CaseImageUrl = this.project[i].CmsCaseImgs[j].CaseImageUrl
163
+    let that = this
164
+    wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
165
+      title: '城的空间',
166
+      desc: '城的空间',
167
+      link: `${window.location.origin}${window.location.pathname}#/mainPage/indexPage`,
168
+      thu_image: `https://spaceofcheng.oss-cn-beijing.aliyuncs.com/indexlogo.jpg?x-oss-process=style/wxicon`
169
+    }).then(() => {
170
+      wx.getLocation({
171
+        type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
172
+        success: function (res) {
173
+          that.setLocation({ latitude1: res.latitude, longitude1: res.longitude })
174
+          that.getIndexLocation({ orgid: that.orgid, issys: '0' }).then((res) => {
175
+            // that.data.fiveA = that.fiveA
176
+            that.locationId = 'index'
177
+            that.getIndexInfo({ orgid: that.orgid, locationid: that.locationId }).then((res) => {
178
+              that.newsList = that.cms
179
+              if (that.project !== undefined && that.project !== null) {
180
+                for (let i = 0; i < that.project.length; i++) {
181
+                  if (that.project[i].CmsCaseImgs != null) {
182
+                    for (let j = 0; j < that.project[i].CmsCaseImgs.length; j++) {
183
+                      if (that.project[i].CmsCaseImgs[j].ImageType === 'cover') {
184
+                        that.project[i].CaseImageUrl = that.project[i].CmsCaseImgs[j].CaseImageUrl
185
+                      }
186
+                    }
187
+                  }
150 188
                 }
151 189
               }
152
-            }
153
-          }
190
+            })
191
+            that.getCourseList({
192
+              pagesize: 5,
193
+              page: 1
194
+            }).then(() => {
195
+              that.showPage = true
196
+            })
197
+          })
154 198
         }
155 199
       })
156
-      this.getCourseList({
157
-        pagesize: 5,
158
-        page: 1
159
-      })
160 200
     })
161 201
   },
162 202
   methods: {
163
-    ...mapIndexActions(['getIndexLocation', 'getIndexInfo', 'getCourseList']),
203
+    ...mapIndexActions(['getIndexLocation', 'getIndexInfo', 'getCourseList', 'setLocation']),
164 204
     jump (item) {
165 205
       item.ForwardType = item.ForwardType || ''
166 206
       if (item.ForwardType === 'url') {

+ 3
- 1
src/pages/user/mainPage/indexPage/page.scss Voir le fichier

@@ -28,9 +28,11 @@
28 28
           top: 0;
29 29
           bottom: 0;
30 30
           overflow: hidden;
31
-          >div{
31
+          border-radius: .1rem;
32
+        >div{
32 33
             width: 100%;
33 34
             height: 100%;
35
+            border-radius: .1rem;
34 36
           }
35 37
         }
36 38
       }

+ 1
- 3
src/pages/user/mainPage/userCenter/index.vue Voir le fichier

@@ -94,8 +94,6 @@ export default {
94 94
       this.user = this.userInfo.customer
95 95
       if (this.user.AccountInfo) {
96 96
         this.AccountInfo = JSON.parse(this.user.AccountInfo)
97
-
98
-
99 97
       }
100 98
       this.headimgurl = this.user.Headimgurl
101 99
     })
@@ -136,7 +134,7 @@ export default {
136 134
       userid = `${userid}${num}`
137 135
       window.location.href = `${window.location.origin}/game/luckdraw/#/lotteryList?from=${userid}`
138 136
     },
139
-    toActiveList(){
137
+    toActiveList () {
140 138
       this.$router.push({ name: 'activeList' })
141 139
     }
142 140
   }

+ 32
- 7
src/pages/user/majorProjectsList/index.vue Voir le fichier

@@ -4,11 +4,21 @@
4 4
       <div class="flex-item">
5 5
         <div>
6 6
           <ul>
7
-            <router-link v-for="(item, index) in project" :key="index" class="flex-h" tag="li" :to="{ name:'majorProjects', query:{ id: item.CmsCaseId } }">
7
+            <router-link
8
+              v-for="(item, index) in project"
9
+              :key="index"
10
+              class="flex-h"
11
+              tag="li"
12
+              :to="{ name:'majorProjects', query:{ id: item.CmsCaseId } }"
13
+            >
8 14
               <a class="img">
9 15
                 <img :src="item.CmsCaseImgs[0].CaseImageUrl" class="cover" alt>
10 16
               </a>
11
-              <router-link tag="div" class="flex-item" :to="{ name:'majorProjects', query:{ id: item.CmsCaseId } }">
17
+              <router-link
18
+                tag="div"
19
+                class="flex-item"
20
+                :to="{ name:'majorProjects', query:{ id: item.CmsCaseId } }"
21
+              >
12 22
                 <div>
13 23
                   <span>{{item.Name}}</span>
14 24
                   <span>{{item.CaseAddress}}</span>
@@ -25,7 +35,8 @@
25 35
 <script>
26 36
 import { mapState, createNamespacedHelpers } from 'vuex'
27 37
 const { mapActions: mapIndexActions } = createNamespacedHelpers('index')
28
-
38
+const wx = require('weixin-js-sdk')
39
+import wxsdk from '@/util/share'
29 40
 export default {
30 41
   name: '',
31 42
   data () {
@@ -41,14 +52,28 @@ export default {
41 52
   components: {
42 53
   },
43 54
   created () {
44
-    this.getProjectList({
45
-      orgid: this.orgid
55
+    let that = this
56
+    wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
57
+      title: '城的空间',
58
+      desc: '城的空间',
59
+      link: `${window.location.origin}${window.location.pathname}#/mainPage/indexPage`,
60
+      thu_image: `https://spaceofcheng.oss-cn-beijing.aliyuncs.com/indexlogo.jpg?x-oss-process=style/wxicon`
46 61
     }).then(() => {
47
-      console.log(this.project)
62
+      wx.getLocation({
63
+        type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
64
+        success: function (res) {
65
+          that.setLocation({ latitude1: res.latitude, longitude1: res.longitude })
66
+          that.getProjectList({
67
+            orgid: that.orgid
68
+          }).then(() => {
69
+            console.log(that.project)
70
+          })
71
+        }
72
+      })
48 73
     })
49 74
   },
50 75
   methods: {
51
-    ...mapIndexActions(['getProjectList'])
76
+    ...mapIndexActions(['getProjectList', 'setLocation'])
52 77
   }
53 78
 }
54 79
 </script>

+ 26
- 2
src/store/index/index.js Voir le fichier

@@ -1,5 +1,6 @@
1 1
 import Ajax from '../../util/ajax'
2 2
 import api from '../../util/api'
3
+import toolClass from '../../util/util'
3 4
 const http = new Object
4 5
 
5 6
 // 请求数据
@@ -91,7 +92,9 @@ export default {
91 92
     message: [],
92 93
     project: [],
93 94
     cms: [],
94
-    courseList: []
95
+    courseList: [],
96
+    longitude1: 0,
97
+    latitude1: 0
95 98
   },
96 99
   mutations: {
97 100
     setBanner (state, data) { // 获取首页轮播图
@@ -112,7 +115,21 @@ export default {
112 115
     },
113 116
     setProject (state, data) { // 获取项目专题
114 117
       data = data || []
115
-      state.project = data
118
+      let arr = []
119
+      let dataNew = []
120
+      data.forEach((item) => {
121
+        item.jl = parseInt(toolClass.getGreatCircleDistance(state.latitude1, state.longitude1, item.Coordinate.split(',')[0], item.Coordinate.split(',')[1]))
122
+        arr.push(parseInt(toolClass.getGreatCircleDistance(state.latitude1, state.longitude1, item.Coordinate.split(',')[0], item.Coordinate.split(',')[1])))
123
+      })
124
+      arr.sort((a, b) => { return a - b })
125
+      arr.forEach((curr) => {
126
+        data.forEach((item) => {
127
+          if (curr === item.jl) {
128
+            dataNew.push(item)
129
+          }
130
+        })
131
+      })
132
+      state.project = dataNew
116 133
     },
117 134
     setCms (state, data) { // 获取cms
118 135
       data = data || []
@@ -121,8 +138,15 @@ export default {
121 138
     updateCourseList (state, data) { // 更新附近课程
122 139
       state.courseList = data.list || []
123 140
     },
141
+    upDateLocation (state, data) {
142
+      state.longitude1 = data.longitude1
143
+      state.latitude1 = data.latitude1
144
+    }
124 145
   },
125 146
   actions: {
147
+    setLocation (context, data) {
148
+      context.commit('upDateLocation', data)
149
+    },
126 150
     getCourseList (context, payload) { // 获取附近课程
127 151
       return new Promise((resolve, reject) => {
128 152
         Ajax(api.index.getCourseList.url, {