| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- <!-- 文档资源 -->
- <template>
- <view class="docResource-component">
- <view class="card">
- <view class="card-header">
- <view class="header-left">
- <view class="card-title">实验室安全素养资源</view>
- </view>
- </view>
- <view class="card-body">
- <view class="top-table-box">
- <view @click="checkTable(index)"
- :class="topCheckIndex == index ? 'check-table-p':''"
- v-for="(item,index) in tableList" :key="index">
- {{item.disciplineName}}
- </view>
- </view>
- <view class="card-title-box">
- <view>学习资料</view>
- <view @click="goPage(1)">查看更多</view>
- </view>
- <view class="card-for-list-box">
- <view class="card-for-box" @click="goPage(2,item)"
- v-for="(item,index) in topList" :key="index">
- <view class="for-left-box">📄</view>
- <view class="for-center-box">
- <view>{{ item.coursewareName }}</view>
- <view>{{ item.materialType == 4?'文章':item.attachmentType.substring(1) }}</view>
- </view>
- <view class="for-right-box">{{secondsToMinutes(item.minLearningDuration)}}分钟</view>
- </view>
- <view class="null-p" v-if="!topList[0]">暂无资料</view>
- </view>
- <view class="card-title-box">
- <view>题库</view>
- <view @click="goPage(3)">查看更多</view>
- </view>
- <view class="card-for-list-box-2">
- <view class="card-for-box" @click="goPage(4,item)"
- v-for="(item,index) in bottomList" :key="index">
- <view class="for-left-box">📖</view>
- <view class="for-right-box">
- <view>{{item.knowledgePointName}}</view>
- <view>{{item.questionCount}} 题</view>
- </view>
- </view>
- <view class="null-p" v-if="!bottomList[0]">暂无资料</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- examElDisciplineTypeList,
- examUserCoursewareLearningList,
- examElQuestionBankGroupByKnowledgePoint,
- examUserCoursewareLearningRestart,
- } from '@/pages_safetyEducationExamination/api/index.js'
- export default {
- // components: {
- // workbench,
- // },
- data() {
- return {
- topCheckIndex:0,
- tableList:[],
- topList:[],
- bottomList:[],
- }
- },
- created() {
-
- },
- mounted() {
- // this.examElDisciplineTypeList();
- },
- methods: {
- resetMethod(){
- this.$set(this,'topCheckIndex',0);
- this.examElDisciplineTypeList();
- },
- goPage(type,item){
- if(type == 1){
- //文章列表
- uni.navigateTo({
- url: '/pages_safetyEducationExamination/views/study/index?pageType=2'
- });
- }else if(type == 2){
- //学习文章
- if(item.learnStatus == 2){
- uni.showModal({
- title: '提示',
- content: `该课件已学完,是否重置进度重新学习?`,
- success: async (res) => {
- if (res.confirm) {
- await this.examUserCoursewareLearningRestart(item.coursewareId);
- }
- }
- });
- }else{
- uni.navigateTo({
- url: `/pages_safetyEducationExamination/views/webViewPage/coursewareLearning?coursewareId=${item.coursewareId}`,
- });
- }
- }else if(type == 3){
- //知识点刷题列表(带学科类型参数)
- uni.navigateTo({
- url: `/pages_safetyEducationExamination/views/practice/index?disciplineTypeId=${this.tableList[this.topCheckIndex].id}`
- });
- }else if(type == 4){
- //知识点指向题库(带知识点+学科类型参数)
- uni.navigateTo({
- url: `/pages_safetyEducationExamination/views/practice/index?knowledgePointId=${item.knowledgePointId}&disciplineTypeId=${this.tableList[this.topCheckIndex].id}`
- });
- }
- },
- //重新开始学习课件
- async examUserCoursewareLearningRestart(coursewareId) {
- try {
- const { data } = await examUserCoursewareLearningRestart({coursewareId:coursewareId});
- if (data.code === 200) {
- uni.navigateTo({
- url: `/pages_safetyEducationExamination/views/webViewPage/coursewareLearning?coursewareId=${coursewareId}`,
- });
- }
- } catch (e) { console.error('重新开始学习课件失败', e); }
- },
- //选项卡切换
- checkTable(index){
- if(this.topCheckIndex!=index){
- this.$set(this,'topCheckIndex',index);
- this.examUserCoursewareLearningList();
- this.examElQuestionBankGroupByKnowledgePoint();
- }
- },
- async examElDisciplineTypeList() {
- try {
- const { data } = await examElDisciplineTypeList({});
- if (data.code === 200) {
- this.$set(this, 'tableList', data.data)
- this.examUserCoursewareLearningList();
- this.examElQuestionBankGroupByKnowledgePoint();
- }
- } catch (e) { console.error('获取考试任务失败', e); }
- },
- async examUserCoursewareLearningList() {
- try {
- let obj = {
- page:1,
- pageSize:3,
- materialType:2,
- disciplineTypeId:this.tableList[this.topCheckIndex].id,
- }
- const { data } = await examUserCoursewareLearningList(obj);
- if (data.code === 200) {
- this.$set(this, 'topList', data.data.records)
- }
- } catch (e) { console.error('获取文章失败', e); }
- },
- async examElQuestionBankGroupByKnowledgePoint() {
- try {
- let obj = {
- page:1,
- pageSize:2,
- disciplineTypeId:this.tableList[this.topCheckIndex].id,
- }
- const { data } = await examElQuestionBankGroupByKnowledgePoint(obj);
- if (data.code === 200) {
- this.$set(this, 'bottomList', data.data.records)
- }
- } catch (e) { console.error('获取知识点题库失败', e); }
- },
- //换算分钟
- secondsToMinutes(totalSeconds) {
- if (typeof totalSeconds !== 'number' || totalSeconds <= 0) {
- return 1;
- }
- return Math.ceil(totalSeconds / 60);
- },
- },
-
- }
- </script>
- <style lang="stylus" scoped>
- .docResource-component {
- margin: 0 32rpx 32rpx;
- .card {
- background: #fff;
- border-radius: 24rpx;
- overflow: hidden;
- margin-bottom: 24rpx;
- box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
- border: 1px solid #dde3ed;
- }
-
- .card-header {
- padding: 20rpx 28rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- .card-title {
- font-size: 28rpx;
- color: #333;
- }
- .header-subtitle{
- margin-top:10rpx;
- font-size:22rpx;
- color:#8896a7;
- }
- .header-link {
- font-size: 24rpx;
- color: #1857d4;
- }
- }
- .card-body{
- padding-bottom:30rpx;
- .top-table-box{
- padding:0 28rpx;
- display: flex;
- view{
- flex:1;
- text-align: center;
- line-height:50rpx;
- padding:0 10rpx;
- font-size:24rpx;
- border-bottom:4rpx solid #dedede;
- }
- .check-table-p{
- font-weight:600;
- color:#1857d4;
- border-bottom: 4rpx solid #1857d4;
- }
- }
- .card-title-box{
- display: flex;
- padding:0 28rpx 0;
- margin-top:10rpx;
- view{
- height:80rpx;
- line-height:80rpx;
- }
- view:nth-child(1){
- font-size:24rpx;
- flex:1;
- }
- view:nth-child(2){
- font-size:22rpx;
- color:#1857d4;
- }
- }
- .card-for-list-box{
- .null-p{
- text-align: center;
- color:#999;
- font-size:24rpx;
- line-height:100rpx;
- }
- .card-for-box:nth-child(1){
- margin-top:0;
- }
- .card-for-box{
- margin:20rpx 28rpx;
- padding: 20rpx 16rpx;
- background-color: #f4f6fa;
- border-radius: 12rpx;
- display: flex;
- .for-left-box{
- width:50rpx;
- font-size:30rpx;
- line-height:56rpx;
- text-align: center;
- margin-right:10rpx;
- }
- .for-center-box{
- flex:1;
- height:56rpx;
- view:nth-child(1){
- font-size:24rpx;
- line-height:24rpx;
- margin-bottom:10rpx;
- }
- view:nth-child(2){
- font-size:22rpx;
- line-height:22rpx;
- color:#8896a7;
- }
- }
- .for-right-box{
- font-size:24rpx;
- line-height:56rpx;
- color:#8896a7;
- margin-right:15rpx;
- }
- }
- }
- .card-for-list-box-2{
- padding:0 28rpx;
- .null-p{
- text-align: center;
- color:#999;
- font-size:24rpx;
- line-height:100rpx;
- }
- .card-for-box:nth-child(even) {
- margin-left:20rpx;
- }
- .card-for-box{
- width:264rpx;
- padding: 20rpx;
- border-radius: 12rpx;
- background-color: #f4f6fa;
- margin-bottom:20rpx;
- display: inline-block;
- .for-left-box{
- width:60rpx;
- font-size:40rpx;
- line-height:56rpx;
- text-align: center;
- margin-right:20rpx;
- display: inline-block;
- overflow: hidden;
- margin-top:5rpx;
- }
- .for-right-box{
- display: inline-block;
- height:56rpx;
- view:nth-child(1){
- font-size:24rpx;
- line-height:24rpx;
- margin-bottom:10rpx;
- width:180rpx;
- display:block;
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- }
- view:nth-child(2){
- font-size:22rpx;
- line-height:22rpx;
- color:#8896a7;
- }
- }
- }
- }
- }
- }
- </style>
|