Commit 15ec4116 by wenyang

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

parent 2c192a7d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name" : "CFFP财富中心", "name" : "CFFP财富中心",
"appid" : "__UNI__ED34740", "appid" : "__UNI__ED34740",
"description" : "", "description" : "",
"versionCode" : 104, "versionCode" : 105,
"transformPx" : false, "transformPx" : false,
/* 5+App特有相关 */ /* 5+App特有相关 */
"app-plus" : { "app-plus" : {
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
"minSdkVersion" : 21, "minSdkVersion" : 21,
"schemes" : "cffpapp,hbuilder", "schemes" : "cffpapp,hbuilder",
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ], "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"autoSdkPermissions" : false "autoSdkPermissions" : false,
"targetSdkVersion" : 31
}, },
// "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ] // "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
/* ios打包配置 */ /* ios打包配置 */
...@@ -212,7 +213,7 @@ ...@@ -212,7 +213,7 @@
} }
}, },
"_spaceID" : "mp-68e17e23-e517-4839-8210-27480303cc51", "_spaceID" : "mp-68e17e23-e517-4839-8210-27480303cc51",
"versionName" : "1.0.1", "versionName" : "1.0.2",
"mp-qq" : { "mp-qq" : {
"setting" : { "setting" : {
"urlCheck" : false "urlCheck" : false
......
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
</view> </view>
</view> </view>
<view class="dataBox"> <view class="dataBox">
<strong v-if="courseInfo.status==1">{{courseInfo.coursePrice}}</strong> <strong v-if="courseInfo.status==1 || courseInfo.status==2">{{courseInfo.coursePrice}}</strong>
<strong v-if="courseInfo.status==1 && courseInfo.coursePrice == 0">免费</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 <!-- <text v-if="courseInfo.status==2" style="color: #F15A1F;margin-right: 20rpx;"><i
class="iconfont icon-yifukuan"></i>已购</text> class="iconfont icon-yifukuan"></i>已购</text> -->
<text v-if="courseInfo.coursePrice != 0">{{courseInfo.salesNumber}}人购买</text> <text v-if="courseInfo.coursePrice != 0">{{courseInfo.salesNumber}}人购买</text>
</view> </view>
...@@ -62,7 +62,8 @@ ...@@ -62,7 +62,8 @@
<!-- tab区域 --> <!-- tab区域 -->
<view class="tab"> <view class="tab">
<text :class="{'actived': tabType===1}" @click="switchTab(1)">详情</text> <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> <text :class="{'actived': tabType===3}" @click="switchTab(3)">讲师</text>
</view> </view>
<!-- tabContent区域 --> <!-- tabContent区域 -->
...@@ -71,6 +72,10 @@ ...@@ -71,6 +72,10 @@
<view class="courseIntroContent" v-if="tabType===1" style="margin-top: 20rpx;"> <view class="courseIntroContent" v-if="tabType===1" style="margin-top: 20rpx;">
<view v-html="courseInfo.fileIntroduce" class="richTextContent"></view> <view v-html="courseInfo.fileIntroduce" class="richTextContent"></view>
</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="relationCourseListsContent" v-show="tabType===2">
<view class="totalCourseCount"> <view class="totalCourseCount">
...@@ -115,7 +120,7 @@ ...@@ -115,7 +120,7 @@
<view v-html="lecturerInfo?.lecturerIntroduce" class="lecturerText richTextContent"></view> <view v-html="lecturerInfo?.lecturerIntroduce" class="lecturerText richTextContent"></view>
</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> <text>购买</text>
</view> </view>
...@@ -411,11 +416,13 @@ ...@@ -411,11 +416,13 @@
switchTab(type) { switchTab(type) {
this.tabType = type; this.tabType = type;
if (type === 3) { if (type === 3) {
this.lecturerQuery(); //this.lecturerQuery();
} else if (type == 2) { } else if (type == 2) {
this.relatedCoursesList() //this.relatedCoursesList()
} else if (type === 1) {
//this.courseDetail();
} else { } else {
this.courseDetail() //this.courseDetail();
} }
}, },
// 讲师信息查询 // 讲师信息查询
...@@ -443,6 +450,7 @@ ...@@ -443,6 +450,7 @@
}).then(res => { }).then(res => {
if (res['success']) { if (res['success']) {
this.courseInfo = res['data']['data']; this.courseInfo = res['data']['data'];
//this.courseInfo.serviceContent = res['data']['data']['filePathOss'];
this.lecturerId = res['data']['data']['fileLecturerId']; this.lecturerId = res['data']['data']['fileLecturerId'];
this.lecturerQuery(); this.lecturerQuery();
this.relatedCoursesList(); this.relatedCoursesList();
...@@ -769,7 +777,9 @@ ...@@ -769,7 +777,9 @@
// this.switchTab(1); // this.switchTab(1);
}, },
onShow() { onShow() {
this.switchTab(1); //this.switchTab(1);
this.tabType = 1;
this.courseDetail();
this.loginType = uni.getStorageSync('loginType') this.loginType = uni.getStorageSync('loginType')
uni.setStorageSync('entryUrl',window.location.href.split('#')[0]) uni.setStorageSync('entryUrl',window.location.href.split('#')[0])
}, },
...@@ -917,11 +927,10 @@ ...@@ -917,11 +927,10 @@
.tab { .tab {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 40rpx 30rpx 0; padding: 40rpx 150rpx 0;
background-color: #fff; background-color: #fff;
color: #666; color: #666;
font-size: 32rpx; font-size: 32rpx;
text.actived { text.actived {
border-bottom: 2px solid #20269B; border-bottom: 2px solid #20269B;
color: #333; 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 request from "./request";
import authorizeUtils from "./authorizeUtils";
import { baseURL, apiURL, cffpURL } from "../environments/environment"; import { baseURL, apiURL, cffpURL } from "../environments/environment";
// 上传图片事件 // 上传图片事件
export function CommonUpload(psrams) { export function CommonUpload(psrams) {
let requestVO = psrams let requestVO = psrams
// @ts-ignore // @ts-ignore
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.chooseImage({ // 1. 弹窗说明权限用途
count: 1, //默认9 //let authFlag = authorizeUtils.showAuthTipModal("android.permission.READ_EXTERNAL_STORAGE");
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 //let authFlag2 = authorizeUtils.showAuthTipModal("android.permission.CAMERA");
sourceType: ['album','camera'], //从相册选择 uni.showModal({
success: function(res) { title: '权限说明',
// res.tempFiles 数组 content: '我们需要访问您的相机和相册,以便您拍摄或上传图片。',
// for (var i = 0; i < res.tempFiles.length; i++) { confirmText: '同意',
uni.showLoading({ cancelText: '拒绝',
title: '加载中', success: function (res) {
mask: true if (res.confirm) {
});
uni.uploadFile({ uni.chooseImage({
// /api/file/upload //pc上传代理 count: 1, //默认9
// https://mdev.zuihuibi.cn/api/file/upload sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
url: `${apiURL}/file/upload`, // 后端api接口 sourceType: ['album','camera'], //从相册选择
filePath: res.tempFilePaths[0], // uni.chooseImage函数调用后获取的本地文件路劲 success: function(res) {
name: 'file', //后端通过'file'获取上传的文件对象 // res.tempFiles 数组
// formData: this.sendDate, // for (var i = 0; i < res.tempFiles.length; i++) {
// header:{"third-session": uni.getStorageSync('thirdSession')}, uni.showLoading({
formData: { //后台所需除图片外的参数可以写在这里面 ,单张多张都可 title: '加载中',
requestVO: JSON.stringify(requestVO) mask: true
}, });
header: { uni.uploadFile({
// "third-session": uni.getStorageSync('thirdSession') // /api/file/upload //pc上传代理
// 'content-type': 'application/json', // https://mdev.zuihuibi.cn/api/file/upload
'X-Authorization': uni.getStorageSync('uni-token') ? uni.getStorageSync('uni-token') : '' url: `${apiURL}/file/upload`, // 后端api接口
}, filePath: res.tempFilePaths[0], // uni.chooseImage函数调用后获取的本地文件路劲
success: (res) => { name: 'file', //后端通过'file'获取上传的文件对象
let data = JSON.parse(res.data) // formData: this.sendDate,
// // 抛出 // header:{"third-session": uni.getStorageSync('thirdSession')},
resolve(data) formData: { //后台所需除图片外的参数可以写在这里面 ,单张多张都可
uni.hideLoading(); requestVO: JSON.stringify(requestVO)
}, },
fail:(err) =>{ header: {
uni.showModal({ // "third-session": uni.getStorageSync('thirdSession')
content:'上传失败', // 'content-type': 'application/json',
showCancel: false 'X-Authorization': uni.getStorageSync('uni-token') ? uni.getStorageSync('uni-token') : ''
}) },
uni.hideLoading(); success: (res) => {
// console.log(data, '发生错误,查看错误日志') 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