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