This commit is contained in:
shijing 2024-06-18 15:38:26 +08:00
parent 1c18dddf66
commit f528764af3
15 changed files with 425 additions and 149 deletions

View File

@ -37,7 +37,7 @@ const install = (Vue, vm) => {
let getExamList = (params={})=>vm.$u.get('/exam/exam/', params);//考试列表
let startExam = (id)=>vm.$u.post(`/exam/exam/${id}/start/`);//开始考试
let submitExam = (id,params={})=>vm.$u.post(`/exam/examrecord/${id}/submit/`,params);//开始考试
let examRecord = (id,params={})=>vm.$u.get(`/exam/examrecord/self/`,params);//我的考试记录
let examRecord = (id,params={})=>vm.$u.get(`/exam/examrecord/`,params);//我的考试记录
let examRecordDetail = (id,params={})=>vm.$u.get(`/exam/examrecord/${id}/`,params);//我的考试记录
let paperDetail = (id,params={})=>vm.$u.get(`/exam/paper/${id}/`,params);//测试
let questionList = (params={})=>vm.$u.get(`/exam/question/`,params);//题目

View File

@ -137,39 +137,12 @@
}
}
// ,{
// "path" : "pages/exam/test",
// "style" :
// {
// "navigationBarTitleText": "练习",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/exam/question",
// "style" :
// {
// "navigationBarTitleText": "专题练习",
// "enablePullDownRefresh": false
// }
// }
// ,{
// "path" : "pages/exam/testDetail",
// "style" :
// {
// "navigationBarTitleText": "练习题目",
// "enablePullDownRefresh": false
// }
// }
,{
"path" : "pages/exam/exam",
"style" :
{
"navigationBarTitleText": "考试列表",
"enablePullDownRefresh": false
"enablePullDownRefresh": true
}
}
@ -243,12 +216,12 @@
"selectedIconPath": "static/common/homec.png",
"text": "主页"
},
{
"pagePath": "pages/exam/index",
"iconPath": "static/common/dati.png",
"selectedIconPath": "static/common/datic.png",
"text": "考试"
},
// {
// "pagePath": "pages/exam/index",
// "iconPath": "static/common/dati.png",
// "selectedIconPath": "static/common/datic.png",
// "text": "考试"
// },
// {
// "pagePath": "pages/vod/video",
// "iconPath": "static/common/play.png",

View File

@ -46,6 +46,7 @@
})
var filePath = res.tempFilePath;
uni.openDocument({
showMenu:true,
filePath: filePath,
success: function (res) {
uni.hideLoading()

View File

@ -1,60 +1,229 @@
<template>
<view>
<view class="tabs">
<scroll-view
id="tab-bar"
class="scroll-h"
:scroll-x="true"
:show-scrollbar="false"
>
<view v-for="(tab,index) in tabBars"
:key="tab.id" class="uni-tab-item"
:id="tab.id" :data-current="index"
@click="ontabtap">
<text class="tab-item-title"
:class="tabIndex==index ? 'tab-item-title-active' : ''">{{tab.name}}</text>
</view>
</scroll-view>
<view class="line-h"></view>
<scroll-view class="scroll-v list" enableBackToTop="true" scroll-y="true" @scrolltolower="loadMore()">
<uni-list>
<!-- 垂直排列无略缩图主标题+副标题显示 -->
<uni-list-item direction="column" :key="item.id" v-for="(item, index) in examList">
<template v-slot:header>
<view class="uni-title">{{item.name}}</view>
<view class="uni-title"><view class="blue_line"></view>{{item.name}}</view>
</template>
<template v-slot:body>
<view class="uni-list-box">
<view class="uni-content">
<view class="uni-title-sub uni-ellipsis-2">开启时间: {{item.open_time}}{{item.close_time}}</view>
<view class="uni-title-sub uni-ellipsis-2">开启时间: {{item.open_time}}</view>
<view class="uni-title-sub uni-ellipsis-2">结束时间: {{item.close_time}}</view>
<view class="uni-note">考试机会: {{item.chance}}</view>
</view>
</view>
</template>
<template v-slot:footer>
<view class="uni-footer">
<u-button size="mini" type="primary" @click="attendExam(item)">我要参加</u-button>
<u-button size="mini" type="info">成绩排名</u-button>
<u-button v-if="tabIndex==0" type="primary" @click="attendExam(item)">我要参加</u-button>
<!-- <u-button size="mini" type="info" >成绩排名</u-button> -->
</view>
</template>
</uni-list-item>
</uni-list>
<!-- <view class="bottomText" v-if="isLoading">{{loadingText}}</view> -->
<view v-if="isBottom" class="bottomText"> 已经到底了</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
query:{
can_attend:true,
is_my:true,
page:1
},
examList: []
examList: [],
tabBars:[
{name:'可参与',
id:'my'},
{name:'我的',
id:'attend'},
],
tabIndex:0,
examsList:[
{},{}
],
isLoading: false,
refreshText: "",
loadingText: '加载中...',
isBottom:false,
// bottomShow:false,
}
},
onLoad() {
this.getExamList();
setTimeout(()=>{
this.getExamList(0);
},350)
},
methods: {
getExamList(){
this.$u.api.getExamList(this.query).then(res=>{
this.examList = res.data.results
//获取考试列表
getExamList(index){
let that = this;
if(index==0){
that.query.can_attend = true;
}else{
that.query.can_attend = false;
}
that.isLoading = true;
that.isBottom = true;
that.$u.api.getExamList(that.query).then(res=>{
console.log(res)
if(res.data&&res.data.results.length>0){
that.isBottom = false;
console.log('u有数据')
that.examList = that.examList.concat(res.data.results)
}
})
},
//参加考试
attendExam(val){
console.log(val)
uni.setStorageSync('currentExam', val)
uni.navigateTo({
url:"/pages/exam/preview"
})
},
//切换列表
ontabtap(e) {
console.log('ontabtap')
this.query.page = 1;
this.examList = [];
this.isBottom=false;
// this.bottomShow=false;
let index = e.target.dataset.current || e.currentTarget.dataset.current;
this.switchTab(index);
},
//列表变动
switchTab(index) {
if (this.tabIndex === index) {
return;
}
this.tabIndex = index;
this.getExamList(index)
},
onpullingdown(e) {
},
//获取更多
loadMore() {
if(!this.isBottom){
this.query.page +=1;
setTimeout(() => {
this.getExamList(this.tabIndex);
}, 100)
}
// else{
// this.bottomShow = true;
// }
},
}
}
</script>
<style>
.tabs {
flex: 1;
flex-direction: column;
overflow: hidden;
background-color: #ffffff;
/* #ifndef APP-PLUS */
height: 100vh;
/* #endif */
}
.scroll-h {
width: 750rpx;
/* #ifdef H5 */
width:100%;
/* #endif */
height: 80rpx;
flex-direction: row;
/* #ifndef APP-PLUS */
white-space: nowrap;
/* #endif */
position: absolute;
top: 0;
z-index: 10;
}
.line-h {
height: 1rpx;
background-color: #cccccc;
}
.uni-tab-item {
/* #ifndef APP-PLUS */
display: inline-block;
/* #endif */
flex-wrap: nowrap;
padding-left: 34rpx;
padding-right: 34rpx;
}
.tab-item-title {
color: #555;
font-size: 30rpx;
height: 80rpx;
line-height: 80rpx;
flex-wrap: nowrap;
/* #ifndef APP-PLUS */
white-space: nowrap;
/* #endif */
}
.tab-item-title-active {
color: #007AFF;
}
.list{
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 5;
box-sizing: border-box;
padding: 80rpx 0 20rpx 0;
}
.uni-list-item{
width: 96%;
margin: 10px auto;
border: 1px solid #efefef;
border-radius: 10px;
}
.uni-list--border ,.uni-list--border-bottom{
display: none;
}
.bottomText{
font-size: 20rpx;
text-align: center;
height: 50rpx;
}
.blue_line{
width: 8rpx;
height: 40rpx;
background: #2581e4;
display: inline-block;
margin-right: 6rpx;
}
</style>

View File

@ -2,10 +2,26 @@
<view>
<view class="cellWrap">
<view class="cellItem" v-for="item in cellList" :index="item.id" :key="item.id" @click="intoPage(item)">
<view :class="item.class">
<image class="cellImg" :src="item.img"></image>
</view>
<text class="cellText">{{item.title}}</text>
</view>
</view>
<!-- <view class="cellWrap">
<view class="cellItem" @click="intoPage('exam')">
<view class="exam">
<image class="cellImg" src="../../static/exam/exam.png"></image>
</view>
<text class="cellText">正式考试</text>
</view>
<view class="cellItem" @click="intoPage('test')">
<view class="test">
<image class="cellImg" src="../../static/exam/test.png"></image>
</view>
<text class="cellText">考试记录</text>
</view>
</view> -->
</view>
</template>
@ -17,8 +33,8 @@
page: 1
},
cellList: [
{img:'../../static/exam/exam.png',title:'正式考试',id:'exam'},
{img:'../../static/exam/test.png',title:'考试记录',id:'test'},
{img:'../../static/exam/exam.png',title:'正式考试',id:'exam',class:'exam'},
{img:'../../static/exam/test.png',title:'考试记录',id:'test',class:'test'},
// {img:'../../static/exam/question.png',title:'专题练习',id:'question'},
// {img:'../../static/exam/errorIcon.png',title:'错题记录',id:'record'},
]
@ -91,4 +107,20 @@
.cellItem:nth-of-type(4) .cellText{
color: #d81e06;
}
.exam{
width: 200rpx;
height: 200rpx;
background: #46bb5a;
border-radius: 40rpx;
padding: 36rpx;
margin: auto;
}
.test{
width: 200rpx;
height: 200rpx;
background: #ecc041;
border-radius: 40rpx;
padding: 36rpx;
margin: auto;
}
</style>

View File

@ -22,7 +22,7 @@
</view>
<scroll-view class="content" scroll-y="true" v-bind:style="{height:scollHeight+'rpx'}">
<view class="name">
<view>{{currentIndex}}·{{currentQuestion.name}}</view>
<view>{{currentIndex+1}}·{{currentQuestion.name}}</view>
<!-- <rich-text :nodes="currentQuestion.name"></rich-text> -->
<view v-if="currentQuestion.img">
{{currentQuestion.img}}
@ -153,11 +153,16 @@
questions_.push(obj);
}
that.$u.api.submitExam(that.currentExam.examrecord,{questions_:questions_}).then(res=>{
uni.showToast({
title:"提交成功",
icon:"none"
})
uni.setStorageSync('currentExam',res.data)
uni.hideLoading()
uni.redirectTo({
uni.reLaunch({
url:'/pages/exam/result'
})
}).catch(e=>{
if(res.msg){
uni.showModal({
@ -166,12 +171,11 @@
showCancel:false,
success(res) {
uni.reLaunch({
url:'/pages/index/index'
url:'/pages/exam/exam'
})
}
})
}
})
// let questions = this.currentExam.questions
// let score=0

View File

@ -11,16 +11,17 @@
<view>题目分布单选<text>{{currentExam.paper_.danxuan_count}}</text>;多选<text>{{currentExam.paper_.duoxuan_count}}</text>;判断<text>{{currentExam.paper_.panduan_count}}</text></view>
<view>判分规则单选{{currentExam.paper_.danxuan_score}},多选{{currentExam.paper_.duoxuan_score}},多选{{currentExam.paper_.panduan_score}},错选少选均不得分</view>
</view>
<view class="subTitle">答题须知</view>
<!-- <view class="subTitle">答题须知</view> -->
<view class="tipsArea">
<ul>
<li class="tipsTitle">答题须知</li>
<li>1.进入答题后请不要后退或返回</li>
<li>2.可点击上一题/下一题切换</li>
<li>3.可点击答题卡复查</li>
<li>4.请合理安排时间答题,可提前交卷</li>
</ul>
</view>
<u-button type="primary" @click="start()">开始答题</u-button>
<u-button type="primary" @click="start()" class="start">开始答题</u-button>
</view>
</template>
@ -54,30 +55,54 @@
<style lang="scss" scoped>
.wrap{
padding: 24rpx;
font-size: 32rpx;
font-size: 30rpx;
}
.subTitle {
font-size: $u-font-size-title;
font-weight: bold;
color: $theme-color;
// color: $theme-color;
text-align: center;
margin: 40rpx auto 20rpx auto;
}
.examContent {
line-height: 50rpx;
margin-left: 80rpx;
view{
margin-bottom: 6rpx;
}
text {
font-weight: bold;
color:$u-type-warning-dark;
color:$theme-color;;
}
}
.tipsArea {
padding: 0 40rpx;
padding: 20rpx 40rpx;
margin-left: 0rpx;
margin-bottom: 30rpx;
border: 1px solid #2581e4;
border-radius: 20rpx;
font-size: 28rpx;
margin-top: 50rpx;
.tipsTitle{
font-weight: bold;
color: #2581e4;
}
}
ul {
margin: 0 30rpx;
line-height: 50rpx;
}
.start{
width: 50%;
font-size: 30rpx;
height: 110rpx;
line-height: 105rpx;
color: #ffffff;
border-color: #2581e4;
background-color: #2581e4;
border-radius: 10rpx;
text-align: center;
margin: auto;
}
</style>

View File

@ -1,11 +1,14 @@
<template>
<view>
<uni-list>
<uni-list-item v-for="item in list" :key="item.id" @click="goDetail(item.id)" :clickable="true" link style="padding: 10upx;">
<uni-list class="ulist">
<uni-list-item v-for="item in list" :key="item.id" @click="goDetail(item.id)" :clickable="true" link style="padding: 10upx;padding: 5px;
border-radius: 20rpx;
border: 1rpx solid #dddddd;margin-bottom: 20rpx;">
<!-- 自定义 body -->
<template slot="body" style="display: block;width: 100%;">
<view class="infoHead" style="">
<view>
<view class="blue_line"></view>
<text style="font-weight: bold;">{{item.exam_name}}</text>
<text v-if="item.name.indexOf('(补)') != -1">()</text>
</view>
@ -13,7 +16,7 @@
</view>
<view class="infoLine">
<span>耗时
<span style="color:#e47d25;">{{item.took_format}}</span>
<span style="color:#40991c;">{{item.took_format}}</span>
</span>
</view>
<view class="infoLine">
@ -37,7 +40,8 @@
return {
listQuery: {
page: 1,
page_size: 20
page_size: 20,
can_attend:true,
},
list: [],
loadingText: '加载中...'
@ -76,16 +80,23 @@
this.$u.api.examRecordDetail(id).then(res=>{
uni.hideLoading()
uni.setStorageSync('currentExam', res.data)
if (res.data.questions_.length>0){
if (res.data.questions_&&res.data.questions_.length>0){
uni.navigateTo({
url:'/pages/exam/detail?examrecord='+id
})
}
else{
uni.showToast({
title:'获取失败',
icon:'none'
})
uni.showModal({
title: '提示',
content: '考试未结束,请考试结束后再查看',
success: function (res) {
}
});
// uni.showToast({
// title:'考试未结束,请考试结束后再查看',
// icon:'none'
// })
return
}
}).catch(e=>{
@ -110,9 +121,23 @@
<style lang='scss'>
page {
background-color: $u-bg-color;
/* background-color: $u-bg-color; */
background-color: none;
}
.ulist{
width: 96%;
margin: 10rpx auto;
display: block;
}
.blue_line{
width: 18rpx;
height: 20rpx;
background: #2581e4;
display: inline-block;
margin-right: 6rpx;
}
.infoHead{
display: flex;
justify-content: space-between;
@ -135,4 +160,7 @@
text-align: center;
margin-top:20upx
}
.uni-list--border ,.uni-list--border-bottom{
display: none;
}
</style>

View File

@ -20,7 +20,7 @@
export default {
data() {
return {
imageSrcPass: '/static/exam/result.png',
imageSrcPass: '/static/exam/cross.png',
imageSrc: '/static/exam/error.png',
currentExam:{}
}
@ -48,7 +48,7 @@
},
backToHome(){
uni.reLaunch({
url:'/pages/exam/index'
url:'/pages/home/home'
})
}
},

View File

@ -2,7 +2,7 @@
<view>
<!-- <view :style="{background: 'url('+imageURL+')'}">
</view> -->
<view style="background-color: #2581e4;">
<view>
<u-image :src="imageURL" mode="widthFix"></u-image>
<view class="welcome">欢迎您{{vuex_user.name}}</view>
</view>
@ -11,7 +11,7 @@
:indicator-pos="indicatorPos" :mode="mode" :interval="3000" @click="click"></u-swiper> -->
<view style="margin: 12rpx;">
<u-grid :col="3" :border="false">
<u-grid :col="2" :border="false">
<u-grid-item v-for="(item, index) in grids" v-bind:key="index" @click="clickGrid(item)">
<u-icon :name="item.icon" color="#2b85e4" size="80"></u-icon>
<view class="grid-text">{{item.name}}</view>
@ -91,17 +91,17 @@
},
{
name: '考试',
icon: 'file-text',
icon: 'order',
path: '/pages/exam/exam',
},
{
name: '考试记录',
icon: 'file-text',
icon: 'list-dot',
path: '/pages/exam/record',
},
{
name: '证书查询',
icon: 'file-text',
icon: 'qzone-circle-fill',
path: '/pages/certificate/index',
}
],
@ -178,12 +178,17 @@
<style lang="scss" scoped>
.welcome{
background-color: #2581e4;
// font-weight: bold;
font-size: 24rpx;
font-size: 30rpx;
color:white;
padding-left:8rpx;
height: 50rpx;
line-height: 46rpx;
text-align: center;
height: 60rpx;
line-height: 58rpx;
border-radius: 10rpx;
width: 98%;
margin: auto;
}
.ugriditem{
}
.u-body-item-title {
font-size: 32rpx;

View File

@ -16,7 +16,7 @@
<!-- <button :style="[inputStyle]" class="getCaptcha">登录</button> -->
<!-- <u-gap height="0.5" bg-color="#bbb"></u-gap> -->
<view style="margin-top: 16rpx;">
<u-button @click="submit" type="warning">登录</u-button>
<u-button @click="submit" type="primary" style="background-color: #2581e4!important;">登录</u-button>
</view>
<view class="alternative">
<navigator url="login_password" class="password" open-type="navigate">密码登录</navigator>

View File

@ -14,7 +14,7 @@
</u-form-item>
</u-form>
<view style="margin-top: 16rpx;">
<u-button @click="submit" type="warning" >登录</u-button>
<u-button @click="submit" type="primary" >登录</u-button>
</view>
<view class="alternative">
<navigator url="login" class="password" open-type="navigate">验证码登录</navigator>

View File

@ -1,33 +1,24 @@
<template>
<view>
<!-- <u-navbar :is-back="false" title=" " :border-bottom="false">
<view class="u-flex u-row-right" style="width: 100%;">
<view class="camera u-flex u-row-center">
<u-icon name="camera-fill" color="#000000" size="48"></u-icon>
</view>
</view>
</u-navbar> -->
<vie style=" width: 100%;
height: 100px;
display: block;
background: #ffffff;"></vie>
<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
<view class="u-m-r-10">
<u-avatar :src="vuex_user.avatar" size="140"></u-avatar>
<view class="avatarContainer">
<img :src="vuex_user.avatar" class='avatar'>
</view>
<view class="u-flex-1">
<view class="u-font-18 u-p-b-20">{{vuex_user.name}}</view>
<view class="u-font-14 u-type-info">{{vuex_user.username}}-{{vuex_user.dept_name}}</view>
<view class="u-font-14 u-tips-color" v-if="vuex_user.wxmp_openid">已绑定微信</view>
<view class="u-font-18 u-p-b-20 u-p-t-20 userName">{{vuex_user.name}}</view>
<view class="u-font-14 u-type-info deptName">{{vuex_user.username}}-{{vuex_user.dept_name}}</view>
<!-- <view class="u-font-14 u-tips-color" v-if="vuex_user.wxmp_openid">已绑定微信</view> -->
</view>
<!-- <view class="u-m-l-10 u-p-10">
<u-icon name="scan" color="#969799" size="28"></u-icon>
</view>
<view class="u-m-l-10 u-p-10">
<u-icon name="arrow-right" color="#969799" size="28"></u-icon>
</view> -->
</view>
<view class="u-m-t-20">
<u-cell-group>
<view class="u-m-t-20 u-m-l-20 u-m-r-20" style="position: relative;top:-50px">
<u-cell-group style="border-radius: 20rpx;">
<u-cell-item icon="weixin-fill" title="绑定微信" :arrow="false" @click="bindMP" v-if="!vuex_user.wxmp_openid"></u-cell-item>
<u-cell-item icon="list-dot" title="考试记录" @click="examRecord"></u-cell-item>
<u-cell-item icon="close" title="退出" @click="Logout"></u-cell-item>
<u-cell-item icon="backspace" title="退出" @click="Logout"></u-cell-item>
</u-cell-group>
</view>
</view>
@ -53,7 +44,6 @@
});
}
)
},
bindMP(){
uni.login({
@ -93,7 +83,35 @@ page{
}
}
.user-box{
background-color: #fff;
// background-color: #2581e4;
// background-color: rgba(37,129,228,0.9);
background-image: linear-gradient(45deg, #2581e4, #253a54);
padding-top: 24rpx;
width: 94%;
margin: auto;
border-radius: 10rpx;
position: relative;
top: -110rpx;
padding-top:80rpx;
}
.avatarContainer{
width: 150rpx;
height: 150rpx;
border-radius: 75rpx;
position: absolute;
top: -32%;
left: 50%;
padding: 50rpx 10rpx;
background: #ffffff;
-webkit-transform: translate(-50%);
transform: translate(-50%);
}
.avatar{
width: 130rpx;
height: 67rpx;
}
.userName,.deptName{
color: #ffffff;
text-align: center;
}
</style>

View File

@ -32,7 +32,19 @@
export default {
data() {
return {
myinspecttaskList: [],
myinspecttaskList: [
{
state:'已完成',
name:'石静',
inspecttask_:{
name:'任务一',
start_date:'2024-05-20',
end_date:'2024-05-25',
},
members:[],
depts_count:3,
}
],
headstyle: {
"padding-top": "12rpx",
"padding-bottom": "12rpx"
@ -45,7 +57,16 @@
methods: {
getMyInspectTaskList() {
this.$u.api.getMyInspectTaskList({}).then(res => {
this.myinspecttaskList = res.data
this.myinspecttaskList = res.data;
if(res.data.length>0){}else{
uni.showModal({
title: '提示',
content: '您还没有巡查任务,请分配任务后查看',
success: function (res) {
uni.navigateBack(1)
}
});
}
}).catch(e => {})
},
taskClick(index) {

View File

@ -10,7 +10,7 @@ $u-light-color: #c0c4cc;
$u-border-color: #e4e7ed;
$u-bg-color: #f3f4f6;
$u-type-primary: #2979ff;
$u-type-primary: #2581e4;
$u-type-primary-light: #ecf5ff;
$u-type-primary-disabled: #a0cfff;
$u-type-primary-dark: #2b85e4;