|
@@ -46,18 +46,25 @@ export default {
|
|
|
console.log("--option-", option);
|
|
|
this.options = option;
|
|
|
},
|
|
|
- onShow() {
|
|
|
+ async onShow() {
|
|
|
+ // 刷新令牌
|
|
|
+ if (this.options.user_account) {
|
|
|
+ await this.doRequest();
|
|
|
+ }
|
|
|
if (this.$method.isGoLogin()) {
|
|
|
// 扫二维码进来的没登录需要跳到登录页,登录后返回
|
|
|
return;
|
|
|
}
|
|
|
+ // #ifdef H5
|
|
|
+ this.options.scene = window.atob(this.options.scene);
|
|
|
+ // #endif
|
|
|
+
|
|
|
if (this.options.scene) {
|
|
|
this.optObj = {};
|
|
|
let arrs = decodeURIComponent(this.options.scene).split("&");
|
|
|
for (let i = 0; i < arrs.length; i++) {
|
|
|
this.optObj[arrs[i].split("=")[0]] = arrs[i].split("=")[1];
|
|
|
}
|
|
|
- console.log("this.optObj", this.optObj);
|
|
|
}
|
|
|
// 有a字段是标识是扫二维码进来的
|
|
|
if (this.optObj.a == 1) {
|
|
@@ -88,12 +95,21 @@ export default {
|
|
|
...mapGetters(["userInfo", "config"]),
|
|
|
},
|
|
|
methods: {
|
|
|
+ async doRequest() {
|
|
|
+ const res = await this.$api.refreshToken(this.options.user_account);
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ uni.setStorageSync("token", res.data.data.token);
|
|
|
+ this.$store.state.userInfo = null;
|
|
|
+ return Promise.resolve();
|
|
|
+ } else {
|
|
|
+ return Promise.reject("请求错误");
|
|
|
+ }
|
|
|
+ },
|
|
|
getInfo() {
|
|
|
// /app/user/getInfo 登录用户信息 // fromPlat来源平台 1小程序 2PC网站
|
|
|
this.$api.getInfo({ fromPlat: 1 }).then((res) => {
|
|
|
if (res.data.code == 200) {
|
|
|
this.$store.state.userInfo = res.data.data;
|
|
|
- // console.log('this.userInfo', this.userInfo)
|
|
|
this.getParam();
|
|
|
}
|
|
|
});
|