Commit 15ec4116 by wenyang

允许重复购买,优化相关课程,优化上传图片

parent 2c192a7d
......@@ -2,7 +2,7 @@
"name" : "CFFP财富中心",
"appid" : "__UNI__ED34740",
"description" : "",
"versionCode" : 104,
"versionCode" : 105,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
......@@ -54,7 +54,8 @@
"minSdkVersion" : 21,
"schemes" : "cffpapp,hbuilder",
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"autoSdkPermissions" : false
"autoSdkPermissions" : false,
"targetSdkVersion" : 31
},
// "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
/* ios打包配置 */
......@@ -212,7 +213,7 @@
}
},
"_spaceID" : "mp-68e17e23-e517-4839-8210-27480303cc51",
"versionName" : "1.0.1",
"versionName" : "1.0.2",
"mp-qq" : {
"setting" : {
"urlCheck" : false
......
......@@ -48,10 +48,10 @@
</view>
</view>
<view class="dataBox">
<strong v-if="courseInfo.status==1">{{courseInfo.coursePrice}}</strong>
<strong v-if="courseInfo.status==1 && courseInfo.coursePrice == 0">免费</strong>
<text v-if="courseInfo.status==2" style="color: #F15A1F;margin-right: 20rpx;"><i
class="iconfont icon-yifukuan"></i>已购</text>
<strong v-if="courseInfo.status==1 || courseInfo.status==2">{{courseInfo.coursePrice}}</strong>
<strong v-if="(courseInfo.status==1 || courseInfo.status==2 )&& courseInfo.coursePrice == 0">免费</strong>
<!-- <text v-if="courseInfo.status==2" style="color: #F15A1F;margin-right: 20rpx;"><i
class="iconfont icon-yifukuan"></i>已购</text> -->
<text v-if="courseInfo.coursePrice != 0">{{courseInfo.salesNumber}}人购买</text>
</view>
......@@ -62,7 +62,8 @@
<!-- tab区域 -->
<view class="tab">
<text :class="{'actived': tabType===1}" @click="switchTab(1)">详情</text>
<text :class="{'actived': tabType===2}" @click="switchTab(2)">相关课程</text>
<!-- <text :class="{'actived': tabType===2}" @click="switchTab(2)">相关课程</text> -->
<!-- <text :class="{'actived': tabType===4}" @click="switchTab(4)">服务流程</text> -->
<text :class="{'actived': tabType===3}" @click="switchTab(3)">讲师</text>
</view>
<!-- tabContent区域 -->
......@@ -71,6 +72,10 @@
<view class="courseIntroContent" v-if="tabType===1" style="margin-top: 20rpx;">
<view v-html="courseInfo.fileIntroduce" class="richTextContent"></view>
</view>
<!-- 服务流程 -->
<view class="courseIntroContent" v-if="tabType===4" style="margin-top: 20rpx;">
<image :src="courseInfo.serviceContent" mode="widthFix"></image>
</view>
<!-- 相关课程列表 -->
<view class="relationCourseListsContent" v-show="tabType===2">
<view class="totalCourseCount">
......@@ -115,7 +120,7 @@
<view v-html="lecturerInfo?.lecturerIntroduce" class="lecturerText richTextContent"></view>
</view>
<!-- 购买按钮 -->
<view class="buyBox" @click="saveOrder()" v-if="courseInfo.status == 1 && courseInfo.coursePrice != 0">
<view class="buyBox" @click="saveOrder()" v-if="(courseInfo.status == 1 || courseInfo.status == 2) && courseInfo.coursePrice != 0">
<text>购买</text>
</view>
......@@ -411,11 +416,13 @@
switchTab(type) {
this.tabType = type;
if (type === 3) {
this.lecturerQuery();
//this.lecturerQuery();
} else if (type == 2) {
this.relatedCoursesList()
//this.relatedCoursesList()
} else if (type === 1) {
//this.courseDetail();
} else {
this.courseDetail()
//this.courseDetail();
}
},
// 讲师信息查询
......@@ -443,6 +450,7 @@
}).then(res => {
if (res['success']) {
this.courseInfo = res['data']['data'];
//this.courseInfo.serviceContent = res['data']['data']['filePathOss'];
this.lecturerId = res['data']['data']['fileLecturerId'];
this.lecturerQuery();
this.relatedCoursesList();
......@@ -769,7 +777,9 @@
// this.switchTab(1);
},
onShow() {
this.switchTab(1);
//this.switchTab(1);
this.tabType = 1;
this.courseDetail();
this.loginType = uni.getStorageSync('loginType')
uni.setStorageSync('entryUrl',window.location.href.split('#')[0])
},
......@@ -917,11 +927,10 @@
.tab {
display: flex;
justify-content: space-between;
padding: 40rpx 30rpx 0;
padding: 40rpx 150rpx 0;
background-color: #fff;
color: #666;
font-size: 32rpx;
font-size: 32rpx;
text.actived {
border-bottom: 2px solid #20269B;
color: #333;
......
const checkIsIos = async () => {
return new Promise((resolve => {
uni.getSystemInfo({
success: function (res) {
resolve(res.platform === "ios")
}
});
}))
}
export default class authorizeUtils {
/**
* 授权前告知用户使用意图
* @param content
* @returns
*/
static showAuthTipModal = async (authorize: string) => {
// #ifdef H5
if (1 === 1) {
return true
}
// #endif
// ios端在manifest.json配置权限使用说明,以下权限判断仅在安卓端可用
let isIos = await checkIsIos()
if (isIos) return true
let compat: any = plus.android.importClass('androidx.core.content.ContextCompat')
let context = plus.android.runtimeMainActivity()
let result = compat.checkSelfPermission(context, authorize)
console.log("result===", result);
if (result === 0) return true
// 如果已经授权直接返回
const contentData = {
["android.permission.READ_EXTERNAL_STORAGE"]: {
title: "相册权限说明",
describe: "便于您使用该功能上传您的照片/图片/视频信息,请您确认授权,否则无法使用该功能"
},
["android.permission.CAMERA"]: {
title: "拍摄权限说明",
describe: "便于您使用该功能拍摄照片信息,请您确认授权,否则无法使用该功能"
},
["android.permission.CALL_PHONE"]: {
title: "拨打电话权限说明",
describe: "便于您使用该功能拨打客服电话,请您确认授权,否则无法使用该功能"
},
['android.permission.ACCESS_FINE_LOCATION']: {
title: "定位权限说明",
describe: "便于您使用该功能在地图检索附近的地图,请您确认授权,否则无法使用该功能"
},
}
return new Promise((resolve) => {
uni.showModal({
title: contentData[authorize].title,
content: contentData[authorize].describe,
success: (res) => {
resolve(!!res.confirm)
},
fail: () => {
}
})
})
}
/**
* 用户拒绝授权提示手动授权
*/
static showManualAuth = async (authorize: string) => {
let isIos = await checkIsIos()
if (isIos) return true
const contentData = {
["android.permission.READ_EXTERNAL_STORAGE"]: "获取相册权限失败,请手动打开授权",
["android.permission.CAMERA"]: "获取拍摄权限失败,请手动打开授权",
["android.permission.CALL_PHONE"]: "获取拨打电话权限失败,请手动打开授权",
['android.permission.ACCESS_FINE_LOCATION']: "获取定位权限失败,请手动打开授权或检查系统定位开关",
}
uni.showModal({
title: '提示',
content: contentData[authorize],
confirmText: "去设置",
success: (res) => {
if (res.confirm) {
uni.openAppAuthorizeSetting({
success(res) {
console.log(res);
}
});
}
if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
}
\ No newline at end of file
import request from "./request";
import authorizeUtils from "./authorizeUtils";
import { baseURL, apiURL, cffpURL } from "../environments/environment";
// 上传图片事件
export function CommonUpload(psrams) {
let requestVO = psrams
// @ts-ignore
return new Promise((resolve, reject) => {
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album','camera'], //从相册选择
success: function(res) {
// res.tempFiles 数组
// for (var i = 0; i < res.tempFiles.length; i++) {
uni.showLoading({
title: '加载中',
mask: true
});
uni.uploadFile({
// /api/file/upload //pc上传代理
// https://mdev.zuihuibi.cn/api/file/upload
url: `${apiURL}/file/upload`, // 后端api接口
filePath: res.tempFilePaths[0], // uni.chooseImage函数调用后获取的本地文件路劲
name: 'file', //后端通过'file'获取上传的文件对象
// formData: this.sendDate,
// header:{"third-session": uni.getStorageSync('thirdSession')},
formData: { //后台所需除图片外的参数可以写在这里面 ,单张多张都可
requestVO: JSON.stringify(requestVO)
},
header: {
// "third-session": uni.getStorageSync('thirdSession')
// 'content-type': 'application/json',
'X-Authorization': uni.getStorageSync('uni-token') ? uni.getStorageSync('uni-token') : ''
},
success: (res) => {
let data = JSON.parse(res.data)
// // 抛出
resolve(data)
uni.hideLoading();
},
fail:(err) =>{
uni.showModal({
content:'上传失败',
showCancel: false
})
uni.hideLoading();
// console.log(data, '发生错误,查看错误日志')
}
});
// }
}
});
// 1. 弹窗说明权限用途
//let authFlag = authorizeUtils.showAuthTipModal("android.permission.READ_EXTERNAL_STORAGE");
//let authFlag2 = authorizeUtils.showAuthTipModal("android.permission.CAMERA");
uni.showModal({
title: '权限说明',
content: '我们需要访问您的相机和相册,以便您拍摄或上传图片。',
confirmText: '同意',
cancelText: '拒绝',
success: function (res) {
if (res.confirm) {
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album','camera'], //从相册选择
success: function(res) {
// res.tempFiles 数组
// for (var i = 0; i < res.tempFiles.length; i++) {
uni.showLoading({
title: '加载中',
mask: true
});
uni.uploadFile({
// /api/file/upload //pc上传代理
// https://mdev.zuihuibi.cn/api/file/upload
url: `${apiURL}/file/upload`, // 后端api接口
filePath: res.tempFilePaths[0], // uni.chooseImage函数调用后获取的本地文件路劲
name: 'file', //后端通过'file'获取上传的文件对象
// formData: this.sendDate,
// header:{"third-session": uni.getStorageSync('thirdSession')},
formData: { //后台所需除图片外的参数可以写在这里面 ,单张多张都可
requestVO: JSON.stringify(requestVO)
},
header: {
// "third-session": uni.getStorageSync('thirdSession')
// 'content-type': 'application/json',
'X-Authorization': uni.getStorageSync('uni-token') ? uni.getStorageSync('uni-token') : ''
},
success: (res) => {
let data = JSON.parse(res.data)
// // 抛出
resolve(data)
uni.hideLoading();
},
fail:(err) =>{
uni.showModal({
content:'上传失败',
showCancel: false
})
uni.hideLoading();
// console.log(data, '发生错误,查看错误日志')
}
});
// }
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment