cma_search/client_mp/pages/my/my.vue

100 lines
2.3 KiB
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<!-- <u-navbar :is-back="false" title=" " :border-bottom="false">
<view class="u-flex u-row-right" style="width: 100%;">
<view class="camera u-flex u-row-center">
<u-icon name="camera-fill" color="#000000" size="48"></u-icon>
</view>
</view>
</u-navbar> -->
<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
<view class="u-m-r-10">
<u-avatar :src="vuex_user.avatar" size="140"></u-avatar>
</view>
<view class="u-flex-1">
<view class="u-font-18 u-p-b-20">{{vuex_user.name}}</view>
<view class="u-font-14 u-type-info">{{vuex_user.username}}-{{vuex_user.dept_name}}</view>
<view class="u-font-14 u-tips-color" v-if="vuex_user.wxmp_openid">已绑定微信</view>
</view>
<!-- <view class="u-m-l-10 u-p-10">
<u-icon name="scan" color="#969799" size="28"></u-icon>
</view>
<view class="u-m-l-10 u-p-10">
<u-icon name="arrow-right" color="#969799" size="28"></u-icon>
</view> -->
</view>
<view class="u-m-t-20">
<u-cell-group>
<u-cell-item icon="weixin-fill" title="绑定微信" :arrow="false" @click="bindMP" v-if="!vuex_user.wxmp_openid"></u-cell-item>
<u-cell-item icon="list-dot" title="考试记录" @click="examRecord"></u-cell-item>
<u-cell-item icon="close" title="退出" @click="Logout"></u-cell-item>
</u-cell-group>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pic:'https://uviewui.com/common/logo.png',
show:true
}
},
onLoad() {
},
methods: {
Logout(){
this.$u.api.unbindmp().then(res=>{
this.$u.vuex('vuex_token', '')
uni.redirectTo({
url: '/pages/login/login'
});
}
)
},
bindMP(){
uni.login({
provider: 'weixin',
success: (loginRes)=>{
this.$u.api.bindmp({code:loginRes.code}).then(res=>{
this.$u.toast('绑定成功');
this.$u.vuex('vuex_user.wxmp_openid', res.data.wxmp_openid)
uni.reLaunch({
url:'/pages/my/my'
})
}).catch(e=>{})
}
});
},
examRecord(){
uni.navigateTo({
url:'/pages/exam/record'
})
},
}
}
</script>
<style lang="scss">
page{
background-color: #ededed;
}
.camera{
width: 54px;
height: 44px;
&:active{
background-color: #ededed;
}
}
.user-box{
background-color: #fff;
padding-top:24rpx;
}
</style>