aircraft-pilot/aircraft/server/my/my.vue

223 lines
5.1 KiB
Vue
Raw Normal View History

2025-07-02 14:58:38 +08:00
<template>
<view class="aircraft-my">
2025-07-23 18:49:22 +08:00
<view class="my-top">
<u-image width="100%" :src="fileUrl+topBg" mode="widthFix" />
<view class="my-identity">
<u-image class="my-avatar" width="120rpx" height="120rpx"
2025-08-03 01:01:22 +08:00
:src="ordFileUrl+(isPilot||!customer.gender?pilotIcon:(customer.gender === '男' ? boyIcon : girlIcon))" />
2025-07-23 18:49:22 +08:00
<view class="my-self">
<text>{{ userMessage.nickName || userMessage.username || '用户' }}</text>
<text>欢迎来到爱尚云愿您有个美好体验</text>
</view>
</view>
</view>
<view class="function-list">
<view class="functions">
<view class="function-item" v-for="(item,index) in isPilot?functions:functions.slice(2)"
:key="index" @click="handleClickFunction(item)">
2025-07-23 18:49:22 +08:00
<view class="fi-left"><u-icon :name="fileUrl+item.icon" size="50" />{{ item.name }}</view>
<u-icon name="arrow-right" color="#ccc" size="30" />
</view>
</view>
</view>
<view class="my-loginout" @click="loginout">
退出登录
</view>
2025-07-02 14:58:38 +08:00
<u-toast ref="uToast"></u-toast>
</view>
</template>
<script>
2025-07-23 18:49:22 +08:00
import configService from '@/common/config.service.js';
2025-07-02 14:58:38 +08:00
export default {
// #ifdef MP
options: {
styleIsolation: 'shared'
},
// #endif
props: {
2025-08-03 01:01:22 +08:00
isPilot: {
type: Boolean,
default: true
2025-07-02 14:58:38 +08:00
},
isLogin: {
type: String,
default: ''
}
},
data(){
return{
2025-07-23 18:49:22 +08:00
//我的页图标基础路径
fileUrl: configService.fileUrl + 'aerocraft/my/',
2025-08-03 01:01:22 +08:00
ordFileUrl: configService.fileUrl + 'aerocraft/order/',//订单页图标基础路径
2025-07-23 18:49:22 +08:00
// 轮播图
2025-07-31 01:06:16 +08:00
topBg: 'top-bg-a.png',
2025-08-03 01:01:22 +08:00
// 女生头像
girlIcon: 'girl.png',
// 男生头像
boyIcon: 'boy.png',
// 飞行员默认头像
pilotIcon: 'pilot-avatar.png',
2025-07-02 14:58:38 +08:00
// 用户信息
2025-07-23 18:49:22 +08:00
// userMessage:{}
userMessage: this.$store.state.vuex_token === ''?{}:JSON.parse(this.$store.state.user_message),
2025-08-03 01:01:22 +08:00
// 客户信息
customer: {},
2025-07-23 18:49:22 +08:00
// 功能列表
functions: [{
name: '历史订单',
icon: 'history.png',
2025-07-31 01:06:16 +08:00
url: '/aircraft/server/my/child_pages/history'
2025-07-23 18:49:22 +08:00
},{
name: '个人信息',
icon: 'self.png',
url: '/aircraft/server/my/child_pages/setting'
2025-07-23 18:49:22 +08:00
},{
name: '修改密码',
icon: 'password.png',
url: '/aircraft/server/my/child_pages/reset-password'
}],
2025-07-02 14:58:38 +08:00
}
},
computed:{
},
methods:{
// 初始化
2025-08-03 01:01:22 +08:00
async init(){
this.userMessage = this.isLogin === '' ? {} : JSON.parse(this.$store.state.user_message);
if(this.userMessage.id){
let res = await this.$api.bSelfDetail(this.userMessage.id);
this.customer = res === undefined ? {} : res;
2025-07-02 14:58:38 +08:00
}
2025-07-23 18:49:22 +08:00
},
// 功能栏点击
handleClickFunction({url}){
if(url) uni.navigateTo({url: url})
},
// 退出登录
2025-07-23 18:49:22 +08:00
loginout(){
let that = this;
2025-07-23 18:49:22 +08:00
uni.showModal({
title: '退出登录',
content: '是否确认退出登录?',
confirmColor: '#f7c04d',
success: async(res) => {
if (res.confirm) {
await that.$api.logout();
that.$u.vuex('vuex_token', '');
that.$u.vuex('user_message', {});
uni.setStorageSync('current',0);
uni.reLaunch({
url: '/aircraft/server/my/child_pages/login',
complete() {
setTimeout(()=>{
uni.showToast({
icon: 'none',title: '退出登录成功!'
})
},300);
}
})
}
}
2025-07-23 18:49:22 +08:00
})
2025-07-02 14:58:38 +08:00
}
}
}
</script>
<style scoped lang="scss">
.aircraft-my{
2025-07-23 18:49:22 +08:00
display: flex;
flex-direction: column;
height: 100%;
.my-top{
width: 100%;
position: relative;
.my-identity{
position: absolute;
top: 220rpx;
width: 100%;
padding: 0 30rpx;
display: flex;
align-items: center;
.my-avatar{
margin-right: 30rpx;
&::v-deep .u-image__image{
border: 2rpx solid #fff;
border-radius: 100% !important;
}
}
.my-self{
display: flex;
flex-direction: column;
height: 100rpx;
justify-content: space-between;
text{
&:nth-child(1){
font-size: 36rpx;
color: #000;
}
font-family: Source Han Sans SC;
font-weight: bold;
font-size: 28rpx;
color: #111;
}
}
}
}
.function-list{
margin-top: -200rpx;
width: 100%;
flex: 1;
z-index: 1;
background: #f5f5f5;
border-radius: 20rpx;
.functions{
margin: 70rpx 30rpx 0;
background-color: #FFFFFF;
border-radius: 24rpx;
padding: 20rpx 0;
box-shadow: 0rpx 4rpx 14rpx 0rpx rgba(202,202,182,0.5);
.function-item{
padding: 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-family: Source Han Sans SC;
font-weight: bold;
font-size: 32rpx;
color: #111;
.fi-left{
line-height: 50rpx;
display: flex;
align-items: center;
::v-deep .u-icon{
margin-right: 16rpx;
}
}
&:active{
background-color: #f7f7f7;
}
}
}
}
.my-loginout{
margin: auto 40rpx 40rpx;
border-radius: 12rpx;
font-family: Source Han Sans SC;
font-weight: bold;
background-color: #fa4a43;
font-size: 30rpx;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
padding: 30rpx 0;
&:active{
margin: auto 50rpx 40rpx;
padding: 28rpx 0;
background-color: #fab6b6;
}
}
2025-07-02 14:58:38 +08:00
}
</style>