69 lines
1.8 KiB
Vue
69 lines
1.8 KiB
Vue
<template>
|
|
<tpx-dialog v-model:show="lgDialog.show" :renderDefaultSlot="true" title="登录" :rootStyle="'min-height:auto;'">
|
|
<LoginComponent ref="lcRef" @succeedBack="handleLoginedBack"
|
|
@userinfoUpdateBack="handleUpdateUserInfoBanck"/>
|
|
</tpx-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import { USERKEY } from "@/store/actionKey"
|
|
import { getSessionLoginInfo, setSessionLoginInfo, setSessionXToken } from "@/session"
|
|
import { encrypt } from "@/common/libs/jsencrypt_utils"
|
|
import { promiseTimeout, showToast } from "@/common/untool"
|
|
import { getCurrentInstance } from "vue"
|
|
import { sysEventNames } from "@/common/enum"
|
|
|
|
// #ifdef MP
|
|
import LoginComponent from "@/components/buns-api/login/mp-login"
|
|
// #endif
|
|
|
|
// #ifndef MP
|
|
import LoginComponent from "@/components/buns-api/login/com-login"
|
|
// #endif
|
|
|
|
export default {
|
|
components: { LoginComponent },
|
|
data() {
|
|
return {
|
|
lgDialog: { show: false },
|
|
}
|
|
},
|
|
computed: {
|
|
|
|
},
|
|
created() {
|
|
uni.$on(sysEventNames.login, this.triggerLogin)
|
|
},
|
|
mounted(){
|
|
},
|
|
unmounted(){
|
|
uni.$off(sysEventNames.login, this.triggerLogin)
|
|
},
|
|
methods: {
|
|
async handleLoginedBack() {
|
|
await promiseTimeout(300)
|
|
await this.$store.dispatch(USERKEY.GETUSERINFO)
|
|
this.reloadCurrentPage(this) // 刷新当前页面
|
|
},
|
|
async handleUpdateUserInfoBanck(){
|
|
this.lgDialog.show = false
|
|
await this.$store.dispatch(USERKEY.GETUSERINFO)
|
|
this.reloadCurrentPage(this) // 刷新当前页面
|
|
},
|
|
async handleCheckUserInfo() {
|
|
let bl = await this.$refs.lcRef.handleCheckUserInfo()
|
|
this.lgDialog.show = !bl
|
|
return bl
|
|
},
|
|
async triggerLogin(){
|
|
setSessionXToken() // 登录前先清除xtoke
|
|
await this.$refs.lcRef.initData()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
</style>
|