You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< script setup >
/**
* name:
* user: sa0ChunLuyu
* date: 2022-04-19 14:58:23
*/
import {
ref
} from 'vue'
import {
getUserInfoAction ,
getConfigAction
} from '@/api/index.js'
const is _login = ref ( false )
const login _show = ref ( true )
const phone _show = ref ( true )
const props = defineProps ( {
type : {
type : String ,
default : 'fixed'
}
} ) ;
import {
onShow ,
} from '@dcloudio/uni-app'
onShow ( ( ) => {
getUserInfo ( )
} )
const toLogin = ( ) => {
let routes = getCurrentPages ( ) ;
let curRoute = routes [ routes . length - 1 ] . route
uni . setStorageSync ( 'JUMP_PATH' , '/' + curRoute )
uni . navigateTo ( {
url : '/pages/main/login/login'
} )
}
const getConfigPhone = ( ) => {
getConfigAction ( "'设置手机号'" , ( list ) => {
if ( Number ( list [ "设置手机号" ] . content ) === 2 ) {
login _show . value = false
phone _show . value = false
}
} )
}
const getUserInfo = ( ) => {
login _show . value = true
phone _show . value = true
is _login . value = false
getUserInfoAction ( ( info ) => {
is _login . value = true
if ( info . phone ) {
login _show . value = false
} else {
getConfigPhone ( )
}
} , false )
}
const toUserSetInfo = ( ) => {
uni . navigateTo ( {
url : '/pages/user/set_info/set_info'
} )
}
defineExpose ( {
getUserInfo
} )
< / script >
< template >
< view v-if ="login_show" >
< view class = "login_wrapper" v-if ="!is_login" :style="{
position: props.type
}" @click="toLogin()"></view>
<view class="phone_wrapper" v-if="phone_show" :style="{
position: props.type
}" @click="toUserSetInfo()" > < / view >
< / view >
< / template >
< style scoped >
. phone _wrapper {
top : 0 ;
bottom : 0 ;
left : 0 ;
right : 0 ;
background : # 000000 ;
opacity : 0 ;
z - index : 9998 ;
}
. login _wrapper {
top : 0 ;
bottom : 0 ;
left : 0 ;
right : 0 ;
background : # 000000 ;
opacity : 0 ;
z - index : 9999 ;
}
< / style >