更改requser让手机端也能正常访问网络

This commit is contained in:
田岩
2025-06-23 15:57:00 +08:00
parent 1ba4ebe14f
commit a4c57e1185
8 changed files with 109 additions and 195 deletions
+2 -3
View File
@@ -9,9 +9,8 @@ ENV = 'development'
#VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786'
#VITE_APP_BASE_API_Url = 'http://aitstest.jlbank.com.cn:7002'
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# app入口
VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001'
#VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001'
+45 -3
View File
@@ -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
View File
@@ -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);
}
});
})
+9 -162
View File
@@ -1,5 +1,4 @@
{
<<<<<<< HEAD
"pages": [
{
"path": "pages/index/index",
@@ -19,6 +18,15 @@
}
}
},
{
"path": "pages/courseDetail/submit",
"style": {
"navigationBarTitleText": "提交评价",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/study/index",
"style": {
@@ -155,165 +163,4 @@
}
},
"uniIdRouter": {}
=======
"pages": [{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/courseDetail/index",
"style": {
"navigationBarTitleText": "课程详情",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/courseDetail/submit",
"style": {
"navigationBarTitleText": "提交评价",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/study/index",
"style": {
"navigationBarTitleText": "学习",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/intelligentAnswering/index",
"style": {
"navigationBarTitleText": "智能问答",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/scene/index",
"style": {
"navigationBarTitleText": "场景",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/me/index",
"style": {
"navigationBarTitleText": "我的",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/other/web_view",
"style": {
"navigationBarTitleText": "",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/login/ysxy",
"style": {
"navigationBarTitleText": "",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/search/search",
"style": {
"navigationBarTitleText": "",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/course/index",
"style": {
"navigationBarTitleText": "课程中心",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/course/study",
"style": {
"navigationBarTitleText": ""
}
}
],
"tabBar": {
"list": [{
"text": "首页",
"pagePath": "pages/index/index"
},
{
"text": "学习",
"pagePath": "pages/study/index"
},
{
"text": "场景",
"pagePath": "pages/scene/index"
},
{
"text": "我的",
"pagePath": "pages/me/index"
}
],
"color": "#666666",
"selectedColor": "#0066FF",
"fontSize": "16px",
"borderStyle": "white",
"borderColor": "#ffffff",
"height": "70px",
"spacing": "10px",
"midButton": {
"iconPath": "/static/images/icon/fawn.png",
"width": "86px",
"height": "86px",
"iconWidth": "90px"
}
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "AI智能培训",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"navigationStyle": "custom",
"app-plus": {
"titleView": false,
"bounce": "none"
}
},
"uniIdRouter": {}
>>>>>>> 8af971b2f3c186031f86d692251cf77f91455270
}
+14 -1
View File
@@ -29,11 +29,24 @@
<script setup>
import {
reactive
reactive,
onMounted
} from 'vue'
import {
qryTraCrsBbsDataByCrsNum
} from '@/api/courseDetail.js';
const message_list = reactive([
])
const props = defineProps({
crsNum:String
})
onMounted(() => {
qryTraCrsBbsDataByCrsNum({crsNum:props.crsNum}).then(() => {
})
})
</script>
<style lang="scss" scoped>
+1 -1
View File
@@ -36,7 +36,7 @@
<knowledge v-model="form"></knowledge>
</view>
<view class="evaluate" v-if="tabAct == 2">
<comment></comment>
<comment :crsNum="crsNum"></comment>
</view>
</view>
</view>
+9 -3
View File
@@ -10,21 +10,25 @@
</view>
</view>
<view class="pt-8">
<view class="font_pf fz-24" :class="item.pgrphStdyStateName == '已学习' ? 'learn' : 'unlearn'">{{ item.pgrphStdyStateName }}</view>
<view class="font_pf fz-24" :class="item.pgrphStdyStateName == '已学习' ? 'learn' : 'unlearn'">
{{ item.pgrphStdyStateName }}</view>
</view>
</view>
</template>
<script setup>
import common from '@/common/common';
const props = defineProps({
modelValue:Object
modelValue: Object
})
</script>
<style lang="scss" scoped>
.point-item {
background-color: #fff;
display: flex;
@@ -33,9 +37,11 @@
padding-right: 52rpx;
border-radius: 22rpx;
justify-content: space-between;
.blue-ball {
padding-top: 16rpx;
margin-right: 12rpx;
.ball {
width: 12rpx;
height: 12rpx;
+6 -7
View File
@@ -118,6 +118,7 @@
queryTraStdyStatisticsSelf
} from '@/api/user.js'
const statistics_data = reactive({
'stdtTmLen': 2, // 学习
'study': 0, // 学习
'train': 0, // 训练
'exam': 0, // 考试
@@ -188,13 +189,11 @@
onShow(() => {
const user_info_cache = getUserInfo()
Object.assign(user_info, user_info_cache)
queryTraStdyStatisticsSelf().then(res => {
statistics_data['accmPoint'] = res['accmPoint']
statistics_data['accmTaskCnt'] = res['accmTaskCnt']
statistics_data['stdtTmLen'] = res['stdtTmLen']
console.log('res', res);
console.log('res', res);
console.log('res', res);
queryTraStdyStatisticsSelf().then(({body}) => {
statistics_data['accmPoint'] = body['accmPoint']
statistics_data['accmTaskCnt'] = body['accmTaskCnt']
statistics_data['stdtTmLen'] = body['stdtTmLen']
console.log('res', body);
})
// statistics_data['get_statistics_data']() // 获取首页统计数据
})