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

bug修复,服务端渲染等

上级 503efe8c
<!-- 课程时长统计 -->
<template>
<div>
<ul class="lr-course-times" v-show="maxDuration > avgDuration">
<li>
<p>
课程总时长
<span>(所有课程数 {{totalSize}}门)</span>
</p>
<ProcessBar :processDataObj="processDataObj" :maxValue="maxDuration" :value="maxDuration"></ProcessBar>
</li>
<li>
<p>平均学习时长</p>
<ProcessBar2 barColor="#FFB01A" :maxValue="maxDuration" :value="avgDuration"></ProcessBar2>
</li>
</ul>
<ul class="lr-course-times" v-show="avgDuration > maxDuration">
<li>
<p>
课程总时长
<span>(所有课程数 {{totalSize}}门)</span>
</p>
<ProcessBar :processDataObj="processDataObj" :maxValue="avgDuration" :value="maxDuration"></ProcessBar>
</li>
<li>
<p>平均学习时长</p>
<ProcessBar2 barColor="#FFB01A" :maxValue="avgDuration" :value="avgDuration"></ProcessBar2>
</li>
</ul>
</div>
</template>
<script>
import ProcessBar from "@/components/common/pica-process";
import ProcessBar2 from "@/components/common/pica-process2";
export default {
props: {
totalSize: {
type: Number | String,
default: 0
},
maxDuration: {
type: Number | String,
default: 100
},
avgDuration: {
type: Number | String,
default: 100
},
processDataObj: {
type: Object,
default: () => {
return {
maxValue: 100,
value: 0
}
}
},
},
components: {
ProcessBar,
ProcessBar2
},
methods: {}
};
</script>
<style lang="scss" scoped>
.lr-course-times {
margin: 20px 15px;
li {
margin: 20px 0;
p {
height: 14px;
line-height: 14px;
margin: 6px 0;
font-size: 14px;
color: #676869;
span {
font-size: 14px;
font-weight: 400;
color: #979899;
}
}
}
}
</style>
<!-- 完成项目考试次数情况 -->
<template>
<div class="exam-times-wrapper">
<ul class="title">
<li>考试次数(次)</li>
<li>考试人数(个)</li>
</ul>
<ul class="list">
<li v-for="(item, index) in rankList" :key="index">
<span>{{index + 1}}</span>
<span>88</span>
</li>
</ul>
</div>
</template>
<script>
export default {
props: {
rankList: {
type: Array,
default: () => [
{
province: "福建省",
order: 1
},
{
province: "福建省",
order: 1
},
{
province: "福建省",
order: 1
},
{
province: "福建省",
order: 1
}
]
}
},
methods: {
getRankImgUrl(index) {
return require(`../../assets/images/rank-${index + 1}.png`);
}
}
};
</script>
<style scoped lang="scss">
.exam-times-wrapper {
font-size: 14px;
.title {
display: flex;
flex-direction: row;
margin: 0 15px;
justify-content: center;
height: 60px;
line-height: 60px;
border-bottom: 1px solid #f0f1f2;
// background: #e3efed;
// border-radius: 6px 6px 0px 0px;
li {
font-size: 14px;
font-weight: 400;
color: #449284;
}
li:nth-child(1) {
text-align: center;
flex: 1;
}
li:nth-child(2) {
flex: 1;
text-align: center;
}
}
.list {
font-size: 16px;
margin: 0 15px 20px;
li {
display: flex;
flex-direction: row;
height: 60px;
line-height: 60px;
// justify-content: space-between;
border-bottom: 1px solid #f0f1f2;
span {
font-weight: 400;
color: #373839;
}
span:nth-child(1) {
flex: 1;
text-align: center;
}
span:nth-child(2) {
flex: 1;
text-align: center;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="pop-notice-wrapper">
<div class="mask"></div>
<div class="content">
<div class="top">
<span class="title">公告提醒</span>
<span class="body">该项目已于2019年12月1日<span class="b">停止发放项目证书</span>,但仍可以继续学习该项目</span>
</div>
<div class="line"></div>
<div class="bottom">
<span @click="clickNotice">我知道了</span>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
};
},
props: {
popText: {
type: String,
default: ""
},
btnText: {
type: String,
default: ""
}
},
methods: {
clickNotice() {
this.$emit('clickNotice')
}
},
};
</script>
<style lang="scss" scoped>
@import "../../style/mixin";
.pop-notice-wrapper {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 110;
font-size: px2rem(20px);
.mask {
position: absolute;
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
z-index: 111;
}
.content {
position: absolute;
left: 50%;
top: 50%;
z-index: 112;
width: px2rem(300px);
height: px2rem(185px);
margin: px2rem(-150px) 0 0 px2rem(-150px);
border-radius: px2rem(7px);
text-align: center;
background: #fff;
.top {
padding: px2rem(30px);
.title {
display: block;
font-size: px2rem(18px);
height: px2rem(18px);
line-height: px2rem(18px);
font-weight: 400;
color: #333333;
}
.body {
text-align: left;
display: block;
margin: px2rem(14px) 0;
font-size: px2rem(14px);
height: px2rem(21px);
line-height: px2rem(21px);
font-weight: 400;
color: #676869;
.b {
font-weight: 700;
}
}
}
.line {
width: px2rem(300px);
height: px2rem(1px);
background:rgba(240,241,242,1);
}
.bottom {
text-align: center;
// margin-top: px2rem(14px);
font-size: px2rem(17px);
height: px2rem(50px);
line-height: px2rem(50px);
font-weight: 400;
span {
color: #449284;
}
}
}
}
</style>
......@@ -40,7 +40,7 @@ export default {
}),
isNotVisible() {
console.log('this.areaDegree', this.areaDegree)
if(this.orgList.length == 0 || this.areaDegree == 0 || this.areaDegree == 1 || this.areaDegree == 2) {
if((this.orgList && this.orgList.length == 0) || this.areaDegree == 0 || this.areaDegree == 1 || this.areaDegree == 2) {
// if(this.areaDegree == 0 || this.areaDegree == 1 || this.areaDegree == 2) {
return true;
} else {
......
<template>
<section :class="isFixNavbar ? 'nav-top fixed' : 'nav-top'" :style="'height:' + navHeight">
<div
class="nav-part"
:style="'background:' + bgColor + ';'
+ 'padding-top:' + paddingTop + ';border-bottom:' + borderStyle"
>
<div class="nav-title">
<span class="nav-back" @click="goBack">
<img v-show="isBlack" src="../../assets/images/left-arrow-black.png" alt="">
<img v-show="!isBlack" src="../../assets/images/left-arrow-black.png" alt="">
</span>
<span class="nav-title-title" v-show="bgColor!=='none'">{{title}}</span>
<span v-show="isShowShare" class="nav-share" @click="goShare">
<img
src="https://pica-pro.oss-cn-shanghai.aliyuncs.com/eagle_plan/courses/Group17_hover%403x.png"
>
</span>
</div>
</div>
</section>
</template>
<script>
export default {
name: "common-navbar",
data() {
return {
navbarHeight: 28,
contentHeight: 35,
fontSize: 37.5,
content: "",
shareImageUrl:
"https://file.yunqueyi.com/logo.png?version=" + new Date().getTime()
};
},
props: {
bgColor: {
type: String,
default: ""
},
title: {
type: String,
default: "暂无数据"
},
isFixNavbar: {
//是否fix定位
type: Boolean,
default: false
},
burialPoint: {
default: "",
type: String
},
backMethod: {
type: String,
default: "native" // inner native
},
isShowShare: {
type: Boolean,
default: false
},
borderStyle: {
type: String,
default: "1px solid #e7e7e7"
},
isBlack: {
type: Boolean,
default: true
}
},
computed: {
navHeight() {
if (this.isFixNavbar) {
return 0;
} else {
return (this.navbarHeight + this.contentHeight) / this.fontSize + "rem";
}
},
paddingTop() {
return this.navbarHeight / this.fontSize + "rem";
}
},
mounted() {
let htmlDom = document.getElementsByTagName("html")[0].style.fontSize;
this.fontSize = htmlDom;
},
methods: {
//返回
goBack() {
rocNative.goBack();
},
//分享
goShare() {
let url = location.href,
_this = this;
rocNative.shareWechat({
type: 6,
shareId: 0,
shareUrl: 'shareUrl',
title1: "this.shareTitle1",
title2: "this.shareTitle2",
shareImageUrl: "https://file.yunqueyi.com/logo.png?version=" + new Date().getTime()
});
}
}
};
</script>
<style lang="scss" scoped>
.back {
position: absolute;
left: 0px;
top: 15px;
display: inline-block;
width: 50px;
height: 50px;
img {
padding: 10px;
width: 20px;
height: 20px;
}
}
.nav-top {
// height: 65px;
background: #fff;
color: #333;
position: relative;
z-index: 109;
.nav-back {
display: inline-block;
position: absolute;
left: 0px;
top: 0;
height: 25px;
width: 55px;
padding-left: 15px;
padding-right: 15px;
// -ms-transform: translate(180deg);
// -webkit-transform: (180deg);
// transform: rotate(180deg);
}
img {
display: block;
height: 25px;
width: 25px;
}
.nav-icon {
display: inline-block;
width: 50px;
height: 50px;
svg {
stroke: #000;
fill: #0000ff;
}
}
.nav-share {
position: absolute;
right: 16px;
top: 0;
height: 25px;
width: 25px;
}
.nav-title {
position: relative;
top: 10px;
left: 0;
display: inline-block;
width: 100%;
/* padding:0 33px;*/
height: 36px;
&-title {
height: 18px;
font-size: 18px;
font-weight: 700;
color: rgba(51, 51, 51, 1);
line-height: 26px;
}
}
.nav-part {
width: 100%;
font-size: 18px;
text-align: center;
padding: 0 0 10px 0;
/* height: 25px;*/
}
}
.nav-part {
position: fixed;
top: 0;
left: 0;
border-bottom: 1px solid #e7e7e7;
/* height: 25px;*/
}
</style>
\ No newline at end of file
<!-- Tabs组件 -->
<template>
<div class="common-header">
<span class="left" @click="back">
<img style="width:20px;height:20px;" src="../../assets/images/left-arrow-black.png" />
</span>
<span class="center">{{title}}</span>
<span v-show="needRightBtn" class="right" @click="back">
<!-- <img src="../../assets/images/left-array-black.png" /> -->
</span>
</div>
</template>
<script>
export default {
props: {
title: {
type: String,
default: "2019基础高血压管理"
},
needRightBtn: {
type: Boolean,
default: true
}
},
methods: {
back() {
if(this.$rocNative.isWeb) {
this.$router.back(-1);
} else {
this.$rocNative.goBack();
}
}
}
};
</script>
<style lang="scss" scoped>
.common-header {
display: flex;
margin-top: 45px;
width: 100%;
height: 90px;
line-height: 44px;
flex-direction: row nowrap;
align-content: center;
align-items: center;
text-align: center;
justify-content: center; /* 水平居中 */
font-size: 17px;
// span {
// display: block;
// }
.left {
width: 60px;
box-sizing: border-box;
text-align: left;
// padding-top: 10px;
padding-left: 15px;
height: 44px;
line-height: 44px;
font-size: 17px;
img {
font-size: 17px;
// display: inherit;
width: 20px;
height: 20px;
}
}
.center {
flex: 1;
font-size: 17px;
font-weight: 700;
color: #030303;
}
.right {
width: 60px;
}
img {
font-size: 17px;
// display: inherit;
width: 20px;
height: 20px;
}
}
</style>
<!-- Swipter的子组件 -->
<template>
<section class="common-swiper-item">
<article class="middle">
<div class="title">
<span>获证率</span>
<span>
<img src="../../assets/images/tips-1.png" />
</span>
</div>
<div class="ratio">
<span>{{(percentData.certificateRate * 100).toFixed(0)}}%</span>
</div>
<div class="statics">
<span>已获证人数 {{percentData.finishCount}}</span>
<span>应参与人数 {{percentData.doctorCount}}</span>
</div>
</article>
<article class="mini">
<div class="item">
<div class="wrapper">
<span>
<div class="desc">人员参与率</div>
<div class="ratio">{{(percentData.doctorRate * 100).toFixed(0)}}%</div>
</span>
<img src="../../assets/images/tips-2.png" />
</div>
<span class="desc-num">已参与人数 {{percentData.joinCount}}</span>
<span class="desc-num">应参与人数 {{percentData.doctorCount}}</span>
</div>
<div class="item">
<div class="wrapper">
<span>
<div class="desc">机构参与率</div>
<div class="ratio">{{(percentData.hospitalRate * 100).toFixed(0)}}%</div>
</span>
<img src="../../assets/images/tips-3.png" />
</div>
<span class="desc-num">已参与机构数 {{percentData.hospitalJoinCount}}</span>
<span class="desc-num">应参与机构数 {{percentData.hospitalCount}}</span>
</div>
</article>
</section>
</template>
<script>
export default {
props: {
percentData: {
type: Object,
default: () => {
return {
doctorCount: 0,
joinCount: 0,
finishCount: 0,
hospitalCount: 0,
hospitalJoinCount: 0,
certificateRate: 0,
doctorRate: 0,
hospitalRate: 0
}
}
}
},
watch: {
percentData: {
handler(newValue, oldValue) {
return newValue
},
deep: true
}
},
methods: {}
};
</script>
<style lang="scss" scoped>
.common-swiper-item {
font-size: 20px;
margin-top: 20px;
display: block;
.middle {
display: block;
box-sizing: border-box;
// width: 100%;
height: 120px;
margin: 5px 15px;
// width: 345px;
height: 128px;
padding: 20px 15px;
// background: #b4d4ce;
background: linear-gradient(
180deg,
rgba(6, 190, 182, 1) 0%,
rgba(72, 177, 191, 1) 100%
);
box-shadow: 0px 5px 10px 0px rgba(68, 146, 132, 0.1);
border-radius: 6px;
border: 1px solid rgba(180, 212, 206, 1);
.ratio {
height: 24px;
line-height: 24px;
width: 100px;
margin: 10px 0 24px;
// height: 80px;
span {
display: inline-block;
height: 24px;
line-height: 24px;
color: #fff;
font-size: 24px;
}
}
.title,
.statics {
display: flex;
justify-content: space-between;
height: 14px;
line-height: 14px;
span {
color: #fff;
font-size: 14px;
}
img {
width: 30px;
height: 30px;
}
}
}
.mini {
display: flex;
justify-content: space-between;
margin: 9px 15px;
.item {
display: inline-block;
width: 135px;
height: 95px;
padding: 15px;
background: #000;
border-radius: 6px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 5px 15px 0px rgba(0, 0, 0, 0.04);
border: 1px solid rgba(231, 232, 233, 1);
.wrapper {
display: flex;
justify-content: space-between;
margin-bottom: 18px;
.desc {
height: 12px;
line-height: 12px;
font-size: 12px;
font-weight: 700;
color: #676869;
}
.ratio {
height: 21px;
line-height: 21px;
font-size: 21px;
font-weight: 700;
color: #449284;
padding-top: 10px;
}
img {
width: 30px;
height: 30px;
}
}
.desc-num {
display: block;
height: 12px;
line-height: 12px;
font-size: 12px;
margin-top: 8px;
color: #979899;
}
}
}
}
</style>
......@@ -86,8 +86,10 @@ export default {
default: 0
}
},
data: {
isAndroid: false
data() {
return {
isAndroid: false
}
},
watch: {
percentData: {
......
......@@ -176,7 +176,7 @@ export default {
},
watch: {
projectId(newVal) {
this.queryParams.provinceId = newVal;
this.queryParams.projectId = newVal;
// this.getProvinceData(this.queryParams);
},
provinceList(newVal) {
......@@ -199,7 +199,7 @@ export default {
async getHospitalsByRegionId(params) {
await getHospitalsByRegionId(params).then(res => {
if (res.code === "000000") {
this.setOrgList(res.data.list)
this.setOrgList(res.data.list || [])
}
});
},
......
......@@ -62,7 +62,7 @@ export default {
watch: {
orgList: {
handler(newList) {
this.dataList = newList;
this.dataList = newList || [];
this.dataList.map(a => {
a.selected = false;
});
......
......@@ -24,22 +24,22 @@ export default {
needRightBtn: true,
token: "",
// 查询概况数据
queryGDParams: {
appSelectType: 2,
beginDate: "",
endDate: "",
hospitalIdList: [],
originalFlag: 1, // 默认值0:0不查看原始数据
projectId: 374,
regionId: "",
timeFlag: 1,
pageNo: 0,
pageSize: 0,
sourceType: 1,
pageCfg: {
type: 1
}
},
// queryGDParams: {
// appSelectType: 2,
// beginDate: "",
// endDate: "",
// hospitalIdList: [],
// originalFlag: 1, // 默认值0:0不查看原始数据
// projectId: 374,
// regionId: "",
// timeFlag: 1,
// pageNo: 0,
// pageSize: 0,
// sourceType: 1,
// pageCfg: {
// type: 1
// }
// },
allData: {},
dataList: [],
dropdownList: [{
......@@ -61,34 +61,63 @@ export default {
CommonNoMore,
ExamScoreList
},
async asyncData( { query } ) {
let queryGDParams = {
appSelectType: 2,
beginDate: "",
endDate: "",
hospitalIdList: [],
originalFlag: 1, // 默认值0:0不查看原始数据
projectId: 374,
regionId: "",
timeFlag: 1,
pageNo: 0,
pageSize: 0,
sourceType: 1,
pageCfg: {
type: 1
}
};
let hospitalIdList = query.hospitalIdList || ''
queryGDParams.projectId = query.projectId || '';
queryGDParams.regionId = query.regionId || '';
queryGDParams.hospitalIdList = hospitalIdList && hospitalIdList.split(',') || [];
cookies.set("token", query.token || '');
let examData = await getGeneralExam(queryGDParams);
console.log(examData);
return {
allData: examData.data,
dataList: examData.data && examData.data.examScoreList || [],
title: `共${examData.data && examData.data.examScoreList && examData.data.examScoreList.length || 0}条数据`
}
},
created() {
if (process.client) {
if(this.$route && this.$route.query) {
let cQuery = this.$route.query
this.queryGDParams.projectId = cQuery.projectId || '';
this.queryGDParams.regionId = cQuery.regionId || '';
let hospitalIdList = cQuery.hospitalIdList || ''
this.queryGDParams.hospitalIdList = hospitalIdList && hospitalIdList.split(',') || [];
cookies.set("token", cQuery.token || '');
this.getGeneralExam(this.queryGDParams);
}
// if(this.$route && this.$route.query) {
// let cQuery = this.$route.query
// this.queryGDParams.projectId = cQuery.projectId || '';
// this.queryGDParams.regionId = cQuery.regionId || '';
// let hospitalIdList = cQuery.hospitalIdList || ''
// this.queryGDParams.hospitalIdList = hospitalIdList && hospitalIdList.split(',') || [];
// cookies.set("token", cQuery.token || '');
// this.getGeneralExam(this.queryGDParams);
// }
}
},
mounted() {
},
methods: {
// 考试分析
async getGeneralExam(queryData) {
await getGeneralExam(queryData).then(res => {
if (res.code === "000000") {
this.allData = res.data;
this.dataList = res.data.examScoreList;
this.title = `共${this.dataList.length}条数据`;
}
});
},
// // 考试分析
// async getGeneralExam(queryData) {
// await getGeneralExam(queryData).then(res => {
// if (res.code === "000000") {
// this.allData = res.data;
// this.dataList = res.data.examScoreList;
// this.title = `共${this.dataList.length}条数据`;
// }
// });
// },
selectSortItem(type) {
if(type == 1) {
this.dataList = this.allData.examScoreList || [];
......
<template>
<section>
<CommonHeader title="完成项目考试次数情况"></CommonHeader>
<CommonTitleMini :title="title" :needRightBtn="needRightBtn"></CommonTitleMini>
<ExamTimesList :dataList="dataList"></ExamTimesList>
<CommonNoMore class="mt-10"></CommonNoMore>
</section>
</template>
<script>
const cookies = require("cookie-universal")();
import { getGeneralExam } from "@/service";
import CommonHeader from "@/components/common/common-header";
import CommonTitleMini from "@/components/common/common-title-mini";
import CommonNoMore from "@/components/common/common-no-more";
import ExamTimesList from "@/components/bussiness/exam-times-list";
export default {
data() {
return {
title: "共0条数据",
needRightBtn: false,
token: "",
queryGDParams: {
appSelectType: 1,
beginDate: "",
endDate: "",
hospitalIdList: [],
originalFlag: 1, // 默认值0:0不查看原始数据
projectId: 374,
regionId: "",
timeFlag: 1,
pageNo: 0,
pageSize: 0,
sourceType: 1,
pageCfg: {
type: 1
}
},
dataList: []
};
},
components: {
CommonHeader,
CommonTitleMini,
CommonNoMore,
ExamTimesList
},
async asyncData( { query } ) {
let queryGDParams = {
appSelectType: 1,
beginDate: "",
endDate: "",
hospitalIdList: [],
originalFlag: 1, // 默认值0:0不查看原始数据
projectId: 374,
regionId: "",
timeFlag: 1,
pageNo: 0,
pageSize: 0,
sourceType: 1,
pageCfg: {
type: 1
}
};
let hospitalIdList = query.hospitalIdList || ''
queryGDParams.projectId = query.projectId || '';
queryGDParams.regionId = query.regionId || '';
queryGDParams.hospitalIdList = hospitalIdList && hospitalIdList.split(',') || [];
cookies.set("token", query.token || '');
let examData = await getGeneralExam(queryGDParams);
console.log(examData);
return {
dataList: examData.data && examData.data.examTimesList,
title: `共${(examData.data && examData.data.examTimesList.length) || 0}条数据`
}
},
created() {
if (process.client) {
// if(this.$route && this.$route.query) {
// let cQuery = this.$route.query
// let hospitalIdList = cQuery.hospitalIdList || ''
// this.queryGDParams.projectId = cQuery.projectId || '';
// this.queryGDParams.regionId = cQuery.regionId || '';
// this.queryGDParams.hospitalIdList = hospitalIdList && hospitalIdList.split(',') || [];
// cookies.set("token", cQuery.token || '');
// this.getGeneralExam(this.queryGDParams);
// }
}
},
mounted() {
},
methods: {
// 考试分析
async getGeneralExam(queryData) {
await getGeneralExam(queryData).then(res => {
if (res.code === "000000") {
this.dataList = res.data.examTimesList;
this.title = `共${this.dataList.length}条数据`
}
});
},
}
};
</script>
<style lang="less" scoped>
.mt-10 {
margin-top: 10px !important;
}
</style>
\ No newline at end of file
......@@ -21,7 +21,17 @@ export default {
title: "共0条数据",
needRightBtn: false,
token: "",
queryGDParams: {
dataList: []
};
},
components: {
CommonHeader,
CommonTitleMini,
CommonNoMore,
ExamTimesList
},
async asyncData( { query } ) {
let queryGDParams = {
appSelectType: 1,
beginDate: "",
endDate: "",
......@@ -36,43 +46,47 @@ export default {
pageCfg: {
type: 1
}
},
dataList: []
};
},
components: {
CommonHeader,
CommonTitleMini,
CommonNoMore,
ExamTimesList
};
let hospitalIdList = query.hospitalIdList || ''
queryGDParams.projectId = query.projectId || '';
queryGDParams.regionId = query.regionId || '';
queryGDParams.hospitalIdList = hospitalIdList && hospitalIdList.split(',') || [];
cookies.set("token", query.token || '');
let examData = await getGeneralExam(queryGDParams);
console.log(examData);
return {
dataList: examData.data && examData.data.examTimesList,
title: `共${(examData.data && examData.data.examTimesList && examData.data.examTimesList.length) || 0}条数据`
}
},
created() {
if (process.client) {
if(this.$route && this.$route.query) {
let cQuery = this.$route.query
let hospitalIdList = cQuery.hospitalIdList || ''
this.queryGDParams.projectId = cQuery.projectId || '';
this.queryGDParams.regionId = cQuery.regionId || '';
this.queryGDParams.hospitalIdList = hospitalIdList && hospitalIdList.split(',') || [];
cookies.set("token", cQuery.token || '');
this.getGeneralExam(this.queryGDParams);
}
// if(this.$route && this.$route.query) {
// let cQuery = this.$route.query
// let hospitalIdList = cQuery.hospitalIdList || ''
// this.queryGDParams.projectId = cQuery.projectId || '';
// this.queryGDParams.regionId = cQuery.regionId || '';
// this.queryGDParams.hospitalIdList = hospitalIdList && hospitalIdList.split(',') || [];
// cookies.set("token", cQuery.token || '');
// this.getGeneralExam(this.queryGDParams);
// }
}
},
mounted() {
},
methods: {
// 考试分析
async getGeneralExam(queryData) {
await getGeneralExam(queryData).then(res => {
if (res.code === "000000") {
this.dataList = res.data.examTimesList;
this.title = `共${this.dataList.length}条数据`
}
});
},
// // 考试分析
// async getGeneralExam(queryData) {
// await getGeneralExam(queryData).then(res => {
// if (res.code === "000000") {
// this.dataList = res.data.examTimesList;
// this.title = `共${this.dataList.length}条数据`
// }
// });
// },
}
};
</script>
......
......@@ -218,6 +218,7 @@ export default {
allData: {},
projectId: "",
token:
"11B8076631AE45999D350EC08A7E66AE" ||
"A220943B006347799F277CC524EBB662" ||
"B10441890E2940499621C76667675B2D" ||
// "17B31C94D44947829097A953BC7C2732" ||
......
......@@ -49,6 +49,7 @@ export default {
ChartColumnHorizontalTCLong,
TipsInfo
},
// async asyncData( context ) { } // async方法,由于图标比较难实现,则放弃使用
created() {
if (process.client) {
......
/*
* @Author: souse
* @Date: 2019-08-12 18:08:07
* @Last Modified by: souse
* @Last Modified time: 2019-08-13 19:17:00
* @Descript 和app交互的接口调用 单例模式
*/
const ARRAY_CLASS = '[object Array]';
const _toString = Object.prototype.toString;
/**
* set default options
*/
export const JsBridgeOptions = {
GLOBAL_NAME: 'rocNative',
NATIVE_IOS_NAME: 'rociOS',
NATIVE_ANDROID_NAME: '__rocAndroid',
initMethodsWithCallBack: ['getToken', 'getUserInfo'], // value is string
initMethodsWithoutCallBack: ['gotoLogin', 'appInit', 'goBack', 'shareWechat', 'showNativeToast', 'dispatchEventByModuleCode', 'appBuryingPointEntrust', 'webLoadSuccess'] // value is string
}
/**
* @description
* @author souse
* @date 2019-08-12
* @export
* @class PicaJsBridge
*/
export default class PicaJsBridge {
constructor(options = JsBridgeOptions) {
const initMethodsWithCallBack = options.initMethodsWithCallBack;
const initMethodsWithoutCallBack = options.initMethodsWithoutCallBack;
this._callbakFns = {};
this._callbackId = 0;
this._GLOBAL_NAME = options.GLOBAL_NAME;
this._NATIVE_IOS_NAME = options.NATIVE_IOS_NAME;
this._NATIVE_ANDROID_NAME = options.NATIVE_ANDROID_NAME;
this.isIOS = this._isIos();
this.isAndroid = this._isAndroid();
this.isWeb = this._isWeb();
if (_toString.call(initMethodsWithCallBack) === ARRAY_CLASS && initMethodsWithCallBack.length !== 0) {
this.registerMethods(initMethodsWithCallBack, true);
}
if (_toString.call(initMethodsWithoutCallBack) === ARRAY_CLASS && initMethodsWithoutCallBack.length !== 0) {
this.registerMethods(initMethodsWithoutCallBack, false);
}
this.mountToWindow();
}
// is ios flag
_isIos() {
return !!(window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers[this._NATIVE_IOS_NAME]);
}
// is android flag
_isAndroid() {
return !!window[this._NATIVE_ANDROID_NAME];
}
// is web flag
_isWeb() {
return !this.isIOS && !this.isAndroid;
}
// register method width callback in window
_registerMethod(method) {
const _this = this;
_this[method] = (param) => {
return new Promise((response, reject) => {
_this._callNative(method, param, function(result) {
response(result);
}) ? void 0 : reject(`${method} not handled.`);
});
}
}
// register method widthout callback in window
_registerMethodWithoutMethod(method) {
const _this = this;
_this[method] = (param) => {
return new Promise((response, reject) => {
_this._callNative(method, param, null) ? response('success') : reject(`${method} not handled.`);
});
}
}
// window call app method
_callNative(name, param, callbackFn) {
debugger
let callbackId = 0, pm;
if (typeof callbackFn === 'function') {
this._callbackId++;
callbackId = this._callbackId;
this._callbakFns[callbackId] = callbackFn;
}
pm = JSON.stringify({
name,
callbackId: callbackId ? callbackId.toString() : '',
param: param || {}
});
if (this.isAndroid) {
window[this._NATIVE_ANDROID_NAME].postMessage(pm);
return true;
}
if (this.isIOS) {
window.webkit.messageHandlers[this._NATIVE_IOS_NAME].postMessage(pm);
return true;
}
return false;
}
// app call window method
__nativeCall(name, callbackId, result) {
const wFun = window[callbackId];
const fun = callbackId && this._callbakFns[callbackId];
//add by zhangping
if (wFun && typeof wFun === 'function') {
wFun(result);
return;
}
delete this._callbakFns[callbackId];
if (fun && typeof fun === 'function') fun(result);
}
// batch register methods
registerMethods(methods = [], widthCallback) {
if (undefined === widthCallback)
throw Error('widthCallback flag not defined, registerMethods should take second param value(true/false) for is not has callback.');
methods.forEach(m => {
widthCallback === true ? this._registerMethod(m) : this._registerMethodWithoutMethod(m)
});
}
// async call app method do not need register
asyncCallNative(method, param) {
const _this = this;
return new Promise(resolve => {
_this._callNative(method, param, function(result) {
resolve(result);
});
});
}
// call app method direct without register and callback
callNative(method, param) {
return this._callNative(method, param, null);
}
// register jsbridge to window
mountToWindow() {
window[this._GLOBAL_NAME] = this;
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册