diff --git a/.env.development b/.env.development index 70f067d5..cb00b5c1 100644 --- a/.env.development +++ b/.env.development @@ -4,12 +4,12 @@ ENV = 'development' # VITE_APP_BASE_API_Url = 'https://aits.jlbank.com.cn:7001' -VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' +VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' # VITE_APP_BASE_API_Url = 'http://192.168.247.200' # VITE_APP_BASE_API_Url = 'http://aitscdn.jlbank.com.cn:7001' # VITE_APP_BASE_API_Url = 'http://192.168.108.129' # dev -#VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001' +# VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001' # sit # VITE_APP_BASE_API_Url = 'http://25.18.122.91:9786' @@ -27,7 +27,7 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' # VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001' # VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786' # VITE_APP_BASE_H5_API_Url = 'http://25.18.122.78:9786' -VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://192.168.247.200' +# VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://192.168.247.200' # VITE_APP_BASE_H5_API_Url_TRASTUDY = 'http://25.64.32.154:9602' #VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://192.168.247.200' # VITE_APP_BASE_H5_API_Url_TRAASK = 'http://25.64.32.154:9605' diff --git a/src/api/request.js b/src/api/request.js index 9081ebc3..93218d73 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -35,7 +35,7 @@ export const get_base_url = (url = '') => { } // #endif // #ifdef APP-PLUS - return 'https://aitstest.jlbank.com.cn:7002' || ENV.VITE_APP_BASE_API_Url + return 'https://aitstest.jlbank.com.cn:7001' || ENV.VITE_APP_BASE_API_Url // #endif } else { // 其他环境,包括生产环境,sit环境,uat环境 diff --git a/src/api/sparring.js b/src/api/sparring.js index 239a1ade..c5b546ee 100644 --- a/src/api/sparring.js +++ b/src/api/sparring.js @@ -41,4 +41,12 @@ export const queryTraPartnerCharacterInfoList = (data) => { method: 'post', data }); +}; +// 陪练角色详情 + 对话详情 /traPartnerCharacterInfo/queryTraPartnerCharacterInfoById +export const queryTraPartnerCharacterInfoById = (data) => { + return request({ + url: base_url + '/traPartnerCharacterInfo/queryTraPartnerCharacterInfoById', + method: 'post', + data + }); }; \ No newline at end of file diff --git a/src/common/common.js b/src/common/common.js index 037c20a2..e6ed517b 100644 --- a/src/common/common.js +++ b/src/common/common.js @@ -1,3 +1,4 @@ +import { get_base_url } from '@/api/request'; // #ifdef APP-PLUS import showDialog from '@/common/dialogMessage' // #endif @@ -277,6 +278,65 @@ export function setupKeyboardHeightListener(updateCallback) { } + export const previewFileFnc = ({fileId, getFileSrc, fileName}) => { + let userInfo = getUserInfo() + let userParams = '/' + (userInfo?.loginName??'') + if (getPhoneEnvBool('AND')) { + common.navigateTo('/pages/index/preview?fileId=' + fileId +'&fileApiSrc=' + getFileSrc); + } else { + if (isDownloading.value) return + const base_url = get_base_url(getFileSrc); + let fileUrl = base_url + getFileSrc + fileId + userParams; + const localFilePath = '_doc/pdf_view/' + fileName + '.pdf'; + isDownloading.value = true + downloadFileFnc(fileUrl, localFilePath).then((res) => { + uni.openDocument({ + filePath: res, + showMenu: true, + success: function() { + console.log('打开文档成功'); + } + }) + }).finally(() => { + setTimeout(() => { + isDownloading.value = false + }, 1000) + }); + } + } + const downloadFileFnc = async (fileUrl, localFilePath) => { + try { + //#ifdef APP-PLUS + return new Promise((resolve, reject) => { + console.log('开始下载:', fileUrl); + const dtask = plus.downloader.createDownload( + fileUrl, { + filename: localFilePath + }, + (d, status) => { + if (status === 200) { + console.log('保存路径:', d.filename); + resolve(d.filename); + } else { + console.error('文件下载失败:', status); + reject(new Error(`下载失败,状态码: ${status}`)); + } + } + ); + dtask.start(); + }); + // #endif + //#ifdef H5 + return new Promise((resolve, reject) => { + resolve(); + }); + // #endif + } catch (error) { + console.error('创建目录失败:', error); + throw error; + } + }; + export default { getPageCache, diff --git a/src/pages/index/preview.vue b/src/pages/index/preview.vue index bca1f462..e6470716 100644 --- a/src/pages/index/preview.vue +++ b/src/pages/index/preview.vue @@ -26,6 +26,7 @@ export default { data() { return { fileId: '', + fileApiSrc: '/traask/traFilePreview/', showUrl: '', // viewerUrl: '/static/pdf-view/web/viewer.html', viewerUrl: '/static/view-pdf/pdf.html', @@ -36,6 +37,9 @@ export default { }, onLoad(params) { this.fileId = params.fileId || '' + if(params.fileApiSrc) { + this.fileApiSrc = params.fileApiSrc + } const userInfo = getUserInfo(); this.userParams = '/' + (userInfo?.loginName??'') }, @@ -45,8 +49,8 @@ export default { fileId: this.fileId }) }else{ - const base_url = get_base_url('/traask/traFilePreview/'); - let fileUrl = base_url + '/traask/traFilePreview/' + this.fileId + this.userParams; + const base_url = get_base_url(this.fileApiSrc); + let fileUrl = base_url + this.fileApiSrc + this.fileId + this.userParams; this.showUrl = fileUrl console.log(this.showUrl,111) } @@ -77,9 +81,9 @@ export default { common.navigateBack() }, openPdfFn(data) { - const base_url = get_base_url('/traask/traFilePreview/') + const base_url = get_base_url(this.fileApiSrc) let _id = data?.fileId - let fileUrl = base_url + '/traask/traFilePreview/' + _id + this.userParams + let fileUrl = base_url + this.fileApiSrc + _id + this.userParams this.showUrl = this.viewerUrl + '?url=' + fileUrl console.log(this.showUrl) this.showView = true diff --git a/src/pages/sparring/chooseRole.vue b/src/pages/sparring/chooseRole.vue index e7393709..e90b0c5b 100644 --- a/src/pages/sparring/chooseRole.vue +++ b/src/pages/sparring/chooseRole.vue @@ -68,6 +68,7 @@ } from "@/api/sparring.js" import CardSwiper from './components/card-swiper.vue'; const traId = ref('') + const talkingType = ref('') const detailInfo = ref({}) const roleList = ref([]) const currentIndex = ref(0) @@ -92,10 +93,11 @@ } const toTip = () => { - common.navigateTo('/pages/sparring/tip?traId=' + traId.value + '&roleId=' + activeRole.value.chaId) + common.navigateTo('/pages/sparring/tip?traId=' + traId.value + '&chaId=' + activeRole.value.chaId + '&type=' + talkingType.value) } onLoad((params) => { traId.value = params.traId; + talkingType.value = params.type }); onMounted(() => { getDetailInfo() diff --git a/src/pages/sparring/components/sparring-item.vue b/src/pages/sparring/components/sparring-item.vue index 1a88dcfc..69fadbe0 100644 --- a/src/pages/sparring/components/sparring-item.vue +++ b/src/pages/sparring/components/sparring-item.vue @@ -22,7 +22,7 @@ {{itemInfo.traName}} - + {{item.tagName}} @@ -70,9 +70,9 @@ }, computed: { tagsShowList() { - if (!this.activeTag) return this.itemInfo.tagCataList || [] - let _arr = (this.itemInfo.tagCataList || []).filter(t => this.activeTag.includes(t.tagId)) - let _arr1 = (this.itemInfo.tagCataList || []).filter(t => !this.activeTag.includes(t.tagId)) + if (!this.activeTag) return this.itemInfo.traPartnerTagList || [] + let _arr = (this.itemInfo.traPartnerTagList || []).filter(t => this.activeTag.includes(t.tagId)) + let _arr1 = (this.itemInfo.traPartnerTagList || []).filter(t => !this.activeTag.includes(t.tagId)) return _arr.concat(_arr1) } }, @@ -86,7 +86,7 @@ \ No newline at end of file diff --git a/src/pages/sparring/detail.vue b/src/pages/sparring/detail.vue index f0dd10e4..a89955e2 100644 --- a/src/pages/sparring/detail.vue +++ b/src/pages/sparring/detail.vue @@ -12,21 +12,15 @@ - {{detailInfo.traName}} - - - 已练习次数:{{detailInfo.practiceTimes}} - - - 类型:{{detailInfo.traInterTypName}} - - - 截止时间:{{detailInfo.endTm}} + {{ detailInfo.traName }} + 已练习次数:{{ detailInfo.practiceTimes }} + 类型:{{ detailInfo.traInterTypDesc }} + 截止时间:{{ detailInfo.endTm }} - - {{item.tagName}} + + {{ item.tagName }} @@ -37,7 +31,7 @@ 陪练介绍 - {{detailInfo.introduction}} + {{ detailInfo.introduction }} @@ -46,7 +40,7 @@ 陪练目标 - {{detailInfo.traTarget}} + {{ detailInfo.traTarget }} @@ -54,19 +48,16 @@ 陪练预计时长 - - {{detailInfo.traStartLimit+ ' ~ ' + detailInfo.traEndLimit}} 分钟 - + {{ detailInfo.traStartLimit + ' ~ ' + detailInfo.traEndLimit }} 分钟 - + 陪练参考资料 - - 文件名称{{item}}.docx - + {{ item.dataName }}.{{ item.dataSuffix }} @@ -86,111 +77,55 @@ onShow, onLoad, onUnload - } from '@dcloudio/uni-app'; - import common from '@/common/common'; - import ImagePreview from '@/components/image-preview/image-preview.vue'; + } from '@dcloudio/uni-app' + import common from '@/common/common' + import ImagePreview from '@/components/image-preview/image-preview.vue' import { queryTraPartnerInfoById - } from "@/api/sparring.js" + } from '@/api/sparring.js' import { - getPhoneEnvBool - } from '@/common/common'; - const traId = ref('') - const detailInfo = ref({}) - const isDownloading = ref(false) - const tagsShowList = ref([{ - tagName: '公金业务' - }, { - tagName: '初级' - }, { - tagName: '销售类' - }, { - tagName: '公金业务' - }, { - tagName: '初级' - }, { - tagName: '销售类' - }, { - tagName: '公金业务' - }, { - tagName: '初级' - }, { - tagName: '销售类' - }]) + previewFileFnc + } from '@/common/common' + const traId = ref('') + const detailInfo = ref({ + traPartnerDataVoList: [] + }) + const isLoading = ref(false) const getDetailInfo = () => { + if (isLoading.value) return + isLoading.value = true queryTraPartnerInfoById({ - id: traId.value - }).then(res => { - console.log(res) - detailInfo.value = res.body || {} + traId: traId.value + }) + .then(res => { + detailInfo.value = res.body || {} + }) + .catch(err => { + console.log(err) + }).finally(() => { + isLoading.value = false + }) + } + const previewFile = info => { + previewFileFnc({ + fileId: info.dataId, + getFileSrc: '/trapractice/traFilePreview/', + fileName: info.dataName }) } - const previewFile = (info) => { - if (getPhoneEnvBool('AND')) { - common.navigateTo('/pages/index/preview?fileId=' + info.docId); - } else { - if (isDownloading.value) return - const base_url = get_base_url('/traask/traFilePreview/'); - let fileUrl = base_url + '/traask/traFilePreview/' + info.docId + userParams; - const localFilePath = '_doc/pdf_view/' + info.docName + '.pdf'; - isDownloading.value = true - downloadFileFnc(fileUrl, localFilePath).then((res) => { - uni.openDocument({ - filePath: res, - showMenu: true, - success: function() { - console.log('打开文档成功'); - } - }) - }).finally(() => { - setTimeout(() => { - isDownloading.value = false - }, 1000) - }); - } - } - const downloadFileFnc = async (fileUrl, localFilePath) => { - try { - //#ifdef APP-PLUS - return new Promise((resolve, reject) => { - console.log('开始下载:', fileUrl); - const dtask = plus.downloader.createDownload( - fileUrl, { - filename: localFilePath - }, - (d, status) => { - if (status === 200) { - console.log('保存路径:', d.filename); - resolve(d.filename); - } else { - console.error('文件下载失败:', status); - reject(new Error(`下载失败,状态码: ${status}`)); - } - } - ); - dtask.start(); - }); - // #endif - //#ifdef H5 - return new Promise((resolve, reject) => { - resolve(); - }); - // #endif - } catch (error) { - console.error('创建目录失败:', error); - throw error; - } - }; - const toChooseRole = (type) => { + const toChooseRole = type => { common.navigateTo('/pages/sparring/chooseRole?traId=' + traId.value + '&type=' + type) } - onLoad((params) => { - traId.value = params.traId; - }); + onLoad(params => { + traId.value = params.traId + }) onMounted(() => { getDetailInfo() }) + onShow(() => { + getDetailInfo() + })