Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop
This commit is contained in:
+45
-3
@@ -1,12 +1,54 @@
|
||||
import request from '@/api/request'
|
||||
|
||||
const base_url = '/traapp'
|
||||
const module_url = '/traapp'
|
||||
|
||||
// 获取课程分类树接口
|
||||
// AITS-A-4006--APP课程详情查询-含知识点学习状态数据
|
||||
export const getCourseDetailApi = (data) => {
|
||||
return request({
|
||||
url: base_url + '/crsInfo/queryCrsInfoDetail',
|
||||
url: module_url + '/crsInfo/queryCrsInfoDetail',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// AITS-A-4007--APP课程评价列表数据查询
|
||||
export const qryTraCrsBbsDataByCrsNum = (data) => {
|
||||
return request({
|
||||
url: module_url + '/traCrsBbsInfo/qryTraCrsBbsDataByCrsNum',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
// AITS-A-4008--APP课程评价下回复评论时刷新二级评论列表数据接口
|
||||
export const qryChildTraCrsBbsInfo = (data) => {
|
||||
return request({
|
||||
url: module_url + '/traCrsBbsInfo/qryChildTraCrsBbsInfo',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// AITS-A-4009--APP课程评价回复评论接口
|
||||
export const replyTraCrsBbsInfo = (data) => {
|
||||
return request({
|
||||
url: module_url + '/traCrsBbsInfo/replyTraCrsBbsInfo',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// AITS-A-4010--APP课程评价接口
|
||||
export const publishCrsEvaluation = (data) => {
|
||||
return request({
|
||||
url: module_url + '/traCrsBbsInfo/publishCrsEvaluation',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
+23
-15
@@ -6,18 +6,26 @@ import common from '@/common/common.js'
|
||||
const ENV = import.meta.env
|
||||
|
||||
export const get_base_url = url => {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// 开发环境
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
} else if (process.env.NODE_ENV === 'production') {
|
||||
// 生产环境
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
if (process.env.NODE_ENV === 'development') { // 开发环境
|
||||
// H5必须用非https,手机端必须用https
|
||||
// #ifdef H5
|
||||
const baseUrl = ENV.VITE_APP_BASE_API_Url
|
||||
if (baseUrl.startsWith('https')) {
|
||||
return baseUrl.replace('https', 'http')
|
||||
}
|
||||
return baseUrl
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
// #endif
|
||||
} else if (process.env.NODE_ENV === 'production') { // 生产环境
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
}
|
||||
}
|
||||
|
||||
// 请求错误码
|
||||
export const REQUES_ERROR_CODES = {
|
||||
NO_LOGIN: ['QQ0005', '0005'] //登录
|
||||
NO_LOGIN: ['QQ0005', '0005'] //登录
|
||||
};
|
||||
|
||||
// 去登录弹窗状态
|
||||
@@ -27,7 +35,7 @@ export const goto_login_fun = () => {
|
||||
// if (no_login_show_modal_state) return;
|
||||
no_login_show_modal_state = true
|
||||
common.hideLoading()
|
||||
common.show('未登录','现在去登录').then(() => {
|
||||
common.show('未登录', '现在去登录').then(() => {
|
||||
common.navigateTo('/pages/login/login')
|
||||
}).finally(() => {
|
||||
no_login_show_modal_state = false
|
||||
@@ -42,13 +50,13 @@ export default function request({
|
||||
meta,
|
||||
isStream,
|
||||
suppressErrors,
|
||||
header={}
|
||||
header = {}
|
||||
}) {
|
||||
const base_url = get_base_url(url);
|
||||
|
||||
const headers_base = {
|
||||
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
...(header||{})
|
||||
...(header || {})
|
||||
}
|
||||
|
||||
let token = getToken()
|
||||
@@ -69,11 +77,11 @@ export default function request({
|
||||
// suppressErrors
|
||||
// 模拟拦截器功能
|
||||
const res = response.data
|
||||
if (res?.rtnCode === '0000'){
|
||||
if (res?.rtnCode === '0000') {
|
||||
return resolve(res)
|
||||
}
|
||||
//到这里下面全是异常的处理
|
||||
if(suppressErrors){ // 静默的接口,报错也不处理,因为下面有公共处理
|
||||
if (suppressErrors) { // 静默的接口,报错也不处理,因为下面有公共处理
|
||||
return reject()
|
||||
}
|
||||
if (!res) {
|
||||
@@ -81,14 +89,14 @@ export default function request({
|
||||
return reject()
|
||||
}
|
||||
// 0005 QQ0005 登录已过期
|
||||
if(REQUES_ERROR_CODES['NO_LOGIN'].includes(res.rtnCode)) {
|
||||
if (REQUES_ERROR_CODES['NO_LOGIN'].includes(res.rtnCode)) {
|
||||
goto_login_fun()
|
||||
}
|
||||
|
||||
|
||||
return reject(res)
|
||||
},
|
||||
fail(res) {
|
||||
console.log('131231', res, url);
|
||||
console.log('131231', res, url, base_url);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user