Files
Gaoxs 95a8589448 1.修改小程序段拼团未登录情况下无法进行登录回跳的问题
2.新增订单扫码核销的功能
3.修改cookie方法未取到值返回null导致报错的问题
4.修改loading页面跳转登录的问题
2020-11-06 11:51:10 +08:00

115 lines
2.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="lottie-bg">
<view id="lottie">
<image src="../../static/images/live-logo.gif" rel="preload" mode="widthFix" style="width: 100%;" />
</view>
</view>
</template>
<script>
import {
mapState,
mapMutations,
mapActions
} from "vuex";
// 组件
// import request from "@//api/request";
import {
wxappAuth,
} from "@/api/user";
import dayjs from "dayjs";
import store from "@/store";
import cookie from "@/utils/store/cookie";
import {
parseQuery,
login,
handleQrCode,
getCurrentPageUrl,
handleUrlParam,
getCurrentPageUrlWithArgs
} from "@/utils";
export default {
name: "Loading",
data() {
return {};
},
onShow() {
console.log('getUser')
var url = handleQrCode();
if (!url) {
url = handleUrlParam(getCurrentPageUrlWithArgs())
}
// 判断是否是分销
if (url) {
let urlSpread = parseInt(url.spread);
if (urlSpread) {
cookie.set("spread", urlSpread);
}
}
if (this.$deviceType == "app" || this.$deviceType == "weixinh5") {
this.$yrouter.switchTab({
path: "/pages/home/index"
});
return;
}
if (this.$store.getters.token) {
// 如果token存在直接进行进页面
console.log('登录状态存在,直接进页面')
this.toLaunch();
return;
}
console.log('进行登录操作')
login().finally(() => {
this.$yrouter.switchTab({
path: "/pages/home/index"
});
});
},
methods: {
...mapActions(["changeAuthorization", "setUserInfo", "getUser"]),
toLaunch() {
console.log("loading home");
this.changeAuthorization(false);
let redirect = cookie.get('redirect').replace(/\ /g, '')
if (redirect && redirect.indexOf('/pages') != -1) {
this.$yrouter.replace({
path: '/pages' + redirect.split('/pages')[1],
});
cookie.remove('redirect');
} else {
this.$yrouter.switchTab({
path: "/pages/home/index"
});
}
}
}
};
</script>
<style scoped lang="less">
.lottie-bg {
position: fixed;
left: 0;
top: 0;
background-color: #fff;
width: 100%;
height: 100%;
z-index: 999;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
}
#lottie {
width: 35%;
display: block;
overflow: hidden;
transform: translate3d(0, 0, 0);
margin: auto;
}
</style>