Blame view

main.js 1.88 KB
4b045f7c   刘淇   江阴初始化项目
1
2
3
4
5
6
7
8
9
10
11
12
13
  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'
  }
19569f2b   刘淇   购买券
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
67
  
  Vue.filter('priceFormat', function(value, arg) {
    return (value / 100).toFixed(2)
  })
  
  Vue.filter('timeFormat', function(value, arg) {
  
    var time = '';
    if (null != value && "" != value) {
      var timer = parseInt(value);
      if (timer == 0) {
        return '0秒';
      }
      var days = parseInt(timer / (60 * 60 * 24));
      var hours = parseInt((timer % (60 * 60 * 24)) / (60 * 60));
      var minutes = parseInt((timer % (60 * 60)) / (60))
      var seconds = parseInt(timer % (60));
      if (days > 0) {
        time = time + days +'天';
      }
      if (hours > 0) {
        time = time + hours +'小时';
      }
      if (minutes > 0) {
        time = time + minutes +'分钟';
      }
      if (seconds > 0) {
        time = time + seconds +'秒';
      }
      return time;
    }
    return time;
  
  })
  
  Vue.prototype.getGlobalUser = function(key) {
    var userInfo = uni.getStorageSync("globalUser");
    if (userInfo != null && userInfo != "" && userInfo != undefined) {
      return userInfo;
    } else {
      return null;
    }
  }
  
  Vue.prototype.getWxOpenid= function(key) {
    var WxOpenid = uni.getStorageSync("WxOpenid");
    if (WxOpenid != null && WxOpenid != "" && WxOpenid != undefined) {
      return WxOpenid;
    } else {
      return "";
    }
  }
  
  
4b045f7c   刘淇   江阴初始化项目
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
  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