|
|
@@ -67,96 +67,126 @@ if (navigator.userAgent.includes('#cordova#')) {
|
|
|
document.addEventListener(
|
|
|
'deviceready',
|
|
|
function () {
|
|
|
- window.$vm = app.mount('#app');
|
|
|
- StatusBar.overlaysWebView(false);
|
|
|
- StatusBar.hide();
|
|
|
- setTimeout(() => {
|
|
|
- navigator.splashscreen.hide();
|
|
|
- StatusBar.show();
|
|
|
- StatusBar.backgroundColorByHexString('#F5F7FA');
|
|
|
- StatusBar.styleDefault();
|
|
|
- }, 2000);
|
|
|
+ http.http.get(`/appVersion/checkIosReview?version=${navigator.appInfo.version}`).then(res => {
|
|
|
+ store.commit('setReview', res.review);
|
|
|
+ if (res.review) {
|
|
|
+ if (location.host !== 'test.raex.vip') {
|
|
|
+ // location.href = 'https://test.raex.vip';
|
|
|
+ // return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ window.$vm = app.mount('#app');
|
|
|
+ StatusBar.overlaysWebView(false);
|
|
|
+ StatusBar.hide();
|
|
|
+ setTimeout(() => {
|
|
|
+ navigator.splashscreen.hide();
|
|
|
+ StatusBar.show();
|
|
|
+ StatusBar.backgroundColorByHexString('#F5F7FA');
|
|
|
+ StatusBar.styleDefault();
|
|
|
+ }, 2000);
|
|
|
|
|
|
- if (/iphone|ipad|ipod/i.test(navigator.userAgent)) {
|
|
|
- style.setProperty('--safe-top', 'env(safe-area-inset-top)');
|
|
|
- style.setProperty('--safe-bottom', 'env(safe-area-inset-bottom)');
|
|
|
- style.setProperty('--safe-left', 'env(safe-area-inset-left)');
|
|
|
- style.setProperty('--safe-right', 'env(safe-area-inset-right)');
|
|
|
- } else {
|
|
|
- if (window.AndroidNotch) {
|
|
|
- window.AndroidNotch.getInsetTop(
|
|
|
- px => {
|
|
|
- style.setProperty('--safe-top', px + 'px');
|
|
|
- },
|
|
|
- err => console.error('Failed to get insets top:', err)
|
|
|
- );
|
|
|
+ if (/iphone|ipad|ipod/i.test(navigator.userAgent)) {
|
|
|
+ style.setProperty('--safe-top', 'env(safe-area-inset-top)');
|
|
|
+ style.setProperty('--safe-bottom', 'env(safe-area-inset-bottom)');
|
|
|
+ style.setProperty('--safe-left', 'env(safe-area-inset-left)');
|
|
|
+ style.setProperty('--safe-right', 'env(safe-area-inset-right)');
|
|
|
+ } else {
|
|
|
+ if (window.AndroidNotch) {
|
|
|
+ window.AndroidNotch.getInsetTop(
|
|
|
+ px => {
|
|
|
+ style.setProperty('--safe-top', px + 'px');
|
|
|
+ },
|
|
|
+ err => console.error('Failed to get insets top:', err)
|
|
|
+ );
|
|
|
|
|
|
- window.AndroidNotch.getInsetRight(
|
|
|
- px => {
|
|
|
- style.setProperty('--safe-right', px + 'px');
|
|
|
- },
|
|
|
- err => console.error('Failed to get insets right:', err)
|
|
|
- );
|
|
|
+ window.AndroidNotch.getInsetRight(
|
|
|
+ px => {
|
|
|
+ style.setProperty('--safe-right', px + 'px');
|
|
|
+ },
|
|
|
+ err => console.error('Failed to get insets right:', err)
|
|
|
+ );
|
|
|
|
|
|
- window.AndroidNotch.getInsetBottom(
|
|
|
- px => {
|
|
|
- style.setProperty('--safe-bottom', px + 'px');
|
|
|
- },
|
|
|
- err => console.error('Failed to get insets bottom:', err)
|
|
|
- );
|
|
|
+ window.AndroidNotch.getInsetBottom(
|
|
|
+ px => {
|
|
|
+ style.setProperty('--safe-bottom', px + 'px');
|
|
|
+ },
|
|
|
+ err => console.error('Failed to get insets bottom:', err)
|
|
|
+ );
|
|
|
|
|
|
- window.AndroidNotch.getInsetLeft(
|
|
|
- px => {
|
|
|
- style.setProperty('--safe-left', px + 'px');
|
|
|
- },
|
|
|
- err => console.error('Failed to get insets left:', err)
|
|
|
- );
|
|
|
+ window.AndroidNotch.getInsetLeft(
|
|
|
+ px => {
|
|
|
+ style.setProperty('--safe-left', px + 'px');
|
|
|
+ },
|
|
|
+ err => console.error('Failed to get insets left:', err)
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- let t = 0;
|
|
|
- document.addEventListener(
|
|
|
- 'backbutton',
|
|
|
- e => {
|
|
|
- if (window.$vm.$route.matched.find(i => i.name === 'index')) {
|
|
|
- e.preventDefault();
|
|
|
- let t1 = new Date().getTime();
|
|
|
- console.log(t1 - t);
|
|
|
- if (t1 - t < 1000) {
|
|
|
- navigator.app.exitApp();
|
|
|
+ let t = 0;
|
|
|
+ document.addEventListener(
|
|
|
+ 'backbutton',
|
|
|
+ e => {
|
|
|
+ if (window.$vm.$route.matched.find(i => i.name === 'index')) {
|
|
|
+ e.preventDefault();
|
|
|
+ let t1 = new Date().getTime();
|
|
|
+ console.log(t1 - t);
|
|
|
+ if (t1 - t < 1000) {
|
|
|
+ navigator.app.exitApp();
|
|
|
+ } else {
|
|
|
+ t = t1;
|
|
|
+ window.$vm.$toast('再按一次退出');
|
|
|
+ }
|
|
|
} else {
|
|
|
- t = t1;
|
|
|
- window.$vm.$toast('再按一次退出');
|
|
|
+ window.$vm.$router.go(-1);
|
|
|
}
|
|
|
- } else {
|
|
|
- window.$vm.$router.go(-1);
|
|
|
- }
|
|
|
- },
|
|
|
- false
|
|
|
- );
|
|
|
+ },
|
|
|
+ false
|
|
|
+ );
|
|
|
|
|
|
- if (
|
|
|
- !(
|
|
|
- location.host === 'www.raex.vip' ||
|
|
|
- location.host === 'test.raex.vip' ||
|
|
|
- /^http:\/\/192\.168\.\d{1,3}\.\d{1,3}((:\d+)?)$/.test(location.host)
|
|
|
- )
|
|
|
- ) {
|
|
|
- if (!/iphone|ipad|ipod/i.test(navigator.userAgent)) {
|
|
|
- window.$vm.$dialog.alert({
|
|
|
- message: '检测到新版本,请下载更新',
|
|
|
- confirmButtonText: '下载更新',
|
|
|
- beforeClose(action, done) {
|
|
|
- console.log(action);
|
|
|
- if (/iphone|ipad|ipod/.test(navigator.userAgent)) {
|
|
|
- //location.href = 'https://apps.apple.com/cn/app/id1598469798';
|
|
|
- } else {
|
|
|
- location.href = 'http://download.raex.vip';
|
|
|
+ if (
|
|
|
+ !(
|
|
|
+ location.host === 'www.raex.vip' ||
|
|
|
+ location.host === 'test.raex.vip' ||
|
|
|
+ /^http:\/\/192\.168\.\d{1,3}\.\d{1,3}((:\d+)?)$/.test(location.host)
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ if (!/iphone|ipad|ipod/i.test(navigator.userAgent)) {
|
|
|
+ window.$vm.$dialog.alert({
|
|
|
+ message: '检测到新版本,请下载更新',
|
|
|
+ confirmButtonText: '下载更新',
|
|
|
+ beforeClose(action, done) {
|
|
|
+ console.log(action);
|
|
|
+ if (/iphone|ipad|ipod/.test(navigator.userAgent)) {
|
|
|
+ //location.href = 'https://apps.apple.com/cn/app/id1598469798';
|
|
|
+ } else {
|
|
|
+ location.href = 'http://download.raex.vip';
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (window.store && /iphone|ipad|ipod/i.test(navigator.userAgent)) {
|
|
|
+ window.store.register({
|
|
|
+ id: '358',
|
|
|
+ alias: 'my_consumable1',
|
|
|
+ type: window.store.CONSUMABLE
|
|
|
+ });
|
|
|
+
|
|
|
+ window.store.error(function (error) {
|
|
|
+ console.log('ERROR ' + error.code + ': ' + error.message);
|
|
|
});
|
|
|
+ window.store
|
|
|
+ .when('358')
|
|
|
+ .updated(res => {
|
|
|
+ console.log(res, 'updated');
|
|
|
+ })
|
|
|
+ .approved(p => {
|
|
|
+ console.log('approved', res);
|
|
|
+ });
|
|
|
+ window.store.refresh();
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
},
|
|
|
false
|
|
|
);
|