-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.js
66 lines (64 loc) · 1.3 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import App from './App'
import store from './store'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
Vue.prototype.$store = store
Vue.prototype.$adpid = "1111111111"
Vue.prototype.$backgroundAudioData = {
playing: false,
playTime: 0,
formatedPlayTime: '00:00:00'
}
Vue.prototype.checkUrl=async function(url){
let checkUrl;
if(url)checkUrl=url;
else {
let setting=uni.getStorageSync("setting");
if(setting)checkUrl=setting.url;
}
return new Promise(function(resolve, reject) {
if(checkUrl){
uni.request({
url:checkUrl+"?"+new Date().getTime(),
method:"GET",
timeout:5000,
success:res=>{
resolve(true);
},
fail:res =>{
resolve(false);
}
})
}else resolve(false);
})
};
Vue.prototype.shutdown=function(){
var Runtime= plus.android.importClass("java.lang.Runtime");
Runtime.getRuntime().exec(["su","-c","reboot","-p"]).waitFor();
};
App.mpType = 'app'
const app = new Vue({
store,
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
app.use(store)
app.config.globalProperties.$adpid = "1111111111"
app.config.globalProperties.$backgroundAudioData = {
playing: false,
playTime: 0,
formatedPlayTime: '00:00:00'
}
return {
app
}
}
// #endif