修改密码调整
This commit is contained in:
parent
32963b1ab0
commit
2361b79548
|
|
@ -17,7 +17,7 @@
|
|||
<view class="text-white text-3xl ml-[20rpx]">未登录</view>
|
||||
</navigator>
|
||||
<navigator v-if="isLogin" hover-class="none" url="/pages/user_set/user_set">
|
||||
<u-icon name="setting" color="#fff" :size="58"></u-icon>
|
||||
<u-icon name="setting" color="#fff" :size="48"></u-icon>
|
||||
</navigator>
|
||||
</view>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@
|
|||
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>
|
||||
<view class="text-2xl font-medium mb-[60rpx]">
|
||||
{{ type == 'set' ? '设置登录密码' : '修改登录密码' }}
|
||||
</view>
|
||||
<u-form borderBottom :label-width="150">
|
||||
<u-form-item label="原密码" borderBottom>
|
||||
<u-form-item label="原密码" borderBottom v-if="type != 'set'">
|
||||
<u-input
|
||||
class="flex-1"
|
||||
type="password"
|
||||
v-model="formData.oldPassword"
|
||||
:border="false"
|
||||
placeholder="请输入原来的密码"
|
||||
|
|
@ -41,16 +44,17 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { userChangePwd } from '@/api/user'
|
||||
import { reactive } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { reactive, ref } from 'vue'
|
||||
|
||||
const formData = reactive({
|
||||
oldPassword: '',
|
||||
const type = ref('')
|
||||
const formData = reactive<any>({
|
||||
password: '',
|
||||
password2: ''
|
||||
})
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (!formData.oldPassword) return uni.$u.toast('请输入原来的密码')
|
||||
if (!formData.oldPassword && type.value != 'set') return uni.$u.toast('请输入原来的密码')
|
||||
if (!formData.password) return uni.$u.toast('请输入密码')
|
||||
if (!formData.password2) return uni.$u.toast('请输入确认密码')
|
||||
if (formData.password != formData.password2) return uni.$u.toast('两次输入的密码不一致')
|
||||
|
|
@ -58,6 +62,15 @@ const handleConfirm = async () => {
|
|||
uni.$u.toast('操作成功')
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
type.value = options.type || ''
|
||||
if (type.value == 'set') {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '设置登录密码'
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
|||
|
|
@ -14,21 +14,22 @@
|
|||
</navigator>
|
||||
<view
|
||||
class="item bg-white mt-[20rpx] btn-border flex flex-1 justify-between"
|
||||
@click="show = true"
|
||||
@click="handlePwd"
|
||||
>
|
||||
<view class="">登录密码</view>
|
||||
<u-icon name="arrow-right" color="#666"></u-icon>
|
||||
</view>
|
||||
<view class="item bg-white flex flex-1 justify-between">
|
||||
<!-- #ifdef MP-WEIXIN || H5 -->
|
||||
<view class="item bg-white flex flex-1 justify-between" v-if="isWeixin">
|
||||
<view class="">绑定微信</view>
|
||||
<view class="flex justify-between">
|
||||
<view class="text-muted mr-[20rpx]">
|
||||
{{ userInfo.isBindMnp ? '已绑定' : '未绑定' }}
|
||||
</view>
|
||||
<u-icon name="arrow-right" color="#666"></u-icon>
|
||||
<!-- <u-icon name="arrow-right" color="#666"></u-icon> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- #endif -->
|
||||
<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>
|
||||
|
|
@ -73,6 +74,7 @@ import { ref } from 'vue'
|
|||
import { useAppStore } from '@/stores/app'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { AgreementEnum } from '@/enums/agreementEnums'
|
||||
import { isWeixinClient } from '@/utils/client'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const userStore = useUserStore()
|
||||
|
|
@ -80,7 +82,8 @@ const userInfo = ref({
|
|||
avatar: '',
|
||||
nickname: '',
|
||||
username: '',
|
||||
isBindMnp: ''
|
||||
isBindMnp: '',
|
||||
isPassword: ''
|
||||
})
|
||||
const list = ref([
|
||||
{
|
||||
|
|
@ -90,6 +93,12 @@ const list = ref([
|
|||
text: '忘记密码'
|
||||
}
|
||||
])
|
||||
|
||||
const isWeixin = ref(true)
|
||||
// #ifdef H5
|
||||
isWeixin.value = isWeixinClient()
|
||||
// #endif
|
||||
|
||||
const show = ref(false)
|
||||
|
||||
// 获取用户信息
|
||||
|
|
@ -110,6 +119,12 @@ const handleClick = (index: number) => {
|
|||
}
|
||||
}
|
||||
|
||||
const handlePwd = () => {
|
||||
if (!userInfo.value.isPassword)
|
||||
return uni.navigateTo({ url: '/pages/change_password/change_password?type=set' })
|
||||
show.value = true
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
const logoutHandle = () => {
|
||||
uni.showModal({
|
||||
|
|
|
|||
Loading…
Reference in New Issue