Commit b1beab30 authored by xd's avatar xd

解决冲突4。8

parents 9b0dbe03 305c6a7e
......@@ -78,6 +78,7 @@ export default {
components: {},
data() {
return {
code: '',
type: "coupon",
freeze: false,
rolling: false,
......@@ -119,6 +120,9 @@ export default {
},
created() {
this.type = this.$route.query.type;
// 检测用户身份
// 获取code
this.zReadyUserId()
},
watch: {
prizeNumber() {
......@@ -136,6 +140,46 @@ export default {
}
},
methods: {
zReadyUserId() {
if (this.$route.query.code === undefined) {
alert("没code");
console.log('code', this.$route.query.code);
this.zTestPreAuthCode();
} else {
alert("有code");
// this.zTestGetNowUrlInfo();
// this.zTestGetUserInfoByOldToken();
}
},
// 获取code
zTestPreAuthCode() {
// alert('获取code')
const basicInfo = {
head: "https://open.weixin.qq.com/connect/oauth2/authorize?",
// appId: "wwd1cdbca7b8b2b6c4",
appId: "ww4df265003b43fa0d",
redirectUrI: encodeURIComponent("oysales.oywanhao.com:8087/activeDetail?id=2&type=wheel"),
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;
window.location.href = url;
},
Start_Game() {
this.rolling = true;
const { wheelDeg, prizeList } = this;
......
......@@ -23,7 +23,7 @@
<!-- <div class="menu">
<img class="menu-logo" :src="test.menuInfo.icon['1']" />
<div class="menu-text">优惠券核销</div>
</div> -->
</div>-->
<div class="menu" @click="menu02Click">
<img class="menu-logo" :src="test.menuInfo.icon['2']" />
<div class="menu-text">任务列表</div>
......@@ -111,9 +111,9 @@
</template>
<script>
import axios from "axios"
import axios from "axios";
import { getStoreDetail } from "@/api/sidebar/voucher";
import {configWx, getUserInfo} from "@/utils/aCommon"
import { configWx, getUserInfo } from "@/utils/aCommon";
import { getUserInfoByUserId } from "@/api/sidebar/voucher";
export default {
name: "discountIndex",
......@@ -191,12 +191,11 @@ export default {
"5": "/mainSale/icon-menuBar-5-ac.png"
}
}
},
}
},
dis: {},
oyStallCode: '',
userId: '',
oyStallCode: "",
userId: "",
zcache: {
nowUrl: "",
preAuthCodeUrl: "",
......@@ -205,7 +204,7 @@ export default {
userInfoResOld: "",
userInfoResNew: ""
}
}
};
},
created() {
if(sessionStorage.getItem('personalFan')) {
......@@ -225,8 +224,6 @@ export default {
this.zTestGetNowUrlInfo()
// this.oyStallCode = sessionStorage.getItem('oyStallCode')
// this.userId = sessionStorage.getItem('userId')
},
methods: {
// 获取用户信息
......@@ -237,7 +234,9 @@ export default {
};
axios({
url: "http://139.155.48.151:8085/workWx/auth/user/get?userId=" + this.zcache.userId,
url:
"http://139.155.48.151:8085/workWx/auth/user/get?userId=" +
this.zcache.userId,
method: "get",
headers: headerData
})
......@@ -248,7 +247,7 @@ export default {
sessionStorage.setItem("avatar", res.data.data.avatar)
})
.catch(err => {
console.log(err)
console.log(err);
});
},
getFans() {
......@@ -258,7 +257,9 @@ export default {
};
axios({
url: "http://139.155.48.151:8085/workWx/auth/contact/listExternalContacts?userId=" + this.zcache.userId,
url:
"http://139.155.48.151:8085/workWx/auth/contact/listExternalContacts?userId=" +
this.zcache.userId,
method: "get",
headers: headerData
})
......@@ -274,13 +275,13 @@ export default {
getStore() {
let params = {
oyStallCode: this.oyStallCode
}
};
getStoreDetail(params).then(res => {
if(res.data.stallInfo != null) {
this.test.manInfo.barName = res.data.stallInfo.name
sessionStorage.setItem("barName", res.data.stallInfo.name)
}
})
});
},
checkNowMenuBar() {
let inData = "1";
......@@ -292,11 +293,11 @@ export default {
},
switchBarClick() {
this.$router.push({
path:'ChangeCounter',
query:{
path: "ChangeCounter",
query: {
userId: this.zcache.userId
}
})
});
},
testButtonClick() {},
menu01Click() {},
......@@ -332,9 +333,9 @@ export default {
},
// 获取code
zReadyUserId() {
if (this.$route.query.code === undefined){
if (this.$route.query.code === undefined) {
// alert('没code')
this.zTestPreAuthCode()
this.zTestPreAuthCode();
} else {
// alert('有code')
this.zTestGetNowUrlInfo();
......@@ -345,7 +346,7 @@ export default {
zTestGetNowUrlInfo() {
this.zcache.nowUrl = JSON.stringify(this.$route.query);
this.zcache.code = String(this.$route.query.code);
this.url = this.zcache.nowUrl
this.url = this.zcache.nowUrl;
},
zTestPreAuthCode() {
// alert('获取code')
......@@ -379,39 +380,41 @@ export default {
// 测试-获取用户信息
zTestGetUserInfoByOldToken() {
let postData = {
code: this.zcache.code,
code: this.zcache.code
};
let headerData = {
agentId: "1000033",
corpId: "ww4df265003b43fa0d"
};
this.zcache.userInfoResOld = "PostData:" + JSON.stringify(postData)
this.zcache.userInfoResOld = "PostData:" + JSON.stringify(postData);
axios({
url: "http://139.155.48.151:8085/workWx/auth/oauth2/getUserInfo?code=" + this.zcache.code,
url:
"http://139.155.48.151:8085/workWx/auth/oauth2/getUserInfo?code=" +
this.zcache.code,
method: "post",
headers: headerData,
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)
this.getUserInfo()
sessionStorage.setItem("userId", String(res.data.data.userId));
this.zcache.userId = String(res.data.data.userId);
this.getUserFromId(this.zcache.userId);
this.getUserInfo();
})
.catch(err => {
console.log(err)
console.log(err);
});
},
getUserFromId(id) {
let userName = id
getUserInfoByUserId({ userName }).then(res => {
sessionStorage.setItem("oyStallCode",res.data[0].oyStallCode)
this.oyStallCode = res.data[0].oyStallCode
this.getStore()
this.getFans()
})
.catch(err => {
let userName = id;
getUserInfoByUserId({ userName })
.then(res => {
sessionStorage.setItem("oyStallCode", res.data[0].oyStallCode);
this.oyStallCode = res.data[0].oyStallCode;
this.getStore();
this.getFans();
})
.catch(err => {});
}
}
};
......
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