parent
677af90f97
commit
16fa6bb8b9
22 changed files with 1286 additions and 1387 deletions
@ -1,277 +0,0 @@ |
|||||||
const VueConfig = (function (Vue, Vuex, VueRouter, Axios, NProgress) { |
|
||||||
const global = { |
|
||||||
app: null, |
|
||||||
store: null, |
|
||||||
route: null, |
|
||||||
router: null |
|
||||||
} |
|
||||||
// 向外暴露通过use注册
|
|
||||||
function install(app, options) { |
|
||||||
vantInstall(app) |
|
||||||
app.config.globalProperties.$axios = Axios.server |
|
||||||
if (!global.app) global.app = app |
|
||||||
} |
|
||||||
|
|
||||||
function createApp(path, attributes) { |
|
||||||
const div = document.createElement('div') |
|
||||||
div.setAttribute('v-cloak', '') |
|
||||||
div.id = 'app' |
|
||||||
|
|
||||||
const appView = document.createElement('app') |
|
||||||
if (attributes instanceof Object) { |
|
||||||
for (a in attributes) { |
|
||||||
appView.setAttribute(a, attributes[a]) |
|
||||||
} |
|
||||||
} |
|
||||||
div.appendChild(appView) |
|
||||||
document.body.appendChild(div) |
|
||||||
|
|
||||||
Vue.createApp({ |
|
||||||
components: { app: vueLoader(path) } |
|
||||||
}).use(VueConfig).use(store).use(VueRouter.createRouter({ history: VueRouter.createWebHashHistory(), routes: [] })).mount('#app') |
|
||||||
} |
|
||||||
|
|
||||||
const cacheComponentsPath = [] |
|
||||||
|
|
||||||
// 后期移除
|
|
||||||
function components(obj) { |
|
||||||
if (obj instanceof Object) { |
|
||||||
for (const name in obj) { |
|
||||||
const path = obj[name] |
|
||||||
if (!name || !path) { |
|
||||||
return console.error('name or path is null') |
|
||||||
} |
|
||||||
const key = name + '|' + path |
|
||||||
if (cacheComponentsPath.indexOf(key) === -1) { |
|
||||||
global.app.component(name, vueLoader(path)) |
|
||||||
} else { |
|
||||||
// console.log(`${name}已注册过`)
|
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
function scriptLoader(src) { |
|
||||||
const jsFile = document.createElement('script'); |
|
||||||
jsFile.src = src; |
|
||||||
document.head.appendChild(jsFile); |
|
||||||
} |
|
||||||
|
|
||||||
function addRoutes(pathObj, routes) { |
|
||||||
if (routes.length > 0) { |
|
||||||
routes.forEach(item => { |
|
||||||
global.router.addRoute({ |
|
||||||
meta: item.meta, |
|
||||||
name: item.name, |
|
||||||
path: item.path, |
|
||||||
children: item.children, |
|
||||||
component: vueLoader(item.component) |
|
||||||
}) |
|
||||||
}) |
|
||||||
|
|
||||||
// global.router.beforeEach((to, from, next) => {
|
|
||||||
// next()
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
if (typeof pathObj === 'object') { |
|
||||||
global.store.dispatch('setRoutePath', pathObj.path) |
|
||||||
console.log(pathObj); |
|
||||||
global.router.replace(pathObj) |
|
||||||
} else { // string
|
|
||||||
global.store.dispatch('setRoutePath', pathObj) |
|
||||||
if (global.route.path === '/') { |
|
||||||
return global.router.replace(pathObj) |
|
||||||
} |
|
||||||
global.router.replace({ path: global.route.path, params: global.route.params, query: global.route.query }) |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
const mjsCaches = {} |
|
||||||
const vueCaches = {} |
|
||||||
|
|
||||||
function vueLoader(path) { |
|
||||||
if (path.length > 4 && path.substring(path.length - 4) !== '.vue') path += '.vue' |
|
||||||
|
|
||||||
return Vue.defineAsyncComponent(function () { |
|
||||||
var pathname = window.location.pathname |
|
||||||
pathname = pathname.substring(0, pathname.lastIndexOf('/')) |
|
||||||
|
|
||||||
if (!global.store) global.store = Vuex.useStore() |
|
||||||
if (!global.route) global.route = VueRouter.useRoute() |
|
||||||
if (!global.router) global.router = VueRouter.useRouter() |
|
||||||
if (NProgress) NProgress.start() |
|
||||||
|
|
||||||
return window['vue3-sfc-loader'].loadModule(path, { |
|
||||||
moduleCache: { |
|
||||||
'vue-helper': { components: components, scriptLoader: scriptLoader, addRoutes: addRoutes, route: VueRouter.useRoute(), router: VueRouter.useRouter(), store: Vuex.useStore() }, |
|
||||||
vue: Vue, |
|
||||||
vuex: { useStore: Vuex.useStore }, |
|
||||||
'vue-router': { useRouter: VueRouter.useRouter, useRoute: VueRouter.useRoute }, |
|
||||||
axios: { |
|
||||||
axios: Axios.server, |
|
||||||
copyright: Axios.copyright, |
|
||||||
RUN_ENV: Axios.RUN_ENV, |
|
||||||
UPLOAD_URL: Axios.UPLOAD_URL, |
|
||||||
BASE_URL: Axios.BASE_URL, |
|
||||||
OL_WS_URL: Axios.OL_WS_URL, |
|
||||||
}, |
|
||||||
}, |
|
||||||
getFile: function (url) { |
|
||||||
var index = url.indexOf('@') |
|
||||||
if (index === 0) url = pathname + '/src' + url.substring(index + 1) |
|
||||||
|
|
||||||
var type = '.mjs' |
|
||||||
var laIndex = url.lastIndexOf('.') |
|
||||||
if (laIndex > -1) type = url.substring(laIndex) |
|
||||||
|
|
||||||
if (type === '.vue') { |
|
||||||
if (vueCaches[url]) { |
|
||||||
if (NProgress) NProgress.done() |
|
||||||
console.log('[' + type + ']' + url + '已注册'); |
|
||||||
return vueCaches[url] |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (type === '.mjs') { |
|
||||||
if (mjsCaches[url]) { |
|
||||||
if (NProgress) NProgress.done() |
|
||||||
console.log('[' + type + ']' + url + '已注册'); |
|
||||||
return mjsCaches[url] |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return fetch(url).then(function (res) { |
|
||||||
if (NProgress) NProgress.done() |
|
||||||
if (!res.ok) throw Object.assign(new Error(url + ' ' + res.statusText), { res: res }) |
|
||||||
return { |
|
||||||
type: type, |
|
||||||
getContentData: function (asBinary) { |
|
||||||
var respData = asBinary ? res.arrayBuffer() : res.text() |
|
||||||
if (type === '.vue') if (!vueCaches[url]) vueCaches[url] = respData |
|
||||||
|
|
||||||
if (type === '.mjs') if (!mjsCaches[url]) mjsCaches[url] = respData |
|
||||||
return respData |
|
||||||
} |
|
||||||
} |
|
||||||
}) |
|
||||||
}, |
|
||||||
handleModule: function (type, getContentData, path, options) { }, |
|
||||||
addStyle: function (textContent) { |
|
||||||
var style = Object.assign(document.createElement('style'), { textContent: textContent }) |
|
||||||
var ref = document.head.getElementsByTagName('style')[0] || null |
|
||||||
document.head.insertBefore(style, ref) |
|
||||||
}, |
|
||||||
log(type, ...args) { |
|
||||||
console[type](...args) |
|
||||||
}, |
|
||||||
compiledCache: { |
|
||||||
set(key, str) { |
|
||||||
for (; ;) { |
|
||||||
try { |
|
||||||
window.localStorage.setItem((key), str) |
|
||||||
break |
|
||||||
} catch (ex) { |
|
||||||
window.localStorage.removeItem(window.localStorage.key(0)) |
|
||||||
} |
|
||||||
} |
|
||||||
}, |
|
||||||
get(key) { |
|
||||||
return window.localStorage.getItem(key) |
|
||||||
} |
|
||||||
} |
|
||||||
}) |
|
||||||
}) |
|
||||||
} |
|
||||||
|
|
||||||
// vant组件注册
|
|
||||||
function vantInstall(app) { |
|
||||||
if (!window.vant) return |
|
||||||
// 空状态
|
|
||||||
app.use(vant.Empty) |
|
||||||
app.use(vant.Button) |
|
||||||
app.use(vant.Lazyload) |
|
||||||
app.use(vant.Cell) |
|
||||||
app.use(vant.CellGroup) |
|
||||||
|
|
||||||
app.use(vant.Icon) |
|
||||||
app.use(vant.Image) |
|
||||||
// Layout 布局
|
|
||||||
app.use(vant.Col) |
|
||||||
app.use(vant.Row) |
|
||||||
// 弹出层
|
|
||||||
app.use(vant.Popup) |
|
||||||
app.use(vant.Toast) |
|
||||||
app.use(vant.Cascader) |
|
||||||
app.use(vant.Checkbox) |
|
||||||
app.use(vant.CheckboxGroup) |
|
||||||
app.use(vant.DatetimePicker) |
|
||||||
app.use(vant.Field) |
|
||||||
app.use(vant.Form) |
|
||||||
app.use(vant.NumberKeyboard) |
|
||||||
app.use(vant.PasswordInput) |
|
||||||
app.use(vant.Picker) |
|
||||||
app.use(vant.Radio) |
|
||||||
app.use(vant.RadioGroup) |
|
||||||
app.use(vant.Rate) |
|
||||||
app.use(vant.Search) |
|
||||||
app.use(vant.Slider) |
|
||||||
app.use(vant.Stepper) |
|
||||||
app.use(vant.Switch) |
|
||||||
app.use(vant.Uploader) |
|
||||||
app.use(vant.ActionSheet) |
|
||||||
app.use(vant.Dialog) |
|
||||||
app.use(vant.DropdownMenu) |
|
||||||
app.use(vant.DropdownItem) |
|
||||||
app.use(vant.Loading) |
|
||||||
app.use(vant.Notify) |
|
||||||
app.use(vant.Overlay) |
|
||||||
app.use(vant.Area) |
|
||||||
|
|
||||||
app.use(vant.PullRefresh) |
|
||||||
app.use(vant.Badge) |
|
||||||
app.use(vant.Circle) |
|
||||||
app.use(vant.Collapse) |
|
||||||
app.use(vant.CollapseItem) |
|
||||||
app.use(vant.CountDown) |
|
||||||
app.use(vant.Divider) |
|
||||||
app.use(vant.ImagePreview) |
|
||||||
app.use(vant.List) |
|
||||||
app.use(vant.NoticeBar) |
|
||||||
app.use(vant.Popover) |
|
||||||
app.use(vant.Progress) |
|
||||||
app.use(vant.Skeleton) |
|
||||||
app.use(vant.Step) |
|
||||||
app.use(vant.Steps) |
|
||||||
app.use(vant.Sticky) |
|
||||||
app.use(vant.Swipe) |
|
||||||
app.use(vant.SwipeItem) |
|
||||||
app.use(vant.Tag) |
|
||||||
app.use(vant.Grid) |
|
||||||
app.use(vant.GridItem) |
|
||||||
app.use(vant.IndexBar) |
|
||||||
app.use(vant.IndexAnchor) |
|
||||||
app.use(vant.NavBar) |
|
||||||
app.use(vant.Pagination) |
|
||||||
app.use(vant.Sidebar) |
|
||||||
app.use(vant.SidebarItem) |
|
||||||
|
|
||||||
app.use(vant.Tab) |
|
||||||
app.use(vant.Tabs) |
|
||||||
app.use(vant.Tabbar) |
|
||||||
app.use(vant.TabbarItem) |
|
||||||
app.use(vant.TreeSelect) |
|
||||||
app.use(vant.SwipeCell); |
|
||||||
app.use(vant.Card); |
|
||||||
app.use(vant.Calendar) |
|
||||||
} |
|
||||||
|
|
||||||
return { |
|
||||||
install: install, |
|
||||||
vueLoader: vueLoader, |
|
||||||
createApp: createApp |
|
||||||
} |
|
||||||
})(Vue, Vuex, VueRouter, Axios, NProgress) |
|
||||||
|
|
||||||
Object.freeze(VueConfig) |
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,82 @@ |
|||||||
|
<template> |
||||||
|
<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="姓  名" |
||||||
|
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> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import { Go } from '@/utils/common-util.mjs' |
||||||
|
export default { |
||||||
|
|
||||||
|
data() { |
||||||
|
return { |
||||||
|
show: false, |
||||||
|
text: '人脸识别', |
||||||
|
patient: { |
||||||
|
idCardNo: '', |
||||||
|
name: '' |
||||||
|
}, |
||||||
|
redirect_uri: '' |
||||||
|
} |
||||||
|
}, |
||||||
|
created() { |
||||||
|
if(URLUtil.getQueryVar('verifyInfo')){ |
||||||
|
this.patient.idCardNo = URLUtil.getQueryVar('verifyInfo').split('_')[0] |
||||||
|
this.patient.name = decodeURIComponent(URLUtil.getQueryVar('verifyInfo').split('_')[1]) |
||||||
|
this.redirect_uri = decodeURIComponent(URLUtil.getQueryVar('verifyInfo').split('_')[2]) |
||||||
|
} |
||||||
|
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() { |
||||||
|
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=${this.redirect_uri}?orderId=${resp.data}` |
||||||
|
} else { |
||||||
|
window.location.reload() |
||||||
|
} |
||||||
|
}) |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
</script> |
Loading…
Reference in new issue