122 lines
3.3 KiB
JavaScript
122 lines
3.3 KiB
JavaScript
import App from './App'
|
|
import uView from '@/uni_modules/uview-ui'
|
|
import store from './store'
|
|
import messages from './locale/index'
|
|
import watermark from './store/watermark.js'
|
|
|
|
let i18nConfig = {
|
|
locale: uni.getLocale(),
|
|
messages
|
|
}
|
|
|
|
// #ifndef VUE3
|
|
import Vue from 'vue'
|
|
import VueI18n from 'vue-i18n'
|
|
import './uni.promisify.adaptor'
|
|
Vue.use(VueI18n)
|
|
const i18n = new VueI18n(i18nConfig)
|
|
|
|
Vue.use(watermark, {
|
|
loginPaths: [
|
|
'./salessupport/todoList/todoList.vue'
|
|
],
|
|
defaultContent: 'Cannot get user data'
|
|
});
|
|
|
|
Vue.config.productionTip = false
|
|
Vue.prototype.$store = store
|
|
// 注册全局方法
|
|
Vue.prototype.isLogin = function(){
|
|
getApp().isLogin();
|
|
}
|
|
Vue.prototype.checkJailbreak = function(){
|
|
getApp().checkJailbreak();
|
|
}
|
|
Vue.prototype.navBack = function(delta){
|
|
getApp().navBack(delta);
|
|
}
|
|
Vue.prototype.navTo = function(url,type,auth){
|
|
getApp().navTo(url,type,auth);
|
|
}
|
|
Vue.prototype.writeLog = function(userId,eventCode,transactionId,description,requestBody,responseBody,successTag,debugTag){
|
|
getApp().writeLog(userId,eventCode,transactionId,description,requestBody,responseBody,successTag,debugTag);
|
|
}
|
|
Vue.prototype.redirectByPermission = function(userData,needRedirect){
|
|
getApp().redirectByPermission(userData,needRedirect);
|
|
}
|
|
Vue.prototype.showTabbarByPermission = function(userData){
|
|
getApp().showTabbarByPermission(userData);
|
|
}
|
|
Vue.prototype.checkInMacau = function(){
|
|
return getApp().checkInMacau();
|
|
}
|
|
Vue.prototype.checkVPNOpen = function(){
|
|
return getApp().checkVPNOpen();
|
|
}
|
|
Vue.prototype.checkLocationAndVPN = function(type){
|
|
return getApp().checkLocationAndVPN(type);
|
|
}
|
|
Vue.prototype.logout = function(){
|
|
return getApp().logout();
|
|
}
|
|
Vue.prototype.$onLaunched = new Promise((resolve, reject) => {
|
|
Vue.prototype.$isResolve = resolve
|
|
})
|
|
|
|
|
|
App.mpType = 'app'
|
|
/*uni.addInterceptor('request', {
|
|
success: function(request) {
|
|
let adfsCookie = uni.getStorageSync('adfs_cookie');
|
|
console.log('Set request Cookie');
|
|
if (adfsCookie) {
|
|
console.log(adfsCookie);*/
|
|
/*var cookies ="FederationAuthCookie="+ adfsCookie+
|
|
";RequestedSecurityToken="+ adfsCookie+
|
|
";FedAuth="+adfsCookie;*/
|
|
|
|
//request.header.Cookie = adfsCookie; // 将每次的请求头中加入Cookies
|
|
//request.header.cookie = cookies;
|
|
//request.header.FederationAuthCookie=adfsCookie;
|
|
//request.header.RequestedSecurityToken=adfsCookie;
|
|
//request.header.FedAuth=adfsCookie;
|
|
/*request.header.Authorization='Bearer '+adfsCookie;
|
|
}
|
|
}
|
|
});*/
|
|
const app = new Vue({
|
|
i18n,
|
|
store,
|
|
...App
|
|
})
|
|
|
|
// 引入请求封装,将app参数传递到配置中
|
|
require('@/common/request.js')(app)
|
|
app.$mount()
|
|
// #endif
|
|
|
|
// #ifdef VUE3
|
|
import { createSSRApp } from 'vue'
|
|
import { createI18n } from 'vue-i18n'
|
|
const i18n = createI18n(i18nConfig)
|
|
export function createApp() {
|
|
const app = createSSRApp(App)
|
|
/*uni.addInterceptor('request', {
|
|
success: function(request) {
|
|
let adfsCookie = uni.getStorageSync('adfs_cookie');
|
|
console.log('Set request Cookie');
|
|
if (adfsCookie) {
|
|
var cookies ={
|
|
FederationAuthCookie: adfsCookie,
|
|
RequestedSecurityToken: adfsCookie
|
|
};
|
|
request.header.Cookies = cookies // 将每次的请求头中加入Cookies
|
|
}
|
|
}
|
|
});*/
|
|
app.use(i18n)
|
|
return {
|
|
app
|
|
}
|
|
}
|
|
// #endif
|