Commit 91fb54e1 authored by 罗成兵's avatar 罗成兵

配置文件

parent 25e0aeb7
...@@ -4,7 +4,8 @@ import VueRouter from 'vue-router' ...@@ -4,7 +4,8 @@ import VueRouter from 'vue-router'
Vue.use(VueRouter) Vue.use(VueRouter)
const routes = [ const routes = [
{path: '/',name: 'provideUnit',component: () => import('../views/provideUnit/provideUnit.vue'),meta: { keepAlive: true,}}, {path: '/',name: 'index',component: () => import('../views/index/index.vue'),meta: { keepAlive: true,}},
{path: '/provideUnit',name: 'provideUnit',component: () => import('../views/provideUnit/provideUnit.vue'),meta: { keepAlive: true,}},
{path: '/receiveApply',name: 'receiveApply',component: () => import('../views/receiveApply/receiveApply.vue'),meta: { keepAlive: true, isBack: false,}}, {path: '/receiveApply',name: 'receiveApply',component: () => import('../views/receiveApply/receiveApply.vue'),meta: { keepAlive: true, isBack: false,}},
{path: '/informedConsentForm',name: 'informedConsentForm',component: () => import('../views/informedConsentForm/informedConsentForm.vue'),}, {path: '/informedConsentForm',name: 'informedConsentForm',component: () => import('../views/informedConsentForm/informedConsentForm.vue'),},
{path: '/applyRecord',name: 'applyRecord',component: () => import('../views/applyRecord/applyRecord.vue'),meta: { keepAlive: true, isBack: false}}, {path: '/applyRecord',name: 'applyRecord',component: () => import('../views/applyRecord/applyRecord.vue'),meta: { keepAlive: true, isBack: false}},
......
<template>
<div>
<div v-if="msg">
<br><br><br><br><br>
<van-empty image="error" :description="msg"/>
<van-button style="margin-left: 10%;width: 80%" round type="danger" color="#EC808D" @click="handleBack()">
返回
</van-button>
</div>
</div>
</template>
<script>
import {callMobile, isIOSWebKit} from '@/utils/common';
import {Dialog} from 'vant';
export default {
components: {},
data() {
return {
msg: null,
scrollPosition: 0,
}
},
created() {
let vm = this;
window['init'] = (result) => {
vm.initUserInfo(result);
vm.showMsg();
};
window['qrcodeContent'] = (result) => {
vm.scanQRCallBack(result);
};
},
mounted() {
if (process.env.NODE_ENV == "dev") {
let userInfo = {
account: '18487125843',
token: '7de354fd8be1484cacbc41e96fe88d7e',
userId: '11133351501171512',
};
window.sessionStorage.setItem('userInfo', JSON.stringify(userInfo));
this.showMsg();
} else {
let query = this.$route.query;
let userInfo = {
account: query.account,
token: query.token,
userId: query.userId,
};
if (!userInfo.userId && !userInfo.account) {
this.msg = "用户信息获取失败!"
callMobile('init', {});
} else {
if (!userInfo.userId || !userInfo.account) {
this.msg = "用户信息获取失败!"
return;
}
window.sessionStorage.setItem('userInfo', JSON.stringify(userInfo));
this.showMsg();
}
}
},
activated() {
window.scrollTo(0, this.scrollPosition);
},
methods: {
handleBack() {
callMobile('goIndex', {});
},
initUserInfo(val) {
let ios = isIOSWebKit();
if (ios) {
window.sessionStorage.setItem('userInfo', val);
} else {
window.sessionStorage.setItem('userInfo', JSON.stringify(val));
}
},
showMsg(){
Dialog.alert({
title: '温馨提示',
message: '备孕妇女从孕前3个月,坚持每天服用0.4mg叶酸或含叶酸的复合维生素至少到怀孕满3个月,可预防胎儿神经管缺陷的发生,还能减少唇腭裂、先心病、早产等风险。特殊情况妇女如肥胖、糖尿病等要加量。',
confirmButtonText: "好的,知道了"
}).then(() => {
this.$router.push('provideUnit');
});
}
},
beforeRouteLeave(to, from, next) {
this.scrollPosition = document.documentElement.scrollTop || document.body.scrollTop;
next();
},
}
</script>
<style lang="less" scoped>
</style>
\ No newline at end of file
<template> <template>
<div class="provideUnit"> <div class="provideUnit">
<!-- 头部 --> <!-- 头部 -->
<van-nav-bar fixed title="选择叶酸发放单位"> <van-nav-bar fixed title="选择叶酸发放单位">
<template #left> <template #left>
<img src="../../assets/images/back.png" alt="" @click="handleBack"/> <img src="../../assets/images/back.png" alt="" @click="handleBack"/>
</template> </template>
<template #right> <template #right>
<div @click="handleRecord">申请记录</div> <div @click="handleRecord">申请记录</div>
</template> </template>
</van-nav-bar> </van-nav-bar>
<!-- 搜索框 --> <!-- 搜索框 -->
<van-search @blur="handleInput" style="width: 88%;display: inline-block" @clear="handleCancel" <van-search @blur="handleInput" style="width: 88%;display: inline-block" @clear="handleCancel"
v-model="seachInfo.unitName" placeholder="请输入搜索关键词"/> v-model="seachInfo.unitName" placeholder="请输入搜索关键词"/>
<van-icon size="33" style="float: right;margin-right: 8px;" name="scan" @click="openQrCode"/> <van-icon size="33" style="float: right;margin-right: 8px;" name="scan" @click="openQrCode"/>
<!-- 申请部分 --> <!-- 申请部分 -->
<template v-if="unitList.length != 0"> <template v-if="unitList.length != 0">
<div class="flex_block" v-for="item in unitList" :key="item.id" @click="handleClick(item)"> <div class="flex_block" v-for="item in unitList" :key="item.id" @click="handleClick(item)">
<div class="flex_block_title"> <div class="flex_block_title">
<span class="top">{{ item.unitName }}</span> <span class="top">{{ item.unitName }}</span>
<span class="bottom">地址:{{ <span class="bottom">地址:{{
(item.areaFullName ? item.areaFullName : "") + (item.unitAddress ? item.unitAddress : "") (item.areaFullName ? item.areaFullName : "") + (item.unitAddress ? item.unitAddress : "")
}}</span> }}</span>
</div> </div>
<div class="flex_block_btn">申请</div> <div class="flex_block_btn">申请</div>
</div> </div>
</template> </template>
<van-empty v-else description="暂无发放单位"/> <van-empty v-else description="暂无发放单位"/>
</div> </div>
</template> </template>
<script> <script>
import {getProvideUnit, getProvideUnitById} from '@/axios/api'; import {getProvideUnit, getProvideUnitById} from '@/axios/api';
...@@ -34,178 +34,162 @@ import {callMobile, isIOSWebKit, isEmpty} from '@/utils/common'; ...@@ -34,178 +34,162 @@ import {callMobile, isIOSWebKit, isEmpty} from '@/utils/common';
import {Dialog} from 'vant'; import {Dialog} from 'vant';
export default { export default {
components: {}, components: {},
data() { data() {
return { return {
seachInfo: { seachInfo: {
unitName: '云南省', unitName: '云南省',
}, },
unitList: [], unitList: [],
scrollPosition: 0, scrollPosition: 0,
} }
},
created() {
let vm = this;
// window['init'] = (result) => {
// vm.initUserInfo(result);
// };
window['qrcodeContent'] = (result) => {
vm.scanQRCallBack(result);
};
},
mounted() {
this.getProvideUnitList();
},
activated() {
window.scrollTo(0, this.scrollPosition);
},
methods: {
handleInput(val) {
this.getProvideUnitList();
}, },
created() { handleCancel() {
Dialog.alert({ this.getProvideUnitList();
title: '温馨提示',
message: '备孕妇女从孕前3个月,坚持每天服用0.4mg叶酸或含叶酸的复合维生素至少到怀孕满3个月,可预防胎儿神经管缺陷的发生,还能减少唇腭裂、先心病、早产等风险。特殊情况妇女如肥胖、糖尿病等要加量。',
confirmButtonText: "好的,知道了"
}).then(() => {
});
let vm = this;
window['init'] = (result) => {
vm.initUserInfo(result);
};
window['qrcodeContent'] = (result) => {
vm.scanQRCallBack(result);
};
}, },
mounted() { openQrCode() {
if (process.env.NODE_ENV == "dev") { callMobile("qrcode", {});
let userInfo = { },
account: '18487125843', getProvideUnitList() {
token: '7de354fd8be1484cacbc41e96fe88d7e', this.$toast.open();
userId: '11133351501171512', let unitName = this.seachInfo.unitName;
}; if (isEmpty(unitName)) {
window.sessionStorage.setItem('userInfo', JSON.stringify(userInfo)); unitName = undefined;
} else { }
callMobile('init', {}); getProvideUnit(unitName).then(res => {
if (res.code === 'SUCCESS') {
if (res.data) {
this.unitList = res.data;
} else {
this.unitList = [];
}
} }
this.getProvideUnitList(); }).finally(() => {
this.$toast.close();
});
},
// 申请
handleClick(val) {
let areaFullName = val.areaFullName ? val.areaFullName : "";
let address = val.unitAddress ? val.unitAddress : "";
let unitAddress = areaFullName + address;
let applyUnitInfo = {
unitId: val.id,
unitName: val.unitName,
unitAddress: unitAddress,
};
window.sessionStorage.setItem('applyUnitInfo', JSON.stringify(applyUnitInfo));
this.$router.push('questionAnswer');
}, },
activated() { // 申请记录
window.scrollTo(0, this.scrollPosition); handleRecord() {
this.$router.push('applyRecord');
}, },
methods: { handleBack() {
handleInput(val) { callMobile('goIndex', {});
this.getProvideUnitList(); },
}, scanQRCallBack(qrContent) {
handleCancel() { if (!qrContent) {
this.getProvideUnitList(); this.$toast.success('无效的二维码');
}, return;
openQrCode() { }
callMobile("qrcode", {}); let qrContentArr = qrContent.split("?");
}, if (qrContentArr.length < 2) {
getProvideUnitList() { this.$toast.success('无效的二维码');
this.$toast.open(); return;
let unitName = this.seachInfo.unitName; }
if (isEmpty(unitName)) { getProvideUnitById(qrContentArr[1]).then(res => {
unitName = undefined; if (res.code === 'SUCCESS') {
} if (res.data) {
getProvideUnit(unitName).then(res => { let areaFullName = res.data.areaFullName ? res.data.areaFullName : "";
if (res.code === 'SUCCESS') { let unitAddress = res.data.unitAddress ? res.data.unitAddress : "";
if (res.data) {
this.unitList = res.data;
} else {
this.unitList = [];
}
}
}).finally(() => {
this.$toast.close();
});
},
// 申请
handleClick(val) {
let areaFullName = val.areaFullName ? val.areaFullName : "";
let address = val.unitAddress ? val.unitAddress : "";
let unitAddress = areaFullName + address;
let applyUnitInfo = { let applyUnitInfo = {
unitId: val.id, unitId: res.data.id,
unitName: val.unitName, unitName: res.data.unitName,
unitAddress: unitAddress, unitAddress: areaFullName + unitAddress,
}; };
window.sessionStorage.setItem('applyUnitInfo', JSON.stringify(applyUnitInfo)); window.sessionStorage.setItem('applyUnitInfo', JSON.stringify(applyUnitInfo));
this.$router.push('questionAnswer'); this.$router.push('questionAnswer');
} else {
}, this.$toast.success('无效的二维码');
// 申请记录 }
handleRecord() { }
this.$router.push('applyRecord'); })
},
handleBack() {
callMobile('goIndex', {});
},
scanQRCallBack(qrContent) {
if (!qrContent) {
this.$toast.success('无效的二维码');
return;
}
let qrContentArr = qrContent.split("?");
if (qrContentArr.length < 2) {
this.$toast.success('无效的二维码');
return;
}
getProvideUnitById(qrContentArr[1]).then(res => {
if (res.code === 'SUCCESS') {
if (res.data) {
let areaFullName = res.data.areaFullName ? res.data.areaFullName : "";
let unitAddress = res.data.unitAddress ? res.data.unitAddress : "";
let applyUnitInfo = {
unitId: res.data.id,
unitName: res.data.unitName,
unitAddress: areaFullName + unitAddress,
};
window.sessionStorage.setItem('applyUnitInfo', JSON.stringify(applyUnitInfo));
this.$router.push('questionAnswer');
} else {
this.$toast.success('无效的二维码');
}
}
})
},
initUserInfo(val) {
let ios = isIOSWebKit();
if (ios) {
window.sessionStorage.setItem('userInfo', val);
} else {
window.sessionStorage.setItem('userInfo', JSON.stringify(val));
}
},
}, },
beforeRouteLeave(to, from, next) { initUserInfo(val) {
this.scrollPosition = document.documentElement.scrollTop || document.body.scrollTop; let ios = isIOSWebKit();
next(); if (ios) {
window.sessionStorage.setItem('userInfo', val);
} else {
window.sessionStorage.setItem('userInfo', JSON.stringify(val));
}
}, },
},
beforeRouteLeave(to, from, next) {
this.scrollPosition = document.documentElement.scrollTop || document.body.scrollTop;
next();
},
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.provideUnit { .provideUnit {
padding-top: 52px; padding-top: 52px;
.flex_block { .flex_block {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin: 24px 24px 24px 16px; margin: 24px 24px 24px 16px;
.flex_block_title { .flex_block_title {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 90%; width: 90%;
.top { .top {
color: #262626; color: #262626;
font-size: 14px; font-size: 14px;
} }
.bottom { .bottom {
color: #595959; color: #595959;
font-size: 12px; font-size: 12px;
margin-top: 7px; margin-top: 7px;
} }
} }
.flex_block_btn { .flex_block_btn {
width: 48px; width: 48px;
height: 25px; height: 25px;
border: 1px solid #F5222D; border: 1px solid #F5222D;
border-radius: 24px; border-radius: 24px;
font-size: 12px; font-size: 12px;
color: #F5222D; color: #F5222D;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-left: 8px; margin-left: 8px;
}
} }
}
} }
</style> </style>
\ No newline at end of file
<template> <template>
<div> <div>
<!-- 头部 --> <!-- 头部 -->
<van-nav-bar fixed title="问卷"> <van-nav-bar fixed title="问卷">
<template #left> <template #left>
<img src="../../assets/images/back.png" alt="" @click="goBack"/> <img src="../../assets/images/back.png" alt="" @click="goBack"/>
</template> </template>
<template #right> <template #right>
<div></div> <div></div>
</template> </template>
</van-nav-bar> </van-nav-bar>
<br><br><br> <br><br><br>
<div class="content"> <div class="content">
<div> <div>
根据您的实际情况进行选择(可多选): 根据您的实际情况进行选择(可多选):
</div> </div>
<van-checkbox-group v-model="checkedList" checked-color="#F5222D"> <van-checkbox-group v-model="checkedList" checked-color="#F5222D">
<br> <br>
<span v-for="(item,index) in questionList"> <span v-for="(item,index) in questionList">
<van-checkbox shape="square" :name="item.value">{{ item.name }}</van-checkbox> <van-checkbox shape="square" :name="item.value">{{ item.name }}</van-checkbox>
<van-divider/> <van-divider/>
</span> </span>
</van-checkbox-group> </van-checkbox-group>
<p style="margin-left: 15%;color:#F5222D ">建议服用:{{ formData.recommendEat }}</p> <p style="margin-left: 15%;color:#F5222D ">建议服用:{{ formData.recommendEat }}</p>
<br> <br>
<div style="text-align: center"> <div style="text-align: center">
<van-row> <van-row>
<van-col span="12"> <van-col span="12">
<van-button style="width: 150px" round color="#EC808D" plain @click="onSubmit(1)">忽略 <van-button style="width: 150px" round color="#EC808D" plain @click="onSubmit(1)">忽略
</van-button> </van-button>
</van-col> </van-col>
<van-col span="12"> <van-col span="12">
<van-button style="width: 150px" round type="danger" color="#EC808D" @click="onSubmit(2)"> <van-button style="width: 150px" round type="danger" color="#EC808D" @click="onSubmit(2)">
提交问卷 提交问卷
</van-button> </van-button>
</van-col> </van-col>
</van-row> </van-row>
</div> </div>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import {getUserInfoLast} from '@/axios/api' import {getUserInfoLast} from '@/axios/api'
import { Notify } from 'vant';
export default { export default {
name: "questionAnswer", name: "questionAnswer",
data() { data() {
return { return {
checkedList: [], checkedList: [],
questionList: [{value: "1", name: "1、您是否患糖尿病?"}, {value: "2", name: "2、您是否患有癫痫?"}, questionList: [{value: "1", name: "1、您是否患糖尿病?"}, {value: "2", name: "2、您是否患有癫痫?"},
{value: "3", name: "3、您或丈夫是否患有神经管缺陷或曾有神经管缺陷生育史?"}, {value: "3", name: "3、您或丈夫是否患有神经管缺陷或曾有神经管缺陷生育史?"},
{value: "4", name: "4、您是否患有同型半胱氨酸血症?"}, {value: "4", name: "4、您是否患有同型半胱氨酸血症?"},
{value: "5", name: "5、您是否患有先天性脑积水、先天性心脏病、唇腭裂、肢体缺陷、泌尿系统缺陷?"}, {value: "5", name: "5、您是否患有先天性脑积水、先天性心脏病、唇腭裂、肢体缺陷、泌尿系统缺陷?"},
{value: "6", name: "6、您的一二级直系女性亲属是否有神经管缺陷生育史?"}, {value: "6", name: "6、您的一二级直系女性亲属是否有神经管缺陷生育史?"},
{ {
value: "7", value: "7",
name: "7、您是否正在服用以下药物:卡马西平、丙戊酸、苯妥英钠、二甲双胍、扑米酮、苯巴比妥、甲氨蝶呤、柳氮磺胺吡啶、甲氧咔啶、氨苯蝶啶、考来烯胺?" name: "7、您是否正在服用以下药物:卡马西平、丙戊酸、苯妥英钠、二甲双胍、扑米酮、苯巴比妥、甲氨蝶呤、柳氮磺胺吡啶、甲氧咔啶、氨苯蝶啶、考来烯胺?"
}, },
{value: "8", name: "8、你是否患有胃肠道吸收不良?"}], {value: "8", name: "8、你是否患有胃肠道吸收不良?"}],
formData: {recommendEat: "2颗/天(0.8mg/天)"}, formData: {recommendEat: "2颗/天(0.8mg/天)"},
}
},
watch: {
checkedList(checkedList) {
this.formData.recommendEat = '2颗/天(0.8mg/天)';
checkedList.forEach(x => {
if (x == '3') {
this.formData.recommendEat = "10颗/天(4mg/天)";
} }
}, if (x == '4') {
watch: { this.formData.recommendEat = "13颗/天(5.2mg/天)";
checkedList(checkedList) {
this.formData.recommendEat = '2颗/天(0.8mg/天)';
checkedList.forEach(x => {
if (x == '3') {
this.formData.recommendEat = "10颗/天(4mg/天)";
}
if (x == '4') {
this.formData.recommendEat = "13颗/天(5.2mg/天)";
}
})
} }
})
}
},
mounted() {
this.getLastRecord();
},
methods: {
// 返回
goBack() {
this.$router.push('provideUnit');
}, },
mounted() { getLastRecord() {
this.getLastRecord(); let userInfo = JSON.parse(sessionStorage.getItem('userInfo'))
}, if (!userInfo){
methods: { Notify({ type: 'warning', message: '用户信息获取失败!' });
// 返回 return
goBack() { }
this.$router.push('provideUnit'); this.$toast.open();
}, getUserInfoLast(userInfo.userId).then(res => {
getLastRecord() { if (res.code === 'SUCCESS') {
this.$toast.open(); if (res.data) {
let userInfo = JSON.parse(sessionStorage.getItem('userInfo')); this.formData = res.data;
getUserInfoLast(userInfo.userId).then(res => { let {presentCode} = res.data;
if (res.code === 'SUCCESS') { this.formData.presentCode = presentCode;
if (res.data) { if (this.formData.question) {
this.formData = res.data; this.checkedList = this.formData.question.split(",");
let {presentCode} = res.data;
this.formData.presentCode = presentCode;
if (this.formData.question) {
this.checkedList = this.formData.question.split(",");
}
if (!this.formData.recommendEat) {
this.formData.recommendEat = "2颗/天(0.8mg/天)";
}
}
}
}).finally(() => {
this.$toast.close();
});
},
onSubmit(type) {
if (type == 1) {
this.formData.question = null;
sessionStorage.setItem("lastRecord", JSON.stringify(this.formData));
this.$router.push('receiveApply');
return;
} }
if (this.checkedList.length == 0) { if (!this.formData.recommendEat) {
this.$toast.tips('请您选择答题后提交'); this.formData.recommendEat = "2颗/天(0.8mg/天)";
return;
} }
let question = ""; }
this.checkedList.forEach(x => {
question += x + ",";
});
this.formData.question = question.substring(0, question.length - 1);
sessionStorage.setItem("lastRecord", JSON.stringify(this.formData));
this.$router.push({path: 'receiveApply'});
} }
}).finally(() => {
this.$toast.close();
});
},
onSubmit(type) {
if (type == 1) {
this.formData.question = null;
sessionStorage.setItem("lastRecord", JSON.stringify(this.formData));
this.$router.push('receiveApply');
return;
}
if (this.checkedList.length == 0) {
this.$toast.tips('请您选择答题后提交');
return;
}
let question = "";
this.checkedList.forEach(x => {
question += x + ",";
});
this.formData.question = question.substring(0, question.length - 1);
sessionStorage.setItem("lastRecord", JSON.stringify(this.formData));
this.$router.push({path: 'receiveApply'});
} }
}
} }
</script> </script>
<style scoped> <style scoped>
.content { .content {
margin-left: 15px; margin-left: 15px;
} }
/deep/ .content .van-checkbox__label { /deep/ .content .van-checkbox__label {
font-size: 14px; font-size: 14px;
} }
</style> </style>
\ No newline at end of file
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