修复:解决测试发现的问题

This commit is contained in:
2025-11-12 16:00:44 +08:00
parent 1da75a59f2
commit 1daa6367c9
29 changed files with 133 additions and 182 deletions

View File

@@ -36,10 +36,7 @@
</view>
</view> -->
<wd-cell-group border class="contact-info">
<wd-cell :title="$t('user.hotline')" clickable @click="handlePhoneCall">
022-24142321
<img src="/static/icon/tel.png" width="23" height="23" />
</wd-cell>
<wd-cell :title="$t('user.hotline')" clickable icon="call" value="022-24142321" @click="handlePhoneCall"></wd-cell>
<!-- <wd-cell :title="$t('user.wechat')" value="yilujiankangkefu" clickable @click="handlePhoneCall" /> -->
</wd-cell-group>
@@ -86,7 +83,7 @@ const getAppVersion = () => {
* 拨打电话
*/
const handlePhoneCall = () => {
makePhoneCall('022-24142321', t('user.hotline'), t)
makePhoneCall('022-24142321', t('user.hotline'))
}
/**

View File

@@ -11,6 +11,7 @@
<wd-select-picker
v-model="form.type"
type="radio"
style="border-bottom: 1px solid #ddd;"
:columns="issueTypeOptions"
:placeholder="$t('common.pleaseSelect')"
:show-confirm="false"
@@ -227,8 +228,6 @@ const handleSubmit = async () => {
}
try {
uni.showLoading()
// 处理图片
if (imageUrl.value.length > 0) {
form.value.image = imageUrl.value.join(',')
@@ -236,8 +235,6 @@ const handleSubmit = async () => {
// 提交反馈
await submitFeedback(form.value)
uni.hideLoading()
uni.showModal({
title: t('global.tips'),
@@ -265,7 +262,6 @@ const handleSubmit = async () => {
})
} catch (error) {
console.error('提交反馈失败:', error)
uni.hideLoading()
uni.showToast({
title: t('user.feedbackFailed'),
icon: 'none'

View File

@@ -1,7 +1,7 @@
<template>
<view class="user-page">
<view class="user-page" :style="{ paddingTop: getNotchHeight() + 30 + 'px' }">
<!-- 设置图标 -->
<view class="settings-icon" @click="goSettings">
<view class="settings-icon" :style="{ top: getNotchHeight() + 30 + 'px' }" @click="goSettings">
<wd-icon name="setting1" size="24px" color="#666" />
<text>{{ $t('user.settings') }}</text>
</view>
@@ -27,7 +27,8 @@
<!-- VIP订阅卡片 -->
<view class="vip-card-section">
<view class="vip-card">
<view v-if="vipInfo.id" class="vip-info">
用户VIP功能重写中
<!-- <view v-if="vipInfo.id" class="vip-info">
<text class="label">{{ $t('user.vip') }}</text>
<text class="value">{{ vipInfo.endTime ? vipInfo.endTime.split(' ')[0] : '' }}</text>
</view>
@@ -38,7 +39,16 @@
@click="goSubscribe"
>
{{ $t('user.subscribe') }}
</wd-button>
</wd-button> -->
</view>
</view>
<!-- 我的资产 -->
<view class="vip-card-section wallet-section">
<view class="vip-card wallet_l">
我的资产功能重写中
<!-- <text class="wallet_title">{{$t('my.coin')}}<uni-icons type="help" size="19" color="#666"></uni-icons></text>
<text class="wallet_count">{{userMes.peanutCoin}}</text> -->
</view>
</view>
@@ -65,6 +75,7 @@ import { useUserStore } from '@/stores/user'
import { getUserInfo, getVipInfo } from '@/api/modules/user'
import type { IVipInfo } from '@/types/user'
import { useI18n } from 'vue-i18n'
import { getNotchHeight } from '@/utils/system'
const { t } = useI18n()
const userStore = useUserStore()
@@ -205,13 +216,11 @@ $theme-color: #54a966;
.user-page {
min-height: 100vh;
background-color: #f7faf9;
padding-top: 130rpx;
}
.settings-icon {
position: absolute;
right: 40rpx;
top: 60rpx;
right: 20px;
z-index: 2;
display: flex;
flex-direction: column;

View File

@@ -98,11 +98,9 @@ async function loadBookList() {
}
loading.value = true
uni.showLoading({ title: t('global.loading') })
try {
const res = await bookApi.getMyBooks(page.value.current, page.value.limit)
uni.hideLoading()
if (res.page && res.page.records) {
total.value = res.page.total
@@ -115,7 +113,6 @@ async function loadBookList() {
}
}
} catch (error) {
uni.hideLoading()
console.error('Failed to load book list:', error)
} finally {
loading.value = false

View File

@@ -112,13 +112,8 @@ const getData = async () => {
try {
loading.value = true
uni.showLoading({
title: t('common.loading')
})
const res = await getOrderList(page.value.current, page.value.limit)
uni.hideLoading()
if (res.orders && res.orders.records) {
total.value = res.orders.total
@@ -139,7 +134,6 @@ const getData = async () => {
}
} catch (error) {
console.error('获取订单列表失败:', error)
uni.hideLoading()
} finally {
loading.value = false
}

View File

@@ -27,7 +27,7 @@
@click="editField(field)"
>
<view class="value-wrapper">
<text v-if="userInfo[field.key]" class="value">
<text v-if="userInfo[field.key] || userInfo[field.key] === 0" class="value">
{{ formatValue(field, userInfo[field.key]) }}
</text>
<text v-else class="placeholder">{{ $t('user.notSet') }}</text>
@@ -163,7 +163,8 @@ const fields = computed(() => [
// 性别选项
const sexOptions = [
{ label: t('user.male'), value: 1 },
{ label: t('user.female'), value: 2 }
{ label: t('user.female'), value: 0 },
{ label: t('user.secrecy'), value: 2 },
]
// 编辑相关
@@ -198,10 +199,8 @@ const avatarUrl = ref('')
*/
const userInfo = ref<any>({}) // 用户信息
const getData = async () => {
uni.showLoading()
try {
const res = await getUserInfo()
uni.hideLoading()
if (res.result) {
userStore.setUserInfo(res.result)
userInfo.value = res.result
@@ -216,7 +215,22 @@ const getData = async () => {
*/
const formatValue = (field: any, value: any) => {
if (field.key === 'sex') {
return value === 1 ? t('user.male') : t('user.female')
let result = null
switch(value) {
case 1:
result = t('user.male')
break
case 0:
result = t('user.female')
break
case 2:
result = t('user.secrecy')
break
default:
result = null
break
}
return result
}
if (field.key === 'password') {
return '******'
@@ -385,8 +399,6 @@ const handleSubmit = async () => {
const key = currentField.value?.key
try {
uni.showLoading()
// 构建更新数据对象
let updateData: any = Object.assign({}, userInfo.value)
@@ -394,7 +406,6 @@ const handleSubmit = async () => {
case 'email':
// 更新邮箱
if (!editForm.value.email || !editForm.value.code) {
uni.hideLoading()
uni.showToast({
title: t('user.pleaseInputCode'),
icon: 'none'
@@ -407,7 +418,6 @@ const handleSubmit = async () => {
case 'password':
// 更新密码
if (!passwordOk.value) {
uni.hideLoading()
uni.showToast({
title: passwordNote.value,
icon: 'none'
@@ -415,7 +425,6 @@ const handleSubmit = async () => {
return
}
if (editForm.value.password !== editForm.value.confirmPassword) {
uni.hideLoading()
uni.showToast({
title: t('user.passwordNotMatch'),
icon: 'none'
@@ -429,7 +438,6 @@ const handleSubmit = async () => {
// 更新头像
console.log('avatarUrl.value:', avatarUrl.value)
if (!avatarUrl.value) {
uni.hideLoading()
uni.showToast({
title: t('common.pleaseSelect') + t('user.avatar'),
icon: 'none'
@@ -444,8 +452,7 @@ const handleSubmit = async () => {
case 'sex':
// 更新性别
const sexValue = editValue.value === 2 ? 0 : editValue.value
updateData.sex = sexValue
updateData.sex = editValue.value
await updateUserInfo(updateData)
break
@@ -463,7 +470,6 @@ const handleSubmit = async () => {
break
}
uni.hideLoading()
uni.showToast({
title: t('user.updateSuccess'),
icon: 'success'
@@ -477,7 +483,6 @@ const handleSubmit = async () => {
}, 500)
} catch (error) {
console.error('更新失败:', error)
uni.hideLoading()
}
}

View File

@@ -142,13 +142,7 @@ const getPlatform = () => {
*/
const getPackages = async () => {
try {
uni.showLoading({
title: t('common.loading')
})
const res = await getVipPackages()
uni.hideLoading()
if (res.sysDictDatas && res.sysDictDatas.length > 0) {
packages.value = res.sysDictDatas
@@ -163,7 +157,6 @@ const getPackages = async () => {
}
} catch (error) {
console.error('获取套餐列表失败:', error)
uni.hideLoading()
}
}
@@ -246,10 +239,6 @@ const handleSubscribe = async () => {
}
try {
uni.showLoading({
title: t('common.loading')
})
// 创建订单
const orderData = {
paymentMethod: paymentMethod.value,
@@ -273,7 +262,6 @@ const handleSubscribe = async () => {
}
} catch (error) {
console.error('创建订单失败:', error)
uni.hideLoading()
}
}
@@ -283,7 +271,6 @@ const handleSubscribe = async () => {
const initiateGooglePay = async () => {
// TODO: 集成 Google Pay SDK
// 这里需要使用 sn-googlepay5 插件
uni.hideLoading()
uni.showToast({
title: 'Google Pay 功能开发中',
icon: 'none'
@@ -295,7 +282,6 @@ const initiateGooglePay = async () => {
*/
const initiateIAP = async () => {
// TODO: 集成 IAP SDK
uni.hideLoading()
uni.showToast({
title: 'IAP 功能开发中',
icon: 'none'

View File

@@ -91,20 +91,14 @@ const getData = async () => {
try {
loading.value = true
uni.showLoading({
title: t('common.loading')
})
const res = await getTransactionList(userStore.userInfo.id)
uni.hideLoading()
if (res.transactionDetailsList && res.transactionDetailsList.length > 0) {
transactionList.value = res.transactionDetailsList
}
} catch (error) {
console.error('获取交易记录失败:', error)
uni.hideLoading()
} finally {
loading.value = false
}