初始化
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
import App from './App'
|
||||
import Inputli from './components/form/input-li.vue';
|
||||
import Selectli from './components/form/select-li.vue';
|
||||
import Dateli from './components/form/date-li.vue';
|
||||
import DateText from './components/form/dateText.vue';
|
||||
import { getToken } from './api/create.js'
|
||||
import { formatDate, calculator } from './com/index.js'
|
||||
|
||||
// #ifndef VUE3
|
||||
import Vue from 'vue'
|
||||
Vue.config.productionTip = false
|
||||
Vue.prototype.a = '1234456'
|
||||
const msg = (title,icon = 'none', duration = 1500, mask = false, ) => {
|
||||
//统一提示方便全局修改
|
||||
if (Boolean(title) === false) {
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title,
|
||||
duration,
|
||||
mask,
|
||||
icon
|
||||
});
|
||||
}
|
||||
|
||||
const setNavigationBar = ( title = '教育平台', backgroundColor = '#ffffff') =>{
|
||||
console.log('更改标题')
|
||||
// my.setNavigationBar({
|
||||
// title,
|
||||
// backgroundColor
|
||||
// });
|
||||
}
|
||||
const navTo = (url, skip = 'navigateTo') =>{
|
||||
uni[skip]({
|
||||
url
|
||||
});
|
||||
}
|
||||
const login = () =>{
|
||||
return new Promise((reslove,reject)=>{
|
||||
uni.getAuthCode({
|
||||
success:(user)=>{
|
||||
console.log(user)
|
||||
getToken(user.authCode).then((res)=>{
|
||||
if(res){
|
||||
reslove(res.data)
|
||||
console.log(res.data)
|
||||
}
|
||||
}).catch(err =>{
|
||||
reject(err)
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
// 提示框 点击确定进入resolve 取消进入reject
|
||||
const showModel = (content) =>{
|
||||
return new Promise((resolve, reject)=>{
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: content,
|
||||
cancelText: '取消',
|
||||
confirmText: '确定',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
resolve('affirm')
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
reject('cancal')
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
Vue.prototype.$navTo = navTo // 页面跳转
|
||||
Vue.prototype.$msg = msg
|
||||
Vue.prototype.$setNavigationBar = setNavigationBar
|
||||
Vue.prototype.$login = login
|
||||
Vue.prototype.$calculator = calculator // 计算数
|
||||
Vue.prototype.$formatDate = formatDate // 日期格式修改
|
||||
Vue.prototype.$showModel = showModel // 提示框
|
||||
|
||||
|
||||
|
||||
Vue.component("Inputli",Inputli)
|
||||
Vue.component("Selectli",Selectli)
|
||||
Vue.component("Dateli",Dateli)
|
||||
Vue.component("DateText",DateText)
|
||||
App.mpType = 'app'
|
||||
const app = new Vue({
|
||||
...App
|
||||
})
|
||||
app.$mount()
|
||||
// #endif
|
||||
|
||||
|
||||
|
||||
|
||||
// #ifdef VUE3
|
||||
import { createSSRApp } from 'vue'
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
return {
|
||||
app
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
Reference in New Issue
Block a user