fix
13404089107
6 天以前 2e90f57e7d28d6a949247ef39b487d3e75b56683
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
67
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import App from './App'
 
// #ifndef VUE3
import Vue from 'vue'
 
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
 
import fly from '@/common/bin/fly'
Vue.prototype.$fly = fly
 
import apis from '@/common/api/index.js'
Vue.prototype.$apis = apis
 
const dayjs = require('@/common/bin/dayjs.min.js');
Vue.prototype.$dayjs = dayjs
 
// 全局简写跳转
Vue.prototype.$navTo = function(path){
  uni.navigateTo({
    url:path
  })
}
Vue.prototype.$navBack = function(delta){
  if(typeof delta != 'number') delta = 1
  uni.navigateBack({
    delta:delta
  })
}
 
 
Vue.prototype.$toast = (val, callback) => {
  uni.showToast({
    icon: 'none',
    mask: true,
    title: val,
    duration: 1200
  })
  if (callback) setTimeout(callback, 1300)
}
 
Vue.prototype.$loading = (val = "") => {
  uni.showLoading({
    title: val,
    mask: true,
  })
}
 
// 底部导航栏
Vue.prototype.$TabBar = {
  list:[{
    pagePath:'/pages/index/index/index',
    text:'饮水',
    iconPath:"/static/icon/tabBar/icon_tabbar_index.png",
    selectedIconPath:"/static/icon/tabBar/icon_tabbar_index_active.png",
  },{
    pagePath:'/pages/user/index/index',
    text:'我的',
    iconPath:"/static/icon/tabBar/icon_tabbar_user.png",
    selectedIconPath:"/static/icon/tabBar/icon_tabbar_user_active.png",
  }],
  current:0,
}
 
 
// 时间格式化
Date.prototype.Format = function(fmt) {
  const DAY = ['日', '一', '二', '三', '四', '五', '六']
  var o = {
    "M+": this.getMonth() + 1, //月份 
    "d+": this.getDate(), //日 
    "H+": this.getHours(), //小时 
    "m+": this.getMinutes(), //分 
    "s+": this.getSeconds(), //秒 
    "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
    "S": this.getMilliseconds(), //毫秒
    "D": DAY[this.getDay()]
  };
  if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" +
      o[k]).substr(("" + o[k]).length)));
  return fmt;
}
 
Vue.filter('getTime',val=>{
  return new Date(val).Format('yyyy-MM-dd HH:mm:ss')
})
 
Vue.filter('getTimeMin',val=>{
  return new Date(val).Format('yyyy-MM-dd')
})
 
 
Vue.filter('hidePhoneMiddle',(phone)=>{
  // 先验证是否为11位数字
  if (/^\d{11}$/.test(phone)) {
    return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
  }
  return phone; // 如果不是11位数字,返回原值
})
 
 
import store from './store'
Vue.prototype.$store = store
 
import './uni.promisify.adaptor'
Vue.config.productionTip = false
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)
  return {
    app
  }
}
// #endif