修改头像裁剪组件,修改其他bug

This commit is contained in:
田岩
2025-09-02 21:18:48 +08:00
parent acae343260
commit e12756b45e
31 changed files with 1268 additions and 1308 deletions
+3 -1
View File
@@ -12,10 +12,11 @@ export const uploadFile = (file, data) => {
const base_url = get_base_url(url);
const token = getToken();
const header = {};
console.log('file', file);
if (token)
header['summary'] = token
return new Promise((resolve, reject) => {
uni.uploadFile({
uni.uploadFile({
url: `${base_url}${url}`,
header: header,
filePath: file,
@@ -34,6 +35,7 @@ export const uploadFile = (file, data) => {
}
},
fail(error) {
console.log('error', error);
reject(new Error('Upload failed'));
}
});
+1 -1
View File
@@ -22,7 +22,7 @@ export const commitPaperExam = (data) => {
});
};
// 试卷考试查分
// 考试中心考试查分
export const queryPaperExamScore = (data) => {
return request({
url: base_url + '/traExamPapers/queryPaperExamScore',
+6 -7
View File
@@ -61,7 +61,6 @@ export const useAccountLoginApp = (data) => request({
...userInfo,
'mascotInfo': mascotInfo
})
console.log(mascotInfo);
return {
mascotState:!mascotInfo.mascotId
}
@@ -112,21 +111,21 @@ export const queryCurrentUser = (data) => request({
// userId: "USER001"
// userName: "ADMIN" / todo name
// userStatus: "01"
const userInfo = getUserInfo()
const userInfo = getUserInfo() ?? {}
setUserInfo({
...userInfo,
...res.body
})
console.log('预加载头像');
// console.log('预加载头像');
const base_url = get_base_url()
// 预加载头像
// #ifdef APP-PLUS
// 更新用户信息中的头像路径
const updateUserAvatar = (imagePath) => {
const _userInfo = getUserInfo() ?? {}
setUserInfo({
...userInfo,
..._userInfo,
...res.body,
'imagePath': imagePath
})
}
@@ -215,7 +214,7 @@ export const queryCurrentUser = (data) => request({
const exists = await checkFileExists(localFilePath)
if (exists) {
console.log('头像已存在,无需下载')
// console.log('头像已存在,无需下载')
updateUserAvatar(localFilePath)
} else {
const savedPath = await downloadAndSaveAvatar(fileUrl, localFilePath)
+5 -5
View File
@@ -42,10 +42,10 @@ export default class WebSocketUtil {
header: this.options.header || {},
protocols: this.options.protocols || [],
success: () => {
console.log('WebSocket连接创建成功');
// console.log('WebSocket连接创建成功');
},
fail: (err) => {
console.error('WebSocket连接创建失败', err);
// console.error('WebSocket连接创建失败', err);
this.triggerEvent('error', err);
this.tryReconnect(); // 连接失败时尝试重连
}
@@ -53,7 +53,7 @@ export default class WebSocketUtil {
// 监听WebSocket连接打开事件
this.socketTask.onOpen(() => {
console.log('WebSocket连接已打开');
// console.log('WebSocket连接已打开');
this.reconnectCount = 0; // 重置重连计数
clearInterval(this.reconnectTimer); // 清除重连计时器
// this.startHeartbeat(); // 启动心跳机制
@@ -83,7 +83,7 @@ export default class WebSocketUtil {
// 监听WebSocket连接关闭事件
this.socketTask.onClose((res) => {
console.log('WebSocket连接已关闭', res);
// console.log('WebSocket连接已关闭', res);
clearInterval(this.heartbeatTimer); // 清除心跳计时器
this.triggerEvent('close', res); // 触发连接关闭事件
this.tryReconnect(); // 尝试重连
@@ -146,7 +146,7 @@ export default class WebSocketUtil {
this.socketTask.send({
data: typeof message === 'string' ? message : JSON.stringify(message),
success: () => {
console.log('WebSocket消息发送成功');
// console.log('WebSocket消息发送成功');
},
fail: (err) => {
console.error('WebSocket消息发送失败', err);
File diff suppressed because it is too large Load Diff
@@ -36,12 +36,11 @@
}
});
const select_status = computed(() => {
// 只要是正确答案 就是绿色
if (props.analysisVo.correctFlag === 'R') return 'success';
// 是错误答案但是被用户错误选中的为红
const my_answer_array = props.my_answer;
if(my_answer_array.includes(props.analysisVo.itemId) && props.analysisVo.correctFlag === 'E') return 'error';
// 是正确答案 被用户错误选中的为绿色
if(my_answer_array.includes(props.analysisVo.itemId) && props.analysisVo.correctFlag === 'R') return 'success';
// 只有被我选中,不知是正确还是错误的为蓝
if(my_answer_array.includes(props.analysisVo.itemId)) return 'primary';
// 什么都不是者为灰色
+1 -2
View File
@@ -99,8 +99,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">试题解析{{ subject_data?.analyContent }}</view>
</view>
</view>
</view>
@@ -89,7 +89,7 @@
<image class="img" src="@/static/images/courseDetail/empty_message.png" mode="widthFix"></image>
<view class="text">这里什么都没有</view>
</view>
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载"></uv-load-more>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载"></uv-load-more>
<uni-popup ref="popup" class="popup">
<view class="bottom_reply_input_div" :style="{ marginBottom: popup_input_bottom }">
<uv-input
@@ -97,9 +97,7 @@
};
// 跳转到详情
const click_list_item = (list_item) => {
console.log('list_item', list_item);
const papersName = item.value.examName;
common.navigateTo(
`/pages/examination/result?execId=${list_item.execId}&papersName=${papersName}&mode=record`
);
@@ -2,8 +2,8 @@
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list"></itemVue>
<list-no-data v-if="total == 0 && status == 'nomore'"></list-no-data>
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无记录</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</template>
@@ -2,8 +2,8 @@
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list"></itemVue>
<list-no-data v-if="total == 0 && status == 'nomore'"></list-no-data>
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无记录</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</template>
@@ -2,8 +2,8 @@
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list" ></itemVue>
<list-no-data v-if="total == 0 && status == 'nomore'"></list-no-data>
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无记录</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</template>
+17 -10
View File
@@ -268,7 +268,7 @@
// 录音按钮提交
const touchBtnSubmit = (type, submitObj) => {
const old_text = touchBtnRef.value?.clearinputText(); // 清除发送框数据
// const old_text = touchBtnRef.value?.clearinputText(); // 清除发送框数据
if (type === 'voice') {
topic.value.es_status = '00'; // 00转圈
const voicePath = submitObj;
@@ -276,19 +276,26 @@
.then((res) => {
let _res = JSON.parse(res.data);
if (_res.rtnCode === '0000') {
topic.value.es_status = '02';
topic.value.my_answer = {
anserResult: _res.body.transContent,
ossKey: _res.body.fileId,
ossAddr: _res.body.ossFileAddr,
voicePath: voicePath
};
const _content = _res.body.transContent.trim();
console.log('_content', _content);
if (_content === '') {
topic.value.es_status = ''; // 取消转圈
return common.msg('未识别到文字');
} else {
topic.value.es_status = '02';
topic.value.my_answer = {
anserResult: _res.body.transContent,
ossKey: _res.body.fileId,
ossAddr: _res.body.ossFileAddr,
voicePath: voicePath
};
}
}
})
.catch((err) => {
topic.value.es_status = ''; // 取消转圈
// 失败了再把发送框数据还原回去
touchBtnRef.value?.clearinputText(old_text); // 清除发送框数据
// touchBtnRef.value?.clearinputText(old_text); // 清除发送框数据
common.msg('系统异常,请联系管理员');
});
} else if (type === 'text') {
@@ -466,7 +473,7 @@
}
func.then((res) => {
// 判断是否需要查分
const flagQueryDetail = res.body.flagQueryDetail===''?res.body.flagQuery:res.body.flagQueryDetail
const flagQueryDetail = res.body.flagQueryDetail === '' ? res.body.flagQuery : res.body.flagQueryDetail;
common.redirectTo(
`/pages/examination/result?execId=${res.body.execId}&flagQuery=${res.body.flagQuery}&flagQueryDetail=${flagQueryDetail}&examLenTm=${examLenTm}&papersName=${paperData.papersName}&papersId=${paperData.papersId}&mode=${mode}&crsId=${paperData.crsId}`
);
+11 -6
View File
@@ -123,7 +123,8 @@
import { onLoad, onUnload } from '@dcloudio/uni-app';
import { ref, reactive, computed, onMounted, nextTick, getCurrentInstance } from 'vue';
import { queryPaperExamScore } from '@/api/examination.js';
import { queryPaperExamScore, queryCrsExamScore } from '@/api/examination.js';
import Subject from '@/components/examination/subject.vue';
import common from '@/common/common';
const pass_status = ref(0);
@@ -208,7 +209,7 @@
const scroll = (event) => {};
// 跳转到去考试页面
// 考试排行榜
const goExamRanking = () => {
// 首先判断是课程跳入还是考试中心跳入
if (result.crsId !== '') {
@@ -243,11 +244,17 @@
console.log('已达到最大请求次数(15次),停止请求');
return;
}
let req
if (result.crsId !== '') { // 试卷跳入
req = queryCrsExamScore
} else {
req = queryPaperExamScore
}
timerId.value = setTimeout(() => {
// 每次请求前计数器+1
requestCount.value++;
queryPaperExamScore({
req({
execId: result.execId
})
.then(({ body }) => {
@@ -289,7 +296,6 @@
result.papersName = e.papersName;
result.examLenTm = e.examLenTm;
result.mode = e.mode || '';
result.papersId = e.papersId;
flagQueryDetail.value = e.flagQueryDetail;
flagQuery.value = e.flagQuery;
@@ -305,7 +311,6 @@
}
});
const formatSecondsToText = (milliseconds) => {
console.log('milliseconds', milliseconds);
if (milliseconds === undefined) return '--';
// 尝试将输入转换为数字(处理字符串形式的数字)
const num = Number(milliseconds);
@@ -57,8 +57,7 @@
</template>
<script setup>
import { computed, ref, reactive, nextTick } from 'vue';
import { setPageCache } from '@/common/common';
import { computed, ref, reactive } from 'vue';
import common from '@/common/common';
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const props = defineProps({
@@ -99,10 +98,9 @@
};
// 跳转到详情
const click_list_item = (list_item) => {
const examLenTm = 666;
const papersName = item.value.examName;
common.navigateTo(
`/pages/examination/result?execId=${list_item.execId}&examLenTm=${examLenTm}&papersName=${papersName}&mode=record`
`/pages/examination/result?execId=${list_item.execId}&papersName=${papersName}&mode=record&flagQuery=Y&flagQueryDetail=Y`
);
};
</script>
@@ -2,8 +2,8 @@
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list"></itemVue>
<list-no-data v-if="total == 0 && status == 'nomore'"></list-no-data>
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无记录</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</template>
@@ -33,7 +33,7 @@
</view>
</uv-swipe-action-item>
</uv-swipe-action>
<list-no-data v-if="total == 0 && status == 'nomore'">暂无数据</list-no-data>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无数据</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
@@ -41,7 +41,7 @@
</view>
</uv-swipe-action-item>
</uv-swipe-action>
<list-no-data v-if="total == 0 && status == 'nomore'">暂无数据</list-no-data>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无数据</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
+1
View File
@@ -438,6 +438,7 @@
return;
}
const userInfo = getUserInfo();
console.log('首页userInfo', userInfo);
if (userInfo) {
mascotInfo.value = userInfo?.mascotInfo;
}
@@ -45,9 +45,15 @@
};
// 跳转到详情
const click_item = (item) => {
if(item.isTimeOut === '00') {
common.msg('任务已结束')
return ;
if(item.limitTyp === '02') {
const startTm = new Date(item.startTm).getTime();
const endTm = new Date(item.endTm).getTime();
const currentTimestamp = Date.now();
if(currentTimestamp < startTm) {
return common.msg('任务未开始');
} else if(currentTimestamp > endTm) {
return common.msg('任务已结束');
}
}
setPageCache('learning_tasks_details', item);
common.navigateTo('/pages/learningTasks/details');
@@ -2,8 +2,8 @@
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list"></itemVue>
<list-no-data v-if="total == 0 && status == 'nomore'"></list-no-data>
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无学习任务</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</template>
@@ -23,7 +23,7 @@
required: true
}
});
const getData = (from = '', searchText = '') => {
if (from == 'first') {
if (total.value !== -1) {
+1 -1
View File
@@ -113,7 +113,7 @@
</view>
</view>
</view>
<list-no-data v-if="total == 0 && status == 'nomore'"></list-no-data>
<list-no-data v-if="total === 0 && status === 'nomore'">暂无数据</list-no-data>
<uv-load-more
v-if="status === 'loading'"
:status="status"
+17 -17
View File
@@ -55,24 +55,14 @@
<view class="item">
<view class="top">我的积分</view>
<view class="bottom">
<uv-count-to
:startVal="0"
:endVal="0"
:useEasing="true"
ref="accmTaskCntRef"
></uv-count-to>
<uv-count-to :startVal="0" :endVal="0" :useEasing="true" ref="accmTaskCntRef"></uv-count-to>
</view>
</view>
<view class="item-interval"></view>
<view class="item">
<view class="top">徽章墙</view>
<view class="bottom">
<uv-count-to
:startVal="0"
:endVal="0"
:useEasing="true"
ref="accmTaskCntRef"
></uv-count-to>
<uv-count-to :startVal="0" :endVal="0" :useEasing="true" ref="accmTaskCntRef"></uv-count-to>
</view>
</view>
</view>
@@ -243,13 +233,22 @@
const avatarCropperStatus = ref(true);
const avatarCropperUrl = ref('');
//
const click_update_avatar = (value) => {
const click_update_avatar = () => {
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
success: (res) => {
avatarCropperUrl.value = res.tempFilePaths[0];
avatarCropperStatus.value = true;
success: (resPicture) => {
uni.getFileInfo({
filePath: resPicture.tempFilePaths[0],
success: function (resSize) {
if (resSize.size > 10 * 1024 * 1024) return common.msg('图片过大,请重新选择');
avatarCropperUrl.value = resPicture.tempFilePaths[0];
avatarCropperStatus.value = true;
},
fail: function (err) {
common.msg('获取图片失败,请选择其他图片');
}
});
}
});
};
@@ -280,7 +279,8 @@
common.msg('修改成功');
user_info.imageAddr = userData.imageAddr;
user_info.imagePath = '';
} catch {
} catch (e) {
console.log('sss', e);
common.msg('修改失败');
}
common.hideLoading();
+1 -1
View File
@@ -49,7 +49,7 @@
</view>
</view>
</view>
<list-no-data v-if="total == 0 && status == 'nomore'">暂无数据</list-no-data>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无数据</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
<uni-popup ref="popup" type="bottom">
+5 -5
View File
@@ -26,22 +26,22 @@
"
></view>
<view class="item" v-for="(item, index) in data_list" @click="read">
<view class="item" v-for="item in data_list" @click="read">
<view class="icon">
<image
v-if="item.noticeTyp == '01'"
v-if="item.noticeTyp === '01'"
class="img_100"
src="@/static/images/messageNotification/type_01.png"
mode="widthFix"
></image>
<image
v-if="item.noticeTyp == '02'"
v-if="item.noticeTyp === '02'"
class="img_100"
src="@/static/images/messageNotification/type_02.png"
mode="widthFix"
></image>
<image
v-if="item.noticeTyp == '03'"
v-if="item.noticeTyp === '03'"
class="img_100"
src="@/static/images/messageNotification/type_03.png"
mode="widthFix"
@@ -65,7 +65,7 @@
</view>
</view>
</view>
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</view>
</scroll-view>
</view>
@@ -13,7 +13,7 @@
<view class="time_and_num"></view>
</view>
</view>
<list-no-data v-if="total == 0 && status == 'nomore'">暂无数据</list-no-data>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无数据</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
+15 -6
View File
@@ -153,14 +153,23 @@
}
})
//
const click_update_avatar = (value) => {
const click_update_avatar = () => {
uni.chooseImage({
count: 1,
sizeType: ["compressed"],
success: (res) => {
avatarCropperUrl.value = res.tempFilePaths[0];
avatarCropperStatus.value = true
},
sizeType: ['compressed'],
success: (resPicture) => {
uni.getFileInfo({
filePath: resPicture.tempFilePaths[0],
success: function (resSize) {
if (resSize.size > 10 * 1024 * 1024) return common.msg('图片过大,请重新选择');
avatarCropperUrl.value = resPicture.tempFilePaths[0];
avatarCropperStatus.value = true;
},
fail: function (err) {
common.msg('获取图片失败,请选择其他图片');
}
});
}
});
};
//
+1 -2
View File
@@ -10,7 +10,7 @@
<!-- 主体 -->
<view class="content">
<itemVue :item="item" v-for="item in data_list"></itemVue>
<list-no-data v-if="total == 0 && status == 'nomore'">暂无数据</list-no-data>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无考试任务</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</view>
</scroll-view>
@@ -77,7 +77,6 @@
getData();
};
const search = (value) => {
console.log('searchvalue', value);
total.value = -1;
getData('first', value);
};
@@ -4,8 +4,8 @@
<view class="content" v-for="(item, index) in data_list">
<subject :item="item" mode="mistake" :isPreview="true" :clearResult="false"></subject>
</view>
<list-no-data v-if="total == 0 && status == 'nomore'"></list-no-data>
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无错题</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</template>
@@ -4,8 +4,8 @@
<view class="content" v-for="(item, index) in data_list">
<subject :item="item" mode="mistake" :isPreview="true" :clearResult="false"></subject>
</view>
<list-no-data v-if="total == 0 && status == 'nomore'"></list-no-data>
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无错题</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</template>