Commit 7057b6d3 by 林家欣

fix: 修改发布后接口配置

parent f62c5d85
VUE_APP_CURRENTMODE = "development"
VUE_APP_HOST_URL = "http://81.68.189.225:9091"
VUE_APP_API_URL = "/"
VUE_APP_GDS_URL = "/gds"
VUE_APP_LOG = true
\ No newline at end of file
VUE_APP_CURRENTMODE = "production"
VUE_APP_HOST_URL = "http://192.168.0.47:8090"
VUE_APP_HOST_URL = "http://81.68.189.225:9091"
VUE_APP_API_URL = "http://81.68.189.225:9091"
VUE_APP_GDS_URL = "http://data-studio.gds.org.cn"
VUE_APP_LOG = false
\ No newline at end of file
......@@ -12,7 +12,7 @@ gzip_vary on;
gzip_disable "MSIE [1-6]\.";
server {
listen 8088;
listen 9091;
server_name 81.68.189.225;
location / {
root /usr/share/nginx/html;
......
<template>
<div id="app">
<router-view></router-view>
</div>
<div id="app">
<router-view></router-view>
</div>
</template>
<script>
export default {
created() {
console.log(process.env, 'process.env');
},
};
</script>
<style>
.container-fluid{
padding: 0 !important;
.container-fluid {
padding: 0 !important;
}
</style>
import {
GET
} from "./fetch.js"
// import {
// GET
// } from "./fetch.js"
import Vue from "vue";
import VueResource from 'vue-resource'
Vue.use(VueResource);
const Prefix = process.env.NODE_ENV === 'development' ? '/gs1' : '';
const Prefix2 = process.env.NODE_ENV === 'development' ? '/gs1' : process.env.VUE_APP_API_URL;
/* 公共接口 */
// 首页大轮播图
const getCaptcha = (query = {}) => {
return GET(`${Prefix}/office/captcha.jpg`, query)
return Vue.http.get(`${Prefix2}/office/captcha.jpg?uuid=${query.uuid}`, {
responseType: "blob",
})
}
import home from "./module/home.js"
......
......@@ -18,7 +18,9 @@ import {
getToken
} from "@/utils/cookie.js"
const baseUrl = process.env.BASE_URL
const baseUrl = process.env.VUE_APP_API_URL;
console.log(process.env, baseUrl, 'baseUrl');
function fetch(options) {
return new Promise((resolve, reject) => {
const instance = axios.create({
......
// 节流
export function throttle(fn, interval) {
let delay = interval || 1500
let previous = 0
return function() {
let now = Date.now()
let that = this
let args = arguments
if (now - previous > delay) {
fn.apply(that, args)
previous = now
}
let delay = interval || 1500
let previous = 0
return function () {
let now = Date.now()
let that = this
let args = arguments
if (now - previous > delay) {
fn.apply(that, args)
previous = now
}
}
}
// 防抖
export function debounce(fn, interval) {
let delay = interval || 1500
let timer = null
return function() {
let that = this
let args = arguments
timer && clearTimeout(timer)
timer = setTimeout(function() {
fn.apply(that, args)
}, delay)
}
let delay = interval || 1500
let timer = null
return function () {
let that = this
let args = arguments
timer && clearTimeout(timer)
timer = setTimeout(function () {
fn.apply(that, args)
}, delay)
}
}
var unique = 0;
export function uuid(prefix) {
const time = Date.now();
const random = Math.floor(Math.random() * 1000000000);
unique++;
return prefix + '_' + random + unique + String(time);
const time = Date.now();
const random = Math.floor(Math.random() * 1000000000);
unique++;
return prefix + '_' + random + unique + String(time);
}
// 一维数组转换成二维数组
export const groupList = (list, length) => {
const pages = [];
list.forEach((item, index) => {
const page = Math.floor(index / length);
if (!pages[page]) {
pages[page] = [];
}
pages[page].push(item);
});
return pages;
};
const pages = [];
list.forEach((item, index) => {
const page = Math.floor(index / length);
if (!pages[page]) {
pages[page] = [];
}
pages[page].push(item);
});
return pages;
};
/**
* 获取uuid
*/
export const getUUID = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
return (c === 'x' ? (Math.random() * 16 | 0) : ('r&0x3' | '0x8')).toString(16)
})
}
\ No newline at end of file
/**
* 获取uuid
*/
export const getUUID = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
return (c === 'x' ? (Math.random() * 16 | 0) : ('r&0x3' | '0x8')).toString(16)
})
}
\ No newline at end of file
......@@ -1009,7 +1009,8 @@ export default {
},
// 商品全球身份证
async homeNewGtin() {
this.$http.get("/gds/Data/NewGtin").then((res) => {
console.log(process.env, 'process.env');
this.$http.get(`${process.env.VUE_APP_GDS_URL}/Data/NewGtin`).then((res) => {
res.body.murl = `http://data-studio.gds.org.cn/${res.body.murl}`;
res.body.surl = `http://data-studio.gds.org.cn/${res.body.surl}`;
this.spqqsfz = res.body;
......
......@@ -165,13 +165,13 @@ export default {
// 获取验证码
getCaptcha() {
this.uuid = getUUID();
this.$http
.get(`/gs1/office/captcha.jpg?uuid=${this.uuid}`, {
responseType: "blob",
})
.then((res) => {
this.captchaPath = window.URL.createObjectURL(res.body);
});
const query = {
uuid: this.uuid,
};
this.$api.getCaptcha(query).then((res) => {
console.log(res, 'res');
this.captchaPath = window.URL.createObjectURL(res.body);
});
},
handleSearch() {
this.searchCodeShow = this.search.code;
......
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