2022-09-09 10:42:41 +00:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="user-set">
|
|
|
|
|
|
<navigator :url="`/pages/user_data/user_data`">
|
|
|
|
|
|
<view class="item flex bg-white mt-[20rpx]">
|
2022-09-13 02:54:36 +00:00
|
|
|
|
<u-avatar :src="userInfo.avatar" shape="square" :size="100"></u-avatar>
|
|
|
|
|
|
<view class="ml-[20rpx] flex flex-1 justify-between items-center">
|
2022-09-09 10:42:41 +00:00
|
|
|
|
<view>
|
|
|
|
|
|
<view class="mb-[15rpx] text-xl font-medium">{{ userInfo.nickname }}</view>
|
|
|
|
|
|
<view class="text-content text-xs">账号:{{ userInfo.username }}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<u-icon name="arrow-right" color="#666"></u-icon>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</navigator>
|
|
|
|
|
|
<view
|
|
|
|
|
|
class="item bg-white mt-[20rpx] btn-border flex flex-1 justify-between"
|
2022-09-16 07:35:04 +00:00
|
|
|
|
@click="handlePwd"
|
2022-09-09 10:42:41 +00:00
|
|
|
|
>
|
|
|
|
|
|
<view class="">登录密码</view>
|
|
|
|
|
|
<u-icon name="arrow-right" color="#666"></u-icon>
|
|
|
|
|
|
</view>
|
2022-09-16 07:35:04 +00:00
|
|
|
|
<!-- #ifdef MP-WEIXIN || H5 -->
|
|
|
|
|
|
<view class="item bg-white flex flex-1 justify-between" v-if="isWeixin">
|
2022-09-09 10:42:41 +00:00
|
|
|
|
<view class="">绑定微信</view>
|
|
|
|
|
|
<view class="flex justify-between">
|
|
|
|
|
|
<view class="text-muted mr-[20rpx]">
|
|
|
|
|
|
{{ userInfo.isBindMnp ? '已绑定' : '未绑定' }}
|
|
|
|
|
|
</view>
|
2022-09-16 07:35:04 +00:00
|
|
|
|
<!-- <u-icon name="arrow-right" color="#666"></u-icon> -->
|
2022-09-09 10:42:41 +00:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2022-09-16 07:35:04 +00:00
|
|
|
|
<!-- #endif -->
|
2022-09-09 10:42:41 +00:00
|
|
|
|
<navigator :url="`/pages/agreement/agreement?type=${AgreementEnum.PRIVACY}`">
|
|
|
|
|
|
<view class="item bg-white mt-[20rpx] btn-border flex flex-1 justify-between">
|
|
|
|
|
|
<view class="">隐私政策</view>
|
|
|
|
|
|
<u-icon name="arrow-right" color="#666"></u-icon>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</navigator>
|
|
|
|
|
|
<navigator :url="`/pages/agreement/agreement?type=${AgreementEnum.SERVICE}`">
|
|
|
|
|
|
<view class="item bg-white btn-border flex flex-1 justify-between">
|
|
|
|
|
|
<view class="">服务协议</view>
|
|
|
|
|
|
<u-icon name="arrow-right" color="#666"></u-icon>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</navigator>
|
2022-09-13 09:41:24 +00:00
|
|
|
|
<navigator url="/pages/as_us/as_us">
|
|
|
|
|
|
<view class="item bg-white flex flex-1 justify-between">
|
|
|
|
|
|
<view class="">关于我们</view>
|
|
|
|
|
|
<view class="flex justify-between">
|
|
|
|
|
|
<view class="text-muted mr-[20rpx]">
|
|
|
|
|
|
{{ appStore.config.version }}
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<u-icon name="arrow-right" color="#666"></u-icon>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</navigator>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="mt-[60rpx] mx-[26rpx]">
|
|
|
|
|
|
<u-button type="primary" shape="circle" @click="logoutHandle"> 退出登录 </u-button>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<u-action-sheet
|
|
|
|
|
|
:list="list"
|
|
|
|
|
|
v-model="show"
|
|
|
|
|
|
@click="handleClick"
|
|
|
|
|
|
:safe-area-inset-bottom="true"
|
|
|
|
|
|
></u-action-sheet>
|
2022-09-09 10:42:41 +00:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { getUserInfo } from '@/api/user'
|
|
|
|
|
|
import { onShow } from '@dcloudio/uni-app'
|
2022-09-13 09:41:24 +00:00
|
|
|
|
import { ref } from 'vue'
|
2022-09-09 10:42:41 +00:00
|
|
|
|
import { useAppStore } from '@/stores/app'
|
2022-09-13 02:54:36 +00:00
|
|
|
|
import { useUserStore } from '@/stores/user'
|
2022-09-09 10:42:41 +00:00
|
|
|
|
import { AgreementEnum } from '@/enums/agreementEnums'
|
2022-09-16 07:35:04 +00:00
|
|
|
|
import { isWeixinClient } from '@/utils/client'
|
2022-09-09 10:42:41 +00:00
|
|
|
|
|
|
|
|
|
|
const appStore = useAppStore()
|
2022-09-13 02:54:36 +00:00
|
|
|
|
const userStore = useUserStore()
|
2022-09-13 09:41:24 +00:00
|
|
|
|
const userInfo = ref({
|
|
|
|
|
|
avatar: '',
|
|
|
|
|
|
nickname: '',
|
|
|
|
|
|
username: '',
|
2022-09-16 07:35:04 +00:00
|
|
|
|
isBindMnp: '',
|
|
|
|
|
|
isPassword: ''
|
2022-09-13 09:41:24 +00:00
|
|
|
|
})
|
2022-09-09 10:42:41 +00:00
|
|
|
|
const list = ref([
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '修改密码'
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
text: '忘记密码'
|
|
|
|
|
|
}
|
|
|
|
|
|
])
|
2022-09-16 07:35:04 +00:00
|
|
|
|
|
|
|
|
|
|
const isWeixin = ref(true)
|
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
|
isWeixin.value = isWeixinClient()
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
|
2022-09-09 10:42:41 +00:00
|
|
|
|
const show = ref(false)
|
2022-09-13 02:54:36 +00:00
|
|
|
|
|
|
|
|
|
|
// 获取用户信息
|
2022-09-09 10:42:41 +00:00
|
|
|
|
const getUser = async () => {
|
|
|
|
|
|
const res = await getUserInfo()
|
|
|
|
|
|
userInfo.value = res
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-13 02:54:36 +00:00
|
|
|
|
// 修改/忘记密码
|
2022-09-09 10:42:41 +00:00
|
|
|
|
const handleClick = (index: number) => {
|
|
|
|
|
|
switch (index) {
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
uni.navigateTo({ url: '/pages/change_password/change_password' })
|
|
|
|
|
|
break
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
uni.navigateTo({ url: '/pages/forget_pwd/forget_pwd' })
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-16 07:35:04 +00:00
|
|
|
|
const handlePwd = () => {
|
|
|
|
|
|
if (!userInfo.value.isPassword)
|
|
|
|
|
|
return uni.navigateTo({ url: '/pages/change_password/change_password?type=set' })
|
|
|
|
|
|
show.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-13 02:54:36 +00:00
|
|
|
|
// 退出登录
|
|
|
|
|
|
const logoutHandle = () => {
|
2022-09-13 09:41:24 +00:00
|
|
|
|
uni.showModal({
|
|
|
|
|
|
content: '是否退出登录?',
|
|
|
|
|
|
confirmColor: '#4173FF',
|
|
|
|
|
|
success: ({ cancel }) => {
|
|
|
|
|
|
if (cancel) return
|
|
|
|
|
|
userStore.logout()
|
|
|
|
|
|
uni.redirectTo({ url: '/pages/login/login' })
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2022-09-13 02:54:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-09 10:42:41 +00:00
|
|
|
|
onShow(() => {
|
|
|
|
|
|
getUser()
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.user-set {
|
|
|
|
|
|
.item {
|
2022-09-13 09:41:24 +00:00
|
|
|
|
padding: 30rpx;
|
2022-09-09 10:42:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.btn-border {
|
2022-09-13 09:41:24 +00:00
|
|
|
|
border-bottom: 2rpx solid #f8f8f8;
|
2022-09-09 10:42:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|