a1300399510@qq.com 提交于 2023/04/04 -11:00:02
This commit is contained in:
parent
658f070cc1
commit
681703809e
@ -1,3 +1,3 @@
|
||||
const baseURL = 'https://forum.gter.net/api';
|
||||
const baseURL = 'https://forum.gter.net';
|
||||
|
||||
export default baseURL
|
@ -4,26 +4,28 @@ import axios from 'axios'
|
||||
// 使用element-ui Message做消息提醒
|
||||
import { Message } from 'element-ui';
|
||||
import baseURL from '@/utils/baseApi'
|
||||
import { skipUrl, pageStop, pageMove, goTologin } from "@/utils/common.js"
|
||||
import { goTologin } from "@/utils/common.js"
|
||||
|
||||
//1. 创建新的axios实例,
|
||||
axios.defaults.withCredentials = true
|
||||
axios.defaults.emulateJSON = true
|
||||
// baseURL = "https://offer.gter.net/api"
|
||||
baseURL = "https://forum.gter.net"
|
||||
|
||||
baseURL = {
|
||||
forum: "https://forum.gter.net",
|
||||
offer: "https://offer.gter.net",
|
||||
}
|
||||
|
||||
const service = axios.create({
|
||||
baseURL,
|
||||
baseURL: baseURL.forum,
|
||||
timeout: 5000
|
||||
})
|
||||
|
||||
// service.header.authorization = "qj2q1qk1on0curclipghjtv5ja1g9eq2"
|
||||
|
||||
// 2.请求拦截器
|
||||
service.interceptors.request.use(config => {
|
||||
//发请求前做的一些处理,数据转化,配置请求头,设置token,设置loading等,根据需求去添加
|
||||
//注意使用token的时候需要引入cookie方法或者用本地localStorage等方法,推荐js-cookie
|
||||
console.log(config, "config");
|
||||
config['baseURL'] = "https://offer.gter.net/details/iem04u0WK0mH"
|
||||
// config['baseURL'] = "https://offer.gter.net"
|
||||
config['headers']['authorization'] = "qj2q1qk1on0curclipghjtv5ja1g9eq2"
|
||||
return config
|
||||
}, error => {
|
||||
@ -99,20 +101,26 @@ const http = {
|
||||
* methods: 请求
|
||||
* @param url 请求地址
|
||||
* @param params 请求参数
|
||||
* @param baseURLName 域名名称 不传为论坛
|
||||
* @param ispop 报错是否需要弹窗
|
||||
*/
|
||||
get(url, params, ispop = true) {
|
||||
get(url, params, baseURLName, ispop = true) {
|
||||
const config = {
|
||||
method: 'get',
|
||||
url: url
|
||||
url,
|
||||
baseURL: baseURL[baseURLName],
|
||||
|
||||
}
|
||||
if (params) config.params = params
|
||||
config.ispop = ispop
|
||||
return service(config)
|
||||
},
|
||||
post(url, params, ispop = true) {
|
||||
post(url, params, baseURLName, ispop = true) {
|
||||
const config = {
|
||||
method: 'post',
|
||||
url: url
|
||||
url: url,
|
||||
baseURL: baseURL[baseURLName],
|
||||
|
||||
}
|
||||
if (params) config.data = params
|
||||
config.ispop = ispop
|
||||
|
@ -277,7 +277,7 @@ export default {
|
||||
info: {},
|
||||
type: 0, // 定位帖 1 面经 2 租房帖 3 总结 5 捷报 6
|
||||
token: "",
|
||||
|
||||
offerinfo: {}, // offer捷报详情
|
||||
|
||||
|
||||
|
||||
@ -288,6 +288,7 @@ export default {
|
||||
mounted() {
|
||||
this.tid = this.$route.query['tid']
|
||||
this.getDetail()
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
@ -312,7 +313,13 @@ export default {
|
||||
|
||||
// 获取offer详情
|
||||
getOfferDetail() {
|
||||
|
||||
this.$http.post("/api/details", {
|
||||
token: "aKpet3Y6LVE50g0a1TMJ9CO_fWeZORk7ZswsZAkMwwupQ2lbtcsjmX1np5mUmPKVla8FzCF8ZNJySac3tX-r8ULfxTS6S4Grt_SaX84Tov9BHHh9L568EHRR9CMIbYIOQI76V-jgTuur3qck0L4lAvgbcwSi5c9MUS5qI7zXYMklqBguz5n0Fgy794uePqhF_W9PwA0IQwGuLWIcvSZ8RqrhUM4cadRC4TgxN2Mx"
|
||||
}, 'offer').then(res => {
|
||||
console.log("res", res);
|
||||
let data = res.data
|
||||
this.offerinfo = data.offerinfo
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user