Commit 3b7064b1 authored by 小耗子's avatar 小耗子

商城修改

parent c9dd295e
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
"quickapp" : {}, "quickapp" : {},
/* 小程序特有相关 */ /* 小程序特有相关 */
"mp-weixin" : { "mp-weixin" : {
"appid" : "wx60c6530c49c52ff7", "appid" : "wx91fa336def077983",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"minified" : true "minified" : true
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
if (!res.code && res.data) { if (!res.code && res.data) {
let code = res.data.sfCode; let code = res.data.sfCode;
let time = new Date().getTime(); let time = new Date().getTime();
this.webUrl= `https://wxcs.zhonghuihaotai.com/webpage/wxdist/index.html#/${this.appointPage?this.appointPage:""}?mallId=106975910000477&companyId=999999998&time=${time}&sfCode=${code}&authMode=force` this.webUrl= `https://wxcs.zhonghuihaotai.com/webpage/wxdist/index.html#/${this.appointPage?this.appointPage:""}?mallId=119583623123146&companyId=625&time=${time}&sfCode=${code}&authMode=force`
// this.webUrl = `https://wxcs.zhonghuihaotai.com/webpage/wxdist/index.html#/?mallId=106975910000477&companyId=999999998&time=${time}&sfCode=${code}` // this.webUrl = `https://wxcs.zhonghuihaotai.com/webpage/wxdist/index.html#/?mallId=106975910000477&companyId=999999998&time=${time}&sfCode=${code}`
console.log(this.webUrl) console.log(this.webUrl)
} }
......
...@@ -84,6 +84,9 @@ ...@@ -84,6 +84,9 @@
this.actuallyPay = actuallyPay; this.actuallyPay = actuallyPay;
this.orderId = orderId; this.orderId = orderId;
this.params = JSON.parse(decodeURIComponent(data)); this.params = JSON.parse(decodeURIComponent(data));
},
onLaunch(){
console.log("关闭")
} }
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
...mapGetters(['userInfo', 'todayNum']) ...mapGetters(['userInfo', 'todayNum'])
}, },
methods: { methods: {
...mapActions(['getPhoneNumber', 'registerInfoFn', 'getWeRunDataFn', 'authCheck', 'getUserInfo']), ...mapActions(['getPhoneNumber', 'registerInfoFn', 'authCheck', 'getUserInfo']),
// 切换底部tab; // 切换底部tab;
changeTabBar() { changeTabBar() {
if (this.unregistered) { if (this.unregistered) {
...@@ -45,11 +45,12 @@ ...@@ -45,11 +45,12 @@
}, },
async authAndWeRun() { async authAndWeRun() {
let auth = await this.authCheck(); let auth = await this.authCheck();
console.log("调用authcheck的值"+auth)
let that = this;
if (auth == 0) { if (auth == 0) {
this.unregistered = true; that.unregistered = true;
} else if (auth == 2001) { } else if (auth == 2001) {
this.getUserInfo(); that.unregistered = false;
this.unregistered = false;
} }
}, },
async loginSession() { async loginSession() {
...@@ -69,6 +70,7 @@ ...@@ -69,6 +70,7 @@
*/ */
if (this.checkSessionStatus && token) { if (this.checkSessionStatus && token) {
let token = uni.getStorageSync('token'); let token = uni.getStorageSync('token');
console.log("token的值===================="+token)
this.authAndWeRun(); this.authAndWeRun();
} else { } else {
// session 不存在,调用login。userInfo 。更新session // session 不存在,调用login。userInfo 。更新session
...@@ -76,13 +78,11 @@ ...@@ -76,13 +78,11 @@
success: function(info) { //调用code success: function(info) { //调用code
console.log("code000000000000000000000000==========", info.code) console.log("code000000000000000000000000==========", info.code)
that.$store.commit('wxCode', info.code); //按钮切换全选。 that.$store.commit('wxCode', info.code); //按钮切换全选。
let userInfo = that.getUserInfo(); let userInfo = that.getUserInfo(info.code);
userInfo.then(res => { userInfo.then(res => {
that.authCheck().then(checkCode => { that.authCheck().then(checkCode => {
if (checkCode == 0) { if (checkCode == 0) {
that.unregistered = true; that.unregistered = true;
}else if(checkCode == 2001) {
that.unregistered = false;
} }
}) })
}) })
...@@ -95,7 +95,6 @@ ...@@ -95,7 +95,6 @@
let that = this; let that = this;
uni.checkSession({ //校验session uni.checkSession({ //校验session
success(res) { //有效 success(res) { //有效
console.log("有效session")
if (res.errMsg === "checkSession:ok") { if (res.errMsg === "checkSession:ok") {
that.checkSessionStatus = true; that.checkSessionStatus = true;
// 如果有缓存信息 // 如果有缓存信息
...@@ -110,22 +109,6 @@ ...@@ -110,22 +109,6 @@
}) })
} }
// async getAuth(){
// let token = uni.getStorageSync('token');
// // 如果有缓存信息
// if (token) {
// let auth = await this.authCheck();
// if(auth == 0) {
// this.unregistered = true;
// }else if(auth == 2001){
// this.unregistered = false;
// }
// } else {
// let getUserInfo = await this.getUserInfo();
// }
// }
}, },
onHide() {}, onHide() {},
onShow() { onShow() {
......
...@@ -2,22 +2,16 @@ ...@@ -2,22 +2,16 @@
import http from '@/shopro/request/index' import http from '@/shopro/request/index'
import api from "@/shopro/request/index"; import api from "@/shopro/request/index";
const state = { const state = {
mallId:'106975910000477', mallId:'119583623123146',
sessionkey: uni.getStorageSync("sessionkey") || "", sessionkey: uni.getStorageSync("sessionkey") || "",
userInfo: {}, userInfo: {},
registerInfo: {//注册信息 registerInfo: {//注册信息
companyId: '999999998', //开放式传 companyId: '625', //开放式传
mobile: '', //封闭式传 mobile: '', //封闭式传
empcardno: '', //封闭式传 empcardno: '', //封闭式传
registerType: 'register' //注册时的类型为普通注册 registerType: 'register' //注册时的类型为普通注册
}, },
wxCode:'', wxCode:'',
// weRunData:{//今日步数
// todayNum: 0,
// totalNum: 0,
// updateDate: "",
// yesterdayNum: 0
// },
todayNum:0, todayNum:0,
sessionStatus:false sessionStatus:false
} }
...@@ -27,7 +21,8 @@ const getters = { ...@@ -27,7 +21,8 @@ const getters = {
userInfo: state => state.userInfo, userInfo: state => state.userInfo,
todayNum: state => state.todayNum, todayNum: state => state.todayNum,
wxCode: state=> state.wxCode, wxCode: state=> state.wxCode,
sessionStatus: state=> state.sessionStatus sessionStatus: state=> state.sessionStatus,
mallId: state=>state.mallId
} }
const actions = { const actions = {
...@@ -41,12 +36,13 @@ const actions = { ...@@ -41,12 +36,13 @@ const actions = {
state state
}, code) { }, code) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let mallId = '106975910000477'
uni.setStorageSync("mallId", mallId) uni.setStorageSync("mallId", state.mallId);
let code = state.wxCode; // console.log(state.wxCode)
// let code = state.wxCode;
http('user.getHomePage', { http('user.getHomePage', {
code: code, code: code,
mallId: mallId mallId: state.mallId
}).then(res => { }).then(res => {
if (!res.code) { if (!res.code) {
let { sessionKey } = res.data; let { sessionKey } = res.data;
...@@ -75,13 +71,26 @@ const actions = { ...@@ -75,13 +71,26 @@ const actions = {
api("user.authCheck", { api("user.authCheck", {
mallId: mallId mallId: mallId
}).then(res => { }).then(res => {
console.log("authcheck状态码=========================")
console.log(res)
let data = res.data; let data = res.data;
if (res.code === 0) { if (res.code === 0) {
resolve(res.code) resolve(res.code)
} else if (res.code == 1001) { } else if (res.code == 2001) {
reject(res.code) uni.login({
success: function(info) { //调用code
state.wxCode == info.code;
dispatch('getUserInfo',info.code);
}
})
resolve(res.code);
} else { } else {
reject(res.code) uni.showToast({
title: res.msg,
duration: 2000,
icon:'none'
});
resolve(res.code)
} }
}); });
}) })
...@@ -140,12 +149,22 @@ const actions = { ...@@ -140,12 +149,22 @@ const actions = {
// 查询步数 // 查询步数
getWeRunDataFn({state}){ getWeRunDataFn({state}){
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
let wRunEncryptedData = {} // let wRunEncryptedData = {}
let data= ""
wx.getWeRunData({ wx.getWeRunData({
success: function(res) { success: function(res) {
wRunEncryptedData.encryptedData = encodeURIComponent(res.encryptedData); let obj = {
wRunEncryptedData.iv = encodeURIComponent(res.iv); encryptedData:res.encryptedData,
http('user.wxRun', wRunEncryptedData).then(res => { iv:res.iv,
sessionKey:uni.getStorageSync("sessionKey")
}
data = JSON.stringify(obj)
// wRunEncryptedData.encryptedData = encodeURIComponent(res.encryptedData);
// wRunEncryptedData.iv = encodeURIComponent(res.iv);
// wRunEncryptedData.sessionKey = encodeURIComponent(uni.getStorageSync("sessionKey") );
http('user.wxRun', {data:data}).then(res => {
console.log("微信步数++=========================")
console.log(res)
if (!res.code && res.data) { if (!res.code && res.data) {
state.todayNum = res.data.todayNum; state.todayNum = res.data.todayNum;
resolve(res.data); resolve(res.data);
...@@ -163,7 +182,7 @@ const actions = { ...@@ -163,7 +182,7 @@ const actions = {
fail:function(err){ fail:function(err){
console.log(err) console.log(err)
uni.showToast({ uni.showToast({
title: "您未开通微信运动,请关注微信运动公众号后重试", title: "您未授权微信步数,请点击右上角...进去设置开启授权",
duration: 2000, duration: 2000,
icon:'none' icon:'none'
}); });
...@@ -183,6 +202,7 @@ const mutations = { ...@@ -183,6 +202,7 @@ const mutations = {
wxCode(state,code) { wxCode(state,code) {
state.wxCode = code; state.wxCode = code;
} }
} }
export default { export default {
state, state,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment