yuantianjiao 6 年前
父节点
当前提交
6c79770375

+ 2
- 1
package.json 查看文件

@@ -36,6 +36,7 @@
36 36
     "vue-croppa": "^1.3.8",
37 37
     "vue-router": "^3.0.1",
38 38
     "vue-template-compiler": "^2.5.17",
39
-    "vuex": "^3.0.1"
39
+    "vuex": "^3.0.1",
40
+    "weixin-jsapi": "^1.1.0"
40 41
   }
41 42
 }

+ 2
- 1
src/pages/user/mainPage/coffeeIndex/index.vue 查看文件

@@ -135,13 +135,14 @@ import logo from '../../../../common/icon/indexlogo.jpg'
135 135
 import wxsdk from '../../../../util/share'
136 136
 import noMore from '../../../../components/noMore/noMore'
137 137
 import { mapState, createNamespacedHelpers } from 'vuex'
138
+import wx from 'weixin-jsapi'
138 139
 const { mapActions: actions } = createNamespacedHelpers('app')
139 140
 const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
140 141
 const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
141 142
 const { mapState: mpRemarkState, mapActions: mapRemarkActions } = createNamespacedHelpers('remark')
142 143
 const { mapState: mapCardState, mapActions: mapCardActions } = createNamespacedHelpers('myCard')
143 144
 const { mapActions: mapUserCenterActions } = createNamespacedHelpers('userCenter')
144
-const wx = require('weixin-js-sdk')
145
+// const wx = require('weixin-js-sdk')
145 146
 
146 147
 export default {
147 148
   name: '',

+ 2
- 1
src/pages/user/mainPage/indexPage/index.vue 查看文件

@@ -127,8 +127,9 @@ import { swiper, swiperSlide } from 'vue-awesome-swiper'
127 127
 import 'swiper/dist/css/swiper.css'
128 128
 import toolClass from '../../../../util/util'
129 129
 import { mapState, createNamespacedHelpers } from 'vuex'
130
+import wx from 'weixin-jsapi'
130 131
 const { mapState: mapIndexState, mapActions: mapIndexActions } = createNamespacedHelpers('index')
131
-const wx = require('weixin-js-sdk')
132
+// const wx = require('weixin-js-sdk')
132 133
 import wxsdk from '@/util/share'
133 134
 export default {
134 135
   name: '',

+ 19
- 16
src/pages/user/mainPage/libraryIndex/index.vue 查看文件

@@ -81,7 +81,8 @@ const { mapActions: mapAppActions } = createNamespacedHelpers('app')
81 81
 const { mapState: mapBookState, mapActions: mapBookActions } = createNamespacedHelpers('book')
82 82
 import { Toast } from '../../../../../node_modules/vant';
83 83
 import wxsdk from '../../../../util/share'
84
-const wx = require('weixin-js-sdk')
84
+import wx from 'weixin-jsapi'
85
+// const wx = require('weixin-js-sdk')
85 86
 export default {
86 87
   name: '',
87 88
   data () {
@@ -170,23 +171,23 @@ export default {
170 171
         let hasSol = false
171 172
         const startDt = (new Date).getTime()
172 173
 
173
-        const t = window.setInterval(() => {
174
-          const nw = (new Date).getTime()
174
+        // const t = window.setInterval(() => {
175
+        //   const nw = (new Date).getTime()
175 176
 
176
-          if (hasSol) {
177
-            window.clearInterval(t)
178
-            return
179
-          }
177
+        //   if (hasSol) {
178
+        //     window.clearInterval(t)
179
+        //     return
180
+        //   }
180 181
 
181
-          // 500 毫秒还未定位则直接取消定位
182
-          if ((nw - startDt) >= 500) {
183
-            hasSol = true
184
-            window.clearInterval(t)
182
+        //   // 500 毫秒还未定位则直接取消定位
183
+        //   if ((nw - startDt) >= 500) {
184
+        //     hasSol = true
185
+        //     window.clearInterval(t)
185 186
 
186
-            this.setDefaultCase(((this.CaseList || [])[0] || {}).CaseId)
187
-            reject('定位超时 ...')
188
-          }
189
-        }, 100)
187
+        //     this.setDefaultCase(((this.CaseList || [])[0] || {}).CaseId)
188
+        //     reject('定位超时 ...')
189
+        //   }
190
+        // }, 100)
190 191
 
191 192
         wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
192 193
           title: '城的空间',
@@ -194,6 +195,7 @@ export default {
194 195
           link: `${window.location.origin}${window.location.pathname}#/mainPage/indexPage`,
195 196
           thu_image: `https://spaceofcheng.oss-cn-beijing.aliyuncs.com/indexlogo.jpg?x-oss-process=style/wxicon`
196 197
         }).then(() => {
198
+          console.log(wx.getLocation)
197 199
           if (hasSol) return
198 200
           hasSol = true
199 201
           const that = this
@@ -213,7 +215,8 @@ export default {
213 215
                 that.longitude = res.longitude // 经度,浮点数,范围为180 ~ -180。
214 216
                 console.log('获取到位置 ->', that.latitude, that.longitude)
215 217
               },
216
-              complete: function () {
218
+              complete: function (res) {
219
+                console.log(res)
217 220
                 console.log('获取位置后, 不管成功与否', that.latitude, that.longitude)
218 221
 
219 222
                 if(that.latitude && that.longitude ) {

+ 2
- 1
src/pages/user/majorProjectsDetail/index.vue 查看文件

@@ -83,7 +83,8 @@ import { swiper, swiperSlide } from 'vue-awesome-swiper'
83 83
 import 'swiper/dist/css/swiper.css'
84 84
 import { mapState, createNamespacedHelpers } from 'vuex'
85 85
 const { mapActions: mapProjectActions, mapState: mapProjectState } = createNamespacedHelpers('majorProjects')
86
-const wx = require('weixin-js-sdk')
86
+import wx from 'weixin-jsapi'
87
+// const wx = require('weixin-js-sdk')
87 88
 
88 89
 export default {
89 90
   name: '',

+ 2
- 1
src/pages/user/majorProjectsList/index.vue 查看文件

@@ -35,7 +35,8 @@
35 35
 <script>
36 36
 import { mapState, createNamespacedHelpers } from 'vuex'
37 37
 const { mapActions: mapIndexActions } = createNamespacedHelpers('index')
38
-const wx = require('weixin-js-sdk')
38
+import wx from 'weixin-jsapi'
39
+// const wx = require('weixin-js-sdk')
39 40
 import wxsdk from '@/util/share'
40 41
 export default {
41 42
   name: '',

+ 2
- 1
src/util/share.js 查看文件

@@ -1,8 +1,9 @@
1 1
 import Ajax from './ajax'
2 2
 import api from './api'
3
+import wx from 'weixin-jsapi'
3 4
 
4 5
 function wxsdk (params, config) {
5
-  const wx = require('weixin-js-sdk')
6
+  // const wx = require('weixin-js-sdk')
6 7
   console.log(config)
7 8
   const shareData = {
8 9
     title: config.title, // 分享标题