验证玩pk上传

This commit is contained in:
田岩
2025-11-12 13:54:19 +08:00
parent 728a52b9eb
commit 375b5a1f1e
24 changed files with 371 additions and 356 deletions
-8
View File
@@ -3,11 +3,3 @@ ENV = 'development'
# 'development'
VITE_APP_BASE_API_Url = ''
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_TRASTUDY = 'http://25.64.32.154:9602'
VITE_APP_BASE_H5_API_Url_TRAEXAM = ''http://25.64.32.154:9604'
# VITE_APP_BASE_H5_API_Url_TRAASK = 'http://25.64.32.154:9605'
+1 -1
View File
@@ -15,7 +15,7 @@
"build:app-plus:sit": "uni build -p app-plus --mode sit",
"build:app-plus:uat": "uni build -p app-plus --mode uat",
"build:app-plus:prod": "uni build -p app-plus",
"build:h5:dev": "uni build -p app-plus --mode development_h5",
"build:h5:dev": "uni build -p h5 --mode development_h5",
"build:h5": "uni build"
},
"dependencies": {
+1 -1
View File
@@ -110,7 +110,7 @@
<view class="reference_answer_title">参考答案:</view>
{{ subject_data.itemVos[0]?.itemAnswer ?? '' }}
</view>
<view class="analysis_note">试题解析:{{ subject_data?.analyContent }}</view>
<view class="analysis_note" v-if="props.mode !== 'pk_in'">试题解析:{{ subject_data?.analyContent }}</view>
</view>
</view>
</view>
+28 -19
View File
@@ -1,6 +1,6 @@
<template>
<view class="">
<uni-popup ref="popup">
<view class="" style="background-color: aqua;">
<uni-popup ref="popup" background-color="rgba(10,10,10, 0.8)" >
<view class="popup-content" @touchmove.stop>
<view class="fl1"></view>
<view class="max-div">
@@ -20,14 +20,11 @@
</view>
<swiper class="swiper">
<swiper-item class="swiper-item-div">
<image src="@/static/images/test/xz2.jpg" class="img" ></image>
<image src="@/static/images/test/xz.png" class="img"></image>
</swiper-item>
<swiper-item class="swiper-item-div">
<image src="@/static/images/test/xz2.jpg" class="img"></image>
<image src="@/static/images/test/xz.png" class="img"></image>
<!-- // <image-preview :src="item.imgAddr" class="img" mode="widthFix"></image-preview> -->
</swiper-item>
</swiper>
<view class="doct_icon" @click="doct_click(1)">
@@ -64,7 +61,7 @@
import { optionErrorIcon, optionSuccessIcon } from '@/common/imgSvg';
import { addPointsByCheckIn, queryCheckIn } from '@/api/pointsAndRank.js';
import common from '@/common/common';
import {arrowRightIcon} from '@/common/imgSvg'
import { arrowRightIcon } from '@/common/imgSvg';
const popup = ref(null);
const nowImgSrc = ref('');
const badgesList = ref([]);
@@ -97,22 +94,31 @@
<style scoped lang="scss">
.points-div {
width: 100%;
// width: 100%;
display: flex;
position: relative;
align-items: center;
justify-content: center;
.swiper {
flex: 1;
height: 400rpx;
width: 520rpx;
.swiper-item-div {
// background-color: firebrick;
/* 父容器只需居中对齐,无需设置背景图 */
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
background-image: url('@/static/images/pointsAndRank/fs.png');
background-size: 110% 110%; /* 背景图比img大10% */
background-position: center; /* 背景图居中 */
background-repeat: no-repeat; /* 禁止背景图重复 */
.img {
width: 384rpx;
height: 340rpx;
/* 1. 缩放img(根据需要调整宽高,这里缩到原来的80%左右示例) */
width: 300rpx;
height: 270rpx;
transform: scale(0.8);
}
}
}
@@ -125,7 +131,7 @@
align-items: center;
justify-content: center;
}
.left{
.left {
transform: rotate(180deg);
}
width: 8vw;
@@ -183,7 +189,7 @@
.title {
font-family: AlimamaShuHeiTi, AlimamaShuHeiTi;
font-weight: bold;
font-size: 46rpx;
font-size: 36rpx;
color: #d88f50;
margin: 0rpx 30rpx;
text-align: center;
@@ -203,19 +209,22 @@
}
.popup-content {
width: 100%;
width: 100vw;
height: 100vh;
z-index: 99999;
display: flex;
flex-direction: column;
align-items: center;
padding: 40rpx 0;
// padding: 40rpx 0;
}
.max-div {
width: 80vw;
// max-width: 400rpx;
// width: 80vw;
background-color: #fefbfa;
border-radius: 38rpx;
position: relative;
padding: 26rpx;
// padding: 26rpx;
overflow: hidden;
margin-top: var(--status-bar-height);
margin-bottom: 120rpx;
+72 -62
View File
@@ -82,7 +82,7 @@
<image-preview
v-if="data_info.pkIsAnony === 'N'"
class="img"
:src="data_info.pkimgAddr"
:src="data_info.pkImgAddr"
></image-preview>
<image v-else class="img" :src="defaultAnonymousAvatar" mode="aspectFill"></image>
</view>
@@ -108,22 +108,21 @@
<selectionInstitutions ref="selectionInstitutionsRef" @submit="selectionInstitutionsSubmit"></selectionInstitutions>
<uv-picker ref="anonyPickerRef" :columns="[anonyOptions]" keyName="label" @confirm="anonyConfirm"></uv-picker>
</view>
</template>
<script setup lang="ts">
import {ref, onMounted, reactive} from 'vue';
import common, {getUserInfo} from '@/common/common';
import {MatchTimeGenerator, formatTime} from './js/matching';
import {queryTraCompetitionInfoByPkUser} from '@/api/competition';
import {onLoad} from '@dcloudio/uni-app';
import {defaultAnonymousAvatar} from '@/enum';
import {pkAnonymousClose, pkAnonymousOpen, pkRankingList, pkRules, switchIcon} from '@/common/imgSvg';
import {queryTraUserAnonyByUserId, updateTraUserAnony} from '@/api/user';
import selectionInstitutions from '@/components/selection-institutions/index.vue';
import { ref, onMounted, reactive } from 'vue';
import common, { getUserInfo } from '@/common/common';
import { MatchTimeGenerator, formatTime } from './js/matching';
import { queryTraCompetitionInfoByPkUser } from '@/api/competition';
import { onLoad } from '@dcloudio/uni-app';
import { defaultAnonymousAvatar } from '@/enum';
import { pkAnonymousClose, pkAnonymousOpen, pkRankingList, pkRules, switchIcon } from '@/common/imgSvg';
import { queryTraUserAnonyByUserId, updateTraUserAnony } from '@/api/user';
import selectionInstitutions from '@/components/selection-institutions/index.vue';
import { nextTick } from 'process';
const data_info = reactive({
const data_info = reactive({
userId: '',
userName: '',
orgName: '全部', // 机构名称
@@ -133,23 +132,23 @@ const data_info = reactive({
ruleDesc: '', // 规则说明
comName: '', // 标题
comId: '',
orgIdName: '',
orgIdName: '', // 自己的机构名称
pkIsAnony: '',
pkimgAddr: '',
pkImgAddr: '',
pkUserName: '',
pkOrgIdName: ''
});
});
const popupRef = ref(null);
const anonyPickerRef = ref(null);
const selectionInstitutionsRef = ref(null);
const challengeLoading = ref(false);
const isMatchingSuccess = ref(false); // 匹配成功状态
const challengeButtonStatus = ref(true); // 匹配按钮显示
const practiceTime = ref(0); // 匹配时间
let practiceTimeTimer: number | null = null; // 匹配时间计时器
let matchTimer: number | null = null; // 匹配成功定时器
const anonyOptions = [
const popupRef = ref(null);
const anonyPickerRef = ref(null);
const selectionInstitutionsRef = ref(null);
const challengeLoading = ref(false);
const isMatchingSuccess = ref(false); // 匹配成功状态
const challengeButtonStatus = ref(true); // 匹配按钮显示
const practiceTime = ref(0); // 匹配时间
let practiceTimeTimer: number | null = null; // 匹配时间计时器
let matchTimer: number | null = null; // 匹配成功定时器
const anonyOptions = [
{
value: 'Y',
label: '匿名'
@@ -158,9 +157,9 @@ const anonyOptions = [
value: 'N',
label: '不匿名'
}
];
// 开始挑战
const start_challenge = () => {
];
// 开始挑战
const start_challenge = () => {
if (!challengeLoading.value) {
challengeLoading.value = true;
// 清除旧计时器
@@ -182,25 +181,35 @@ const start_challenge = () => {
matchTimer = setTimeout(async () => {
try {
challengeButtonStatus.value = false;
const orgId = data_info.orgId
const papersId = data_info.papersId
const comId = data_info.comId
const orgId = data_info.orgId;
const papersId = data_info.papersId;
const comId = data_info.comId;
const pkDataBody = await queryTraCompetitionInfoByPkUser({
// orgId:510121,
// papersId:'COMPETITION_PAPERS0250640321542025101615442400000003107',
// comId:'TRA_COMPETITION_INFO0250640321542025101615442400000003099'
orgId, papersId, comId
orgId,
papersId,
comId
});
const pkData = pkDataBody.body;
// 下面两行是给后端擦屁股,后端传回的数值为空
pkData.orgId = orgId
pkData.papersId = papersId
pkData.orgId = orgId;
pkData.papersId = papersId;
pkData.userId = data_info.userId;
pkData.userName = data_info.userName;
data_info.orgIdName = pkData.orgIdName;
data_info.pkUserName = pkData.pkUserName;
data_info.pkOrgIdName = pkData.pkOrgIdName;
data_info.pkImgAddr = pkData.pkImgAddr;
data_info.pkIsAnony = pkData.pkIsAnony;
console.log('上一页数据', pkData);
common.setPageCache('competition_pk', pkData);
// 1. 显示匹配成功状态
isMatchingSuccess.value = true;
// 震动
uni.vibrateLong({
success: function () {
}
success: function () {}
});
// 2. 执行匹配成功动画(等待1.5秒)
await new Promise((resolve) => setTimeout(resolve, 600));
@@ -218,21 +227,21 @@ const start_challenge = () => {
} finally {
resetChallengeState();
}
}, delayTime * 1000);
}, delayTime * 100);
} else {
// 取消挑战
resetChallengeState();
// resetChallengeState();
}
};
};
interface InstitutionItem {
interface InstitutionItem {
orgName: string; // 机构名称,类型为字符串
orgId: string; // 机构ID,类型为字符串
parentId: string; // 父级ID,类型为字符串
children?: InstitutionItem[];
}
}
const selectionInstitutionsSubmit = (options: [InstitutionItem, ...InstitutionItem[]]) => {
const selectionInstitutionsSubmit = (options: [InstitutionItem, ...InstitutionItem[]]) => {
// 缓存起来
common.setValue('cache_selection_institutions' + data_info.userId, options);
const lastItem = options.at(-1);
@@ -240,14 +249,14 @@ const selectionInstitutionsSubmit = (options: [InstitutionItem, ...InstitutionIt
data_info.orgId = lastItem.orgId;
selectionInstitutionsRef.value.close();
};
const anonyConfirm = (e) => {
};
const anonyConfirm = (e) => {
const originalIsAnony = data_info.isAnony;
const isAnony = e.value[0].value;
if (isAnony === data_info.isAnony) return;
data_info.isAnony = isAnony;
common.loading('修改中');
updateTraUserAnony({isAnony})
updateTraUserAnony({ isAnony })
.then(() => {
setTimeout(() => common.msg('切换成功'), 400);
})
@@ -259,8 +268,8 @@ const anonyConfirm = (e) => {
.finally(() => {
common.hideLoading();
});
};
const click_top_icon = (type: number) => {
};
const click_top_icon = (type: number) => {
// 匿名切换
if (type === 1) {
anonyPickerRef.value.setIndexs([data_info.isAnony === 'Y' ? 0 : 1], true);
@@ -270,11 +279,11 @@ const click_top_icon = (type: number) => {
popupRef.value.open('bottom');
} else if (type === 3) {
// 去排行榜
common.navigateTo(`/pages/competition/ranking?papersId=${data_info.papersId}&orgId=${data_info.orgId}`)
common.navigateTo(`/pages/competition/ranking?papersId=${data_info.papersId}&orgId=${data_info.orgId}`);
}
};
// 统一重置状态的函数
const resetChallengeState = () => {
};
// 统一重置状态的函数
const resetChallengeState = () => {
if (matchTimer) {
clearTimeout(matchTimer);
matchTimer = null;
@@ -287,12 +296,13 @@ const resetChallengeState = () => {
challengeLoading.value = false;
isMatchingSuccess.value = false;
practiceTime.value = 0;
};
};
onLoad((e) => {
onLoad((e) => {
const lastData = common.getPageCache('competition_list');
console.log('lastData', lastData);
const userInfo = getUserInfo();
console.log('userInfo', userInfo);
Object.assign(data_info, {
...lastData,
userId: userInfo.userId,
@@ -311,17 +321,17 @@ onLoad((e) => {
// console.log('selectOptions', selectOptions);
// }
}
});
});
</script>
<style scoped lang="scss">
// 匹配成功样式动画
@import './style/matching-success.scss';
@import './style/matching-loading.scss';
@import './style/matching-prelude.scss';
// 匹配成功样式动画
@import './style/matching-success.scss';
@import './style/matching-loading.scss';
@import './style/matching-prelude.scss';
/* 容器样式 */
.max_page {
/* 容器样式 */
.max_page {
width: 100%;
min-height: 100vh;
background-image: url('@/static/images/competition/bg.png');
@@ -333,5 +343,5 @@ onLoad((e) => {
display: flex;
flex-direction: column;
align-items: center;
}
}
</style>
+2 -1
View File
@@ -138,7 +138,6 @@
// 计算对方分数
const opponentScore = computed(() => {
// 筛选出所有 asrTm <= 当前时长的项
const validItems = pkData.traCompetitionPkTimeRecordVos.filter((item) => item.asrTm <= practiceTime.value);
if (validItems.length > 0) {
@@ -413,6 +412,8 @@
// console.log('倒计时时间', practiceRemainingTime.value);
// Pk时间到
if (practiceRemainingTime.value <= 0) {
}
}, 1000);
};
+5 -4
View File
@@ -57,7 +57,7 @@
</view>
<view class="pk-msg-right-div">
<view class="avatar-div">
<image-preview v-if="pkData.isAnonyPk === 'N'" class="img" :src="pkData.imgPk"></image-preview>
<image-preview v-if="pkData.pkIsAnony === 'N'" class="img" :src="pkData.imgPk"></image-preview>
<image v-else class="img" :src="defaultAnonymousAvatar" mode="aspectFill"></image>
</view>
<view class="name-div">{{ pkData.userNamePk }}</view>
@@ -123,7 +123,7 @@
userIdPk: '', // 用户Id String
userNamePk: '', // 用户姓名 String
imgPk: '', // 对方头像 String
isAnonyPk: 'Y', // 匿名 String
pkIsAnony: 'Y', // 匿名 String
correctNubPk: 0, // 正确数 int
qnsNubPk: 0, // 总数 int
timeTakenPk: 0, // 用时 int
@@ -147,7 +147,8 @@
const pkDataInit = common.getPageCache('competition_pk_to_resulf');
Object.assign(pkData, {
userName: pkDataInit.userName,
isAnony: pkDataInit.isAnony
isAnony: pkDataInit.isAnony,
pkIsAnony: pkDataInit.pkIsAnony,
});
});
onMounted(() => {
@@ -168,7 +169,7 @@
userIdPk: userResult.userIdPk, // 用户Id String
userNamePk: userResult.userNamePk, // 用户姓名 String
imgPk: userResult.imgPk, // 用户姓名 String
pkIsAnony: userResult.pkIsAnony, // 匿名 String
pkIsAnony: userResult.isAnonyPk, // 匿名 String
correctNubPk: userResult.correctNubPk, // 正确数 int
qnsNubPk: userResult.qnsNubPk || 0, // 总数 int
timeTakenPk: userResult.timeTakenPk || 0, // 用时 int
+2
View File
@@ -165,6 +165,7 @@
display: flex;
align-items: center;
justify-content: center;
flex-wrap: nowrap;
margin: 30rpx 0;
.title {
margin: 0 16rpx;
@@ -173,6 +174,7 @@
color: #ae723b;
text-align: center;
font-style: normal;
white-space: nowrap;
}
.img {
width: 242rpx;
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.8 MiB

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB