11 changed files with 349 additions and 323 deletions
@ -1,116 +1,103 @@ |
|||||||
<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="`${$VUE_APP_RESOURCES_URL}/images/live-logo.gif`" rel="preload" mode="widthFix" style="width: 100%;" /> |
||||||
</view> |
</view> |
||||||
</view> |
</view> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
import { |
import { mapState, mapMutations, mapActions } from 'vuex' |
||||||
mapState, |
// 组件 |
||||||
mapMutations, |
// import request from "@//api/request"; |
||||||
mapActions |
import { wxappAuth } from '@/api/user' |
||||||
} from "vuex"; |
import dayjs from 'dayjs' |
||||||
// 组件 |
import store from '@/store' |
||||||
// import request from "@//api/request"; |
import cookie from '@/utils/store/cookie' |
||||||
import { |
import { parseQuery, login, handleQrCode, getCurrentPageUrl, handleUrlParam, getCurrentPageUrlWithArgs } from '@/utils' |
||||||
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 { |
export default { |
||||||
name: "Loading", |
name: 'Loading', |
||||||
data() { |
data() { |
||||||
return {}; |
return {} |
||||||
}, |
}, |
||||||
onShow() { |
onShow() { |
||||||
console.log('getUser') |
console.log('getUser') |
||||||
var url = handleQrCode(); |
var url = handleQrCode() |
||||||
if (!url) { |
if (!url) { |
||||||
url = handleUrlParam(getCurrentPageUrlWithArgs()) |
url = handleUrlParam(getCurrentPageUrlWithArgs()) |
||||||
} |
} |
||||||
console.log(url) |
console.log(url) |
||||||
console.log('判断是否是分销') |
console.log('判断是否是分销') |
||||||
// 判断是否是分销 |
// 判断是否是分销 |
||||||
if (url) { |
if (url) { |
||||||
let urlSpread = parseInt(url.spread); |
let urlSpread = parseInt(url.spread) |
||||||
if (urlSpread) { |
if (urlSpread) { |
||||||
cookie.set("spread", urlSpread); |
cookie.set('spread', urlSpread) |
||||||
} |
|
||||||
} |
} |
||||||
if (this.$deviceType == "app" || this.$deviceType == "weixinh5") { |
} |
||||||
|
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({ |
this.$yrouter.switchTab({ |
||||||
path: "/pages/home/index" |
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> |
</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…
Reference in new issue