303 lines
6.8 KiB
Vue
303 lines
6.8 KiB
Vue
<template>
|
|
<view class="content">
|
|
<view v-if="token" style="width: 100%;">
|
|
<view class="head" v-if="info.aud_id" @click="navTo('/pageTwo/setting/setting')">
|
|
<view class="left">
|
|
<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>
|
|
</view>
|
|
<view class="head " v-else @click="handleUserEdit">
|
|
<text class="size22">{{$t('msgAddUser')}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="list">
|
|
<view class="item" @click="navTo('/pageTwo/me/userEdit')">
|
|
<view class="left">
|
|
<image src="/static/11.png" mode=""></image>{{$t('infoPersonalProfile')}}
|
|
</view>
|
|
<uni-icons type="forward" size="20" color="#666"></uni-icons>
|
|
</view>
|
|
<!-- <view class="item" @click="navTo('/pageTwo/me/mymenu?pageName=我的菜谱')">
|
|
<view class="left">
|
|
<image src="/static/12.png" mode=""></image>{{$t('infoMyRecipes')}}
|
|
</view>
|
|
<uni-icons type="forward" size="20" color="#666"></uni-icons>
|
|
</view>
|
|
<view class="item" @click="navTo('/pageTwo/me/mymenu?pageName=我的收藏')">
|
|
<view class="left">
|
|
<image src="/static/27.png" mode=""></image>{{$t('infoMyCollection')}}
|
|
</view>
|
|
<uni-icons type="forward" size="20" color="#666"></uni-icons>
|
|
</view> -->
|
|
|
|
<view class="item" @click="navTo('/pageTwo/me/record')">
|
|
<view class="left">
|
|
<image src="/static/13.png" mode=""></image>{{$t('titleHistory')}}
|
|
</view>
|
|
<uni-icons type="forward" size="20" color="#666"></uni-icons>
|
|
</view>
|
|
|
|
<!-- #ifdef APP-PLUS -->
|
|
<view class="item" @click="navTo('/pageTwo/me/about')">
|
|
<view class="left">
|
|
<image src="/static/27.png" mode=""></image>{{$t('titleAboutUs')}}
|
|
</view>
|
|
<uni-icons type="forward" size="20" color="#666"></uni-icons>
|
|
</view>
|
|
<!-- #endif -->
|
|
<view class="item">
|
|
<view class="left">
|
|
<image src="/static/12.png" mode=""></image>{{$t('titleLanguage')}}
|
|
</view>
|
|
<view class="right">
|
|
<picker mode="selector" @change="changeClickLanguage" :range="languageList" range-key="name"
|
|
:value="levelInd">
|
|
<view>
|
|
{{languageList[levelInd].name}}
|
|
<icon class="iconfont icon-arrow-down"></icon>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="item"
|
|
@click="navTo('/pageTwo/webview/webview?url=' + configInfo.business_cooperation.jump_url)">
|
|
<view class="left">
|
|
<image src="/static/14.png" mode=""></image>{{$t('BusinessCooperation')}}
|
|
</view>
|
|
<uni-icons type="forward" size="20" color="#666"></uni-icons>
|
|
</view> -->
|
|
</view>
|
|
<view class="btn" v-if="!token" @click="handleLogin">{{$t('msgLoginTips')}}</view>
|
|
<view class="btn " v-if="token" @click="handleOutLogin">{{$t('btnLogOut')}}</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState
|
|
} from "vuex";
|
|
export default {
|
|
data() {
|
|
return {
|
|
token: null,
|
|
levelInd: 0,
|
|
}
|
|
},
|
|
computed: {
|
|
...mapState(["user", 'configInfo', "setLocale"]),
|
|
info() {
|
|
return this.user
|
|
},
|
|
languageList() {
|
|
let that = this
|
|
let languageList = this.configInfo.language_arr
|
|
that.levelInd = languageList.findIndex(ite => ite.key == this.setLocale)
|
|
return this.configInfo.language_arr
|
|
}
|
|
},
|
|
onShow() {
|
|
let that = this
|
|
console.log(that.languageList, that.setLocale)
|
|
that.token = uni.getStorageSync('token')
|
|
},
|
|
methods: {
|
|
handleOutLogin() {
|
|
let that = this
|
|
uni.showModal({
|
|
title: that.$t('msgTitle'),
|
|
content: that.$t('verifyOutLogin'),
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.$model.getloginOut({}).then((res) => {
|
|
that.$tools.msg(res.message)
|
|
if (res.code != 0) return
|
|
that.token = null
|
|
uni.setStorageSync('token', null)
|
|
uni.reLaunch({
|
|
url: "/pageTwo/login/login"
|
|
})
|
|
})
|
|
} else if (res.cancel) {
|
|
that.$tools.msg($t('msgCancel'));
|
|
}
|
|
},
|
|
})
|
|
},
|
|
handleLogin() {
|
|
uni.reLaunch({
|
|
url: "/pageTwo/login/login"
|
|
})
|
|
},
|
|
// 语言切换
|
|
changeClickLanguage(e) {
|
|
let that = this
|
|
let key = that.languageList[e.target.value].key
|
|
let val = that.languageList[e.target.value].val
|
|
that.levelInd = e.target.value
|
|
|
|
that.$model.getSetLanguage({
|
|
language: val,
|
|
}).then(res => {
|
|
that.$i18n.locale = key
|
|
uni.setStorageSync('language', key)
|
|
that.$store.commit('changeLocale', key)
|
|
that.$store.dispatch("getHomeConfig")
|
|
that.$store.dispatch("getUserInfo")
|
|
that.handleTabBarItem()
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
url: '/pages/index/index'
|
|
})
|
|
}, 500)
|
|
})
|
|
},
|
|
handleTabBarItem() {
|
|
let that = this
|
|
uni.setTabBarItem({
|
|
index: 0,
|
|
text: that.$t('titleHome')
|
|
})
|
|
uni.setTabBarItem({
|
|
index: 1,
|
|
text: that.$t('titleCount')
|
|
})
|
|
uni.setTabBarItem({
|
|
index: 2,
|
|
text: that.$t('titleMe')
|
|
})
|
|
},
|
|
|
|
//个人资料
|
|
handleUserEdit() {
|
|
uni.navigateTo({
|
|
url: '/pageTwo/me/userEdit'
|
|
})
|
|
},
|
|
navTo(url) {
|
|
if (!uni.getStorageSync('token')) {
|
|
this.$tools.msg(this.$t('msgLoginTips'))
|
|
return
|
|
}
|
|
uni.navigateTo({
|
|
url
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.content {
|
|
min-height: calc(100vh - 40rpx);
|
|
background-color: #fff;
|
|
padding-top: 40rpx;
|
|
}
|
|
|
|
.size22 {
|
|
width: 100%;
|
|
text-align: center;
|
|
color: #fff;
|
|
}
|
|
|
|
.head {
|
|
width: 100%;
|
|
height: 5rem;
|
|
background: $maincolor;
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 16px;
|
|
font-weight: bold;
|
|
padding-bottom: 40rpx;
|
|
margin-top: -40rpx;
|
|
|
|
.left {
|
|
width: calc(100% - 60rpx);
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
image {
|
|
width: 100rpx;
|
|
height: 100rpx;
|
|
margin: 0 30rpx;
|
|
}
|
|
}
|
|
|
|
.btnlogin {
|
|
color: #fff;
|
|
margin: auto;
|
|
padding: 8px 30rpx;
|
|
background: $btncolor;
|
|
border-radius: 5px;
|
|
font-weight: 500 !important;
|
|
}
|
|
|
|
.list {
|
|
width: 100%;
|
|
background: #fff;
|
|
margin: 30rpx;
|
|
border-radius: 20rpx;
|
|
line-height: 100rpx;
|
|
margin-top: -40rpx;
|
|
|
|
.item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin: 0 30rpx;
|
|
border-radius: 40rpx;
|
|
background: #FEF9F4;
|
|
margin-top: 30rpx;
|
|
padding: 0 20rpx;
|
|
|
|
.left {
|
|
// width: 70%;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.right {
|
|
width: 50%;
|
|
|
|
view {
|
|
width: 100%;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
}
|
|
}
|
|
|
|
image {
|
|
width: 50rpx;
|
|
height: 50rpx;
|
|
margin-right: 20rpx;
|
|
}
|
|
}
|
|
|
|
:nth-child(2).item {
|
|
background-color: #F2FDEE;
|
|
}
|
|
|
|
:nth-child(3).item {
|
|
background-color: #FFEEFF;
|
|
}
|
|
|
|
:nth-child(4).item {
|
|
background-color: #DBF2F9;
|
|
}
|
|
|
|
:nth-child(5).item {
|
|
background-color: #FFEEFF;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
width: calc(100% - 60rpx);
|
|
margin-left: 30rpx;
|
|
color: #fff;
|
|
margin-bottom: 40rpx;
|
|
}
|
|
</style> |