diff --git a/h5/App.vue b/h5/App.vue index 3878125..a5aedbc 100644 --- a/h5/App.vue +++ b/h5/App.vue @@ -23,8 +23,17 @@ const $store = useStore() const setConfigStore = () => { - const config_str = uni.getStorageSync('CONFIG_CONFIG') - const config = JSON.parse(config_str) + let config = {} + try { + const config_str = uni.getStorageSync('CONFIG_CONFIG') + if (config_str) config = JSON.parse(config_str) + } catch (e) { + uni.showToast({ + icon:"none", + title:e.message || '未知错误' + }) + console.warn('CONFIG_CONFIG 解析失败', e) + } $store.config = config if (!config.color) { document.body.classList.toggle('grayscale'); diff --git a/h5/config.js b/h5/config.js index 8d29e36..f98386b 100644 --- a/h5/config.js +++ b/h5/config.js @@ -6,6 +6,7 @@ const config = { api_map_url: base_url + '/api/ApiMap/h5', base_assets_url: base_url, } +const TOKEN_KEY = 'OPENID' uni.$config = JSON.parse(JSON.stringify(config)) export default { title: '海南现代妇女儿童医院', @@ -15,5 +16,6 @@ export default { error_message: '网络请求发生错误', appid: '', app_type: app_type, - config: config + config: config, + token: TOKEN_KEY } \ No newline at end of file