diff --git a/.env.development b/.env.development index 19ed8d12..75cb95b8 100644 --- a/.env.development +++ b/.env.development @@ -5,13 +5,13 @@ 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 @@ -34,7 +34,8 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' #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_TRASTUDY = 'http://25.64.32.154:9602' +# VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://25.64.32.158:9601' +VITE_APP_BASE_H5_API_Url_TEST = 'http://127.0.0.1:5000' #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/pointsAndRank.js b/src/api/pointsAndRank.js index bab3c9dc..5e53ab2c 100644 --- a/src/api/pointsAndRank.js +++ b/src/api/pointsAndRank.js @@ -44,8 +44,14 @@ export const addPointsByCheckIn = (data) => { changePoints 本次获得积分 int */ export const addPointsByTask = (data) => { + // base_url + // return request({ + // url: base_url + '/traPointsInfo/addPointsByTask', + // method: 'post', + // data + // }); return request({ - url: base_url + '/traPointsInfo/addPointsByTask', + url: '/test/traPointsInfo/addPointsByTask', method: 'post', data }); diff --git a/src/api/pointsRedemption.js b/src/api/pointsRedemption.js new file mode 100644 index 00000000..32bca0c4 --- /dev/null +++ b/src/api/pointsRedemption.js @@ -0,0 +1,20 @@ +import request from '@/api/request' +const base_url = '/traapp' + +// String actId,活动id +export const queryPointsActivityDetail = (data) => { + return request({ + url: base_url + '/traPointsActivity/queryPointsActivityDetail', + method: 'post', + data + }); +}; + + +export const addPointsExchange = (data) => { + return request({ + url: base_url + '/traPointsActivity/addPointsExchange', + method: 'post', + data + }); +}; \ No newline at end of file diff --git a/src/common/common.js b/src/common/common.js index e6ee8e52..6f5a0524 100644 --- a/src/common/common.js +++ b/src/common/common.js @@ -63,6 +63,23 @@ const loading = (title = '加载中', mask = true) => uni.showLoading({ }) const hideLoading = () => uni.hideLoading() +// 根据姓名的长度生成对应的带星号格式 +export const formatName = (name) => { + + // 处理空值或非字符串情况 + if (!name || typeof name !== 'string') { + return ''; + } + + const familyName = name.charAt(0); // 取姓氏(第一个字符) + const givenNameLength = name.length - 1; // 名字部分的长度 + + // 根据名字长度计算星号数量,最多4个 + const starCount = Math.min(givenNameLength, 3); + const stars = '*'.repeat(starCount); + + return familyName + stars; +} // 防抖工具函数 function debounce(fn, wait = 300) { diff --git a/src/components/points-and-badge/usePointsAndBadge.js b/src/components/points-and-badge/usePointsAndBadge.js index 50388319..bfa230f9 100644 --- a/src/components/points-and-badge/usePointsAndBadge.js +++ b/src/components/points-and-badge/usePointsAndBadge.js @@ -1,9 +1,9 @@ /** 完成课程学习 首次完成1分 每天最多获取5分 完成课程学习 crsId 02 完成调用 杨航 - 完成课程练习 首次完成1分 每天最多获取5分 完成课程练习 crsId 04 完成练习调用 田岩 - 通过课程考试 首次完成1分 每天最多获取5分 通过课程考试 crsId 03 通过调用 田岩 - 完成考试中心考试 首次完成1分 每天最多获取5分 完成考试中心考试 papersId 05 完成调用 田岩 - 完成竞赛PK 每次1分 每天最多获取5分 完成竞赛PK 11 完成调用 田岩 + 完成课程练习 首次完成1分 每天最多获取5分 完成课程练习 crsId 04 完成练习调用 田岩 已完成 + 通过课程考试 首次完成1分 每天最多获取5分 通过课程考试 crsId 03 通过调用 田岩 已完成 + 完成考试中心考试 首次完成1分 每天最多获取5分 完成考试中心考试 papersId 05 完成调用 田岩 已完成 + 完成竞赛PK 每次1分 每天最多获取5分 完成竞赛PK 11 完成调用 田岩 已完成 通过AI陪练练习 每次1分 每天最多获取5分 通过AI陪练练习 07 通过调用 杨航 通过AI陪练考试 每次1分 每天最多获取5分 通过AI陪练考试 08 通过调用 杨航 签到 每日1积分, @@ -15,7 +15,7 @@ import { addPointsByTask } from '@/api/pointsAndRank.js' import { - ref + ref, nextTick } from 'vue' import { pop_up_time @@ -90,6 +90,13 @@ export default function usePointsAndBadge() { // 调用积分接口 console.log('调用积分接口'); const res = await addPointsByTask(requestParams); + if(type=== '04') { // 完成课程练习,自己处理逻辑 + return { + points: res.body.points, + message: res.body.message, + taskBadges: res.body.taskBadges ?? [], + } + } console.log('调用积分接口', res); console.log('pointsRefpointsRef', pointsRef.value); @@ -98,7 +105,9 @@ export default function usePointsAndBadge() { if (badgesList.length > 0) { nextTick(() => { setTimeout(() => { - badgeRef.value.open(pointsList, badgesList); + badgeRef.value.open(pointsList, badgesList, () => { + badgeRef.value.close() + }); }, pop_up_time); }); } diff --git a/src/pages.json b/src/pages.json index 9487bedc..8e1a92be 100644 --- a/src/pages.json +++ b/src/pages.json @@ -393,6 +393,15 @@ } } }, + { + "path": "pages/pointsRedemption/index", + "style": { + "navigationBarTitleText": "积分兑换", + "app-plus": { + "titleNView": false + } + } + }, { "path": "pages/course/index", "style": { diff --git a/src/pages/competition/matching.vue b/src/pages/competition/matching.vue index e3c64d40..3f36ee62 100644 --- a/src/pages/competition/matching.vue +++ b/src/pages/competition/matching.vue @@ -31,7 +31,7 @@ - {{ data_info.isAnony === 'N' ? data_info.userName : '匿名' }} + {{ data_info.isAnony === 'N' ? data_info.userName : formatName(data_info.userName) }} @@ -68,7 +68,7 @@ - {{ data_info.isAnony === 'N' ? data_info.userName : '匿名' }} + {{ data_info.isAnony === 'N' ? data_info.userName : formatName(data_info.userName)}} {{ data_info.isAnony === 'N' ? data_info.orgIdName : '机构不显示' }} @@ -87,7 +87,7 @@ - {{ data_info.pkIsAnony === 'N' ? data_info.pkUserName : '匿名' }} + {{ data_info.pkIsAnony === 'N' ? data_info.pkUserName : formatName(data_info.pkUserName)}} {{ data_info.pkIsAnony === 'N' ? data_info.pkOrgIdName : '机构不显示' }} @@ -101,7 +101,7 @@ 双人对战规则说明 - {{ data_info.ruleDesc }} + {{ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'|| data_info.ruleDesc }} @@ -112,7 +112,7 @@ diff --git a/src/pages/competition/result.vue b/src/pages/competition/result.vue index df3fde8a..59e67c68 100644 --- a/src/pages/competition/result.vue +++ b/src/pages/competition/result.vue @@ -37,7 +37,7 @@ - {{ pkData.userName }} + {{ pkData.isAnony === 'N' ?pkData.userName:formatName(pkData.userName) }} 正确/总题数 {{ pkData.correctNub }} @@ -60,7 +60,7 @@ - {{ pkData.pkIsAnony === 'N' ? pkData.userNamePk : '匿名' }} + {{ pkData.pkIsAnony === 'N' ? pkData.userNamePk : formatName(pkData.userNamePk) }} 正确/总题数 {{ pkData.correctNubPk }} @@ -80,7 +80,9 @@ - 查看排行榜 + + 查看排行榜 + @@ -98,7 +100,7 @@ + + diff --git a/src/pages/practice/index.vue b/src/pages/practice/index.vue index 4193e17b..c1d47a1c 100644 --- a/src/pages/practice/index.vue +++ b/src/pages/practice/index.vue @@ -7,10 +7,7 @@ - - 退出 - - + 退出 @@ -40,6 +37,8 @@ topicList[questionNumber.value], @@ -157,6 +156,7 @@ const isLastTopic = computed( () => topicList.length === finishCurrent.value + 1 && finishCurrent.value === questionNumber.value ); + const showSwiper = ref(false); const transition = (event) => { if (isTriggered.value) return; const dx = event.detail.dx; @@ -405,7 +405,9 @@ const hand_in_paper_button_click = () => { console.log('交卷按钮'); const stat = 'P'; - // 都做完弹窗了,产品说改成跳页,说客户觉得奇怪 + showSwiper.value = true; + // 2. 延迟 50ms 确保 swiper 已销毁,再跳转 + nextTick(() => { common.redirectTo( `/pages/practice/result?name=${paperData.name}&exrId=${paperData.exrId}&crsId=${paperData.crsId}&examLenTm=${practiceTime.value}&stat=${stat}&examStat=${examStat.value}` @@ -747,7 +749,7 @@ width: 32rpx; height: 32rpx; } - .text{ + .text { color: #eaeaea; font-size: 24rpx; white-space: nowrap; @@ -755,7 +757,7 @@ } } } - + .main_div { display: flex; flex-direction: column; diff --git a/src/pages/practice/result.vue b/src/pages/practice/result.vue index 107e36d3..452cd52a 100644 --- a/src/pages/practice/result.vue +++ b/src/pages/practice/result.vue @@ -1,7 +1,26 @@ @@ -47,6 +67,10 @@ import { startExamByCrs } from '@/api/examination.js'; import { startPracticeByCrs } from '@/api/practice.js'; import { practiceCommit } from '@/api/practice.js'; + import badge from '@/components/points-and-badge/badge'; + import { pop_up_time } from '@/enum'; + import usePointsAndBadge from '@/components/points-and-badge/usePointsAndBadge'; + const { pointAndBadgesRun, badgeRef } = usePointsAndBadge(); const customStyle1 = { borderRadius: '12rpx', color: '#FFFFFF', @@ -74,7 +98,7 @@ const crsId = ref(''); const name = ref(''); const loading = ref(''); - + // 用于标记组件是否已卸载 let isUnmounted = false; // 存储请求取消函数 @@ -124,37 +148,107 @@ loading.value = ''; } }; - const exrId = ref('') - const examLenTm = ref('') - const stat = ref('') - const examStat = ref('') - const commit = ref(false) + const exrId = ref(''); + const examLenTm = ref(''); + const stat = ref(''); + const examStat = ref(''); + const commit = ref(false); + // const changePoints = ref(0); + const showData = ref({ + num: 0, + message:'' + }); onLoad((e) => { console.log('xx23333'); - crsId.value = e.crsId - name.value = e.name - exrId.value = e.exrId - examLenTm.value = e.examLenTm - stat.value = e.stat - examStat.value = e.examStat??'' + crsId.value = e.crsId; + name.value = e.name; + exrId.value = e.exrId; + examLenTm.value = e.examLenTm; + stat.value = e.stat; + examStat.value = e.examStat ?? ''; console.log('xxxx111'); - practiceCommitFun() + practiceCommitFun(); }); const practiceCommitFun = () => { practiceCommit({ exrId: exrId.value, examLenTm: examLenTm.value, stat: stat.value }).then(() => { console.log('提交练习状态成功'); - commit.value = true - }) - } - + commit.value = true; + pointAndBadgesRun('04', crsId.value).then(({ points, message, taskBadges }) => { + if (Array.isArray(points) && points.length > 0) { + showData.value.num = points[0]['changePoints']; + showData.value.message = message; + } + if (taskBadges.length > 0) { + nextTick(() => { + setTimeout(() => { + badgeRef.value.open([], taskBadges); + }, pop_up_time); + }); + } + }); + }); + }; + onUnmounted(() => {});