TraceabilityAPP/pages/index/personal.vue

200 lines
3.8 KiB
Vue
Raw Permalink Normal View History

2023-11-21 18:54:33 +08:00
<template>
<view class="head">
2023-11-30 17:51:39 +08:00
<!-- #ifdef APP-PLUS -->
<view class="head-return">
<Myindex url='/pages/index/personal' />
2023-11-21 18:54:33 +08:00
</view>
2023-11-30 17:51:39 +08:00
<!-- #endif -->
<view class="head-con">
<view class="avater">
<u--image @click="previewImageFn" :src="userinfo.avatar" width="130.28rpx" height="130.28rpx"
shape="circle"></u--image>
</view>
<view class="" v-if="Object.keys(userinfo).length>0">
2023-11-27 18:23:17 +08:00
2023-11-30 17:51:39 +08:00
<view class="head-li">
2023-12-14 11:27:14 +08:00
{{userinfo.nickname}}
2023-11-30 17:51:39 +08:00
</view>
<view class="head-li">
电话: {{userinfo.mobile}}
</view>
<!-- <view class="head-li">
公司: 里海弄农业科技有限公司
</view> -->
2023-11-21 18:54:33 +08:00
</view>
2023-11-30 17:51:39 +08:00
<view class="" v-else @click="revto('/pages/Login/login')">
请登录
2023-11-21 18:54:33 +08:00
</view>
2023-11-25 16:18:54 +08:00
</view>
2023-11-21 18:54:33 +08:00
</view>
2024-01-03 19:11:45 +08:00
<view class="content" style="position: relative;">
<view class="card"
style="border-radius: 10rpx;position: absolute;left:50%;transform: translateX(-50%);top: -100rpx;">
2023-11-21 18:54:33 +08:00
<view class="card-li" v-for="(item,index) in cardLiList" :key="index" @click="navto(item.nav)">
<view class="" style="display: flex;align-items: center;">
<view class="" style="margin-right: 20rpx;">
2023-12-14 11:27:14 +08:00
<u-icon size="20" name="lock"></u-icon>
2023-11-21 18:54:33 +08:00
</view>
<view class="">
{{item.text}}
</view>
</view>
<view class="">
<u-icon name="arrow-right" size="16"></u-icon>
</view>
</view>
</view>
2024-01-03 19:11:45 +08:00
</view>
<view class="out-btn">
<up-button @click="loginOutFn" type="primary" customStyle="border:none;height:90rpx;border-radius: 500rpx;"
color="#EC6857" text="退出登录" v-if="Object.keys(userinfo).length>0"></up-button>
2023-11-21 18:54:33 +08:00
</view>
2023-12-25 00:26:32 +08:00
<MyTabbar></MyTabbar>
2023-11-21 18:54:33 +08:00
</template>
<script setup lang="ts">
2023-12-25 00:26:32 +08:00
import MyTabbar from "@/components/customTabbar/tabbar.vue"
2023-11-30 17:51:39 +08:00
import Myindex from '@/components/return/index.vue';
2023-11-21 18:54:33 +08:00
import {
reactive,
ref
} from 'vue';
import { logout } from '@/api/api.js'
2024-01-02 18:18:57 +08:00
import {
onLoad
} from "@dcloudio/uni-app"
2023-11-27 18:23:17 +08:00
import store from "@/store/index.js"
2023-11-27 18:23:17 +08:00
const userinfo = reactive({})
2023-11-30 17:51:39 +08:00
if (store.state.userInfo != null) {
Object.assign(userinfo, store.state.userInfo)
2023-11-27 18:23:17 +08:00
}
2023-11-21 18:54:33 +08:00
const previewImageFn = () => {
uni.previewImage({
urls: [
userinfo.avatar
2023-11-21 18:54:33 +08:00
]
});
}
2024-01-02 18:18:57 +08:00
onLoad(() => {
uni.hideTabBar()
})
2023-11-27 18:23:17 +08:00
const cardLiList = reactive([
{
text: "安全设置",
nav: "/pages/updatePassword/updatePassword"
},
2023-11-21 18:54:33 +08:00
])
const loginOutFn = () => {
2023-11-27 18:23:17 +08:00
if (store.state.userInfo) {
logout().then((res) => {
if (res.code == 1) {
uni.$u.toast('退出登录');
uni.navigateTo({
url: "/pages/Login/login"
})
uni.clearStorageSync()
}
})
} else {
uni.navigateTo({
url: "/pages/Login/login"
})
}
2023-11-21 18:54:33 +08:00
}
const navto = (url) => {
uni.navigateTo({
url
})
}
2023-11-25 16:18:54 +08:00
const revto = (url) => {
2023-11-27 18:23:17 +08:00
2023-11-25 16:18:54 +08:00
uni.redirectTo({
url
})
}
2023-11-21 18:54:33 +08:00
</script>
2023-11-30 17:51:39 +08:00
<style lang="scss">
page {
background-color: $theme-bg-color;
}
2023-11-30 17:51:39 +08:00
2023-11-21 18:54:33 +08:00
.head {
height: 25vh;
color: white;
2023-11-30 17:51:39 +08:00
padding-top: 30rpx;
position: relative;
2023-12-17 19:34:37 +08:00
position: relative;
2024-01-03 19:11:45 +08:00
background-image: url('/static/main/index/wo.png');
background-size: 100% 100%;
2023-11-30 17:51:39 +08:00
.head-con {
display: flex;
align-items: center;
2023-12-17 19:34:37 +08:00
position: absolute;
2024-01-03 19:11:45 +08:00
bottom: 120rpx // margin-top: 150rpx;
2023-11-30 17:51:39 +08:00
}
2023-11-21 18:54:33 +08:00
.head-li {
margin: 10rpx 0;
}
.avater {
margin: 0 40rpx;
}
2023-11-30 17:51:39 +08:00
.head-return {
margin-top: 30rpx;
margin-left: calc(100% - 200rpx);
2023-12-14 11:27:14 +08:00
2023-11-30 17:51:39 +08:00
}
2023-11-21 18:54:33 +08:00
}
.content {
2023-11-30 17:51:39 +08:00
2023-12-14 11:27:14 +08:00
// padding-top: 30rpx;
2023-11-21 18:54:33 +08:00
.card {
background-color: white;
border-radius: 10rpx;
2023-12-14 11:27:14 +08:00
width: 90vw;
transform: translateY(-50rpx);
2023-11-21 18:54:33 +08:00
.card-li {
height: 80rpx;
line-height: 80rpx;
// background-color: red;
border-bottom: 1px solid #F5F5F5;
display: flex;
justify-content: space-between;
align-items: center;
}
}
2023-12-14 11:27:14 +08:00
2024-01-03 19:11:45 +08:00
}
2023-12-14 11:27:14 +08:00
2024-01-03 19:11:45 +08:00
.out-btn {
width: 693.93rpx;
position: absolute;
bottom: 140rpx;
left: 50%;
transform: translateX(-50%);
2023-11-21 18:54:33 +08:00
}
</style>