Compare commits
4 Commits
04e2196942
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c2811646a | |||
| 9e00409e5e | |||
| 1457a24cea | |||
| 34d6cfdf9e |
22
App.vue
22
App.vue
@@ -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();
|
||||
|
||||
@@ -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', // 暂时用不到
|
||||
},
|
||||
|
||||
@@ -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 }
|
||||
})
|
||||
|
||||
@@ -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 }
|
||||
})
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
@@ -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: {}
|
||||
})
|
||||
|
||||
@@ -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}
|
||||
})
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面显示
|
||||
*/
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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)
|
||||
|
||||
/**
|
||||
* 获取平台信息
|
||||
@@ -273,9 +274,10 @@
|
||||
url: '/pages/user/points/index'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
onShow(() => {
|
||||
if (uni.getStorageSync('token')) {
|
||||
tokenState.value = true
|
||||
getData()
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
@@ -251,16 +241,16 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询后台配置的商品信息
|
||||
*/
|
||||
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({
|
||||
@@ -297,7 +287,7 @@
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 调用后台支付-ios
|
||||
*/
|
||||
@@ -307,14 +297,17 @@
|
||||
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);
|
||||
@@ -334,7 +327,7 @@
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关闭订单
|
||||
*/
|
||||
@@ -493,13 +486,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换支付方式
|
||||
*/
|
||||
const choseType = () => {
|
||||
// payType.value = val;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDevName();
|
||||
getActivityDescriptionData()
|
||||
|
||||
@@ -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 |
Reference in New Issue
Block a user