Commit 010bcfb6 by Caiyijun

配置文件

parent 5ea1ece4
import axios from 'axios';//引入axios import axios from 'axios';//引入axios
export function fetch(options) { export function fetch(options) {
// if (!window['userData']) { if (!window['userData']) {
// let user_data_str = localStorage.getItem('walk_userData'); let user_data_str = localStorage.getItem('walk_userData');
// if (user_data_str) { if (user_data_str) {
// window['userData'] = JSON.parse(user_data_str); window['userData'] = JSON.parse(user_data_str);
// } }
// } }
// if (!window['userData']) { if (!window['userData']) {
// localStorage.setItem('last_url', location.hash.slice(1)); localStorage.setItem('last_url', location.hash.slice(1));
// location.replace('#/Author'); location.replace('#/Author');
// // this.$router.push({name:"Author"}) // this.$router.push({name:"Author"})
// } }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const instance = axios.create({ //instance创建一个axios实例,可以自定义配置,可在 axios文档中查看详情 const instance = axios.create({ //instance创建一个axios实例,可以自定义配置,可在 axios文档中查看详情
//所有的请求都会带上这些配置,比如全局都要用的身份信息等。 //所有的请求都会带上这些配置,比如全局都要用的身份信息等。
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
// 'Authorization': window['userData']?window['userData'].token:'' 'Authorization': window['userData']?window['userData'].token:''
'Authorization':"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCJvcGVuX2lkIjoiMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsInVuaW9uX2lkIjoiMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsImV4cCI6MTU1NDMxNzM0NH0.3yWRj-qm-Rk1PcCc7KrifJiuExlzETSBznBxrtYA3dU" // 'Authorization':"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCJvcGVuX2lkIjoiMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsInVuaW9uX2lkIjoiMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsImV4cCI6MTU1NDMxNzM0NH0.3yWRj-qm-Rk1PcCc7KrifJiuExlzETSBznBxrtYA3dU"
// 'token_in_header': global_.token,//token从全局变量那里传过来 // 'token_in_header': global_.token,//token从全局变量那里传过来
}, },
timeout: 30 * 1000 // 30秒超时 timeout: 30 * 1000 // 30秒超时
...@@ -30,16 +30,16 @@ export function fetch(options) { ...@@ -30,16 +30,16 @@ export function fetch(options) {
resolve(response.data);//把请求到的数据发到引用请求的地方 resolve(response.data);//把请求到的数据发到引用请求的地方
}) })
.catch(error => { .catch(error => {
// console.log('请求异常信息:', error); console.log('请求异常信息:', error);
// console.log(error); console.log(error);
// if (error.response.status == 401) { if (error.response.status == 401) {
// localStorage.setItem('last_url', location.hash.slice(1)); localStorage.setItem('last_url', location.hash.slice(1));
// localStorage.setItem('walk_userData', ''); localStorage.setItem('walk_userData', '');
// location.replace('#/Author'); location.replace('#/Author');
// // this.$router.push({name:"Author"}) // this.$router.push({name:"Author"})
// } else { } else {
// reject(error); reject(error);
// } }
}); });
}); });
......
//也可以像下面这样,区分环境或者区分服务器等等 //也可以像下面这样,区分环境或者区分服务器等等
let service = 'dev' // let service = 'dev'
// let service = 'prod'; let service = 'prod';
let api = '' let api = ''
if (service === 'dev') { if (service === 'dev') {
/**dev开发**/ /**dev开发**/
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
>{{item.status===0?'未开始':item.status===1?'比赛中':item.status===2?'已结束':'已淘汰'}} >{{item.status===0?'未开始':item.status===1?'比赛中':item.status===2?'已结束':'已淘汰'}}
</div> </div>
</div> </div>
<div class="item-income" :style="item.status===1?'':'visibility: hidden;'"> <div class="item-income" :style="item.status===1?'':'visibility: hidden;'">
<div class="item-amount">{{item.money|moneyFormatter}}</div> <div class="item-amount">{{item.money|moneyFormatter}}</div>
<div class="item-text">(元) 预计收益</div> <div class="item-text">(元) 预计收益</div>
</div> </div>
......
//vue.config.js //vue.config.js
module.exports = { module.exports = {
// 选项... // 选项...
// publicPath: 'https://miniapp-api.wxatech.com/app_pages', publicPath: 'https://miniapp-api.wxatech.com/app_pages',
// indexPath: "walk_daka.html", indexPath: "walk_daka.html",
// assetsDir: "walk_static", assetsDir: "walk_static",
devServer: { devServer: {
proxy: { proxy: {
'/api': { '/api': {
......
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