240 lines
4.4 KiB
Vue
240 lines
4.4 KiB
Vue
<template>
|
|
<view class="app">
|
|
<image class="circular" src="../../static/homepage.png" mode=""></image>
|
|
<view class="user" v-if="Personallist">
|
|
<image class="img" src="../../static/user2.png" mode=""></image>
|
|
<view class="phone" v-if="Personallist.realName">
|
|
{{Personallist.realName}}
|
|
</view>
|
|
<view class="nickname" v-if="Personallist.userName">
|
|
{{Personallist.userName}}
|
|
</view>
|
|
</view>
|
|
<view class="user" v-else>
|
|
<image class="img" src="../../static/user2.png" mode=""></image>
|
|
<view class="login" @tap='gologin'>
|
|
登录
|
|
</view>
|
|
</view>
|
|
<view class="bottomitems">
|
|
<view class="bottomitem" @tap='goremove'>
|
|
<image src="../../static/shezhi.png" mode=""></image>
|
|
<view class="">
|
|
退出账号
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import {
|
|
info
|
|
} from '@/api/user/index.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
Personallist: undefined,
|
|
}
|
|
},
|
|
onLoad() {
|
|
if (uni.getStorageSync('examh5token')) {
|
|
this.myInfo()
|
|
}
|
|
},
|
|
methods: {
|
|
myInfo() {
|
|
info({
|
|
token: uni.getStorageSync('examh5token')
|
|
}).then(res => {
|
|
if (res.code == 0) {
|
|
uni.setStorageSync("examh5token", res.data.token)
|
|
uni.setStorageSync("examh5user", {
|
|
id: res.data.id,
|
|
phone: res.data.phone,
|
|
name: res.data.realName,
|
|
cardNo: res.data.userName
|
|
})
|
|
this.Personallist = res.data
|
|
}
|
|
})
|
|
},
|
|
//跳登录
|
|
gologin() {
|
|
uni.reLaunch({
|
|
url: '/pages/login/login'
|
|
})
|
|
},
|
|
//退出账号
|
|
goremove() {
|
|
let that = this
|
|
const value = uni.getStorageSync('examh5token');
|
|
if (value) {
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: '确认要退出此账号吗',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
uni.clearStorageSync();
|
|
that.Personallist = undefined
|
|
that.$refs.uToast.show({
|
|
title: '退出账号成功!',
|
|
type: 'success',
|
|
duration: '1000'
|
|
})
|
|
if (that.timer) {
|
|
clearTimeout(that.timer)
|
|
}
|
|
that.timer = setTimeout(e => {
|
|
that.gologin();
|
|
}, 1000)
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
that.$refs.uToast.show({
|
|
title: '您未登录',
|
|
type: 'error',
|
|
duration: '1000'
|
|
})
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #fff;
|
|
}
|
|
|
|
.app {
|
|
padding: 0;
|
|
font-size: 32rpx;
|
|
height: calc(100vh - 100rpx);
|
|
|
|
.bottomitems {
|
|
position: absolute;
|
|
bottom: 50rpx;
|
|
width: 100%;
|
|
|
|
.bottomitem {
|
|
width: 85%;
|
|
margin: 0 auto;
|
|
height: 120rpx;
|
|
position: relative;
|
|
border-bottom: 1rpx solid #F3F3F3;
|
|
|
|
view {
|
|
display: inline-block;
|
|
font-size: 35rpx;
|
|
color: #333333;
|
|
line-height: 120rpx;
|
|
margin-left: 80rpx;
|
|
}
|
|
|
|
image {
|
|
position: absolute;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
display: inline-block;
|
|
width: 50rpx;
|
|
height: 50rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.topitems {
|
|
z-index: 999;
|
|
padding: 45rpx 0 35rpx;
|
|
width: 94%;
|
|
margin: 0 auto;
|
|
display: flex;
|
|
background: #FFFFFF;
|
|
box-shadow: 0rpx 3rpx 18rpx 0rpx rgba(79, 108, 254, 0.43);
|
|
border-radius: 5rpx;
|
|
justify-content: space-around;
|
|
text-align: center;
|
|
position: relative;
|
|
|
|
.topitem {
|
|
view {
|
|
font-size: 32rpx;
|
|
margin-top: 10rpx;
|
|
}
|
|
|
|
image {
|
|
width: 90rpx;
|
|
height: 90rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.user {
|
|
width: 100%;
|
|
height: 500rpx;
|
|
position: relative;
|
|
color: #FFFFFF;
|
|
font-size: 38rpx;
|
|
z-index: 999;
|
|
|
|
.modify {
|
|
position: absolute;
|
|
right: 3%;
|
|
top: 250rpx;
|
|
font-size: 28rpx;
|
|
|
|
image {
|
|
width: 23rpx;
|
|
height: 23rpx;
|
|
padding-left: 10rpx;
|
|
}
|
|
}
|
|
|
|
.login {
|
|
text-align: center;
|
|
position: absolute;
|
|
top: 220rpx;
|
|
left: 35%;
|
|
font-size: 36rpx;
|
|
width: 180rpx;
|
|
line-height: 70rpx;
|
|
border: 1rpx solid #fff;
|
|
height: 70rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.nickname {
|
|
position: absolute;
|
|
top: 260rpx;
|
|
left: 35%;
|
|
font-size: 28rpx;
|
|
}
|
|
|
|
.phone {
|
|
position: absolute;
|
|
top: 180rpx;
|
|
left: 35%;
|
|
}
|
|
|
|
.img {
|
|
width: 160rpx;
|
|
height: 160rpx;
|
|
border-radius: 50%;
|
|
background: #F6F6F6;
|
|
position: absolute;
|
|
top: 170rpx;
|
|
left: 8%;
|
|
// border: 4rpx solid #6DD8FC;
|
|
}
|
|
}
|
|
|
|
.circular {
|
|
z-index: 1;
|
|
width: 100%;
|
|
height: 500rpx;
|
|
position: absolute;
|
|
top: 0;
|
|
}
|
|
}
|
|
</style> |