Compare commits
9 Commits
v1.0.9-goo
...
04e2196942
| Author | SHA1 | Date | |
|---|---|---|---|
| 04e2196942 | |||
| 6e5d63febe | |||
| 3ce5e07573 | |||
| d98e1ef024 | |||
| b8dd0584aa | |||
| b3d9b0c100 | |||
| 66b004d6bf | |||
| c3b84946fb | |||
| b671e8d76c |
26
App.vue
26
App.vue
@@ -1,10 +1,33 @@
|
|||||||
<script>
|
<script>
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
import update from "@/uni_modules/uni-upgrade-center-app/utils/check-update";
|
import update from "@/uni_modules/uni-upgrade-center-app/utils/check-update";
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
|
const userStore = useUserStore()
|
||||||
console.log('App Launch')
|
console.log('App Launch')
|
||||||
|
// 保存原生 switchTab 方法
|
||||||
|
const originalSwitchTab = uni.switchTab;
|
||||||
|
uni.switchTab = (options) => {
|
||||||
|
if (options.url.includes('/pages/book/index') && !uni.getStorageSync('token')) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '请先登录后访问该页面',
|
||||||
|
confirmText: '去登录',
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res, 'res');
|
||||||
|
if (res.confirm) uni.navigateTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return; // 拦截跳转
|
||||||
|
}
|
||||||
|
// 已登录/非拦截页 → 执行原生跳转
|
||||||
|
originalSwitchTab.call(uni, options);
|
||||||
|
}
|
||||||
// 检测自动更新
|
// 检测自动更新
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
update();
|
update();
|
||||||
@@ -15,6 +38,9 @@
|
|||||||
},
|
},
|
||||||
onHide: function() {
|
onHide: function() {
|
||||||
console.log('App Hide')
|
console.log('App Hide')
|
||||||
|
},
|
||||||
|
onTabItemTap: function() {
|
||||||
|
console.log('点击了');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
9
api/clients/index.ts
Normal file
9
api/clients/index.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { skeletonClient } from './skeleton'
|
||||||
|
import { mainClient } from './main'
|
||||||
|
import { paymentClient } from './payment'
|
||||||
|
|
||||||
|
export {
|
||||||
|
skeletonClient,
|
||||||
|
mainClient,
|
||||||
|
paymentClient
|
||||||
|
}
|
||||||
@@ -3,5 +3,5 @@ import { createRequestClient } from '../request';
|
|||||||
import { SERVICE_MAP } from '../config';
|
import { SERVICE_MAP } from '../config';
|
||||||
|
|
||||||
export const mainClient = createRequestClient({
|
export const mainClient = createRequestClient({
|
||||||
baseURL: SERVICE_MAP.MAIN,
|
baseURL: SERVICE_MAP.MAIN
|
||||||
});
|
});
|
||||||
|
|||||||
8
api/clients/skeleton.ts
Normal file
8
api/clients/skeleton.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// api/clients/main.ts
|
||||||
|
import { createRequestClient } from '../request';
|
||||||
|
import { SERVICE_MAP } from '../config';
|
||||||
|
|
||||||
|
export const skeletonClient = createRequestClient({
|
||||||
|
baseURL: SERVICE_MAP.MAIN,
|
||||||
|
loading: false
|
||||||
|
})
|
||||||
@@ -8,7 +8,7 @@ import type { ILoginResponse } from '@/types/user'
|
|||||||
* @param code 验证码
|
* @param code 验证码
|
||||||
*/
|
*/
|
||||||
export async function loginWithCode(tel: string, code: string) {
|
export async function loginWithCode(tel: string, code: string) {
|
||||||
const res = await mainClient.request<IApiResponse<ILoginResponse>>({
|
const res = await mainClient.request<ILoginResponse>({
|
||||||
url: 'book/user/registerOrLogin',
|
url: 'book/user/registerOrLogin',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: { tel, code }
|
data: { tel, code }
|
||||||
@@ -22,7 +22,7 @@ export async function loginWithCode(tel: string, code: string) {
|
|||||||
* @param password 密码
|
* @param password 密码
|
||||||
*/
|
*/
|
||||||
export async function loginWithPassword(phone: string, password: string) {
|
export async function loginWithPassword(phone: string, password: string) {
|
||||||
const res = await mainClient.request<IApiResponse<ILoginResponse>>({
|
const res = await mainClient.request<ILoginResponse>({
|
||||||
url: 'book/user/login',
|
url: 'book/user/login',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// api/modules/book.ts
|
// api/modules/book.ts
|
||||||
import { createRequestClient } from '../request'
|
import { mainClient, skeletonClient } from '@/api/clients'
|
||||||
import { SERVICE_MAP } from '../config'
|
|
||||||
import type { IApiResponse } from '../types'
|
import type { IApiResponse } from '../types'
|
||||||
import type {
|
import type {
|
||||||
IBook,
|
IBook,
|
||||||
@@ -13,8 +12,6 @@ import type {
|
|||||||
} from '@/types/book'
|
} from '@/types/book'
|
||||||
import type { IGoods } from '@/types/order'
|
import type { IGoods } from '@/types/order'
|
||||||
|
|
||||||
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 书籍相关API
|
* 书籍相关API
|
||||||
*/
|
*/
|
||||||
@@ -25,7 +22,7 @@ export const bookApi = {
|
|||||||
* @param limit 每页数量
|
* @param limit 每页数量
|
||||||
*/
|
*/
|
||||||
getMyBooks(current: number, limit: number) {
|
getMyBooks(current: number, limit: number) {
|
||||||
return client.request<IApiResponse<{ page: IPageData<IBook> }>>({
|
return mainClient.request<IApiResponse<{ page: IPageData<IBook> }>>({
|
||||||
url: 'bookAbroad/home/getMyBooks',
|
url: 'bookAbroad/home/getMyBooks',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { current, limit }
|
data: { current, limit }
|
||||||
@@ -37,7 +34,7 @@ export const bookApi = {
|
|||||||
* @param bookId 书籍ID
|
* @param bookId 书籍ID
|
||||||
*/
|
*/
|
||||||
getBookInfo(bookId: number) {
|
getBookInfo(bookId: number) {
|
||||||
return client.request<IApiResponse<{ bookInfo: IBookDetail }>>({
|
return skeletonClient.request<IApiResponse<{ bookInfo: IBookDetail }>>({
|
||||||
url: 'bookAbroad/home/getBookInfo',
|
url: 'bookAbroad/home/getBookInfo',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { bookId }
|
data: { bookId }
|
||||||
@@ -49,7 +46,7 @@ export const bookApi = {
|
|||||||
* @param bookId 书籍ID
|
* @param bookId 书籍ID
|
||||||
*/
|
*/
|
||||||
getBookReadCount(bookId: number) {
|
getBookReadCount(bookId: number) {
|
||||||
return client.request<IApiResponse<{
|
return skeletonClient.request<IApiResponse<{
|
||||||
readCount: number
|
readCount: number
|
||||||
listenCount: number
|
listenCount: number
|
||||||
buyCount: number
|
buyCount: number
|
||||||
@@ -65,7 +62,7 @@ export const bookApi = {
|
|||||||
* @param bookId 书籍ID
|
* @param bookId 书籍ID
|
||||||
*/
|
*/
|
||||||
getRecommendBook(bookId: number) {
|
getRecommendBook(bookId: number) {
|
||||||
return client.request<IApiResponse<{ bookList: IBook[] }>>({
|
return skeletonClient.request<IApiResponse<{ bookList: IBook[] }>>({
|
||||||
url: 'bookAbroad/home/getRecommendBook',
|
url: 'bookAbroad/home/getRecommendBook',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { bookId }
|
data: { bookId }
|
||||||
@@ -79,7 +76,7 @@ export const bookApi = {
|
|||||||
* @param limit 每页数量
|
* @param limit 每页数量
|
||||||
*/
|
*/
|
||||||
getBookComments(bookId: number, current: number, limit: number) {
|
getBookComments(bookId: number, current: number, limit: number) {
|
||||||
return client.request<IApiResponse<{
|
return mainClient.request<IApiResponse<{
|
||||||
commentsTree: IComment[]
|
commentsTree: IComment[]
|
||||||
commentsCount: number
|
commentsCount: number
|
||||||
}>>({
|
}>>({
|
||||||
@@ -96,7 +93,7 @@ export const bookApi = {
|
|||||||
* @param pid 父评论ID,默认为0表示顶级评论
|
* @param pid 父评论ID,默认为0表示顶级评论
|
||||||
*/
|
*/
|
||||||
insertComment(bookId: number, content: string, pid: number = 0) {
|
insertComment(bookId: number, content: string, pid: number = 0) {
|
||||||
return client.request<IApiResponse>({
|
return mainClient.request<IApiResponse>({
|
||||||
url: 'bookAbroad/insertBookAbroadComment',
|
url: 'bookAbroad/insertBookAbroadComment',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { bookId, content, pid }
|
data: { bookId, content, pid }
|
||||||
@@ -108,7 +105,7 @@ export const bookApi = {
|
|||||||
* @param commentId 评论ID
|
* @param commentId 评论ID
|
||||||
*/
|
*/
|
||||||
likeComment(commentId: number) {
|
likeComment(commentId: number) {
|
||||||
return client.request<IApiResponse>({
|
return mainClient.request<IApiResponse>({
|
||||||
url: 'bookAbroad/insertBookAbroadCommentLike',
|
url: 'bookAbroad/insertBookAbroadCommentLike',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { commentId }
|
data: { commentId }
|
||||||
@@ -120,7 +117,7 @@ export const bookApi = {
|
|||||||
* @param commentId 评论ID
|
* @param commentId 评论ID
|
||||||
*/
|
*/
|
||||||
unlikeComment(commentId: number) {
|
unlikeComment(commentId: number) {
|
||||||
return client.request<IApiResponse>({
|
return mainClient.request<IApiResponse>({
|
||||||
url: 'bookAbroad/delBookAbroadCommentLike',
|
url: 'bookAbroad/delBookAbroadCommentLike',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { commentId }
|
data: { commentId }
|
||||||
@@ -132,7 +129,7 @@ export const bookApi = {
|
|||||||
* @param commentId 评论ID
|
* @param commentId 评论ID
|
||||||
*/
|
*/
|
||||||
deleteComment(commentId: number) {
|
deleteComment(commentId: number) {
|
||||||
return client.request<IApiResponse>({
|
return mainClient.request<IApiResponse>({
|
||||||
url: 'bookAbroad/delBookAbroadComment',
|
url: 'bookAbroad/delBookAbroadComment',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { commentId }
|
data: { commentId }
|
||||||
@@ -144,7 +141,7 @@ export const bookApi = {
|
|||||||
* @param bookId 书籍ID
|
* @param bookId 书籍ID
|
||||||
*/
|
*/
|
||||||
getBookChapter(data: { bookId: number; language: string }) {
|
getBookChapter(data: { bookId: number; language: string }) {
|
||||||
return client.request<IApiResponse<{ chapterList: IChapter[] }>>({
|
return mainClient.request<IApiResponse<{ chapterList: IChapter[] }>>({
|
||||||
url: 'bookAbroad/home/getBookChapter',
|
url: 'bookAbroad/home/getBookChapter',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
@@ -156,7 +153,7 @@ export const bookApi = {
|
|||||||
* @param chapterId 章节ID
|
* @param chapterId 章节ID
|
||||||
*/
|
*/
|
||||||
getChapterContent(chapterId: number) {
|
getChapterContent(chapterId: number) {
|
||||||
return client.request<IApiResponse<{ contentPage: IChapterContent[] }>>({
|
return mainClient.request<IApiResponse<{ contentPage: IChapterContent[] }>>({
|
||||||
url: 'bookAbroad/home/getBookChapterContent',
|
url: 'bookAbroad/home/getBookChapterContent',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { chapterId }
|
data: { chapterId }
|
||||||
@@ -168,7 +165,7 @@ export const bookApi = {
|
|||||||
* @param bookId 书籍ID
|
* @param bookId 书籍ID
|
||||||
*/
|
*/
|
||||||
getReadProgress(bookId: number) {
|
getReadProgress(bookId: number) {
|
||||||
return client.request<IApiResponse<{ bookReadRate: IReadProgress | null }>>({
|
return mainClient.request<IApiResponse<{ bookReadRate: IReadProgress | null }>>({
|
||||||
url: 'bookAbroad/home/getBookReadRate',
|
url: 'bookAbroad/home/getBookReadRate',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { bookId }
|
data: { bookId }
|
||||||
@@ -182,7 +179,7 @@ export const bookApi = {
|
|||||||
* @param contentId 内容ID
|
* @param contentId 内容ID
|
||||||
*/
|
*/
|
||||||
saveReadProgress(bookId: number, chapterId: number, contentId: number) {
|
saveReadProgress(bookId: number, chapterId: number, contentId: number) {
|
||||||
return client.request<IApiResponse>({
|
return mainClient.request<IApiResponse>({
|
||||||
url: 'bookAbroad/home/insertBookReadRate',
|
url: 'bookAbroad/home/insertBookReadRate',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { bookId, chapterId, contentId }
|
data: { bookId, chapterId, contentId }
|
||||||
@@ -196,7 +193,7 @@ export const bookApi = {
|
|||||||
* @param contentId 内容ID
|
* @param contentId 内容ID
|
||||||
*/
|
*/
|
||||||
getBookLanguages(bookId: number) {
|
getBookLanguages(bookId: number) {
|
||||||
return client.request<IApiResponse>({
|
return mainClient.request<IApiResponse>({
|
||||||
url: 'bookAbroad/home/getBookLanguage',
|
url: 'bookAbroad/home/getBookLanguage',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { bookId }
|
data: { bookId }
|
||||||
@@ -208,7 +205,7 @@ export const bookApi = {
|
|||||||
* @param chapterId 章节ID
|
* @param chapterId 章节ID
|
||||||
*/
|
*/
|
||||||
getChapterContentListen(chapterId: number) {
|
getChapterContentListen(chapterId: number) {
|
||||||
return client.request<IApiResponse<{ bookChapterContents: any[] }>>({
|
return mainClient.request<IApiResponse<{ bookChapterContents: any[] }>>({
|
||||||
url: 'bookAbroad/home/getBookChapterContentListen',
|
url: 'bookAbroad/home/getBookChapterContentListen',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { chapterId }
|
data: { chapterId }
|
||||||
@@ -220,7 +217,7 @@ export const bookApi = {
|
|||||||
* @param bookId 书籍ID
|
* @param bookId 书籍ID
|
||||||
*/
|
*/
|
||||||
getBookGoods(bookId: number) {
|
getBookGoods(bookId: number) {
|
||||||
return client.request<IApiResponse<{ goodsList: IGoods[] }>>({
|
return mainClient.request<IApiResponse<{ goodsList: IGoods[] }>>({
|
||||||
url: 'bookAbroad/home/getProductListForBook',
|
url: 'bookAbroad/home/getProductListForBook',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { bookId }
|
data: { bookId }
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// api/modules/home.ts
|
// api/modules/home.ts
|
||||||
import { createRequestClient } from '../request'
|
import { mainClient, skeletonClient } from '@/api/clients'
|
||||||
import { SERVICE_MAP } from '../config'
|
|
||||||
import type {
|
import type {
|
||||||
IMyBooksResponse,
|
IMyBooksResponse,
|
||||||
IRecommendBooksResponse,
|
IRecommendBooksResponse,
|
||||||
@@ -10,17 +9,15 @@ import type {
|
|||||||
ISearchResponse
|
ISearchResponse
|
||||||
} from '@/types/book'
|
} from '@/types/book'
|
||||||
|
|
||||||
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页相关API
|
* 首页相关API
|
||||||
*/
|
*/
|
||||||
export const homeApi = {
|
export const bookHomeApi = {
|
||||||
/**
|
/**
|
||||||
* 获取VIP信息
|
* 获取VIP信息
|
||||||
*/
|
*/
|
||||||
getVipInfo() {
|
getVipInfo() {
|
||||||
return client.request<IVipInfoResponse>({
|
return mainClient.request<IVipInfoResponse>({
|
||||||
url: 'bookAbroad/home/getVipInfo',
|
url: 'bookAbroad/home/getVipInfo',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {}
|
data: {}
|
||||||
@@ -33,7 +30,7 @@ export const homeApi = {
|
|||||||
* @param limit 每页数量
|
* @param limit 每页数量
|
||||||
*/
|
*/
|
||||||
getMyBooks(current: number, limit: number) {
|
getMyBooks(current: number, limit: number) {
|
||||||
return client.request<IMyBooksResponse>({
|
return skeletonClient.request<IMyBooksResponse>({
|
||||||
url: 'bookAbroad/home/getMyBooks',
|
url: 'bookAbroad/home/getMyBooks',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { current, limit }
|
data: { current, limit }
|
||||||
@@ -44,7 +41,7 @@ export const homeApi = {
|
|||||||
* 获取推荐图书
|
* 获取推荐图书
|
||||||
*/
|
*/
|
||||||
getRecommendBooks() {
|
getRecommendBooks() {
|
||||||
return client.request<IRecommendBooksResponse>({
|
return skeletonClient.request<IRecommendBooksResponse>({
|
||||||
url: 'bookAbroad/home/getRecommendBooks',
|
url: 'bookAbroad/home/getRecommendBooks',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {}
|
data: {}
|
||||||
@@ -56,7 +53,7 @@ export const homeApi = {
|
|||||||
* @param type 0: 分类标签, 1: 活动标签
|
* @param type 0: 分类标签, 1: 活动标签
|
||||||
*/
|
*/
|
||||||
getBookLabelList(type: number) {
|
getBookLabelList(type: number) {
|
||||||
return client.request<ILabelListResponse>({
|
return skeletonClient.request<ILabelListResponse>({
|
||||||
url: 'bookAbroad/home/getBookAbroadLableList',
|
url: 'bookAbroad/home/getBookAbroadLableList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { type }
|
data: { type }
|
||||||
@@ -68,7 +65,7 @@ export const homeApi = {
|
|||||||
* @param pid 父级标签ID
|
* @param pid 父级标签ID
|
||||||
*/
|
*/
|
||||||
getSubLabelList(pid: number) {
|
getSubLabelList(pid: number) {
|
||||||
return client.request<ILabelListResponse>({
|
return skeletonClient.request<ILabelListResponse>({
|
||||||
url: 'bookAbroad/home/getBookAbroadLableListByPid',
|
url: 'bookAbroad/home/getBookAbroadLableListByPid',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { pid }
|
data: { pid }
|
||||||
@@ -80,7 +77,7 @@ export const homeApi = {
|
|||||||
* @param lableId 标签ID(注意:原接口参数名为 lableId)
|
* @param lableId 标签ID(注意:原接口参数名为 lableId)
|
||||||
*/
|
*/
|
||||||
getBooksByLabel(lableId: number) {
|
getBooksByLabel(lableId: number) {
|
||||||
return client.request<IBookListResponse>({
|
return skeletonClient.request<IBookListResponse>({
|
||||||
url: 'bookAbroad/home/getAbroadBookListByLable',
|
url: 'bookAbroad/home/getAbroadBookListByLable',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { lableId }
|
data: { lableId }
|
||||||
@@ -96,7 +93,7 @@ export const homeApi = {
|
|||||||
page: number,
|
page: number,
|
||||||
limit: number,
|
limit: number,
|
||||||
}) {
|
}) {
|
||||||
return client.request<ISearchResponse>({
|
return mainClient.request<ISearchResponse>({
|
||||||
url: 'bookAbroad/home/searchBook',
|
url: 'bookAbroad/home/searchBook',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
// api/modules/common.ts
|
// api/modules/common.ts
|
||||||
import { mainClient } from '@/api/clients/main'
|
import { mainClient, skeletonClient } from '@/api/clients'
|
||||||
import type { IApiResponse } from '@/api/types'
|
import type { IApiResponse } from '@/api/types'
|
||||||
import type { IAgreement } from '@/types/user'
|
import type { IAgreement } from '@/types/user'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
|
||||||
export const commonApi = {
|
export const commonApi = {
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +22,7 @@ export const commonApi = {
|
|||||||
* @param id 协议 ID (111: 用户协议, 112: 隐私政策)
|
* @param id 协议 ID (111: 用户协议, 112: 隐私政策)
|
||||||
*/
|
*/
|
||||||
getAgreement: async (id: number) => {
|
getAgreement: async (id: number) => {
|
||||||
const res = await mainClient.request<IApiResponse<IAgreement>>({
|
const res = await skeletonClient.request<IApiResponse<IAgreement>>({
|
||||||
url: 'sys/agreement/getAgreement',
|
url: 'sys/agreement/getAgreement',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { id }
|
data: { id }
|
||||||
@@ -36,8 +37,9 @@ export const commonApi = {
|
|||||||
* @returns 消息列表
|
* @returns 消息列表
|
||||||
*/
|
*/
|
||||||
getMessageList(isBook: number, isMedical: number, isSociology: number) {
|
getMessageList(isBook: number, isMedical: number, isSociology: number) {
|
||||||
return mainClient.request<IMessageListResponse>({
|
const userStore = useUserStore()
|
||||||
url: 'common/message/listByPage',
|
return skeletonClient.request<IApiResponse>({
|
||||||
|
url: userStore.token ? 'common/message/listByPage' : '/visitor/listByPage',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { isBook, isMedical, isSociology }
|
data: { isBook, isMedical, isSociology }
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
// api/modules/course.ts
|
// api/modules/course.ts
|
||||||
import { createRequestClient } from '../request'
|
import { skeletonClient, mainClient } from '@/api/clients/index'
|
||||||
import { SERVICE_MAP } from '../config'
|
|
||||||
import type { IApiResponse } from '../types'
|
import type { IApiResponse } from '../types'
|
||||||
import type {
|
import type {
|
||||||
ICourseMedicalTreeResponse,
|
ICourseCategoryResponse,
|
||||||
IUserLateCourseListResponse,
|
IUserLateCourseListResponse,
|
||||||
IMarketCourseListResponse,
|
IMarketCourseListResponse,
|
||||||
ICourseDetailResponse,
|
ICourseDetailResponse,
|
||||||
@@ -14,8 +13,7 @@ import type {
|
|||||||
} from '@/types/course'
|
} from '@/types/course'
|
||||||
import type { ISearchRequest, ISearchResponse } from '@/types/search'
|
import type { ISearchRequest, ISearchResponse } from '@/types/search'
|
||||||
import type { ICommentListResponse, IAddCommentResponse, IComment } from '@/types/comment'
|
import type { ICommentListResponse, IAddCommentResponse, IComment } from '@/types/comment'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程相关API
|
* 课程相关API
|
||||||
@@ -26,7 +24,7 @@ export const courseApi = {
|
|||||||
* @returns 分类数据
|
* @returns 分类数据
|
||||||
*/
|
*/
|
||||||
getCourseMedicalTree() {
|
getCourseMedicalTree() {
|
||||||
return client.request<ICourseMedicalTreeResponse>({
|
return mainClient.request<ICourseCategoryResponse>({
|
||||||
url: 'medical/home/getCourseMedicalTree',
|
url: 'medical/home/getCourseMedicalTree',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {}
|
data: {}
|
||||||
@@ -38,7 +36,7 @@ export const courseApi = {
|
|||||||
* @returns 观看记录列表
|
* @returns 观看记录列表
|
||||||
*/
|
*/
|
||||||
getUserLateCourseList() {
|
getUserLateCourseList() {
|
||||||
return client.request<IUserLateCourseListResponse>({
|
return skeletonClient.request<IUserLateCourseListResponse>({
|
||||||
url: 'medical/home/getUserLateCourseList',
|
url: 'medical/home/getUserLateCourseList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {}
|
data: {}
|
||||||
@@ -57,8 +55,9 @@ export const courseApi = {
|
|||||||
page: number,
|
page: number,
|
||||||
limit: number
|
limit: number
|
||||||
}) {
|
}) {
|
||||||
return client.request<IMarketCourseListResponse>({
|
const userStore = useUserStore()
|
||||||
url: 'medical/home/getMarketCourseList',
|
return skeletonClient.request<IMarketCourseListResponse>({
|
||||||
|
url: userStore.token ? 'medical/home/getMarketCourseList' : 'visitor/getMarketCourseList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
@@ -70,7 +69,7 @@ export const courseApi = {
|
|||||||
* @returns 搜索结果
|
* @returns 搜索结果
|
||||||
*/
|
*/
|
||||||
searchData(data: ISearchRequest) {
|
searchData(data: ISearchRequest) {
|
||||||
return client.request<ISearchResponse>({
|
return mainClient.request<ISearchResponse>({
|
||||||
url: 'bookAbroad/home/searchCourse',
|
url: 'bookAbroad/home/searchCourse',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
@@ -82,7 +81,7 @@ export const courseApi = {
|
|||||||
* @param id 课程ID
|
* @param id 课程ID
|
||||||
*/
|
*/
|
||||||
getCourseDetail(id: number) {
|
getCourseDetail(id: number) {
|
||||||
return client.request<ICourseDetailResponse>({
|
return skeletonClient.request<ICourseDetailResponse>({
|
||||||
url: 'sociology/course/getCourseDetail',
|
url: 'sociology/course/getCourseDetail',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { id }
|
data: { id }
|
||||||
@@ -94,7 +93,7 @@ export const courseApi = {
|
|||||||
* @param id 目录ID
|
* @param id 目录ID
|
||||||
*/
|
*/
|
||||||
getCatalogueChapterList(id: number) {
|
getCatalogueChapterList(id: number) {
|
||||||
return client.request<IChapterListResponse>({
|
return skeletonClient.request<IChapterListResponse>({
|
||||||
url: 'sociology/course/getCourseCatalogueChapterList',
|
url: 'sociology/course/getCourseCatalogueChapterList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { id }
|
data: { id }
|
||||||
@@ -106,7 +105,7 @@ export const courseApi = {
|
|||||||
* @param id 章节ID
|
* @param id 章节ID
|
||||||
*/
|
*/
|
||||||
getChapterDetail(id: number) {
|
getChapterDetail(id: number) {
|
||||||
return client.request<IChapterDetailResponse>({
|
return skeletonClient.request<IChapterDetailResponse>({
|
||||||
url: 'sociology/course/getCourseCatalogueChapterDetail',
|
url: 'sociology/course/getCourseCatalogueChapterDetail',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { id, load: false }
|
data: { id, load: false }
|
||||||
@@ -118,7 +117,7 @@ export const courseApi = {
|
|||||||
* @param catalogueId 目录ID
|
* @param catalogueId 目录ID
|
||||||
*/
|
*/
|
||||||
startStudyForMF(catalogueId: number) {
|
startStudyForMF(catalogueId: number) {
|
||||||
return client.request<IApiResponse>({
|
return mainClient.request<IApiResponse>({
|
||||||
url: 'sociology/course/startStudyForMF',
|
url: 'sociology/course/startStudyForMF',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { catalogueId }
|
data: { catalogueId }
|
||||||
@@ -130,7 +129,7 @@ export const courseApi = {
|
|||||||
* @param id 目录ID
|
* @param id 目录ID
|
||||||
*/
|
*/
|
||||||
getProductListForCourse(id: number) {
|
getProductListForCourse(id: number) {
|
||||||
return client.request<IProductListResponse>({
|
return mainClient.request<IProductListResponse>({
|
||||||
url: 'sociology/product/getProductListForCourse',
|
url: 'sociology/product/getProductListForCourse',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { id }
|
data: { id }
|
||||||
@@ -142,7 +141,7 @@ export const courseApi = {
|
|||||||
* @param courseCatalogueId 目录ID
|
* @param courseCatalogueId 目录ID
|
||||||
*/
|
*/
|
||||||
checkRenewPayment(courseCatalogueId: number) {
|
checkRenewPayment(courseCatalogueId: number) {
|
||||||
return client.request<IApiResponse<{ canRelearn: boolean }>>({
|
return skeletonClient.request<IApiResponse<{ canRelearn: boolean }>>({
|
||||||
url: 'common/courseRelearn/courseCatalogueCanRelearn',
|
url: 'common/courseRelearn/courseCatalogueCanRelearn',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { courseCatalogueId }
|
data: { courseCatalogueId }
|
||||||
@@ -154,7 +153,7 @@ export const courseApi = {
|
|||||||
* @param catalogueId 目录ID
|
* @param catalogueId 目录ID
|
||||||
*/
|
*/
|
||||||
getRenewProductList(catalogueId: number) {
|
getRenewProductList(catalogueId: number) {
|
||||||
return client.request<IProductListResponse>({
|
return mainClient.request<IProductListResponse>({
|
||||||
url: 'common/courseRelearn/relearnShopProductList',
|
url: 'common/courseRelearn/relearnShopProductList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { catalogueId }
|
data: { catalogueId }
|
||||||
@@ -169,7 +168,7 @@ export const courseApi = {
|
|||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
*/
|
*/
|
||||||
getCourseComments(courseId: number, page: number, limit: number, userId: number) {
|
getCourseComments(courseId: number, page: number, limit: number, userId: number) {
|
||||||
return client.request<ICommentListResponse>({
|
return mainClient.request<ICommentListResponse>({
|
||||||
url: 'common/courseGuestbook/getCourseGuestbookList',
|
url: 'common/courseGuestbook/getCourseGuestbookList',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { courseId, page, limit, userId, chapterId: '' }
|
data: { courseId, page, limit, userId, chapterId: '' }
|
||||||
@@ -190,7 +189,7 @@ export const courseApi = {
|
|||||||
content: string
|
content: string
|
||||||
images: string
|
images: string
|
||||||
}) {
|
}) {
|
||||||
return client.request<IAddCommentResponse>({
|
return mainClient.request<IAddCommentResponse>({
|
||||||
url: 'common/courseGuestbook/addCourseGuestbook',
|
url: 'common/courseGuestbook/addCourseGuestbook',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
@@ -203,7 +202,7 @@ export const courseApi = {
|
|||||||
* @param guestbookId 留言ID
|
* @param guestbookId 留言ID
|
||||||
*/
|
*/
|
||||||
likeComment(userId: number, guestbookId: number) {
|
likeComment(userId: number, guestbookId: number) {
|
||||||
return client.request<IApiResponse>({
|
return mainClient.request<IApiResponse>({
|
||||||
url: 'common/courseGuestbook/addCourseGuestbookSupport',
|
url: 'common/courseGuestbook/addCourseGuestbookSupport',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { userId, guestbookId }
|
data: { userId, guestbookId }
|
||||||
@@ -216,7 +215,7 @@ export const courseApi = {
|
|||||||
* @param guestbookId 留言ID
|
* @param guestbookId 留言ID
|
||||||
*/
|
*/
|
||||||
unlikeComment(userId: number, guestbookId: number) {
|
unlikeComment(userId: number, guestbookId: number) {
|
||||||
return client.request<IApiResponse>({
|
return mainClient.request<IApiResponse>({
|
||||||
url: 'common/courseGuestbook/cancelCourseGuestbookSupport',
|
url: 'common/courseGuestbook/cancelCourseGuestbookSupport',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { userId, guestbookId }
|
data: { userId, guestbookId }
|
||||||
@@ -228,7 +227,7 @@ export const courseApi = {
|
|||||||
* @param courseId 课程ID
|
* @param courseId 课程ID
|
||||||
*/
|
*/
|
||||||
checkCourseVip(courseId: number) {
|
checkCourseVip(courseId: number) {
|
||||||
return client.request<IApiResponse<{ userVip: IVipInfo | null }>>({
|
return skeletonClient.request<IApiResponse<{ userVip: IVipInfo | null }>>({
|
||||||
url: 'common/userVip/ownCourseCatalogueByVip',
|
url: 'common/userVip/ownCourseCatalogueByVip',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { courseId }
|
data: { courseId }
|
||||||
@@ -240,7 +239,7 @@ export const courseApi = {
|
|||||||
* @param courseId 课程ID
|
* @param courseId 课程ID
|
||||||
*/
|
*/
|
||||||
getCourseVipModule(courseId: number) {
|
getCourseVipModule(courseId: number) {
|
||||||
return client.request<IApiResponse<{ list: string[] }>>({
|
return skeletonClient.request<IApiResponse<{ list: string[] }>>({
|
||||||
url: 'common/userVip/getCourseVipModule',
|
url: 'common/userVip/getCourseVipModule',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { courseId }
|
data: { courseId }
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import type {
|
|||||||
IMarketCourseListResponse,
|
IMarketCourseListResponse,
|
||||||
ICourseMedicalLabelsResponse
|
ICourseMedicalLabelsResponse
|
||||||
} from '@/types/course'
|
} from '@/types/course'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { skeletonClient } from '../clients'
|
||||||
|
|
||||||
|
|
||||||
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
|
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
|
||||||
|
|
||||||
@@ -20,8 +23,9 @@ export const courseSubjectClassificationApi = {
|
|||||||
* @returns 分类数据
|
* @returns 分类数据
|
||||||
*/
|
*/
|
||||||
getCourseMedicalTree() {
|
getCourseMedicalTree() {
|
||||||
|
const userStore = useUserStore()
|
||||||
return client.request<ICourseCategoryResponse>({
|
return client.request<ICourseCategoryResponse>({
|
||||||
url: 'medical/home/getCourseMedicalTree',
|
url: userStore.token ? 'medical/home/getCourseMedicalTree' : '/visitor/getCourseMedicalTree',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {}
|
data: {}
|
||||||
})
|
})
|
||||||
@@ -33,7 +37,7 @@ export const courseSubjectClassificationApi = {
|
|||||||
* @returns 分类数据
|
* @returns 分类数据
|
||||||
*/
|
*/
|
||||||
getCourseSoulTree() {
|
getCourseSoulTree() {
|
||||||
return client.request<ICourseCategoryResponse>({
|
return skeletonClient.request<ICourseCategoryResponse>({
|
||||||
url: 'psyche/home/getPsycheLabels',
|
url: 'psyche/home/getPsycheLabels',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { id: 0 }
|
data: { id: 0 }
|
||||||
@@ -46,7 +50,7 @@ export const courseSubjectClassificationApi = {
|
|||||||
* @returns 分类数据
|
* @returns 分类数据
|
||||||
*/
|
*/
|
||||||
getCourseSociologyTree() {
|
getCourseSociologyTree() {
|
||||||
return client.request<ICourseCategoryResponse>({
|
return skeletonClient.request<ICourseCategoryResponse>({
|
||||||
url: 'sociology/home/getSociologyLabels',
|
url: 'sociology/home/getSociologyLabels',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { id: 0 }
|
data: { id: 0 }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// api/modules/user.ts
|
// api/modules/user.ts
|
||||||
import { mainClient } from '@/api/clients/main'
|
import { mainClient, skeletonClient } from '@/api/clients'
|
||||||
import { paymentClient } from '@/api/clients/payment'
|
import { paymentClient } from '@/api/clients/payment'
|
||||||
import type { IApiResponse } from '@/api/types'
|
import type { IApiResponse } from '@/api/types'
|
||||||
import type {
|
import type {
|
||||||
@@ -17,7 +17,7 @@ import { SERVICE_MAP } from '@/api/config'
|
|||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
*/
|
*/
|
||||||
export async function getUserInfo() {
|
export async function getUserInfo() {
|
||||||
const res = await mainClient.request<IApiResponse<{ user: IUserInfo }>>({
|
const res = await skeletonClient.request<IApiResponse<{ user: IUserInfo }>>({
|
||||||
url: 'common/user/getUserInfo',
|
url: 'common/user/getUserInfo',
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
})
|
})
|
||||||
@@ -159,7 +159,7 @@ export function uploadImage(filePath: string): Promise<string> {
|
|||||||
url: `${SERVICE_MAP.MAIN}oss/fileoss`,
|
url: `${SERVICE_MAP.MAIN}oss/fileoss`,
|
||||||
filePath,
|
filePath,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
success: (res) => {
|
success: (res: any) => {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(res.data)
|
const data = JSON.parse(res.data)
|
||||||
if (data.url) {
|
if (data.url) {
|
||||||
@@ -304,9 +304,10 @@ export async function getPointsData(current : number, limit : number, userId : s
|
|||||||
* 迁移用户数据
|
* 迁移用户数据
|
||||||
* @param tel 旧账号
|
* @param tel 旧账号
|
||||||
* @param code 迁移验证码
|
* @param code 迁移验证码
|
||||||
|
* @param type 未迁移数据类型
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
export async function migrateUserData(data: { tel: string, code: string }) {
|
export async function migrateUserData(data: { tel: string, code: string, type: string }) {
|
||||||
const res = await mainClient.request<IApiResponse>({
|
const res = await mainClient.request<IApiResponse>({
|
||||||
url: 'common/user/migrationWumenData',
|
url: 'common/user/migrationWumenData',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -314,3 +315,64 @@ export async function migrateUserData(data: { tel: string, code: string }) {
|
|||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户迁移信息
|
||||||
|
* @return {
|
||||||
|
* alreadyMigration: 已迁移用户数
|
||||||
|
* notMigration: 未迁移用户数
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
export async function getUserMigrateInfo() {
|
||||||
|
const res = await mainClient.request<IApiResponse>({
|
||||||
|
url: 'common/user/getMigrationList',
|
||||||
|
method: 'POST',
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的湖分
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
export async function getUserContributionData() {
|
||||||
|
const res = await mainClient.request<IApiResponse>({
|
||||||
|
url: 'common/userContribution/getUserContribution',
|
||||||
|
method: 'POST'
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 湖分列表
|
||||||
|
* @param current 当前页码
|
||||||
|
* @param limit 每页数量
|
||||||
|
* @param type 湖分类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
export async function getUserContributionByTypeList(current : number, limit : number, type : string,) {
|
||||||
|
const res = await mainClient.request<IApiResponse>({
|
||||||
|
url: 'common/userContribution/getUserContributionByType',
|
||||||
|
method: 'POST',
|
||||||
|
data: { current, limit, type, }
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ios支付
|
||||||
|
* @param transactionId 支付交易id
|
||||||
|
* @param productId 商品id
|
||||||
|
* @param orderId 订单id
|
||||||
|
* @param receiptData 苹果返回收据
|
||||||
|
* @param customerOid 用户id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
export async function getIosPayment(transactionId : string, productId : string, orderId : string, receiptData : string, customerOid : string) {
|
||||||
|
const res = await mainClient.request<IApiResponse>({
|
||||||
|
url: 'Ipa/veri/',
|
||||||
|
method: 'POST',
|
||||||
|
data: { transactionId, productId, orderId, receiptData, customerOid}
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
}
|
||||||
@@ -3,8 +3,7 @@ import { createRequestClient } from '../request'
|
|||||||
import { SERVICE_MAP } from '../config'
|
import { SERVICE_MAP } from '../config'
|
||||||
import type { IApiResponse } from '../types'
|
import type { IApiResponse } from '../types'
|
||||||
import type { IVideoCheckResponse } from '@/types/video'
|
import type { IVideoCheckResponse } from '@/types/video'
|
||||||
|
import { skeletonClient } from '@/api/clients'
|
||||||
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 视频相关API
|
* 视频相关API
|
||||||
@@ -18,7 +17,7 @@ export const videoApi = {
|
|||||||
checkVideo(data: {
|
checkVideo(data: {
|
||||||
id: number
|
id: number
|
||||||
}) {
|
}) {
|
||||||
return client.request<IVideoCheckResponse>({
|
return skeletonClient.request<IVideoCheckResponse>({
|
||||||
url: 'sociology/course/checkVideo',
|
url: 'sociology/course/checkVideo',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
@@ -34,7 +33,7 @@ export const videoApi = {
|
|||||||
videoId: number
|
videoId: number
|
||||||
position: number
|
position: number
|
||||||
}) {
|
}) {
|
||||||
return client.request<IApiResponse>({
|
return skeletonClient.request<IApiResponse>({
|
||||||
url: 'sociology/course/saveCoursePosition',
|
url: 'sociology/course/saveCoursePosition',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
@@ -51,7 +50,7 @@ export const videoApi = {
|
|||||||
videoId: number
|
videoId: number
|
||||||
sort: number
|
sort: number
|
||||||
}) {
|
}) {
|
||||||
return client.request<IApiResponse>({
|
return skeletonClient.request<IApiResponse>({
|
||||||
url: 'medical/course/addErrorCourse',
|
url: 'medical/course/addErrorCourse',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
|
|||||||
1
api/types.d.ts
vendored
1
api/types.d.ts
vendored
@@ -15,6 +15,7 @@ export interface IApiResponse<T = any> {
|
|||||||
*/
|
*/
|
||||||
export interface IRequestOptions extends UniApp.RequestOptions {
|
export interface IRequestOptions extends UniApp.RequestOptions {
|
||||||
// 允许扩展额外字段(例如 FILE 上传专用等)
|
// 允许扩展额外字段(例如 FILE 上传专用等)
|
||||||
|
headers?: Record<string, string>;
|
||||||
maxSize?: number;
|
maxSize?: number;
|
||||||
files?: Array<{ name: string; uri: string; fileType?: string }>;
|
files?: Array<{ name: string; uri: string; fileType?: string }>;
|
||||||
}
|
}
|
||||||
|
|||||||
107
components/Skeleton/Skeleton.vue
Normal file
107
components/Skeleton/Skeleton.vue
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<template v-if="loading">
|
||||||
|
<slot name="loading-top" />
|
||||||
|
<component v-if="theme" :is="components[theme]" :size="size" :count="count" />
|
||||||
|
<slot name="loading-bottom" />
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<slot v-if="data" name="content" :data="data" />
|
||||||
|
<slot v-else name="error" />
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, onMounted, computed } from 'vue'
|
||||||
|
import ImageText from './templates/ImageText.vue'
|
||||||
|
import LineList from './templates/LineList.vue'
|
||||||
|
import BookCard from './templates/BookCard.vue'
|
||||||
|
import ImageCard from './templates/ImageCard.vue'
|
||||||
|
import BookInfo from './templates/BookInfo.vue'
|
||||||
|
import Menu from './templates/Menu.vue'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 注册组件
|
||||||
|
const components = {
|
||||||
|
'none': () => null,
|
||||||
|
'image-text': ImageText,
|
||||||
|
'line-list': LineList,
|
||||||
|
'image-card': ImageCard,
|
||||||
|
'book-card': BookCard,
|
||||||
|
'book-info': BookInfo,
|
||||||
|
'menu': Menu
|
||||||
|
}
|
||||||
|
|
||||||
|
type RequestFn = () => Promise<any>
|
||||||
|
type ThemeType = keyof typeof components
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<{
|
||||||
|
theme?: ThemeType
|
||||||
|
request: RequestFn | RequestFn[]
|
||||||
|
auto?: boolean,
|
||||||
|
size?: 'small' | 'medium' | 'large' | any[]
|
||||||
|
count?: number
|
||||||
|
}>(), {
|
||||||
|
theme: 'none',
|
||||||
|
auto: true,
|
||||||
|
count: 1
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits(['success', 'error', 'complete'])
|
||||||
|
|
||||||
|
const requestFnType = ref('single')
|
||||||
|
const requestList = computed<RequestFn[]>(() => {
|
||||||
|
if (Array.isArray(props.request)) {
|
||||||
|
requestFnType.value = 'multi'
|
||||||
|
return props.request
|
||||||
|
}
|
||||||
|
requestFnType.value = 'single'
|
||||||
|
return [props.request]
|
||||||
|
})
|
||||||
|
|
||||||
|
const loading = ref(true)
|
||||||
|
const data = ref<any>(null)
|
||||||
|
|
||||||
|
const run = async (methods?: RequestFn[]) => {
|
||||||
|
loading.value = true
|
||||||
|
const reqMethods = methods || requestList.value
|
||||||
|
try {
|
||||||
|
// await new Promise(resolve => setTimeout(resolve, 3000))
|
||||||
|
const results = await Promise.all(
|
||||||
|
reqMethods.map(fn => fn())
|
||||||
|
)
|
||||||
|
// 将每个请求的结果处理成 key-value 格式
|
||||||
|
const resolvedData: Record<string, any> = {}
|
||||||
|
reqMethods.forEach((fn, index) => {
|
||||||
|
const key = fn.name || `request_${index}`
|
||||||
|
resolvedData[key] = results[index]
|
||||||
|
})
|
||||||
|
data.value = requestFnType.value === 'single' ? results[0] : resolvedData
|
||||||
|
emit('success', data.value)
|
||||||
|
} catch (err) {
|
||||||
|
emit('error', err)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const reload = (methods?: RequestFn[]) => {
|
||||||
|
run(methods)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (props.auto) {
|
||||||
|
run()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
reload,
|
||||||
|
loading
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
15
components/Skeleton/templates/BookCard.vue
Normal file
15
components/Skeleton/templates/BookCard.vue
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<wd-skeleton :row-col="info" animation="gradient" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
const count = 10
|
||||||
|
const info = Array.from({ length: count }, (_, index) => ({ height: '20px' }))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
31
components/Skeleton/templates/BookInfo.vue
Normal file
31
components/Skeleton/templates/BookInfo.vue
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<wd-skeleton :row-col="info" animation="gradient" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
const info = [
|
||||||
|
{ width: '300rpx', height: '400rpx' },
|
||||||
|
{ width: '600rpx', height: '60rpx' },
|
||||||
|
{ width: '180rpx', height: '40rpx' },
|
||||||
|
[{ width: '180rpx', height: '120rpx' }, { width: '180rpx', height: '120rpx' }, { width: '180rpx', height: '120rpx' }],
|
||||||
|
{ width: '700rpx', height: '40rpx' },
|
||||||
|
{ width: '700rpx', height: '40rpx' },
|
||||||
|
{ width: '700rpx', height: '40rpx' },
|
||||||
|
{ width: '700rpx', height: '40rpx' }
|
||||||
|
]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.wd-skeleton__content) {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.wd-skeleton__row {
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
16
components/Skeleton/templates/ImageCard.vue
Normal file
16
components/Skeleton/templates/ImageCard.vue
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<wd-skeleton theme="image" :row-col="list" animation="gradient" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
const props = defineProps<{
|
||||||
|
size?: any[],
|
||||||
|
count: number
|
||||||
|
}>()
|
||||||
|
const list = Array.from({ length: props.count }, (_, index) => (props.size || []))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
17
components/Skeleton/templates/ImageText.vue
Normal file
17
components/Skeleton/templates/ImageText.vue
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<wd-skeleton :row-col="info" animation="gradient" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
const info = [
|
||||||
|
{ height: '220px' }, 1, 1,
|
||||||
|
[{ width: '93px' }]
|
||||||
|
]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
15
components/Skeleton/templates/LineList.vue
Normal file
15
components/Skeleton/templates/LineList.vue
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<wd-skeleton :row-col="info" animation="gradient" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
const count = 10
|
||||||
|
const info = Array.from({ length: count }, (_, index) => ({ height: '20px' }))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
33
components/Skeleton/templates/Menu.vue
Normal file
33
components/Skeleton/templates/Menu.vue
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<template>
|
||||||
|
<view class="menu-box">
|
||||||
|
<wd-skeleton :row-col="grid" animation="gradient" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
const props = defineProps<{
|
||||||
|
size?: any[],
|
||||||
|
count: number
|
||||||
|
}>()
|
||||||
|
const list = Array.from({ length: props.count }, (_, index) => (props.size || []))
|
||||||
|
|
||||||
|
const grid = [
|
||||||
|
[
|
||||||
|
{ width: '96rpx', height: '96rpx' },
|
||||||
|
{ width: '96rpx', height: '96rpx' },
|
||||||
|
{ width: '96rpx', height: '96rpx' },
|
||||||
|
{ width: '96rpx', height: '96rpx' }
|
||||||
|
]
|
||||||
|
]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.menu-box {
|
||||||
|
padding: 40rpx 80rpx;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
|
||||||
|
:deep(.wd-skeleton) {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<!-- 商品列表 -->
|
<!-- 商品列表 -->
|
||||||
<view class="selector-header">
|
<view class="selector-header">
|
||||||
<text class="title">{{ isFudu ? t('order.selectFuduScheme') : t('order.selectPurchaseScheme') }}</text>
|
<text class="title">{{ t('order.goodsList') }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="goods-list">
|
<view class="goods-list">
|
||||||
<view
|
<view
|
||||||
@@ -54,7 +54,6 @@ const { t } = useI18n()
|
|||||||
interface Props {
|
interface Props {
|
||||||
show: boolean
|
show: boolean
|
||||||
goods: IGoods[]
|
goods: IGoods[]
|
||||||
isFudu?: boolean // 是否为复读
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>()
|
const props = defineProps<Props>()
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export function useVideoAPI() {
|
|||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error('Failed to fetch video info:', err)
|
console.error('Failed to fetch video info:', err)
|
||||||
error.value = {
|
error.value = {
|
||||||
type: 'API_ERROR',
|
type: 'API_ERROR' as VideoErrorType,
|
||||||
message: err.message || '获取视频信息失败,请稍后重试'
|
message: err.message || '获取视频信息失败,请稍后重试'
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -227,7 +227,14 @@
|
|||||||
"instruction2": "After data migration is complete, the chinese account data will be cleared, and all purchased Tianyi Coins, points, courses, E-book, VIP, certificate, and User Contribution will be transferred to the current account",
|
"instruction2": "After data migration is complete, the chinese account data will be cleared, and all purchased Tianyi Coins, points, courses, E-book, VIP, certificate, and User Contribution will be transferred to the current account",
|
||||||
"instruction3": "The migration process may take a few minutes, please be patient.",
|
"instruction3": "The migration process may take a few minutes, please be patient.",
|
||||||
"instruction4": "If you encounter any issues, please contact customer service for assistance.",
|
"instruction4": "If you encounter any issues, please contact customer service for assistance.",
|
||||||
"closeWindow": "Close the payment pop-up window"
|
"alreadyMigrated": "You have already migrated:",
|
||||||
|
"notMigration": "This migration:",
|
||||||
|
"migratedCompleted": "You have completed all migrations:",
|
||||||
|
"closeWindow": "Close the payment pop-up window",
|
||||||
|
"certificate": "My certificate",
|
||||||
|
"iHufen": "My lake",
|
||||||
|
"hufenRecord": "Lake division record",
|
||||||
|
"hufen": "Hufen"
|
||||||
},
|
},
|
||||||
"book": {
|
"book": {
|
||||||
"title": "My Books",
|
"title": "My Books",
|
||||||
@@ -435,8 +442,7 @@
|
|||||||
"orderCreateFailed": "Failed to create order"
|
"orderCreateFailed": "Failed to create order"
|
||||||
},
|
},
|
||||||
"order": {
|
"order": {
|
||||||
"selectFuduScheme": "Select Fudu Scheme",
|
"goodsList": "Product List",
|
||||||
"selectPurchaseScheme": "Select Purchase Scheme",
|
|
||||||
"confirmTitle": "Confirm Order",
|
"confirmTitle": "Confirm Order",
|
||||||
"goodsInfo": "Product Information",
|
"goodsInfo": "Product Information",
|
||||||
"priceDetail": "Price Details",
|
"priceDetail": "Price Details",
|
||||||
|
|||||||
@@ -228,7 +228,14 @@
|
|||||||
"instruction2": "数据迁移完成后,旧账号数据将被清空,已购买的天医币、积分、课程、电子书、VIP、证书、湖分将转移到当前账号。",
|
"instruction2": "数据迁移完成后,旧账号数据将被清空,已购买的天医币、积分、课程、电子书、VIP、证书、湖分将转移到当前账号。",
|
||||||
"instruction3": "迁移过程可能需要几分钟时间,请耐心等待。",
|
"instruction3": "迁移过程可能需要几分钟时间,请耐心等待。",
|
||||||
"instruction4": "如遇到问题,请联系客服获取帮助。",
|
"instruction4": "如遇到问题,请联系客服获取帮助。",
|
||||||
"closeWindow": "关闭支付弹窗"
|
"alreadyMigrated": "您已迁移过:",
|
||||||
|
"notMigration": "本次迁移:",
|
||||||
|
"migratedCompleted": "您已迁移过所有可迁移数据:",
|
||||||
|
"closeWindow": "关闭支付弹窗",
|
||||||
|
"certificate": "我的证书",
|
||||||
|
"iHufen": "我的湖分",
|
||||||
|
"hufenRecord": "湖分记录",
|
||||||
|
"hufen": "湖分"
|
||||||
},
|
},
|
||||||
"book": {
|
"book": {
|
||||||
"title": "我的书单",
|
"title": "我的书单",
|
||||||
@@ -435,8 +442,7 @@
|
|||||||
"orderCreateFailed": "订单创建失败"
|
"orderCreateFailed": "订单创建失败"
|
||||||
},
|
},
|
||||||
"order": {
|
"order": {
|
||||||
"selectFuduScheme": "选择复读方案",
|
"goodsList": "商品列表",
|
||||||
"selectPurchaseScheme": "选择购买方案",
|
|
||||||
"confirmTitle": "确认订单",
|
"confirmTitle": "确认订单",
|
||||||
"goodsInfo": "商品信息",
|
"goodsInfo": "商品信息",
|
||||||
"priceDetail": "价格明细",
|
"priceDetail": "价格明细",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-taimed-international-app",
|
"id": "uni-wumen-international-app",
|
||||||
"name": "TaimedInternationalApp",
|
"name": "wumen-international-app",
|
||||||
"displayName": "太湖国际",
|
"displayName": "太湖国际",
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"description": "太湖国际",
|
"description": "太湖国际",
|
||||||
|
|||||||
23
pages.json
23
pages.json
@@ -67,6 +67,24 @@
|
|||||||
"navigationBarTitleText": "%user.feedback%",
|
"navigationBarTitleText": "%user.feedback%",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},{
|
||||||
|
"path": "pages/user/certificate/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "%user.certificate%",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path": "pages/user/hufen/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "%user.hufen%",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path": "pages/user/hufen/forDetails",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "%user.hufen%",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/user/recharge/index",
|
"path": "pages/user/recharge/index",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -219,6 +237,11 @@
|
|||||||
"animationDuration": 200
|
"animationDuration": 200
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
"path": "pages/visitor/index",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
|
|||||||
@@ -3,32 +3,35 @@
|
|||||||
<!-- 导航栏 -->
|
<!-- 导航栏 -->
|
||||||
<nav-bar :title="$t('bookDetails.title')"></nav-bar>
|
<nav-bar :title="$t('bookDetails.title')"></nav-bar>
|
||||||
|
|
||||||
<scroll-view
|
<Skeleton
|
||||||
scroll-y
|
ref="bookInfoSkeleton"
|
||||||
class="detail-scroll"
|
theme="book-info"
|
||||||
:style="{ height: scrollHeight + 'px' }"
|
class="p-3"
|
||||||
|
:request="[getBookInfo, getBookReadCount]"
|
||||||
|
@success="getBookInfoSuccess"
|
||||||
>
|
>
|
||||||
|
<template #content="{ data }">
|
||||||
<!-- 书籍信息 -->
|
<!-- 书籍信息 -->
|
||||||
<view class="book-info">
|
<view class="book-info">
|
||||||
<image :src="bookInfo.images" class="cover" mode="aspectFill" />
|
<image :src="data.getBookInfo.bookInfo.images" class="cover" mode="aspectFill" />
|
||||||
<text class="title">{{ bookInfo.name }}</text>
|
<text class="title">{{ data.getBookInfo.bookInfo.name }}</text>
|
||||||
<text class="author">{{ $t('bookDetails.authorName') }}{{ bookInfo.author?.authorName }}</text>
|
<text class="author">{{ $t('bookDetails.authorName') }}{{ data.getBookInfo.bookInfo.author?.authorName }}</text>
|
||||||
|
|
||||||
<!-- 统计信息 -->
|
<!-- 统计信息 -->
|
||||||
<view class="stats">
|
<view class="stats">
|
||||||
<view class="stat-item">
|
<view class="stat-item">
|
||||||
<image src="@/static/icon/icon_look_c.png" mode="aspectFit" />
|
<image src="@/static/icon/icon_look_c.png" mode="aspectFit" />
|
||||||
<text>{{ readCount }}{{ $t('bookHome.readingCount') }}</text>
|
<text>{{ data.getBookReadCount.readCount }}{{ $t('bookHome.readingCount') }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="divider" />
|
<view class="divider" />
|
||||||
<view class="stat-item">
|
<view class="stat-item">
|
||||||
<image src="@/static/icon/icon_listen_c.png" mode="aspectFit" />
|
<image src="@/static/icon/icon_listen_c.png" mode="aspectFit" />
|
||||||
<text>{{ listenCount }}{{ $t('bookHome.listenCount') }}</text>
|
<text>{{ data.getBookReadCount.listenCount }}{{ $t('bookHome.listenCount') }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="divider" />
|
<view class="divider" />
|
||||||
<view class="stat-item">
|
<view class="stat-item">
|
||||||
<image src="@/static/icon/icon_bug_c.png" mode="aspectFit" />
|
<image src="@/static/icon/icon_bug_c.png" mode="aspectFit" />
|
||||||
<text>{{ buyCount }}{{ $t('bookHome.purchased') }}</text>
|
<text>{{ data.getBookReadCount.buyCount }}{{ $t('bookHome.purchased') }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -36,35 +39,25 @@
|
|||||||
<!-- 简介 -->
|
<!-- 简介 -->
|
||||||
<view class="introduction">
|
<view class="introduction">
|
||||||
<text class="section-title">{{ $t('bookDetails.introduction') }}</text>
|
<text class="section-title">{{ $t('bookDetails.introduction') }}</text>
|
||||||
<text class="content">{{ bookInfo.author?.introduction }}</text>
|
<text class="content">{{ data.getBookInfo.bookInfo.author?.introduction }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
<!-- 书评列表 (非iOS) -->
|
</Skeleton>
|
||||||
<!-- <view v-if="!isIOS" class="comments-section">
|
|
||||||
<view class="section-header">
|
|
||||||
<text class="section-title">{{ $t('bookDetails.message') }}</text>
|
|
||||||
<view v-if="commentList.length > 0" class="more-link" @click="goToReview">
|
|
||||||
<text>{{ $t('bookDetails.more') }}</text>
|
|
||||||
<wd-icon name="arrow-right" size="14px" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="comment-wrapper">
|
|
||||||
<CommentList
|
|
||||||
v-if="commentList.length > 0"
|
|
||||||
:comments="commentList.slice(0, 2)"
|
|
||||||
/>
|
|
||||||
<text v-else class="empty-text">{{ nullText }}</text>
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
|
|
||||||
<!-- 相关推荐 -->
|
<!-- 相关推荐 -->
|
||||||
<view class="related-books">
|
<view class="related-books">
|
||||||
<text class="section-title">{{ $t('bookDetails.relatedBooks') }}</text>
|
<text class="section-title">{{ $t('bookDetails.relatedBooks') }}</text>
|
||||||
<scroll-view v-if="relatedBooks.length > 0" scroll-x class="book-scroll">
|
<Skeleton
|
||||||
|
theme="image-card"
|
||||||
|
:size="Array(4).fill({ height: '100px', width: '23%' })"
|
||||||
|
:request="getRecommendBook"
|
||||||
|
>
|
||||||
|
<template #content="{ data }">
|
||||||
|
<scroll-view v-if="data.bookList.length > 0" scroll-x class="book-scroll">
|
||||||
<view class="book-list">
|
<view class="book-list">
|
||||||
<view
|
<view
|
||||||
class="book-item"
|
class="book-item"
|
||||||
v-for="item in relatedBooks"
|
v-for="item in data.bookList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@click="goToDetail(item.id)"
|
@click="goToDetail(item.id)"
|
||||||
>
|
>
|
||||||
@@ -73,12 +66,13 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<text v-else class="empty-text">{{ nullBookText }}</text>
|
<text v-else class="empty-text">{{ $t('common.data_null') }}</text>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
|
||||||
|
|
||||||
<!-- 底部操作栏 -->
|
<!-- 底部操作栏 -->
|
||||||
<view class="action-bar">
|
<view v-if="bookInfoLoading" class="action-bar">
|
||||||
<template v-if="bookInfo.isBuy || hasVip">
|
<template v-if="bookInfo.isBuy || hasVip">
|
||||||
<view class="action-btn read" @click="goToReader">
|
<view class="action-btn read" @click="goToReader">
|
||||||
<text>{{ $t('bookDetails.startReading') }}</text>
|
<text>{{ $t('bookDetails.startReading') }}</text>
|
||||||
@@ -120,13 +114,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||||
import { t } from '@/utils/i18n'
|
|
||||||
import { bookApi } from '@/api/modules/book'
|
import { bookApi } from '@/api/modules/book'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import type { IBookDetail, IBook, IComment } from '@/types/book'
|
import type { IBookDetail } from '@/types/book'
|
||||||
import type { IGoods } from '@/types/order'
|
import type { IGoods } from '@/types/order'
|
||||||
import GoodsSelector from '@/components/order/GoodsSelector.vue'
|
import GoodsSelector from '@/components/order/GoodsSelector.vue'
|
||||||
import CommentList from '@/components/book/CommentList.vue'
|
import Skeleton from '@/components/Skeleton/Skeleton.vue'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
@@ -138,6 +131,8 @@ const pageFrom = ref('')
|
|||||||
const hasVip = computed(() => userStore.userInfo?.userEbookVip?.length > 0 || false)
|
const hasVip = computed(() => userStore.userInfo?.userEbookVip?.length > 0 || false)
|
||||||
|
|
||||||
// 数据状态
|
// 数据状态
|
||||||
|
const bookInfoSkeleton = ref()
|
||||||
|
const bookInfoLoading = ref(false)
|
||||||
const bookInfo = ref<IBookDetail>({
|
const bookInfo = ref<IBookDetail>({
|
||||||
id: 0,
|
id: 0,
|
||||||
name: '',
|
name: '',
|
||||||
@@ -147,23 +142,7 @@ const bookInfo = ref<IBookDetail>({
|
|||||||
freeChapterCount: 0
|
freeChapterCount: 0
|
||||||
})
|
})
|
||||||
const goodsList = ref<IGoods[]>([])
|
const goodsList = ref<IGoods[]>([])
|
||||||
const readCount = ref(0)
|
|
||||||
const listenCount = ref(0)
|
|
||||||
const buyCount = ref(0)
|
|
||||||
const commentList = ref<IComment[]>([])
|
|
||||||
const relatedBooks = ref<IBook[]>([])
|
|
||||||
const nullText = ref('')
|
|
||||||
const nullBookText = ref('')
|
|
||||||
const purchaseVisible = ref(false)
|
const purchaseVisible = ref(false)
|
||||||
const scrollHeight = ref(0)
|
|
||||||
|
|
||||||
// 计算属性
|
|
||||||
const isIOS = computed(() => {
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
return uni.getSystemInfoSync().platform === 'ios'
|
|
||||||
// #endif
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
|
|
||||||
// 生命周期
|
// 生命周期
|
||||||
onLoad((options: any) => {
|
onLoad((options: any) => {
|
||||||
@@ -173,45 +152,23 @@ onLoad((options: any) => {
|
|||||||
if (options.page) {
|
if (options.page) {
|
||||||
pageFrom.value = options.page
|
pageFrom.value = options.page
|
||||||
}
|
}
|
||||||
|
|
||||||
initScrollHeight()
|
|
||||||
loadBookCount()
|
|
||||||
loadRecommendBooks()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
loadBookInfo()
|
bookInfoSkeleton.value?.reload()
|
||||||
loadGoodsInfo()
|
|
||||||
if (!isIOS.value) {
|
|
||||||
loadComments()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
initScrollHeight()
|
|
||||||
})
|
|
||||||
|
|
||||||
// 初始化滚动区域高度
|
|
||||||
function initScrollHeight() {
|
|
||||||
const systemInfo = uni.getSystemInfoSync()
|
|
||||||
const statusBarHeight = systemInfo.statusBarHeight || 0
|
|
||||||
let navBarHeight = 44
|
|
||||||
if (systemInfo.model.includes('iPhone')) {
|
|
||||||
const modelNumber = parseInt(systemInfo.model.match(/\d+/)?.[0] || '0')
|
|
||||||
if (modelNumber >= 11) {
|
|
||||||
navBarHeight = 48
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const totalNavHeight = statusBarHeight + navBarHeight
|
|
||||||
const actionBarHeight = 110 // rpx转px约55
|
|
||||||
scrollHeight.value = systemInfo.windowHeight - totalNavHeight - actionBarHeight / 2
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载书籍详情
|
// 加载书籍详情
|
||||||
async function loadBookInfo() {
|
const getBookInfo = () => bookApi.getBookInfo(bookId.value)
|
||||||
const res = await bookApi.getBookInfo(bookId.value)
|
const getBookInfoSuccess = (res: any) => {
|
||||||
bookInfo.value = res.bookInfo
|
bookInfoLoading.value = true
|
||||||
|
bookInfo.value = res.getBookInfo.bookInfo || {}
|
||||||
}
|
}
|
||||||
|
// 加载统计数据
|
||||||
|
const getBookReadCount = () => bookApi.getBookReadCount(bookId.value)
|
||||||
|
// 加载推荐书籍
|
||||||
|
const getRecommendBook = () => bookApi.getRecommendBook(bookId.value)
|
||||||
|
|
||||||
// 加载购买商品信息
|
// 加载购买商品信息
|
||||||
async function loadGoodsInfo() {
|
async function loadGoodsInfo() {
|
||||||
@@ -219,38 +176,9 @@ async function loadGoodsInfo() {
|
|||||||
goodsList.value = res.productList || []
|
goodsList.value = res.productList || []
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载统计数据
|
|
||||||
async function loadBookCount() {
|
|
||||||
const res = await bookApi.getBookReadCount(bookId.value)
|
|
||||||
if (res.code === 0) {
|
|
||||||
readCount.value = res.readCount || 0
|
|
||||||
listenCount.value = res.listenCount || 0
|
|
||||||
buyCount.value = res.buyCount || 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载评论
|
|
||||||
async function loadComments() {
|
|
||||||
const res = await bookApi.getBookComments(bookId.value, 1, 10)
|
|
||||||
if (res.commentsTree && res.commentsTree.length > 0) {
|
|
||||||
commentList.value = res.commentsTree
|
|
||||||
} else {
|
|
||||||
nullText.value = t('common.data_null')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载推荐书籍
|
|
||||||
async function loadRecommendBooks() {
|
|
||||||
const res = await bookApi.getRecommendBook(bookId.value)
|
|
||||||
if (res.bookList && res.bookList.length > 0) {
|
|
||||||
relatedBooks.value = res.bookList
|
|
||||||
} else {
|
|
||||||
nullBookText.value = t('common.data_null')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显示购买弹窗
|
// 显示购买弹窗
|
||||||
function showPurchasePopup() {
|
async function showPurchasePopup() {
|
||||||
|
await loadGoodsInfo()
|
||||||
purchaseVisible.value = true
|
purchaseVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,12 +209,6 @@ function goToListen() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function goToReview() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/book/review?bookId=${bookId.value}&page=0`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function goToDetail(id: number) {
|
function goToDetail(id: number) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/book/detail?id=${id}`
|
url: `/pages/book/detail?id=${id}`
|
||||||
@@ -301,7 +223,7 @@ function goToDetail(id: number) {
|
|||||||
|
|
||||||
.book-info {
|
.book-info {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 40rpx 30rpx;
|
padding-bottom: 40rpx;
|
||||||
|
|
||||||
.cover {
|
.cover {
|
||||||
width: 300rpx;
|
width: 300rpx;
|
||||||
@@ -360,8 +282,6 @@ function goToDetail(id: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.introduction {
|
.introduction {
|
||||||
padding: 40rpx 30rpx 0;
|
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 34rpx;
|
font-size: 34rpx;
|
||||||
@@ -410,7 +330,7 @@ function goToDetail(id: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.related-books {
|
.related-books {
|
||||||
padding: 40rpx 30rpx 40rpx;
|
padding: 0rpx 30rpx calc(40rpx + 110rpx);
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -24,19 +24,27 @@
|
|||||||
<!-- 我的书单 & 推荐图书模块 -->
|
<!-- 我的书单 & 推荐图书模块 -->
|
||||||
<view class="mine-block">
|
<view class="mine-block">
|
||||||
<!-- 我的书单 -->
|
<!-- 我的书单 -->
|
||||||
|
<Skeleton
|
||||||
|
ref="myBookSkeleton"
|
||||||
|
theme="image-card"
|
||||||
|
:request="getMyBooks"
|
||||||
|
:size="[{ height:'140px' }]"
|
||||||
|
class="flex-1 w-[50%]"
|
||||||
|
>
|
||||||
|
<template #content="{ data }" >
|
||||||
<view class="mine-1">
|
<view class="mine-1">
|
||||||
<text class="mine-title">{{ $t('bookHome.block1') }}</text>
|
<text class="mine-title">{{ $t('bookHome.block1') }}</text>
|
||||||
<view
|
<view
|
||||||
v-if="myBooksList.length > 0"
|
v-if="data.page.records.length > 0"
|
||||||
class="mine-more"
|
class="mine-more"
|
||||||
@click="handleMoreClick"
|
@click="handleMoreClick"
|
||||||
>
|
>
|
||||||
{{ $t('bookHome.more') }}
|
{{ $t('bookHome.more') }}
|
||||||
<image src="@/static/icon/icon_right.png" />
|
<image src="@/static/icon/icon_right.png" />
|
||||||
</view>
|
</view>
|
||||||
<view v-if="myBooksList.length > 0" class="mine-1-list">
|
<view v-if="data.page.records.length > 0" class="mine-1-list">
|
||||||
<view
|
<view
|
||||||
v-for="(item, index) in myBooksList"
|
v-for="(item, index) in data.page.records"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="mine-item"
|
class="mine-item"
|
||||||
@click="handleMyBookClick(item.id)"
|
@click="handleMyBookClick(item.id)"
|
||||||
@@ -47,19 +55,29 @@
|
|||||||
</view>
|
</view>
|
||||||
<text v-else class="zanwu">{{ $t('common.data_null') }}</text>
|
<text v-else class="zanwu">{{ $t('common.data_null') }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
|
|
||||||
<!-- 推荐图书 -->
|
<!-- 推荐图书 -->
|
||||||
|
<Skeleton
|
||||||
|
ref="recommendBooksSkeleton"
|
||||||
|
theme="image-card"
|
||||||
|
:request="getRecommendBooks"
|
||||||
|
:size="[{ height:'140px' }]"
|
||||||
|
class="flex-1 w-[50%]"
|
||||||
|
>
|
||||||
|
<template #content="{ data }" >
|
||||||
<view class="mine-2">
|
<view class="mine-2">
|
||||||
<text class="mine-title">{{ $t('bookHome.block2') }}</text>
|
<text class="mine-title">{{ $t('bookHome.block2') }}</text>
|
||||||
<swiper
|
<swiper
|
||||||
v-if="recommendBooksList.length > 0"
|
v-if="data.books.length > 0"
|
||||||
autoplay
|
autoplay
|
||||||
:interval="3000"
|
:interval="3000"
|
||||||
:duration="500"
|
:duration="500"
|
||||||
class="recommend-list"
|
class="recommend-list"
|
||||||
>
|
>
|
||||||
<swiper-item
|
<swiper-item
|
||||||
v-for="(item, index) in recommendBooksList"
|
v-for="(item, index) in data.books"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="recommend-item"
|
class="recommend-item"
|
||||||
@click="handleBookClick(item.id)"
|
@click="handleBookClick(item.id)"
|
||||||
@@ -69,10 +87,22 @@
|
|||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 活动图书模块 -->
|
<!-- 活动图书模块 -->
|
||||||
<view v-if="showActivity" class="activity-block">
|
<view class="activity-block">
|
||||||
|
<Skeleton
|
||||||
|
theme="image-card"
|
||||||
|
:size="Array(5).fill({ height:'28px', width: '18%' })"
|
||||||
|
:request="getActivityLabels"
|
||||||
|
@success="getActivityLabelsSuccess"
|
||||||
|
>
|
||||||
|
<template #loading-top>
|
||||||
|
<wd-skeleton :row-col="[{ width: '45%', height: '35px' }]" animation="gradient" class="mb-2.5!" />
|
||||||
|
</template>
|
||||||
|
<template #content>
|
||||||
<text class="activity-title">{{ $t('bookHome.activityTitle') }}</text>
|
<text class="activity-title">{{ $t('bookHome.activityTitle') }}</text>
|
||||||
<scroll-view class="scroll-view" scroll-x :show-scrollbar="false">
|
<scroll-view class="scroll-view" scroll-x :show-scrollbar="false">
|
||||||
<view class="activity-label-list">
|
<view class="activity-label-list">
|
||||||
@@ -89,15 +119,26 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
|
<Skeleton
|
||||||
|
ref="activityBooksSkeleton"
|
||||||
|
theme="image-card"
|
||||||
|
:auto="false"
|
||||||
|
:size="Array(4).fill({ height:'100px', width: '23%' })"
|
||||||
|
class="mt-[20rpx]!"
|
||||||
|
:request="getActivityBooks"
|
||||||
|
>
|
||||||
|
<template #content="{ data }">
|
||||||
<scroll-view
|
<scroll-view
|
||||||
v-if="activityList.length > 0"
|
v-if="data.bookList.length > 0"
|
||||||
class="scroll-view"
|
class="scroll-view"
|
||||||
scroll-x
|
scroll-x
|
||||||
:show-scrollbar="false"
|
:show-scrollbar="false"
|
||||||
>
|
>
|
||||||
<view class="activity-list">
|
<view class="activity-list">
|
||||||
<view
|
<view
|
||||||
v-for="(item, index) in activityList"
|
v-for="(item, index) in data.bookList"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="activity-item"
|
class="activity-item"
|
||||||
@click="handleBookClick(item.bookId)"
|
@click="handleBookClick(item.bookId)"
|
||||||
@@ -108,10 +149,20 @@
|
|||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<text v-else class="zanwu" style="padding: 80rpx 0">{{ $t('global.dataNull') }}</text>
|
<text v-else class="zanwu" style="padding: 80rpx 0">{{ $t('global.dataNull') }}</text>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 分类图书模块 -->
|
<!-- 分类图书模块 -->
|
||||||
<view v-if="showCategory" class="book-block">
|
<view class="book-block">
|
||||||
|
<Skeleton
|
||||||
|
ref="categoryLevel1LabelSkeleton"
|
||||||
|
theme="image-card"
|
||||||
|
:size="Array(3).fill({ height:'75px', width: '32%' })"
|
||||||
|
:request="getCategoryLabels"
|
||||||
|
@success="getCategoryLabelsSuccess"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
<!-- 一级分类标签 -->
|
<!-- 一级分类标签 -->
|
||||||
<scroll-view class="scroll-view" scroll-x :show-scrollbar="false">
|
<scroll-view class="scroll-view" scroll-x :show-scrollbar="false">
|
||||||
<view class="book-tab-one">
|
<view class="book-tab-one">
|
||||||
@@ -128,7 +179,18 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
|
<Skeleton
|
||||||
|
ref="categoryLevel2LabelSkeleton"
|
||||||
|
theme="image-card"
|
||||||
|
:auto="false"
|
||||||
|
:size="Array(4).fill({ height:'30px', width: '24%' })"
|
||||||
|
class="mt-[20rpx]!"
|
||||||
|
:request="getSubLabels"
|
||||||
|
@success="getSubLabelsSuccess"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
<!-- 二级分类标签 -->
|
<!-- 二级分类标签 -->
|
||||||
<scroll-view
|
<scroll-view
|
||||||
v-if="categoryLevel2List.length > 0"
|
v-if="categoryLevel2List.length > 0"
|
||||||
@@ -151,11 +213,23 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
|
|
||||||
<!-- 分类图书列表 -->
|
<!-- 分类图书列表 -->
|
||||||
<view v-if="categoryBookList.length > 0" class="book-list">
|
<Skeleton
|
||||||
|
ref="categoryBooksSkeleton"
|
||||||
|
theme="image-card"
|
||||||
|
:auto="false"
|
||||||
|
:size="Array(2).fill({ height:'240px', width: '49%' })"
|
||||||
|
:count="3"
|
||||||
|
class="mt-[20rpx]!"
|
||||||
|
:request="getBooksByLabel"
|
||||||
|
>
|
||||||
|
<template #content="{ data }">
|
||||||
|
<view v-if="data.bookList.length > 0" class="book-list">
|
||||||
<view
|
<view
|
||||||
v-for="(item, index) in categoryBookList"
|
v-for="(item, index) in data.bookList"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="book-item"
|
class="book-item"
|
||||||
@click="handleBookClick(item.bookId)"
|
@click="handleBookClick(item.bookId)"
|
||||||
@@ -166,47 +240,41 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<text v-else class="zanwu" style="padding: 100rpx 0">{{ $t('global.dataNull') }}</text>
|
<text v-else class="zanwu" style="padding: 100rpx 0">{{ $t('global.dataNull') }}</text>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
import { homeApi } from '@/api/modules/book_home'
|
import { bookHomeApi } from '@/api/modules/book_home'
|
||||||
import { getNotchHeight } from '@/utils/system'
|
import { getNotchHeight } from '@/utils/system'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import BookPrice from '@/components/book/BookPrice.vue'
|
import BookPrice from '@/components/book/BookPrice.vue'
|
||||||
import type {
|
import type { ILabel } from '@/types/book'
|
||||||
IBook,
|
|
||||||
IBookWithStats,
|
|
||||||
ILabel,
|
|
||||||
IVipInfo
|
|
||||||
} from '@/types/book'
|
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
// 状态定义
|
|
||||||
const showMyBooks = ref(false)
|
|
||||||
const showActivity = ref(false)
|
|
||||||
const showCategory = ref(false)
|
|
||||||
|
|
||||||
// 我的书单
|
// 我的书单
|
||||||
const myBooksList = ref<IBook[]>([])
|
const myBookSkeleton = ref()
|
||||||
|
|
||||||
// 推荐图书
|
// 推荐图书
|
||||||
const recommendBooksList = ref<IBook[]>([])
|
const recommendBooksSkeleton = ref()
|
||||||
|
|
||||||
// 活动图书
|
// 活动图书
|
||||||
|
const activityBooksSkeleton = ref()
|
||||||
const activityLabelList = ref<ILabel[]>([])
|
const activityLabelList = ref<ILabel[]>([])
|
||||||
const activityList = ref<IBookWithStats[]>([])
|
|
||||||
const currentActivityIndex = ref(0)
|
const currentActivityIndex = ref(0)
|
||||||
|
|
||||||
// 分类图书
|
// 分类图书
|
||||||
|
const categoryLevel1LabelSkeleton = ref()
|
||||||
|
const categoryLevel2LabelSkeleton = ref()
|
||||||
|
const categoryBooksSkeleton = ref()
|
||||||
const categoryLevel1List = ref<ILabel[]>([])
|
const categoryLevel1List = ref<ILabel[]>([])
|
||||||
const categoryLevel2List = ref<ILabel[]>([])
|
const categoryLevel2List = ref<ILabel[]>([])
|
||||||
const categoryBookList = ref<IBookWithStats[]>([])
|
|
||||||
const currentLevel1Index = ref(0)
|
const currentLevel1Index = ref(0)
|
||||||
const currentLevel2Index = ref(0)
|
const currentLevel2Index = ref(0)
|
||||||
|
|
||||||
@@ -216,96 +284,62 @@ const vipInfo = computed(() => userStore.userInfo?.userEbookVip?.[0] || null)
|
|||||||
/**
|
/**
|
||||||
* 获取我的书单
|
* 获取我的书单
|
||||||
*/
|
*/
|
||||||
const getMyBooks = async () => {
|
const getMyBooks = () => bookHomeApi.getMyBooks(1, 10)
|
||||||
const res = await homeApi.getMyBooks(1, 10)
|
|
||||||
if (res && res.code === 0) {
|
|
||||||
showMyBooks.value = true
|
|
||||||
if (res.page.records && res.page.records.length > 0) {
|
|
||||||
myBooksList.value = res.page.records
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 未登录,跳转到登录页
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/login/login'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取推荐图书
|
* 获取推荐图书
|
||||||
*/
|
*/
|
||||||
const getRecommendBooks = async () => {
|
const getRecommendBooks = () => bookHomeApi.getRecommendBooks()
|
||||||
const res = await homeApi.getRecommendBooks()
|
|
||||||
if (res.books && res.books.length > 0) {
|
|
||||||
recommendBooksList.value = res.books
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取活动标签列表
|
* 获取活动图书
|
||||||
*/
|
*/
|
||||||
const getActivityLabels = async () => {
|
// 获取活动图书标签列表
|
||||||
const res = await homeApi.getBookLabelList(1)
|
const getActivityLabels = () => bookHomeApi.getBookLabelList(1)
|
||||||
showActivity.value = true
|
const getActivityLabelsSuccess = (res: any) => {
|
||||||
if (res.lableList && res.lableList.length > 0) {
|
activityLabelList.value = res.lableList || []
|
||||||
activityLabelList.value = res.lableList
|
activityBooksSkeleton.value.reload()
|
||||||
// 默认加载第一个标签的图书列表
|
|
||||||
await getBooksByLabel(res.lableList[0].id, 'activity')
|
|
||||||
}
|
}
|
||||||
|
// 获取活动图书列表
|
||||||
|
const getActivityBooks = () => {
|
||||||
|
// 获取活动标签列表
|
||||||
|
const index = currentActivityIndex.value || 0
|
||||||
|
return bookHomeApi.getBooksByLabel(activityLabelList.value[index].id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取分类标签列表
|
* 获取分类标签列表
|
||||||
*/
|
*/
|
||||||
const getCategoryLabels = async () => {
|
const getCategoryLabels = () => bookHomeApi.getBookLabelList(0)
|
||||||
const res = await homeApi.getBookLabelList(0)
|
const getCategoryLabelsSuccess = (res: any) => {
|
||||||
showCategory.value = true
|
categoryLevel1List.value = res.lableList || []
|
||||||
if (res.lableList && res.lableList.length > 0) {
|
currentLevel2Index.value = 0
|
||||||
categoryLevel1List.value = res.lableList
|
categoryLevel2LabelSkeleton.value.reload()
|
||||||
// 默认加载第一个标签的二级标签
|
|
||||||
await getSubLabels(res.lableList[0].id, 0)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取二级标签列表
|
* 获取二级标签列表
|
||||||
*/
|
*/
|
||||||
const getSubLabels = async (pid: number, index: number) => {
|
const getSubLabels = async () => {
|
||||||
const res = await homeApi.getSubLabelList(pid)
|
await getCategoryLabels()
|
||||||
currentLevel1Index.value = index
|
const pid = categoryLevel1List.value[currentLevel1Index.value]?.id || 0
|
||||||
if (res.lableList && res.lableList.length > 0) {
|
return bookHomeApi.getSubLabelList(pid)
|
||||||
categoryLevel2List.value = res.lableList
|
|
||||||
currentLevel2Index.value = 0
|
|
||||||
// 加载第一个二级标签的图书列表
|
|
||||||
await getBooksByLabel(res.lableList[0].id, 'category')
|
|
||||||
} else {
|
|
||||||
// 没有二级标签,直接加载一级标签的图书列表
|
|
||||||
categoryLevel2List.value = []
|
|
||||||
await getBooksByLabel(pid, 'category')
|
|
||||||
}
|
}
|
||||||
|
const getSubLabelsSuccess = (res: any) => {
|
||||||
|
categoryLevel2List.value = res.lableList || []
|
||||||
|
categoryBooksSkeleton.value.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据标签获取图书列表
|
* 获取分类标签图书列表
|
||||||
*/
|
*/
|
||||||
const getBooksByLabel = async (
|
const getBooksByLabel = () => {
|
||||||
labelId: number,
|
// 获取当前需要加载的标签id
|
||||||
type: 'activity' | 'category'
|
// 判断是否有一级标签当前选中值
|
||||||
) => {
|
const level1Id = categoryLevel1List.value[currentLevel1Index.value]?.id
|
||||||
const res = await homeApi.getBooksByLabel(labelId)
|
// 判断是否有二级标签当前选中值
|
||||||
if (type === 'activity') {
|
const level2Id = categoryLevel2List.value[currentLevel2Index.value]?.id
|
||||||
if (res.bookList && res.bookList.length > 0) {
|
|
||||||
activityList.value = res.bookList
|
const labelId = level2Id || level1Id || 0
|
||||||
} else {
|
return bookHomeApi.getBooksByLabel(labelId)
|
||||||
activityList.value = []
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (res.bookList && res.bookList.length > 0) {
|
|
||||||
categoryBookList.value = res.bookList
|
|
||||||
} else {
|
|
||||||
categoryBookList.value = []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -349,14 +383,17 @@ const handleMoreClick = () => {
|
|||||||
*/
|
*/
|
||||||
const handleActivityLabelClick = async (labelId: number, index: number) => {
|
const handleActivityLabelClick = async (labelId: number, index: number) => {
|
||||||
currentActivityIndex.value = index
|
currentActivityIndex.value = index
|
||||||
await getBooksByLabel(labelId, 'activity')
|
activityBooksSkeleton.value.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理一级分类标签点击
|
* 处理一级分类标签点击
|
||||||
*/
|
*/
|
||||||
const handleCategoryLevel1Click = async (labelId: number, index: number) => {
|
const handleCategoryLevel1Click = async (labelId: number, index: number) => {
|
||||||
await getSubLabels(labelId, index)
|
currentLevel1Index.value = index
|
||||||
|
currentLevel2Index.value = 0
|
||||||
|
categoryBooksSkeleton.value.loading = true
|
||||||
|
categoryLevel2LabelSkeleton.value.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -364,27 +401,15 @@ const handleCategoryLevel1Click = async (labelId: number, index: number) => {
|
|||||||
*/
|
*/
|
||||||
const handleCategoryLevel2Click = async (labelId: number, index: number) => {
|
const handleCategoryLevel2Click = async (labelId: number, index: number) => {
|
||||||
currentLevel2Index.value = index
|
currentLevel2Index.value = index
|
||||||
await getBooksByLabel(labelId, 'category')
|
categoryBooksSkeleton.value.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面加载
|
|
||||||
*/
|
|
||||||
onMounted(() => {
|
|
||||||
// 重置活动标签选中状态
|
|
||||||
currentActivityIndex.value = 0
|
|
||||||
showActivity.value = false
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面显示
|
* 页面显示
|
||||||
*/
|
*/
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
// 刷新数据
|
// 刷新数据
|
||||||
getMyBooks()
|
myBookSkeleton.value?.reload()
|
||||||
getRecommendBooks()
|
|
||||||
getActivityLabels()
|
|
||||||
getCategoryLabels()
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -426,12 +451,12 @@ onShow(() => {
|
|||||||
.mine-block {
|
.mine-block {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
.mine-1,
|
.mine-1,
|
||||||
.mine-2 {
|
.mine-2 {
|
||||||
width: 49%;
|
|
||||||
height: 290rpx;
|
height: 290rpx;
|
||||||
border-radius: 15rpx;
|
border-radius: 15rpx;
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
@@ -584,7 +609,6 @@ onShow(() => {
|
|||||||
|
|
||||||
.activity-list {
|
.activity-list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 20rpx;
|
|
||||||
padding-left: 10rpx;
|
padding-left: 10rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -617,7 +641,6 @@ onShow(() => {
|
|||||||
|
|
||||||
.book-block {
|
.book-block {
|
||||||
padding: 20rpx 20rpx 0;
|
padding: 20rpx 20rpx 0;
|
||||||
|
|
||||||
.book-tab-one {
|
.book-tab-one {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -700,7 +723,6 @@ onShow(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin-top: 20rpx;
|
|
||||||
|
|
||||||
.book-item {
|
.book-item {
|
||||||
width: 49%;
|
width: 49%;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { homeApi } from '@/api/modules/book_home'
|
import { bookHomeApi } from '@/api/modules/book_home'
|
||||||
import BookPrice from '@/components/book/BookPrice.vue'
|
import BookPrice from '@/components/book/BookPrice.vue'
|
||||||
import type { IBookWithStats, IVipInfo } from '@/types/home'
|
import type { IBookWithStats, IVipInfo } from '@/types/home'
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ onLoad((options: any) => {
|
|||||||
* 获取VIP信息
|
* 获取VIP信息
|
||||||
*/
|
*/
|
||||||
const getVipInfo = async () => {
|
const getVipInfo = async () => {
|
||||||
const res = await homeApi.getVipInfo()
|
const res = await bookHomeApi.getVipInfo()
|
||||||
vipInfo.value = res.vipInfo
|
vipInfo.value = res.vipInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ const handleSearch = async () => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
isEmpty.value = false
|
isEmpty.value = false
|
||||||
|
|
||||||
const res = await homeApi.searchBooks({
|
const res = await bookHomeApi.searchBooks({
|
||||||
title: keyword.value.trim(),
|
title: keyword.value.trim(),
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
<!-- 页面内容 -->
|
<!-- 页面内容 -->
|
||||||
<view class="page-content">
|
<view class="page-content">
|
||||||
<!-- 视频播放器 -->
|
<!-- 视频播放器 -->
|
||||||
<view v-if="videoList.length > 0" class="video-section">
|
<view class="video-section">
|
||||||
<VideoPlayer
|
<VideoPlayer
|
||||||
|
v-if="videoList.length > 0"
|
||||||
ref="videoPlayerRef"
|
ref="videoPlayerRef"
|
||||||
v-model:current-index="currentVideoIndex"
|
v-model:current-index="currentVideoIndex"
|
||||||
:video-list="videoList"
|
:video-list="videoList"
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
<view class="section-title">{{ $t('courseDetails.videoTeaching') }}</view>
|
<view class="section-title">{{ $t('courseDetails.videoTeaching') }}</view>
|
||||||
<wd-radio-group v-model="currentVideoIndex" shape="button" >
|
<wd-radio-group v-model="currentVideoIndex" shape="button" >
|
||||||
<wd-radio v-for="(video, index) in videoList" :key="video.id" :value="index" class="mb-2!">
|
<wd-radio v-for="(video, index) in videoList" :key="video.id" :value="index" class="mb-2!">
|
||||||
【{{ video.type == "2" ? $t('courseDetails.audio') : $t('courseDetails.video') }}】{{ index + 1 }}
|
【{{ video.type == 2 ? $t('courseDetails.audio') : $t('courseDetails.video') }}】{{ index + 1 }}
|
||||||
</wd-radio>
|
</wd-radio>
|
||||||
</wd-radio-group>
|
</wd-radio-group>
|
||||||
</view>
|
</view>
|
||||||
@@ -74,7 +75,8 @@ import { ref } from 'vue'
|
|||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { courseApi } from '@/api/modules/course'
|
import { courseApi } from '@/api/modules/course'
|
||||||
import VideoPlayer from '@/components/video-player/index.vue'
|
import VideoPlayer from '@/components/video-player/index.vue'
|
||||||
import type { IChapterDetail, IVideo } from '@/types/course'
|
import type { IChapterDetail } from '@/types/course'
|
||||||
|
import type { IVideoInfo } from '@/types/video'
|
||||||
|
|
||||||
// 页面参数
|
// 页面参数
|
||||||
const chapterId = ref<number>(0)
|
const chapterId = ref<number>(0)
|
||||||
@@ -83,7 +85,7 @@ const chapterTitle = ref('')
|
|||||||
|
|
||||||
// 页面数据
|
// 页面数据
|
||||||
const chapterDetail = ref<IChapterDetail | null>(null)
|
const chapterDetail = ref<IChapterDetail | null>(null)
|
||||||
const videoList = ref<IVideo[]>([])
|
const videoList = ref<IVideoInfo[]>([])
|
||||||
const currentVideoIndex = ref(0)
|
const currentVideoIndex = ref(0)
|
||||||
const activeVideoIndex = ref(0)
|
const activeVideoIndex = ref(0)
|
||||||
const currentTab = ref('chapterIntro')
|
const currentTab = ref('chapterIntro')
|
||||||
@@ -141,6 +143,7 @@ const previewImage = (url: string) => {
|
|||||||
|
|
||||||
.video-section {
|
.video-section {
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
|
height: 400rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-section {
|
.info-section {
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<view>
|
||||||
|
<Skeleton ref="skeleton" theme="line-list" :request="[getChapters, checkRenewPayment]" :auto="false" @success="getDataSuccess">
|
||||||
|
<template #loading-top>
|
||||||
|
<wd-skeleton :row-col="[
|
||||||
|
[{ width: '45%', height: '35px' }, { width: '45%', height: '35px' }],
|
||||||
|
[{ width: '100%', height: '90px' }]
|
||||||
|
]" animation="gradient" class="mb-2.5! mt-5!" />
|
||||||
|
</template>
|
||||||
|
<template #content>
|
||||||
<view class="course-content-wrapper">
|
<view class="course-content-wrapper">
|
||||||
<view
|
<view
|
||||||
v-if="catalogues.length > 1"
|
v-if="catalogues.length > 1"
|
||||||
@@ -55,12 +64,8 @@
|
|||||||
<wd-button size="small" type="warning" @click="handlePurchase">
|
<wd-button size="small" type="warning" @click="handlePurchase">
|
||||||
{{ $t('courseDetails.purchase') }}
|
{{ $t('courseDetails.purchase') }}
|
||||||
</wd-button>
|
</wd-button>
|
||||||
<wd-button
|
<!-- 如果是复读显示复读按钮 -->
|
||||||
v-if="showRenewBtn"
|
<wd-button v-if="canRenlearn" size="small" type="success" @click="handleRenlearn">
|
||||||
size="small"
|
|
||||||
type="success"
|
|
||||||
@click="handleRenew"
|
|
||||||
>
|
|
||||||
{{ $t('courseDetails.relearn') }}
|
{{ $t('courseDetails.relearn') }}
|
||||||
</wd-button>
|
</wd-button>
|
||||||
<wd-button size="small" type="primary" @click="goToVip">
|
<wd-button size="small" type="primary" @click="goToVip">
|
||||||
@@ -136,26 +141,46 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
</Skeleton>
|
||||||
|
|
||||||
|
<!-- 商品选择器 -->
|
||||||
|
<GoodsSelector
|
||||||
|
:show="showGoodsSelector"
|
||||||
|
:goods="goodsList"
|
||||||
|
@select="handleGoodsSelect"
|
||||||
|
@confirm="handleGoodsConfirm"
|
||||||
|
@close="closeGoodsSelector"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 购买协议弹窗 -->
|
||||||
|
<Protocol :visible="showProtocol" @confirmPurchase="confirmPurchase" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, watch } from 'vue'
|
import { ref, computed, watch } from 'vue'
|
||||||
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
import { courseApi } from '@/api/modules/course'
|
import { courseApi } from '@/api/modules/course'
|
||||||
|
import GoodsSelector from '@/components/order/GoodsSelector.vue'
|
||||||
|
import Protocol from './Protocol.vue'
|
||||||
import type { IChapter, ICatalogue, IVipInfo } from '@/types/course'
|
import type { IChapter, ICatalogue, IVipInfo } from '@/types/course'
|
||||||
|
import type { IGoods } from '@/types/order'
|
||||||
|
|
||||||
|
const skeleton = ref()
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
catalogues: ICatalogue[]
|
catalogues: ICatalogue[]
|
||||||
userVip: IVipInfo | null
|
userVip: IVipInfo | null
|
||||||
showRenewBtn?: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>()
|
const props = defineProps<Props>()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
click: [chapter: IChapter],
|
click: [chapter: IChapter],
|
||||||
purchase: [catalogue: ICatalogue],
|
change: [index: number],
|
||||||
renew: [catalogue: ICatalogue],
|
toVip: [],
|
||||||
toVip: [catalogue: ICatalogue],
|
toDetail: [chapter: IChapter, catalogue: ICatalogue],
|
||||||
change: [index: number]
|
loadPageData: [],
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
// 当前目录索引
|
// 当前目录索引
|
||||||
@@ -167,14 +192,21 @@ const currentCatalogue = computed(() => {
|
|||||||
// 当前目录的章节
|
// 当前目录的章节
|
||||||
const chapterList = ref<IChapter[]>([])
|
const chapterList = ref<IChapter[]>([])
|
||||||
|
|
||||||
// 显示续费按钮
|
// 当前目录是否是复读
|
||||||
const showRenewBtn = ref<boolean>(false)
|
const isRelearn = ref<boolean>(false)
|
||||||
|
const canRenlearn = ref<boolean>(false)
|
||||||
|
|
||||||
// 判断目录是否已购买
|
// 判断目录是否已购买
|
||||||
const isPurchased = computed(() => {
|
const isPurchased = computed(() => {
|
||||||
return currentCatalogue.value.isBuy === 1
|
return currentCatalogue.value.isBuy === 1
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 商品选择
|
||||||
|
const showGoodsSelector = ref(false)
|
||||||
|
const goodsList = ref<IGoods[]>([])
|
||||||
|
const selectedGoods = ref<IGoods | null>(null)
|
||||||
|
const showProtocol = ref(false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择目录
|
* 选择目录
|
||||||
*/
|
*/
|
||||||
@@ -190,52 +222,137 @@ const handleSelect = (index: number) => {
|
|||||||
/**
|
/**
|
||||||
* 获取当前目录的章节
|
* 获取当前目录的章节
|
||||||
*/
|
*/
|
||||||
const getChapters = async () => {
|
const getChapters = () => courseApi.getCatalogueChapterList(currentCatalogue.value.id)
|
||||||
const res = await courseApi.getCatalogueChapterList(currentCatalogue.value.id)
|
|
||||||
chapterList.value = res.chapterList || []
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查目录是否支持复读
|
* 检查目录是否支持复读
|
||||||
*/
|
*/
|
||||||
const checkRenewPayment = async () => {
|
const checkRenewPayment = async () => {
|
||||||
if (currentCatalogue.value.isBuy === 0 && !props.userVip) {
|
if (currentCatalogue.value.isBuy === 0 && !props.userVip) {
|
||||||
const renewRes = await courseApi.checkRenewPayment(currentCatalogue.value.id)
|
return courseApi.checkRenewPayment(currentCatalogue.value.id)
|
||||||
showRenewBtn.value = renewRes.canRelearn || false
|
|
||||||
} else {
|
} else {
|
||||||
showRenewBtn.value = false
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据完成后处理
|
||||||
|
*/
|
||||||
|
const getDataSuccess = (res: any) => {
|
||||||
|
const { getChapters, checkRenewPayment } = res
|
||||||
|
chapterList.value = getChapters.chapterList || []
|
||||||
|
canRenlearn.value = checkRenewPayment.canRelearn || false
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监听目录变化
|
* 监听目录变化
|
||||||
*/
|
*/
|
||||||
watch(() => props.catalogues, (newVal: ICatalogue[]) => {
|
watch(() => props.catalogues, (newVal: ICatalogue[]) => {
|
||||||
if (newVal.length > 0) {
|
if (newVal.length > 0) {
|
||||||
currentCatalogueIndex.value = 0
|
currentCatalogueIndex.value = 0
|
||||||
getChapters()
|
skeleton.value.reload()
|
||||||
checkRenewPayment()
|
|
||||||
}
|
}
|
||||||
}, { immediate: true, deep: true })
|
}, { immediate: true, deep: true })
|
||||||
|
/**
|
||||||
|
* 刷新章节数据
|
||||||
|
*/
|
||||||
|
onShow(async () => {
|
||||||
|
skeleton.value && skeleton.value.reload()
|
||||||
|
})
|
||||||
|
|
||||||
// 购买
|
// 购买
|
||||||
const handlePurchase = () => {
|
const handlePurchase = async () => {
|
||||||
emit('purchase', currentCatalogue.value)
|
if (!currentCatalogue.value) return
|
||||||
|
|
||||||
|
isRelearn.value = false
|
||||||
|
const res = await courseApi.getProductListForCourse(currentCatalogue.value.id)
|
||||||
|
if (res.code === 0 && res.productList.length > 0) {
|
||||||
|
goodsList.value = res.productList
|
||||||
|
showGoodsSelector.value = true
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: '此课程暂无购买方式', icon: 'none' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择商品
|
||||||
|
*/
|
||||||
|
const handleGoodsSelect = (goods: IGoods) => {
|
||||||
|
selectedGoods.value = goods
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认购买
|
||||||
|
*/
|
||||||
|
const handleGoodsConfirm = () => {
|
||||||
|
showGoodsSelector.value = false
|
||||||
|
showProtocol.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭商品选择器
|
||||||
|
*/
|
||||||
|
const closeGoodsSelector = () => {
|
||||||
|
showGoodsSelector.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认购买协议
|
||||||
|
*/
|
||||||
|
const confirmPurchase = () => {
|
||||||
|
showProtocol.value = false
|
||||||
|
if (!selectedGoods.value) return
|
||||||
|
|
||||||
|
showProtocol.value = false
|
||||||
|
|
||||||
|
if (isRelearn.value) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/order/goodsConfirm?isRelearn=1`,
|
||||||
|
success: () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.$emit('selectedGoods', selectedGoods.value)
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 跳转到购买确认订单页
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/order/goodsConfirm?goods=${selectedGoods.value.productId}`
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 去开通vip
|
// 去开通vip
|
||||||
const goToVip = () => {
|
const goToVip = () => {
|
||||||
emit('toVip', currentCatalogue.value)
|
emit('toVip')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 续费/复读
|
// 续费/复读
|
||||||
const handleRenew = () => {
|
const handleRenlearn = async () => {
|
||||||
emit('renew', currentCatalogue.value)
|
if (!currentCatalogue.value) return
|
||||||
|
|
||||||
|
isRelearn.value = true
|
||||||
|
const res = await courseApi.getRenewProductList(currentCatalogue.value.id)
|
||||||
|
if (res.productList.length > 0) {
|
||||||
|
goodsList.value = res.productList
|
||||||
|
showGoodsSelector.value = true
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: '暂无复读方案', icon: 'none' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 领取免费课程
|
// 领取免费课程
|
||||||
const handleGetFreeCourse = async () => {
|
const handleGetFreeCourse = async () => {
|
||||||
emit('getFreeCourse', currentCatalogue.value)
|
if (!currentCatalogue.value) return
|
||||||
|
|
||||||
|
const res = await courseApi.startStudyForMF(currentCatalogue.value.id)
|
||||||
|
if (res.code === 0) {
|
||||||
|
uni.showToast({ title: '领取成功', icon: 'success' })
|
||||||
|
// 刷新页面数据
|
||||||
|
emit('loadPageData')
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: res.msg || '领取失败', icon: 'none' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,7 +377,7 @@ const canAccess = (chapter: IChapter): boolean => {
|
|||||||
/**
|
/**
|
||||||
* 点击章节
|
* 点击章节
|
||||||
*/
|
*/
|
||||||
const handleChapterClick = (chapter: IChapter, catalogue: ICatalogue) => {
|
const handleChapterClick = (chapter: IChapter) => {
|
||||||
if (!canAccess(chapter)) {
|
if (!canAccess(chapter)) {
|
||||||
if (currentCatalogue.value.type === 0) {
|
if (currentCatalogue.value.type === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
89
pages/course/details/components/Protocol.vue
Normal file
89
pages/course/details/components/Protocol.vue
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<template>
|
||||||
|
<wd-popup v-model="showProtocol" position="center">
|
||||||
|
<view class="protocol-popup">
|
||||||
|
<view class="protocol-title">温馨提示</view>
|
||||||
|
<view class="protocol-content">
|
||||||
|
<text>
|
||||||
|
用户您好,本软件对于一个用户名及密码仅允许一部电子设备登陆,多部设备使用同一用户名操作软件的行为属于违规操作,发现违规一次将提出警告,再次违规您的用户名将被封号,无法正常登陆,如因此对您使用带来不便,敬请谅解。
|
||||||
|
</text>
|
||||||
|
<text>
|
||||||
|
课程购买之后一年内不打开,此一年内不会计算有效学习时间,一年后会自动开始计算有效学习时间。
|
||||||
|
</text>
|
||||||
|
<text>
|
||||||
|
本课程一经购买,暂不支持退款,敬请谅解。
|
||||||
|
</text>
|
||||||
|
<view style="color: red; font-weight: bold"> 注: </view>
|
||||||
|
<view>
|
||||||
|
1.手机、pad、电脑均为可登陆电子设备,均有唯一标识码,一个用户名仅允许在一个手机或一个ipad或一个电脑登陆,请根据您的使用习惯自行选择。<br />
|
||||||
|
2.如若申请变更登陆设备请联系客服,<br />
|
||||||
|
客服电话:021-08371305<br />
|
||||||
|
客服微信号:yilujiankangkefu<br />
|
||||||
|
3.如因违反上述使用规定...概不退款,本公司保留追究用户相关法律责任的权利。<br />
|
||||||
|
4.点击“同意”按钮即表示您同意遵守以上条款。
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="protocol-actions">
|
||||||
|
<wd-button type="info" plain @click="showProtocol = false">不同意</wd-button>
|
||||||
|
<wd-button type="primary" @click="confirmPurchase">同意</wd-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</wd-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
visible: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const showProtocol = computed({
|
||||||
|
get: () => props.visible,
|
||||||
|
set: (val) => emit('update:visible', val)
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:visible': [boolean],
|
||||||
|
confirmPurchase: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const confirmPurchase = () => {
|
||||||
|
emit('confirmPurchase')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.protocol-popup {
|
||||||
|
width: 600rpx;
|
||||||
|
padding: 40rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
|
||||||
|
.protocol-title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.protocol-content {
|
||||||
|
max-height: 60vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 1.8;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
|
text {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.protocol-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -13,17 +13,18 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 课程信息 -->
|
<!-- 课程信息 -->
|
||||||
|
<Skeleton theme="image-text" :request="getCourseDetail" @success="getCourseDetailSuccess">
|
||||||
|
<template #content>
|
||||||
<CourseInfo v-if="courseDetail" :course="courseDetail" :class="{'pt-10': !!vipTip}" />
|
<CourseInfo v-if="courseDetail" :course="courseDetail" :class="{'pt-10': !!vipTip}" />
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
|
|
||||||
<!-- 课程内容包装器 -->
|
<!-- 课程内容包装器 -->
|
||||||
<CatalogueList
|
<CatalogueList
|
||||||
v-if="catalogueList.length > 0"
|
|
||||||
:catalogues="catalogueList"
|
:catalogues="catalogueList"
|
||||||
:userVip="userVip"
|
:userVip="userVip"
|
||||||
@getFreeCourse="handleGetFreeCourse"
|
|
||||||
@purchase="handlePurchase"
|
|
||||||
@toVip="goToVip"
|
@toVip="goToVip"
|
||||||
@renew="handleRenew"
|
@loadPageData="loadPageData"
|
||||||
@toDetail="handleToDetail"
|
@toDetail="handleToDetail"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -89,55 +90,14 @@
|
|||||||
/>
|
/>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
<!-- 商品选择器 -->
|
|
||||||
<GoodsSelector
|
|
||||||
:show="showGoodsSelector"
|
|
||||||
:goods="goodsList"
|
|
||||||
:isFudu="isFudu"
|
|
||||||
@select="handleGoodsSelect"
|
|
||||||
@confirm="handleGoodsConfirm"
|
|
||||||
@close="closeGoodsSelector"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 购买协议弹窗 -->
|
|
||||||
<wd-popup v-model="showProtocol" position="center">
|
|
||||||
<view class="protocol-popup">
|
|
||||||
<view class="protocol-title">温馨提示</view>
|
|
||||||
<view class="protocol-content">
|
|
||||||
<text>
|
|
||||||
用户您好,本软件对于一个用户名及密码仅允许一部电子设备登陆,多部设备使用同一用户名操作软件的行为属于违规操作,发现违规一次将提出警告,再次违规您的用户名将被封号,无法正常登陆,如因此对您使用带来不便,敬请谅解。
|
|
||||||
</text>
|
|
||||||
<text>
|
|
||||||
课程购买之后一年内不打开,此一年内不会计算有效学习时间,一年后会自动开始计算有效学习时间。
|
|
||||||
</text>
|
|
||||||
<text>
|
|
||||||
本课程一经购买,暂不支持退款,敬请谅解。
|
|
||||||
</text>
|
|
||||||
<view style="color: red; font-weight: bold"> 注: </view>
|
|
||||||
<view>
|
|
||||||
1.手机、pad、电脑均为可登陆电子设备,均有唯一标识码,一个用户名仅允许在一个手机或一个ipad或一个电脑登陆,请根据您的使用习惯自行选择。<br />
|
|
||||||
2.如若申请变更登陆设备请联系客服,<br />
|
|
||||||
客服电话:021-08371305<br />
|
|
||||||
客服微信号:yilujiankangkefu<br />
|
|
||||||
3.如因违反上述使用规定...概不退款,本公司保留追究用户相关法律责任的权利。<br />
|
|
||||||
4.点击“同意”按钮即表示您同意遵守以上条款。
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="protocol-actions">
|
|
||||||
<wd-button type="info" plain @click="showProtocol = false">不同意</wd-button>
|
|
||||||
<wd-button type="primary" @click="confirmPurchase">同意</wd-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</wd-popup>
|
|
||||||
|
|
||||||
<!-- 评论编辑器 -->
|
<!-- 评论编辑器 -->
|
||||||
<CommentEditor
|
<!-- <CommentEditor
|
||||||
:show="showEditor"
|
:show="showEditor"
|
||||||
:parentComment="replyComment"
|
:parentComment="replyComment"
|
||||||
type="course"
|
type="course"
|
||||||
@submit="handleCommentSubmit"
|
@submit="handleCommentSubmit"
|
||||||
@close="closeCommentEditor"
|
@close="closeCommentEditor"
|
||||||
/>
|
/> -->
|
||||||
|
|
||||||
<!-- 返回顶部 -->
|
<!-- 返回顶部 -->
|
||||||
<wd-backtop :scrollTop="scrollTop" custom-class="back-top">
|
<wd-backtop :scrollTop="scrollTop" custom-class="back-top">
|
||||||
@@ -153,7 +113,6 @@ import { useUserStore } from '@/stores/user'
|
|||||||
import { courseApi } from '@/api/modules/course'
|
import { courseApi } from '@/api/modules/course'
|
||||||
import CourseInfo from './components/CourseInfo.vue'
|
import CourseInfo from './components/CourseInfo.vue'
|
||||||
import CatalogueList from './components/CatalogueList.vue'
|
import CatalogueList from './components/CatalogueList.vue'
|
||||||
import GoodsSelector from '@/components/order/GoodsSelector.vue'
|
|
||||||
import CommentList from '@/components/comment/CommentList.vue'
|
import CommentList from '@/components/comment/CommentList.vue'
|
||||||
import CommentEditor from '@/components/comment/CommentEditor.vue'
|
import CommentEditor from '@/components/comment/CommentEditor.vue'
|
||||||
import type { ICourseDetail, ICatalogue, IChapter, IVipInfo } from '@/types/course'
|
import type { ICourseDetail, ICatalogue, IChapter, IVipInfo } from '@/types/course'
|
||||||
@@ -172,14 +131,6 @@ const vipModuleList = ref<string[]>([])
|
|||||||
const learningProgress = ref(0)
|
const learningProgress = ref(0)
|
||||||
const relatedBooks = ref<IGoods[]>([])
|
const relatedBooks = ref<IGoods[]>([])
|
||||||
|
|
||||||
// 商品选择
|
|
||||||
const showGoodsSelector = ref(false)
|
|
||||||
const goodsList = ref<IGoods[]>([])
|
|
||||||
const selectedGoods = ref<IGoods | null>(null)
|
|
||||||
const showProtocol = ref(false)
|
|
||||||
const isFudu = ref(false)
|
|
||||||
const fuduCatalogueId = ref<number>(0)
|
|
||||||
|
|
||||||
// 评论相关
|
// 评论相关
|
||||||
const commentList = ref<IComment[]>([])
|
const commentList = ref<IComment[]>([])
|
||||||
const commentsLoading = ref(false)
|
const commentsLoading = ref(false)
|
||||||
@@ -229,21 +180,14 @@ const vipTip = computed(() => {
|
|||||||
*/
|
*/
|
||||||
onLoad(async (options: any) => {
|
onLoad(async (options: any) => {
|
||||||
courseId.value = parseInt(options.id)
|
courseId.value = parseInt(options.id)
|
||||||
})
|
loadPageData()
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面显示
|
|
||||||
*/
|
|
||||||
onShow(async () => {
|
|
||||||
await loadPageData()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载页面数据
|
* 加载页面数据
|
||||||
*/
|
*/
|
||||||
const loadPageData = async () => {
|
const getCourseDetail = () => courseApi.getCourseDetail(courseId.value)
|
||||||
// 获取课程详情
|
const getCourseDetailSuccess = async (res: any) => {
|
||||||
const res = await courseApi.getCourseDetail(courseId.value)
|
|
||||||
if (res.code === 0 && res.data) {
|
if (res.code === 0 && res.data) {
|
||||||
courseDetail.value = res.data.course
|
courseDetail.value = res.data.course
|
||||||
catalogueList.value = res.data.catalogues || []
|
catalogueList.value = res.data.catalogues || []
|
||||||
@@ -255,12 +199,10 @@ const loadPageData = async () => {
|
|||||||
learningProgress.value = Number((totalProgress / catalogueList.value.length).toFixed(2))
|
learningProgress.value = Number((totalProgress / catalogueList.value.length).toFixed(2))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
const loadPageData = async () => {
|
||||||
// 检查VIP权益
|
// 检查VIP权益
|
||||||
await checkVipStatus()
|
await checkVipStatus()
|
||||||
|
|
||||||
// 加载评论
|
|
||||||
await loadComments()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -301,92 +243,6 @@ const goToVip = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 领取免费课程
|
|
||||||
*/
|
|
||||||
const handleGetFreeCourse = async (catalogue: ICatalogue) => {
|
|
||||||
if (!catalogue) return
|
|
||||||
|
|
||||||
const res = await courseApi.startStudyForMF(catalogue.id)
|
|
||||||
if (res.code === 0) {
|
|
||||||
uni.showToast({ title: '领取成功', icon: 'success' })
|
|
||||||
// 刷新页面数据
|
|
||||||
loadPageData()
|
|
||||||
} else {
|
|
||||||
uni.showToast({ title: res.msg || '领取失败', icon: 'none' })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 购买课程
|
|
||||||
*/
|
|
||||||
const handlePurchase = async (catalogue: ICatalogue) => {
|
|
||||||
if (!catalogue) return
|
|
||||||
|
|
||||||
isFudu.value = false
|
|
||||||
const res = await courseApi.getProductListForCourse(catalogue.id)
|
|
||||||
if (res.code === 0 && res.productList.length > 0) {
|
|
||||||
goodsList.value = res.productList
|
|
||||||
showGoodsSelector.value = true
|
|
||||||
} else {
|
|
||||||
uni.showToast({ title: '此课程暂无购买方式', icon: 'none' })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 续费/复读
|
|
||||||
*/
|
|
||||||
const handleRenew = async () => {
|
|
||||||
// if (!currentCatalogue.value) return
|
|
||||||
|
|
||||||
// isFudu.value = true
|
|
||||||
// fuduCatalogueId.value = currentCatalogue.value.id
|
|
||||||
// const res = await courseApi.getRenewProductList(currentCatalogue.value.id)
|
|
||||||
// if (res.code === 0 && res.productList.length > 0) {
|
|
||||||
// goodsList.value = res.productList
|
|
||||||
// showGoodsSelector.value = true
|
|
||||||
// } else {
|
|
||||||
// uni.showToast({ title: '暂无复读方案', icon: 'none' })
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 选择商品
|
|
||||||
*/
|
|
||||||
const handleGoodsSelect = (goods: IGoods) => {
|
|
||||||
selectedGoods.value = goods
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认购买
|
|
||||||
*/
|
|
||||||
const handleGoodsConfirm = () => {
|
|
||||||
showGoodsSelector.value = false
|
|
||||||
showProtocol.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭商品选择器
|
|
||||||
*/
|
|
||||||
const closeGoodsSelector = () => {
|
|
||||||
showGoodsSelector.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认购买协议
|
|
||||||
*/
|
|
||||||
const confirmPurchase = () => {
|
|
||||||
showProtocol.value = false
|
|
||||||
if (!selectedGoods.value) return
|
|
||||||
|
|
||||||
showProtocol.value = false
|
|
||||||
|
|
||||||
// 跳转到确认订单页
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/order/goodsConfirm?goods=${selectedGoods.value.productId}`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转到书籍详情
|
* 跳转到书籍详情
|
||||||
*/
|
*/
|
||||||
@@ -586,11 +442,11 @@ onPullDownRefresh(async () => {
|
|||||||
/**
|
/**
|
||||||
* 触底加载
|
* 触底加载
|
||||||
*/
|
*/
|
||||||
onReachBottom(() => {
|
// onReachBottom(() => {
|
||||||
if (hasMoreComments.value && !commentsLoading.value) {
|
// if (hasMoreComments.value && !commentsLoading.value) {
|
||||||
loadComments()
|
// loadComments()
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -740,40 +596,6 @@ onReachBottom(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.protocol-popup {
|
|
||||||
width: 600rpx;
|
|
||||||
padding: 40rpx;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 12rpx;
|
|
||||||
|
|
||||||
.protocol-title {
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.protocol-content {
|
|
||||||
max-height: 60vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
font-size: 26rpx;
|
|
||||||
line-height: 1.8;
|
|
||||||
color: #666;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
|
|
||||||
text {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 20rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.protocol-actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 20rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.back-top) {
|
:deep(.back-top) {
|
||||||
background-color: #fff !important;
|
background-color: #fff !important;
|
||||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||||
|
|||||||
@@ -31,6 +31,14 @@
|
|||||||
>{{ item }}</view>
|
>{{ item }}</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 医学 -->
|
<!-- 医学 -->
|
||||||
|
<Skeleton
|
||||||
|
v-if="selectedFirstLevel === '医学'"
|
||||||
|
ref="medicineMenuSkeletonRef"
|
||||||
|
theme="menu"
|
||||||
|
:request="getMedicineMenus"
|
||||||
|
@success="getMedicineMenusSuccess"
|
||||||
|
>
|
||||||
|
<template #content>
|
||||||
<view v-if="selectedFirstLevel === '医学'" class="newLeve2">
|
<view v-if="selectedFirstLevel === '医学'" class="newLeve2">
|
||||||
<view class="home_nar nomargin" style="padding: 0; background-color: #fff">
|
<view class="home_nar nomargin" style="padding: 0; background-color: #fff">
|
||||||
<view class="flexbox">
|
<view class="flexbox">
|
||||||
@@ -70,41 +78,40 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 心理学 -->
|
</template>
|
||||||
<view v-if="selectedFirstLevel === '心理学'" class="soul_cate_box">
|
</Skeleton>
|
||||||
<scroll-view scroll-x="true">
|
<!-- 心理学和国学 -->
|
||||||
<view class="cate_list" v-if="soulCateList.length > 0">
|
<Skeleton
|
||||||
|
v-if="selectedFirstLevel === '心理学' || selectedFirstLevel === '国学'"
|
||||||
|
ref="menuSkeletonRef"
|
||||||
|
theme="menu"
|
||||||
|
:request="getMenus"
|
||||||
|
>
|
||||||
|
<template #content="{ data }">
|
||||||
|
<view
|
||||||
|
v-if="data.labels.length > 0"
|
||||||
|
:class="[
|
||||||
|
{'sociology_cate_box': selectedFirstLevel === '国学'},
|
||||||
|
{'soul_cate_box': selectedFirstLevel === '心理学'}
|
||||||
|
]"
|
||||||
|
>
|
||||||
<view
|
<view
|
||||||
class="cate_item_box"
|
class="cate_item_box"
|
||||||
v-for="(item, index) in soulCateList"
|
v-for="item in data.labels"
|
||||||
:key="index"
|
|
||||||
@click="curseClickJump(item)"
|
@click="curseClickJump(item)"
|
||||||
>
|
|
||||||
<view class="cate_item_border">
|
|
||||||
<image :src="item.icon"></image>
|
|
||||||
</view>
|
|
||||||
<view class="cate_item_name">{{ item.title }}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
</view>
|
|
||||||
<!-- 国学 -->
|
|
||||||
<view v-if="selectedFirstLevel === '国学' && sociologyCateList.length > 0" class="sociology_cate_box">
|
|
||||||
<view
|
|
||||||
class="cate_item_box"
|
|
||||||
v-for="(v, i) in sociologyCateList"
|
|
||||||
@click="curseClickJump(v)"
|
|
||||||
>
|
>
|
||||||
<view class="cate_item_border">
|
<view class="cate_item_border">
|
||||||
<image
|
<image
|
||||||
:src="v.icon"
|
:src="item.icon"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
style="width: 49rpx; height: 49rpx"
|
style="width: 49rpx; height: 49rpx"
|
||||||
></image>
|
></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="cate_item_name">{{ v.title }}</view>
|
<view class="cate_item_name">{{ item.title }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
|
|
||||||
<!-- 观看记录区域 -->
|
<!-- 观看记录区域 -->
|
||||||
<view class="learnBox" v-if="learnList.length > 0">
|
<view class="learnBox" v-if="learnList.length > 0">
|
||||||
@@ -143,7 +150,7 @@
|
|||||||
<view class="newscoll">
|
<view class="newscoll">
|
||||||
<swiper
|
<swiper
|
||||||
class="swiper"
|
class="swiper"
|
||||||
interval="5000"
|
:interval="5000"
|
||||||
circular
|
circular
|
||||||
autoplay
|
autoplay
|
||||||
vertical
|
vertical
|
||||||
@@ -163,15 +170,23 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 精彩试听区域 -->
|
<!-- 精彩试听区域 -->
|
||||||
<view class="learnBox" v-if="tryListenList.length > 0">
|
<view class="learnBox">
|
||||||
<view class="titleBox flexbox">
|
<view class="titleBox flexbox">
|
||||||
<image src="../../static/course/try_listen.png" mode="aspectFit"></image>
|
<image src="../../static/course/try_listen.png" mode="aspectFit"></image>
|
||||||
<text>{{ $t('courseHome.tryListen') }}</text>
|
<text>{{ $t('courseHome.tryListen') }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="learn flexbox shiting">
|
<Skeleton
|
||||||
|
theme="image-card"
|
||||||
|
class=""
|
||||||
|
:size="Array(2).fill({ width: '48%', height: '260rpx' })"
|
||||||
|
:count="3"
|
||||||
|
:request="getTryListenList"
|
||||||
|
>
|
||||||
|
<template #content="{ data }">
|
||||||
|
<view v-if="data.courseList.records.length > 0" class="learn flexbox shiting">
|
||||||
<view
|
<view
|
||||||
class="item"
|
class="item"
|
||||||
v-for="(item, index) in tryListenList"
|
v-for="(item, index) in data.courseList.records"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@click="onPageJump('/pages/course/details/course', item.id, item.title)"
|
@click="onPageJump('/pages/course/details/course', item.id, item.title)"
|
||||||
>
|
>
|
||||||
@@ -197,22 +212,24 @@
|
|||||||
<view class="moreBox shiting">
|
<view class="moreBox shiting">
|
||||||
<text @click="onPageJump('/pages/course/list/tryListen', 1, $t('courseHome.tryListen'))">{{ $t('courseHome.moreTryListen') }}</text>
|
<text @click="onPageJump('/pages/course/list/tryListen', 1, $t('courseHome.tryListen'))">{{ $t('courseHome.moreTryListen') }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
|
</Skeleton>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { onShow, onHide, onPullDownRefresh, onPageScroll, onLoad } from '@dcloudio/uni-app'
|
import { onShow, onHide, onPullDownRefresh, onPageScroll } from '@dcloudio/uni-app'
|
||||||
import { useI18n } from 'vue-i18n'
|
|
||||||
import { courseApi } from '@/api/modules/course'
|
import { courseApi } from '@/api/modules/course'
|
||||||
import { courseSubjectClassificationApi } from '@/api/modules/cousre_subject_classification'
|
import { courseSubjectClassificationApi } from '@/api/modules/cousre_subject_classification'
|
||||||
import { commonApi } from '@/api/modules/common'
|
import { commonApi } from '@/api/modules/common'
|
||||||
import { getNotchHeight } from '@/utils/system'
|
import { getNotchHeight } from '@/utils/system'
|
||||||
// import { onPageJump } from '@/utils'
|
// import { onPageJump } from '@/utils'
|
||||||
import type { IMedicalTag, ICourse, INews } from '@/types/course'
|
import type { ICategory, ICourse, INews } from '@/types/course'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
// 系统信息
|
// 系统信息
|
||||||
const scrollTop = ref<number>(0) // 滚动位置
|
const scrollTop = ref<number>(0) // 滚动位置
|
||||||
@@ -227,38 +244,25 @@ const handleSearch = ({ value }: { value: string }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 分类相关
|
// 分类相关
|
||||||
const curseTagList = ref<IMedicalTag[]>([]) // 一级分类标签列表
|
const curseTagList = ref<ICategory[]>([]) // 一级分类标签列表
|
||||||
const sbuMedicalTagsList = ref<IMedicalTag[]>([]) // 二级分类标签列表
|
const sbuMedicalTagsList = ref<ICategory[]>([]) // 二级分类标签列表
|
||||||
const currentIndex = ref<number>(0) // 当前选中的一级分类索引
|
const currentIndex = ref<number>(0) // 当前选中的一级分类索引
|
||||||
const currentItem = ref<IMedicalTag | null>(null) // 当前选中的一级分类项
|
const currentItem = ref<ICategory | null>(null) // 当前选中的一级分类项
|
||||||
|
|
||||||
// 学科数据
|
// 学科数据
|
||||||
const firstLevelCategories = ref<string[]>(['医学', '心理学', '国学'])
|
const firstLevelCategories = ref<string[]>(['医学', '心理学', '国学'])
|
||||||
const selectedFirstLevel = ref<number>('医学') // 当前选中的一级分类索引
|
const selectedFirstLevel = ref('医学') // 当前选中的一级分类索引
|
||||||
/**
|
|
||||||
* 学科点击处理
|
|
||||||
*/
|
|
||||||
const handleFirstLevelClick = (item: string) => {
|
|
||||||
selectedFirstLevel.value = item
|
|
||||||
switch (item) {
|
|
||||||
case '医学':
|
|
||||||
getMedicalTags()
|
|
||||||
break
|
|
||||||
case '心理学':
|
|
||||||
getSoulCateList()
|
|
||||||
break
|
|
||||||
case '国学':
|
|
||||||
getSociologyCateList()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 医学
|
* 医学
|
||||||
* 获取课程分类数据
|
* 获取课程分类数据
|
||||||
*/
|
*/
|
||||||
const getMedicalTags = async () => {
|
const medicineMenuSkeletonRef = ref()
|
||||||
|
const getMedicineMenus = () => {
|
||||||
sbuMedicalTagsList.value = []
|
sbuMedicalTagsList.value = []
|
||||||
const res = await courseSubjectClassificationApi.getCourseMedicalTree()
|
return courseSubjectClassificationApi.getCourseMedicalTree()
|
||||||
|
}
|
||||||
|
const getMedicineMenusSuccess = (res: any) => {
|
||||||
if (res && res.code === 0) {
|
if (res && res.code === 0) {
|
||||||
if (res.labels && res.labels.length > 0) {
|
if (res.labels && res.labels.length > 0) {
|
||||||
curseTagList.value = res.labels
|
curseTagList.value = res.labels
|
||||||
@@ -281,7 +285,7 @@ const getMedicalTags = async () => {
|
|||||||
* 医学
|
* 医学
|
||||||
* 一级分类点击处理
|
* 一级分类点击处理
|
||||||
*/
|
*/
|
||||||
const curseClick = (item: IMedicalTag, index: number) => {
|
const curseClick = (item: ICategory, index: number) => {
|
||||||
currentItem.value = item
|
currentItem.value = item
|
||||||
currentIndex.value = index
|
currentIndex.value = index
|
||||||
|
|
||||||
@@ -299,33 +303,54 @@ const curseClick = (item: IMedicalTag, index: number) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 心理学
|
* 菜单
|
||||||
* 获取课程分类数据
|
* 获取课程分类数据
|
||||||
*/
|
*/
|
||||||
const soulCateList = ref<IMedicalTag[]>([])
|
const menuSkeletonRef = ref()
|
||||||
const getSoulCateList = async () => {
|
const getMenus = () => {
|
||||||
const res = await courseSubjectClassificationApi.getCourseSoulTree()
|
switch (selectedFirstLevel.value) {
|
||||||
if (res.labels&&res.labels.length>0) {
|
// case '医学':
|
||||||
soulCateList.value = res.labels;
|
// return getMedicalTags()
|
||||||
|
case '心理学':
|
||||||
|
return courseSubjectClassificationApi.getCourseSoulTree()
|
||||||
|
case '国学':
|
||||||
|
return courseSubjectClassificationApi.getCourseSociologyTree()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国学
|
* 学科点击处理
|
||||||
* 获取课程分类数据
|
|
||||||
*/
|
*/
|
||||||
const sociologyCateList = ref<IMedicalTag[]>([])
|
const handleFirstLevelClick = (item: string) => {
|
||||||
const getSociologyCateList = async () => {
|
getPrompt()
|
||||||
const res = await courseSubjectClassificationApi.getCourseSociologyTree()
|
if(!uni.getStorageSync('token')) return
|
||||||
if (res.labels&&res.labels.length>0) {
|
selectedFirstLevel.value = item
|
||||||
sociologyCateList.value = res.labels;
|
if (item === '医学') {
|
||||||
|
medicineMenuSkeletonRef.value.reload()
|
||||||
|
} else {
|
||||||
|
menuSkeletonRef.value?.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// switch (item) {
|
||||||
|
// case '医学':
|
||||||
|
// getMedicalTags()
|
||||||
|
// break
|
||||||
|
// case '心理学':
|
||||||
|
// getSoulCateList()
|
||||||
|
// break
|
||||||
|
// case '国学':
|
||||||
|
// getSociologyCateList()
|
||||||
|
// break
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 终极分类点击处理
|
* 终极分类点击处理
|
||||||
*/
|
*/
|
||||||
const curseClickJump = (item: IMedicalTag) => {
|
const curseClickJump = (item: ICategory) => {
|
||||||
|
getPrompt()
|
||||||
|
if(!uni.getStorageSync('token')) return
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/course/list/category?id=${item.id}&title=${item.title}&pid=${item.pid}&subject=${selectedFirstLevel.value}`
|
url: `/pages/course/list/category?id=${item.id}&title=${item.title}&pid=${item.pid}&subject=${selectedFirstLevel.value}`
|
||||||
})
|
})
|
||||||
@@ -335,6 +360,8 @@ const curseClickJump = (item: IMedicalTag) => {
|
|||||||
* 页面跳转统一处理
|
* 页面跳转统一处理
|
||||||
*/
|
*/
|
||||||
const onPageJump = (url: string, id?: number, title?: string) => {
|
const onPageJump = (url: string, id?: number, title?: string) => {
|
||||||
|
getPrompt()
|
||||||
|
if(!uni.getStorageSync('token')) return
|
||||||
let targetUrl = url
|
let targetUrl = url
|
||||||
if (id !== undefined) {
|
if (id !== undefined) {
|
||||||
targetUrl += `?id=${id}`
|
targetUrl += `?id=${id}`
|
||||||
@@ -381,28 +408,37 @@ const getNewsList = async () => {
|
|||||||
* 新闻点击处理
|
* 新闻点击处理
|
||||||
*/
|
*/
|
||||||
const newsClick = (item: INews) => {
|
const newsClick = (item: INews) => {
|
||||||
|
getPrompt()
|
||||||
|
if(!uni.getStorageSync('token')) return
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/news/details?newsId=${item.id}&url=${item.url}&type=${item.type}`
|
url: `/pages/news/details?newsId=${item.id}&url=${item.url}&type=${item.type}`
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 精彩试听
|
// 精彩试听
|
||||||
const tryListenList = ref<ICourse[]>([]) // 试听课程列表
|
|
||||||
/**
|
/**
|
||||||
* 获取试听课程列表
|
* 获取试听课程列表
|
||||||
*/
|
*/
|
||||||
const getTryListenList = async () => {
|
const getTryListenList = () => courseApi.getMarketCourseList({ page: 1, limit: 6, id: 1 })
|
||||||
const res = await courseApi.getMarketCourseList({
|
|
||||||
page: 1,
|
/**
|
||||||
limit: 6,
|
* 登录提示语
|
||||||
id: 1
|
*/
|
||||||
})
|
const getPrompt = () => {
|
||||||
if (res && res.code === 0) {
|
console.log(userStore.token);
|
||||||
if (res.courseList && res.courseList.records && res.courseList.records.length > 0) {
|
if(!uni.getStorageSync('token')) {
|
||||||
tryListenList.value = res.courseList.records
|
uni.showModal({
|
||||||
} else {
|
title: '提示',
|
||||||
tryListenList.value = []
|
content: '请先登录后访问该页面',
|
||||||
|
confirmText: '去登录',
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res, 'res');
|
||||||
|
if (res.confirm) uni.navigateTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,8 +446,9 @@ const getTryListenList = async () => {
|
|||||||
* 统一请求所有数据
|
* 统一请求所有数据
|
||||||
*/
|
*/
|
||||||
const requestAll = async () => {
|
const requestAll = async () => {
|
||||||
|
if(uni.getStorageSync('token')){
|
||||||
getLearnCourse()
|
getLearnCourse()
|
||||||
getMedicalTags()
|
}
|
||||||
getTryListenList()
|
getTryListenList()
|
||||||
getNewsList()
|
getNewsList()
|
||||||
}
|
}
|
||||||
@@ -420,11 +457,17 @@ const requestAll = async () => {
|
|||||||
* 页面挂载
|
* 页面挂载
|
||||||
*/
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if(!userStore.token) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
// 重置分类索引
|
// 重置分类索引
|
||||||
currentIndex.value = 0
|
currentIndex.value = 0
|
||||||
|
|
||||||
// 请求所有数据
|
// 请求所有数据
|
||||||
requestAll()
|
requestAll()
|
||||||
|
console.log('进来了2');
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -432,16 +475,19 @@ onMounted(() => {
|
|||||||
*/
|
*/
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
// 检查是否有固定的分类选择状态
|
// 检查是否有固定的分类选择状态
|
||||||
const fixed = uni.getStorageSync('fixed')
|
// const fixed = uni.getStorageSync('fixed')
|
||||||
if (fixed && currentItem.value) {
|
// if (fixed && currentItem.value) {
|
||||||
curseClick(currentItem.value, currentIndex.value)
|
// curseClick(currentItem.value, currentIndex.value)
|
||||||
} else {
|
// } else {
|
||||||
currentIndex.value = 0
|
// currentIndex.value = 0
|
||||||
currentItem.value = null
|
// currentItem.value = null
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 刷新数据
|
// 刷新数据
|
||||||
requestAll()
|
// requestAll()
|
||||||
|
if(userStore.token){
|
||||||
|
getLearnCourse()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -464,7 +510,7 @@ onPullDownRefresh(() => {
|
|||||||
/**
|
/**
|
||||||
* 页面滚动
|
* 页面滚动
|
||||||
*/
|
*/
|
||||||
onPageScroll((e) => {
|
onPageScroll((e: any) => {
|
||||||
scrollTop.value = e.scrollTop
|
scrollTop.value = e.scrollTop
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -634,11 +680,9 @@ $border-color: #eeeeee;
|
|||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
margin: 0 10rpx;
|
margin: 0 10rpx;
|
||||||
|
|
||||||
.cate_list {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
|
||||||
.cate_item_box {
|
.cate_item_box {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
padding: 40rpx 0 30rpx;
|
padding: 40rpx 0 30rpx;
|
||||||
@@ -669,6 +713,13 @@ $border-color: #eeeeee;
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.child-menu {
|
||||||
|
display: none;
|
||||||
|
background-color: #000;
|
||||||
|
box-shadow: 0 4rpx 12rpx rgba(51, 97, 165, 0.08);
|
||||||
|
border-radius: 0 0 20rpx 20rpx;
|
||||||
|
padding: 10rpx 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -850,7 +901,6 @@ $border-color: #eeeeee;
|
|||||||
|
|
||||||
.learn {
|
.learn {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-top: 20rpx;
|
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
@@ -877,6 +927,7 @@ $border-color: #eeeeee;
|
|||||||
|
|
||||||
.titleBox {
|
.titleBox {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 50rpx;
|
width: 50rpx;
|
||||||
|
|||||||
139
pages/index.vue
Normal file
139
pages/index.vue
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
<template>
|
||||||
|
<div class="menu-container">
|
||||||
|
|
||||||
|
<!-- 一级导航 -->
|
||||||
|
<div class="menu-level-1">
|
||||||
|
<div
|
||||||
|
v-for="item in level1"
|
||||||
|
:key="item.id"
|
||||||
|
class="menu-item"
|
||||||
|
:class="{ active: selectedParentId === item.id }"
|
||||||
|
@click="selectParent(item)"
|
||||||
|
>
|
||||||
|
{{ item.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 二级导航区域 -->
|
||||||
|
<transition name="fade">
|
||||||
|
<div
|
||||||
|
v-if="childList.length"
|
||||||
|
class="menu-level-2"
|
||||||
|
:style="{ gridRowStart: childRowIndex }"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-for="child in childList"
|
||||||
|
:key="child.id"
|
||||||
|
class="menu-item child"
|
||||||
|
>
|
||||||
|
{{ child.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed } from "vue"
|
||||||
|
|
||||||
|
// 模拟接口返回的一级导航
|
||||||
|
const level1 = ref([
|
||||||
|
{ id: 1, name: "导航1", children: [] },
|
||||||
|
{ id: 2, name: "导航2", children: [
|
||||||
|
{ id: 21, name: "子2-1" },
|
||||||
|
{ id: 22, name: "子2-2" },
|
||||||
|
{ id: 23, name: "子2-3" }
|
||||||
|
]},
|
||||||
|
{ id: 3, name: "导航3", children: [] },
|
||||||
|
{ id: 4, name: "导航4", children: [
|
||||||
|
{ id: 41, name: "子4-1" },
|
||||||
|
{ id: 42, name: "子4-2" }
|
||||||
|
]},
|
||||||
|
{ id: 5, name: "导航5", children: [] },
|
||||||
|
{ id: 6, name: "导航6", children: [
|
||||||
|
{ id: 61, name: "子6-1" },
|
||||||
|
{ id: 62, name: "子6-2" },
|
||||||
|
{ id: 63, name: "子6-3" },
|
||||||
|
{ id: 64, name: "子6-4" },
|
||||||
|
]},
|
||||||
|
{ id: 7, name: "导航7", children: [] },
|
||||||
|
{ id: 8, name: "导航8", children: [] }
|
||||||
|
])
|
||||||
|
|
||||||
|
// 选择的一级导航
|
||||||
|
const selectedParentId = ref(null)
|
||||||
|
|
||||||
|
// 当前一级导航的子级
|
||||||
|
const childList = computed(() => {
|
||||||
|
const parent = level1.value.find(i => i.id === selectedParentId.value)
|
||||||
|
return parent ? parent.children : []
|
||||||
|
})
|
||||||
|
|
||||||
|
// 计算二级导航应该显示在哪一行(每行 4 个)
|
||||||
|
const childRowIndex = computed(() => {
|
||||||
|
if (!selectedParentId.value) return 3
|
||||||
|
const index = level1.value.findIndex(i => i.id === selectedParentId.value)
|
||||||
|
return Math.floor(index / 4) + 2 // 第一行 row=1,二级导航从 row=2 或 row=3
|
||||||
|
})
|
||||||
|
|
||||||
|
const selectParent = (item) => {
|
||||||
|
// 点击同一个时关闭
|
||||||
|
if (selectedParentId.value === item.id) {
|
||||||
|
selectedParentId.value = null
|
||||||
|
} else {
|
||||||
|
selectedParentId.value = item.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.menu-container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: auto auto auto;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 一级导航:4列布局 */
|
||||||
|
.menu-level-1 {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item {
|
||||||
|
padding: 12px;
|
||||||
|
text-align: center;
|
||||||
|
background: #4a90e2;
|
||||||
|
color: white;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item.active {
|
||||||
|
background: #2d73c7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 二级导航:自动换行 */
|
||||||
|
.menu-level-2 {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 8px;
|
||||||
|
background: #2d73c7;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item.child {
|
||||||
|
background: #1e4f8a;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 动画 */
|
||||||
|
.fade-enter-active, .fade-leave-active {
|
||||||
|
transition: all .2s ease;
|
||||||
|
}
|
||||||
|
.fade-enter-from, .fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-5px);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<view class="title" :style="{ 'margin-top': getNotchHeight() + 'px' }">{{ $t('forget.title') }}</view>
|
<!-- 自定义导航栏 -->
|
||||||
|
<nav-bar :title="$t('forget.title')" />
|
||||||
|
<!-- <view class="title" :style="{ 'margin-top': getNotchHeight() + 'px' }">{{ $t('forget.title') }}</view> -->
|
||||||
|
|
||||||
<!-- 邮箱输入 -->
|
<!-- 邮箱输入 -->
|
||||||
<view class="input-box">
|
<view class="input-box">
|
||||||
@@ -33,7 +35,7 @@
|
|||||||
<input
|
<input
|
||||||
class="input-text"
|
class="input-text"
|
||||||
type="password"
|
type="password"
|
||||||
maxlength="20"
|
:maxlength="20"
|
||||||
v-model="password"
|
v-model="password"
|
||||||
:placeholder="$t('forget.passwordPlaceholder')"
|
:placeholder="$t('forget.passwordPlaceholder')"
|
||||||
@input="inputMethod(password)"
|
@input="inputMethod(password)"
|
||||||
@@ -54,8 +56,8 @@
|
|||||||
<input
|
<input
|
||||||
class="input-text"
|
class="input-text"
|
||||||
type="password"
|
type="password"
|
||||||
minlength="8"
|
:minlength="8"
|
||||||
maxlength="20"
|
:maxlength="20"
|
||||||
v-model="confirmPassword"
|
v-model="confirmPassword"
|
||||||
:placeholder="$t('forget.passwordAgainPlaceholder')"
|
:placeholder="$t('forget.passwordAgainPlaceholder')"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
v-model="code"
|
v-model="code"
|
||||||
:placeholder="$t('login.codePlaceholder')"
|
:placeholder="$t('login.codePlaceholder')"
|
||||||
placeholder-class="grey"
|
placeholder-class="grey"
|
||||||
maxlength="6"
|
:maxlength="6"
|
||||||
@confirm="onSubmit"
|
@confirm="onSubmit"
|
||||||
/>
|
/>
|
||||||
<wd-button type="info" :class="['code-btn', { 'active': !readonly }]" @click="onSetCode">
|
<wd-button type="info" :class="['code-btn', { 'active': !readonly }]" @click="onSetCode">
|
||||||
@@ -115,11 +115,11 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 游客体验 -->
|
<!-- 游客体验 -->
|
||||||
<!-- <view class="youke-l">
|
<view class="youke-l" v-if="!isAndorid">
|
||||||
<view @click="onPageJump('/pages/visitor/visitor')">
|
<view @click="onPageSwitch('/pages/course/index')">
|
||||||
{{ $t('login.noLogin') }}
|
{{ $t('login.noLogin') }}
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 用户协议弹窗 -->
|
<!-- 用户协议弹窗 -->
|
||||||
@@ -147,6 +147,7 @@ import { loginWithCode, loginWithPassword } from '@/api/modules/auth'
|
|||||||
import { commonApi } from '@/api/modules/common'
|
import { commonApi } from '@/api/modules/common'
|
||||||
import { validateEmail } from '@/utils/validator'
|
import { validateEmail } from '@/utils/validator'
|
||||||
import { onPageJump } from '@/utils'
|
import { onPageJump } from '@/utils'
|
||||||
|
import { ILoginResponse } from '@/types/user'
|
||||||
|
|
||||||
import { t } from '@/utils/i18n'
|
import { t } from '@/utils/i18n'
|
||||||
|
|
||||||
@@ -184,6 +185,7 @@ let codeTimer: any = null
|
|||||||
|
|
||||||
// 提交点击次数
|
// 提交点击次数
|
||||||
const submitClickNum = ref(0)
|
const submitClickNum = ref(0)
|
||||||
|
const isAndorid = ref(false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 切换登录方式
|
* 切换登录方式
|
||||||
@@ -302,14 +304,14 @@ const passwordLogin = async () => {
|
|||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
if(!isAgree()) return false
|
if(!isAgree()) return false
|
||||||
|
|
||||||
let res = null
|
let res: ILoginResponse | null = null
|
||||||
|
|
||||||
switch (loginType.value) {
|
switch (loginType.value) {
|
||||||
case 2000:
|
case 2000:
|
||||||
res = await verifyCodeLogin()
|
res = await verifyCodeLogin() as ILoginResponse
|
||||||
break
|
break
|
||||||
case 1000:
|
case 1000:
|
||||||
res = await passwordLogin()
|
res = await passwordLogin() as ILoginResponse
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,8 +400,8 @@ const yszc = () => {
|
|||||||
/**
|
/**
|
||||||
* 页面跳转
|
* 页面跳转
|
||||||
*/
|
*/
|
||||||
const onPageJump = (url: string) => {
|
const onPageSwitch = (url: string) => {
|
||||||
uni.navigateTo({
|
uni.switchTab({
|
||||||
url: url,
|
url: url,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -437,7 +439,18 @@ const agreeAgreements = () => {
|
|||||||
uni.setStorageSync('Agreements_agreed', agree.value);
|
uni.setStorageSync('Agreements_agreed', agree.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断当前系统
|
||||||
|
*/
|
||||||
|
const getOS = () =>{
|
||||||
|
const oprateOs = uni.getSystemInfoSync().platform
|
||||||
|
console.log(oprateOs, 'oprateOs');
|
||||||
|
isAndorid.value = oprateOs === "android" ? true : false
|
||||||
|
console.log(isAndorid.value);
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
getOS()
|
||||||
loadAgreements()
|
loadAgreements()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -91,15 +91,23 @@ const orderType = computed(() => {
|
|||||||
* 页面加载
|
* 页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(async (options: any) => {
|
onLoad(async (options: any) => {
|
||||||
if (options.goods) {
|
|
||||||
try {
|
try {
|
||||||
|
if (options.isRelearn == 1) {
|
||||||
|
uni.$on('selectedGoods', async (data: IOrderGoods) => {
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
await getUserInfo()
|
await getUserInfo()
|
||||||
|
|
||||||
|
// 处理商品数据
|
||||||
|
console.log('监听到传入的商品数据:', data)
|
||||||
|
goodsList.value = [ data ]
|
||||||
|
})
|
||||||
|
} else if (options.goods) {
|
||||||
|
// 获取用户信息
|
||||||
|
await getUserInfo()
|
||||||
// 根据商品ID获取商品详细信息
|
// 根据商品ID获取商品详细信息
|
||||||
goodsIds.value = options.goods || ''
|
goodsIds.value = options.goods || ''
|
||||||
isRelearn.value = options.isRelearn == '1'
|
|
||||||
getGoodsList()
|
getGoodsList()
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('解析商品数据失败:', error)
|
console.error('解析商品数据失败:', error)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -107,7 +115,6 @@ onLoad(async (options: any) => {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -56,10 +56,10 @@ const orderType = ref<string>('')
|
|||||||
/**
|
/**
|
||||||
* 页面加载
|
* 页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(async () => {
|
onLoad(() => {
|
||||||
try {
|
try {
|
||||||
// 获取商品列表
|
// 获取商品列表
|
||||||
await uni.$on('selectedGoods', async (data: IOrderGoods) => {
|
uni.$on('selectedGoods', async (data: IOrderGoods) => {
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
await getUserInfo()
|
await getUserInfo()
|
||||||
|
|
||||||
|
|||||||
134
pages/user/certificate/index.vue
Normal file
134
pages/user/certificate/index.vue
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
<template>
|
||||||
|
<view class="certificate-page">
|
||||||
|
<nav-bar :title="$t('user.certificate')"></nav-bar>
|
||||||
|
<view v-if="certificateList.length > 0">
|
||||||
|
<view style="margin: 10rpx;" >【共{{certificateList.length}}个证书】</view>
|
||||||
|
<view class="certificate-list" v-for="(item,index) in certificateList" :key="index">
|
||||||
|
<view class="certificate-list-row">
|
||||||
|
<h3>证书编号:{{item.bh}}</h3>
|
||||||
|
<text style="font-size: 26rpx; color: #999;">获得时间:{{item.time}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="certificate-certificate">
|
||||||
|
<view class="img" v-for="(i,index) in item.certificateUrl" :key="index">
|
||||||
|
<image @click="preveImg(i.url)" :src="i.url" mode="heightFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="certificate-detailed" @click="detailed(item)">详细信息</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-else><wd-divider>您还未获得证书</wd-divider></view>
|
||||||
|
</view>
|
||||||
|
<wd-popup v-model="detailedState" position="bottom" :closeable="true">
|
||||||
|
<view class="detailed">
|
||||||
|
<view class="detailed-text">
|
||||||
|
证书详情
|
||||||
|
</view>
|
||||||
|
<view class="detailed-row">证书类型:<text class="text">{{detailedData.a}}</text></view>
|
||||||
|
<view class="detailed-row">获得时间:<text class="text">{{detailedData.time}}</text></view>
|
||||||
|
<view class="detailed-row">获得途径:<text class="text">{{detailedData.b}}</text></view>
|
||||||
|
</view>
|
||||||
|
</wd-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const detailedState = ref(false)
|
||||||
|
const detailedData = ref({})
|
||||||
|
|
||||||
|
// 模拟的 certificateList 数据
|
||||||
|
const certificateList = ref([
|
||||||
|
{ a: 'ZH', b: '吴门', bh: 1, time: '2025-6-20', certificateUrl: "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/certificate/ca2140c3-d212-4d4e-9203-ddc161d50470.jpg,https://ehh-private-01.oss-cn-beijing.aliyuncs.com/certificate/18a7ea22-b75a-4ef6-9109-f448f45e424f.jpg" },
|
||||||
|
{ bh: 2, time: '2025-6-22', certificateUrl: "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/certificate/ca2140c3-d212-4d4e-9203-ddc161d50470.jpg,https://ehh-private-01.oss-cn-beijing.aliyuncs.com/certificate/18a7ea22-b75a-4ef6-9109-f448f45e424f.jpg" }
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 重新获取数据
|
||||||
|
certificateList.value = certificateList.value.map(item => {
|
||||||
|
return { ...item, certificateUrl: item.certificateUrl.split(',').map(url => ({ url })) };
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看证书详情信息
|
||||||
|
*/
|
||||||
|
const detailed = (item) => {
|
||||||
|
detailedState.value = true
|
||||||
|
detailedData.value = item
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看照片
|
||||||
|
*/
|
||||||
|
const preveImg = (url : any) => {
|
||||||
|
uni.previewImage({
|
||||||
|
urls: [url],
|
||||||
|
current: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.certificate-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f7faf9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.certificate-list {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 15rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
margin: 20rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.certificate-list-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.certificate-certificate {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-top: 20rpx;
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 36%;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 300rpx;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.certificate-detailed {
|
||||||
|
color: #55aaff;
|
||||||
|
border: #55aaff 1px solid;
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
border-radius: 15rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailed {
|
||||||
|
padding: 20rpx;
|
||||||
|
|
||||||
|
.detailed-text {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailed-row {
|
||||||
|
color: #999;
|
||||||
|
margin: 20rpx 0;
|
||||||
|
font-size: 26rpx;
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
113
pages/user/hufen/forDetails.vue
Normal file
113
pages/user/hufen/forDetails.vue
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<template>
|
||||||
|
<z-paging ref="paging" v-model="bookList" auto-show-back-to-top class="my-book-page" @query="hufenList"
|
||||||
|
:default-page-size="10">
|
||||||
|
<template #top>
|
||||||
|
<!-- 自定义导航栏 -->
|
||||||
|
<nav-bar :title="$t('user.hufenRecord')"></nav-bar>
|
||||||
|
</template>
|
||||||
|
<view class="recharge-record" v-if="(bookList && bookList.length > 0)">
|
||||||
|
<view class="go-gecharge">{{hufenData.nameValue}} {{$t('user.hufenRecord')}}</view>
|
||||||
|
<view class="recharge-record-block" v-for="(item, index) in bookList" :key="index">
|
||||||
|
<view class="recharge-record-block-row">{{item.createTime}}<text class="text">{{item.score}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="time">{{item.detail}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</z-paging>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { getUserContributionByTypeList } from '@/api/modules/user'
|
||||||
|
import { copyToClipboard } from '@/utils/index'
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const paging = ref<any>()
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
// 数据状态
|
||||||
|
const bookList = ref([])
|
||||||
|
const loading = ref(false)
|
||||||
|
const firstLoad = ref(true)
|
||||||
|
const hufenData = ref('')
|
||||||
|
|
||||||
|
// 湖分记录
|
||||||
|
async function hufenList(pageNo : number, pageSize : number) {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const res = await getUserContributionByTypeList(pageNo, pageSize, hufenData.value.type)
|
||||||
|
console.log(res, 'res');
|
||||||
|
paging.value.complete(res.list.records)
|
||||||
|
} catch (error) {
|
||||||
|
paging.value.complete(false)
|
||||||
|
console.error('Failed to load book list:', error)
|
||||||
|
} finally {
|
||||||
|
firstLoad.value = false
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onLoad((options) => {
|
||||||
|
hufenData.value = options
|
||||||
|
console.log(hufenData);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.my-book-page {
|
||||||
|
background: #f7faf9;
|
||||||
|
min-height: 100vh;
|
||||||
|
|
||||||
|
.recharge-record {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 15rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
// padding: 20rpx;
|
||||||
|
margin: 20rpx;
|
||||||
|
|
||||||
|
.go-gecharge {
|
||||||
|
text-align: center;
|
||||||
|
background: linear-gradient(to right, #007bff, #17a2b8);
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #fff;
|
||||||
|
padding: 20rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 30rpx;
|
||||||
|
padding-left: 20rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
color: #007bff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recharge-record-block {
|
||||||
|
border-bottom: 1px solid #e0e0e0;
|
||||||
|
padding: 20rpx;
|
||||||
|
|
||||||
|
.time {
|
||||||
|
font-size: 24rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
color: #343434
|
||||||
|
}
|
||||||
|
|
||||||
|
.recharge-record-block-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
// font-weight: 700;
|
||||||
|
color: #909090;
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: #007bff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
69
pages/user/hufen/index.vue
Normal file
69
pages/user/hufen/index.vue
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<template>
|
||||||
|
<view class="recharge-page">
|
||||||
|
<nav-bar :title="$t('user.iHufen')"></nav-bar>
|
||||||
|
<view class="menu-section" v-if="hufenList.list.length > 0">
|
||||||
|
<wd-cell-group border class="menu-list">
|
||||||
|
<wd-cell v-for="item in hufenList.list" :key="item.type" :title="item.dict_value" is-link
|
||||||
|
@click="handleMenuClick(item)">
|
||||||
|
<text class="menu-list-hufen">{{item.score}}</text><text class="menu-list-hufen-text">{{$t('user.hufen')}}</text>
|
||||||
|
</wd-cell>
|
||||||
|
</wd-cell-group>
|
||||||
|
</view>
|
||||||
|
<view v-else><wd-divider>您还未获得湖分</wd-divider></view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { getUserContributionData } from '@/api/modules/user'
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const hufenList = ref([])
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户湖分
|
||||||
|
*/
|
||||||
|
const getHufen = async () => {
|
||||||
|
hufenList.value = await getUserContributionData()
|
||||||
|
console.log(hufenList.value.list)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleMenuClick = (item) => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/user/hufen/forDetails?type=${item.type}&nameValue=${item.dict_value}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getHufen()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.recharge-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f7faf9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-section {
|
||||||
|
padding: 20rpx 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-list {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 15rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
|
||||||
|
.menu-list-hufen {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #007bff;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-list-hufen-text {
|
||||||
|
color: #007bff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="user-page" :style="{ paddingTop: getNotchHeight() + 30 + 'px' }">
|
<view class="user-page" :style="{ paddingTop: getNotchHeight() + 30 + 'px' }" v-if="userStore.token && uni.getStorageSync('token')">
|
||||||
<!-- 设置图标 -->
|
<!-- 设置图标 -->
|
||||||
<view class="settings-icon" :style="{ top: getNotchHeight() + 30 + 'px' }" @click="goSettings">
|
<view class="settings-icon" :style="{ top: getNotchHeight() + 30 + 'px' }" @click="goSettings">
|
||||||
<wd-icon name="setting1" size="24px" color="#666" />
|
<wd-icon name="setting1" size="24px" color="#666" />
|
||||||
@@ -23,18 +23,23 @@
|
|||||||
<view class="vip-card-title">{{ $t('user.vip') }}</view>
|
<view class="vip-card-title">{{ $t('user.vip') }}</view>
|
||||||
<view class="vip-card-content">
|
<view class="vip-card-content">
|
||||||
<view class="vip-item-list">
|
<view class="vip-item-list">
|
||||||
<view v-if="vipInfo?.length > 0" v-for="vip in vipInfo">{{ vipTypeDict[vip.type] }}({{ parseTime(vip.endTime, '{y}-{m}-{d}') }} 截止)</view>
|
<view v-if="vipInfo?.length > 0" v-for="vip in vipInfo">
|
||||||
|
{{ vipTypeDict[vip.type] }}({{ parseTime(vip.endTime, '{y}-{m}-{d}') }} 截止)</view>
|
||||||
<view v-else>办理课程VIP,畅享更多权益</view>
|
<view v-else>办理课程VIP,畅享更多权益</view>
|
||||||
</view>
|
</view>
|
||||||
<wd-button v-if="vipInfo?.length > 0" plain type="primary" size="small" @click="goCourseVipSub">{{ $t('vip.renewal') }}</wd-button>
|
<wd-button v-if="vipInfo?.length > 0" plain type="primary" size="small"
|
||||||
<wd-button v-else plain type="primary" size="small" @click="goCourseVipSub">{{ $t('vip.openVip') }}</wd-button>
|
@click="goCourseVipSub">{{ $t('vip.renewal') }}</wd-button>
|
||||||
|
<wd-button v-else plain type="primary" size="small"
|
||||||
|
@click="goCourseVipSub">{{ $t('vip.openVip') }}</wd-button>
|
||||||
</view>
|
</view>
|
||||||
<view class="vip-card-content">
|
<view class="vip-card-content">
|
||||||
<view class="vip-item-list">
|
<view class="vip-item-list">
|
||||||
<view v-if="vipInfoEbook?.length > 0" v-for="vip in vipInfoEbook">电子书VIP{{ vipTypeDict[vip.type] }}({{ parseTime(vip.endTime, '{y}-{m}-{d}') }} 截止)</view>
|
<view v-if="vipInfoEbook?.length > 0" v-for="vip in vipInfoEbook">
|
||||||
|
电子书VIP{{ vipTypeDict[vip.type] }}({{ parseTime(vip.endTime, '{y}-{m}-{d}') }} 截止)</view>
|
||||||
<view v-else>办理电子书VIP,畅享更多权益</view>
|
<view v-else>办理电子书VIP,畅享更多权益</view>
|
||||||
</view>
|
</view>
|
||||||
<wd-button v-if="!vipInfoEbook?.length" plain type="primary" size="small" @click="goSubscribe">{{ $t('vip.openVip') }}</wd-button>
|
<wd-button v-if="!vipInfoEbook?.length" plain type="primary" size="small"
|
||||||
|
@click="goSubscribe">{{ $t('vip.openVip') }}</wd-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -65,29 +70,33 @@
|
|||||||
<!-- 功能菜单列表 -->
|
<!-- 功能菜单列表 -->
|
||||||
<view class="menu-section">
|
<view class="menu-section">
|
||||||
<wd-cell-group border class="menu-list">
|
<wd-cell-group border class="menu-list">
|
||||||
<wd-cell v-for="item in menuItems" :key="item.id" :title="item.name" :label="item.desc" is-link @click="handleMenuClick(item)" />
|
<wd-cell v-for="item in menuItems" :key="item.id" :title="item.name" :label="item.desc" is-link
|
||||||
|
@click="handleMenuClick(item)">
|
||||||
|
<text v-if="item.hufenState" class="menu-list-hufen">{{hufenData?.total ?? 0}}<text
|
||||||
|
style="margin-left: 6rpx;">湖分</text></text>
|
||||||
|
</wd-cell>
|
||||||
</wd-cell-group>
|
</wd-cell-group>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<visitor v-else></visitor>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import { useSysStore } from '@/stores/sys'
|
import { useSysStore } from '@/stores/sys'
|
||||||
import { getUserInfo, getVipInfo } from '@/api/modules/user'
|
import { getUserInfo, getUserContributionData } from '@/api/modules/user'
|
||||||
import type { IVipInfo } from '@/types/user'
|
|
||||||
import { getNotchHeight } from '@/utils/system'
|
import { getNotchHeight } from '@/utils/system'
|
||||||
import { parseTime } from '@/utils/index'
|
import { parseTime } from '@/utils/index'
|
||||||
import { t } from '@/utils/i18n'
|
import { t } from '@/utils/i18n'
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
|
import visitor from '@/pages/visitor/index.vue';
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const sysStore = useSysStore()
|
const sysStore = useSysStore()
|
||||||
|
|
||||||
// 默认头像
|
// 默认头像
|
||||||
const defaultAvatar = '/static/logo.png'
|
const defaultAvatar = '/static/logo.png'
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const userInfo = computed(() => userStore.userInfo)
|
const userInfo = computed(() => userStore.userInfo)
|
||||||
|
|
||||||
@@ -140,7 +149,22 @@
|
|||||||
// desc: t('user.migrateSubtitle'),
|
// desc: t('user.migrateSubtitle'),
|
||||||
// type: 'pageJump'
|
// type: 'pageJump'
|
||||||
// }
|
// }
|
||||||
|
// {
|
||||||
|
// id: 7,
|
||||||
|
// name: t('user.certificate'),
|
||||||
|
// url: '/pages/user/certificate/index',
|
||||||
|
// type: 'pageJump'
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
name: t('user.iHufen'),
|
||||||
|
url: '/pages/user/hufen/index',
|
||||||
|
type: 'pageJump',
|
||||||
|
hufenState: true
|
||||||
|
},
|
||||||
])
|
])
|
||||||
|
// 湖分
|
||||||
|
const hufenData = ref()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取平台信息
|
* 获取平台信息
|
||||||
@@ -161,6 +185,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户湖分
|
||||||
|
*/
|
||||||
|
const getHufen = async () => {
|
||||||
|
hufenData.value = await getUserContributionData()
|
||||||
|
hufenData.value = await getUserContributionData()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转到设置页面
|
* 跳转到设置页面
|
||||||
*/
|
*/
|
||||||
@@ -243,11 +275,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
if (uni.getStorageSync('token')) {
|
||||||
getData()
|
getData()
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (uni.getStorageSync('token')) {
|
||||||
getPlatform()
|
getPlatform()
|
||||||
|
getHufen()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -255,7 +293,7 @@
|
|||||||
$theme-color: #54a966;
|
$theme-color: #54a966;
|
||||||
|
|
||||||
.user-page {
|
.user-page {
|
||||||
min-height: 100vh;
|
min-height: calc(100vh - 50px);
|
||||||
background-color: #f7faf9;
|
background-color: #f7faf9;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,6 +432,16 @@
|
|||||||
border-radius: 15rpx;
|
border-radius: 15rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
|
||||||
|
.menu-list-hufen {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #007bff;
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chong_btn {
|
.chong_btn {
|
||||||
|
|||||||
@@ -3,10 +3,20 @@
|
|||||||
<!-- 自定义导航栏 -->
|
<!-- 自定义导航栏 -->
|
||||||
<nav-bar :title="$t('user.dataMigrate')"></nav-bar>
|
<nav-bar :title="$t('user.dataMigrate')"></nav-bar>
|
||||||
|
|
||||||
<view class="text-red-500 text-center mb-[20rpx]! font-bold">{{ $t('user.migrateWarning') }}</view>
|
<view v-if="!!migrateInfo.notMigration" class="text-center mb-[20rpx]!">
|
||||||
|
<view v-if="!!migrateInfo.alreadyMigration">{{ $t('user.alreadyMigrated') }}{{ migrateInfo.alreadyMigration }}</view>
|
||||||
|
<view>{{ $t('user.notMigration') }}<text class="font-bold">{{ migrateInfo.notMigration }}</text></view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-else class="text-center mb-[20rpx]! bg-white p-[20rpx] rounded-[10rpx] shadow-[0_4rpx_12rpx_rgba(0,0,0,0.05)]">
|
||||||
|
<wd-text :text="$t('user.migratedCompleted')" type="warning" />
|
||||||
|
<wd-text :text="migrateInfo.alreadyMigration" type="warning" bold />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view v-if="!!migrateInfo.notMigration" class="text-red-500 text-center mb-[20rpx]! font-bold">{{ $t('user.migrateWarning') }}</view>
|
||||||
|
|
||||||
<!-- 主要内容区域 -->
|
<!-- 主要内容区域 -->
|
||||||
<wd-form ref="migrateForm" :model="formData" :rules="rules" :label-width="120" class="migrate-card p-[10rpx]">
|
<wd-form v-if="!!migrateInfo.notMigration" ref="migrateForm" :model="formData" :rules="rules" :label-width="120" class="migrate-card p-[10rpx]">
|
||||||
<wd-cell-group border>
|
<wd-cell-group border>
|
||||||
<wd-input
|
<wd-input
|
||||||
v-model="formData.tel"
|
v-model="formData.tel"
|
||||||
@@ -60,22 +70,40 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { t } from '@/utils/i18n'
|
import { t } from '@/utils/i18n'
|
||||||
import { migrateUserData } from '@/api/modules/user'
|
import { migrateUserData, getUserMigrateInfo } from '@/api/modules/user'
|
||||||
import { useMessage } from '@/uni_modules/wot-design-uni'
|
import { useMessage } from '@/uni_modules/wot-design-uni'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
|
const migrateInfo = ref({
|
||||||
|
alreadyMigration: '',
|
||||||
|
notMigration: ''
|
||||||
|
})
|
||||||
|
|
||||||
// 表单引用
|
// 表单引用
|
||||||
const migrateForm = ref()
|
const migrateForm = ref()
|
||||||
|
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
tel: '',
|
tel: '',
|
||||||
code: ''
|
code: '',
|
||||||
|
type: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 获取用户迁移信息
|
||||||
|
const getMigrateInfo = async () => {
|
||||||
|
const res = await getUserMigrateInfo()
|
||||||
|
migrateInfo.value.alreadyMigration = res.alreadyMigration
|
||||||
|
// migrateInfo.value.notMigration = res.notMigration
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
getMigrateInfo()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 表单验证规则
|
// 表单验证规则
|
||||||
const rules = ref({
|
const rules = ref({
|
||||||
tel: [
|
tel: [
|
||||||
@@ -113,6 +141,7 @@ const handleSubmit = async () => {
|
|||||||
}
|
}
|
||||||
// 处理迁移
|
// 处理迁移
|
||||||
const submitMigrate = async () => {
|
const submitMigrate = async () => {
|
||||||
|
formData.value.type = migrateInfo.value.notMigration
|
||||||
await migrateUserData(formData.value)
|
await migrateUserData(formData.value)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: t('user.migrateSuccess'),
|
title: t('user.migrateSuccess'),
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
<view class="text">活动充值金额</view>
|
<view class="text">活动充值金额</view>
|
||||||
<view class="recharge">
|
<view class="recharge">
|
||||||
<view class="recharge_block" @click="chosPric(item)"
|
<view class="recharge_block" @click="chosPric(item)"
|
||||||
:class="aloneItem.priceTypeId === item.priceTypeId ? 'selected' : ''"
|
:class="aloneItem.priceTypeId === item.priceTypeId ? 'selected' : ''" v-for="item in eventAmountList"
|
||||||
v-for="item in eventAmountList" :key="item.priceTypeId">
|
:key="item.priceTypeId">
|
||||||
<view class="recharge_money">NZ${{item.realMoney}}</view>
|
<view class="recharge_money">NZ${{item.realMoney}}</view>
|
||||||
<view style="font-size: 26rpx;">{{item.money}}{{ $t('global.coin') }}</view>
|
<view style="font-size: 26rpx;">{{item.money}}{{ $t('global.coin') }}</view>
|
||||||
<span class="activity-label" v-if="item.givejf >0">{{item.description}}</span>
|
<span class="activity-label" v-if="item.givejf >0">{{item.description}}</span>
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
<view class="text">{{$t('order.rechargeAmount')}}</view>
|
<view class="text">{{$t('order.rechargeAmount')}}</view>
|
||||||
<view class="recharge">
|
<view class="recharge">
|
||||||
<view class="recharge_block" @click="chosPric(item)"
|
<view class="recharge_block" @click="chosPric(item)"
|
||||||
:class="aloneItem.priceTypeId === item.priceTypeId ? 'selected' : ''"
|
:class="aloneItem.priceTypeId === item.priceTypeId ? 'selected' : ''" v-for="item in standardAmountList"
|
||||||
v-for="item in standardAmountList" :key="item.priceTypeId">
|
:key="item.priceTypeId">
|
||||||
<view class="recharge_money">NZ${{item.realMoney}}</view>
|
<view class="recharge_money">NZ${{item.realMoney}}</view>
|
||||||
<view style="font-size: 26rpx;">{{item.money}}{{ $t('global.coin') }}</view>
|
<view style="font-size: 26rpx;">{{item.money}}{{ $t('global.coin') }}</view>
|
||||||
<span class="activity-label" v-if="item.givejf >0">{{item.description}}</span>
|
<span class="activity-label" v-if="item.givejf >0">{{item.description}}</span>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
import { ref, computed, onMounted, toRefs, reactive } from 'vue'
|
import { ref, computed, onMounted, toRefs, reactive } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useMessage } from '@/uni_modules/wot-design-uni'
|
import { useMessage } from '@/uni_modules/wot-design-uni'
|
||||||
import { getBookBuyConfigList, getAgreement, getActivityDescription, verifyGooglePay, getPlaceOrder } from '@/api/modules/user'
|
import { getBookBuyConfigList, getAgreement, getActivityDescription, verifyGooglePay, getPlaceOrder, getIosPayment } from '@/api/modules/user'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import { useThrottle } from '@/hooks/useThrottle';
|
import { useThrottle } from '@/hooks/useThrottle';
|
||||||
|
|
||||||
@@ -136,6 +136,8 @@
|
|||||||
//正常金额数据
|
//正常金额数据
|
||||||
const standardAmountList = ref([])
|
const standardAmountList = ref([])
|
||||||
|
|
||||||
|
const iapChannel = ref(null)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取使用环境
|
* 获取使用环境
|
||||||
*/
|
*/
|
||||||
@@ -145,6 +147,7 @@
|
|||||||
isAndroid.value = true;
|
isAndroid.value = true;
|
||||||
console.log('运行Android上')
|
console.log('运行Android上')
|
||||||
} else {
|
} else {
|
||||||
|
isAndroid.value = false;
|
||||||
qudao.value = 'Google'
|
qudao.value = 'Google'
|
||||||
console.log('运行iOS上')
|
console.log('运行iOS上')
|
||||||
}
|
}
|
||||||
@@ -189,10 +192,11 @@
|
|||||||
* 获取订单编号
|
* 获取订单编号
|
||||||
*/
|
*/
|
||||||
const getPlaceOrderObj = async () => {
|
const getPlaceOrderObj = async () => {
|
||||||
|
console.log(isAndroid.value);
|
||||||
const { priceTypeId, realMoney, money } = toRefs(aloneItem.value)
|
const { priceTypeId, realMoney, money } = toRefs(aloneItem.value)
|
||||||
const data = {
|
const data = {
|
||||||
userId: userStore.userInfo.id, // 用户di
|
userId: userStore.userInfo.id, // 用户di
|
||||||
paymentMethod: '5', //支付方式4point 5google
|
paymentMethod: isAndroid.value ? '5' : '3', //支付方式3ios 5google
|
||||||
orderMoney: money.value, //订单金额
|
orderMoney: money.value, //订单金额
|
||||||
realMoney: realMoney.value, //实际金额
|
realMoney: realMoney.value, //实际金额
|
||||||
come: '10', //订单来源 2医学吴门医述 10海外读书
|
come: '10', //订单来源 2医学吴门医述 10海外读书
|
||||||
@@ -200,12 +204,12 @@
|
|||||||
productId: priceTypeId.value // 商品id
|
productId: priceTypeId.value // 商品id
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// uni.hideLoading()
|
|
||||||
const res = await getPlaceOrder(data)
|
const res = await getPlaceOrder(data)
|
||||||
orderSn.value = res.orderSn
|
orderSn.value = res.orderSn
|
||||||
console.log(orderSn.value, '获取订单号');
|
console.log(orderSn.value, '获取订单号');
|
||||||
uni.showLoading({ title: t('order.orderCreating') })
|
uni.showLoading({ title: t('order.orderCreating') })
|
||||||
getGooglePay()
|
isAndroid.value ? getGooglePay() : checkProvider()
|
||||||
|
// getGooglePay()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取订单号失败', error)
|
console.error('获取订单号失败', error)
|
||||||
}
|
}
|
||||||
@@ -233,7 +237,121 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化
|
* 检测支付提供商(判断是否支持applepay)
|
||||||
|
*/
|
||||||
|
const checkProvider = () => {
|
||||||
|
uni.getProvider({
|
||||||
|
service: 'payment',
|
||||||
|
success: (res) => {
|
||||||
|
console.log('getProvider返回结果:', res); // 关键日志:看是否包含applepay
|
||||||
|
iapChannel.value = res.providers.find((channel) => {
|
||||||
|
return (channel.id === 'appleiap')
|
||||||
|
})
|
||||||
|
getProductInfo()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询后台配置的商品信息
|
||||||
|
*/
|
||||||
|
const getProductInfo = () => {
|
||||||
|
const id = String(aloneItem.value.priceTypeId)
|
||||||
|
iapChannel.value.requestProduct([id], (res: any) => {
|
||||||
|
console.log(res, '查询苹果后台配置的商品id');
|
||||||
|
topay(id)
|
||||||
|
}, (err: any) => {
|
||||||
|
uni.showToast({ title: '未获取到产品信息,请联系管理员', icon: 'none' });
|
||||||
|
console.error('失败', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 准备支付-调出支付窗口
|
||||||
|
*/
|
||||||
|
const topay = (id: string) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'appleiap',
|
||||||
|
orderInfo: {
|
||||||
|
productid: id,
|
||||||
|
username: orderSn.value, // 订单id
|
||||||
|
quantity: 1,
|
||||||
|
manualFinishTransaction: true
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res, 'res-topay');
|
||||||
|
iapCheck(res);
|
||||||
|
resolve(res);
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('支付错误', err);
|
||||||
|
restoreComplateRequest()
|
||||||
|
uni.showToast({
|
||||||
|
title: '关闭支付弹窗',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用后台支付-ios
|
||||||
|
*/
|
||||||
|
const iapCheck = async (res : { transactionIdentifier : string; transactionReceipt : string }) => {
|
||||||
|
// console.log(res.transactionIdentifier,res.payment.productid,res.payment.username,res.transactionReceipt,userStore.userInfo.id);
|
||||||
|
try {
|
||||||
|
const obj = await getIosPayment(res.transactionIdentifier, res.payment.productid, res.payment.username, res.transactionReceipt, userStore.userInfo.id)
|
||||||
|
console.log(obj, '校验订单')
|
||||||
|
finishTransaction(res)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('校验订单失败:', error)
|
||||||
|
// 也需要释放订单,防止再次提交支付窗口拉不起来
|
||||||
|
finishTransaction(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否存在未关闭的订单
|
||||||
|
*/
|
||||||
|
const restoreComplateRequest = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
iapChannel.value.restoreCompletedTransactions({
|
||||||
|
manualFinishTransaction: true,
|
||||||
|
}, (res: unknown) => {
|
||||||
|
console.log(res, '成功-restoreCompletedTransactions');
|
||||||
|
res.map((item: any) => {
|
||||||
|
finishTransaction(item)
|
||||||
|
})
|
||||||
|
resolve(res);
|
||||||
|
}, (err : any) => {
|
||||||
|
console.log(err, '失败-restoreCompletedTransactions');
|
||||||
|
reject(err);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭订单
|
||||||
|
*/
|
||||||
|
const finishTransaction = (trans : any) => {
|
||||||
|
iapChannel.value.finishTransaction(
|
||||||
|
trans,
|
||||||
|
(success : any) => {
|
||||||
|
console.log("关闭订单成功", success);
|
||||||
|
},
|
||||||
|
(fail : any) => {
|
||||||
|
console.log("关闭订单失败", fail);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谷歌初始化
|
||||||
*/
|
*/
|
||||||
const getGooglePay = () => {
|
const getGooglePay = () => {
|
||||||
googlePay.init({
|
googlePay.init({
|
||||||
|
|||||||
138
pages/visitor/index.vue
Normal file
138
pages/visitor/index.vue
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
<template>
|
||||||
|
<view class="visitor">
|
||||||
|
<view class="visitor-block">
|
||||||
|
<view style="display: flex;">
|
||||||
|
<image class="visitor_img" src="/static/logo.png" mode="aspectFil">
|
||||||
|
</image>
|
||||||
|
<text class="visitor-text" @click="gologin">立即登录</text>
|
||||||
|
</view>
|
||||||
|
<wd-cell-group border class="visitor-list">
|
||||||
|
<wd-cell v-for="item in menuItems" :title="item.name" is-link @click="handleMenuClick(item)">
|
||||||
|
</wd-cell>
|
||||||
|
</wd-cell-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<wd-action-sheet v-model="isShareSheetOpen" title="选择分享渠道" :panels="panels" @select="handleShare" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
const menuItems = ref([
|
||||||
|
{
|
||||||
|
name: '分享APP'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '关于我们',
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const isShareSheetOpen = ref(false)
|
||||||
|
|
||||||
|
const panels = ref([
|
||||||
|
{
|
||||||
|
iconUrl: '/static/contact-person.png',
|
||||||
|
title: '微信消息'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
iconUrl: '/static/moments.png',
|
||||||
|
title: '朋友圈'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// 打开分享菜单
|
||||||
|
const openShareSheet = () => {
|
||||||
|
isShareSheetOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 选择分享渠道后执行分享逻辑
|
||||||
|
const handleShare = (action) => {
|
||||||
|
console.log(action, 'action');
|
||||||
|
isShareSheetOpen.value = false // 关闭菜单
|
||||||
|
if (action.index == 0) {
|
||||||
|
// 分享到好友
|
||||||
|
uni.share({
|
||||||
|
provider: "weixin",
|
||||||
|
scene: "WXSceneSession",
|
||||||
|
type: 0,
|
||||||
|
href: 'https://a.app.qq.com/o/simple.jsp?pkgname=com.cn.medicine',
|
||||||
|
title: "吴门医述",
|
||||||
|
summary: "我正在使用吴门医述提升自己,赶紧跟我一起来体验吧!",
|
||||||
|
imageUrl: "static/icon/home_icon_logo.png",
|
||||||
|
success: function (res) {
|
||||||
|
console.log("success:" + JSON.stringify(res));
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
console.log("fail:" + JSON.stringify(err));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else if (action.index == 1) {
|
||||||
|
// 分享到朋友圈
|
||||||
|
uni.share({
|
||||||
|
provider: "weixin",
|
||||||
|
scene: "WXSceneTimeline",
|
||||||
|
type: 0,
|
||||||
|
href: 'https://a.app.qq.com/o/simple.jsp?pkgname=com.cn.medicine',
|
||||||
|
title: "吴门医述",
|
||||||
|
summary: "我正在使用吴门医述提升自己,赶紧跟我一起来体验吧!",
|
||||||
|
imageUrl: "static/icon/home_icon_logo.png",
|
||||||
|
success: function (res) {
|
||||||
|
console.log("success:" + JSON.stringify(res));
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
console.log("fail:" + JSON.stringify(err));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleMenuClick = (item : { name : string }) => {
|
||||||
|
if (item.name === '关于我们') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/user/about/index'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
isShareSheetOpen.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const gologin = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.visitor {
|
||||||
|
background: #f4f7ff;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.visitor-block {
|
||||||
|
padding: 100rpx 20rpx 40rpx 20rpx;
|
||||||
|
|
||||||
|
.visitor_img {
|
||||||
|
width: 150rpx;
|
||||||
|
height: 150rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.visitor-text {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 36rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visitor-list {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 15rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
BIN
static/contact-person.png
Normal file
BIN
static/contact-person.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
static/moments.png
Normal file
BIN
static/moments.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -8,6 +8,9 @@
|
|||||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
||||||
"Courier New", monospace;
|
"Courier New", monospace;
|
||||||
--color-red-500: oklch(63.7% 0.237 25.331);
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
||||||
|
--color-gray-300: oklch(87.2% 0.01 258.338);
|
||||||
|
--color-gray-500: oklch(55.1% 0.027 264.364);
|
||||||
|
--color-white: #fff;
|
||||||
--spacing: 0.25rem;
|
--spacing: 0.25rem;
|
||||||
--text-xs: 0.75rem;
|
--text-xs: 0.75rem;
|
||||||
--text-xs--line-height: calc(1 / 0.75);
|
--text-xs--line-height: calc(1 / 0.75);
|
||||||
@@ -211,18 +214,81 @@
|
|||||||
max-width: 96rem;
|
max-width: 96rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.mt-2 {
|
||||||
|
margin-top: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
|
.mt-2\! {
|
||||||
|
margin-top: calc(var(--spacing) * 2) !important;
|
||||||
|
}
|
||||||
|
.mt-2\.5\! {
|
||||||
|
margin-top: calc(var(--spacing) * 2.5) !important;
|
||||||
|
}
|
||||||
|
.mt-3 {
|
||||||
|
margin-top: calc(var(--spacing) * 3);
|
||||||
|
}
|
||||||
|
.mt-3\! {
|
||||||
|
margin-top: calc(var(--spacing) * 3) !important;
|
||||||
|
}
|
||||||
|
.mt-5 {
|
||||||
|
margin-top: calc(var(--spacing) * 5);
|
||||||
|
}
|
||||||
|
.mt-5\! {
|
||||||
|
margin-top: calc(var(--spacing) * 5) !important;
|
||||||
|
}
|
||||||
|
.mt-20 {
|
||||||
|
margin-top: calc(var(--spacing) * 20);
|
||||||
|
}
|
||||||
|
.mt-20\! {
|
||||||
|
margin-top: calc(var(--spacing) * 20) !important;
|
||||||
|
}
|
||||||
|
.mt-\[20rpx\]\! {
|
||||||
|
margin-top: 20rpx !important;
|
||||||
|
}
|
||||||
|
.mr-\[20rpx\] {
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
.mr-\[20rpx\]\! {
|
||||||
|
margin-right: 20rpx !important;
|
||||||
|
}
|
||||||
|
.mb-1 {
|
||||||
|
margin-bottom: calc(var(--spacing) * 1);
|
||||||
|
}
|
||||||
|
.mb-1\! {
|
||||||
|
margin-bottom: calc(var(--spacing) * 1) !important;
|
||||||
|
}
|
||||||
|
.mb-1\.5\! {
|
||||||
|
margin-bottom: calc(var(--spacing) * 1.5) !important;
|
||||||
|
}
|
||||||
|
.mb-2 {
|
||||||
|
margin-bottom: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
.mb-2\! {
|
.mb-2\! {
|
||||||
margin-bottom: calc(var(--spacing) * 2) !important;
|
margin-bottom: calc(var(--spacing) * 2) !important;
|
||||||
}
|
}
|
||||||
|
.mb-2\.5\! {
|
||||||
|
margin-bottom: calc(var(--spacing) * 2.5) !important;
|
||||||
|
}
|
||||||
.mb-\[20rpx\]\! {
|
.mb-\[20rpx\]\! {
|
||||||
margin-bottom: 20rpx !important;
|
margin-bottom: 20rpx !important;
|
||||||
}
|
}
|
||||||
|
.ml-1 {
|
||||||
|
margin-left: calc(var(--spacing) * 1);
|
||||||
|
}
|
||||||
.ml-1\! {
|
.ml-1\! {
|
||||||
margin-left: calc(var(--spacing) * 1) !important;
|
margin-left: calc(var(--spacing) * 1) !important;
|
||||||
}
|
}
|
||||||
|
.ml-2 {
|
||||||
|
margin-left: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
.ml-2\.5\! {
|
.ml-2\.5\! {
|
||||||
margin-left: calc(var(--spacing) * 2.5) !important;
|
margin-left: calc(var(--spacing) * 2.5) !important;
|
||||||
}
|
}
|
||||||
|
.ml-\[20rpx\] {
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
.ml-\[20rpx\]\! {
|
||||||
|
margin-left: 20rpx !important;
|
||||||
|
}
|
||||||
.block {
|
.block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
@@ -247,6 +313,9 @@
|
|||||||
.table {
|
.table {
|
||||||
display: table;
|
display: table;
|
||||||
}
|
}
|
||||||
|
.w-\[50\%\] {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
.w-\[100px\] {
|
.w-\[100px\] {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
@@ -256,6 +325,9 @@
|
|||||||
.flex-shrink {
|
.flex-shrink {
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
}
|
}
|
||||||
|
.border-collapse {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
.transform {
|
.transform {
|
||||||
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
||||||
}
|
}
|
||||||
@@ -265,16 +337,46 @@
|
|||||||
.flex-wrap {
|
.flex-wrap {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
.rounded-\[10rpx\] {
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
.border {
|
.border {
|
||||||
border-style: var(--tw-border-style);
|
border-style: var(--tw-border-style);
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
}
|
}
|
||||||
|
.bg-gray-300 {
|
||||||
|
background-color: var(--color-gray-300);
|
||||||
|
}
|
||||||
|
.bg-gray-500 {
|
||||||
|
background-color: var(--color-gray-500);
|
||||||
|
}
|
||||||
|
.bg-white {
|
||||||
|
background-color: var(--color-white);
|
||||||
|
}
|
||||||
|
.p-0 {
|
||||||
|
padding: calc(var(--spacing) * 0);
|
||||||
|
}
|
||||||
.p-0\! {
|
.p-0\! {
|
||||||
padding: calc(var(--spacing) * 0) !important;
|
padding: calc(var(--spacing) * 0) !important;
|
||||||
}
|
}
|
||||||
|
.p-2 {
|
||||||
|
padding: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
|
.p-2\.5 {
|
||||||
|
padding: calc(var(--spacing) * 2.5);
|
||||||
|
}
|
||||||
|
.p-3 {
|
||||||
|
padding: calc(var(--spacing) * 3);
|
||||||
|
}
|
||||||
.p-\[10rpx\] {
|
.p-\[10rpx\] {
|
||||||
padding: 10rpx;
|
padding: 10rpx;
|
||||||
}
|
}
|
||||||
|
.p-\[20rpx\] {
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
.p-\[20rpx\]\! {
|
||||||
|
padding: 20rpx !important;
|
||||||
|
}
|
||||||
.p-\[30rpx\] {
|
.p-\[30rpx\] {
|
||||||
padding: 30rpx;
|
padding: 30rpx;
|
||||||
}
|
}
|
||||||
@@ -287,6 +389,9 @@
|
|||||||
.pt-\[10rpx\] {
|
.pt-\[10rpx\] {
|
||||||
padding-top: 10rpx;
|
padding-top: 10rpx;
|
||||||
}
|
}
|
||||||
|
.pb-0 {
|
||||||
|
padding-bottom: calc(var(--spacing) * 0);
|
||||||
|
}
|
||||||
.pb-0\! {
|
.pb-0\! {
|
||||||
padding-bottom: calc(var(--spacing) * 0) !important;
|
padding-bottom: calc(var(--spacing) * 0) !important;
|
||||||
}
|
}
|
||||||
@@ -337,6 +442,13 @@
|
|||||||
--tw-ordinal: ordinal;
|
--tw-ordinal: ordinal;
|
||||||
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
|
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
|
||||||
}
|
}
|
||||||
|
.underline {
|
||||||
|
text-decoration-line: underline;
|
||||||
|
}
|
||||||
|
.shadow-\[0_4rpx_12rpx_rgba\(0\,0\,0\,0\.05\)\] {
|
||||||
|
--tw-shadow: 0 4rpx 12rpx var(--tw-shadow-color, rgba(0,0,0,0.05));
|
||||||
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
||||||
|
}
|
||||||
.ring {
|
.ring {
|
||||||
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
||||||
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
||||||
|
|||||||
1
types/book.d.ts
vendored
1
types/book.d.ts
vendored
@@ -129,7 +129,6 @@ export interface IPageData<T> {
|
|||||||
export interface IApiResponse<T = any> {
|
export interface IApiResponse<T = any> {
|
||||||
code: number
|
code: number
|
||||||
msg?: string
|
msg?: string
|
||||||
info?: string
|
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
types/course.d.ts
vendored
18
types/course.d.ts
vendored
@@ -3,7 +3,8 @@
|
|||||||
* 课程相关类型定义
|
* 课程相关类型定义
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { IApiResponse } from './book'
|
import type { IApiResponse } from '@/api/types'
|
||||||
|
import type { IVideoInfo } from './video'
|
||||||
import type { IGoods } from './order'
|
import type { IGoods } from './order'
|
||||||
|
|
||||||
/** 医学标签(课程分类) */
|
/** 医学标签(课程分类) */
|
||||||
@@ -49,11 +50,6 @@ export interface IMarketCourseListResponse extends IApiResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 消息列表响应 */
|
|
||||||
export interface IMessageListResponse extends IApiResponse {
|
|
||||||
messages: INews[] // 消息列表
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 课程详情 */
|
/** 课程详情 */
|
||||||
export interface ICourseDetail {
|
export interface ICourseDetail {
|
||||||
id: number
|
id: number
|
||||||
@@ -93,14 +89,6 @@ export interface IChapterDetail {
|
|||||||
questions: string // 思考题内容
|
questions: string // 思考题内容
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 视频信息 */
|
|
||||||
export interface IVideo {
|
|
||||||
id: number
|
|
||||||
title: string
|
|
||||||
url: string
|
|
||||||
duration?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
/** VIP信息 */
|
/** VIP信息 */
|
||||||
export interface IVipInfo {
|
export interface IVipInfo {
|
||||||
type: number // VIP类型 4-中医学 5-针灸学 6-肿瘤学 7-国学 8-心理学 9-中西汇通学
|
type: number // VIP类型 4-中医学 5-针灸学 6-肿瘤学 7-国学 8-心理学 9-中西汇通学
|
||||||
@@ -140,7 +128,7 @@ export interface IChapterListResponse extends IApiResponse {
|
|||||||
export interface IChapterDetailResponse extends IApiResponse {
|
export interface IChapterDetailResponse extends IApiResponse {
|
||||||
data: {
|
data: {
|
||||||
detail: IChapterDetail
|
detail: IChapterDetail
|
||||||
videos: IVideo[]
|
videos: IVideoInfo[]
|
||||||
current?: number // 当前播放视频ID
|
current?: number // 当前播放视频ID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
types/user.ts → types/user.d.ts
vendored
19
types/user.ts → types/user.d.ts
vendored
@@ -1,4 +1,5 @@
|
|||||||
// types/user.ts
|
// types/user.ts
|
||||||
|
import type { IApiResponse } from '@/api/types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息接口
|
* 用户信息接口
|
||||||
@@ -16,12 +17,12 @@ export interface IUserInfo {
|
|||||||
/**
|
/**
|
||||||
* 登录响应接口
|
* 登录响应接口
|
||||||
*/
|
*/
|
||||||
export interface ILoginResponse {
|
export interface ILoginResponse<T = IUserInfo> extends IApiResponse {
|
||||||
userInfo: IUserInfo
|
|
||||||
token: {
|
token: {
|
||||||
token: string
|
token: string
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
},
|
||||||
|
userInfo: T
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,3 +117,15 @@ export interface IPageData<T> {
|
|||||||
pages: number
|
pages: number
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单接口
|
||||||
|
*/
|
||||||
|
export interface IOrder {
|
||||||
|
id: number
|
||||||
|
orderType: string // 订单类型
|
||||||
|
changeAmount: number
|
||||||
|
remark: string
|
||||||
|
createTime: string
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
11
types/video.d.ts
vendored
11
types/video.d.ts
vendored
@@ -6,7 +6,7 @@
|
|||||||
export interface IVideoInfo {
|
export interface IVideoInfo {
|
||||||
id: number
|
id: number
|
||||||
chapterId: number
|
chapterId: number
|
||||||
type: 0 | 1 // 0: MP4, 1: M3U8
|
type: 0 | 1 | 2 // 0: MP4, 1: M3U8, 2: 音频
|
||||||
video: string // 视频ID
|
video: string // 视频ID
|
||||||
sort: number
|
sort: number
|
||||||
duration: number // 视频时长(秒)
|
duration: number // 视频时长(秒)
|
||||||
@@ -46,14 +46,7 @@ export interface IVideoCheckResponse {
|
|||||||
* 视频播放器组件 Props
|
* 视频播放器组件 Props
|
||||||
*/
|
*/
|
||||||
export interface IVideoPlayerProps {
|
export interface IVideoPlayerProps {
|
||||||
videoList: Array<{
|
videoList: Array<IVideoInfo>
|
||||||
id: number
|
|
||||||
chapterId: number
|
|
||||||
video: string
|
|
||||||
sort: number
|
|
||||||
type?: 0 | 1
|
|
||||||
duration?: number
|
|
||||||
}>
|
|
||||||
currentIndex: number
|
currentIndex: number
|
||||||
countdownSeconds?: number
|
countdownSeconds?: number
|
||||||
showWatermark?: boolean
|
showWatermark?: boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user