对接接口

This commit is contained in:
wangxiaowei
2025-12-17 00:45:31 +08:00
parent 977f7d4038
commit 018a784a8c
20 changed files with 455 additions and 816 deletions

View File

@ -1,4 +1,5 @@
<route lang="jsonc" type="page">{
"needLogin": true,
"layout": "default",
"style": {
"navigationStyle": "custom"
@ -9,9 +10,9 @@
<view>
<view class="mx-60rpx mt-20rpx">
<view class="text-[#303133] text-48rpx leading-80rpx font-600">
修改手机号码
{{ page.title }}
</view>
<view class="font-400 text-28rpx leading-44rpx text-[#6B7280] mt-12rpx">手机号一年内可修改2次</view>
<view class="font-400 text-28rpx leading-44rpx text-[#6B7280] mt-12rpx">{{ page.desc }}</view>
</view>
<view class="mt-106rpx mx-48rpx">
<wd-form ref="form" :model="model">
@ -31,7 +32,7 @@
</view>
</view>
<view class="mt-40rpx">
<view class="mt-40rpx" v-if="pageType == 'edit'">
<view class="font-400 text-30rpx text-[#606266] leading-44rpx">验证码</view>
<view class="mt-20rpx">
<wd-input type="text" placeholder="请输入验证码" v-model="model.code" inputmode="numeric" no-border custom-class="!bg-[#F6F7F8] !border !border-solid !border-[#EAECF0] !rounded-16rpx" custom-input-class="!px-32rpx !h-104rpx">
@ -58,15 +59,6 @@
<view class="h-90rpx leading-90rpx mx-60rpx rounded-8rpx text-center mt-112rpx bg-[#4C9F44] text-[#fff]" :class="disabled ? 'opacity-40' : ''" @click="mobile.handleToLogin">登录</view>
<view class="flex items-center mx-52rpx mt-56rpx" v-if="pageType === 'login'">
<view class="w-32rpx h-32rpx">
<wd-checkbox v-model="agree" @change="mobile.handleAgree" checked-color="#4C9F44" size="large"> </wd-checkbox>
</view>
<view class="font-400 text-26rpx leading-40rpx text-[#8F959E] ml-14rpx flex-1" @click="agree = !agree">
我已阅读并同意 <text class="text-[#4C9F44]" @click.stop="mobile.handleToService">服务协议</text> <text class="text-[#4C9F44]" @click.stop="mobile.handleToPrivacy">隐私政策</text>
</view>
</view>
<!-- 手机号修改成功 -->
<wd-popup v-model="showEditSuccessPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
<view class="relative pt-64rpx pb-74rpx">
@ -94,7 +86,7 @@
const disabled = ref<boolean>(true)
/** 页面 **/
let pageType = 'login' // 页面类型 login:登录 edit:修改手机号
const pageType = ref<string>('') // 页面类型 login:登录 edit:修改手机号
const page = ref<{title: string, desc: string}>({title: '其他手机号登录', desc: '请输入你要登录的手机号'})
const showEditSuccessPopup = ref<boolean>(false) // 显示手机号修改成功弹窗
const userId = ref<number>(0) // 用户ID修改手机号时需要传
@ -114,18 +106,18 @@
})
/** 结束 **/
/** 服务协议和隐私政策 **/
const agree = ref<boolean>(false)
/** 结束 **/
onLoad((args) => {
// 从个人登录页面进入
pageType.value = args.type
userId.value = Number(args.userId) || 0 // userId仅做测试使用实际请传真实用户ID
if (args.type === 'edit') {
userId.value = Number(args.userId) || 0 // userId仅做测试使用实际请传真实用户ID
page.value.title = '修改手机号'
page.value.desc = '手机号一年内可修改2次'
pageType = 'edit'
} else if (args.type === 'change') {
page.value.title = '修改绑定用户'
page.value.desc = '请输入新的手机号进行绑定'
}
})

View File

@ -1,4 +1,5 @@
<route lang="jsonc" type="page">{
"needLogin": true,
"layout": "default",
"style": {
"navigationStyle": "custom"

View File

@ -1,5 +1,6 @@
<route lang="jsonc" type="page">
{
"needLogin": true,
"layout": "default",
"style": {
"navigationStyle": "custom"
@ -76,7 +77,7 @@
image-mode="scaleToFill"
:action="action"
@success="Profile.handleUploadSuccess">
<wd-img width="64rpx" height="64rpx" :src="user.avatar" mode="aspectFill" round />
<wd-img width="64rpx" height="64rpx" :src="user.avatar || `${OSS}images/store/my/image1.png`" mode="aspectFill" round />
</wd-upload>
</view>
<wd-icon name="arrow-right" size="32rpx" color="#C0C4CC" />
@ -100,7 +101,7 @@
</view>
<!-- 修改手机号 -->
<view class="flex justify-between items-center mb-54rpx" @click="Profile.handleToEditMobile">
<view class="flex justify-between items-center mb-54rpx" @click="router.navigateTo('/bundle/profile/change-mobile?type=edit')">
<view class="font-400 text-[#303133] text-30rpx leading-42rpx">修改手机号</view>
<view class="flex justify-end">
<view class="flex items-center">
@ -116,31 +117,17 @@
<!-- 修改手机号 -->
<view class="flex justify-between items-center mb-54rpx" @click="router.navigateTo('/bundle/profile/change-password')">
<view class="font-400 text-[#303133] text-30rpx leading-42rpx">修改手机号</view>
<view class="flex justify-end">
<view class="flex items-center">
<view class="font-400 text-[#303133] text-30rpx leading-42rpx">
{{ user.nickname }}
</view>
<view>
<wd-icon name="arrow-right" size="32rpx" color="#C0C4CC" />
</view>
</view>
<view class="font-400 text-[#303133] text-30rpx leading-42rpx">修改密码</view>
<view>
<wd-icon name="arrow-right" size="32rpx" color="#C0C4CC" />
</view>
</view>
<!-- 修改绑定用户 -->
<view class="flex justify-between items-center" @click="router.navigateTo('/bundle/profile/change-password')">
<view class="flex justify-between items-center" @click="router.navigateTo('/bundle/profile/change-mobile?type=change')">
<view class="font-400 text-[#303133] text-30rpx leading-42rpx">修改绑定用户</view>
<view class="flex justify-end">
<view class="flex items-center">
<view class="font-400 text-[#303133] text-30rpx leading-42rpx">
{{ user.nickname }}
</view>
<view>
<wd-icon name="arrow-right" size="32rpx" color="#C0C4CC" />
</view>
</view>
<view>
<wd-icon name="arrow-right" size="32rpx" color="#C0C4CC" />
</view>
</view>
</view>
@ -164,7 +151,7 @@
// 上传文件
const fileList = ref<any[]>([])
const action = 'https://cz.stnav.com/api/upload/image' // 仅做测试使用,实际请换成真实上传接口
const action = import.meta.env.VITE_UPLOAD_BASEURL
// 修改昵称
const showEditNicknamePopup = ref<boolean>(false) // 是否显示退款详情弹出框
@ -195,17 +182,16 @@
onLoad(() => {
token.value = uni.getStorageSync('token')
// Profile.handleInit()
Profile.handleInit()
})
const Profile = {
/**
* 初始化用户信息
*/
handleInit: () => {
getUserInfo().then(res => {
user.value = res
})
handleInit: async () => {
const res = await getUserInfo()
user.value = res
},
/**
@ -221,7 +207,7 @@
const response = JSON.parse(e.file.response)
if (response.code) {
const avatarUrl = response.data.uri
await updateUserInfo({ field: 'avatar', value: avatarUrl })
await updateUserInfo({ avatar: avatarUrl })
user.value.avatar = avatarUrl
toast.info('头像上传成功')
} else {
@ -241,7 +227,7 @@
return
}
await updateUserInfo({ field: 'nickname', value: nickname.value })
await updateUserInfo({ nickname: nickname.value })
showEditNicknamePopup.value = false
user.value.nickname = nickname.value
toast.info('昵称修改成功')
@ -259,9 +245,9 @@
/**
* 退出
*/
handleLogout: () => {
handleLogout: async () => {
const userStore = useUserStore()
userStore.logout()
await userStore.logout()
if (!userStore.isLoggedIn) {
toast.info('退出成功')
router.reLaunch('/pages/my/my')