api base 调整,接口对接

This commit is contained in:
yanghang
2025-06-19 16:24:16 +08:00
parent 543e1a53eb
commit 21db4ae1a0
9 changed files with 339 additions and 186 deletions
+1
View File
@@ -4,3 +4,4 @@ ENV = 'development'
# base api
VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
# VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786'
+3 -3
View File
@@ -4,7 +4,7 @@ import request from '@/api/request'
// 获取课程分类树接口
export const getCourseTypeListApi = (data) => {
return request({
url: '/app/traCrsCatalogInfo/courseQueryTraCrsCatalogInfoList',
url: '/traapp/app/traCrsCatalogInfo/courseQueryTraCrsCatalogInfoList',
method: 'post',
data
});
@@ -12,7 +12,7 @@ export const getCourseTypeListApi = (data) => {
// 获取生产线分类树接口
export const getPrdLineTypeListApi = (data) => {
return request({
url: '/app/traPrdLineInfo/courseQueryTraPrdLineInfoList',
url: '/traapp/app/traPrdLineInfo/courseQueryTraPrdLineInfoList',
method: 'post',
data
});
@@ -20,7 +20,7 @@ export const getPrdLineTypeListApi = (data) => {
// 获取标签分类树 接口
export const getTraTagListApi = (data) => {
return request({
url: '/app/traTagCatalogInfo/queryTraTagCatalogInfoList',
url: '/traapp/app/traTagCatalogInfo/queryTraTagCatalogInfoList',
method: 'post',
data
});
+4 -4
View File
@@ -6,7 +6,7 @@ const setUserInfo = data => uni.setStorageSync('userInfo', data)
// 账号登录接口
export const useAccountLoginApp = (data) => request({
url: '/access/userLogin',
url: '/traapp/access/userLogin',
method: 'post',
data
}).then(async({ rtnCode, body }) => {
@@ -29,21 +29,21 @@ export const useAccountLoginApp = (data) => request({
// 获取个人信息
export const queryCurrentUser = (data) => request({
url: '/access/queryCurrentUser',
url: '/traapp/access/queryCurrentUser',
method: 'post',
data
})
//获取隐私协议
export const getYsxy = (data) => request({
url: '/dfAgtInfo/queryValidDfAgt',
url: '/traapp/dfAgtInfo/queryValidDfAgt',
method: 'post',
data
})
// 获取验证码(作废)
export const getLoginAppCheckCode = (data) => request({
url: '/access/checkCode',
url: '/traapp/access/checkCode',
method: 'get',
data
})
+8 -6
View File
@@ -8,10 +8,10 @@ const ENV = import.meta.env
export const get_base_url = url => {
if (process.env.NODE_ENV === 'development') {
// 开发环境
return ENV.VITE_APP_BASE_API_Url + "/traapp"
return ENV.VITE_APP_BASE_API_Url
} else if (process.env.NODE_ENV === 'production') {
// 生产环境
return ENV.VITE_APP_BASE_API_Url + "/traapp"
return ENV.VITE_APP_BASE_API_Url
}
}
@@ -21,17 +21,19 @@ export default function request({
data,
meta,
isStream,
suppressErrors
suppressErrors,
header={}
}) {
const base_url = get_base_url(url);
const header = {
const headers_base = {
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
...(header||{})
}
let token = getToken()
if (token) {
header['summary'] = token // 让每个请求携带令牌
headers_base['summary'] = token // 让每个请求携带令牌
}
let that = this
return new Promise((resolve, reject) => {
@@ -39,7 +41,7 @@ export default function request({
url: `${base_url}${url}`,
data: data,
method: method,
header: header,
header: headers_base,
success: (response) => {
if (isStream) { // 流式传输,直接返回
return resolve(response);
+76 -4
View File
@@ -1,20 +1,92 @@
<template>
<view>
<view class="course-item-box" @click="clickItem">
<ImagePreview class="img-box"></ImagePreview>
<view class="cont-box">
<view class="item-title">{{itemInfo.crsName}}</view>
<uv-scroll-list class="item-tags" :indicator="false">
<view class="item-tag" v-for="item in itemInfo.tagsList">{{item.tagName}}</view>
</uv-scroll-list>
<view class="item-publish">发布{{itemInfo.publicTime}}</view>
<view class="item-num">已学{{itemInfo.learnedNum}}人次</view>
</view>
</view>
</template>
<script>
<script >
import ImagePreview from '@/components/image-preview/image-preview.vue'
export default {
name:"course-item",
components:{
ImagePreview
},
props:{
itemInfo:{
type:Object,
default:()=>({
crsName: '银行核心业务全流程实践哒哒哒哒',
tagsList:[{tagName:'公斤业务'},{tagName:'初级'}],
publicTime:"2025-01-03",
learnedNum:'2222222'
})
}
},
data() {
return {
};
},
methods:{
clickItem(){
this.$emit('clickItem')
}
}
}
</script>
<style lang="scss">
.course-item-box{
padding: 15rpx;
overflow: hidden;
.img-box{
width: 170rpx;
height: 170rpx;
float: left;
}
.cont-box{
width: calc(100% - 170rpx);
box-sizing: border-box;
padding: 0 10rpx 0 20rpx;
float: left;
.item-title{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 44rpx;
font-size: 29rpx;
font-weight: 500;
margin-bottom: 10rpx;
}
.item-tags{
padding-bottom: 0 !important;
.item-tag{
height: 32rpx;
line-height: 32rpx;
font-size: 20rpx;
background-color: #eee;
color: rgb(51, 51, 51);
padding: 0 20rpx;
border-radius: 16rpx;
margin-right: 20rpx;
}
}
.item-publish,
.item-num{
height: 32rpx;
line-height: 32rpx;
font-size: 20rpx;
color: rgb(102,102,102);
margin-top: 6rpx;
}
}
}
</style>
+13 -12
View File
@@ -1,9 +1,10 @@
<template>
<image :src="imgUrl"></image>
<!-- <image :src="imgUrlShow"></image> -->
<image class="img" src="@/static/images/test/1.png"></image>
</template>
<script>
import previewFile from'@/api/common.js'
import {previewFile} from'@/api/common.js'
export default {
name:"image-preview",
props:{
@@ -14,7 +15,7 @@
},
data() {
return {
imgUrl
imgUrlShow:''
};
},
watch: {
@@ -39,15 +40,15 @@
},
methods: {
getPreviewUrlBlob(id) {
previewFile(id).then((res) => {
this.imgUrlShow = URL.createObjectURL(res);
// const reader = new FileReader();
// reader.readAsDataURL(res)
// reader.onloadend = () => {
// this.imgUrlShow = reader.result;
// }
});
this.imgUrlShow = '@/static/images/index/message_b.png'
// previewFile(id).then((res) => {
// this.imgUrlShow = URL.createObjectURL(res);
// // const reader = new FileReader();
// // reader.readAsDataURL(res)
// // reader.onloadend = () => {
// // this.imgUrlShow = reader.result;
// // }
// });
},
},
mounted() {
+138 -137
View File
@@ -1,139 +1,140 @@
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/study/index",
"style": {
"navigationBarTitleText": "学习",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/course/index",
"style": {
"navigationBarTitleText": "课程中心",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/intelligent_answering/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
},
"enablePullDownRefresh": true
}
},
{
"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
}
}
}
],
"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": {}
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/study/index",
"style": {
"navigationBarTitleText": "学习",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/intelligent_answering/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
},
"enablePullDownRefresh": true
}
},
{
"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
}
}
}
],
"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": {}
}
+87 -19
View File
@@ -29,12 +29,29 @@
<uv-tags text="全部" v-for="item in 15" shape="circle" plain type="info" class="tags-item" size="mini"></uv-tags>
</uv-scroll-list>
<view class="course-list">
<view class="left-type-list">
<view v-for="item in 6" :class="['type-item', item == 3 ?'is-active':'']">
课程分类
</view>
<view class="left-type-list" v-if="'全部' === activeTab">
<view
v-for="item in courseTypeList"
:key="item.value"
:class="['type-item',activeCourseType == item.value ?'is-active':'']"
@click="activeCourseType = item.value"
>
{{item.label}}
</view>
</view>
<view class="left-type-list" v-if="'生产线'===activeTab">
<view
v-for="item in coursePrdlineList"
:key="item.value"
:class="['type-item', activePrdlineType == item.value ?'is-active':'']"
@click="activePrdlineType = item.value"
>
{{item.label}}
</view>
</view>
<view class="right-course-list">
<CourseItem v-for="item in 6"/>
</view>
<view class="right-course-list"></view>
</view>
</view>
</view>
@@ -42,13 +59,14 @@
</template>
<script setup>
import CourseItem from "@/components/course-item/course-item.vue"
import common from '@/common/common'
import {
getPrdLineTypeListApi,
getTraTagListApi,
getCourseTypeListApi
} from "@/api/course.js"
import { onMounted } from 'vue'
import { onMounted, ref, computed } from 'vue'
const customStyle = {
backgroundColor: "#ffffff",
paddingLeft: "40rpx",
@@ -63,24 +81,63 @@ import { onMounted } from 'vue'
}
const tabsCustomStyle ={
backgroundColor: "#ffffff",
marginTop: '23rpx',
borderRadius: '23rpx',
}
const tabList = [
{ name:'全部'},
{ name:'热门'},
{ name:'最新'},
{ name:'推荐'},
{ name:'生产线'},
]
{ name:'全部'},
{ name:'热门'},
{ name:'最新'},
{ name:'推荐'},
{ name:'生产线'},
]
const activeTab = ref('全部')
const activeCourseType = ref('')
const activePrdlineType = ref('')
const courseTypeList = ref([])
const coursePrdlineList = ref([])
const tagsTree = ref([])
const tagsList = computed(()=>{
let _arr = []
tagsTree.value.forEach(t=>{
let _tarr = t.children || []
_arr = _arr.concat(_tarr)
})
return _arr.sort(a,b=>{
t.required == "y" && b.required === 'N'
})
})
const changeTab = (item) => {
console.log(item)
activeTab.value = item.name
switch (item.name){
case '全部':
console.log(item.name)
break;
case '热门':
console.log(item.name)
break;
case '最新':
console.log(item.name)
break;
case '推荐':
console.log(item.name)
break;
case '生产线':
console.log(item.name)
break;
}
}
onMounted(()=>{
// getPrdLineTypeListApi().then(res=>{
// console.log(res)
// })
getCourseTypeListApi().then(res=>{
courseTypeList.value = res.body||[]
})
getPrdLineTypeListApi().then(res=>{
coursePrdlineList.value = res.body||[]
})
getTraTagListApi().then(res=>{
tagsTree.value = res.body||[]
})
})
</script>
@@ -102,6 +159,7 @@ import { onMounted } from 'vue'
}
.course-center-body{
position: absolute;
overflow: hidden;
left:0;
top: 0;
height: 100%;
@@ -120,6 +178,7 @@ import { onMounted } from 'vue'
font-weight: 500;
color:#000;
position: relative;
// margin-bottom: 23rpx;
.arrow-icon{
position: absolute;
left:36rpx;
@@ -139,6 +198,7 @@ import { onMounted } from 'vue'
}
.list-view{
flex:1;
overflow: hidden;
margin-bottom: 80rpx;
background: #ffffff;
border-radius: 23rpx;
@@ -164,10 +224,12 @@ import { onMounted } from 'vue'
}
.course-list{
display: flex;
flex:1;
flex:1;
overflow: hidden;
.left-type-list{
width: 152rpx;
border-right: 2rpx solid #eee;
overflow-y: auto;
.type-item{
height: 90rpx;
line-height: 90rpx;
@@ -185,6 +247,12 @@ import { onMounted } from 'vue'
}
.right-course-list{
flex:1;
overflow-y: auto;
// .course-box{
// width: 100%;
// height: 100%;
// overflow-y: auto;
// }
}
}
}
+9 -1
View File
@@ -1,5 +1,13 @@
{
"pages": [
{
"path": "pages/course/index",
"style": {
"navigationBarTitleText": "课程中心",
"app-plus": {
"titleNView": false
}
}
}
]
}