提交 e9c699c9 编写于 作者: guangjun.yang's avatar guangjun.yang

兑换的相关逻辑

上级 50965758
......@@ -40,6 +40,10 @@ export default {
isShow: {
type: Boolean,
default: true
},
changeErrorMsg: {
type: String,
default: ''
}
},
// computed: {
......@@ -63,18 +67,22 @@ export default {
this.$nextTick(() => {
this.activationCode = val.replace(/\s/g,'').replace(/.....(?!$)/g,'$& ');
});
},
changeErrorMsg(val) {
if(val) {
this.errorMsg = val;
}
}
},
methods: {
cancle() {
console.log('cancle');
this.$emit("cancle");
},
confirm() {
console.log('confirm');
if(!this.activationCode || this.activationCode.length != 23) return;
let aCode = JSON.stringify(this.activationCode);
this.$emit("confirm", aCode.replace(/\s/g,''));
let aCode = JSON.parse(JSON.stringify(this.activationCode));
aCode = aCode.replace(/\s/g,'');
this.$emit("confirm", aCode);
},
// bankCardKeyup() {
// this.id_card = val.replace(/\s/g,'').replace(/....(?!$)/g,'$& ');
......
......@@ -19,7 +19,8 @@ service.interceptors.request.use(config => {
if( process.env.BUILD_ENV == "development" ){ // 本地开发环境
config.headers['token'] = config.data.token || '891F256CC48A4D57905F79C8F7628A74';
}
// delete config.data.token;
delete config.data.setEntry;
delete config.data.token;
}
config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' })
......
......@@ -13,7 +13,7 @@ module.exports = {
query = this.$route.query
}
// alert('this.token' + this.token)
this.token = this.getUrlKey('token') || (query && query.token) || 'EEF69589911F4D3CAC8700AC11EE8096'
this.token = this.getUrlKey('token') || (query && query.token) || '4510A4F7DF72471D82EA3626C43A8696'
},
mounted() {
......
......@@ -31,10 +31,7 @@
:studyNum="project.studyNum"
:subject="project.subject"
/>
<CommonAdertImg
:advertInfoList="advertInfoList"
position="0"
/>
<CommonAdertImg :advertInfoList="advertInfoList" position="0" />
<!-- 步骤条 -->
<div v-if="project.cmeType != 2">
<CmeStep
......@@ -76,7 +73,8 @@
<LearnKnow :mustKnow="project.mustKnow"></LearnKnow>
<CommonSpliteLine></CommonSpliteLine>
<ItemIntro :textContent="textContent" @itemIntroText="itemIntroText"></ItemIntro>
<ItemLeader v-if="projectLeader"
<ItemLeader
v-if="projectLeader"
:projectLeader="projectLeader"
:leaderText="leaderText"
@changeLeaderText="changeLeaderText"
......@@ -96,14 +94,9 @@
</div>
</div>
<CommonAdertImg
needPadTop
:advertInfoList="advertInfoList"
position="1"
/>
<CommonAdertImg needPadTop :advertInfoList="advertInfoList" position="1" />
<NoMoreContent />
<div v-if="detailNum <= 9" class="no-more-bottom"></div>
</div>
<!-- 弹框 -->
<CommonDialog
......@@ -113,7 +106,7 @@
:confirmBtnText="confirmBtnText"
:content="dialogContent"
@handlerAction="handlerAction"
/>
/>
<!-- 弹框 -->
<ExjumperDialog
:isShowDialog="isShowEJDialog"
......@@ -127,23 +120,34 @@
<ExjumperButton
@btnClick="beforeJumpToExam"
v-if="project.cmeType == 2 && hasBindCard"
:btnText="project.currentProgress > 1 ? '参加考试' : '学完全部课程,可参加考试'"
:type="project.currentProgress > 1 ? 'primary' : 'disabled'"></ExjumperButton>
:btnText="project.currentProgress > 1 ? '参加考试' : '学完全部课程,可参加考试'"
:type="project.currentProgress > 1 ? 'primary' : 'disabled'"
></ExjumperButton>
<div v-if="project.cmeType == 2" style="padding-top: 30px"></div>
<BindCardButton
v-if="project.cmeType == 2 && !hasBindCard"
<BindCardButton
v-if="project.cmeType == 2 && !hasBindCard"
:cardInfo="cardInfo"
@changeClick="changeClick"
@gotoBuy="confirm"
></BindCardButton>
<!--去兑换-->
<ChangeCard :isShow="showChangeCard" @cancle="cancleChangeCard" @confirm="changeCardAction"></ChangeCard>
<ChangeCard
:changeErrorMsg="changeCardErrorMsg"
:isShow="showChangeCard"
@cancle="cancleChangeCard"
@confirm="changeCardAction">
</ChangeCard>
<!-- <CardPopup :cardInfo="cardInfo" :isShow="isShowPopup" @clickOverlay="clickOverlay" @cancle="jumpToCardList()" @confirm="confirm"></CardPopup> -->
<Loading v-show="showLoading" />
<div>
<span data-clipboard-action="copy" class="cobyOrderSn" :data-clipboard-text="this.project.cardKey" @click="copyLink"></span>
<span
data-clipboard-action="copy"
class="cobyOrderSn"
:data-clipboard-text="this.project.cardKey"
@click="copyLink"
></span>
</div>
</div>
</template>
......@@ -173,7 +177,7 @@ import CommonAdertImg from "@/components/common/common-advert-img";
import { getWebPageUrl, gotoPage } from "@/utils/index";
import { mapGetters, mapActions } from "vuex";
import vueFilters from "@/utils/filter";
import { Toast } from 'vant';
import { Toast } from "vant";
// import CardPopup from "@/components/cme/card-popup";
import BindCardButton from "@/components/cme/bind-card-button";
import ChangeCard from "@/components/cme/change-card";
......@@ -221,18 +225,18 @@ export default {
inScope: 0, // 是否在范围内判断
projectCredit: "", // 学分
certificateId: "0",
cmeType: 1, // 1: 自营项目; 2: 中华医学会二类
examBtnUrl: '', // 考试按钮跳转连接
firstIntoExam: false, // true弹框,是否首次进入考试,用于首次跳转弹框提示,只跟项目和人员有关
jumpToContents: false, // 是否跳转到目录
cardStatus: 0,
cmeType: 1, // 1: 自营项目; 2: 中华医学会二类
examBtnUrl: "", // 考试按钮跳转连接
firstIntoExam: false, // true弹框,是否首次进入考试,用于首次跳转弹框提示,只跟项目和人员有关
jumpToContents: false, // 是否跳转到目录
cardStatus: 0
// cmeType=2时不显示进度,
// projectNo为空时不显示项目编号,
// projectLeader为空时不显示项目负责人,
// inScope=0时考试按钮不显示,
// currentProgress>1时考试按钮显示并可用
},
hasBindCard: false, // 是否绑定过学习卡或兑换过 没有绑定,则显示绑定按钮
hasBindCard: false, // 是否绑定过学习卡或兑换过 没有绑定,则显示绑定按钮
projectLeader: {},
doctorList: [],
from: "inner",
......@@ -264,17 +268,18 @@ export default {
detailNum: 0,
courseRequire: 0,
clientType: 0,
// currentProgress>1时考试按钮显示并可用
btnType: 'primary', // primary: 可跳转时(currentProgress = 1); disabled: 不可跳转时
btnText: '学完全部课程,可参加考试', // 参加考试(currentProgress = 1); 或者学完全部课程,可参加考试
provinceId: '',
organizationId: '',
// currentProgress>1时考试按钮显示并可用
btnType: "primary", // primary: 可跳转时(currentProgress = 1); disabled: 不可跳转时
btnText: "学完全部课程,可参加考试", // 参加考试(currentProgress = 1); 或者学完全部课程,可参加考试
provinceId: "",
organizationId: "",
isShowPopup: false,
cardInfo: {
id: 0
},
advertInfoList: [],
showChangeCard: true,//是否展示兑换弹框
showChangeCard: false, //是否展示兑换弹框,
changeCardErrorMsg: ""
};
},
components: {
......@@ -301,7 +306,7 @@ export default {
},
computed: {
...mapGetters(["userInfo"]),
...mapGetters(["userInfo"])
},
created() {
......@@ -316,7 +321,7 @@ export default {
window.__getUserInfo64Comp = function(param) {
// appVersion 安卓 3.2.2 iOS
console.log('__getUserInfo64Comp', param);
console.log("__getUserInfo64Comp", param);
_this.token = param.userToken;
_this.setUserInfo(param);
_this.checkToken();
......@@ -345,7 +350,7 @@ export default {
// _this.showLoading = false;
param.setEntry = true;
_this.getProvinceIdByPosition(param);
}
};
// 调用广告位接口
this.getAdvertInfoList();
......@@ -366,32 +371,38 @@ export default {
// 兑换 返回值:0绑定失败,1绑定成功
changeCardAction(cardKey) {
console.log('in changeCard');
this.showChangeCard = false;
console.log("cardKey", cardKey);
console.log("in changeCard");
let _this = this;
let param = {
cardKey: cardKey,
cardType: 2,
portalProjectId: this.projectId
}
// param.setEntry = true;
portalProjectId: this.projectId,
setEntry: true
};
_this.changeCardErrorMsg = "";
this.POST("cme/projectCard/bind", param).then(res => {
if (res.code == "000000") {
this.showChangeCard = false;
_this.getProjectParticularsV2();
} else {
_this.changeCardErrorMsg = "请输入正确的兑换码";
}
});
}).catch( e => {
_this.changeCardErrorMsg = "请输入正确的兑换码";
});
},
// 复制卡密
copyLink() {
console.log('in copyLink');
console.log("in copyLink");
let _this = this;
let clipboard = new this.clipboard(".cobyOrderSn");
clipboard.on('success', function () {
Toast("复制成功")
clipboard.on("success", function() {
Toast("复制成功");
});
clipboard.on('error', function () {
Toast("复制失败")
clipboard.on("error", function() {
Toast("复制失败");
});
},
......@@ -402,15 +413,15 @@ export default {
};
this.GET(`portal/jump/${this.projectId}/1`, param).then(res => {
if (res.code == "000000") {
this.advertInfoList = res.data && res.data.list || [];
console.log('advertInfoList', this.advertInfoList);
this.advertInfoList = (res.data && res.data.list) || [];
console.log("advertInfoList", this.advertInfoList);
}
});
},
// 点击弹层
clickOverlay() {
console.log('clickOverlay');
console.log("clickOverlay");
// this.isShowPopup = false;
},
......@@ -418,13 +429,13 @@ export default {
beforeJumpToExam() {
this.$sendBuriedData({
component_tag: `882#8824`
});
});
// 如果是首次,则弹出弹框
if(this.project.firstIntoExam) {
if (this.project.firstIntoExam) {
this.isShowEJDialog = true;
} else {
// this.isBuy(2);
this.jumpToCardList();
this.jumpToCardList();
}
},
......@@ -451,12 +462,12 @@ export default {
// if (res.code == "000000") {
// // 如果购买过,则直接跳转到中华医学会页面
// if(res.data) {
// this.jumpToCardList();
// this.jumpToCardList();
// } else {
// this.preJumper();
// }
// }
// });
// });
// },
// 跳转II类学习详情页面(中华医学会项目详情页面)
......@@ -469,9 +480,9 @@ export default {
// this.isShowPopup = false;
// 判断版本号,如果小于3.4.0,则只做提示
let appVersion = this.userInfo.appVersion;
let appVersionNum = appVersion.split('.').join('');
if(appVersionNum < 341) {
Toast('请您下载新版本App');
let appVersionNum = appVersion.split(".").join("");
if (appVersionNum < 341) {
Toast("请您下载新版本App");
return;
}
......@@ -492,11 +503,11 @@ export default {
// 此字段不配置,则用原来的逻辑
{
key: "needCache",
value: '1', // 0不缓存,其它值都做缓存
value: "1", // 0不缓存,其它值都做缓存
type: 4,
seqNo: 1
}
]
];
rocNative.dispatchEventByModuleCode({
modeCode: "M300",
jsonString: paramList
......@@ -507,10 +518,10 @@ export default {
// 跳转前判断是否有机构,否则使用定位信息
preJumper() {
// TODO 测试代码
if(window.__isWeb) {
if (window.__isWeb) {
this.getCardInfoByProvinceId(310);
} else {
if(this.organizationId != 0 && this.provinceId != 0) {
if (this.organizationId != 0 && this.provinceId != 0) {
this.getCardInfoByProvinceId(this.provinceId);
} else {
this.getPositionData();
......@@ -521,34 +532,36 @@ export default {
// 根据位置信息获取省ID
getProvinceIdByPosition(param) {
param.setEntry = true;
this.POST("aggregate/cme/convertLocationToProvinceId", param).then(res => {
if (res.code == "000000") {
this.getCardInfoByProvinceId(res.data);
this.POST("aggregate/cme/convertLocationToProvinceId", param).then(
res => {
if (res.code == "000000") {
this.getCardInfoByProvinceId(res.data);
}
}
});
);
},
// 根据省ID,获取学习卡信息
getCardInfoByProvinceId(provinceId) {
let param = {
"area": provinceId + '',
"cardType": 2,
"pageNum": 1,
"pageSize": 1
}
area: provinceId + "",
cardType: 2,
pageNum: 1,
pageSize: 1
};
this.POST("trade/goods/cardList", param).then(res => {
if (res.code == "000000") {
this.showLoading = false;
// this.isShowPopup = true;
this.cardInfo = res.data && res.data[0] || {id: 0} ;
this.cardInfo = (res.data && res.data[0]) || { id: 0 };
}
});
});
},
// 获取地理位置信息
getPositionData() {
// this.showLoading = true;
console.log('getPositionData');
console.log("getPositionData");
rocNative.getPositionData({
__funcName: "__getPositionData"
});
......@@ -556,10 +569,10 @@ export default {
// 跳转到原生的购买页面
confirm() {
let appVersion = this.userInfo.appVersion || '';
let appVersionNum = appVersion.split('.').join('');
if(appVersionNum < 341) {
Toast('请您下载新版本App');
let appVersion = this.userInfo.appVersion || "";
let appVersionNum = appVersion.split(".").join("");
if (appVersionNum < 341) {
Toast("请您下载新版本App");
return;
}
this.$sendBuriedData({
......@@ -570,11 +583,14 @@ export default {
// let pageUrl = this.project.examBtnUrl;
// 直接传入项目ID(projectId)
let projectId = this.project.projectId;
let pageUrl = getWebPageUrl(`/cme/#/coop?id=${projectId}&cmeProjectId=${projectId}`);
let pageUrl = getWebPageUrl(
`/cme/#/coop?id=${projectId}&cmeProjectId=${projectId}`
);
let paramList = [
{
key: "className",
value: "com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC",
value:
"com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC",
type: 4,
seqNo: 1
},
......@@ -597,7 +613,7 @@ export default {
jsonString: paramList
});
},
// 跳转到原生的购买页面
// 跳转到原生的购买页面
confirmOld() {
this.$sendBuriedData({
component_tag: `885#8852`
......@@ -608,7 +624,8 @@ export default {
let paramList = [
{
key: "className",
value: "com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC",
value:
"com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC",
type: 4,
seqNo: 1
},
......@@ -638,11 +655,13 @@ export default {
token: _this.userInfo.userToken || this.token,
setEntry: true
};
this.NEW_POST(`cme/project/${_this.projectId}/firstIntoExam`, param).then(res => {
if (res.code == "000000") {
this.project.firstIntoExam = false;
this.NEW_POST(`cme/project/${_this.projectId}/firstIntoExam`, param).then(
res => {
if (res.code == "000000") {
this.project.firstIntoExam = false;
}
}
});
);
},
//获取用户信息
......@@ -683,7 +702,10 @@ export default {
setEntry: true
};
_this.NEW_POST("cme/credit/rangeCheck", param).then(res => {
if ( (_this.project.cmeType != 2) && (res.code == "219004" || res.code == "219012")) {
if (
_this.project.cmeType != 2 &&
(res.code == "219004" || res.code == "219012")
) {
// 未加入机构 219004 不在申请范围 219012
this.dialogContent = `该项目仅对${_this.project.scope}的用户开放`;
this.cancleBtnText = "我知道了";
......@@ -734,8 +756,8 @@ export default {
},
//去兑换
changeClick(msg){
console.log('in changeClick');
changeClick(msg) {
console.log("in changeClick");
this.showChangeCard = true;
},
......@@ -747,7 +769,7 @@ export default {
scrollFun() {
let scrollTop =
document.body.scrollTop || document.documentElement.scrollTop;
let h = intorOffsetTop - 135
let h = intorOffsetTop - 135;
// 显示头部导航
if (scrollTop > 20) {
this.isBlack = true;
......@@ -757,36 +779,35 @@ export default {
this.bgColor = "none";
}
if(window.__isWeb) {
if (window.__isWeb) {
h = intorOffsetTop - 75;
} else if(window.__isIOS) {
} else if (window.__isIOS) {
h = intorOffsetTop - 140;
}
// 如果滚动高度大于简介头部(并减去tab高度),则进行固定
if(scrollTop > h) {
if (scrollTop > h) {
this.fixedFlag = true;
} else {
this.fixedFlag = false;
}
// 如果滚动高度大于
if(scrollTop > cataOffsetTop - 600) {
if (scrollTop > cataOffsetTop - 600) {
this.tabFlag = false;
} else {
this.tabFlag = true;
}
},
// 锚点到简介
jumpIntro() {
if(!this.tabFlag) {
if (!this.tabFlag) {
this.tabFlag = true;
}
if(!this.fixedFlag) {
if (!this.fixedFlag) {
this.fixedFlag = true;
}
}
let h;
if (this.isWeb) {
h = intorOffsetTop - 30 - titleOffsetHeight;
......@@ -803,10 +824,10 @@ export default {
// 锚点到目录
jumpCatalogue() {
if(this.tabFlag) {
if (this.tabFlag) {
this.tabFlag = false;
}
if(!this.fixedFlag) {
if (!this.fixedFlag) {
this.fixedFlag = true;
}
let h;
......@@ -887,12 +908,17 @@ export default {
_this.organizationId = res.data.positionModel.organizationId;
_this.courseRequire = res.data.courseRequire || 0;
setTimeout( () => {
cataOffsetTop = document.getElementById("catalogue-content").offsetTop;
setTimeout(() => {
cataOffsetTop = document.getElementById("catalogue-content")
.offsetTop;
intorOffsetTop = document.getElementById("intro-content").offsetTop;
console.log('getProjectParticularsV2', cataOffsetTop, intorOffsetTop);
console.log(
"getProjectParticularsV2",
cataOffsetTop,
intorOffsetTop
);
// 直接跳转
if(_this.project.jumpToContents) {
if (_this.project.jumpToContents) {
setTimeout(() => {
this.jumpCatalogue();
}, 200);
......@@ -904,8 +930,8 @@ export default {
// 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡
_this.hasBindCard = res.data.cardStatus == 0 ? false : true;
if(!_this.hasBindCard) {
_this.preJumper()
if (!_this.hasBindCard) {
_this.preJumper();
}
}
});
......@@ -1031,7 +1057,6 @@ export default {
// margin-bottom: px2rem(40px);
}
.intro-catalogue-container {
.title {
height: px2rem(50px);
line-height: px2rem(30px);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册