修改密码
This commit is contained in:
parent
33e4cd45f3
commit
43b9a54b6a
|
|
@ -23,4 +23,6 @@ export function userBindMobile(data: any) {
|
||||||
export function userMnpMobile(data: any) {
|
export function userMnpMobile(data: any) {
|
||||||
return request.post({ url: '/user/mnpMobile', data: data })
|
return request.post({ url: '/user/mnpMobile', data: data })
|
||||||
}
|
}
|
||||||
|
export function userChangePwd(data: any) {
|
||||||
|
return request.post({ url: '/user/changePwd', data: data })
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,67 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="">
|
<view
|
||||||
<u-parse :html="agreementContent"></u-parse>
|
class="register bg-white min-h-full flex flex-col items-center px-[40rpx] pt-[100rpx] box-border"
|
||||||
|
>
|
||||||
|
<view class="w-full">
|
||||||
|
<view class="text-2xl font-medium mb-[60rpx]">修改登录密码</view>
|
||||||
|
<u-form borderBottom :label-width="150">
|
||||||
|
<u-form-item label="原密码" borderBottom>
|
||||||
|
<u-input
|
||||||
|
class="flex-1"
|
||||||
|
v-model="formData.oldPassword"
|
||||||
|
:border="false"
|
||||||
|
placeholder="请输入原来的密码"
|
||||||
|
/>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="新密码" borderBottom>
|
||||||
|
<u-input
|
||||||
|
class="flex-1"
|
||||||
|
type="password"
|
||||||
|
v-model="formData.password"
|
||||||
|
placeholder="6-20位数字+字母或符号组合"
|
||||||
|
:border="false"
|
||||||
|
/>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="确认密码" borderBottom>
|
||||||
|
<u-input
|
||||||
|
class="flex-1"
|
||||||
|
type="password"
|
||||||
|
v-model="formData.password2"
|
||||||
|
placeholder="再次输入新密码"
|
||||||
|
:border="false"
|
||||||
|
/>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
<view class="mt-[100rpx]">
|
||||||
|
<u-button type="primary" shape="circle" @click="handleConfirm"> 确定 </u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref } from 'vue'
|
import { userChangePwd } from '@/api/user'
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { reactive } from 'vue'
|
||||||
import { AgreementEnum } from '@/enums/agreementEnums'
|
|
||||||
import { getPolicy } from '@/api/app'
|
|
||||||
|
|
||||||
let agreementType = ref('') // 协议类型
|
const formData = reactive({
|
||||||
let agreementContent = ref('') // 协议内容
|
oldPassword: '',
|
||||||
// let agreementName = ref('') // 协议名称
|
password: '',
|
||||||
|
password2: ''
|
||||||
|
})
|
||||||
|
|
||||||
const getData = async (type) => {
|
const handleConfirm = async () => {
|
||||||
let res = await getPolicy({ type })
|
if (!formData.oldPassword) return uni.$u.toast('请输入原来的密码')
|
||||||
console.log(res, 'res')
|
if (!formData.password) return uni.$u.toast('请输入密码')
|
||||||
|
if (!formData.password2) return uni.$u.toast('请输入确认密码')
|
||||||
agreementContent.value = res.content
|
if (formData.password != formData.password2) return uni.$u.toast('两次输入的密码不一致')
|
||||||
|
await userChangePwd(formData)
|
||||||
uni.setNavigationBarTitle({
|
uni.$u.toast('操作成功')
|
||||||
title: res.name
|
uni.navigateBack()
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
|
||||||
onLoad((options: any) => {
|
|
||||||
if(options.type) {
|
|
||||||
agreementType.value = options.type
|
|
||||||
getData(agreementType)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
class="register bg-white min-h-full flex flex-col items-center px-[40rpx] pt-[100rpx] box-border"
|
class="register bg-white min-h-full flex flex-col items-center px-[40rpx] pt-[100rpx] box-border"
|
||||||
>
|
>
|
||||||
<view class="w-full">
|
<view class="w-full">
|
||||||
<view class="text-2xl font-medium mb-[100rpx]">忘记登录密码</view>
|
<view class="text-2xl font-medium mb-[60rpx]">忘记登录密码</view>
|
||||||
<u-form borderBottom :label-width="150">
|
<u-form borderBottom :label-width="150">
|
||||||
<u-form-item label="手机号" borderBottom>
|
<u-form-item label="手机号" borderBottom>
|
||||||
<u-input
|
<u-input
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ const getData = async () => {
|
||||||
state.pages = JSON.parse(data.pages)
|
state.pages = JSON.parse(data.pages)
|
||||||
state.article = data.article
|
state.article = data.article
|
||||||
}
|
}
|
||||||
|
|
||||||
getData()
|
getData()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ import { SMSEnum } from '@/enums/appEnums'
|
||||||
import { useLockFn } from '@/hooks/useLockFn'
|
import { useLockFn } from '@/hooks/useLockFn'
|
||||||
import { useAppStore } from '@/stores/app'
|
import { useAppStore } from '@/stores/app'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { currentPage } from '@/utils/util'
|
||||||
import { reactive, ref, shallowRef } from 'vue'
|
import { reactive, ref, shallowRef } from 'vue'
|
||||||
enum LoginTypeEnum {
|
enum LoginTypeEnum {
|
||||||
MOBILE = 'mobile',
|
MOBILE = 'mobile',
|
||||||
|
|
@ -197,7 +198,14 @@ const loginFun = async (scene: LoginTypeEnum, code?: string) => {
|
||||||
await userStore.getUser()
|
await userStore.getUser()
|
||||||
uni.$u.toast('登录成功')
|
uni.$u.toast('登录成功')
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.navigateBack()
|
uni.navigateBack({
|
||||||
|
success: () => {
|
||||||
|
// @ts-ignore
|
||||||
|
const { onLoad, options } = currentPage()
|
||||||
|
// 刷新上一个页面
|
||||||
|
onLoad && onLoad(options)
|
||||||
|
}
|
||||||
|
})
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
throw new Error(error)
|
throw new Error(error)
|
||||||
|
|
|
||||||
|
|
@ -5,18 +5,26 @@
|
||||||
<view class="flex justify-center">
|
<view class="flex justify-center">
|
||||||
<image @click="uploaderAvatar" :src="userInfo?.avatar"></image>
|
<image @click="uploaderAvatar" :src="userInfo?.avatar"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-[20rpx] text-center text-muted text-xs" @click="uploaderAvatar">点击修改头像</view>
|
<view class="mt-[20rpx] text-center text-muted text-xs" @click="uploaderAvatar"
|
||||||
|
>点击修改头像</view
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 用户ID -->
|
<!-- 用户ID -->
|
||||||
<view class="item text-nr flex justify-between" @click="(showUserName = true), (newUsername = userInfo?.username)">
|
<view
|
||||||
|
class="item text-nr flex justify-between"
|
||||||
|
@click=";(showUserName = true), (newUsername = userInfo?.username)"
|
||||||
|
>
|
||||||
<view class="label">账号</view>
|
<view class="label">账号</view>
|
||||||
<view class="content">{{ userInfo?.username }}</view>
|
<view class="content">{{ userInfo?.username }}</view>
|
||||||
<u-icon name="arrow-right" size="22"></u-icon>
|
<u-icon name="arrow-right" size="22"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 昵称 -->
|
<!-- 昵称 -->
|
||||||
<view class="item text-nr flex justify-between" @click="(showNickName = true), (newNickname = userInfo?.nickname)">
|
<view
|
||||||
|
class="item text-nr flex justify-between"
|
||||||
|
@click=";(showNickName = true), (newNickname = userInfo?.nickname)"
|
||||||
|
>
|
||||||
<view class="label">昵称</view>
|
<view class="label">昵称</view>
|
||||||
<view class="content">{{ userInfo?.nickname }}</view>
|
<view class="content">{{ userInfo?.nickname }}</view>
|
||||||
<u-icon name="arrow-right" size="22"></u-icon>
|
<u-icon name="arrow-right" size="22"></u-icon>
|
||||||
|
|
@ -32,10 +40,19 @@
|
||||||
<!-- 手机号 -->
|
<!-- 手机号 -->
|
||||||
<view class="item text-nr flex justify-between">
|
<view class="item text-nr flex justify-between">
|
||||||
<view class="label">手机号</view>
|
<view class="label">手机号</view>
|
||||||
<view class="content">{{ userInfo?.mobile == '' ? '未绑定手机号' : userInfo?.mobile }}</view>
|
<view class="content">{{
|
||||||
|
userInfo?.mobile == '' ? '未绑定手机号' : userInfo?.mobile
|
||||||
|
}}</view>
|
||||||
|
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<u-button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" size="mini" type="primary" shape="circle" :plain="true">
|
<u-button
|
||||||
|
open-type="getPhoneNumber"
|
||||||
|
@getphonenumber="getPhoneNumber"
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
shape="circle"
|
||||||
|
:plain="true"
|
||||||
|
>
|
||||||
{{ userInfo?.mobile == '' ? '绑定手机号' : '更换手机号' }}
|
{{ userInfo?.mobile == '' ? '绑定手机号' : '更换手机号' }}
|
||||||
</u-button>
|
</u-button>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
|
|
@ -58,9 +75,7 @@
|
||||||
<view class="mb-[70rpx] text-xl text-center">修改昵称</view>
|
<view class="mb-[70rpx] text-xl text-center">修改昵称</view>
|
||||||
<u-field v-model="newNickname" label="新昵称" placeholder="请输入新的昵称"> </u-field>
|
<u-field v-model="newNickname" label="新昵称" placeholder="请输入新的昵称"> </u-field>
|
||||||
<view class="mt-[80rpx]">
|
<view class="mt-[80rpx]">
|
||||||
<u-button @click="changeNameConfirm" type="primary" shape="circle">
|
<u-button @click="changeNameConfirm" type="primary" shape="circle"> 确定 </u-button>
|
||||||
确定
|
|
||||||
</u-button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
|
@ -79,8 +94,14 @@
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
|
||||||
<!-- 性别修改组件 -->
|
<!-- 性别修改组件 -->
|
||||||
<u-picker mode="selector" v-model="showPicker" confirm-color="#4173FF" :default-selector="[0]" :range="sexList"
|
<u-picker
|
||||||
@confirm="changeSexConfirm" />
|
mode="selector"
|
||||||
|
v-model="showPicker"
|
||||||
|
confirm-color="#4173FF"
|
||||||
|
:default-selector="[0]"
|
||||||
|
:range="sexList"
|
||||||
|
@confirm="changeSexConfirm"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 账号修改组件 -->
|
<!-- 账号修改组件 -->
|
||||||
<u-popup v-model="showMobilePop" :closeable="true" mode="center" border-radius="20">
|
<u-popup v-model="showMobilePop" :closeable="true" mode="center" border-radius="20">
|
||||||
|
|
@ -115,161 +136,137 @@
|
||||||
</view>
|
</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
<view class="mt-[80rpx]">
|
<view class="mt-[80rpx]">
|
||||||
<u-button @click="changeCodeMobile" type="primary" shape="circle">
|
<u-button @click="changeCodeMobile" type="primary" shape="circle"> 确定 </u-button>
|
||||||
确定
|
|
||||||
</u-button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {
|
import { ref, shallowRef } from 'vue'
|
||||||
ref,
|
import { onShow, onUnload } from '@dcloudio/uni-app'
|
||||||
shallowRef,
|
import { getUserInfo, userEdit, userBindMobile, userMnpMobile } from '@/api/user.ts'
|
||||||
} from 'vue'
|
import { smsSend } from '@/api/app'
|
||||||
import {
|
import { FieldType, SMSEnum } from '@/enums/appEnums'
|
||||||
onShow,
|
import { uploadFile } from '@/utils/util.ts'
|
||||||
onUnload
|
|
||||||
} from '@dcloudio/uni-app'
|
|
||||||
import {
|
|
||||||
getUserInfo,
|
|
||||||
userEdit,
|
|
||||||
userBindMobile,
|
|
||||||
userMnpMobile,
|
|
||||||
} from '@/api/user.ts'
|
|
||||||
import { smsSend } from '@/api/app'
|
|
||||||
import {
|
|
||||||
FieldType,
|
|
||||||
SMSEnum,
|
|
||||||
} from '@/enums/appEnums'
|
|
||||||
import {
|
|
||||||
uploadFile
|
|
||||||
} from '@/utils/util.ts'
|
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
let userInfo = ref < any | null > (null)
|
const userInfo = ref<any | null>(null)
|
||||||
// 用户信息的枚举
|
// 用户信息的枚举
|
||||||
const fieldType = ref(FieldType.NONE)
|
const fieldType = ref(FieldType.NONE)
|
||||||
//选择性别数据
|
//选择性别数据
|
||||||
const sexList = ref < Array < string > | null > (['男', '女'])
|
const sexList = ref<Array<string> | null>(['男', '女'])
|
||||||
|
|
||||||
//显示昵称弹窗
|
//显示昵称弹窗
|
||||||
const showNickName = ref < boolean | null >(false)
|
const showNickName = ref<boolean | null>(false)
|
||||||
//显示账户弹窗
|
//显示账户弹窗
|
||||||
const showUserName = ref < boolean | null >(false)
|
const showUserName = ref<boolean | null>(false)
|
||||||
//显示性别选择弹窗
|
//显示性别选择弹窗
|
||||||
const showPicker = ref < boolean | null >(false)
|
const showPicker = ref<boolean | null>(false)
|
||||||
// 显示手机号验证码调整弹窗 非小程序才需要
|
// 显示手机号验证码调整弹窗 非小程序才需要
|
||||||
const showMobilePop = ref < boolean | null > (false)
|
const showMobilePop = ref<boolean | null>(false)
|
||||||
|
|
||||||
//新昵称
|
//新昵称
|
||||||
const newNickname = ref < string > ('')
|
const newNickname = ref<string>('')
|
||||||
//新账号
|
//新账号
|
||||||
const newUsername = ref < string > ('')
|
const newUsername = ref<string>('')
|
||||||
//新的手机号码
|
//新的手机号码
|
||||||
const newMobile = ref < string > ('')
|
const newMobile = ref<string>('')
|
||||||
|
|
||||||
//修改手机验证码
|
//修改手机验证码
|
||||||
const mobileCode = ref <string > ('')
|
const mobileCode = ref<string>('')
|
||||||
const codeTips = ref('')
|
const codeTips = ref('')
|
||||||
const uCodeRef = shallowRef()
|
const uCodeRef = shallowRef()
|
||||||
|
|
||||||
|
// 获取用户信息
|
||||||
// 获取用户信息
|
const getUser = async (): Promise<void> => {
|
||||||
const getUser = async (): Promise < void > => {
|
|
||||||
userInfo.value = await getUserInfo()
|
userInfo.value = await getUserInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取验证码显示字段
|
// 获取验证码显示字段
|
||||||
const codeChange = (text: string) => {
|
const codeChange = (text: string) => {
|
||||||
codeTips.value = text
|
codeTips.value = text
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送验证码
|
// 发送验证码
|
||||||
const sendSms = async () => {
|
const sendSms = async () => {
|
||||||
if (!newMobile.value) return uni.$u.toast('请输入新的手机号码')
|
if (!newMobile.value) return uni.$u.toast('请输入新的手机号码')
|
||||||
if (uCodeRef.value?.canGetCode) {
|
if (uCodeRef.value?.canGetCode) {
|
||||||
await smsSend({
|
await smsSend({
|
||||||
scene: userInfo.mobile ? SMSEnum.CHANGE_MOBILE : SMSEnum.BIND_MOBILE,
|
scene: userInfo.value.mobile ? SMSEnum.CHANGE_MOBILE : SMSEnum.BIND_MOBILE,
|
||||||
mobile: newMobile.value
|
mobile: newMobile.value
|
||||||
})
|
})
|
||||||
uni.$u.toast('发送成功')
|
uni.$u.toast('发送成功')
|
||||||
uCodeRef.value?.start()
|
uCodeRef.value?.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证码修改手机号-非微信小程序
|
// 验证码修改手机号-非微信小程序
|
||||||
const changeCodeMobile = async () => {
|
const changeCodeMobile = async () => {
|
||||||
await userBindMobile({
|
await userBindMobile({
|
||||||
type: userInfo.mobile ? 'change' : 'bind',
|
type: userInfo.value.mobile ? 'change' : 'bind',
|
||||||
mobile: newMobile.value,
|
mobile: newMobile.value,
|
||||||
code: mobileCode.value,
|
code: mobileCode.value
|
||||||
})
|
})
|
||||||
getUser()
|
getUser()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改用户信息
|
||||||
// 修改用户信息
|
const setUserInfoFun = async (value: string): Promise<void> => {
|
||||||
const setUserInfoFun = async (value: string): Promise < void > => {
|
|
||||||
await userEdit({
|
await userEdit({
|
||||||
field: fieldType.value,
|
field: fieldType.value,
|
||||||
value: value,
|
value: value
|
||||||
})
|
})
|
||||||
getUser()
|
getUser()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传头像
|
// 上传头像
|
||||||
const uploaderAvatar = () => {
|
const uploaderAvatar = () => {
|
||||||
fieldType.value = FieldType.AVATAR
|
fieldType.value = FieldType.AVATAR
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/uni_modules/vk-uview-ui/components/u-avatar-cropper/u-avatar-cropper?destWidth=300&rectWidth=200&fileType=jpg',
|
url: '/uni_modules/vk-uview-ui/components/u-avatar-cropper/u-avatar-cropper?destWidth=300&rectWidth=200&fileType=jpg'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示修改用户性别弹窗
|
// 显示修改用户性别弹窗
|
||||||
const changeSex = () => {
|
const changeSex = () => {
|
||||||
showPicker.value = true
|
showPicker.value = true
|
||||||
fieldType.value = FieldType.SEX
|
fieldType.value = FieldType.SEX
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改用户性别
|
// 修改用户性别
|
||||||
const changeSexConfirm = (value) => {
|
const changeSexConfirm = (value) => {
|
||||||
setUserInfoFun(value[0] + 1)
|
setUserInfoFun(value[0] + 1)
|
||||||
showPicker.value = false
|
showPicker.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改用户账号
|
// 修改用户账号
|
||||||
const changeUserNameConfirm = () => {
|
const changeUserNameConfirm = () => {
|
||||||
if (newUsername.value == '') return uni.$u.toast('账号不能为空')
|
if (newUsername.value == '') return uni.$u.toast('账号不能为空')
|
||||||
if (newUsername.value.length > 10) return uni.$u.toast('账号长度不得超过十位数')
|
if (newUsername.value.length > 10) return uni.$u.toast('账号长度不得超过十位数')
|
||||||
|
|
||||||
fieldType.value = FieldType.USERNAME
|
fieldType.value = FieldType.USERNAME
|
||||||
setUserInfoFun(newUsername.value)
|
setUserInfoFun(newUsername.value)
|
||||||
showUserName.value = false
|
showUserName.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改用户昵称
|
// 修改用户昵称
|
||||||
const changeNameConfirm = () => {
|
const changeNameConfirm = () => {
|
||||||
if (newNickname.value == '') return uni.$u.toast('昵称不能为空')
|
if (newNickname.value == '') return uni.$u.toast('昵称不能为空')
|
||||||
if (newNickname.value.length > 10) return uni.$u.toast('昵称长度不得超过十位数')
|
if (newNickname.value.length > 10) return uni.$u.toast('昵称长度不得超过十位数')
|
||||||
showNickName.value = false
|
showNickName.value = false
|
||||||
fieldType.value = FieldType.NICKNAME
|
fieldType.value = FieldType.NICKNAME
|
||||||
setUserInfoFun(newNickname.value)
|
setUserInfoFun(newNickname.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 微信小程序 绑定||修改用户手机号
|
// 微信小程序 绑定||修改用户手机号
|
||||||
const getPhoneNumber = async (e): Promise < void > => {
|
const getPhoneNumber = async (e): Promise<void> => {
|
||||||
fieldType.value = FieldType.MOBILE
|
fieldType.value = FieldType.MOBILE
|
||||||
const {
|
const { encryptedData, iv, code } = e.detail
|
||||||
encryptedData,
|
const data = {
|
||||||
iv,
|
|
||||||
code,
|
|
||||||
} = e.detail
|
|
||||||
let data = {
|
|
||||||
code,
|
code,
|
||||||
encrypted_data: encryptedData,
|
encrypted_data: encryptedData,
|
||||||
iv,
|
iv
|
||||||
}
|
}
|
||||||
if (encryptedData) {
|
if (encryptedData) {
|
||||||
await userMnpMobile({
|
await userMnpMobile({
|
||||||
|
|
@ -277,19 +274,19 @@
|
||||||
})
|
})
|
||||||
getUser()
|
getUser()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const goPage = (url: string) => {
|
const goPage = (url: string) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: url,
|
url: url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听从裁剪页发布的事件,获得裁剪结果
|
// 监听从裁剪页发布的事件,获得裁剪结果
|
||||||
uni.$on('uAvatarCropper', (path) => {
|
uni.$on('uAvatarCropper', (path) => {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '正在上传中...',
|
title: '正在上传中...',
|
||||||
mask: true,
|
mask: true
|
||||||
})
|
})
|
||||||
uploadFile(path)
|
uploadFile(path)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -300,19 +297,19 @@
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.$u.toast('上传失败')
|
uni.$u.toast('上传失败')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
onShow(async () => {
|
onShow(async () => {
|
||||||
getUser()
|
getUser()
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
uni.$off('uAvatarCropper')
|
uni.$off('uAvatarCropper')
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.header {
|
.header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 240rpx;
|
height: 240rpx;
|
||||||
// border-radius: 14rpx;
|
// border-radius: 14rpx;
|
||||||
|
|
@ -322,9 +319,9 @@
|
||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
margin-top: 2rpx;
|
margin-top: 2rpx;
|
||||||
padding: 30rpx 20rpx;
|
padding: 30rpx 20rpx;
|
||||||
// border-radius: 14rpx;
|
// border-radius: 14rpx;
|
||||||
|
|
@ -344,10 +341,10 @@
|
||||||
border-width: 1rpx;
|
border-width: 1rpx;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.license {
|
.license {
|
||||||
margin-top: 80rpx;
|
margin-top: 80rpx;
|
||||||
color: #a7a7a7;
|
color: #a7a7a7;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,16 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</navigator>
|
</navigator>
|
||||||
<view class="item bg-white mt-[20rpx] btn-border flex flex-1 justify-between">
|
<view
|
||||||
|
class="item bg-white mt-[20rpx] btn-border flex flex-1 justify-between"
|
||||||
|
@click="show = true"
|
||||||
|
>
|
||||||
<view class="text-xl">登录密码</view>
|
<view class="text-xl">登录密码</view>
|
||||||
<u-icon name="arrow-right" color="#666"></u-icon>
|
<u-icon name="arrow-right" color="#666"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="item bg-white btn-border flex flex-1 justify-between">
|
<view class="item bg-white btn-border flex flex-1 justify-between">
|
||||||
<view class="text-xl">绑定微信</view>
|
<view class="text-xl">绑定微信</view>
|
||||||
<view class=" flex justify-between">
|
<view class="flex justify-between">
|
||||||
<view class="text-muted mr-[20rpx]">
|
<view class="text-muted mr-[20rpx]">
|
||||||
{{ userInfo.isBindMnp ? '已绑定' : '未绑定' }}
|
{{ userInfo.isBindMnp ? '已绑定' : '未绑定' }}
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -26,13 +29,13 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<navigator :url="`/pages/agreement/agreement?type=${ AgreementEnum.PRIVACY }`">
|
<navigator :url="`/pages/agreement/agreement?type=${AgreementEnum.PRIVACY}`">
|
||||||
<view class="item bg-white mt-[20rpx] btn-border flex flex-1 justify-between">
|
<view class="item bg-white mt-[20rpx] btn-border flex flex-1 justify-between">
|
||||||
<view class="text-xl">隐私政策</view>
|
<view class="text-xl">隐私政策</view>
|
||||||
<u-icon name="arrow-right" color="#666"></u-icon>
|
<u-icon name="arrow-right" color="#666"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</navigator>
|
</navigator>
|
||||||
<navigator :url="`/pages/agreement/agreement?type=${ AgreementEnum.SERVICE }`">
|
<navigator :url="`/pages/agreement/agreement?type=${AgreementEnum.SERVICE}`">
|
||||||
<view class="item bg-white btn-border flex flex-1 justify-between">
|
<view class="item bg-white btn-border flex flex-1 justify-between">
|
||||||
<view class="text-xl">服务协议</view>
|
<view class="text-xl">服务协议</view>
|
||||||
<u-icon name="arrow-right" color="#666"></u-icon>
|
<u-icon name="arrow-right" color="#666"></u-icon>
|
||||||
|
|
@ -47,45 +50,53 @@
|
||||||
<u-icon name="arrow-right" color="#666"></u-icon>
|
<u-icon name="arrow-right" color="#666"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-action-sheet :list="list" v-model="show" @click="handleClick"></u-action-sheet>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import { getUserInfo } from '@/api/user'
|
||||||
getUserInfo
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
} from '@/api/user'
|
import { reactive, ref } from 'vue'
|
||||||
import {
|
import { useAppStore } from '@/stores/app'
|
||||||
onShow
|
import { AgreementEnum } from '@/enums/agreementEnums'
|
||||||
} from '@dcloudio/uni-app'
|
|
||||||
import {
|
|
||||||
reactive,
|
|
||||||
ref,
|
|
||||||
} from 'vue'
|
|
||||||
import {
|
|
||||||
useAppStore
|
|
||||||
} from '@/stores/app'
|
|
||||||
import {
|
|
||||||
AgreementEnum
|
|
||||||
} from '@/enums/agreementEnums'
|
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
let userInfo = ref({})
|
const userInfo = ref({})
|
||||||
|
const list = ref([
|
||||||
const getUser = async () => {
|
{
|
||||||
let res = await getUserInfo()
|
text: '修改密码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '忘记密码'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
const show = ref(false)
|
||||||
|
const getUser = async () => {
|
||||||
|
const res = await getUserInfo()
|
||||||
console.log(res, 'res')
|
console.log(res, 'res')
|
||||||
|
|
||||||
userInfo.value = res
|
userInfo.value = res
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getUser()
|
getUser()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.user-set {
|
.user-set {
|
||||||
.item {
|
.item {
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
@ -93,5 +104,5 @@
|
||||||
.btn-border {
|
.btn-border {
|
||||||
border-bottom: 1rpx solid $u-form-item-border-color;
|
border-bottom: 1rpx solid $u-form-item-border-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue