From 3d2c065a0fccf4c8edb3147d8789321b75817919 Mon Sep 17 00:00:00 2001 From: tcubic <123456> Date: Tue, 2 Aug 2022 10:38:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.test | 2 +- src/api/httpServe.js | 2 ++ src/components/Index.vue | 27 +++++++-------------------- src/page/Home/Home.vue | 14 +++++++++++--- src/store/index.js | 18 +++++++++++++++++- 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/.env.test b/.env.test index 3c811a2..8198d79 100644 --- a/.env.test +++ b/.env.test @@ -5,7 +5,7 @@ NODE_ENV = 'test' VUE_APP_BASE_URL = 'https://test.szxgl.cn/zszq-celebration/activity/' // 业务接口 -VUE_APP_API = 'https://test.szxgl.cn/zszq-celebration' +VUE_APP_API = 'https://wealth.newone.com.cn' // CDN地址 VUE_APP_CDN = 'https://test.szxgl.cn/zszq-celebration/activity/' diff --git a/src/api/httpServe.js b/src/api/httpServe.js index 7d410e7..f99864d 100644 --- a/src/api/httpServe.js +++ b/src/api/httpServe.js @@ -1,6 +1,8 @@ import axios from 'axios' import QS from 'qs'; +console.log("API:",process.env.VUE_APP_API); + // 创建axios const service = axios.create({ // baseURL: 'https://hd.xglpa.com/pars-training', //生产环境 diff --git a/src/components/Index.vue b/src/components/Index.vue index 1266f5a..8e746a9 100644 --- a/src/components/Index.vue +++ b/src/components/Index.vue @@ -185,27 +185,14 @@ const btn = () => { const drawBtn = () => { console.log("抽奖:"); // console.log("授权:",getAuthorize(1)); - // let href = window.location.href; - // let h_idx = window.location.href.indexOf("#"); - // let out_href = href.slice(0, h_idx); - // service.get(process.env.VUE_APP_ZS_DOMAIN + '/wxauth/official/account/authorize',{params:{ - // redirectUrl: out_href, - // scope: 1, - // }}).then((res) => { - - // console.log("招商授权结果:",res); - // }) - - if (h5plugin.getQueryString("forceauth")) { - // H5P.getSetCookie('authState',1,{expires:0.5}) - console.log("yes-forceauth"); - getAuthorize(0); - } else { - // H5P.getSetCookie('authState',1,{expires:0.5}) - console.log("no-forceauth"); - getAuthorize(1); - } + // if (h5plugin.getQueryString("forceauth")) { + // console.log("yes-forceauth"); + // getAuthorize(0); + // } else { + // console.log("no-forceauth"); + // getAuthorize(1); + // } }; // 活动点击 diff --git a/src/page/Home/Home.vue b/src/page/Home/Home.vue index 237f0af..6e5df80 100644 --- a/src/page/Home/Home.vue +++ b/src/page/Home/Home.vue @@ -35,8 +35,7 @@ const authCode = ref('') // 页面未挂载 onBeforeMount(() => { - console.log("用户活动信息1:", store.state.userAccount); - console.log("授权链接:",window.location.href); + console.log("link:",window.location.href); // 微信环境授权 // if (h5plugin.isWX()) { @@ -49,9 +48,18 @@ onBeforeMount(() => { // } else { // getCode() // } - // } + // let token = h5plugin.getQueryString('token') + // 更新openid + store.commit({ type: "updateToken", token: h5plugin.getQueryString('token') }); + store.commit({ type: "updateCardId", cardId: h5plugin.getQueryString('cardId') }); + store.commit({ type: "updateNkh", cardId: h5plugin.getQueryString('nkh') }); + + + console.log("用户活动信息:", store.state.userAccount); + + }); diff --git a/src/store/index.js b/src/store/index.js index 32c6512..2d6c2fa 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -7,6 +7,8 @@ export default createStore({ userAccount: { xglOpenid: 'openid12138', //用户openid token: 'token12138', //用户token + cardId: '', //carid + nkh: '', //牛卡号 isDraw: false, //是否抽过奖 isHasAccount: false, //是否存在牛卡号 isAddCustomer: false, //是否添加过服务人员 @@ -24,7 +26,21 @@ export default createStore({ // 更新信广龙openid updateXGLOpenid(state, val) { state.userAccount.xglOpenid = val.openid - } + }, + + // 更新token + updateToken(state,val){ + state.userAccount.token = val.token + }, + + updateCardId(state,val){ + state.userAccount.cardId = val.cardId + }, + + updateNkh(state,val){ + state.userAccount.nkh = val.nkh + }, + }, // 改变方法:异步 actions: {},