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

判断用户是否购买过I类学习卡

上级 e6d612d2
<template>
<!-- 专项合作列表 -->
<section class="coop-container">
<div
v-show="paramData.length && isShow"
v-for="(item , index) in paramData"
:key="index"
class="coop-item"
@click="coopDetails(item)"
>
<div class="coop-item-left">
<img :src="item.imgUrl" />
<span
v-if="item.projectStatusValue"
class="coop-container-status"
:style="{'background': cBgColor(item)}"
>{{item.projectStatusValue | statusText}}</span>
</div>
<div class="coop-item-right">
<span class="coop-item-right-title">{{item.name}}</span>
<span class="coop-item-right-other">{{item.level}} | {{item.credit}} | {{item.scope}}</span>
<!-- <span v-if="item.pType == 1"
class="coop-item-right-other"
>起止日期 {{item.oldTime}}</span>-->
<!-- <span v-else
class="coop-item-right-other"
>起止日期 {{item.projectBegintimeLong | formatTime}}-{{item.projectEndtimeLong | formatTime}}</span>-->
<span class="coop-item-right-other">{{item.startDate | formatTime('{y}.{m}.{d}')}}{{item.endDate | formatTime('{y}.{m}.{d}')}}</span>
</div>
</div>
<NoMoreContent v-show="paramData.length > 9"></NoMoreContent>
<NoContent v-show="!paramData.length && isShow" :tabNum="tabTo"></NoContent>
<!--<UpdateDialog :showGoUpdate="showGoUpdate" @goUpdateHandler="goUpdateHandler"></UpdateDialog>-->
<!-- <van-popup
v-model="showGoUpdate"
position="bottom"
:style="{ height: '4.427rem' }"
>
<div class="update-dialog-content">
<p class="title">该项目仅对河北石家庄市的用户开放</p>
<p class="update-btn v-hairline-top confirm-btn" @click="goUpdateHandler">确定</p>
<p class="update-btn v-hairline-top" @click="showGoUpdate = false">取消</p>
</div>
</van-popup>-->
</section>
</template>
<script>
import NoMoreContent from "@/components/business/no-more-content";
import NoContent from "@/components/business/no-content";
import UpdateDialog from "@/components/business/update-dialog";
import { setEventByModuleCode, deepCopy, getWebPageUrl } from "@/utils/index";
import { getAppVersion } from "@/utils";
import { mapActions, mapGetters } from "vuex";
import { Popup } from "vant";
export default {
name: "coop-list-item",
data() {
return {
bgColor: "green",
statusText: "进行中",
showGoUpdate: false
};
},
props: {
paramData: {
type: Array,
default: () => []
},
coopType: {
type: Number,
default: 1
},
isShow: {
type: Boolean,
default: false
},
tabTo: {
type: Number,
default: 1
},
userMobile: {
type: String,
default: ""
},
provinceId: {
type: String | Number,
default: 0
},
organizationId: {
type: String | Number,
default: 0
},
},
computed: {
...mapGetters(["userInfo"])
// cBgColor() {
// }
},
components: {
NoMoreContent,
NoContent,
UpdateDialog
},
mounted() {},
filters: {
statusText(status) {
if (status === 1) {
return "参加中";
} else if (status === 5) {
return "进行中";
} else if (status === 10) {
return "已结束";
} else {
return "已结束";
}
}
},
methods: {
...mapActions(["setProjectTabIndex"]),
cBgColor(item) {
if (item.projectStatusValue === 1) {
return "#5890DD";
} else if (item.projectStatusValue === 5) {
return "#449284";
} else if (item.projectStatusValue === 10) {
return "#373839";
} else {
return "#5890DD";
}
},
coopDetails(item) {
let appVersion = this.userInfo.appVersion;
let appVersionNum = appVersion.split('.').join('');
console.log('appVersionNum', appVersionNum);
if(appVersionNum < 341) {
Toast('请您下载新版本App');
return;
}
// 临时添加
if(window.__isWeb) {
this.$router.push({
path: "/coop",
query: {
id: item.id,
coopType: this.coopType,
courseRequire: item.courseRequire
}
});
return;
}
if (this.userMobile) {
let paramList = [
{
key: "pageUrl",
value: getWebPageUrl(`cme/#/coop?id=${item.id}&courseRequire=${item.courseRequire}`),
type: 4,
seqNo: 1
}
];
rocNative.dispatchEventByModuleCode({
modeCode: "M300",
jsonString: paramList
});
} else {
rocNative.gotoLogin();
}
this.$sendBuriedData({
component_tag: `210#210002#${item.id}#${item.name}` //'210#210002#0#'+item.projectName
});
// if (item.courseRequire == 1) { //对课程完成度有控制,需判断版本号
// let appVersion = getAppVersion(this.userInfo.appVersion);
// // alert('版本'+appVersion)
// let flag = appVersion < 315;
// if (flag === true) {
// // 小于315版本,添加去更新弹层
// this.showGoUpdate = true;
// }else {
// // 跳转到老项目
// if(this.tabTo != 3) {
// this.setProjectTabIndex(this.tabTo)
// }
// if (item.pType == 1) {
// this.goToPage(item);
// // 跳转到新项目
// } else {
// this.showModule(item, this.coopType, this.tabTo, item.courseRequire)
// }
// }
// } else {
// // 跳转到老项目
// if(this.tabTo != 3) {
// this.setProjectTabIndex(this.tabTo)
// }
// if (item.pType == 1) {
// this.goToPage(item);
// // 跳转到新项目
// } else {
// this.showModule(item, this.coopType, this.tabTo, item.courseRequire)
// // this.$router.push({
// // path: "/coop",
// // query: {
// // id: item.id,
// // coopType: this.coopType
// // }
// // });
// }
// }
},
// 跳转到新项目
// showModule(item, coopType, tabTo, courseRequire) {
// if (window.__isWeb) {
// if(item.parent === false) {
// this.$router.push({
// path: "/coop",
// query: {
// id: item.id,
// coopType: coopType,
// tabTo: tabTo,
// courseRequire: courseRequire,
// }
// });
// } else {
// this.$router.push({
// path: "/parent",
// query: {
// entryId: item.entryId,
// }
// });
// }
// return;
// }
// let pageUrl = "";
// let paramList = [];
// if(item.parent === false) {
// pageUrl = getWebPageUrl('cme/#/coop');
// paramList = [
// {
// key: "pageUrl",
// value: pageUrl + `?id=${item.id}&coopType=${coopType}&tabTo=${tabTo}&courseRequire=${courseRequire}`,
// type: 4,
// seqNo: 1
// }
// ]
// } else {
// pageUrl = getWebPageUrl('cme/#/parent');
// paramList = [
// {
// key: "pageUrl",
// value: pageUrl + `?entryId=${item.entryId}`,
// type: 4,
// seqNo: 1
// }
// ]
// }
// rocNative.dispatchEventByModuleCode({
// modeCode: "M300",
// jsonString: paramList
// });
// },
goToPage(item) {
let _this = this;
// 如果是湖北考试项目,则做相应权限判断 湖北的projectId=3
if (item.id == "3") {
if (!_this.userInfo.userToken) {
rocNative.gotoLogin();
return;
}
let param = {
type: 1,
token: _this.userInfo.userToken || _this.token,
setEntry: true
};
this.GET("portal/portalApp/role/3", param).then(res => {
if (res.code == "000000") {
// {
// "data": 0, // 0就是无权限,1有权限
// "code": "000000",
// "message": "成功"
// }
if (res.data == 0) {
rocNative.showNativeToast({
message: "您不属于该项目,无法查看"
});
return;
}
} else {
rocNative.gotoLogin();
return;
}
_this.goToPage1(item.contentListModel);
});
} else {
_this.goToPage1(item.contentListModel);
}
},
// 跳转
goToPage1(itemData) {
let paramList = deepCopy(setEventByModuleCode(itemData));
let isStrokeUrl =
paramList[0] &&
paramList[0]["value"] &&
paramList[0]["value"].indexOf("stroke.js") !== -1;
let strokeUrl = "";
if (isStrokeUrl) {
strokeUrl =
paramList[0]["value"] + "&token=" + this.userInfo.userToken ||
_this.token;
paramList[0]["value"] = strokeUrl;
}
rocNative.dispatchEventByModuleCode({
modeCode: itemData.appModuleInfo.code,
jsonString: paramList
});
// this.appBuryingPointEntrust({
// ...activity_action,
// labelId: itemData.id,
// functionCode: this.id == 1 ? "c_project" : "f_activity",
// actionCode: this.id == 1 ? "c_project_tab" : "c_activity_tab",
// labelValue: itemData.title,
// createdTime: new Date().getTime()
// });
},
goUpdateHandler() {
//去更新
rocNative.upGradeVersion();
this.showGoUpdate = false;
}
}
};
</script>
<style lang="scss" scoped>
@import "../../style/mixin";
.coop-container {
position: relative;
margin: px2rem(0px) px2rem(15px);
&-status {
position: absolute;
top: px2rem(6px);
left: 0;
// display: block;
width: px2rem(44px);
height: px2rem(18px);
line-height: px2rem(18px);
padding: px2rem(0px) 0 0 px2rem(4px);
background: rgba(88, 144, 221, 1);
color: #fff;
font-size: px2rem(11px);
border-top-right-radius: px2rem(3px);
border-bottom-right-radius: px2rem(3px);
}
}
.coop-item {
display: flex;
width: 100%;
height: px2rem(128px);
border-bottom: 1px solid #f0f0f0;
background: #fff;
flex-direction: row;
justify-content: center;
align-items: center;
img {
width: px2rem(115px);
height: px2rem(86px);
margin-right: px2rem(15px);
border-radius: px2rem(3px);
}
&-left {
display: flex;
position: relative;
top: 0;
}
&-right {
display: flex;
width: px2rem(215px);
flex-direction: column;
padding-top: px2rem(4px);
&-title {
height: px2rem(50px);
line-height: px2rem(20px);
font-size: px2rem(16px);
font-weight: 700;
color: rgba(55, 56, 57, 1);
}
&-other {
height: px2rem(21px);
line-height: px2rem(20px);
font-size: px2rem(13px);
font-weight: 400;
color: rgba(151, 152, 153, 1);
width: px2rem(210px);
overflow : hidden;
text-overflow: ellipsis;
white-space:nowrap;
}
}
}
.update-dialog-content {
padding: 0 px2rem(15px);
box-sizing: border-box;
.title {
text-align: center;
color: #373839;
font-size: px2rem(18px);
padding: px2rem(15px) 0;
line-height: px2rem(25px);
}
.update-btn {
text-align: center;
height: px2rem(55px);
line-height: px2rem(55px);
font-size: px2rem(16px);
color: #979899;
&.confirm-btn {
color: #449284;
}
&.v-hairline-top::after {
border-top-width: 1px;
}
}
}
</style>
<style>
.van-overlay {
background-color: rgba(0, 0, 0, 0.5);
}
</style>
...@@ -19,29 +19,11 @@ ...@@ -19,29 +19,11 @@
<div class="coop-item-right"> <div class="coop-item-right">
<span class="coop-item-right-title">{{item.name}}</span> <span class="coop-item-right-title">{{item.name}}</span>
<span class="coop-item-right-other">{{item.level}} | {{item.credit}} | {{item.scope}}</span> <span class="coop-item-right-other">{{item.level}} | {{item.credit}} | {{item.scope}}</span>
<!-- <span v-if="item.pType == 1"
class="coop-item-right-other"
>起止日期 {{item.oldTime}}</span>-->
<!-- <span v-else
class="coop-item-right-other"
>起止日期 {{item.projectBegintimeLong | formatTime}}-{{item.projectEndtimeLong | formatTime}}</span>-->
<span class="coop-item-right-other">{{item.startDate | formatTime('{y}.{m}.{d}')}}{{item.endDate | formatTime('{y}.{m}.{d}')}}</span> <span class="coop-item-right-other">{{item.startDate | formatTime('{y}.{m}.{d}')}}{{item.endDate | formatTime('{y}.{m}.{d}')}}</span>
</div> </div>
</div> </div>
<NoMoreContent v-show="paramData.length > 9"></NoMoreContent> <NoMoreContent v-show="paramData.length > 9"></NoMoreContent>
<NoContent v-show="!paramData.length && isShow" :tabNum="tabTo"></NoContent> <NoContent v-show="!paramData.length && isShow" :tabNum="tabTo"></NoContent>
<!--<UpdateDialog :showGoUpdate="showGoUpdate" @goUpdateHandler="goUpdateHandler"></UpdateDialog>-->
<!-- <van-popup
v-model="showGoUpdate"
position="bottom"
:style="{ height: '4.427rem' }"
>
<div class="update-dialog-content">
<p class="title">该项目仅对河北石家庄市的用户开放</p>
<p class="update-btn v-hairline-top confirm-btn" @click="goUpdateHandler">确定</p>
<p class="update-btn v-hairline-top" @click="showGoUpdate = false">取消</p>
</div>
</van-popup>-->
</section> </section>
</template> </template>
...@@ -83,12 +65,18 @@ export default { ...@@ -83,12 +65,18 @@ export default {
userMobile: { userMobile: {
type: String, type: String,
default: "" default: ""
} },
provinceId: {
type: String | Number,
default: 0
},
organizationId: {
type: String | Number,
default: 0
},
}, },
computed: { computed: {
...mapGetters(["userInfo"]) ...mapGetters(["userInfo"])
// cBgColor() {
// }
}, },
components: { components: {
NoMoreContent, NoMoreContent,
...@@ -138,7 +126,9 @@ export default { ...@@ -138,7 +126,9 @@ export default {
query: { query: {
id: item.id, id: item.id,
coopType: this.coopType, coopType: this.coopType,
courseRequire: item.courseRequire courseRequire: item.courseRequire,
projectId: this.provinceId,
organizationId: this.organizationId
} }
}); });
return; return;
...@@ -148,7 +138,7 @@ export default { ...@@ -148,7 +138,7 @@ export default {
let paramList = [ let paramList = [
{ {
key: "pageUrl", key: "pageUrl",
value: getWebPageUrl(`cme/#/coop?id=${item.id}&courseRequire=${item.courseRequire}`), value: getWebPageUrl(`cme/#/coop?id=${item.id}&courseRequire=${item.courseRequire}&projectId=${this.projectId}&organizationId=${this.organizationId}`),
type: 4, type: 4,
seqNo: 1 seqNo: 1
} }
...@@ -164,100 +154,9 @@ export default { ...@@ -164,100 +154,9 @@ export default {
this.$sendBuriedData({ this.$sendBuriedData({
component_tag: `210#210002#${item.id}#${item.name}` //'210#210002#0#'+item.projectName component_tag: `210#210002#${item.id}#${item.name}` //'210#210002#0#'+item.projectName
}); });
// if (item.courseRequire == 1) { //对课程完成度有控制,需判断版本号
// let appVersion = getAppVersion(this.userInfo.appVersion);
// // alert('版本'+appVersion)
// let flag = appVersion < 315;
// if (flag === true) {
// // 小于315版本,添加去更新弹层
// this.showGoUpdate = true;
// }else {
// // 跳转到老项目
// if(this.tabTo != 3) {
// this.setProjectTabIndex(this.tabTo)
// }
// if (item.pType == 1) {
// this.goToPage(item);
// // 跳转到新项目
// } else {
// this.showModule(item, this.coopType, this.tabTo, item.courseRequire)
// }
// }
// } else {
// // 跳转到老项目
// if(this.tabTo != 3) {
// this.setProjectTabIndex(this.tabTo)
// }
// if (item.pType == 1) {
// this.goToPage(item);
// // 跳转到新项目
// } else {
// this.showModule(item, this.coopType, this.tabTo, item.courseRequire)
// // this.$router.push({
// // path: "/coop",
// // query: {
// // id: item.id,
// // coopType: this.coopType
// // }
// // });
// }
// }
}, },
// 跳转到新项目
// showModule(item, coopType, tabTo, courseRequire) {
// if (window.__isWeb) {
// if(item.parent === false) {
// this.$router.push({
// path: "/coop",
// query: {
// id: item.id,
// coopType: coopType,
// tabTo: tabTo,
// courseRequire: courseRequire,
// }
// });
// } else {
// this.$router.push({
// path: "/parent",
// query: {
// entryId: item.entryId,
// }
// });
// }
// return;
// }
// let pageUrl = "";
// let paramList = [];
// if(item.parent === false) {
// pageUrl = getWebPageUrl('cme/#/coop');
// paramList = [
// {
// key: "pageUrl",
// value: pageUrl + `?id=${item.id}&coopType=${coopType}&tabTo=${tabTo}&courseRequire=${courseRequire}`,
// type: 4,
// seqNo: 1
// }
// ]
// } else {
// pageUrl = getWebPageUrl('cme/#/parent');
// paramList = [
// {
// key: "pageUrl",
// value: pageUrl + `?entryId=${item.entryId}`,
// type: 4,
// seqNo: 1
// }
// ]
// }
// rocNative.dispatchEventByModuleCode({
// modeCode: "M300",
// jsonString: paramList
// });
// },
goToPage(item) { goToPage(item) {
let _this = this; let _this = this;
// 如果是湖北考试项目,则做相应权限判断 湖北的projectId=3 // 如果是湖北考试项目,则做相应权限判断 湖北的projectId=3
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<div class="info"> <div class="info">
<span class="name">{{cardInfo.goodsName}}</span> <span class="name">{{cardInfo.goodsName}}</span>
<p> <p>
<span class="price">{{cardInfo.preferentialPrice}}</span><span class="discount"><del> 原价¥{{cardInfo.costPrice}}</del></span> <span class="price">{{cardInfo.preferentialPrice}}</span><span v-show="cardInfo.costPrice" class="discount"><del> 原价¥{{cardInfo.costPrice}}</del></span>
</p> </p>
</div> </div>
</section> </section>
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
<script> <script>
import CommonNavbar from "@/components/common/common-navbar"; import CommonNavbar from "@/components/common/common-navbar";
import CardPopup from "@/components/cme/card-popup"; import CardPopup from "@/components/cme/card-popup";
import { mapGetters } from 'vuex';
export default { export default {
data() { data() {
return { return {
...@@ -42,20 +41,18 @@ export default { ...@@ -42,20 +41,18 @@ export default {
CommonNavbar, CommonNavbar,
CardPopup CardPopup
}, },
computed: {
...mapGetters(['jumpURLForI', 'organizationInfo'])
},
created() { created() {
// TEST
let _this = this; let _this = this;
window.__getPositionData = function(param) { window.__getPositionData = function(param) {
console.log(param); console.log(param);
param.setEntry = true;
_this.getProvinceIdByPosition(param); _this.getProvinceIdByPosition(param);
} }
this.oneLevelUrl = decodeURIComponent(this.$route.query && this.$route.query.oneLevelUrl || ''); this.oneLevelUrl = decodeURIComponent(this.$route.query && this.$route.query.oneLevelUrl || '');
this.provinceId = this.$route.query && this.$route.query.provinceId || 0; this.provinceId = this.$route.query && this.$route.query.provinceId || 0;
this.organizationId = this.$route.query && this.$route.query.organizationId || 0; this.organizationId = this.$route.query && this.$route.query.organizationId || 0;
console.log(this.oneLevelUrl, this.provinceId, this.organizationId);
// this.getProvinceIdByPosition();
}, },
methods: { methods: {
// 判断用户是否购买过I类学习卡 // 判断用户是否购买过I类学习卡
...@@ -76,12 +73,10 @@ export default { ...@@ -76,12 +73,10 @@ export default {
}); });
}, },
// 跳转前判断是否有机构,否则使用定位信息
preJumper() { preJumper() {
// 如果有机构,则直接获取学习卡信息
console.log('in jumper this.organizationInfo', this.organizationInfo, '');
if(this.organizationId != 0 && this.provinceId != 0) { if(this.organizationId != 0 && this.provinceId != 0) {
this.getCardInfoByProvinceId(this.provinceId); this.getCardInfoByProvinceId(this.provinceId);
// 否则获取地理位置信息
} else { } else {
this.getPositionData(); this.getPositionData();
} }
...@@ -106,7 +101,6 @@ export default { ...@@ -106,7 +101,6 @@ export default {
this.POST("trade/goods/cardList", param).then(res => { this.POST("trade/goods/cardList", param).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
this.showGoUpdate = true; this.showGoUpdate = true;
console.log('getCardInfoByProvinceId', res);
this.cardInfo = res.data && res.data[0] || {} ; this.cardInfo = res.data && res.data[0] || {} ;
} }
}); });
...@@ -114,9 +108,9 @@ export default { ...@@ -114,9 +108,9 @@ export default {
// 根据位置信息获取省ID // 根据位置信息获取省ID
getProvinceIdByPosition(param) { getProvinceIdByPosition(param) {
this.GET("aggregate/cme/convertLocationToProvinceId", param).then(res => { param.setEntry = true;
this.POST("aggregate/cme/convertLocationToProvinceId", param).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
console.log('getProvinceIdByPosition', res);
this.getCardInfoByProvinceId(res.data); this.getCardInfoByProvinceId(res.data);
} }
}); });
...@@ -124,7 +118,6 @@ export default { ...@@ -124,7 +118,6 @@ export default {
// 跳转到原生的购买页面 // 跳转到原生的购买页面
confirm(goodId) { confirm(goodId) {
console.log(goodId);
let paramList = [ let paramList = [
{ {
key: "className", key: "className",
...@@ -147,9 +140,7 @@ export default { ...@@ -147,9 +140,7 @@ export default {
// 跳转I类学习详情页面(中华医学会项目列表页面) // 跳转I类学习详情页面(中华医学会项目列表页面)
jumpToCardList() { jumpToCardList() {
console.log(this.oneLevelUrl);
if (window.__isWeb) { if (window.__isWeb) {
console.log('in jumpToCardList');
return; return;
} else { } else {
let pageUrl = this.oneLevelUrl; let pageUrl = this.oneLevelUrl;
...@@ -159,6 +150,13 @@ export default { ...@@ -159,6 +150,13 @@ export default {
value: pageUrl, value: pageUrl,
type: 4, type: 4,
seqNo: 1 seqNo: 1
},
// 此字段不配置,则用原来的逻辑
{
key: "needCache",
value: '1', // 0不缓存,其它值都做缓存
type: 4,
seqNo: 1
} }
] ]
rocNative.dispatchEventByModuleCode({ rocNative.dispatchEventByModuleCode({
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
:tabTo="1" :tabTo="1"
:isShow="isShow" :isShow="isShow"
:userMobile="userMobile" :userMobile="userMobile"
:provinceId="provinceId"
:organizationId="organizationId"
></CoopListItem> ></CoopListItem>
</section> </section>
<section v-if="tabIndex === 2"> <section v-if="tabIndex === 2">
...@@ -49,6 +51,8 @@ ...@@ -49,6 +51,8 @@
:tabTo="2" :tabTo="2"
:isShow="isShow" :isShow="isShow"
:userMobile="userMobile" :userMobile="userMobile"
:provinceId="provinceId"
:organizationId="organizationId"
></CoopListItem> ></CoopListItem>
</section> </section>
</article> </article>
...@@ -100,6 +104,8 @@ export default { ...@@ -100,6 +104,8 @@ export default {
needShowBackup: false, needShowBackup: false,
showGoUpdate: false, showGoUpdate: false,
oneLevelUrl: '', oneLevelUrl: '',
provinceId: 0,
organizationId: 0,
}; };
}, },
computed: { computed: {
......
...@@ -117,6 +117,7 @@ ...@@ -117,6 +117,7 @@
:btnText="project.currentProgress > 1 ? '参加考试' : '学完全部课程,可参加考试'" :btnText="project.currentProgress > 1 ? '参加考试' : '学完全部课程,可参加考试'"
:type="project.currentProgress > 1 ? 'primary' : 'disabled'"></ExjumperButton> :type="project.currentProgress > 1 ? 'primary' : 'disabled'"></ExjumperButton>
<div v-if="project.cmeType == 2" style="padding-top: 30px"></div> <div v-if="project.cmeType == 2" style="padding-top: 30px"></div>
<CardPopup :cardInfo="cardInfo" :isShow="showGoUpdate" @cancle="jumpToCardList()" @confirm="confirm"></CardPopup>
</div> </div>
</template> </template>
<script> <script>
...@@ -144,6 +145,7 @@ import { getWebPageUrl, gotoPage } from "@/utils/index"; ...@@ -144,6 +145,7 @@ import { getWebPageUrl, gotoPage } from "@/utils/index";
import { mapGetters, mapActions } from "vuex"; import { mapGetters, mapActions } from "vuex";
import vueFilters from "@/utils/filter"; import vueFilters from "@/utils/filter";
import { Toast } from 'vant'; import { Toast } from 'vant';
import CardPopup from "@/components/cme/card-popup";
let cataOffsetTop = 0; let cataOffsetTop = 0;
let intorOffsetTop = 0; let intorOffsetTop = 0;
...@@ -231,8 +233,14 @@ export default { ...@@ -231,8 +233,14 @@ export default {
courseRequire: 0, courseRequire: 0,
clientType: 0, clientType: 0,
// currentProgress>1时考试按钮显示并可用 // currentProgress>1时考试按钮显示并可用
btnType: 'primary', // primary: 可跳转时(currentProgress = 1); disabled: 不可跳转时 btnType: 'primary', // primary: 可跳转时(currentProgress = 1); disabled: 不可跳转时
btnText: '学完全部课程,可参加考试' // 参加考试(currentProgress = 1); 或者学完全部课程,可参加考试 btnText: '学完全部课程,可参加考试', // 参加考试(currentProgress = 1); 或者学完全部课程,可参加考试
provinceId: '',
organizationId: '',
showGoUpdate: false,
cardInfo: {
},
}; };
}, },
components: { components: {
...@@ -250,7 +258,8 @@ export default { ...@@ -250,7 +258,8 @@ export default {
TeacterIntro, TeacterIntro,
CommonDialog, CommonDialog,
ExjumperButton, ExjumperButton,
ExjumperDialog ExjumperDialog,
CardPopup
}, },
computed: { computed: {
...@@ -262,6 +271,8 @@ export default { ...@@ -262,6 +271,8 @@ export default {
this.from = this.$route.query.from || this.from || "native"; this.from = this.$route.query.from || this.from || "native";
this.projectId = this.$route.query.id || 1; this.projectId = this.$route.query.id || 1;
this.courseRequire = this.$route.query.courseRequire; this.courseRequire = this.$route.query.courseRequire;
this.provinceId = this.$route.query && this.$route.query.provinceId || 0;
this.organizationId = this.$route.query && this.$route.query.organizationId || 0;
window.__getUserInfo64Comp = function(param) { window.__getUserInfo64Comp = function(param) {
// appVersion 安卓 3.2.2 iOS // appVersion 安卓 3.2.2 iOS
...@@ -288,7 +299,11 @@ export default { ...@@ -288,7 +299,11 @@ export default {
// action: "打开页面", // action: "打开页面",
component_tag: `211#0#${this.projectId}#0` component_tag: `211#0#${this.projectId}#0`
}); });
window.__getPositionData = function(param) {
console.log(param);
param.setEntry = true;
_this.getProvinceIdByPosition(param);
}
}, },
mounted() { mounted() {
window.addEventListener("scroll", this.scrollFun); window.addEventListener("scroll", this.scrollFun);
...@@ -306,17 +321,130 @@ export default { ...@@ -306,17 +321,130 @@ export default {
if(this.project.firstIntoExam) { if(this.project.firstIntoExam) {
this.isShowEJDialog = true; this.isShowEJDialog = true;
} else { } else {
this.jumpToExamAction(); this.isBuy(2);
// this.jumpToExamAction();
} }
}, },
// 第一次跳转弹框,点击时调用相应接口 // 第一次跳转弹框,点击时调用相应接口
handlerEJAction() { handlerEJAction() {
this.isShowEJDialog = false; this.isShowEJDialog = false;
this.jumpToExamAction(); this.isBuy(2);
// this.jumpToExamAction();
this.firstIntoExamAction(); this.firstIntoExamAction();
}, },
// 判断用户是否购买过I类学习卡
isBuy(cardType) {
let param = {
cardType: cardType,
setEntry: true,
}
this.GET("trade/storage/card/isBuy", param).then(res => {
if (res.code == "000000") {
// 如果购买过,则直接跳转到中华医学会页面
if(res.data) {
this.jumpToCardList();
} else {
this.preJumper();
}
}
});
},
// 跳转II类学习详情页面(中华医学会项目详情页面)
jumpToCardList() {
if (window.__isWeb) {
return;
} else {
let pageUrl = this.project.examBtnUrl;
let paramList = [
{
key: "pageUrl",
value: pageUrl,
type: 4,
seqNo: 1
},
// 此字段不配置,则用原来的逻辑
{
key: "needCache",
value: '1', // 0不缓存,其它值都做缓存
type: 4,
seqNo: 1
}
]
rocNative.dispatchEventByModuleCode({
modeCode: "M300",
jsonString: paramList
});
}
},
// 跳转前判断是否有机构,否则使用定位信息
preJumper() {
if(this.organizationId != 0 && this.provinceId != 0) {
this.getCardInfoByProvinceId(this.provinceId);
} else {
this.getPositionData();
}
},
// 根据位置信息获取省ID
getProvinceIdByPosition(param) {
param.setEntry = true;
this.POST("aggregate/cme/convertLocationToProvinceId", param).then(res => {
if (res.code == "000000") {
this.getCardInfoByProvinceId(res.data);
}
});
},
// 根据省ID,获取学习卡信息
getCardInfoByProvinceId(provinceId) {
let param = {
"area": provinceId + '',
"cardType": 1,
"pageNum": 1,
"pageSize": 1
}
this.POST("trade/goods/cardList", param).then(res => {
if (res.code == "000000") {
this.showGoUpdate = true;
this.cardInfo = res.data && res.data[0] || {} ;
}
});
},
// 获取地理位置信息
getPositionData() {
console.log('getPositionData');
rocNative.getPositionData({
__funcName: "__getPositionData"
});
},
// 跳转到原生的购买页面
confirm(goodId) {
let paramList = [
{
key: "className",
value: "com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC",
type: 4,
seqNo: 1
},
{
key: "goodId",
value: goodId,
type: 4,
seqNo: 1
},
];
rocNative.dispatchEventByModuleCode({
modeCode: "M200",
jsonString: paramList
});
},
// 跳转到第三方考试页面 // 跳转到第三方考试页面
jumpToExamAction() { jumpToExamAction() {
// 判断版本号,如果小于3.4.0,则只做提示 // 判断版本号,如果小于3.4.0,则只做提示
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册