Commit 7057b6d3 by 林家欣

fix: 修改发布后接口配置

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