Commit 5dd741c7 authored by gengchunlei's avatar gengchunlei

慢综 医生端 关闭页面原生调用

parent 22d1a765
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import axios from 'axios' import axios from 'axios'
import { showFailToast, showLoadingToast } from 'vant' import { showFailToast, showLoadingToast } from 'vant'
import { callMobile } from '@/utils/common' import { backHome } from '@/utils/common'
const baseAxios = axios.create({ const baseAxios = axios.create({
baseURL: '', baseURL: '',
...@@ -31,7 +31,7 @@ export function fetchBase({ ...@@ -31,7 +31,7 @@ export function fetchBase({
contentType === 'file' && (contentType = 'multipart/form-data') contentType === 'file' && (contentType = 'multipart/form-data')
let token = sessionStorage.getItem('token') let token = sessionStorage.getItem('token')
if (!token) { if (!token) {
callMobile("goIndex", {}) backHome()
return return
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<script> <script>
import { getDict } from '@/api/base.js' import { getDict } from '@/api/base.js'
import { useStore } from './store/index.js' import { useStore } from './store/index.js'
import { callMobile, getQueryVariable } from '@/utils/common' import { backHome, getQueryVariable } from '@/utils/common'
import { getAuthInfo } from '@/api/doctor/generalFU' import { getAuthInfo } from '@/api/doctor/generalFU'
export default { export default {
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
this.visible = true this.visible = true
} else { } else {
callMobile("goIndex", {}) backHome()
} }
} }
......
...@@ -213,3 +213,22 @@ export function callMobile(handlerInterface, parameters) { ...@@ -213,3 +213,22 @@ export function callMobile(handlerInterface, parameters) {
} }
} }
} }
// 判断ios还是安卓
export function isIOSWebKit() {
const aa = window.navigator.userAgent;
if (!!aa.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {// ios端
return true;
} else if (aa.indexOf('Android') !== -1 || aa.indexOf('Adr') !== -1) {// 安卓端
return false;
}
}
//关闭页面
export function backHome() {
if (isIOSWebKit()) { //ios
callMobile("closeWebPage", {})
} if (isIOSWebKit() === false) {
callMobile("closePage", {})
}
}
\ 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