|
@@ -162,6 +162,63 @@ export default {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+ // 如果是微信小程序。初始化wss
|
|
|
+ if (getIsMin()) {
|
|
|
+ // 如果刷新之后没有与微信小程序建立链接则提示用户,关闭小程序重新进入
|
|
|
+ const isReloadLoop = await isReloadBefore();
|
|
|
+ if (isReloadLoop) {
|
|
|
+ uni.removeStorageSync('isReload');
|
|
|
+ const { theme } = getsTheCurrentTopic();
|
|
|
+ this.$dialog({
|
|
|
+ title: '温馨提示',
|
|
|
+ message: '当前网络异常,请重新进入小程序',
|
|
|
+ confirmButtonColor: this.$theme[theme].primaryColor,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ /* const isReload = await theCommunicationBetweenWechatAndH5IsNormal();
|
|
|
+ if (isReload) {
|
|
|
+ uni.removeStorageSync('isReload');
|
|
|
+ const { theme } = getsTheCurrentTopic();
|
|
|
+ this.$dialog({
|
|
|
+ title: '温馨提示',
|
|
|
+ message: '当前网络异常,请重新进入小程序',
|
|
|
+ confirmButtonColor: this.$theme[theme].primaryColor,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ } */
|
|
|
+ }
|
|
|
+ if (window.location.href.indexOf('cryptojs') > -1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // // 保留 carList
|
|
|
+ // const carList = uni.getStorageSync('carList');
|
|
|
+ // // 保留 buildingId
|
|
|
+ // const buildingId = window.localStorage.getItem('buildingId')
|
|
|
+ // // 每次进入页面清空 缓存数据
|
|
|
+ // window.localStorage.clear();
|
|
|
+ // if (carList) {
|
|
|
+ // uni.setStorageSync('carList', JSON.parse(carList));
|
|
|
+ // }
|
|
|
+ // if (buildingId) {
|
|
|
+ // window.localStorage.setItem('buildingId', buildingId)
|
|
|
+ // }
|
|
|
+ setToken();
|
|
|
+ localStorageInit();
|
|
|
+ this.$store.commit('SET_IS_INIT', false);
|
|
|
+ try {
|
|
|
+ const options = await wssInit();
|
|
|
+ this.$store.dispatch('baseInit', {
|
|
|
+ options,
|
|
|
+ callback: () => {
|
|
|
+ this.$store.commit('SET_IS_INIT', true);
|
|
|
+ // 无感积分逻辑
|
|
|
+ // this.wxEasyPointsCommitStatusInit();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
+ }
|
|
|
// 如果是微信公众号
|
|
|
if (getIsWxh5()) {
|
|
|
// 判断用户是否登录
|