Browse Source

合并

master
Gaoxs 5 years ago
parent
commit
90cb82c1c5
  1. 193
      pages/Loading/index.vue

193
pages/Loading/index.vue

@ -1,110 +1,105 @@
<template> <template>
<view class="lottie-bg"> <view class="lottie-bg">
<view id="lottie"> <view id="lottie">
<image src="../../static/images/live-logo.gif" rel="preload" mode="widthFix" style="width: 100%;" /> <image src="../../static/images/live-logo.gif" rel="preload" mode="widthFix" style="width: 100%;" />
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { mapState, mapMutations, mapActions } from "vuex"; import {
// mapState,
// import request from "@//api/request"; mapMutations,
import { wxappAuth, getUser } from "@/api/user"; mapActions
import dayjs from "dayjs"; } from "vuex";
import cookie from "@/utils/store/cookie"; //
import { parseQuery, login, handleQrCode ,getCurrentPageUrl,handleUrlParam} from "@/utils"; // import request from "@//api/request";
import {
wxappAuth,
getUser
} from "@/api/user";
import dayjs from "dayjs";
import cookie from "@/utils/store/cookie";
import {
parseQuery,
login,
handleQrCode,
getCurrentPageUrl,
handleUrlParam
} from "@/utils";
export default { export default {
name: "Loading", name: "Loading",
data() { data() {
return {}; return {};
}, },
onShow() { onShow() {
var url = handleQrCode(); var url = handleQrCode();
if(!url){ if (!url) {
url = handleUrlParam(getCurrentPageUrl()) url = handleUrlParam(getCurrentPageUrl())
} }
// //
if (url) { if (url) {
var spread = cookie.get("spread"); var spread = cookie.get("spread");
let urlSpread = parseInt(url.spread); let urlSpread = parseInt(url.spread);
if (!Number.isNaN(urlSpread) && spread !== urlSpread) { if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
cookie.set("spread", urlSpread || 0); cookie.set("spread", urlSpread || 0);
} else if (spread === 0 || typeof spread !== "number") { } else if (spread === 0 || typeof spread !== "number") {
cookie.set("spread", urlSpread || 0); cookie.set("spread", urlSpread || 0);
} }
if (this.$store.getters.token) { if (this.$store.getters.token) {
this.toLaunch(); this.toLaunch();
return; return;
} }
// cookie.get("spread"); if (this.$deviceType == "app" || this.$deviceType == "h5") {
// if (this.$deviceType == "weixin") { this.$yrouter.switchTab({
// let path = parseQuery().path path: "/pages/home/index"
// console.log(this) });
// if (path) { return;
// this.$yrouter.push({ }
// path login().finally(() => {
// }); this.$yrouter.switchTab({
// } else { path: "/pages/home/index"
// this.$yrouter.switchTab({ });
// path: "/pages/home/index" });
// }); }
// } },
methods: {
// return ...mapActions(["changeAuthorization", "setUserInfo"]),
// } toLaunch() {
// this.toLaunch(); console.log("loading home");
if (this.$deviceType == "app" || this.$deviceType == "h5") { this.changeAuthorization(false);
// this.toLaunch(); this.$yrouter.switchTab({
path: "/pages/home/index"
this.$yrouter.switchTab({ });
path: "/pages/home/index" }
}); }
return; };
}
login().finally(() => {
this.$yrouter.switchTab({
path: "/pages/home/index"
});
});
},
methods: {
...mapActions(["changeAuthorization", "setUserInfo"]),
toLaunch() {
console.log("loading home");
this.changeAuthorization(false);
this.$yrouter.switchTab({
path: "/pages/home/index"
});
}
}
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.lottie-bg { .lottie-bg {
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
background-color: #fff; background-color: #fff;
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 999; z-index: 999;
display: -webkit-flex; display: -webkit-flex;
display: flex; display: flex;
-webkit-align-items: center; -webkit-align-items: center;
align-items: center; align-items: center;
-webkit-justify-content: center; -webkit-justify-content: center;
justify-content: center; justify-content: center;
} }
#lottie { #lottie {
width: 35%; width: 35%;
display: block; display: block;
overflow: hidden; overflow: hidden;
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0);
margin: auto; margin: auto;
} }
</style> </style>

Loading…
Cancel
Save