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

商城修改

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