微信公众号前端模版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.8 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1" >
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>身份绑定</title>
<script type="text/javascript">
document.write('<script type="text/javascript" src="src/utils/import-util.js?t=' + new Date().getTime() + '"><\/script>')
</script>
</head>
<body>
<div id="app"
v-cloak>
<div v-if="show">
<van-form class="card__box"
label-width="80px"
@submit="onSubmit">
<van-field class="input"
v-model="patient.idCardNo"
label="身份证号"
name="idCardNo"
autofocus
maxLength="18"
placeholder="请填写身份证号码"
:border="false"
:rules="[{ required: true, message: '必填' }]">
</van-field>
<van-field class="input"
v-model="patient.name"
label="姓&emsp;&emsp;名"
name="name"
maxLength="18"
placeholder="请填写真实姓名"
:border="false"
:rules="[{ required: true, message: '必填' }]">
</van-field>
<div style="margin: 16px 0; width:100%;text-align:center;">
<span @click="onClick()"
style="color:var(--color-primary)">{{text}}</span>
</div>
</van-form>
</div>
</div>
<script>
Vue.createApp({
data() {
return {
show: false,
text: !URLUtil.getQueryVar('registerOrderId') ? '前往验证' : '判断验证是否通过',
patient: {
idCardNo: '',
name: ''
}
}
},
created() {
if (Axios.runEnv !== 'development') {
if (!URLUtil.getQueryVar('wechatCode') && !URLUtil.getQueryVar('registerOrderId')) { // 获取授权码
if (vant) {
vant.Toast.loading({ duration: 0, forbidClick: true, message: '页面加载中...' })
}
return window.location.href = 'https://health.tengmed.com/open/getUserCode?redirect_uri=' + window.location.href
}
}
this.show = true
},
methods: {
onClick() {
const orderId = URLUtil.getQueryVar('orderId')
const registerOrderId = URLUtil.getQueryVar('registerOrderId')
if (!registerOrderId) {
this.$axios.post('/wx/healthCode/registerUniformVerifyOrder.do', {
idCardNo: this.patient.idCardNo,
name: this.patient.name,
wechatCode: URLUtil.getQueryVar('wechatCode')
}).then(resp => {
if (resp.code === 200) {
window.location.href = `https://health.tengmed.com/open/idAuth?order_id=${resp.data}&hospital_id=31737&redirect_uri=http://wx.hhzyy.com/wx/web/health-auth.html?orderId=${resp.data}`
} else {
window.location.reload()
}
})
} else {
this.$axios.post('/wx/healthCode/checkUniformVerifyResult.do', {
orderId: orderId,
registerOrderId: registerOrderId
}).then(resp => {
if (resp.code === 200) {
alert('成功')
} else {
window.location.reload()
}
})
}
}
},
}).use(VueConfig)
.use(store)
.mount('#app');
</script>
</body>
</html>