Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop

This commit is contained in:
杨航
2025-12-25 09:46:09 +08:00
53 changed files with 411 additions and 195 deletions
+8 -12
View File
@@ -1,26 +1,25 @@
<script>
export default {
onLaunch: function() {
onLaunch: function () {
uni.onTabBarMidButtonTap(() => {
uni.navigateTo({
url: '/pages/index/dialog',
animationType: 'slide-in-bottom'
});
});
//#ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary')
// 锁定屏幕方向
plus.screen.lockOrientation('portrait-primary');
// #endif
},
onShow: function() {
},
onHide: function() {}
onShow: function () {},
onHide: function () {}
};
</script>
<style lang="scss">
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
// @import "@/uni_modules/uview-ui/index.scss";
// #ifndef APP-PLUS-NVUE
@font-face {
font-family: 'PingFangSC';
@@ -64,12 +63,11 @@
overflow: hidden;
}
.max_page {
min-height: 100vh;
}
// #endif
.mr-10 {
margin-right: 10rpx;
}
@@ -166,8 +164,6 @@
flex: 1;
}
.no-overflow {
overflow: hidden;
}
@@ -180,4 +176,4 @@
margin-right: 8rpx;
margin-left: 2rpx;
}
</style>
</style>
+59 -15
View File
@@ -15,8 +15,9 @@ function msg(title, duration = 1000) {
}
let isShowConfirm = false
function show(title, msg, showCancel = true, cancelText = '取消', confirmText = '确定') {
if(isShowConfirm) {
if (isShowConfirm) {
return new Promise((resolve, reject) => {
reject({});
});
@@ -35,7 +36,7 @@ function show(title, msg, showCancel = true, cancelText = '取消', confirmText
resolve(!!res.confirm);
isShowConfirm = false
},
};
// #ifdef APP-PLUS
if (getPhoneEnvBool('AND')) {
@@ -83,19 +84,19 @@ 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;
// 处理空值或非字符串情况
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;
}
// 防抖工具函数
@@ -277,6 +278,49 @@ function isLogin() {
return !!getToken();
}
/**
* 获取额外高度(纯函数,返回对应高度值)
* @returns {string} 最终的额外高度值(带单位)
*/
export const getExtraHeight = () => {
// 所有常量移入函数内部定义,TARGET_DEVICE_MODEL 改为数组类型
const TARGET_DEVICE_MODEL = ['XT2321-2']; // 目标设备型号数组(摩托罗拉razr 40 Ultra
const EXTRA_HEIGHT_TARGET = '15rpx'; // 目标设备额外高度
const EXTRA_HEIGHT_DEFAULT = '2rpx'; // 默认额外高度
try {
// 1. 优先读取缓存
const cachedHeight = getValue('extra_height', '');
if (cachedHeight) {
console.log('缓存有值直接返回', cachedHeight);
return cachedHeight; // 缓存有值直接返回
}
// 2. 缓存无值时,获取设备信息
const deviceInfo = uni.getDeviceInfo();
// 校验设备信息有效性
if (!deviceInfo || !deviceInfo.deviceModel) {
throw new Error('设备信息获取失败');
}
// 3. 判断设备型号(数组包含判断,适配多型号)
const isTargetDevice = TARGET_DEVICE_MODEL.includes(deviceInfo.deviceModel);
const finalHeight = isTargetDevice ? EXTRA_HEIGHT_TARGET : EXTRA_HEIGHT_DEFAULT;
// 4. 缓存结果(后续复用)
setValue('extra_height', finalHeight);
return finalHeight; // 返回计算后的高度
} catch (error) {
// 5. 异常兜底:返回默认值并缓存
console.warn('获取/设置额外高度失败:', error.message);
setValue('extra_height', EXTRA_HEIGHT_DEFAULT);
return EXTRA_HEIGHT_DEFAULT;
}
};
// 封装键盘高度变化处理
export function setupKeyboardHeightListener(updateCallback) {
// #ifndef APP-PLUS
+5 -5
View File
@@ -143,7 +143,7 @@
align-items: center;
justify-content: center;
margin-top: 34rpx;
height: 68rpx;
height: 60rpx;
.img {
width: 26rpx;
height: 44rpx;
@@ -153,7 +153,7 @@
font-weight: bold;
font-size: 46rpx;
color: #d88f50;
margin: 0rpx 30rpx;
margin: 0rpx 26rpx;
text-align: center;
}
}
@@ -180,14 +180,14 @@
}
.max-div {
width: 80vw;
max-width: 80vw;
background-color: #fefbfa;
border-radius: 38rpx;
position: relative;
padding: 26rpx;
padding: 26rpx 80rpx;
overflow: hidden;
margin-top: var(--status-bar-height);
margin-bottom: 120rpx;
margin-bottom: 100rpx;
overflow: auto;
}
</style>
+2 -2
View File
@@ -2,8 +2,8 @@
"name" : "tra-app",
"appid" : "__UNI__EDE0E52",
"description" : "",
"versionName" : "0.0.3",
"versionCode" : 3,
"versionName" : "0.0.4",
"versionCode" : 4,
"transformPx" : false,
/* 5+App */
"app-plus" : {
+6 -2
View File
@@ -130,8 +130,9 @@
import { pkAnonymousClose, pkAnonymousOpen, pkRankingList, pkRules, switchIcon, optionErrorIcon } from '@/common/imgSvg';
import { updateTraUserAnony } from '@/api/user';
import selectionInstitutions from '@/components/selection-institutions/index.vue';
import {getExtraHeight} from '@/common/common';
const extra_height = ref(getExtraHeight());
const data_info = reactive({
userId: '',
userName: '',
@@ -184,11 +185,11 @@
}, 1000);
// 生成匹配延迟时间
const delayTime = MatchTimeGenerator.generateInSeconds();
console.log('delayTime', delayTime);
// 匹配定时器
matchTimer = setTimeout(async () => {
try {
challengeButtonStatus.value = false;
const orgId = data_info.orgId;
const papersId = data_info.papersId;
const comId = data_info.comId;
@@ -349,4 +350,7 @@
flex-direction: column;
align-items: center;
}
.top-button-div{
padding-top: calc(16rpx + var(--status-bar-height) + v-bind(extra_height));
}
</style>
@@ -150,6 +150,9 @@
.avatar-div {
margin-top: 20rpx;
display: flex;
flex-direction: column;
align-items: center;
.avatar-img-div {
width: 204rpx;
height: 204rpx;
@@ -248,7 +251,7 @@
justify-content: space-between;
width: 100%;
height: 70rpx;
padding-top: calc(16rpx + var(--status-bar-height));
font-weight: 500;
position: relative;
margin-right: 10rpx;
+1 -1
View File
@@ -1,6 +1,6 @@
<template>
<view class="exam-ranking">
<image src="@/static/images/examRanking/bg.png" mode="aspectFit" class="bg-box"></image>
<image src="@/static/images/examRanking/bg.png" mode="aspectFill" class="bg-box"></image>
<view class="ranking-box">
<view class="nav-div">
+14 -9
View File
@@ -39,7 +39,7 @@
</view>
<view class="item" v-for="(item, index) in data_list">
<view class="title">
{{ item.mattrDesc }}
{{ item.mattrDesc}}
</view>
<view class="time">
{{ item.ctTime.substr(0, 16) }}
@@ -58,13 +58,15 @@
import { onLoad, onUnload } from '@dcloudio/uni-app';
import useZpaging from '@/composables/useZpaging.js';
import common from '@/common/common';
import {getExtraHeight} from '@/common/common';
const extra_height = ref(getExtraHeight());
import { queryPointsDetail, queryCurrentStatus } from '@/api/pointsAndRank.js';
const startVal = ref(0);
const endVal = ref(0);
const countToRef = ref(null);
const points_data = ref({});
const fetchFunction = (params) => {
queryCurrentStatus().then(({ body }) => {
const { currentPoints } = body;
@@ -172,11 +174,13 @@
flex: 1;
}
.time {
min-width: max(146rpx, 40%);
width: 254rpx;
white-space: nowrap;
}
.value {
text-align: right;
min-width: max(80rpx, 20%);
width: 128rpx;
flex-shrink: 1;
}
}
.item {
@@ -202,16 +206,18 @@
font-size: 30rpx;
color: #000000;
text-align: left;
min-width: max(146rpx, 40%);
width: 254rpx;
white-space: nowrap;
}
.value {
font-family: Arial, Arial;
font-weight: normal;
font-size: 30rpx;
flex-shrink: 1;
text-align: right;
font-weight: 600;
min-width: max(80rpx, 20%);
width: 128rpx;
// min-width: max(80rpx, 20%);
}
.up {
color: #ff8a2d;
@@ -233,14 +239,13 @@
color: #ffffff;
position: relative;
text-align: center;
margin-top: var(--status-bar-height);
margin-top: calc(var(--status-bar-height) + v-bind(extra_height));
.delete_div {
position: absolute;
right: 20rpx;
top: 17rpx;
width: 50rpx;
height: 50rpx;
.img {
width: 34rpx;
height: 34rpx;
+5 -2
View File
@@ -5,7 +5,7 @@
@query="queryList"
class="scroll_div"
:layout-only="true"
empty-view-text="暂无积分记录"
empty-view-text="暂无段位记录"
paging-class="z-paging-class"
>
<template #top>
@@ -61,6 +61,8 @@
import useZpaging from '@/composables/useZpaging.js';
import common from '@/common/common';
import { queryRankDetail, queryCurrentStatus } from '@/api/pointsAndRank.js';
import {getExtraHeight} from '@/common/common';
const extra_height = ref(getExtraHeight());
const dataInfo = reactive({
countPoints: 0, // 累计积分 int
currentPoints: 0, // 当前积分 int
@@ -210,7 +212,8 @@
color: #ffffff;
position: relative;
text-align: center;
margin-top: var(--status-bar-height);
margin-top: calc(var(--status-bar-height) + v-bind(extra_height));
// margin-top: var(--status-bar-height);
.delete_div {
position: absolute;
right: 20rpx;
+4 -2
View File
@@ -4,7 +4,7 @@
@query="queryList"
class="scroll_div"
:loading-more-enabled="false"
empty-view-text="暂无积分记录"
empty-view-text="暂无兑换活动"
paging-class="z-paging-class"
>
<template #top>
@@ -72,6 +72,8 @@
import useZpaging from '@/composables/useZpaging.js';
import common from '@/common/common';
import { queryPointsActivityDetail, addPointsExchange } from '@/api/pointsRedemption.js';
import {getExtraHeight} from '@/common/common';
const extra_height = ref(getExtraHeight());
const customStyle = {
borderRadius: '12rpx'
};
@@ -240,7 +242,7 @@
color: #ffffff;
position: relative;
text-align: center;
margin-top: var(--status-bar-height);
margin-top: calc(var(--status-bar-height) + v-bind(extra_height));
.title {
max-width: 70%;
margin: 0 auto;
+116 -18
View File
@@ -1,5 +1,5 @@
<template>
<watermark></watermark>
<!-- <watermark></watermark> -->
<view class="max_page detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
@@ -8,40 +8,138 @@
</view>
<view class="title font_pf">系统参数</view>
</view>
<view class="detail-title">打包信息</view>
<view class="detail-body">
<uv-cell-group :border="false">
<uv-cell-group :border="false" title="">
<uv-cell title="根域名" :value="url"></uv-cell>
<uv-cell title="当前环境:" :value="ENV.MODE"></uv-cell>
<uv-cell title="版本名称" :value="appBaseInfo.appVersion"></uv-cell>
<uv-cell title="版本号" :value="appBaseInfo.appVersionCode"></uv-cell>
<uv-cell title="点击1:" @click="aaaa"></uv-cell>
<uv-cell title="点击2:" :border="false" @click="bbbb"></uv-cell>
</uv-cell-group>
</view>
<view class="detail-title">设备信息</view>
<view class="detail-body">
<uv-cell-group :border="false" title="">
<uv-cell title="设备类型" :value="deviceInfo.deviceType"></uv-cell>
<uv-cell title="设备品牌" :value="deviceInfo.deviceBrand"></uv-cell>
<uv-cell title="设备型号" :value="deviceInfo.deviceModel"></uv-cell>
<uv-cell title="设备方向" :value="deviceInfo.deviceOrientation"></uv-cell>
<uv-cell title="设备像素比" :value="deviceInfo.devicePixelRatio"></uv-cell>
<uv-cell title="系统名称" :value="deviceInfo.osName"></uv-cell>
<uv-cell title="操作系统版本" :value="deviceInfo.osVersion"></uv-cell>
</uv-cell-group>
</view>
<view class="detail-title">窗口信息</view>
<view class="detail-body">
<uv-cell-group :border="false" title="">
<!-- 新增屏幕/窗口信息带单位优化 -->
<uv-cell title="设备像素比" :value="windowInfo.pixelRatio || '未知'"></uv-cell>
<uv-cell title="屏幕宽度" :value="windowInfo.screenWidth ? `${windowInfo.screenWidth}` : '未知'"></uv-cell>
<uv-cell title="屏幕高度" :value="windowInfo.screenHeight ? `${windowInfo.screenHeight}` : '未知'"></uv-cell>
<uv-cell title="可使用窗口宽度" :value="windowInfo.windowWidth ? `${windowInfo.windowWidth}` : '未知'"></uv-cell>
<uv-cell title="可使用窗口高度" :value="windowInfo.windowHeight ? `${windowInfo.windowHeight}` : '未知'"></uv-cell>
<uv-cell title="窗口顶部位置" :value="windowInfo.windowTop ? `${windowInfo.windowTop}` : '未知'"></uv-cell>
<uv-cell title="窗口底部位置" :value="windowInfo.windowBottom ? `${windowInfo.windowBottom}` : '未知'"></uv-cell>
<uv-cell
title="状态栏高度"
:value="windowInfo.statusBarHeight ? `${windowInfo.statusBarHeight}` : '未知'"
></uv-cell>
<uv-cell
title="设置状态栏高度"
:value="extra_height"
></uv-cell>
<uv-cell title="窗口上边缘Y值" :value="windowInfo.screenTop ? `${windowInfo.screenTop}` : '未知'"></uv-cell>
</uv-cell-group>
<uv-cell-group :border="false" title="safeArea">
<!-- 严格对应safeArea字段定义补充px单位+空值兜底 -->
<uv-cell title="左上角横坐标" :value="windowInfo.safeArea.left ? `${windowInfo.safeArea.left}` : '未知'"></uv-cell>
<uv-cell title="右下角横坐标" :value="windowInfo.safeArea.right ? `${windowInfo.safeArea.right}` : '未知'"></uv-cell>
<uv-cell title="左上角纵坐标" :value="windowInfo.safeArea.top ? `${windowInfo.safeArea.top}` : '未知'"></uv-cell>
<uv-cell title="右下角纵坐标" :value="windowInfo.safeArea.bottom ? `${windowInfo.safeArea.bottom}` : '未知'"></uv-cell>
<uv-cell title="安全区宽度" :value="windowInfo.safeArea.width ? `${windowInfo.safeArea.width}` : '未知'"></uv-cell>
<uv-cell title="安全区高度" :value="windowInfo.safeArea.height ? `${windowInfo.safeArea.height}` : '未知'"></uv-cell>
</uv-cell-group>
<uv-cell-group :border="false" title="safeAreaInsets">
<!-- 严格对应safeArea字段定义补充px单位+空值兜底 -->
<uv-cell title="左上角横坐标" :value="windowInfo.safeArea.left ? `${windowInfo.safeArea.left}` : '未知'"></uv-cell>
<uv-cell title="右下角横坐标" :value="windowInfo.safeArea.right ? `${windowInfo.safeArea.right}` : '未知'"></uv-cell>
<uv-cell title="左上角纵坐标" :value="windowInfo.safeArea.top ? `${windowInfo.safeArea.top}` : '未知'"></uv-cell>
<uv-cell title="右下角纵坐标" :value="windowInfo.safeArea.bottom ? `${windowInfo.safeArea.bottom}` : '未知'"></uv-cell>
<uv-cell title="安全区宽度" :value="windowInfo.safeArea.width ? `${windowInfo.safeArea.width}` : '未知'"></uv-cell>
<uv-cell title="安全区高度" :value="windowInfo.safeArea.height ? `${windowInfo.safeArea.height}` : '未知'"></uv-cell>
</uv-cell-group>
</view>
<view class="detail-title"></view>
</view>
</template>
<script setup>
import common from '@/common/common';
import permision from '@/common/permission'
import {
get_base_url
} from '../../api/request';
import permision from '@/common/permission';
import { get_base_url } from '../../api/request';
const url = get_base_url();
const ENV = import.meta.env
const appBaseInfo = uni.getAppBaseInfo()
import showDialog from '@/common/dialogMessage'
const ENV = import.meta.env;
const appBaseInfo = uni.getAppBaseInfo();
import showDialog from '@/common/dialogMessage';
import { reactive, ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import {getExtraHeight} from '@/common/common';
const extra_height = ref(getExtraHeight());
const customStyle = {
fontWeight:700
}
const deviceInfo = reactive({
deviceType: '', // 设备类型
deviceBrand: '', // 设备品牌
deviceModel: '', // 设备型号
deviceOrientation: '', // 设备方向
devicePixelRatio: '', // 设备像素比
osName: '', // 系统名称
osVersion: '' // 操作系统版本
});
const windowInfo = reactive({
pixelRatio: '', // 设备像素比(number → 转字符串展示)
screenWidth: '', // 屏幕宽度
screenHeight: '', // 屏幕高度
windowWidth: '', // 可使用窗口宽度
windowHeight: '', // 可使用窗口高度
windowTop: '', // 可使用窗口的顶部位置
windowBottom: '', // 可使用窗口的底部位置
statusBarHeight: '', // 手机状态栏的高度
screenTop: '', // 窗口上边缘的 y 值
safeArea: {}, // 安全区域(对象)
safeAreaInsets: {} // 安全区域插入位置(对象)
});
const bbbb = () => {
onLoad(() => {
const _deviceInfo = uni.getDeviceInfo();
Object.assign(deviceInfo, _deviceInfo);
const _windowInfo = uni.getWindowInfo();
Object.assign(windowInfo, _windowInfo);
}
const aaaa = async() => {
common.navigateTo('/pages/test/testChat')
}
});
// windowTop:'', // 窗口的顶部位置
// statusBarHeight:'', // 手机状态栏的高度
// safeArea:{}, // safeArea
const bbbb = () => {};
const aaaa = async () => {
common.navigateTo('/pages/test/testChat');
};
</script>
<style lang="scss" scoped>
$bg-margin-left: 50rpx;
.detail-title {
margin: 30rpx $bg-margin-left 0 calc($bg-margin-left + 15rpx);
font-size: 32rpx;
font-weight: 600;
z-index: 101;
overflow: hidden;
}
.detail-body {
margin: 30rpx $bg-margin-left 0 $bg-margin-left;
background: #ffffff;
@@ -65,7 +163,7 @@
}
.detail-main {
background-color: #F6F8FF;
background-color: #f6f8ff;
}
.title {
@@ -113,4 +211,4 @@
}
}
}
</style>
</style>