diff --git a/.env.development.yh b/.env.development.yh index 6dabe4cb..943c5717 100644 --- a/.env.development.yh +++ b/.env.development.yh @@ -4,8 +4,7 @@ ENV = 'development.yh' VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001' +# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.78:9786' # VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.32.154:9604' # VITE_APP_BASE_H5_API_Url_TRAPRACTICE = 'http://25.64.32.154:9603' - - diff --git a/src/api/sparring.js b/src/api/sparring.js index f683549b..3111b6ce 100644 --- a/src/api/sparring.js +++ b/src/api/sparring.js @@ -1,11 +1,11 @@ import request from '@/api/request' -const course_base_url = '/trapractice' +const base_url = '/trapractice' -// 获取课程分类树接口 -export const getCourseTypeListApi = (data) => { +// 获取分类树接口 +export const queryTraPartnerCatelogList = (data) => { return request({ - url: course_base_url + '/traPartnerCatelog/queryTraPartnerCatelog', + url: base_url + '/traPartnerCatelog/queryTraPartnerCatelogList', method: 'post', data }); @@ -13,7 +13,7 @@ export const getCourseTypeListApi = (data) => { // 获取标签分类树 接口 export const getTraTagListApi = (data) => { return request({ - url: course_base_url + '/traPartnerTag/queryTraTagCatalogInfoList', + url: base_url + '/traPartnerTag/queryTraTagCatalogInfoList', method: 'post', data }); @@ -21,7 +21,15 @@ export const getTraTagListApi = (data) => { // 全部模块 export const queryCrsInfoByCatalogApi = (data) => { return request({ - url: course_course_base_url + '/traPartnerInfo/queryTraPartnerInfoPaging', + url: base_url + '/traPartnerInfo/queryTraPartnerInfoPaging', + method: 'post', + data + }); +}; +// id 查详情/trapractice/traPartnerInfo/queryTraPartnerInfoById +export const queryTraPartnerInfoById = (data) => { + return request({ + url: base_url + '/traPartnerInfo/queryTraPartnerInfoById', method: 'post', data }); diff --git a/src/pages.json b/src/pages.json index 7a4e45e2..2a149e66 100644 --- a/src/pages.json +++ b/src/pages.json @@ -447,6 +447,15 @@ "titleNView": false } } + }, + { + "path": "pages/sparring/detail", + "style": { + "navigationBarTitleText": "AI陪练详情", + "app-plus": { + "titleNView": false + } + } } ], "tabBar": { diff --git a/src/pages/sparring/components/sparring-item.vue b/src/pages/sparring/components/sparring-item.vue index 6474ba18..1a88dcfc 100644 --- a/src/pages/sparring/components/sparring-item.vue +++ b/src/pages/sparring/components/sparring-item.vue @@ -5,31 +5,31 @@ - {{'视频对话'}} + {{itemInfo.traInterName}} - + - {{itemInfo.crsName}} + {{itemInfo.traName}} {{item.tagName}} - 截至时间:{{itemInfo.mtTime}} - 陪练次数:{{itemInfo.accmStdyCnt}}人次 + 截至时间:{{itemInfo.endTm}} + 陪练次数:{{itemInfo.practiceTimes }}人次 diff --git a/src/pages/sparring/detail.vue b/src/pages/sparring/detail.vue new file mode 100644 index 00000000..034ed0e5 --- /dev/null +++ b/src/pages/sparring/detail.vue @@ -0,0 +1,387 @@ + + + + + \ No newline at end of file diff --git a/src/pages/sparring/index.vue b/src/pages/sparring/index.vue index e0fca1c1..bc91f2f4 100644 --- a/src/pages/sparring/index.vue +++ b/src/pages/sparring/index.vue @@ -14,13 +14,14 @@ - - + :activeStyle="{ color: '#0066FF', fontSize: '24rpx', fontWeight: '500' }" :lineColor="`#06f`" + > + - + @@ -89,7 +90,7 @@ } from '@/enum.js'; import { getTraTagListApi, - getCourseTypeListApi, + queryTraPartnerCatelogList, queryCrsInfoByCatalogApi } from '@/api/sparring.js' import { @@ -123,19 +124,52 @@ backgroundColor: '#ffffff', borderRadius: '23rpx' } - const tabList = [{ - name: '全部' - }, { - name: '热门' - }, { - name: '最新' - }, { - name: '推荐' - }, { - name: '生产线' - }] + const catelogList = ref([]) + const tabList = computed(()=>{ + return [{ + name: '全 部', + value: '' + }, ...catelogList.value.map(t=>{ + return { + name: t.label, + value: t.value + } + })] + }) + const tabSecList = computed(()=> { + let _arr = [] + if(!activeTabId.value){ + catelogList.value.forEach(t=>{ + let _children = (t.children||[]) + _arr = _arr.concat(_children.map(k=>{ + return { + name: k.label, + value: k.value + } + })) + }) + }else{ + let _obj = catelogList.value.find(t=>t.value === activeTabId.value) + if(_obj){ + let _children = (_obj.children||[]) + _arr = _children.map(k=>{ + return { + name: k.label, + value: k.value + } + }) + } + } + return [{ + name: '全 部', + value: '' + }, ..._arr] + }) const activeTab = ref('全部') - const activeCourseType = ref('') + const activeTabId= ref('') + const activeTabSec = ref('全部') + const activeTabSecId= ref('') + const activeCourseType = computed(()=> (activeTabSecId.value || activeTabId.value || '')) const activePrdlineType = ref('') const activeTag = ref([]) const sparringTypeList = ref([]) @@ -197,15 +231,6 @@ getMoreList(1) } // 点击课程分类 - const changeCourseType = (item, index) => { - activeCourseType.value = item.value === activeCourseType.value ? '' : item.value - activeLeftIndex.value = index - getMoreList(1) - } - const showTypeName = computed(() => { - return (activeTab.value === '全部' && activeCourseType.value === '') || (activeTab.value === '生产线' && - activePrdlineType.value === '') - }) const tagsList = computed(() => { let _arr = [] tagsTree.value.forEach(t => { @@ -213,7 +238,7 @@ _arr = _arr.concat(_tarr) }) let _reqList = _arr.filter(t => t.required === 'Y') - let _reqListN = _arr.filter(t => t.required === 'N') + let _reqListN = _arr.filter(t => t.required !== 'N') return _reqList.concat(_reqListN) }) const changeChooseTagsList = () => { @@ -262,16 +287,19 @@ if (!item) return sparringListBase.value = [] activeTab.value = item.name + activeTabId.value = item.value || '' activeLeftIndex.value = -1 activeTag.value = [] pageObj.value.page = 1 pageObj.value.total = 0 // activeTag.value = '' - activeCourseType.value = '' activePrdlineType.value = '' loading.value = true - queryCrsInfoByCatalogApi(pageObj.value) + queryCrsInfoByCatalogApi({ + ...pageObj.value, + catalogId: activeCourseType.value + }) .then(res => { sparringListBase.value = res.body || [] pageObj.value.total = res.total @@ -280,21 +308,41 @@ loading.value = false }) } - const changeTabSec = () => { + const changeTabSec = (item) => { + sparringListBase.value = [] + activeLeftIndex.value = -1 + activeTabSec.value = item.name + activeTabSecId.value = item.value || '' + activeTag.value = [] + pageObj.value.page = 1 + pageObj.value.total = 0 + // activeTag.value = '' + activePrdlineType.value = '' + loading.value = true + queryCrsInfoByCatalogApi({ + ...pageObj.value, + catalogId: activeCourseType.value + }) + .then(res => { + sparringListBase.value = res.body || [] + pageObj.value.total = res.total + }) + .finally(() => { + loading.value = false + }) } // 跳转搜索页 const toSearchPage = () => { common.navigateTo('/pages/search/search?from=sparring') } // 跳转 课程详情 - const toCourseDetail = item => { - common.navigateTo('/pages/sparringDetail/index?crsNum=' + item.crsNum + '&crsId=' + item.crsId) - // common.navigateTo('/pages/sparring/study?crsNum=' + item.crsNum) + const toSparringDetail = item => { + common.navigateTo('/pages/sparring/detail?traId=' + item.traId) } onMounted(() => { - getCourseTypeListApi().then(res => { - sparringTypeList.value = res.body || [] + queryTraPartnerCatelogList().then(res => { + catelogList.value = res.body || [] }) getTraTagListApi().then(res => { tagsTree.value = res.body || [] @@ -329,14 +377,28 @@