kitchendDevice/pages/me/me.vue

160 lines
3.4 KiB
Vue
Raw Normal View History

2023-09-08 15:17:21 +08:00
<template>
<view class="content">
2025-03-25 10:17:30 +08:00
<view class="head" v-if="token" @tap="navTo('/pageTwo/setting/setting')">
<view class="left">
<!-- <icon class="t-icon t-icon-nvtouxiang"></icon> -->
<image :src="info.head_pic"></image>
<text>{{info.nickname}}</text>
</view>
<view class="right">
<uni-icons type="forward" size="20" color="#666"></uni-icons>
</view>
2023-09-08 15:17:21 +08:00
</view>
<view class="list">
<view class="item" @tap="navTo('/pageTwo/me/mymenu?pageName=我的菜谱')">
<text>我的菜谱</text>
2025-03-25 10:17:30 +08:00
<uni-icons type="forward" size="20" color="#666"></uni-icons>
2023-09-08 15:17:21 +08:00
</view>
<view class="item" @tap="navTo('/pageTwo/me/mymenu?pageName=我的收藏')">
<text>我的收藏</text>
2025-03-25 10:17:30 +08:00
<uni-icons type="forward" size="20" color="#666"></uni-icons>
2023-09-08 15:17:21 +08:00
</view>
<view class="item" @tap="navTo('/pageTwo/me/userEdit')">
<text>个人资料</text>
2025-03-25 10:17:30 +08:00
<uni-icons type="forward" size="20" color="#666"></uni-icons>
2023-09-08 15:17:21 +08:00
</view>
<view class="item" @tap="navTo('/pageTwo/me/record')">
<text>饮食记录</text>
2025-03-25 10:17:30 +08:00
<uni-icons type="forward" size="20" color="#666"></uni-icons>
2023-09-08 15:17:21 +08:00
</view>
2025-03-25 10:17:30 +08:00
<!-- <view class="item" @tap="navTo('/pageTwo/me/feedBack')">
2023-09-08 15:17:21 +08:00
<text>联系客服</text>
2025-03-25 10:17:30 +08:00
<uni-icons type="forward" size="20" color="#666"></uni-icons>
</view> -->
2023-09-08 15:17:21 +08:00
</view>
2025-03-25 10:17:30 +08:00
<view class="btn " v-if="token" @click="handleOutLogin">退出登录</view>
2025-04-02 09:49:39 +08:00
<view class=" btn" v-if="!token" @click="handleLogin">登录后查看更多</view>
2023-09-08 15:17:21 +08:00
</view>
</template>
<script>
2025-03-25 10:17:30 +08:00
import {
mapState
} from "vuex";
2023-09-08 15:17:21 +08:00
export default {
data() {
return {
token: null
}
},
2025-03-25 10:17:30 +08:00
computed: {
...mapState(["user"]),
info() {
2025-04-02 09:49:39 +08:00
return this.user
2025-03-25 10:17:30 +08:00
},
},
2023-09-08 15:17:21 +08:00
onLoad() {
let that = this
that.token = uni.getStorageSync('token')
},
methods: {
handleOutLogin() {
let that = this
uni.showModal({
title: '友情提示',
content: '是否退出登录?',
success: function(res) {
if (res.confirm) {
2025-03-25 10:17:30 +08:00
that.$model.getloginOut({}).then((res) => {
2023-09-08 15:17:21 +08:00
that.$tools.msg(res.message)
if (res.code != 0) return
2025-03-25 10:17:30 +08:00
that.token = null
2023-09-08 15:17:21 +08:00
uni.setStorageSync('token', null)
2025-04-02 09:49:39 +08:00
uni.clearStorageSync()
uni.reLaunch({
url: "/pageTwo/login/login"
})
2023-09-08 15:17:21 +08:00
})
} else if (res.cancel) {
that.$tools.msg("您已取消操作!");
}
},
})
},
2025-04-02 09:49:39 +08:00
handleLogin(){
uni.reLaunch({
url:"/pageTwo/login/login"
})
},
2023-09-08 15:17:21 +08:00
navTo(url) {
2025-04-02 09:49:39 +08:00
if (!uni.getStorageSync('token')) {
this.$tools.msg("登录后查看等多!")
return
}
2023-09-08 15:17:21 +08:00
uni.navigateTo({
url
})
},
}
}
</script>
<style scoped lang="scss">
.content {
padding: 0 15px;
min-height: 100vh;
}
.head {
width: 100%;
2025-03-25 10:17:30 +08:00
height: 5rem;
2023-09-08 15:17:21 +08:00
background: #fff;
display: flex;
align-items: center;
border-radius: 10px;
font-size: 16px;
font-weight: bold;
2025-03-25 10:17:30 +08:00
.left {
width: calc(100% - 30px);
display: flex;
align-items: center;
}
image {
2023-09-08 15:17:21 +08:00
width: 50px;
height: 50px;
margin: 0 15px;
}
}
2025-03-25 10:17:30 +08:00
.btnlogin {
color: #fff;
margin: auto;
padding: 8px 15px;
background: $btncolor;
border-radius: 5px;
font-weight: 500 !important;
}
2023-09-08 15:17:21 +08:00
.list {
width: 100%;
background: #fff;
margin: 15px;
border-radius: 10px;
line-height: 50px;
.item {
display: flex;
justify-content: space-between;
margin: 0 15px;
border-bottom: 1px solid #f7f7f7;
}
}
.btn {
width: 100%;
color: #fff;
}
2025-03-25 10:17:30 +08:00
</style>