Commit 74c2f858 by 林家欣

联调动态url

parent 276e7eca
// import { import {
// GET GET
// } from "./fetch.js" } from "./fetch.js"
import Vue from "vue"; import Vue from "vue";
import VueResource from 'vue-resource' import VueResource from 'vue-resource'
Vue.use(VueResource); Vue.use(VueResource);
...@@ -8,13 +8,19 @@ Vue.use(VueResource); ...@@ -8,13 +8,19 @@ Vue.use(VueResource);
const Prefix2 = process.env.NODE_ENV === 'development' ? '/gs1' : process.env.VUE_APP_API_URL; const Prefix2 = process.env.NODE_ENV === 'development' ? '/gs1' : process.env.VUE_APP_API_URL;
/* 公共接口 */ /* 公共接口 */
// 首页大轮播图 // 获取验证码
const getCaptcha = (query = {}) => { const getCaptcha = (query = {}) => {
return Vue.http.get(`${Prefix2}/office/captcha.jpg?uuid=${query.uuid}`, { return Vue.http.get(`${Prefix2}/office/captcha.jpg?uuid=${query.uuid}`, {
responseType: "blob", responseType: "blob",
}) })
} }
// 获取url
const homeGetUrl = (params = {}) => {
return GET(`${Prefix2}/office/domain/api/list`, params)
}
import home from "./module/home.js" import home from "./module/home.js"
import org from "./module/org.js" import org from "./module/org.js"
import business from "./module/business.js" import business from "./module/business.js"
...@@ -37,6 +43,7 @@ const api = { ...@@ -37,6 +43,7 @@ const api = {
news, news,
myManage, myManage,
getCaptcha, getCaptcha,
homeGetUrl,
user, user,
barcode, barcode,
sell, sell,
......
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
</template> </template>
<script> <script>
import TopBanner from './layout/topBanner.vue' import TopBanner from "./layout/topBanner.vue";
import Header from "./layout/header/index.vue"; import Header from "./layout/header/index.vue";
import Footer from "./layout/footer.vue" import Footer from "./layout/footer.vue";
import { mapMutations } from "vuex";
export default { export default {
components: { components: {
TopBanner, TopBanner,
...@@ -26,9 +28,23 @@ export default { ...@@ -26,9 +28,23 @@ export default {
}; };
}, },
computed: {}, computed: {},
methods: {}, created() {
created() {}, this.homeGetUrl();
},
mounted() {}, mounted() {},
methods: {
...mapMutations({
setUrl: "setUrl",
}),
async homeGetUrl() {
const homeGetUrlRes = await this.$api.homeGetUrl();
const { returnCode, data } = homeGetUrlRes;
if (returnCode === "0") {
console.log(homeGetUrlRes, 'homeGetUrlRes');
this.setUrl(data);
}
},
},
}; };
</script> </script>
...@@ -1081,6 +1081,7 @@ export default { ...@@ -1081,6 +1081,7 @@ export default {
async getCustomServiceFromServer() { async getCustomServiceFromServer() {
const searchGlnRes = await this.$api.home.customService(); const searchGlnRes = await this.$api.home.customService();
const { returnCode, data } = searchGlnRes; const { returnCode, data } = searchGlnRes;
if (returnCode === "0") { if (returnCode === "0") {
localStorage.setItem("gs-custom-service", JSON.stringify(data)); localStorage.setItem("gs-custom-service", JSON.stringify(data));
......
export const SET_MATCHE = 'setMatche'; export const SET_MATCHE = 'setMatche';
export const SET_URL = 'setUrl';
...@@ -10,6 +10,7 @@ Vue.use(Vuex) ...@@ -10,6 +10,7 @@ Vue.use(Vuex)
import { import {
SET_MATCHE, SET_MATCHE,
SET_URL,
} from './mutation-types'; } from './mutation-types';
const state = { const state = {
...@@ -27,6 +28,10 @@ const mutations = { ...@@ -27,6 +28,10 @@ const mutations = {
localStorage.setItem('matche', JSON.stringify(data)); localStorage.setItem('matche', JSON.stringify(data));
state.matche = data; state.matche = data;
}, },
[SET_URL](state, data) {
console.log(data, 'data');
// state.urls.gs1cnOne = data[0];
},
}; };
export default new Vuex.Store({ export default new Vuex.Store({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment