Commit f309e747 authored by xd's avatar xd

专柜切换和我的

parent 3a8494b2
......@@ -30,8 +30,8 @@ export default {
list: []
}
},
created() {
this.radio = this.$route.query.userId
created() {
this.radio = sessionStorage.getItem('oyStallCode')
this.getList()
},
methods: {
......
......@@ -278,7 +278,6 @@ export default {
this.$router.push("counterInfo");
},
switchBarClick() {
// this.$router.push("ChangeCounter");
this.$router.push({
path:'ChangeCounter',
query:{
......
......@@ -131,8 +131,6 @@
},
mounted() {
this.checkNowMenuBar()
// this.zReadyUserId()
this.zTestGetNowUrlInfo()
},
methods: {
......@@ -155,93 +153,7 @@
},
menuCase() {
this.$router.push({ path: "/case" });
},
// 获取code
zReadyUserId() {
if (this.$route.query.code === undefined){
// alert('没code')
this.zTestPreAuthCode()
} else {
// alert('有code')
this.zTestGetNowUrlInfo();
this.zTestGetUserInfoByOldToken();
}
},
// 测试-获取当前Url信息
zTestGetNowUrlInfo() {
this.zcache.nowUrl = JSON.stringify(this.$route.query);
this.zcache.code = String(this.$route.query.code);
this.url = this.zcache.nowUrl
},
zTestPreAuthCode() {
// alert('获取code')
const basicInfo = {
head: "https://open.weixin.qq.com/connect/oauth2/authorize?",
// appId: "wwd1cdbca7b8b2b6c4",
appId: "ww4df265003b43fa0d",
redirectUrI: encodeURIComponent("oysales.oywanhao.com:8087"),
responseType: "code",
scope: "snsapi_base",
state: "ztest",
tail: "#wechat_redirect"
};
let url =
basicInfo.head +
"appid=" +
basicInfo.appId +
"&redirect_uri=" +
basicInfo.redirectUrI +
"&response_type=" +
basicInfo.responseType +
"&scope=" +
basicInfo.scope +
"&state=" +
basicInfo.state +
basicInfo.tail;
this.zcache.preAuthCodeUrl = url;
window.location.href = url;
},
// 测试-获取用户信息
zTestGetUserInfoByOldToken() {
let postData = {
code: this.zcache.code,
};
let headerData = {
agentId: "1000033",
corpId: "ww4df265003b43fa0d"
};
this.zcache.userInfoResOld = "PostData:" + JSON.stringify(postData)
axios({
url: "http://139.155.48.151:8085/workWx/auth/oauth2/getUserInfo?code=" + this.zcache.code,
method: "post",
headers: headerData,
})
.then(res => {
// alert('获取用户信息接口成功')
sessionStorage.setItem("userId", String(res.data.data.userId))
this.zcache.userId = String(res.data.data.userId)
this.getUserFromId(this.zcache.userId)
})
.catch(err => {
console.log(err)
});
},
getUserFromId(id) {
let userName = id
getUserInfoByUserId({ userName }).then(res => {
// alert('获取成功')
sessionStorage.setItem("oyStallCode",res.data[0].oyStallCode)
this.storeCode = res.data[0].oyStallCode
})
.catch(err => {
})
},
handleDetail(type){
if(type === 'message'){
this.$router.push('/message')
}
}
}
}
};
</script>
......
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