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.

104 lines
1.9 KiB
Vue

This file contains ambiguous Unicode characters!

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
* usersa0ChunLuyu
* date2022-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>