examTeamApp/pages/my/me.vue

287 lines
6.6 KiB
Vue
Raw Normal View History

2024-05-29 16:35:45 +08:00
<template>
<view class="content">
<!-- 头部 -->
2024-10-11 10:04:19 +08:00
<view class="top" @click="navTo('/pageTwo/setting/setting')">
2024-06-13 18:03:50 +08:00
<view class="headimg">
<image :src="user.head_pic" class="image"></image>
<view class="size20 bold">{{user.nickname}}</view>
</view>
<text class="t-icon t-icon-arrow-right-bold"></text>
</view>
2024-05-29 16:35:45 +08:00
<!-- -->
<view class="wxlist borderRadius">
2024-10-11 10:04:19 +08:00
<view class="list" @click="navTo('/pageTwo/my/manage')">
2024-05-29 16:35:45 +08:00
<view class="item border-bottom">
<view class="left">
2025-04-18 14:53:38 +08:00
<view class="name">{{$t("common.titleManage")}}</view>
2024-05-29 16:35:45 +08:00
</view>
<view class="right">
<uni-icons type="right"></uni-icons>
</view>
</view>
</view>
2025-04-26 13:35:30 +08:00
<view class="list" @click="navTo('/pageTwo/history/history?acd_id=2')" v-if="language!= 'zh-Hans'">
<view class="item border-bottom">
<view class="left">
<view class="name">{{$t("common.titleHistory")}}</view>
</view>
<view class="right">
<uni-icons type="right"></uni-icons>
</view>
</view>
</view>
2025-04-18 14:53:38 +08:00
<!-- <view class="list" @click="navTo('/pageTwo/business/business')">
2024-05-29 16:35:45 +08:00
<view class="item border-bottom">
<view class="left">
2025-04-18 14:53:38 +08:00
<view class="name">{{$t("common.titlebBusiness")}}</view>
2024-05-29 16:35:45 +08:00
</view>
<view class="right">
<uni-icons type="right"></uni-icons>
</view>
</view>
2025-04-18 14:53:38 +08:00
</view> -->
<view class="list" @click="navTo('/pageTwo/score/history')" v-if="language== 'zh-Hans'">
2024-05-29 16:35:45 +08:00
<view class="item border-bottom">
<view class="left">
2025-04-18 14:53:38 +08:00
<view class="name">{{$t("common.titleScoreHistory")}}</view>
2024-05-29 16:35:45 +08:00
</view>
<view class="right">
<uni-icons type="right"></uni-icons>
</view>
</view>
</view>
2024-12-10 14:14:28 +08:00
<!-- #ifdef APP-PLUS -->
<view class="list" @click="navTo('/pageTwo/my/about')">
<view class="item border-bottom">
<view class="left">
2025-04-18 14:53:38 +08:00
<view class="name">{{$t("common.titleAboutUs")}}</view>
</view>
<view class="right">
<uni-icons type="right"></uni-icons>
</view>
</view>
</view>
2025-04-26 13:35:30 +08:00
<view class="list">
<view class="picker item">
<view class="name">{{$t("common.titleLanguage")}}</view>
<picker mode="selector" :range="languageList" :value="index" range-key="value"
@change="languageClick">
<view class="uni-input">{{languageList[index].value}}</view>
<icon class="iconfont icon-arrow-down-bold"></icon>
</picker>
</view>
</view>
2024-12-10 14:14:28 +08:00
<!-- #endif -->
<view class="list" v-for="(ite,ind) in CooperationUrl" :key="ind">
<view class="item border-bottom" @click="navTo('/pageTwo/webview/webview?url=' + ite.url)">
2024-07-22 14:13:19 +08:00
<view class="left">
2024-12-10 14:14:28 +08:00
<view class="name">{{ite.title}}</view>
2024-07-22 14:13:19 +08:00
</view>
<view class="right">
<uni-icons type="right"></uni-icons>
</view>
</view>
</view>
2024-05-29 16:35:45 +08:00
</view>
2025-04-18 14:53:38 +08:00
<view class="btn mb-15" v-if="token" @click="handleOutLogin">{{$t("common.btnLogOut")}}</view>
2024-05-29 16:35:45 +08:00
</view>
</template>
<script>
2024-06-13 18:03:50 +08:00
import {
mapState
} from "vuex";
import headerIndex from "@/element/headerIndex.vue"
2024-05-29 16:35:45 +08:00
export default {
data() {
return {
2024-06-13 18:03:50 +08:00
token: "",
2025-04-18 14:53:38 +08:00
user: {},
2025-04-26 13:35:30 +08:00
language: "",
index: 0,
2024-05-29 16:35:45 +08:00
}
},
components: {
headerIndex
},
2024-06-13 18:03:50 +08:00
computed: {
2025-04-26 13:35:30 +08:00
...mapState(["accountNumber", "familayList", "CooperationUrl", 'languageList']),
2024-06-13 18:03:50 +08:00
nickname() {
return this.accountNumber.nickname
},
userList() {
return this.familayList
}
},
2024-05-29 16:35:45 +08:00
onLoad() {
2024-06-13 18:03:50 +08:00
let that = this
2025-04-30 16:47:18 +08:00
uni.setNavigationBarTitle({
title: that.$t('common.titleMe')
})
2025-04-26 13:35:30 +08:00
that.language = uni.getStorageSync('language')
that.index = that.languageList.findIndex(ite => ite.key == that.language)
2024-06-13 18:03:50 +08:00
that.token = uni.getStorageSync('token')
that.handleAccountNumber()
},
watch: {
nickname() {
this.user = {}
this.user = this.accountNumber
}
2024-05-29 16:35:45 +08:00
},
2024-07-26 16:43:31 +08:00
onPullDownRefresh() {
let that = this
that.token = uni.getStorageSync('token')
that.handleAccountNumber()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1000);
},
2024-05-29 16:35:45 +08:00
methods: {
2024-06-13 18:03:50 +08:00
handleAccountNumber() {
let that = this
that.$model.getAccountNumber({}).then(res => {
console.log("账号信息", res)
if (res.code != 0) {
that.$tools.msg(res.msg)
return
}
that.user = res.data
that.$store.commit('changeAccountNumber', res.data)
}).catch(err => {})
},
2024-05-29 16:35:45 +08:00
handleOutLogin() {
let that = this
uni.showModal({
2025-04-18 14:53:38 +08:00
title: that.$t('tips.msgTitle'),
content: that.$t('tips.verifyOutLogin'),
cancelText: that.$t('tips.btnSancellation'),
confirmText: that.$t('tips.btnConfirm'),
2024-05-29 16:35:45 +08:00
success: function(res) {
if (res.confirm) {
that.$model.getloginOut({}).then((res) => {
if (res.code != 0) return
2025-04-18 14:53:38 +08:00
uni.$emit('need-login');
2024-05-29 16:35:45 +08:00
})
} else if (res.cancel) {
2025-04-18 14:53:38 +08:00
that.$tools.msg(that.$t('tips.msgCancel'));
2024-05-29 16:35:45 +08:00
}
},
})
},
2025-04-26 13:35:30 +08:00
languageClick(e) {
let that = this
that.index = e.detail.value
that.language = that.languageList[that.index].key
2025-04-29 17:29:44 +08:00
that.$model.getSetLanguage({
language: that.languageList[that.index].key,
}).then(res => {
2025-04-30 16:47:18 +08:00
that.$i18n.locale = that.languageList[that.index].key
2025-04-29 17:29:44 +08:00
uni.setStorageSync('language', that.languageList[that.index].key)
2025-04-30 16:47:18 +08:00
that.$store.commit('changeLocale', that.languageList[that.index].key)
uni.$emit('login-sucesss');
2025-04-29 17:29:44 +08:00
})
2025-04-26 13:35:30 +08:00
},
2024-05-29 16:35:45 +08:00
navTo(url) {
uni.navigateTo({
url
})
},
}
}
</script>
<style scoped lang="scss">
2024-06-13 18:03:50 +08:00
.content {
background-color: #F3F4F6;
padding: 15px;
min-height: 100vh;
}
.top {
height: auto;
background: #fff;
border-radius: 10px;
display: flex;
padding: 10px;
align-items: center;
justify-content: space-between;
.headimg {
width: 80%;
display: flex;
align-items: center;
2024-08-05 10:01:06 +08:00
view {
2024-07-25 16:55:39 +08:00
width: calc(100% - 70px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
2024-06-13 18:03:50 +08:00
}
image {
width: 60px;
height: 60px;
border-radius: 50%;
margin-right: 10px;
}
}
2024-05-29 16:35:45 +08:00
.wxlist {
height: auto;
overflow: hidden;
position: relative;
2024-06-13 18:03:50 +08:00
2024-05-29 16:35:45 +08:00
.item {
width: auto;
2024-08-05 10:01:06 +08:00
font-size: 32rpx;
2024-05-29 16:35:45 +08:00
line-height: 45px;
height: 45px;
display: flex;
2024-06-13 18:03:50 +08:00
margin-top: 15px;
background: #fff;
padding: 0 10px;
border-radius: 10px;
2024-05-29 16:35:45 +08:00
justify-content: space-between;
align-items: center;
.left {
display: flex;
align-items: center;
}
}
}
2024-10-11 17:23:56 +08:00
.href {
display: flex;
width: 100%;
color: #000;
text-decoration: none;
justify-content: space-between;
}
2024-05-29 16:35:45 +08:00
.btn {
width: auto;
background: $btncolor;
margin: 50px 15px 0 15px;
}
2025-04-26 13:35:30 +08:00
/deep/picker {
width: 50%;
position: relative;
.uni-input {
display: flex;
padding-right: 20px;
text-align: right;
justify-content: flex-end;
}
.iconfont {
position: absolute;
right: -1px;
top: 3px;
}
}
2024-05-29 16:35:45 +08:00
</style>