Compare commits
18 Commits
50743184ff
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9f19842054 | |||
| 38c4519e79 | |||
| 3b596e0a70 | |||
| b513979995 | |||
| ee5431e57a | |||
| 64abd3d4ab | |||
| 3da220526b | |||
| d209c05a18 | |||
| 21a3335939 | |||
| cbc48b8193 | |||
| 574644349c | |||
| 2ccd53ab94 | |||
| 277b6cf0b6 | |||
| 26cef66e82 | |||
| f70fc65c24 | |||
| 33c22eaad9 | |||
| 2a067e0954 | |||
| f9cad8d740 |
@@ -34,7 +34,7 @@ export function responseInterceptor(res: UniApp.RequestSuccessCallbackResult) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 可能为字符串,尝试解析(原项目也做了类似处理)
|
// 可能为字符串,尝试解析(原项目也做了类似处理)
|
||||||
let httpData: IApiResponse | string = res.data;
|
let httpData: IApiResponse | string = res.data as any;
|
||||||
if (typeof httpData === 'string') {
|
if (typeof httpData === 'string') {
|
||||||
try {
|
try {
|
||||||
httpData = JSON.parse(httpData);
|
httpData = JSON.parse(httpData);
|
||||||
@@ -44,20 +44,19 @@ export function responseInterceptor(res: UniApp.RequestSuccessCallbackResult) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 规范化 message 字段
|
// 规范化 message 字段
|
||||||
const message = (httpData as IApiResponse).msg || (httpData as IApiResponse).message || (httpData as IApiResponse).errMsg || '';
|
const message = (httpData as any).msg || (httpData as any).message || (httpData as any).errMsg || '';
|
||||||
|
|
||||||
const code = (httpData as IApiResponse).code;
|
// 成功判断:与原项目一致的条件
|
||||||
|
const successFlag = (httpData as any).success === true || (httpData as any).code === 0;
|
||||||
// 成功判断
|
|
||||||
const successFlag = (httpData as IApiResponse).success === true || code === 0;
|
|
||||||
|
|
||||||
if (successFlag) {
|
if (successFlag) {
|
||||||
// 返回原始 httpData
|
// 返回原始 httpData(与原项目 dataFactory 返回 Promise.resolve(httpData) 保持一致)
|
||||||
// 实际数据每个接口不同,调用者需根据实际情况取 .data 字段
|
// 但大多数调用者更关心 data 字段,这里返回整个 httpData,调用者可取 .data
|
||||||
return Promise.resolve(httpData);
|
return Promise.resolve(httpData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 登录失效或需要强制登录的一些 code
|
// 登录失效或需要强制登录的一些 code(与原项目一致)
|
||||||
|
const code = (httpData as any).code;
|
||||||
if (code === '401' || code === 401) {
|
if (code === '401' || code === 401) {
|
||||||
// 触发登出流程
|
// 触发登出流程
|
||||||
handleAuthExpired();
|
handleAuthExpired();
|
||||||
@@ -65,7 +64,7 @@ export function responseInterceptor(res: UniApp.RequestSuccessCallbackResult) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 原项目还将 1000,1001,1100,402 等视作需要强制登录
|
// 原项目还将 1000,1001,1100,402 等视作需要强制登录
|
||||||
if (code == 1000 || code == 1001 || code === 1100 || code === 402) {
|
if (code === '1000' || code === '1001' || code === 1000 || code === 1001 || code === 1100 || code === '402' || code === 402) {
|
||||||
handleAuthExpired();
|
handleAuthExpired();
|
||||||
return Promise.reject({ statusCode: 0, errMsg: message || t('global.loginExpired'), data: httpData });
|
return Promise.reject({ statusCode: 0, errMsg: message || t('global.loginExpired'), data: httpData });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { t } from '@/utils/i18n'
|
|||||||
export function createRequestClient(cfg: ICreateClientConfig) {
|
export function createRequestClient(cfg: ICreateClientConfig) {
|
||||||
const baseURL = cfg.baseURL;
|
const baseURL = cfg.baseURL;
|
||||||
const timeout = cfg.timeout ?? REQUEST_TIMEOUT;
|
const timeout = cfg.timeout ?? REQUEST_TIMEOUT;
|
||||||
let reqCount= 0
|
|
||||||
|
|
||||||
async function request<T = any>(options: IRequestOptions): Promise<T> {
|
async function request<T = any>(options: IRequestOptions): Promise<T> {
|
||||||
// 组装 final options
|
// 组装 final options
|
||||||
@@ -24,18 +23,14 @@ export function createRequestClient(cfg: ICreateClientConfig) {
|
|||||||
|
|
||||||
// 全局处理请求 loading
|
// 全局处理请求 loading
|
||||||
const loading = !cfg.loading ? true : cfg.loading // 接口请求参数不传loading,默认显示loading
|
const loading = !cfg.loading ? true : cfg.loading // 接口请求参数不传loading,默认显示loading
|
||||||
if (loading) {
|
loading && uni.showLoading()
|
||||||
uni.showLoading({ mask: true })
|
|
||||||
reqCount++
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.request({
|
uni.request({
|
||||||
...intercepted,
|
...intercepted,
|
||||||
complete() {
|
complete() {
|
||||||
// 请求完成关闭 loading
|
// 请求完成关闭 loading
|
||||||
loading && reqCount--
|
loading && uni.hideLoading()
|
||||||
reqCount <= 0 && uni.hideLoading()
|
|
||||||
},
|
},
|
||||||
success(res: any) {
|
success(res: any) {
|
||||||
// 委托给响应拦截器处理
|
// 委托给响应拦截器处理
|
||||||
|
|||||||
@@ -259,8 +259,11 @@ const handleChapterClick = (chapter: IChapter) => {
|
|||||||
border-bottom-left-radius: 40rpx;
|
border-bottom-left-radius: 40rpx;
|
||||||
|
|
||||||
.vip-badge {
|
.vip-badge {
|
||||||
display: inline-block;
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
|
display: inline-block;
|
||||||
background: linear-gradient(90deg, #6429db 0%, #0075ed 100%);
|
background: linear-gradient(90deg, #6429db 0%, #0075ed 100%);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 10rpx 20rpx;
|
padding: 10rpx 20rpx;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<view class="payment-item">
|
<view class="payment-item">
|
||||||
<view class="payment-left">
|
<view class="payment-left">
|
||||||
<image src="/static/icon/pay_3.png" class="payment-icon" />
|
<image src="/static/icon/pay_3.png" class="payment-icon" />
|
||||||
<text class="">{{ $t('global.coin') }}</text>
|
<text class="">{{ $t('order.virtualCoin') }}</text>
|
||||||
<text class="text-[#7dc1f0]">
|
<text class="text-[#7dc1f0]">
|
||||||
({{ $t('order.balance') }}:{{ peanutCoin || 0 }})
|
({{ $t('order.balance') }}:{{ peanutCoin || 0 }})
|
||||||
</text>
|
</text>
|
||||||
@@ -25,12 +25,19 @@
|
|||||||
<view class="tip-title">{{ $t('order.paymentTipTitle') }}</view>
|
<view class="tip-title">{{ $t('order.paymentTipTitle') }}</view>
|
||||||
<view class="tip-item">{{ $t('order.paymentTip1') }}</view>
|
<view class="tip-item">{{ $t('order.paymentTip1') }}</view>
|
||||||
<view class="tip-item">
|
<view class="tip-item">
|
||||||
{{ $t('order.paymentTip2-1') }}
|
{{ $t('order.paymentTip2') }}
|
||||||
<text class="link-text" @click="copyToClipboard('yilujiankangkefu')">yilujiankangkefu</text>
|
<text class="link-text" @click="makePhoneCall('022-24142321')">022-24142321</text>
|
||||||
{{ $t('order.paymentTip2-2') }}
|
</view>
|
||||||
<text class="link-text" @click="copyToClipboard('AmazingLimited@163.com')">
|
<view class="tip-item">
|
||||||
AmazingLimited@163.com
|
{{ $t('order.paymentTip3') }}
|
||||||
|
<text class="link-text" @click="copyToClipboard('publisher@tmrjournals.com')">
|
||||||
|
publisher@tmrjournals.com
|
||||||
</text>
|
</text>
|
||||||
|
{{ $t('order.paymentTip3_1') }}
|
||||||
|
<text class="link-text" @click="copyToClipboard('yilujiankangkefu')">
|
||||||
|
yilujiankangkefu
|
||||||
|
</text>
|
||||||
|
{{ $t('order.paymentTip3_2') }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -46,15 +53,6 @@ const props = defineProps({
|
|||||||
default: 0
|
default: 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* 跳转到充值页面
|
|
||||||
*/
|
|
||||||
const goToRecharge = () => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/user/wallet/recharge/index?source=order'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -230,44 +230,71 @@ function initScrollHeight() {
|
|||||||
|
|
||||||
// 加载书籍详情
|
// 加载书籍详情
|
||||||
async function loadBookInfo() {
|
async function loadBookInfo() {
|
||||||
|
try {
|
||||||
const res = await bookApi.getBookInfo(bookId.value)
|
const res = await bookApi.getBookInfo(bookId.value)
|
||||||
|
|
||||||
|
if (res.bookInfo) {
|
||||||
bookInfo.value = res.bookInfo
|
bookInfo.value = res.bookInfo
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to load book info:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 加载购买商品信息
|
// 加载购买商品信息
|
||||||
async function loadGoodsInfo() {
|
async function loadGoodsInfo() {
|
||||||
|
try {
|
||||||
const res = await bookApi.getBookGoods(bookId.value)
|
const res = await bookApi.getBookGoods(bookId.value)
|
||||||
|
if (res.code === 0) {
|
||||||
goodsList.value = res.productList || []
|
goodsList.value = res.productList || []
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to load goods info:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 加载统计数据
|
// 加载统计数据
|
||||||
async function loadBookCount() {
|
async function loadBookCount() {
|
||||||
|
try {
|
||||||
const res = await bookApi.getBookReadCount(bookId.value)
|
const res = await bookApi.getBookReadCount(bookId.value)
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
readCount.value = res.readCount || 0
|
readCount.value = res.readCount || 0
|
||||||
listenCount.value = res.listenCount || 0
|
listenCount.value = res.listenCount || 0
|
||||||
buyCount.value = res.buyCount || 0
|
buyCount.value = res.buyCount || 0
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to load book count:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载评论
|
// 加载评论
|
||||||
async function loadComments() {
|
async function loadComments() {
|
||||||
|
try {
|
||||||
const res = await bookApi.getBookComments(bookId.value, 1, 10)
|
const res = await bookApi.getBookComments(bookId.value, 1, 10)
|
||||||
if (res.commentsTree && res.commentsTree.length > 0) {
|
if (res.commentsTree && res.commentsTree.length > 0) {
|
||||||
commentList.value = res.commentsTree
|
commentList.value = res.commentsTree
|
||||||
} else {
|
} else {
|
||||||
nullText.value = t('common.data_null')
|
nullText.value = t('common.data_null')
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
nullText.value = t('common.data_null')
|
||||||
|
console.error('Failed to load comments:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载推荐书籍
|
// 加载推荐书籍
|
||||||
async function loadRecommendBooks() {
|
async function loadRecommendBooks() {
|
||||||
|
try {
|
||||||
const res = await bookApi.getRecommendBook(bookId.value)
|
const res = await bookApi.getRecommendBook(bookId.value)
|
||||||
if (res.bookList && res.bookList.length > 0) {
|
if (res.bookList && res.bookList.length > 0) {
|
||||||
relatedBooks.value = res.bookList
|
relatedBooks.value = res.bookList
|
||||||
} else {
|
} else {
|
||||||
nullBookText.value = t('common.data_null')
|
nullBookText.value = t('common.data_null')
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
nullBookText.value = t('common.data_null')
|
||||||
|
console.error('Failed to load recommend books:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示购买弹窗
|
// 显示购买弹窗
|
||||||
|
|||||||
@@ -162,7 +162,7 @@
|
|||||||
>
|
>
|
||||||
<image :src="item.images" />
|
<image :src="item.images" />
|
||||||
<text class="book-text">{{ item.name }}</text>
|
<text class="book-text">{{ item.name }}</text>
|
||||||
<text class="book-price">{{ item.minPrice }} {{ t('global.coin') }}</text>
|
<text class="book-price">{{ item.minPrice }} 天医币</text>
|
||||||
<text v-if="formatStats(item)" class="book-flag">{{
|
<text v-if="formatStats(item)" class="book-flag">{{
|
||||||
formatStats(item)
|
formatStats(item)
|
||||||
}}</text>
|
}}</text>
|
||||||
@@ -219,16 +219,21 @@ const vipInfo = ref<IVipInfo | null>(null)
|
|||||||
* 获取VIP信息
|
* 获取VIP信息
|
||||||
*/
|
*/
|
||||||
const getVipInfo = async () => {
|
const getVipInfo = async () => {
|
||||||
|
try {
|
||||||
const res = await homeApi.getVipInfo()
|
const res = await homeApi.getVipInfo()
|
||||||
if (res.vipInfo) {
|
if (res.vipInfo) {
|
||||||
vipInfo.value = res.vipInfo
|
vipInfo.value = res.vipInfo
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取VIP信息失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取我的书单
|
* 获取我的书单
|
||||||
*/
|
*/
|
||||||
const getMyBooks = async () => {
|
const getMyBooks = async () => {
|
||||||
|
try {
|
||||||
const res = await homeApi.getMyBooks(1, 10)
|
const res = await homeApi.getMyBooks(1, 10)
|
||||||
if (res && res.code === 0) {
|
if (res && res.code === 0) {
|
||||||
showMyBooks.value = true
|
showMyBooks.value = true
|
||||||
@@ -241,22 +246,30 @@ const getMyBooks = async () => {
|
|||||||
url: '/pages/login/login'
|
url: '/pages/login/login'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取我的书单失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取推荐图书
|
* 获取推荐图书
|
||||||
*/
|
*/
|
||||||
const getRecommendBooks = async () => {
|
const getRecommendBooks = async () => {
|
||||||
|
try {
|
||||||
const res = await homeApi.getRecommendBooks()
|
const res = await homeApi.getRecommendBooks()
|
||||||
if (res.books && res.books.length > 0) {
|
if (res.books && res.books.length > 0) {
|
||||||
recommendBooksList.value = res.books
|
recommendBooksList.value = res.books
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取推荐图书失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取活动标签列表
|
* 获取活动标签列表
|
||||||
*/
|
*/
|
||||||
const getActivityLabels = async () => {
|
const getActivityLabels = async () => {
|
||||||
|
try {
|
||||||
const res = await homeApi.getBookLabelList(1)
|
const res = await homeApi.getBookLabelList(1)
|
||||||
showActivity.value = true
|
showActivity.value = true
|
||||||
if (res.lableList && res.lableList.length > 0) {
|
if (res.lableList && res.lableList.length > 0) {
|
||||||
@@ -264,12 +277,16 @@ const getActivityLabels = async () => {
|
|||||||
// 默认加载第一个标签的图书列表
|
// 默认加载第一个标签的图书列表
|
||||||
await getBooksByLabel(res.lableList[0].id, 'activity')
|
await getBooksByLabel(res.lableList[0].id, 'activity')
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取活动标签失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取分类标签列表
|
* 获取分类标签列表
|
||||||
*/
|
*/
|
||||||
const getCategoryLabels = async () => {
|
const getCategoryLabels = async () => {
|
||||||
|
try {
|
||||||
const res = await homeApi.getBookLabelList(0)
|
const res = await homeApi.getBookLabelList(0)
|
||||||
showCategory.value = true
|
showCategory.value = true
|
||||||
if (res.lableList && res.lableList.length > 0) {
|
if (res.lableList && res.lableList.length > 0) {
|
||||||
@@ -277,12 +294,16 @@ const getCategoryLabels = async () => {
|
|||||||
// 默认加载第一个标签的二级标签
|
// 默认加载第一个标签的二级标签
|
||||||
await getSubLabels(res.lableList[0].id, 0)
|
await getSubLabels(res.lableList[0].id, 0)
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取分类标签失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取二级标签列表
|
* 获取二级标签列表
|
||||||
*/
|
*/
|
||||||
const getSubLabels = async (pid: number, index: number) => {
|
const getSubLabels = async (pid: number, index: number) => {
|
||||||
|
try {
|
||||||
const res = await homeApi.getSubLabelList(pid)
|
const res = await homeApi.getSubLabelList(pid)
|
||||||
currentLevel1Index.value = index
|
currentLevel1Index.value = index
|
||||||
if (res.lableList && res.lableList.length > 0) {
|
if (res.lableList && res.lableList.length > 0) {
|
||||||
@@ -295,6 +316,9 @@ const getSubLabels = async (pid: number, index: number) => {
|
|||||||
categoryLevel2List.value = []
|
categoryLevel2List.value = []
|
||||||
await getBooksByLabel(pid, 'category')
|
await getBooksByLabel(pid, 'category')
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取二级标签失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -304,6 +328,7 @@ const getBooksByLabel = async (
|
|||||||
labelId: number,
|
labelId: number,
|
||||||
type: 'activity' | 'category'
|
type: 'activity' | 'category'
|
||||||
) => {
|
) => {
|
||||||
|
try {
|
||||||
const res = await homeApi.getBooksByLabel(labelId)
|
const res = await homeApi.getBooksByLabel(labelId)
|
||||||
if (type === 'activity') {
|
if (type === 'activity') {
|
||||||
if (res.bookList && res.bookList.length > 0) {
|
if (res.bookList && res.bookList.length > 0) {
|
||||||
@@ -318,6 +343,9 @@ const getBooksByLabel = async (
|
|||||||
categoryBookList.value = []
|
categoryBookList.value = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取图书列表失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -117,12 +117,19 @@ function initScrollHeight() {
|
|||||||
|
|
||||||
// 加载书籍信息
|
// 加载书籍信息
|
||||||
async function loadBookInfo() {
|
async function loadBookInfo() {
|
||||||
|
try {
|
||||||
const res = await bookApi.getBookInfo(bookId.value)
|
const res = await bookApi.getBookInfo(bookId.value)
|
||||||
|
if (res.bookInfo) {
|
||||||
bookInfo.value = res.bookInfo
|
bookInfo.value = res.bookInfo
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to load book info:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 加载章节列表
|
// 加载章节列表
|
||||||
async function loadChapterList() {
|
async function loadChapterList() {
|
||||||
|
try {
|
||||||
const res = await bookApi.getBookChapter({
|
const res = await bookApi.getBookChapter({
|
||||||
bookId: bookId.value
|
bookId: bookId.value
|
||||||
})
|
})
|
||||||
@@ -132,6 +139,10 @@ async function loadChapterList() {
|
|||||||
} else {
|
} else {
|
||||||
nullText.value = t('common.data_null')
|
nullText.value = t('common.data_null')
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
nullText.value = t('common.data_null')
|
||||||
|
console.error('Failed to load chapter list:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 播放章节
|
// 播放章节
|
||||||
|
|||||||
@@ -245,9 +245,15 @@ function initAudioContext() {
|
|||||||
|
|
||||||
// 加载书籍信息
|
// 加载书籍信息
|
||||||
async function loadBookInfo() {
|
async function loadBookInfo() {
|
||||||
|
try {
|
||||||
const res = await bookApi.getBookInfo(bookId.value)
|
const res = await bookApi.getBookInfo(bookId.value)
|
||||||
|
if (res.bookInfo) {
|
||||||
bookInfo.value = res.bookInfo
|
bookInfo.value = res.bookInfo
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to load book info:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 加载章节列表
|
// 加载章节列表
|
||||||
async function loadChapterList() {
|
async function loadChapterList() {
|
||||||
|
|||||||
@@ -164,10 +164,14 @@ function initScrollHeight() {
|
|||||||
|
|
||||||
// 加载书籍信息
|
// 加载书籍信息
|
||||||
async function loadBookInfo() {
|
async function loadBookInfo() {
|
||||||
|
try {
|
||||||
const res = await bookApi.getBookInfo(bookId.value)
|
const res = await bookApi.getBookInfo(bookId.value)
|
||||||
if (res.bookInfo) {
|
if (res.bookInfo) {
|
||||||
bookInfo.value = res.bookInfo
|
bookInfo.value = res.bookInfo
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to load book info:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载评论列表
|
// 加载评论列表
|
||||||
@@ -176,6 +180,7 @@ async function loadComments() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await bookApi.getBookComments(bookId.value, page.value.current, page.value.limit)
|
const res = await bookApi.getBookComments(bookId.value, page.value.current, page.value.limit)
|
||||||
|
|
||||||
commentsCount.value = res.commentsCount || 0
|
commentsCount.value = res.commentsCount || 0
|
||||||
@@ -186,6 +191,10 @@ async function loadComments() {
|
|||||||
} else if (commentList.value.length === 0) {
|
} else if (commentList.value.length === 0) {
|
||||||
nullText.value = t('common.data_null')
|
nullText.value = t('common.data_null')
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
nullText.value = t('common.data_null')
|
||||||
|
console.error('Failed to load comments:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载更多
|
// 加载更多
|
||||||
@@ -266,6 +275,7 @@ function handleEmj(i: any) {
|
|||||||
|
|
||||||
// 提交评论
|
// 提交评论
|
||||||
async function submitComment() {
|
async function submitComment() {
|
||||||
|
try {
|
||||||
const content = await getEditorContent()
|
const content = await getEditorContent()
|
||||||
|
|
||||||
if (!content || content === '<p><br></p>') {
|
if (!content || content === '<p><br></p>') {
|
||||||
@@ -289,6 +299,9 @@ async function submitComment() {
|
|||||||
editorCtx.value?.clear()
|
editorCtx.value?.clear()
|
||||||
resetComments()
|
resetComments()
|
||||||
}, 500)
|
}, 500)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to submit comment:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点赞/取消点赞
|
// 点赞/取消点赞
|
||||||
@@ -301,6 +314,7 @@ async function handleLike(comment: IComment) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (comment.isLike === 0) {
|
if (comment.isLike === 0) {
|
||||||
await bookApi.likeComment(comment.id)
|
await bookApi.likeComment(comment.id)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -320,6 +334,9 @@ async function handleLike(comment: IComment) {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resetComments()
|
resetComments()
|
||||||
}, 200)
|
}, 200)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to like comment:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除评论
|
// 删除评论
|
||||||
@@ -331,6 +348,7 @@ function handleDelete(comment: IComment) {
|
|||||||
confirmText: t('common.confirm_text'),
|
confirmText: t('common.confirm_text'),
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
try {
|
||||||
await bookApi.deleteComment(comment.id)
|
await bookApi.deleteComment(comment.id)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: t('bookDetails.deleteSuccess'),
|
title: t('bookDetails.deleteSuccess'),
|
||||||
@@ -341,6 +359,9 @@ function handleDelete(comment: IComment) {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resetComments()
|
resetComments()
|
||||||
}, 500)
|
}, 500)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to delete comment:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -70,9 +70,15 @@ onLoad((options: any) => {
|
|||||||
* 获取VIP信息
|
* 获取VIP信息
|
||||||
*/
|
*/
|
||||||
const getVipInfo = async () => {
|
const getVipInfo = async () => {
|
||||||
|
try {
|
||||||
const res = await homeApi.getVipInfo()
|
const res = await homeApi.getVipInfo()
|
||||||
|
if (res.vipInfo) {
|
||||||
vipInfo.value = res.vipInfo
|
vipInfo.value = res.vipInfo
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取VIP信息失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理搜索
|
* 处理搜索
|
||||||
@@ -85,6 +91,7 @@ const handleSearch = async () => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
isEmpty.value = false
|
isEmpty.value = false
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await homeApi.searchBooks({
|
const res = await homeApi.searchBooks({
|
||||||
title: keyword.value.trim(),
|
title: keyword.value.trim(),
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -97,8 +104,14 @@ const handleSearch = async () => {
|
|||||||
searchResults.value = []
|
searchResults.value = []
|
||||||
isEmpty.value = true
|
isEmpty.value = true
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('搜索失败:', error)
|
||||||
|
searchResults.value = []
|
||||||
|
isEmpty.value = true
|
||||||
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理清空
|
* 处理清空
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ onLoad((options: any) => {
|
|||||||
* 加载章节详情
|
* 加载章节详情
|
||||||
*/
|
*/
|
||||||
const loadChapterDetail = async () => {
|
const loadChapterDetail = async () => {
|
||||||
|
try {
|
||||||
const res = await courseApi.getChapterDetail(chapterId.value)
|
const res = await courseApi.getChapterDetail(chapterId.value)
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
chapterDetail.value = res.data.detail
|
chapterDetail.value = res.data.detail
|
||||||
@@ -178,6 +179,9 @@ const loadChapterDetail = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载章节详情失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ const handleFirstLevelClick = (item: string) => {
|
|||||||
* 获取课程分类数据
|
* 获取课程分类数据
|
||||||
*/
|
*/
|
||||||
const getMedicalTags = async () => {
|
const getMedicalTags = async () => {
|
||||||
|
try {
|
||||||
const res = await courseSubjectClassificationApi.getCourseMedicalTree()
|
const res = await courseSubjectClassificationApi.getCourseMedicalTree()
|
||||||
if (res && res.code === 0) {
|
if (res && res.code === 0) {
|
||||||
if (res.labels && res.labels.length > 0) {
|
if (res.labels && res.labels.length > 0) {
|
||||||
@@ -277,6 +278,9 @@ const getMedicalTags = async () => {
|
|||||||
curseTagList.value = []
|
curseTagList.value = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取医学课程分类失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 医学
|
* 医学
|
||||||
@@ -305,10 +309,14 @@ const curseClick = (item: IMedicalTag, index: number) => {
|
|||||||
*/
|
*/
|
||||||
const soulCateList = ref<IMedicalTag[]>([])
|
const soulCateList = ref<IMedicalTag[]>([])
|
||||||
const getSoulCateList = async () => {
|
const getSoulCateList = async () => {
|
||||||
|
try {
|
||||||
const res = await courseSubjectClassificationApi.getCourseSoulTree()
|
const res = await courseSubjectClassificationApi.getCourseSoulTree()
|
||||||
if (res.labels&&res.labels.length>0) {
|
if (res.labels&&res.labels.length>0) {
|
||||||
soulCateList.value = res.labels;
|
soulCateList.value = res.labels;
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取心理学课程分类失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -317,10 +325,14 @@ const getSoulCateList = async () => {
|
|||||||
*/
|
*/
|
||||||
const sociologyCateList = ref<IMedicalTag[]>([])
|
const sociologyCateList = ref<IMedicalTag[]>([])
|
||||||
const getSociologyCateList = async () => {
|
const getSociologyCateList = async () => {
|
||||||
|
try {
|
||||||
const res = await courseSubjectClassificationApi.getCourseSociologyTree()
|
const res = await courseSubjectClassificationApi.getCourseSociologyTree()
|
||||||
if (res.labels&&res.labels.length>0) {
|
if (res.labels&&res.labels.length>0) {
|
||||||
sociologyCateList.value = res.labels;
|
sociologyCateList.value = res.labels;
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取国学课程分类失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -357,6 +369,7 @@ const learnList = ref<ICourse[]>([]) // 观看记录列表
|
|||||||
* 获取观看记录
|
* 获取观看记录
|
||||||
*/
|
*/
|
||||||
const getLearnCourse = async () => {
|
const getLearnCourse = async () => {
|
||||||
|
try {
|
||||||
const res = await courseApi.getUserLateCourseList()
|
const res = await courseApi.getUserLateCourseList()
|
||||||
if (res && res.code === 0) {
|
if (res && res.code === 0) {
|
||||||
if (res.page && res.page.length > 0) {
|
if (res.page && res.page.length > 0) {
|
||||||
@@ -365,6 +378,9 @@ const getLearnCourse = async () => {
|
|||||||
learnList.value = []
|
learnList.value = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取观看记录失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新闻播报
|
// 新闻播报
|
||||||
@@ -373,6 +389,7 @@ const newsList = ref<INews[]>([]) // 新闻列表
|
|||||||
* 获取新闻列表
|
* 获取新闻列表
|
||||||
*/
|
*/
|
||||||
const getNewsList = async () => {
|
const getNewsList = async () => {
|
||||||
|
try {
|
||||||
const res = await commonApi.getMessageList(0, 1, 0)
|
const res = await commonApi.getMessageList(0, 1, 0)
|
||||||
if (res && res.code === 0) {
|
if (res && res.code === 0) {
|
||||||
if (res.messages && res.messages.length > 0) {
|
if (res.messages && res.messages.length > 0) {
|
||||||
@@ -381,6 +398,9 @@ const getNewsList = async () => {
|
|||||||
newsList.value = []
|
newsList.value = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取新闻列表失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 新闻点击处理
|
* 新闻点击处理
|
||||||
@@ -403,6 +423,7 @@ const tryListenList = ref<ICourse[]>([]) // 试听课程列表
|
|||||||
* 获取试听课程列表
|
* 获取试听课程列表
|
||||||
*/
|
*/
|
||||||
const getTryListenList = async () => {
|
const getTryListenList = async () => {
|
||||||
|
try {
|
||||||
const res = await courseApi.getMarketCourseList({
|
const res = await courseApi.getMarketCourseList({
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 6,
|
limit: 6,
|
||||||
@@ -415,6 +436,9 @@ const getTryListenList = async () => {
|
|||||||
tryListenList.value = []
|
tryListenList.value = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取试听课程失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ const subCategoryList = ref<ICategory[]>([]) // 子级分类列表
|
|||||||
* 获取分类下的子级分类
|
* 获取分类下的子级分类
|
||||||
*/
|
*/
|
||||||
const getSubCategoryList = async () => {
|
const getSubCategoryList = async () => {
|
||||||
|
try {
|
||||||
let res: any = null
|
let res: any = null
|
||||||
switch (subject.value) {
|
switch (subject.value) {
|
||||||
case '医学':
|
case '医学':
|
||||||
@@ -73,6 +74,9 @@ const getSubCategoryList = async () => {
|
|||||||
radio_category_id.value = 0
|
radio_category_id.value = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取分类下的子级分类失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -191,12 +191,16 @@ const getCode = async () => {
|
|||||||
if (!isEmailEmpty()) return
|
if (!isEmailEmpty()) return
|
||||||
if (!isEmailVerified(email.value)) return
|
if (!isEmailVerified(email.value)) return
|
||||||
|
|
||||||
|
try {
|
||||||
await commonApi.sendMailCaptcha(email.value)
|
await commonApi.sendMailCaptcha(email.value)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: t('login.sendCodeSuccess'),
|
title: t('login.sendCodeSuccess'),
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
getCodeState()
|
getCodeState()
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Send code error:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,6 +264,7 @@ const onSubmit = async () => {
|
|||||||
if (!isConfirmPasswordEmpty()) return
|
if (!isConfirmPasswordEmpty()) return
|
||||||
if (!isPasswordMatch()) return
|
if (!isPasswordMatch()) return
|
||||||
|
|
||||||
|
try {
|
||||||
await resetPassword(email.value, code.value, password.value)
|
await resetPassword(email.value, code.value, password.value)
|
||||||
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -270,6 +275,9 @@ const onSubmit = async () => {
|
|||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Reset password error:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -285,8 +285,13 @@ const verifyCodeLogin = async () => {
|
|||||||
|
|
||||||
if (!isCodeEmpty()) return false
|
if (!isCodeEmpty()) return false
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await loginWithCode(email.value, code.value)
|
const res = await loginWithCode(email.value, code.value)
|
||||||
return res || null
|
return res
|
||||||
|
} catch (error) {
|
||||||
|
console.error('验证码登录失败:', error)
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 密码登录
|
// 密码登录
|
||||||
const passwordLogin = async () => {
|
const passwordLogin = async () => {
|
||||||
@@ -296,8 +301,13 @@ const passwordLogin = async () => {
|
|||||||
|
|
||||||
if (!isPasswordEmpty()) return false
|
if (!isPasswordEmpty()) return false
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await loginWithPassword(phoneEmail.value, password.value)
|
const res = await loginWithPassword(phoneEmail.value, password.value)
|
||||||
return res || null
|
return res
|
||||||
|
} catch (error) {
|
||||||
|
console.error('密码登录失败:', error)
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 提交登录
|
// 提交登录
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
|||||||
@@ -26,8 +26,28 @@
|
|||||||
<!-- 商品信息 -->
|
<!-- 商品信息 -->
|
||||||
<view class="goods-info">
|
<view class="goods-info">
|
||||||
<text class="goods-name">{{ item.productName }}</text>
|
<text class="goods-name">{{ item.productName }}</text>
|
||||||
<!-- 商品价格组件 -->
|
|
||||||
<GoodsPrice :goods="item" />
|
<!-- 价格信息 -->
|
||||||
|
<view class="price-info">
|
||||||
|
<!-- VIP优惠价 -->
|
||||||
|
<!-- <view v-if="item.isVipPrice === 1 && item.vipPrice" class="price-row">
|
||||||
|
<text class="vip-price">¥{{ item.vipPrice.toFixed(2) }}</text>
|
||||||
|
<text class="vip-label">{{ $t('order.vipPriceLabel') }}</text>
|
||||||
|
<text class="original-price">¥{{ item.price.toFixed(2) }}</text>
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
<!-- 活动价 -->
|
||||||
|
<!-- <view v-else-if="item.activityPrice && item.activityPrice > 0" class="price-row">
|
||||||
|
<text class="activity-price">¥{{ item.activityPrice.toFixed(2) }}</text>
|
||||||
|
<text class="activity-label">{{ $t('order.activityLabel') }}</text>
|
||||||
|
<text class="original-price">¥{{ item.price.toFixed(2) }}</text>
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
<!-- 普通价格 -->
|
||||||
|
<view class="price-row">
|
||||||
|
<text class="normal-price">{{ item.price.toFixed(2) }} 天医币</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 数量 -->
|
<!-- 数量 -->
|
||||||
<!-- <view class="quantity-row">
|
<!-- <view class="quantity-row">
|
||||||
@@ -49,21 +69,26 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { orderApi } from '@/api/modules/order'
|
import { orderApi } from '@/api/modules/order'
|
||||||
import type { IOrderGoods } from '@/types/order'
|
|
||||||
import Confirm from '@/components/order/Confirm.vue';
|
import Confirm from '@/components/order/Confirm.vue';
|
||||||
import GoodsPrice from '@/components/order/GoodsPrice.vue';
|
import type { IOrderGoods } from '@/types/order'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
*/
|
*/
|
||||||
const userInfo = ref({})
|
const userInfo = ref(null)
|
||||||
const getUserInfo = async () => {
|
const getUserInfo = async () => {
|
||||||
|
try {
|
||||||
const res = await orderApi.getUserInfo()
|
const res = await orderApi.getUserInfo()
|
||||||
|
if (res.code === 0) {
|
||||||
userInfo.value = res.result || {}
|
userInfo.value = res.result || {}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取用户信息失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取商品列表
|
* 获取商品列表
|
||||||
@@ -71,12 +96,16 @@ const getUserInfo = async () => {
|
|||||||
const goodsIds = ref<string>('')
|
const goodsIds = ref<string>('')
|
||||||
const goodsList = ref<IOrderGoods[]>([])
|
const goodsList = ref<IOrderGoods[]>([])
|
||||||
const getGoodsList = async () => {
|
const getGoodsList = async () => {
|
||||||
|
try {
|
||||||
// 获取商品详情
|
// 获取商品详情
|
||||||
const res = await orderApi.getShopProductListByIds(goodsIds.value)
|
const res = await orderApi.getShopProductListByIds(goodsIds.value)
|
||||||
|
|
||||||
if (res.shopProductList?.length > 0) {
|
if (res.code === 0 && res.shopProductList?.length > 0) {
|
||||||
goodsList.value = res.shopProductList
|
goodsList.value = res.shopProductList
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取商品列表失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,6 +181,43 @@ onLoad(async (options: any) => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.price-info {
|
||||||
|
.price-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 10rpx;
|
||||||
|
|
||||||
|
.vip-price,
|
||||||
|
.activity-price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #e97512;
|
||||||
|
}
|
||||||
|
|
||||||
|
.normal-price {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vip-label {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #fa2d12;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-label {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #613804;
|
||||||
|
}
|
||||||
|
|
||||||
|
.original-price {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.quantity-row {
|
.quantity-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<ProductInfo v-if="order.orderType === 'abroadBook'" :data="order.bookEntity" :type="order.orderType" />
|
<ProductInfo v-if="order.orderType === 'abroadBook'" :data="order.bookEntity" :type="order.orderType" />
|
||||||
<ProductInfo v-if="order.orderType === 'vip'" :data="order.vipBuyConfigEntity" :type="order.orderType" />
|
<ProductInfo v-if="order.orderType === 'vip'" :data="order.vipBuyConfigEntity" :type="order.orderType" />
|
||||||
<!-- 三种订单类型商品信息 end -->
|
<!-- 三种订单类型商品信息 end -->
|
||||||
<view class="order-item-total-price">实付款:{{ order.orderMoney }} {{ t('global.coin') }}</view>
|
<view class="order-item-total-price">实付款:{{ order.orderMoney }} 天医币</view>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<view>
|
<view>
|
||||||
|
|||||||
@@ -199,11 +199,15 @@ const avatarUrl = ref('')
|
|||||||
*/
|
*/
|
||||||
const userInfo = ref<any>({}) // 用户信息
|
const userInfo = ref<any>({}) // 用户信息
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
|
try {
|
||||||
const res = await getUserInfo()
|
const res = await getUserInfo()
|
||||||
if (res.result) {
|
if (res.result) {
|
||||||
userStore.setUserInfo(res.result)
|
userStore.setUserInfo(res.result)
|
||||||
userInfo.value = res.result
|
userInfo.value = res.result
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取用户信息失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -320,12 +324,16 @@ const sendCode = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
await sendEmailCode(editForm.value.email)
|
await sendEmailCode(editForm.value.email)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: t('user.sendCodeSuccess'),
|
title: t('user.sendCodeSuccess'),
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
startCountdown()
|
startCountdown()
|
||||||
|
} catch (error) {
|
||||||
|
console.error('发送验证码失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -390,6 +398,7 @@ const checkPasswordStrength = () => {
|
|||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const key = currentField.value?.key
|
const key = currentField.value?.key
|
||||||
|
|
||||||
|
try {
|
||||||
// 构建更新数据对象
|
// 构建更新数据对象
|
||||||
let updateData: any = Object.assign({}, userInfo.value)
|
let updateData: any = Object.assign({}, userInfo.value)
|
||||||
|
|
||||||
@@ -472,6 +481,9 @@ const handleSubmit = async () => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getData()
|
getData()
|
||||||
}, 500)
|
}, 500)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('更新失败:', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
:class="aloneItem.priceTypeId === item.priceTypeId ? 'selected' : ''"
|
:class="aloneItem.priceTypeId === item.priceTypeId ? 'selected' : ''"
|
||||||
v-for="item in rechargeList.bookBuyConfigList" :key="item.priceTypeId">
|
v-for="item in rechargeList.bookBuyConfigList" :key="item.priceTypeId">
|
||||||
<view class="recharge_money">¥{{item.money}}</view>
|
<view class="recharge_money">¥{{item.money}}</view>
|
||||||
<view>{{item.realMoney}}{{ t('global.coin') }}</view>
|
<view>{{item.realMoney}}{{$t('order.virtualCoin')}}</view>
|
||||||
<!-- 红框位置的618活动标签 -->
|
<!-- 红框位置的618活动标签 -->
|
||||||
<!-- <view class="activity-tag">618活动</view> -->
|
<!-- <view class="activity-tag">618活动</view> -->
|
||||||
<span class="activity-label" v-if="item.givejf >0">618充值活动</span>
|
<span class="activity-label" v-if="item.givejf >0">618充值活动</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user