4 Commits

Author SHA1 Message Date
6c2811646a 修复:修改logo图 2025-12-15 15:47:16 +08:00
9e00409e5e 修复:不同系统支付,显示支付方式不同 2025-12-15 11:18:22 +08:00
1457a24cea 修复:更新ios支付接口 2025-12-15 10:41:41 +08:00
34d6cfdf9e 更新:访客模式可以查看图书首页 2025-12-12 14:33:47 +08:00
14 changed files with 69 additions and 93 deletions

22
App.vue
View File

@@ -3,31 +3,9 @@
import update from "@/uni_modules/uni-upgrade-center-app/utils/check-update";
// #endif
import { useUserStore } from '@/stores/user'
export default {
onLaunch: function() {
const userStore = useUserStore()
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
update();

View File

@@ -7,8 +7,8 @@ export const ENV = process.env.NODE_ENV || 'development';
*/
const BASE_URL_MAP = {
development: {
// MAIN: 'http://192.168.110.100:9300/pb/', // 张川川
MAIN: 'https://global.nuttyreading.com/', // 线上
MAIN: 'http://192.168.110.100:9300/pb/', // 张川川
//MAIN: 'https://global.nuttyreading.com/', // 线上
// PAYMENT: 'https://dev-pay.example.com', // 暂时用不到
// CDN: 'https://cdn-dev.example.com', // 暂时用不到
},

View File

@@ -42,7 +42,7 @@ export const bookHomeApi = {
*/
getRecommendBooks() {
return skeletonClient.request<IRecommendBooksResponse>({
url: 'bookAbroad/home/getRecommendBooks',
url: uni.getStorageSync('token') ? 'bookAbroad/home/getRecommendBooks' : 'visitor/bookAbroad/getRecommendBooks',
method: 'POST',
data: {}
})
@@ -54,7 +54,7 @@ export const bookHomeApi = {
*/
getBookLabelList(type: number) {
return skeletonClient.request<ILabelListResponse>({
url: 'bookAbroad/home/getBookAbroadLableList',
url: uni.getStorageSync('token') ? 'bookAbroad/home/getBookAbroadLableList' : 'visitor/bookAbroad//getBookAbroadLableList',
method: 'POST',
data: { type }
})
@@ -66,7 +66,7 @@ export const bookHomeApi = {
*/
getSubLabelList(pid: number) {
return skeletonClient.request<ILabelListResponse>({
url: 'bookAbroad/home/getBookAbroadLableListByPid',
url: uni.getStorageSync('token') ? 'bookAbroad/home/getBookAbroadLableListByPid' : 'visitor/bookAbroad//getBookAbroadLableListByPid',
method: 'POST',
data: { pid }
})
@@ -78,7 +78,7 @@ export const bookHomeApi = {
*/
getBooksByLabel(lableId: number) {
return skeletonClient.request<IBookListResponse>({
url: 'bookAbroad/home/getAbroadBookListByLable',
url: uni.getStorageSync('token') ? 'bookAbroad/home/getAbroadBookListByLable' : 'visitor/bookAbroad/getAbroadBookListByLable',
method: 'POST',
data: { lableId }
})

View File

@@ -2,7 +2,6 @@
import { mainClient, skeletonClient } from '@/api/clients'
import type { IApiResponse } from '@/api/types'
import type { IAgreement } from '@/types/user'
import { useUserStore } from '@/stores/user'
export const commonApi = {
/**
@@ -37,9 +36,8 @@ export const commonApi = {
* @returns 消息列表
*/
getMessageList(isBook: number, isMedical: number, isSociology: number) {
const userStore = useUserStore()
return skeletonClient.request<IApiResponse>({
url: userStore.token ? 'common/message/listByPage' : '/visitor/listByPage',
url: uni.getStorageSync('token') ? 'common/message/listByPage' : '/visitor/listByPage',
method: 'POST',
data: { isBook, isMedical, isSociology }
})

View File

@@ -13,7 +13,6 @@ import type {
} from '@/types/course'
import type { ISearchRequest, ISearchResponse } from '@/types/search'
import type { ICommentListResponse, IAddCommentResponse, IComment } from '@/types/comment'
import { useUserStore } from '@/stores/user'
/**
* 课程相关API
@@ -55,9 +54,8 @@ export const courseApi = {
page: number,
limit: number
}) {
const userStore = useUserStore()
return skeletonClient.request<IMarketCourseListResponse>({
url: userStore.token ? 'medical/home/getMarketCourseList' : 'visitor/getMarketCourseList',
url: uni.getStorageSync('token') ? 'medical/home/getMarketCourseList' : 'visitor/getMarketCourseList',
method: 'POST',
data
})

View File

@@ -7,8 +7,6 @@ import type {
IMarketCourseListResponse,
ICourseMedicalLabelsResponse
} from '@/types/course'
import { useUserStore } from '@/stores/user'
import { skeletonClient } from '../clients'
const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN })
@@ -23,9 +21,8 @@ export const courseSubjectClassificationApi = {
* @returns 分类数据
*/
getCourseMedicalTree() {
const userStore = useUserStore()
return client.request<ICourseCategoryResponse>({
url: userStore.token ? 'medical/home/getCourseMedicalTree' : '/visitor/getCourseMedicalTree',
url: uni.getStorageSync('token') ? 'medical/home/getCourseMedicalTree' : '/visitor/getCourseMedicalTree',
method: 'POST',
data: {}
})

View File

@@ -370,7 +370,7 @@ export async function getUserContributionByTypeList(current : number, limit : nu
*/
export async function getIosPayment(transactionId : string, productId : string, orderId : string, receiptData : string, customerOid : string) {
const res = await mainClient.request<IApiResponse>({
url: 'Ipa/veri/',
url: 'Ipa/veri',
method: 'POST',
data: { transactionId, productId, orderId, receiptData, customerOid}
})

View File

@@ -2,8 +2,8 @@
"name" : "吴门国际",
"appid" : "__UNI__1250B39",
"description" : "吴门国际",
"versionName" : "1.0.9",
"versionCode" : 109,
"versionName" : "1.1.0",
"versionCode" : 110,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@@ -113,7 +113,7 @@
"platforms" : "Android",
"url" : "https://ext.dcloud.net.cn/plugin?id=12608",
"android_package_name" : "com.amazinglimited",
"ios_bundle_id" : "",
"ios_bundle_id" : "com.amazinglimited",
"isCloud" : true,
"bought" : 1,
"pid" : "12608",

View File

@@ -12,7 +12,7 @@
/>
<view class="icon-hua">
<image
src="../../static/home_icon.png"
src="../../static/logo.png"
mode="aspectFit"
class="icon-hua-img"
/>
@@ -35,16 +35,16 @@
<view class="mine-1">
<text class="mine-title">{{ $t('bookHome.block1') }}</text>
<view
v-if="data.page.records.length > 0"
v-if="data?.page?.records.length > 0"
class="mine-more"
@click="handleMoreClick"
>
{{ $t('bookHome.more') }}
<image src="@/static/icon/icon_right.png" />
</view>
<view v-if="data.page.records.length > 0" class="mine-1-list">
<view v-if="data?.page?.records.length > 0" class="mine-1-list">
<view
v-for="(item, index) in data.page.records"
v-for="(item, index) in data?.page?.records"
:key="index"
class="mine-item"
@click="handleMyBookClick(item.id)"
@@ -284,7 +284,7 @@ const vipInfo = computed(() => userStore.userInfo?.userEbookVip?.[0] || null)
/**
* 获取我的书单
*/
const getMyBooks = () => bookHomeApi.getMyBooks(1, 10)
const getMyBooks = () => uni.getStorageSync('token') ? bookHomeApi.getMyBooks(1, 10) : []
/**
* 获取推荐图书
@@ -364,6 +364,8 @@ const handleMyBookClick = (bookId: number) => {
* 处理图书点击
*/
const handleBookClick = (bookId: number) => {
getPrompt()
if(!uni.getStorageSync('token')) return
uni.navigateTo({
url: `/pages/book/detail?id=${bookId}`
})
@@ -382,6 +384,8 @@ const handleMoreClick = () => {
* 处理活动标签点击
*/
const handleActivityLabelClick = async (labelId: number, index: number) => {
getPrompt()
if(!uni.getStorageSync('token')) return
currentActivityIndex.value = index
activityBooksSkeleton.value.reload()
}
@@ -404,6 +408,25 @@ const handleCategoryLevel2Click = async (labelId: number, index: number) => {
categoryBooksSkeleton.value.reload()
}
/**
* 登录提示语
*/
const getPrompt = () => {
if(!uni.getStorageSync('token')) {
uni.showModal({
title: '提示',
content: '请先登录后访问该页面',
confirmText: '去登录',
success: (res) => {
console.log(res , 'res');
if (res.confirm) uni.navigateTo({
url: '/pages/login/login'
});
}
});
}
}
/**
* 页面显示
*/

View File

@@ -457,17 +457,11 @@ const requestAll = async () => {
* 页面挂载
*/
onMounted(() => {
if(!userStore.token) {
uni.navigateTo({
url: '/pages/login/login'
});
}
// 重置分类索引
currentIndex.value = 0
// 请求所有数据
requestAll()
console.log('进来了2');
})
/**
@@ -485,7 +479,7 @@ onShow(() => {
// 刷新数据
// requestAll()
if(userStore.token){
if(uni.getStorageSync('token')){
getLearnCourse()
}
})

View File

@@ -1,5 +1,5 @@
<template>
<view class="user-page" :style="{ paddingTop: getNotchHeight() + 30 + 'px' }" v-if="userStore.token && uni.getStorageSync('token')">
<view class="user-page" :style="{ paddingTop: getNotchHeight() + 30 + 'px' }" v-if="tokenState">
<!-- 设置图标 -->
<view class="settings-icon" :style="{ top: getNotchHeight() + 30 + 'px' }" @click="goSettings">
<wd-icon name="setting1" size="24px" color="#666" />
@@ -165,6 +165,7 @@
])
// 湖分
const hufenData = ref()
const tokenState = ref(false)
/**
* 获取平台信息
@@ -276,6 +277,7 @@
onShow(() => {
if (uni.getStorageSync('token')) {
tokenState.value = true
getData()
}

View File

@@ -3,7 +3,7 @@
<!-- 自定义导航栏 -->
<nav-bar :title="$t('order.recharge')"></nav-bar>
<!-- 活动充值金额 -->
<view class="block" v-if="eventAmountList.length > 0">
<view class="block" v-if="eventAmountList?.length > 0">
<!-- <view class="text">{{$t('order.rechargeAmount')}}</view> -->
<view class="text">活动充值金额</view>
<view class="recharge">
@@ -39,13 +39,11 @@
<view class="cha_fangsh">
<view class="cf_title">{{$t('user.paymentMethod')}}</view>
<view class="cf_radio">
<radio-group v-for="item in iosPaylist">
<radio-group>
<view>
<view :class="payType == item.id ? 'Tab_xf cf_xuanx' : 'cf_xuanx'">
<!-- <image class="pay_item_img" :src="item.imgUrl" mode="aspectFil">
</image> -->
<text>{{ item.title }}</text>
<radio :checked="payType === item.id" @click="choseType(item.id)"></radio>
<view class="cf_xuanx">
<text>{{ isAndroid ? $t('user.googlePay') : $t('user.applePay')}}</text>
<radio checked="true;" @click="choseType(item.id)"></radio>
</view>
</view>
</radio-group>
@@ -88,14 +86,6 @@
const userStore = useUserStore()
const { t } = useI18n()
const message = useMessage()
const payType = ref('1')
const iosPaylist = ref([
{
title: "Google Pay",
id: '1',
// imgUrl: "/static/icon/currency.png"
}
])
// 充值列表
const rechargeList = ref([])
// 金额列表单独每项
@@ -135,7 +125,7 @@
const eventAmountList = ref([])
//正常金额数据
const standardAmountList = ref([])
// 声明ios实例
const iapChannel = ref(null)
/**
@@ -148,7 +138,7 @@
console.log('运行Android上')
} else {
isAndroid.value = false;
qudao.value = 'Google'
qudao.value = 'IOS'
console.log('运行iOS上')
}
getData()
@@ -257,10 +247,10 @@
*/
const getProductInfo = () => {
const id = String(aloneItem.value.priceTypeId)
iapChannel.value.requestProduct([id], (res: any) => {
iapChannel.value.requestProduct([id], (res : any) => {
console.log(res, '查询苹果后台配置的商品id');
topay(id)
}, (err: any) => {
}, (err : any) => {
uni.showToast({ title: '未获取到产品信息,请联系管理员', icon: 'none' });
console.error('失败', err);
});
@@ -269,7 +259,7 @@
/**
* 准备支付-调出支付窗口
*/
const topay = (id: string) => {
const topay = (id : string) => {
return new Promise((resolve, reject) => {
uni.hideLoading()
uni.requestPayment({
@@ -307,9 +297,12 @@
const obj = await getIosPayment(res.transactionIdentifier, res.payment.productid, res.payment.username, res.transactionReceipt, userStore.userInfo.id)
console.log(obj, '校验订单')
finishTransaction(res)
uni.switchTab({
url: '/pages/user/index'
})
} catch (error) {
console.error('校验订单失败:', error)
// 也需要释放订单,防止再次提交支付窗口拉不起来
// 也需要释放订单,防止失败再次提交支付窗口拉不起来
finishTransaction(res)
}
@@ -322,9 +315,9 @@
return new Promise((resolve, reject) => {
iapChannel.value.restoreCompletedTransactions({
manualFinishTransaction: true,
}, (res: unknown) => {
}, (res : unknown) => {
console.log(res, '成功-restoreCompletedTransactions');
res.map((item: any) => {
res.map((item : any) => {
finishTransaction(item)
})
resolve(res);
@@ -493,13 +486,6 @@
}
}
/**
* 切换支付方式
*/
const choseType = () => {
// payType.value = val;
}
onMounted(() => {
getDevName();
getActivityDescriptionData()

View File

@@ -19,9 +19,9 @@
import { ref } from 'vue'
const menuItems = ref([
{
name: '分享APP'
},
// {
// name: '分享APP'
// },
{
name: '关于我们',
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 KiB