d6694631 by simon

默认提交

1 parent 00614d72
......@@ -52,7 +52,8 @@ function Toast(msg) {
// console.log(process.env);
let base = "";
const axios = axiosIns.create({
baseURL: process.env.VUE_APP_BASE_URL,
// baseURL: process.env.VUE_APP_BASE_URL,
baseURL: "https://ow.go.qudone.com",
timeout: 5000
})
......
......@@ -4,6 +4,11 @@ import App from './App.vue';
import router from './router';
import store from './store/index';
import {
httpGet,
httpPost
} from '@/api/fetch-api.js';
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
Vue.use(VueAwesomeSwiper)
......@@ -36,7 +41,6 @@ Vue.config.productionTip = false
Vue.use(VueI18n)
const i18n = new VueI18n({
locale: localStorage.getItem("lang") || 'tc', // 语言标识
//this.$i18n.locale // 通过切换locale的值来实现语言切换
messages: {
'tc': require('@/common/lang/tc'), // 繁体语言包
'zh': require('@/common/lang/zh'), // 简体语言包
......@@ -44,9 +48,7 @@ const i18n = new VueI18n({
}
})
new Vue({
let vueInstance = new Vue({
i18n,
router,
store,
......@@ -55,6 +57,33 @@ new Vue({
document.dispatchEvent(new Event('render-event'));
},
data: {
eventBus: new Vue()
eventBus: new Vue(),
queryConfigData: null, // 1.放内存
// queryConfigData: localStorage.getItem("queryConfig") || null, // 2.放localStorage
}
}).$mount('#app');
// window.vueInstance = vueInstance; // 实在不满足需要,可以把vue实例挂载到windows上
/**
* 初始化请求配置
* 根据需要看放内存还是放localStorage
*
* 具体方法访问方法见 首页index.js mounted方法
* 具体方法访问方法见 首页index.js mounted方法
* 具体方法访问方法见 首页index.js mounted方法
*/
function initQueryConfig() {
/**
* 请求配置 httpGet/httpPost已引入
* 这里先setTimeout 模拟
*/
setTimeout(() => {
let configResult = {
a:123
}
}).$mount('#app')
vueInstance.queryConfigData = configResult; // 放内存
// localStorage.setItem("queryConfig",JSON.stringify(configResult)); // 放localStorage
}, 1000);
}
initQueryConfig();
......
......@@ -159,14 +159,18 @@ export default {
},
fetchBanner() {
return new Promise((resolve, reject) => {
httpPost({ url: api.banner }).then(res => {
httpPost({
url: api.banner
}).then(res => {
resolve(res);
});
});
},
fetchIndexVideo() {
return new Promise((resolve, reject) => {
httpPost({ url: api.indexVideo }).then(res => {
httpPost({
url: api.indexVideo
}).then(res => {
sessionStorage.setItem("_video_url", res.videoUrl);
sessionStorage.setItem("_poster_url", res.posterUrl);
resolve(res);
......@@ -214,6 +218,12 @@ export default {
},
mounted() {
this.initData();
setTimeout(() => {
console.log("queryConfigData:", this.$root.queryConfigData);
// console.log("queryConfigData:", window.vueInstance.queryConfigData); // 挂载到windows的访问方法
// 放localStorage直接是localStorage.getItem("queryConfig");
}, 3000)
},
created() {
......