版本:0.0.0.12

1、添加首页检查更新;2、更换获取考试列表所取id值id --> studentid; 3、考试详情添加提交状态,优化考试提交逻辑;4、答题器取消确定窗口;5、修复bug;
master
chris 3 weeks ago
parent 9d073a9d06
commit 512008bde8

@ -3,6 +3,7 @@
import { onBeforeMount } from 'vue'
// #ifdef APP
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import { useSystemStore } from '@/store/system.js';
const systemStore = useSystemStore()
// #endif
@ -15,6 +16,7 @@
// #ifdef APP
const appInfo = uni.getAppBaseInfo()
systemStore.setAppInfo(appInfo)
checkAppUpdate()
// #endif
uni.getNetworkType({
@ -46,6 +48,19 @@
userStore.setUserInfo(userInfo)
}
})
//
function checkAppUpdate () {
// #ifdef APP
checkUpdate().then(res => {
console.log('检查更新结果:', res)
}).catch(error => {
console.log("检查更新错误:", error)
}).finally(() => {
console.log('检查更新结束')
})
// #endif
}
</script>
<style>

@ -133,7 +133,11 @@ function upload () {
name: 'task-image',
success: (uploadFileRes) => {
uni.showToast({
title: '上传成功'
title: '上传成功',
icon: 'success',
// success: () => {
// resolve(uploadFileRes)
// }
})
resolve(uploadFileRes)
},
@ -142,8 +146,8 @@ function upload () {
icon: 'fail',
title: '上传失败'
})
reject(error)
console.log('上传失败', error)
reject(error)
}
})
})

@ -2,8 +2,8 @@
"name" : "studypen",
"appid" : "__UNI__C183B0D",
"description" : "",
"versionName" : "0.0.0.9",
"versionCode" : 101,
"versionName" : "0.0.0.12",
"versionCode" : 103,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@ -99,20 +99,6 @@
"pid" : "",
"parameters" : {}
}
},
"XM-SysPrinter" : {
"__plugin_info__" : {
"name" : "双端系统打印插件 - [试用版,仅用于自定义调试基座]",
"description" : "XM-SysPrinter是一款在原生系统中调起系统打印页面的插件支持图片、pdf、office、网页等。",
"platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=9567",
"android_package_name" : "",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 0,
"pid" : "9567",
"parameters" : {}
}
}
}
},

@ -60,29 +60,22 @@ function selectOpt (e) {
}
function submitAnswer () {
uni.showModal({
content: '确定要提交答案?',
confirmText: '提交',
cancelText: '放弃',
success: () => {
const params = {
studentanswer: selectOpts.value.join(','),
studentid: userId
}
const params = {
studentanswer: selectOpts.value.sort().join(','),
studentid: userId
}
submitIClickerData(params).then(res => {
uni.showToast({
icon: 'success',
title: '已提交'
})
refresh();
}).catch(() => {
uni.showToast({
icon:'error',
title: '提交失败'
})
})
}
submitIClickerData(params).then(res => {
uni.showToast({
icon: 'success',
title: '已提交'
})
refresh();
}).catch(() => {
uni.showToast({
icon:'error',
title: '提交失败'
})
})
}

@ -28,7 +28,7 @@ import { getExamList } from '@/api/exam.js';
const userStore = useUserStore();
const userId = userStore.userId;
const params = {
id: userId,
studentid: userId,
status: 1,
}

@ -3,7 +3,8 @@
<ch-nav-bar title="考试详情" :height="66"></ch-nav-bar>
<uni-list>
<uni-list-item :showArrow="false" title="考试名称" :rightText="exam.examname" />
<uni-list-item :showArrow="false" title="提交状态" :rightText="status" />
<uni-list-item :showArrow="false" title="考试状态" :rightText="status" />
<uni-list-item :showArrow="false" title="提交状态" :rightText="studentStatus" />
<uni-list-item :showArrow="false" title="得分" :rightText="exam.studentscore + ''" />
<uni-list-item :showArrow="false" title="考试图片" />
<!-- <uni-file-picker
@ -27,7 +28,7 @@
:url="uploadUrl">
</ch-image-uploader>
</uni-list>
<button class="submit-btn" type="primary" :loading="uploading" :disabled="isDisable" @click="submitExam"></button>
<button class="submit-btn" type="primary" :loading="uploading" :disabled="isDisable" @click="submitExam" v-if="status === '进行中'"> </button>
</view>
</template>
@ -59,8 +60,7 @@ const data = reactive({
const { exam, img, imgStyle , files, examId, uploading } = toRefs(data);
const isDisable = computed(() => {
console.log('files', files.value)
!files.value.length || uploading.value
return !files.value.length || uploading.value
})
const status = computed(() => {
@ -69,6 +69,12 @@ const status = computed(() => {
return exam.value.status == 1 ? '进行中' : '已结束'
})
const studentStatus = computed(() => {
if (!exam.value.studentstatus) return ''
return exam.value.studentstatus == 1 ? '已提交' : '未提交'
})
const uploadUrl = computed(() => {
return `${config.baseUrl}/api/user.ashx?act=subexaminfo&studentid=${userId}&examid=${examId.value}`
})
@ -86,24 +92,52 @@ onMounted(() => {
// examid: 1,
// studentid: 1
// }
getExamInfo(params, { loading: true }).then(info => {
exam.value = info;
if (!info.studentimg) return;
files.value = [{
name: 'studentimg',
extname: 'image/png',
path: `${info.studentimg}`
}]
})
getInfo(params, true)
})
//
function submitExam () {
uploading.value = true;
console.log(imgUploader)
imgUploader.value.upload()
.then(() => {
console.log('上传成功')
uni.showToast({
title: '提交成功',
icon: 'success'
})
setTimeout(() => {
getInfo({
examid: examId.value,
studentid: userId
})
}, 1000)
})
.catch(() => {
uni.showToast({
title: '提交失败',
icon: 'error'
})
})
.finally(() => {
uploading.value = false;
uploading.value = false
})
}
function getInfo (params, loading = false) {
return new Promise((resolve, reject) => {
getExamInfo(params, { loading }).then(info => {
exam.value = info;
if (!info.studentimg) return;
files.value = [{
name: 'studentimg',
extname: 'image/png',
path: `${info.studentimg}`
}]
resolve(info)
})
.catch(error => {
reject(error)
})
})
}

@ -8,8 +8,12 @@
}
.user__info-item {
font-size: $uni-font-size-sm;
margin: 4px;
// font-size: 30px;
margin: 2px;
}
.user__info-item text {
font-size: 29px;
}
.uni-grid-item {

@ -7,13 +7,13 @@
</ch-nav-bar>
<view class="top-container">
<uni-row :gutter="10">
<uni-col :span="8">
<uni-col :span="7">
<view class="user__info-item">
<text>姓名</text>
<text>{{ userInfo.studentname }}</text>
</view>
</uni-col>
<uni-col :span="8">
<uni-col :span="9">
<view class="user__info-item">
<text>学号</text>
<text>{{ userInfo.studentno }}</text>
@ -99,6 +99,7 @@ function enterSetting () {
url: '/pages/setting/setting'
})
}
</script>
<style lang="scss" scoped>

@ -1,7 +1,3 @@
::v-deep uni-page-wrapper {
overflow: hidden;
}
.ques-details-page {
height: 100vh;
overflow: hidden;
@ -9,7 +5,6 @@
.ques-content {
height: 100%;
overflow-y: auto;
margin: 0 20rpx;
flex: 26;
}
@ -22,7 +17,7 @@
.toggle-btn {
padding: 0 16rpx;
line-height: 2;
flex: 1;
flex: 1.5;
}
.uni-icons {

@ -11,7 +11,7 @@
<button class="toggle-btn" type="warn" :disabled="questionId == quesIds[0]" @click="toggleQues(-1)">
<uni-icons type="arrow-left" size="28" color="#fff"></uni-icons>
</button>
<view class="ques-content">
<scroll-view scroll-y="true" class="ques-content" :scroll-top="scrollTop">
<view v-html="question.questioncontent"></view>
<view class="ques-options">
<view class="option" v-for="item in question.option">
@ -26,7 +26,23 @@
<text>解析</text>
<view v-html="question.questionexplain"></view>
</view>
</view>
</scroll-view>
<!-- <view class="ques-content">
<view v-html="question.questioncontent"></view>
<view class="ques-options">
<view class="option" v-for="item in question.option">
{{ item.optionnumber }}. <view v-html="item.optioncontent"></view>
</view>
</view>
<view class="answer">
<text>答案</text>
<view v-html="question.questionanswer"></view>
</view>
<view class="analysis">
<text>解析</text>
<view v-html="question.questionexplain"></view>
</view>
</view> -->
<button class="toggle-btn" type="warn" :disabled="questionId == quesIds[quesIds.length - 1]" @click="toggleQues(1)">
<uni-icons type="arrow-right" size="28" color="#fff"></uni-icons>
</button>
@ -45,10 +61,11 @@ import renderMath from '@/utils/mathJax/renderMath';
const data = reactive({
question: {},
questionId: 1,
quesIds: []
quesIds: [],
scrollTop: 0
})
const { question, questionId, quesIds } = toRefs(data)
const { question, questionId, quesIds, scrollTop } = toRefs(data)
const isExit = computed(() => {
return question.value && JSON.stringify(question.value) !== '{}'

@ -10,7 +10,7 @@
</uni-list-item>
<uni-list-item title="家长二维码" show-arrow="true" clickable @click="checkQrcode">
</uni-list-item>
<uni-list-item title="清除数据" show-arrow="true" clickable @click="clearStorage">
<uni-list-item title="退出登录" show-arrow="true" clickable @click="clearStorage">
</uni-list-item>
</uni-list>
<uni-popup ref="qrcodePopupRef" type="dialog">
@ -65,17 +65,29 @@ function checkQrcode () {
}
function clearStorage () {
count.value++;
if (count.value < 3) return;
uni.clearStorageSync();
uni.showToast({
title: '清除成功',
success() {
uni.reLaunch({
url: '/pages/login/login'
})
// count.value++;
// if (count.value < 3) return;
uni.showModal({
title: '提示',
content: '确定要退出登录吗?',
success: function (res) {
if (res.confirm) {
uni.clearStorageSync();
uni.reLaunch({
url: '/pages/login/login'
})
}
}
})
});
// uni.clearStorageSync();
// uni.showToast({
// title: '退',
// success() {
// uni.reLaunch({
// url: '/pages/login/login'
// })
// }
// })
}
</script>

@ -57,7 +57,7 @@ function requestFun ({ url, method, data = {} }, config = { loading: true }) {
const requestConfig = Object.assign({}, config);
delete requestConfig.loading;
config.loading && uni.showLoading()
config.loading && uni.showLoading({ mask: true })
return new Promise((resolve, reject) => {
const task = uni.request({

Loading…
Cancel
Save