修改评论Bug

This commit is contained in:
田岩
2025-07-24 16:35:06 +08:00
parent e86f959c50
commit e609f80681
6 changed files with 83 additions and 70 deletions
+1 -1
View File
@@ -18,4 +18,4 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# h5专用地址
VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7002'
VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7001'
+58 -46
View File
@@ -1,5 +1,6 @@
// #ifdef APP-PLUS
import showDialog from '@/common/dialogMessage'
// #endif
function msg(title, duration = 1000) {
uni.showToast({
title: title,
@@ -10,40 +11,49 @@ function msg(title, duration = 1000) {
}
function show(title, msg, showCancel = true, cancelText = '取消', confirmText = '确定') {
return new Promise((resolve, reject) => {
// 创建通用参数对象
const dialogOptions = {
title,
content: msg,
showCancel,
cancelText,
confirmText,
success: (res) => {
// 统一处理成功回调,解析为布尔值
console.log('res.confirm', res.confirm);
resolve(!!res.confirm);
}
};
if (getPhoneEnvBool('AND')) {
// 安卓环境使用showDialog,补充cancel回调
showDialog({
...dialogOptions,
cancel: () => {
console.log('用户点击取消');
resolve(false); // 取消时也返回Promise结果
}
});
} else {
// 其他环境使用uni.showModal,补充fail回调
uni.showModal({
...dialogOptions,
fail: (res) => {
reject(res);
}
});
}
});
return new Promise((resolve, reject) => {
// 创建通用参数对象
const dialogOptions = {
title,
content: msg,
showCancel,
cancelText,
confirmText,
success: (res) => {
// 统一处理成功回调,解析为布尔值
console.log('res.confirm', res.confirm);
resolve(!!res.confirm);
}
};
// #ifdef APP-PLUS
if (getPhoneEnvBool('AND')) {
// 安卓环境使用showDialog,补充cancel回调
showDialog({
...dialogOptions,
cancel: () => {
console.log('用户点击取消');
resolve(false); // 取消时也返回Promise结果
}
});
} else {
// 其他环境使用uni.showModal,补充fail回调
uni.showModal({
...dialogOptions,
fail: (res) => {
reject(res);
}
});
}
// #endif
// #ifdef H5
uni.showModal({
...dialogOptions,
fail: (res) => {
reject(res);
}
});
// #endif
});
}
const loading = (title = '加载中', mask = true) => uni.showLoading({
@@ -140,18 +150,20 @@ export const getUserInfo = (key = '') => {
* @returns {boolean} 如果当前平台匹配指定标识返回true,否则返回false
*/
export const getPhoneEnvBool = (flag) => {
// 获取当前设备的平台信息
const { platform } = uni.getSystemInfoSync();
// 平台与标识的映射关系
const platformMap = {
ios: 'IOS',
android: 'AND',
};
// 获取当前设备的平台信息
// 根据当前平台返回匹配结果
return platformMap[platform] === flag;
const {
platform
} = uni.getSystemInfoSync();
// 平台与标识的映射关系
const platformMap = {
ios: 'IOS',
android: 'AND',
};
// 根据当前平台返回匹配结果
return platformMap[platform] === flag;
};
+4 -2
View File
@@ -1,4 +1,5 @@
export default function showDialog(options) {
const view = new plus.nativeObj.View('customModal', {
top: '0',
left: '0',
@@ -7,7 +8,7 @@ export default function showDialog(options) {
backgroundColor: 'rgba(0,0,0,0.1)',
position: 'fixed'
});
const screenWidth = plus.screen.resolutionWidth;
const screenHeight = plus.screen.resolutionHeight;
const borderRadius = 10;
@@ -212,7 +213,7 @@ export default function showDialog(options) {
}
}
}, false);
view.show();
return {
@@ -220,4 +221,5 @@ export default function showDialog(options) {
view.close();
}
};
}
+12 -4
View File
@@ -167,10 +167,18 @@
}
}
const getData = () => {
if (status.value !== 'loadmore' && status.value !== '') return
status.value = 'loading'
page.value++
const getData = (from = '') => {
if (from == 'submit') {
status.value = ''
total.value = -1
page.value = 1
message_list.length = 0
} else {
if (status.value !== 'loadmore' && status.value !== '') return
status.value = 'loading'
page.value++
}
queryTraCrsBbsInfoByCrsId({
crsId: props.crsId,
page: page.value,
+7 -16
View File
@@ -37,30 +37,22 @@
:inactive-style="{ color: '#666666', 'font-size': '30rpx' }"></uv-tabs>
</view>
</uv-sticky>
<!-- <swiper class="body-swiper" @change="swiper_change" :current="tabAct">
<swiper-item> -->
<!-- <swiper class="body-swiper" @change="swiper_change" :current="tabAct"><swiper-item> -->
<view class="course-info" v-if="tabAct == 0">
<introduceVue v-model="form"></introduceVue>
</view>
<!-- </swiper-item>
<swiper-item> -->
<!--</swiper-item><swiper-item>-->
<view class="point" v-if="tabAct == 1">
<knowledge v-model="form" @toStudyPrgh="toStudyPrgh"></knowledge>
</view>
<!-- </swiper-item>
<swiper-item> -->
<!--</swiper-item><swiper-item>-->
<view class="evaluate" v-if="tabAct == 2 && form">
<comment ref="commentRef" :crsNum="form.crsNum" :crsId="form.crsId" :imgId="form.imgId">
</comment>
</view>
<!-- </swiper-item>
</swiper> -->
<!--</swiper-item></swiper>-->
</view>
</view>
</scroll-view>
<view class="btn-box btn-box-height font_pf">
<template v-if="[0,1].includes(tabAct)">
@@ -75,8 +67,6 @@
</template>
</view>
</view>
</template>
<script setup>
@@ -171,7 +161,8 @@
onMounted(async () => {
uni.$on('refresh_comment_data', () => {
commentRef.value?.getData();
console.log('发评论了刷新');
commentRef.value?.getData('submit');
tabAct.value = 2
})
})
@@ -315,7 +306,7 @@
.evaluate {
min-height: calc(100vh - 92rpx - 22rpx - 245rpx - var(--status-bar-height));
}
.btn-box-height {
height: 187rpx;
}
+1 -1
View File
@@ -86,7 +86,7 @@
publishCrsEvaluation(formData).then(res => {
common.msg('发表成功')
setTimeout(() => {
uni.$emit('setMascot')
uni.$emit('refresh_comment_data')
if(from.value === 'study'){
} else {
}