yuantianjiao 6 anni fa
parent
commit
ec97245fe7

+ 1
- 0
build/webpack.dev.conf.js Vedi File

@@ -23,6 +23,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
23 23
   // these devServer options should be customized in /config/index.js
24 24
   devServer: {
25 25
     clientLogLevel: 'warning',
26
+    disableHostCheck: true,
26 27
     historyApiFallback: {
27 28
       rewrites: [
28 29
         { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },

+ 1
- 1
config/index.js Vedi File

@@ -8,7 +8,7 @@ module.exports = {
8 8
   dev: {
9 9
     // Paths
10 10
     assetsSubDirectory: 'static',
11
-    assetsPublicPath: '/',
11
+    assetsPublicPath: '/game/luckdraw/',
12 12
     proxyTable: {
13 13
       '/check-api': {
14 14
         // target: 'https://dp.huiju360.com.cn/hj_operations',

+ 1
- 1
dist/index.html Vedi File

@@ -1 +1 @@
1
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>城的空间抽奖</title><link href=./static/css/app.56fd39569a46625134b8c88add3763e1.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.7b08adbe29df9913b077.js></script><script type=text/javascript src=./static/js/app.0e1ca6a038c6299e9a54.js></script></body></html>
1
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>城的空间抽奖</title><link href=./static/css/app.6477706d60e7d5b53195b59405338e1f.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.2a96777d0d5038fab28c.js></script><script type=text/javascript src=./static/js/app.5baff17cc3f4a4c75437.js></script></body></html>

+ 0
- 2
dist/static/css/app.56fd39569a46625134b8c88add3763e1.css
File diff suppressed because it is too large
Vedi File


+ 0
- 1
dist/static/css/app.56fd39569a46625134b8c88add3763e1.css.map
File diff suppressed because it is too large
Vedi File


+ 2
- 0
dist/static/css/app.6477706d60e7d5b53195b59405338e1f.css
File diff suppressed because it is too large
Vedi File


+ 1
- 0
dist/static/css/app.6477706d60e7d5b53195b59405338e1f.css.map
File diff suppressed because it is too large
Vedi File


+ 0
- 2
dist/static/js/app.0e1ca6a038c6299e9a54.js
File diff suppressed because it is too large
Vedi File


+ 0
- 1
dist/static/js/app.0e1ca6a038c6299e9a54.js.map
File diff suppressed because it is too large
Vedi File


+ 2
- 0
dist/static/js/app.5baff17cc3f4a4c75437.js
File diff suppressed because it is too large
Vedi File


+ 1
- 0
dist/static/js/app.5baff17cc3f4a4c75437.js.map
File diff suppressed because it is too large
Vedi File


+ 1
- 1
dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map Vedi File

@@ -1 +1 @@
1
-{"version":3,"sources":["webpack:///webpack/bootstrap f4d0c172a364d4c0e622"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,KAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.3ad1d5771e9b13dbdad2.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"./\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f4d0c172a364d4c0e622"],"sourceRoot":""}
1
+{"version":3,"sources":["webpack:///webpack/bootstrap 678f89f049567daa201d"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,KAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.3ad1d5771e9b13dbdad2.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"./\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 678f89f049567daa201d"],"sourceRoot":""}

+ 26
- 0
dist/static/js/vendor.2a96777d0d5038fab28c.js
File diff suppressed because it is too large
Vedi File


+ 1
- 0
dist/static/js/vendor.2a96777d0d5038fab28c.js.map
File diff suppressed because it is too large
Vedi File


+ 0
- 26
dist/static/js/vendor.7b08adbe29df9913b077.js
File diff suppressed because it is too large
Vedi File


+ 0
- 1
dist/static/js/vendor.7b08adbe29df9913b077.js.map
File diff suppressed because it is too large
Vedi File


+ 1
- 1
package.json Vedi File

@@ -31,7 +31,7 @@
31 31
     "babel-preset-stage-2": "^6.22.0",
32 32
     "chalk": "^2.0.1",
33 33
     "copy-webpack-plugin": "^4.0.1",
34
-    "css-loader": "^0.28.0",
34
+    "css-loader": "^0.28.11",
35 35
     "eslint": "^4.15.0",
36 36
     "eslint-config-standard": "^10.2.1",
37 37
     "eslint-friendly-formatter": "^3.0.0",

+ 1
- 1
src/components/qrCodeCard/qrCodeCard.vue Vedi File

@@ -32,7 +32,7 @@ export default {
32 32
       for (var Key in this.lessonType
33 33
       ) {
34 34
         if (parseInt(Key) === this.msg.course_type) {
35
-          codeText = this.lessonType[Key] + '-1'
35
+          codeText = `${this.lessonType[Key]}-${this.msg.record_id}-${this.msg.luckydraw_id}-1`
36 36
         }
37 37
       }
38 38
       const ele = document.querySelector('#QRcode')

+ 3
- 1
src/main.js Vedi File

@@ -18,13 +18,15 @@ Vue.prototype.$api = api
18 18
 Vue.prototype.$ajax = Ajax
19 19
 Vue.prototype.toolClass = toolClass
20 20
 // router.beforeEach((to, from, next) => {
21
+//   console.log(to)
22
+//   console.log(from)
21 23
 //   let userInfo = localStorage.getItem('userInfo')
22 24
 //   if (userInfo) {
23 25
 //     next()
24 26
 //   } else if (to.name === 'getCode') {
25 27
 //     next()
26 28
 //   } else {
27
-//     next({ name: 'getCode' })
29
+//     next({ name: 'getCode', query: { toName: to.name } })
28 30
 //   }
29 31
 // })
30 32
 /* eslint-disable no-new */

+ 15
- 13
src/page/getCode/getCode.vue Vedi File

@@ -15,26 +15,28 @@ export default {
15 15
   created () {
16 16
     let redirect = encodeURIComponent(window.location.href)
17 17
     if (location.search) {
18
-      this.code = this.toolClass.UrlSearch(location.search).code
19
-      this.getUserInfo({ code: this.code, luckdrawid: this.lotteryId }).then((res) => {
20
-        localStorage.setItem('userInfo', JSON.stringify(res))
21
-        this.$router.push({ name: this.name })
22
-      }).catch(() => {
18
+      if (this.toolClass.UrlSearch(location.search).code) {
19
+        this.code = this.toolClass.UrlSearch(location.search).code
20
+        this.getUserInfo({ code: this.code, luckdrawid: this.lotteryId }).then((res) => {
21
+          localStorage.setItem('userInfo', JSON.stringify(res))
22
+          if (this.$route.query.toName) {
23
+            this.$router.replace({ name: this.$route.query.toName })
24
+          } else {
25
+            this.$router.replace({ name: this.name })
26
+          }
27
+        }).catch(() => {
28
+          let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechatConfig.appid}&redirect_uri=${redirect}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
29
+          window.location.href = url
30
+        })
31
+      } else {
23 32
         let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechatConfig.appid}&redirect_uri=${redirect}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
24 33
         window.location.href = url
25
-      })
34
+      }
26 35
     } else {
27 36
       let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wechatConfig.appid}&redirect_uri=${redirect}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
28 37
       window.location.href = url
29 38
     }
30 39
   },
31
-  beforeRouteEnter (to, from, next) {
32
-    next(vm => {
33
-      if (from.name) {
34
-        vm.name = from.name
35
-      }
36
-    })
37
-  },
38 40
   computed: {
39 41
     ...mapState({
40 42
       userInfo: x => x.app.userInfo

+ 24
- 5
src/page/index/index.vue Vedi File

@@ -170,8 +170,24 @@ export default {
170 170
     }
171 171
   },
172 172
   created () {
173
-    this.data.userInfo = JSON.parse(localStorage.getItem('userInfo'))
174
-    this.getData()
173
+    if (location.search && this.toolClass.UrlSearch(location.search).code) {
174
+      this.code = this.toolClass.UrlSearch(location.search).code
175
+    } else {
176
+      this.code = null
177
+    }
178
+    this.getUserInfo({ code: this.code, luckdrawid: this.lotteryId }).then((res) => {
179
+      if (typeof (res) === 'string') {
180
+        console.log('isString')
181
+        if (res.indexOf('401-') > -1) {
182
+          this.toolClass.getCode(res.substring(4, res.length))
183
+        }
184
+      } else {
185
+        this.data.userInfo = this.userInfo
186
+        this.getData()
187
+      }
188
+    }).catch((err) => {
189
+      console.log(err)
190
+    })
175 191
   },
176 192
   computed: {
177 193
     ...mapState({
@@ -182,8 +198,11 @@ export default {
182 198
     })
183 199
   },
184 200
   methods: {
185
-    ...mapAppActions(['getUserInfo', 'getPrize', 'setPrize', 'getRecord']),
201
+    ...mapAppActions(['getUserInfo', 'getPrize', 'setPrize', 'getRecord', 'setUser']),
186 202
     getData () {
203
+      if (this.$route.params.id) {
204
+        this.setUser({ toId: this.data.userInfo.user.Id, fromId: this.$route.params.id })
205
+      }
187 206
       if (this.data.userInfo.record) {
188 207
         this.winning = this.data.userInfo.record.PrizeName
189 208
         this.showDialog = true
@@ -209,7 +228,7 @@ export default {
209 228
       wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
210 229
         title: '城的空间抽奖',
211 230
         desc: '抽奖小游戏',
212
-        link: window.location.href.split('?')[0],
231
+        link: `${window.location.origin}${window.location.pathname}/#/from/${this.data.userInfo.user.Id}`,
213 232
         thu_image: this.logo
214 233
       })
215 234
     },
@@ -287,7 +306,7 @@ export default {
287 306
 <style lang="scss" scoped>
288 307
 @font-face {
289 308
   font-family: myFont;
290
-  src: url("../../assets/hkhb.ttf");
309
+  src: url("https://spaceofcheng.oss-cn-beijing.aliyuncs.com/hkhb.ttf");
291 310
 }
292 311
 @import "page.scss";
293 312
 </style>

+ 5
- 1
src/page/lotteryDetail/index.vue Vedi File

@@ -23,7 +23,9 @@ export default {
23 23
         detail: {}
24 24
       },
25 25
       msg: {
26
-        course_type: 777
26
+        course_type: 777,
27
+        record_id: '',
28
+        luckydraw_id: ''
27 29
       },
28 30
       bottomMsg
29 31
     }
@@ -39,6 +41,8 @@ export default {
39 41
   created () {
40 42
     this.getLotteryDetail({ id: this.$route.query.id }).then((res) => {
41 43
       this.data.detail = this.detail
44
+      this.mag.luckydraw_id = this.data.detail.LuckdrawId
45
+      this.mag.record_id = this.data.detail.PrizeId
42 46
     })
43 47
   },
44 48
   methods: {

+ 19
- 3
src/page/lotteryList/index.vue Vedi File

@@ -32,9 +32,25 @@ export default {
32 32
     })
33 33
   },
34 34
   mounted () {
35
-    this.data.userInfo = JSON.parse(localStorage.getItem('userInfo'))
36
-    this.getLotteryList({ userid: this.data.userInfo.user.Id }).then((res) => {
37
-      this.data.list = this.list
35
+    if (location.search && this.toolClass.UrlSearch(location.search).code) {
36
+      this.code = this.toolClass.UrlSearch(location.search).code
37
+    } else {
38
+      this.code = null
39
+    }
40
+    this.getUserInfo({ code: this.code, luckdrawid: this.lotteryId }).then((res) => {
41
+      if (typeof (res) === 'string') {
42
+        console.log('isString')
43
+        if (res.indexOf('401-') > -1) {
44
+          this.toolClass.getCode(res.substring(4, res.length))
45
+        }
46
+      } else {
47
+        this.data.userInfo = this.userInfo
48
+        this.getLotteryList({ userid: this.data.userInfo.user.Id }).then((res) => {
49
+          this.data.list = this.list
50
+        })
51
+      }
52
+    }).catch((err) => {
53
+      console.log(err)
38 54
     })
39 55
   },
40 56
   methods: {

+ 11
- 5
src/router/index.js Vedi File

@@ -1,6 +1,6 @@
1 1
 import Vue from 'vue'
2 2
 import Router from 'vue-router'
3
-import getCode from '@/page/getCode/getCode'
3
+// import getCode from '@/page/getCode/getCode'
4 4
 import index from '@/page/index'
5 5
 import lotteryList from '@/page/lotteryList'
6 6
 import lotteryDetail from '@/page/lotteryDetail'
@@ -8,15 +8,21 @@ import lotteryDetail from '@/page/lotteryDetail'
8 8
 Vue.use(Router)
9 9
 
10 10
 export default new Router({
11
+  // mode: 'history',
11 12
   routes: [
13
+    // {
14
+    //   path: '/',
15
+    //   name: 'getCode',
16
+    //   component: getCode
17
+    // },
12 18
     {
13 19
       path: '/',
14
-      name: 'getCode',
15
-      component: getCode
20
+      name: 'index',
21
+      component: index
16 22
     },
17 23
     {
18
-      path: '/index',
19
-      name: 'index',
24
+      path: '/from/:id',
25
+      name: 'share',
20 26
       component: index
21 27
     },
22 28
     {

+ 38
- 5
src/store/app.js Vedi File

@@ -4,13 +4,18 @@ const http = {}
4 4
 
5 5
 // 请求数据
6 6
 http.getUserInfo = (data) => {
7
+  let queryData = {}
8
+  if (data.code) {
9
+    queryData = data
10
+  } else {
11
+    queryData = {
12
+      luckdrawid: data.luckdrawid
13
+    }
14
+  }
7 15
   return new Promise((resolve, reject) => {
8 16
     Ajax(api.lottery.userInfo.url, {
9 17
       method: api.lottery.userInfo.method,
10
-      queryData: {
11
-        code: data.code,
12
-        luckdrawid: data.luckdrawid
13
-      }
18
+      queryData: queryData
14 19
     }).then(res => {
15 20
       resolve(res)
16 21
     }).catch((err) => {
@@ -68,11 +73,30 @@ http.getRecord = (data) => {
68 73
   })
69 74
 }
70 75
 
76
+http.setUser = (data) => {
77
+  console.log('hjxzchvuisdhuvfhiskdzhvudsh')
78
+  return new Promise((resolve, reject) => {
79
+    Ajax(api.lottery.setUser.url, {
80
+      method: api.lottery.setUser.method,
81
+      urlData: {
82
+        id: data.toId
83
+      },
84
+      data: {
85
+        from: data.fromId
86
+      }
87
+    }).then(res => {
88
+      resolve(res)
89
+    }).catch((err) => {
90
+      reject(err)
91
+    })
92
+  })
93
+}
94
+
71 95
 export default {
72 96
   namespaced: true,
73 97
   state: {
74 98
     lotteryId: '1',
75
-    userInfo: localStorage.getItem('userInfo') || {}, // 用户信息
99
+    userInfo: {}, // 用户信息
76 100
     prize: {}, // 抽奖信息
77 101
     record: [] // 中奖列表
78 102
   },
@@ -121,6 +145,15 @@ export default {
121 145
           resolve(res)
122 146
         })
123 147
       })
148
+    },
149
+
150
+    setUser (context, data) {
151
+      console.log(data)
152
+      return new Promise((resolve) => {
153
+        http.setUser(data).then((res) => {
154
+          resolve(res)
155
+        })
156
+      })
124 157
     }
125 158
   }
126 159
 }

+ 7
- 2
src/util/ajax.js Vedi File

@@ -48,14 +48,19 @@ const ajax = (...args) => {
48 48
     Axios(...args).then(({ data }) => {
49 49
       const { Message, Status } = data
50 50
       if (Status) {
51
-        if (Message === 401) {
51
+        if (Message === 406) {
52 52
           window.location.href = 'http://dev.ycjcjy.com/c/#?isLottery=1'
53 53
         } else {
54 54
           resolve(Message)
55 55
         }
56 56
       } else {
57 57
         console.log(data)
58
-        Toast.fail(Message)
58
+        if (typeof (Message) === 'string' && Message.indexOf('401-') > -1) {
59
+          resolve(Message)
60
+        } else if (typeof (Message) === 'string' && Message.indexOf('没有找到') > -1) {
61
+        } else {
62
+          Toast.fail(Message)
63
+        }
59 64
       }
60 65
     }).catch(reject)
61 66
   })

+ 4
- 0
src/util/api.js Vedi File

@@ -32,6 +32,10 @@ const $api = {
32 32
     userRecordDetail: { // 用户中奖记录详情
33 33
       method: 'get',
34 34
       url: `${baseUrl}${wechat}/user/record/:id`
35
+    },
36
+    setUser: { // 分享发送userId
37
+      method: 'post',
38
+      url: `${baseUrl}${wechat}/luckdraw/:id/share`
35 39
     }
36 40
   }
37 41
 }

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

@@ -11,12 +11,13 @@ function wxsdk (params, config) {
11 11
     imgUrl: config.thu_image // 分享图标
12 12
   }
13 13
   // 初始化
14
+  console.log(shareData)
14 15
   return new Promise(function (resolve) {
15 16
     axios.post(api.common.shareWx.url + '?url=' + params.url)
16 17
       .then(function (res) {
17 18
         let result = JSON.parse(res.data)
18 19
         wx.config({
19
-          debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
20
+          debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
20 21
           appId: result.appId, // 必填,公众号的唯一标识
21 22
           timestamp: result.timestamp, // 必填,生成签名的时间戳
22 23
           nonceStr: result.noncestr, // 必填,生成签名的随机串

+ 2
- 2
src/util/util.js Vedi File

@@ -33,8 +33,8 @@ const toolClass = {
33 33
     }
34 34
     return theRequest
35 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`
36
+  getCode: (appid) => {
37
+    let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${wechatConfig.redirect_uri}&response_type=${wechatConfig.response_type}&scope=${wechatConfig.scope}&state=${wechatConfig.state}#wechat_redirect`
38 38
     window.location.href = url
39 39
   }
40 40
 }