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

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

@ -2,8 +2,8 @@
"name" : "studypen", "name" : "studypen",
"appid" : "__UNI__C183B0D", "appid" : "__UNI__C183B0D",
"description" : "", "description" : "",
"versionName" : "0.0.0.9", "versionName" : "0.0.0.12",
"versionCode" : 101, "versionCode" : 103,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
@ -99,20 +99,6 @@
"pid" : "", "pid" : "",
"parameters" : {} "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,13 +60,8 @@ function selectOpt (e) {
} }
function submitAnswer () { function submitAnswer () {
uni.showModal({
content: '确定要提交答案?',
confirmText: '提交',
cancelText: '放弃',
success: () => {
const params = { const params = {
studentanswer: selectOpts.value.join(','), studentanswer: selectOpts.value.sort().join(','),
studentid: userId studentid: userId
} }
@ -82,8 +77,6 @@ function submitAnswer () {
title: '提交失败' title: '提交失败'
}) })
}) })
}
})
} }
function refresh () { function refresh () {

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

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

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

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

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

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

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

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

Loading…
Cancel
Save