Commit 92f06acf by yuzhenWang

Merge branch 'dev' into 'master'

Dev

See merge request !116
parents b20e6093 02168190
......@@ -3,6 +3,36 @@
<head>
<meta charset="UTF-8" />
<script>
// ============ 新增:解析 URL 参数并设置状态栏占位 ============
//解决项目以h5的方式内嵌到app的webview中,手机状态栏和页面顶部内容重叠的问题
(function() {
function getQueryParam(name) {
// 从 hash 中提取查询参数
const hash = window.location.hash;
const queryIndex = hash.indexOf('?');
console.log('queryIndex', queryIndex);
if (queryIndex === -1) return null;
const queryString = hash.substring(queryIndex + 1);
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = queryString.match(reg);
console.log('匹配结果', r);
if (r != null) return decodeURIComponent(r[2]);
return null;
}
const statusBarHeight = getQueryParam('statusBarHeight');
console.log('状态栏高度', statusBarHeight);
if (statusBarHeight) {
const height = parseInt(statusBarHeight, 10);
if (!isNaN(height) && height > 0) {
document.write('<style>' +
'html, body { margin:0; padding:0; height:100%; overflow:hidden; }' +
'body { padding-top: ' + height + 'px; box-sizing: border-box; }' +
'#app { height: 100%; overflow-y: auto; }' +
'</style>');
}
}
})();
// ============ 新增结束 ============
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
......
......@@ -29,7 +29,8 @@
<!-- 家办商城跳cffp的分享功能 -->
<!-- #ifdef H5 -->
<!-- v-if="!generatedImage" -->
<view class="generateImageBox" ref="captureElement" v-if="!generatedImage">
<!-- 生成海报逻辑暂不需要 -->
<!-- <view class="generateImageBox" ref="captureElement" v-if="!generatedImage">
<view class="imgBox">
<img class="posterImg" @load="handleBgImageLoad" @error="handleBgImageError" style="display: block;"
:src="sharePosterItem.fileFirstImage+'?t='+Math.random()" crossorigin="anonymous" alt="防缓存图片" />
......@@ -53,7 +54,7 @@
识别二维码查看商品
</view>
</view>
<!-- 二维码容器 -->
<view class="qrcode-container">
<canvas canvas-id="qrcode" class="qrcode-canvas"
:style="{width: qrCodeSize + 'px', height: qrCodeSize + 'px'}"></canvas>
......@@ -61,7 +62,7 @@
</view>
</view>
</view>
</view> -->
<!-- #endif -->
<view class="productBox">
<view class="productList" :style="{marginTop}">
......
<template>
<view class="container">
<!-- 禁用弹窗 -->
<restrictedTip ref="restrictedTip"/>
<restrictedTip ref="restrictedTip" />
<view style="flex: 1;">
<!-- #ifdef APP -->
<view class="backArrow">
<text class="iconfont icon-youjiantou zuojiantou" style="left: 5rpx;" @click="goBack()"></text>
</view>
<!-- #endif -->
<!-- 课程详情 -->
<template v-if="courseInfoItem">
<view class="courseItemBox" >
<course-item :thumbnailPath="courseInfoItem.displayImage" :title="courseInfoItem.fileTitle"
:summaryBox="courseInfoItem.fileSynopsis"
:dataList="{coursePrice:courseInfoItem.coursePrice,salesNumber:courseInfoItem.salesNumber}"
:fileLecturerId="courseInfoItem.fileLecturerId" :fileId="fileId"></course-item>
</view>
</template>
<!-- 价格明细 -->
<view class="priceInfoContent">
<h4>价格明细</h4>
<view ><text class="txtFont">现价</text><text>¥{{Number(courseInfoItem.coursePrice).toFixed(2)}}</text></view>
<template v-if="courseInfoItem">
<view class="courseItemBox">
<course-item :thumbnailPath="courseInfoItem.displayImage" :title="courseInfoItem.fileTitle"
:summaryBox="courseInfoItem.fileSynopsis"
:dataList="{coursePrice:courseInfoItem.coursePrice,salesNumber:courseInfoItem.salesNumber}"
:fileLecturerId="courseInfoItem.fileLecturerId" :fileId="fileId"></course-item>
</view>
</template>
<!-- 价格明细 -->
<view class="priceInfoContent">
<h4>价格明细</h4>
<view><text class="txtFont">现价</text><text>¥{{Number(courseInfoItem.coursePrice).toFixed(2)}}</text>
</view>
<view>
<text class="txtFont" @click="toggle(1,'bottom')">积分抵扣<i
class="iconfont icon-31tishi txtFont"></i></text>
<text class="integralBox" @click="toggle(2,'bottom')"
v-if="intergralInfo.preFortune">{{isDeduction != 'true' ? '未选' : '已选'}}积分,可抵扣{{deductionCore}}<i
class="iconfont icon-youjiantou iconStyle"></i></text>
<text style="color: #666666;font-size: 30rpx;" v-else>暂无积分</text>
</view>
<view><text class="txtFont">合计</text>
<text v-if="isRedirect == 1">{{calculatedPrice}}</text>
<text v-else>¥{{Number(totalPrice).toFixed(2)}}</text>
</view>
</view>
<!-- 支付方式 -->
<view class="paymentMethodContent">
<h4>选择支付方式</h4>
<view @click="selectPaymentMethod(2)">
<view class="paymentItem" v-if="runEnv!=='wechat-miniprogram'">
<view>
<text class="txtFont" @click="toggle(1,'bottom')">积分抵扣<i class="iconfont icon-31tishi txtFont"></i></text>
<text class="integralBox" @click="toggle(2,'bottom')"
v-if="intergralInfo.preFortune">{{isDeduction != 'true' ? '未选' : '已选'}}积分,可抵扣{{deductionCore}}<i
class="iconfont icon-youjiantou iconStyle"></i></text>
<text style="color: #666666;font-size: 30rpx;" v-else>暂无积分</text>
<i class="iconfont icon-zhifubao"></i>
<text class="txtFont">支付宝支付</text>
</view>
<view><text class="txtFont">合计</text>
<text v-if="isRedirect == 1">{{calculatedPrice}}</text>
<text v-else>¥{{Number(totalPrice).toFixed(2)}}</text>
<view class="selectRadio" :class="{'actived':paymentMethod===2}">
<i class="iconfont icon-duihao txtFont"></i>
</view>
</view>
<!-- 支付方式 -->
<view class="paymentMethodContent">
<h4>选择支付方式</h4>
<view @click="selectPaymentMethod(2)" >
<view class="paymentItem" v-if="runEnv!=='wechat-miniprogram'">
<view>
<i class="iconfont icon-zhifubao"></i>
<text class="txtFont">支付宝支付</text>
</view>
<view class="selectRadio" :class="{'actived':paymentMethod===2}">
<i class="iconfont icon-duihao txtFont"></i>
</view>
</view>
</view>
<view class="paymentItem" @click="selectPaymentMethod(1)" v-if="deviceType==3">
<view>
<i class="iconfont icon-py_weixinzhifu txtFont"></i>
<text>微信支付</text>
</view>
<view class="selectRadio" :class="{'actived':paymentMethod===1}">
<i class="iconfont icon-duihao txtFont"></i>
</view>
</view>
<!-- #ifdef APP-PLUS -->
<!-- <view class="paymentItem" @click="selectPaymentMethod(1)">
</view>
<view class="paymentItem" @click="selectPaymentMethod(1)" v-if="deviceType==3">
<view>
<i class="iconfont icon-py_weixinzhifu txtFont"></i>
<text>微信支付</text>
</view>
<view class="selectRadio" :class="{'actived':paymentMethod===1}">
<i class="iconfont icon-duihao txtFont"></i>
</view>
</view>
<!-- #ifdef APP-PLUS -->
<!-- <view class="paymentItem" @click="selectPaymentMethod(1)">
<view>
<i class="iconfont icon-py_weixinzhifu"></i>
<text>微信支付</text>
......@@ -69,10 +71,10 @@
<i class="iconfont icon-duihao"></i>
</view>
</view> -->
<!-- #endif -->
</view>
<!-- #endif -->
</view>
</view>
<!-- 底部 -->
<view class="totalContent">
<view class="priceInfoBox">
......@@ -110,7 +112,8 @@
</view>
<view v-if="popupType===1"><text>1积分=1元,积分抵扣如同现金,所有产品均可使用</text></view>
<view v-if="popupType===2">
<view class="deductionInfoItem" :class="{'actived':isDeduction == 'true'}" @click="selectDeduction(true)">
<view class="deductionInfoItem" :class="{'actived':isDeduction == 'true'}"
@click="selectDeduction(true)">
<view style="display: flex;">
<text>可抵扣</text>
<view class="integralInfoBox">
......@@ -122,7 +125,8 @@
<i class="iconfont icon-duihao " style="font-size: 28rpx;"></i>
</view>
</view>
<view class="deductionInfoItem" :class="{'actived':isDeduction == 'false'}" @click="selectDeduction(false)">
<view class="deductionInfoItem" :class="{'actived':isDeduction == 'false'}"
@click="selectDeduction(false)">
<view>
<text>不使用积分抵扣</text>
</view>
......@@ -170,7 +174,7 @@
<view class="tips">
<!-- <view class="text-center">请点击右上角菜单</view> -->
<view style="line-height: 60rpx;">戳这里,点击<text class="iconfont icon-liulanqi"></text>
按钮,使用系统浏览器打开页面完成支付,完成后请返回微信,到【我的->成交订单】下,查看购买订单。</view>
按钮,使用系统浏览器打开页面完成支付,完成后请返回微信,到【我的->成交订单】下,查看购买订单。</view>
</view>
</view>
</view>
......@@ -180,8 +184,8 @@
<script>
import api from "@/api/api";
import courseItem from "@/components/courseItem/courseItem.vue";
import {apiURL,companyInfo,shareURL} from "@/environments/environment";
import {nextTick} from "vue";
import { apiURL, companyInfo, shareURL } from "@/environments/environment";
import { nextTick } from "vue";
import common from '../../common/common';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import dataHandling from "@/util/dataHandling";
......@@ -215,10 +219,10 @@
isRedirect: null,
amount: 0,
calculatedPrice: 0,
dataToken:'',
oldToken:'',//原始用户token
pollTimer:'',
runEnv:dataHandling.h5RuntimeEnv()
dataToken: '',
oldToken: '', //原始用户token
pollTimer: '',
runEnv: dataHandling.h5RuntimeEnv()
}
},
computed: {
......@@ -239,38 +243,38 @@
}
}
},
methods: {
queryInfo() {
api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{
// 保存用户得个人信息
if (res['success']) {
delete res.data.commonResult
const cffp_userInfo = {
...res.data
}
// 账号禁用用户
if(res.data.userIsActive&&res.data.userIsActive==2){
this.$refs.restrictedTip.open()
uni.setStorageSync('userIsActive',String(res.data.userIsActive))
return
}
if(res.data.userIsActive&&res.data.userIsActive!=2){
this.$refs.restrictedTip.close()
uni.removeStorageSync('userIsActive')
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo));
uni.setStorageSync('user_mobile', res.data.mobile)
}
})
},
queryInfo() {
api.queryInfo({ userId: uni.getStorageSync('cffp_userId') }).then(res => {
// 保存用户得个人信息
if (res['success']) {
delete res.data.commonResult
const cffp_userInfo = {
...res.data
}
// 账号禁用用户
if (res.data.userIsActive && res.data.userIsActive == 2) {
this.$refs.restrictedTip.open()
uni.setStorageSync('userIsActive', String(res.data.userIsActive))
return
}
if (res.data.userIsActive && res.data.userIsActive != 2) {
this.$refs.restrictedTip.close()
uni.removeStorageSync('userIsActive')
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo));
uni.setStorageSync('user_mobile', res.data.mobile)
}
})
},
goBack() {
uni.navigateBack({
delta: 1
delta: 1
});
},
// 支付
......@@ -290,7 +294,7 @@
fileId: this.fileId,
companyType: companyInfo.companyType,
}
if (this.paymentMethod == 1) {
// APP:微信app支付
// #ifdef APP-PLUS
......@@ -298,16 +302,17 @@
api.unifiedPay(param).then(res => {
this.paymentBtnDisabled = false;
if (res['success']) {
const prepayId = res['data']['prepayId'];//统一下单订单号 如果为空,代表0元订单支付成功
if(prepayId){
const prepayId = res['data']['prepayId']; //统一下单订单号 如果为空,代表0元订单支付成功
if (prepayId) {
const orderInfoParam = {
"appid": res['data']['appid'], // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
"noncestr": res['data']['noncestr'], // 随机字符串
"package": res['data']['packAge'], // 固定值
"appid": res['data'][
'appid'], // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
"noncestr": res['data']['noncestr'], // 随机字符串
"package": res['data']['packAge'], // 固定值
"partnerid": res['data']['partnerid'], // 微信支付商户号
"prepayid": prepayId, // 统一下单订单号
"prepayid": prepayId, // 统一下单订单号
"timestamp": res['data']['timeStamp'], // 时间戳(单位:秒)
"sign": res['data']['sign'] // 签名,这里用的 MD5/RSA 签名
"sign": res['data']['sign'] // 签名,这里用的 MD5/RSA 签名
}
let _this = this
uni.requestPayment({
......@@ -324,7 +329,7 @@
})
}
});
}else {
} else {
uni.navigateTo({
url: `/pages/orderStatus/orderStatus?orderId=${this.orderId}&fileId=${this.fileId}&orderStatus=2&userId=${this.userId}&isRedirect=1`
})
......@@ -348,13 +353,13 @@
//deviceType:PC为1,移动端为2,微信为3
if (this.deviceType == 3) {
// 向小程序通信
if(dataHandling.h5RuntimeEnv()=='wechat-miniprogram'){
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
this.paymentBtnDisabled = false;
// 跳转到小程序消息接收中转页面,拉起小程序的支付
wx.miniProgram.navigateTo({
url: `/myPackageA/h5Pay/appYdhomeofficePay?param=${encodeURIComponent(JSON.stringify(param))}`
url: `/myPackageA/h5Pay/appYdhomeofficePay?param=${encodeURIComponent(JSON.stringify(param))}`
})
return
}
let _this = this
......@@ -366,7 +371,7 @@
// })
api.wxAuthorize(param).then((res) => {
_this.paymentBtnDisabled = false;
if (res['success']) {
if (param.amount == '0.00') {
uni.navigateTo({
......@@ -376,7 +381,7 @@
} else {
window.location.href = res['data']['paymentForm']['action'];
}
}else{
} else {
uni.showToast({
title: res['message'],
duration: 2000,
......@@ -402,7 +407,7 @@
provider: 'alipay',
orderInfo: aliOrderString,
success: function(resp) {
uni.navigateTo({
url: `/pages/orderStatus/orderStatus?orderId=${_this.orderId}&fileId=${_this.fileId}&orderStatus=2&userId=${_this.userId}&isRedirect=1`
})
......@@ -458,8 +463,8 @@
}
},
getunifiedPay(param){
getunifiedPay(param) {
api.unifiedPay(param).then((res) => {
const data = res['data'];
this.paymentBtnDisabled = false;
......@@ -507,7 +512,7 @@
}).then(res => {
if (res['success']) {
this.courseInfoItem = res['data']['data'];
console.log('this.courseInfoItem',this.courseInfoItem);
console.log('this.courseInfoItem', this.courseInfoItem);
}
})
},
......@@ -538,10 +543,10 @@
// 关闭弹出层
closePopup(val) {
if (val === 1) {
this.$refs.popup.close()
if(this.isDeduction == 'true'){
this.toggle(3,'center')
if (this.isDeduction == 'true') {
this.toggle(3, 'center')
}
} else {
this.$refs.popup1.close()
......@@ -572,122 +577,136 @@
}, 500)
}
},
reLogin(option,flag){
uni.showLoading({
title: '加载中...'
});
const params = {
loginType:'5',
authToken: uni.getStorageSync('dataToken'),
visitorUuid:uni.getStorageSync('visitorUuid')?uni.getStorageSync('visitorUuid'):dataHandling.uuid()
}
api.loginVerification(params).then((res)=>{
if(res['success']){
// 之前没使用过系统没有userid,登录并写入缓存
if(flag=='1'){
uni.setStorageSync('isLogin','1');
uni.setStorageSync('loginType','codelogin');
uni.setStorageSync('cffp_userId', res.data.userId);
uni.setStorageSync('uni-token', res.data['token']);
uni.setStorageSync('visitorUuid', res.data['visitorUuid']);
}else if(flag=='2'){
// 有userid,直接可以购买但付款人只是帮订单账号付钱,购买成功还是进入到付款人的账号
this.oldToken = uni.getStorageSync('uni-token')
uni.setStorageSync('oldToken', this.oldToken);
uni.setStorageSync('uni-token', res.data['token']);
}
this.userId = res.data.userId
this.dataToken = ''
}else{
uni.showToast({
title: res['message'],
duration: 2000,
icon: 'none'
})
reLogin(option, flag) {
uni.showLoading({
title: '加载中...'
});
const params = {
loginType: '5',
authToken: uni.getStorageSync('dataToken'),
visitorUuid: uni.getStorageSync('visitorUuid') ? uni.getStorageSync('visitorUuid') : dataHandling
.uuid()
}
api.loginVerification(params).then((res) => {
if (res['success']) {
// 之前没使用过系统没有userid,登录并写入缓存
if (flag == '1') {
uni.setStorageSync('isLogin', '1');
uni.setStorageSync('loginType', 'codelogin');
uni.setStorageSync('cffp_userId', res.data.userId);
uni.setStorageSync('uni-token', res.data['token']);
uni.setStorageSync('visitorUuid', res.data['visitorUuid']);
} else if (flag == '2') {
// 有userid,直接可以购买但付款人只是帮订单账号付钱,购买成功还是进入到付款人的账号
this.oldToken = uni.getStorageSync('uni-token')
uni.setStorageSync('oldToken', this.oldToken);
uni.setStorageSync('uni-token', res.data['token']);
}
})
uni.hideLoading()
this.userId = res.data.userId
this.dataToken = ''
} else {
uni.showToast({
title: res['message'],
duration: 2000,
icon: 'none'
})
}
})
uni.hideLoading()
},
},
onLoad(option) {
if(uni.getStorageSync('dataToken')){
if (uni.getStorageSync('dataToken')) {
this.dataToken = uni.getStorageSync('dataToken')
}
if(uni.getStorageSync('dataToken')){
if (uni.getStorageSync('dataToken')) {
// 没有使用过系统或者之前使用过但未登录
if(!uni.getStorageSync('cffp_userId')|| (uni.getStorageSync('cffp_userId')&&uni.getStorageSync('loginType')=='visitor')){
this.reLogin(option,'1')
}else if(uni.getStorageSync('cffp_userId')!=option.userId){
if (!uni.getStorageSync('cffp_userId') || (uni.getStorageSync('cffp_userId') && uni.getStorageSync(
'loginType') == 'visitor')) {
this.reLogin(option, '1')
} else if (uni.getStorageSync('cffp_userId') != option.userId) {
// 付钱的人和分享的人不一样
this.reLogin(option,'2')
this.reLogin(option, '2')
}
}
dataHandling.pocessTracking(
'购买',
`用户进入到订单确认页`,
'进入',
2,
'订单确认页',
'',
`/pages/orderConfirm/orderConfirm?fileId=${option.fileId}&orderId=${option.orderId}&userId=${option.userId}`
)
this.fileId = Number(option.fileId);
this.orderId = option.orderId;
if (option.userId) {
this.userId = option.userId;
}
this.isRedirect = option.isRedirect;
if (this.isRedirect == 1 && option.userId) {
uni.request({
url: `${apiURL}/authorize/obtainToken`,
method: 'POST',
data: {ticket:'uni-app', loginId:option.userId},
success: (res) => {
if (res.statusCode === 200) {
uni.setStorageSync('uni-token', res.data['data']['token']);
if (this.isRedirect == 1 && option.userId) {
uni.request({
url: `${apiURL}/authorize/obtainToken`,
method: 'POST',
data: { ticket: 'uni-app', loginId: option.userId },
success: (res) => {
if (res.statusCode === 200) {
uni.setStorageSync('uni-token', res.data['data']['token']);
uni.setStorageSync('cffp_userId', option.userId);
uni.setStorageSync('isLogin','1');
uni.setStorageSync('isLogin', '1');
uni.setStorageSync('isH5', 1);
this.courseDetailLoad(option);
}
}
});
}else{
this.courseDetailLoad(option);
}
}
}
});
} else {
this.courseDetailLoad(option);
}
},
onShow() {
if(uni.getStorageSync('loginType')=='codelogin'){
this.queryInfo()
}
if (uni.getStorageSync('loginType') == 'codelogin') {
this.queryInfo()
}
// #ifdef H5
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
initJssdkShare(() => {
setWechatShare();
}, window.location.href);
// #endif
},
beforeUnmount() {
// window.removeEventListener('pageshow', this.handlePageShow);
// window.removeEventListener('pageshow', this.handlePageShow);
},
}
</script>
<style lang="scss" scoped>
::v-deep .uni-popup .uni-popup__wrapper{
margin: 0 !important;
::v-deep .uni-popup .uni-popup__wrapper {
margin: 0 !important;
}
.container {
// position: relative;
width: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
.backArrow{
.backArrow {
box-sizing: border-box;
display: flex;
height: 100rpx;
......@@ -698,15 +717,18 @@
margin-bottom: 10rpx;
color: #333333;
background-color: #fff;
text:nth-child(2){
text:nth-child(2) {
width: 100%;
text-align: center;
position: absolute;
}
}
.txtFont{
.txtFont {
font-size: 27rpx;
}
.courseItemBox {
margin: 20rpx;
border-radius: 10rpx;
......@@ -719,6 +741,7 @@
padding: 20rpx;
box-sizing: border-box;
width: 100%;
.title {
display: flex;
justify-content: space-between;
......@@ -872,7 +895,7 @@
view {
display: flex;
justify-content: space-between;
text {
&:last-child {
font-weight: bold;
......@@ -913,8 +936,8 @@
.paymentMethodContent {
margin-top: 20rpx;
.paymentItem {
display: flex;
align-items: center;
......@@ -1005,7 +1028,8 @@
justify-content: flex-end;
z-index: 100000;
background: rgba(0, 0, 0, 0.8);
.icon-liulanqi{
.icon-liulanqi {
margin: 0px 10rpx;
color: #3b43d5;
background: #fff;
......@@ -1013,9 +1037,10 @@
border-radius: 8rpx;
font-size: 36rpx;
}
.guideImgBox {
margin: 20px auto;
uni-image {
width: 25% !important;
position: absolute;
......@@ -1023,7 +1048,7 @@
top: 0;
}
}
.tips {
margin-top: 20%;
padding: 0 30px;
......@@ -1043,4 +1068,4 @@
text-align: justify;
letter-spacing: 1px;
}
</style>
</style>
\ No newline at end of file
......@@ -138,6 +138,14 @@
`${OSS_BASE_URL}/cases/CorporateServiceDeliveryCase-GroupandPropertyInsurance.pdf`
],
type: 'showURL',
},
{
id: 'case3',
title: '其他案例',
urls: [
`${OSS_BASE_URL}/cases/${uni.getStorageSync('cffp_userId')}-CognitiveAbilityTestReport.pdf`
],
type: 'showURL',
}
],
3: [
......
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