yuantianjiao 6 年之前
父節點
當前提交
1e0d8c588b

+ 1
- 1
build/webpack.base.conf.js 查看文件

71
         test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
71
         test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
72
         loader: 'url-loader',
72
         loader: 'url-loader',
73
         options: {
73
         options: {
74
-          limit: 10000,
74
+          limit: 10000000,
75
           name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
75
           name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
76
         }
76
         }
77
       }
77
       }

+ 4
- 1
package.json 查看文件

46
     "friendly-errors-webpack-plugin": "^1.6.1",
46
     "friendly-errors-webpack-plugin": "^1.6.1",
47
     "html-webpack-plugin": "^2.30.1",
47
     "html-webpack-plugin": "^2.30.1",
48
     "node-notifier": "^5.1.2",
48
     "node-notifier": "^5.1.2",
49
+    "node-sass": "^4.9.3",
49
     "optimize-css-assets-webpack-plugin": "^3.2.0",
50
     "optimize-css-assets-webpack-plugin": "^3.2.0",
50
     "ora": "^1.2.0",
51
     "ora": "^1.2.0",
51
     "portfinder": "^1.0.13",
52
     "portfinder": "^1.0.13",
53
     "postcss-loader": "^2.0.8",
54
     "postcss-loader": "^2.0.8",
54
     "postcss-url": "^7.2.1",
55
     "postcss-url": "^7.2.1",
55
     "rimraf": "^2.6.0",
56
     "rimraf": "^2.6.0",
57
+    "sass-loader": "^7.1.0",
56
     "semver": "^5.3.0",
58
     "semver": "^5.3.0",
57
     "shelljs": "^0.7.6",
59
     "shelljs": "^0.7.6",
58
     "uglifyjs-webpack-plugin": "^1.1.1",
60
     "uglifyjs-webpack-plugin": "^1.1.1",
59
     "url-loader": "^0.5.8",
61
     "url-loader": "^0.5.8",
62
+    "vue-lazyload": "^1.2.6",
60
     "vue-loader": "^13.3.0",
63
     "vue-loader": "^13.3.0",
61
-    "vue-style-loader": "^3.0.1",
64
+    "vue-style-loader": "^3.1.2",
62
     "vue-template-compiler": "^2.5.2",
65
     "vue-template-compiler": "^2.5.2",
63
     "webpack": "^3.6.0",
66
     "webpack": "^3.6.0",
64
     "webpack-bundle-analyzer": "^2.9.0",
67
     "webpack-bundle-analyzer": "^2.9.0",

src/assets/font/hkhb.ttf → src/assets/hkhb.ttf 查看文件


+ 1
- 1
src/config/index.js 查看文件

1
 export default {
1
 export default {
2
   appid: 'wx7320287e057bbeee',
2
   appid: 'wx7320287e057bbeee',
3
-  redirect_uri: encodeURIComponent(window.location.href),
3
+  redirect_uri: encodeURIComponent(window.location.href + '#/index'),
4
   response_type: 'code',
4
   response_type: 'code',
5
   scope: 'snsapi_userinfo',
5
   scope: 'snsapi_userinfo',
6
   state: '12313'
6
   state: '12313'

+ 15
- 0
src/page/getCode/index.vue 查看文件

1
+<template>
2
+  <div></div>
3
+</template>
4
+
5
+<script>
6
+import wechatConfig from '@/config/index'
7
+export default {
8
+  created () {
9
+    let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechatConfig.appid}&redirect_uri=${wechatConfig.redirect_uri}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
10
+    window.location.href = url
11
+  }
12
+}
13
+</script>
14
+ <style lang="scss" scoped>
15
+</style>

+ 8
- 2
src/page/index/index.vue 查看文件

167
     }
167
     }
168
   },
168
   },
169
   created () {
169
   created () {
170
-    this.getUserInfo({ luckdrawid: this.lotteryId }).then((res) => {
170
+    console.log(this.toolClass.UrlSearch(location.search))
171
+    localStorage.setItem('code', this.toolClass.UrlSearch(location.search).code)
172
+    this.code = localStorage.getItem('code')
173
+    this.getUserInfo({ code: this.code, luckdrawid: this.lotteryId }).then((res) => {
171
       this.data.userInfo = this.userInfo
174
       this.data.userInfo = this.userInfo
172
-      console.log(this.data.userInfo)
173
       if (this.data.userInfo.record) {
175
       if (this.data.userInfo.record) {
174
         this.winning = this.data.userInfo.record.PrizeName
176
         this.winning = this.data.userInfo.record.PrizeName
175
         this.showDialog = true
177
         this.showDialog = true
276
 </script>
278
 </script>
277
 
279
 
278
 <style lang="scss" scoped>
280
 <style lang="scss" scoped>
281
+@font-face {
282
+  font-family: myFont;
283
+  src: url("../../assets/hkhb.ttf")
284
+}
279
 @import "page.scss";
285
 @import "page.scss";
280
 </style>
286
 </style>

+ 1
- 4
src/page/index/page.scss 查看文件

1
-@font-face {
2
-  font-family: myFont;
3
-  src: url("../../assets/font/hkhb.ttf")
4
-}
1
+// @import  '../../assets/hkhb.ttf'
5
 body * {
2
 body * {
6
   font-family: myFont;
3
   font-family: myFont;
7
 }
4
 }

+ 2
- 1
src/page/lotteryList/index.vue 查看文件

31
     })
31
     })
32
   },
32
   },
33
   created () {
33
   created () {
34
-    this.getUserInfo({ luckdrawid: this.lotteryId }).then((res) => {
34
+    this.code = localStorage.getItem('code')
35
+    this.getUserInfo({ code: this.code, luckdrawid: this.lotteryId }).then((res) => {
35
       this.data.userInfo = this.userInfo
36
       this.data.userInfo = this.userInfo
36
       this.getLotteryList({ userid: this.data.userInfo.user.Id }).then((res) => {
37
       this.getLotteryList({ userid: this.data.userInfo.user.Id }).then((res) => {
37
         this.data.list = this.list
38
         this.data.list = this.list

+ 7
- 4
src/router/index.js 查看文件

1
 import Vue from 'vue'
1
 import Vue from 'vue'
2
 import Router from 'vue-router'
2
 import Router from 'vue-router'
3
+import getCode from '@/page/getCode'
3
 import index from '@/page/index'
4
 import index from '@/page/index'
4
 import lotteryList from '@/page/lotteryList'
5
 import lotteryList from '@/page/lotteryList'
5
 import lotteryDetail from '@/page/lotteryDetail'
6
 import lotteryDetail from '@/page/lotteryDetail'
10
   routes: [
11
   routes: [
11
     {
12
     {
12
       path: '/',
13
       path: '/',
14
+      name: 'getCode',
15
+      component: getCode
16
+    },
17
+    {
18
+      path: '/index',
13
       name: 'index',
19
       name: 'index',
14
-      component: index,
15
-      meta: {
16
-        id: '1'
17
-      }
20
+      component: index
18
     },
21
     },
19
     {
22
     {
20
       path: '/lotteryList',
23
       path: '/lotteryList',

+ 10
- 14
src/store/app.js 查看文件

5
 // 请求数据
5
 // 请求数据
6
 http.getUserInfo = (data) => {
6
 http.getUserInfo = (data) => {
7
   return new Promise((resolve, reject) => {
7
   return new Promise((resolve, reject) => {
8
-    Ajax(api.system.getCode.url, {
9
-      method: api.system.getCode.method
10
-    }).then((result) => {
11
-      Ajax(api.lottery.userInfo.url, {
12
-        method: api.lottery.userInfo.method,
13
-        queryData: {
14
-          code: result.code,
15
-          luckdrawid: data.luckdrawid
16
-        }
17
-      }).then(res => {
18
-        resolve(res)
19
-      }).catch((err) => {
20
-        reject(err)
21
-      })
8
+    Ajax(api.lottery.userInfo.url, {
9
+      method: api.lottery.userInfo.method,
10
+      queryData: {
11
+        code: data.code,
12
+        luckdrawid: data.luckdrawid
13
+      }
14
+    }).then(res => {
15
+      resolve(res)
16
+    }).catch((err) => {
17
+      reject(err)
22
     })
18
     })
23
   })
19
   })
24
 }
20
 }

+ 1
- 8
src/util/api.js 查看文件

1
-import wechatConfig from '@/config/index'
2
-const baseUrl = '/api'
1
+const baseUrl = '/check-api'
3
 const wechat = ''
2
 const wechat = ''
4
 
3
 
5
 const $api = {
4
 const $api = {
28
       method: 'get',
27
       method: 'get',
29
       url: `${baseUrl}${wechat}/user/record/:id`
28
       url: `${baseUrl}${wechat}/user/record/:id`
30
     }
29
     }
31
-  },
32
-  system: {
33
-    getCode: {
34
-      method: 'get',
35
-      url: `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechatConfig.appid}&redirect_uri=${wechatConfig.redirect_uri}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
36
-    }
37
   }
30
   }
38
 }
31
 }
39
 export default $api
32
 export default $api

+ 17
- 0
src/util/util.js 查看文件

1
+import wechatConfig from '@/config/index'
1
 const toolClass = {
2
 const toolClass = {
2
   dateFormat: (timestamp) => {
3
   dateFormat: (timestamp) => {
3
     let date = new Date(timestamp)
4
     let date = new Date(timestamp)
19
       min = '0' + min
20
       min = '0' + min
20
     }
21
     }
21
     return y + '-' + m + '-' + d + ' ' + h + ':' + min
22
     return y + '-' + m + '-' + d + ' ' + h + ':' + min
23
+  },
24
+  UrlSearch: (urls) => {
25
+    let url = urls // 获取url中"?"符后的字串
26
+    let theRequest = {}
27
+    if (url.indexOf('?') !== -1) {
28
+      let str = url.substr(1)
29
+      let strs = str.split('&')
30
+      for (var i = 0; i < strs.length; i++) {
31
+        theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1])
32
+      }
33
+    }
34
+    return theRequest
35
+  },
36
+  getCode: () => {
37
+    let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechatConfig.appid}&redirect_uri=${wechatConfig.redirect_uri}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
38
+    window.location.href = url
22
   }
39
   }
23
 }
40
 }
24
 
41