yuantianjiao 6 years ago
parent
commit
6c79770375

+ 2
- 1
package.json View File

36
     "vue-croppa": "^1.3.8",
36
     "vue-croppa": "^1.3.8",
37
     "vue-router": "^3.0.1",
37
     "vue-router": "^3.0.1",
38
     "vue-template-compiler": "^2.5.17",
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 View File

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

+ 2
- 1
src/pages/user/mainPage/indexPage/index.vue View File

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

+ 19
- 16
src/pages/user/mainPage/libraryIndex/index.vue View File

81
 const { mapState: mapBookState, mapActions: mapBookActions } = createNamespacedHelpers('book')
81
 const { mapState: mapBookState, mapActions: mapBookActions } = createNamespacedHelpers('book')
82
 import { Toast } from '../../../../../node_modules/vant';
82
 import { Toast } from '../../../../../node_modules/vant';
83
 import wxsdk from '../../../../util/share'
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
 export default {
86
 export default {
86
   name: '',
87
   name: '',
87
   data () {
88
   data () {
170
         let hasSol = false
171
         let hasSol = false
171
         const startDt = (new Date).getTime()
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
         wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
192
         wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
192
           title: '城的空间',
193
           title: '城的空间',
194
           link: `${window.location.origin}${window.location.pathname}#/mainPage/indexPage`,
195
           link: `${window.location.origin}${window.location.pathname}#/mainPage/indexPage`,
195
           thu_image: `https://spaceofcheng.oss-cn-beijing.aliyuncs.com/indexlogo.jpg?x-oss-process=style/wxicon`
196
           thu_image: `https://spaceofcheng.oss-cn-beijing.aliyuncs.com/indexlogo.jpg?x-oss-process=style/wxicon`
196
         }).then(() => {
197
         }).then(() => {
198
+          console.log(wx.getLocation)
197
           if (hasSol) return
199
           if (hasSol) return
198
           hasSol = true
200
           hasSol = true
199
           const that = this
201
           const that = this
213
                 that.longitude = res.longitude // 经度,浮点数,范围为180 ~ -180。
215
                 that.longitude = res.longitude // 经度,浮点数,范围为180 ~ -180。
214
                 console.log('获取到位置 ->', that.latitude, that.longitude)
216
                 console.log('获取到位置 ->', that.latitude, that.longitude)
215
               },
217
               },
216
-              complete: function () {
218
+              complete: function (res) {
219
+                console.log(res)
217
                 console.log('获取位置后, 不管成功与否', that.latitude, that.longitude)
220
                 console.log('获取位置后, 不管成功与否', that.latitude, that.longitude)
218
 
221
 
219
                 if(that.latitude && that.longitude ) {
222
                 if(that.latitude && that.longitude ) {

+ 2
- 1
src/pages/user/majorProjectsDetail/index.vue View File

83
 import 'swiper/dist/css/swiper.css'
83
 import 'swiper/dist/css/swiper.css'
84
 import { mapState, createNamespacedHelpers } from 'vuex'
84
 import { mapState, createNamespacedHelpers } from 'vuex'
85
 const { mapActions: mapProjectActions, mapState: mapProjectState } = createNamespacedHelpers('majorProjects')
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
 export default {
89
 export default {
89
   name: '',
90
   name: '',

+ 2
- 1
src/pages/user/majorProjectsList/index.vue View File

35
 <script>
35
 <script>
36
 import { mapState, createNamespacedHelpers } from 'vuex'
36
 import { mapState, createNamespacedHelpers } from 'vuex'
37
 const { mapActions: mapIndexActions } = createNamespacedHelpers('index')
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
 import wxsdk from '@/util/share'
40
 import wxsdk from '@/util/share'
40
 export default {
41
 export default {
41
   name: '',
42
   name: '',

+ 2
- 1
src/util/share.js View File

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