Commit 8a9d7eae by liu zhuoyu

线上版

parent 851f1a68
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -58,7 +58,7 @@
wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: "wx9af64967a0d40159", // 必填,公众号的唯一标识
appId: "wxd1aab06cc88d0a5e", // 必填,公众号的唯一标识
timestamp: res.timestamp, // 必填,生成签名的时间戳
nonceStr: res.nonceStr, // 必填,生成签名的随机串
signature: res.signature, // 必填,签名
......
import axios from 'axios';//引入axios
export function fetch(options) {
// if (!window['userData']) {
// let user_data_str = localStorage.getItem('walk_userData');
// if (user_data_str) {
// window['userData'] = JSON.parse(user_data_str);
// }
// }
// if (!window['userData']) {
// localStorage.setItem('last_url', location.hash.slice(1));
// location.replace('#/Author');
// // this.$router.push({name:"Author"})
// }
if (!window['userData']) {
let user_data_str = localStorage.getItem('walk_userData');
if (user_data_str) {
window['userData'] = JSON.parse(user_data_str);
}
}
if (!window['userData']) {
localStorage.setItem('last_url', location.hash.slice(1));
location.replace('#/Author');
// this.$router.push({name:"Author"})
}
return new Promise((resolve, reject) => {
const instance = axios.create({ //instance创建一个axios实例,可以自定义配置,可在 axios文档中查看详情
//所有的请求都会带上这些配置,比如全局都要用的身份信息等。
headers: {
'Content-Type': 'application/json',
// 'Authorization': window['userData']?window['userData'].token:''
'Authorization':"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCJvcGVuX2lkIjoiMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsImV4cCI6MTU1Mzk3MTExOX0.KZhzLx6y6t_wDHU35DWNGVIp9M1tZLKzhaW8kMoeBoU"
'Authorization': window['userData']?window['userData'].token:''
// 'Authorization':"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCJvcGVuX2lkIjoiMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsImV4cCI6MTU1Mzk3MTExOX0.KZhzLx6y6t_wDHU35DWNGVIp9M1tZLKzhaW8kMoeBoU"
// 'token_in_header': global_.token,//token从全局变量那里传过来
},
timeout: 30 * 1000 // 30秒超时
......@@ -31,15 +31,15 @@ export function fetch(options) {
})
.catch(error => {
console.log('请求异常信息:', error);
// console.log(error);
// if (error.response.status == 401) {
// localStorage.setItem('last_url', location.hash.slice(1));
// localStorage.setItem('walk_userData', '');
// location.replace('#/Author');
// // this.$router.push({name:"Author"})
// } else {
// reject(error);
// }
console.log(error);
if (error.response.status == 401) {
localStorage.setItem('last_url', location.hash.slice(1));
localStorage.setItem('walk_userData', '');
location.replace('#/Author');
// this.$router.push({name:"Author"})
} else {
reject(error);
}
});
});
......
......@@ -4,7 +4,8 @@ let service = 'dev';
let api = '';
if (service === 'dev') {
/**dev开发**/
api = '';
// api = '';
api = 'https://miniapp-api.wxatech.com/game-bsdk';
} else if (service === 'prod') {
/**prod部署**/
api = 'https://miniapp-api.wxatech.com/game-bsdk';
......
......@@ -20,7 +20,7 @@
let local_hash = location.hash;
window.localStorage.setItem("local_hash", local_hash);
let redirect_uri = encodeURIComponent(`${location.origin}${location.pathname}`);
location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9af64967a0d40159&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`);
location.replace(`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd1aab06cc88d0a5e&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`);
} else {
console.log("拿到code", code);
console.log("请求登录");
......@@ -54,7 +54,7 @@
// setTimeout(() => {
// // this.$router.go("/MyData");
location.replace(
`https://miniapp-api.wxatech.com/app_pages/read_daka.html?#${last_url}`
`https://miniapp-api.wxatech.com/app_pages/walk_daka.html?#${last_url}`
);
// }, 60000);
}
......
//vue.config.js
module.exports = {
// 选项...
// publicPath: 'https://miniapp-api.wxatech.com/app_pages',
// indexPath: "read_daka.html",
// assetsDir: "read_static",
publicPath: 'https://miniapp-api.wxatech.com/app_pages',
indexPath: "walk_daka.html",
assetsDir: "walk_static",
devServer: {
proxy: {
'/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