feat:合并

This commit is contained in:
lixg
2022-12-11 20:46:44 +08:00
parent 2ae27f7c75
commit 18e9c7781c
4 changed files with 100 additions and 61 deletions

View File

@@ -1,4 +1,12 @@
export const BASE = 'http://localhost:3000'
/*
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-12-11 16:57:58
* @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-12-11 19:15:07
* @FilePath: /fe-stu/src/api/api.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export const BASE = 'http://111.231.196.214:30001/manageApi'
// export const FILE_UPLOAD = 'http://111.231.196.214:30001/file/upload'
export const FILE_UPLOAD = '/file/upload'
export const COMMON_TOKEN = 'https://upload-z2.qiniup.com'
@@ -27,3 +35,6 @@ export const DISCUSS_LIKE = '/discussSubmit/clickDiscussLikeCountOr POST'
export const DISCUSS_LIST = '/discussSubmit/queryDiscussSubmitDetailByDiscussId'
export const DISCUSS_DETAIL = '/discuss/getDiscussDetail'
export const DISCUSS_SUBMIT_REVIEW_LIST = '/discussSubmit/queryDiscussSubmitAndReview'
//投票
export const VOTE_DETAIL2 = '/vote/queryStemByStemId POST'

View File

@@ -1,5 +1,5 @@
import router from "@/router";
import {ref, watch} from "vue";
import { ref, watch } from "vue";
import axios from 'axios';
export function useRequest(_url, params = {}) {
@@ -49,20 +49,20 @@ export async function request(_url, params) {
method,
headers: {
'X-Token': localStorage.getItem('token'),
...method !== 'get' ? {'Content-Type': 'application/json'} : {}
...method !== 'get' ? { 'Content-Type': 'application/json' } : {}
},
baseURL: '',
...method !== 'get' ? {data: JSON.stringify(body)} : {}
}).then(resp=>resp.data).then(response => {
...method !== 'get' ? { data: JSON.stringify(body) } : {}
}).then(resp => resp.data).then(response => {
if (response.code !== 200 && response.code !== 0) {
if (response.code === 3 || response.code === 4 || response.code === 100) {
// router.push({path: '/login'})
// router.push({path: '/login'})
return
} else {
// response.showMsg && notification.open({
// message: response.showMsg,
// duration: 2,
// });
// response.showMsg && notification.open({
// message: response.showMsg,
// duration: 2,
// });
return
}
}