import App from './App' import Store from './store' // #ifndef VUE3 import Vue from 'vue' import './uni.promisify.adaptor' Vue.config.productionTip = false App.mpType = 'app' const app = new Vue({ ...App }) app.$mount() // #endif // #ifdef VUE3 import { createSSRApp } from 'vue' // 导入你的语言文件 import en from './en.json' import zhHans from './zh-Hans.json' import zhHant from './zh-Hant.json' const messages = { en, 'zh-Hans': zhHans, 'zh-Hant': zhHant } let i18nConfig = { locale: uni.getStorageSync('userLanguage') || 'zh-Hans',// 获取已设置的语言 messages } import { createI18n } from 'vue-i18n'// v9.x const i18n = createI18n(i18nConfig) export function createApp() { const app = createSSRApp(App) app.use(i18n) app.use(Store) //新增的一行 return { app } } // #endif import { $http } from './api/http.js' // import { login } from './api/api' uni.$http = $http $http.baseUrl = '' // uni.$apiKey = 'xxxxxxxxx' // 请求开始之前 $http.beforeRequest = function (options) { // uni.showLoading({ // title: '数据加载中...', // }) // if(options.url!="http://10.168.4.100:80/api/v1/login"){ // console.log(options); // if (!uni.getStorageSync('token')) { // login().then(data => { // // console.log(data); // if (data.status == 'ok') { // uni.setStorage({ // key: 'token', // data: data.data.token, // success: function(res) { // console.log(res); // } // }); // }else{ // uni.showToast({ // title:data.msg, // icon: 'none', // duration: 2000, // 显示时长,单位为毫秒 // }); // } // }); // } // } } // 请求完成之后 $http.afterRequest = function () { // uni.hideLoading() }