|
@@ -1,231 +1,273 @@
|
|
|
<template>
|
|
|
- <div class="bank-container" ref="bankContainer">
|
|
|
- <div class="back-to-top flex-col-center" :title="$t('evaluation.backToTop')" @click="onBackToTop">
|
|
|
- <Icon type="ios-arrow-up" />
|
|
|
- </div>
|
|
|
- <Tabs :value="tabName" name="listTab" @on-click="onTabClick" :animated="false">
|
|
|
- <TabPane :label="$t('evaluation.index.item')" name="exercise" tab="listTab">
|
|
|
- <ExerciseList ref="exList" @toggleChange="onToggleChange"></ExerciseList>
|
|
|
- </TabPane>
|
|
|
- <TabPane :label="$t('evaluation.index.paper')" name="paper" tab="listTab">
|
|
|
- <PaperList ref="paperList" @onPaperClick="isShowBackList = true" @onBackToTop="onBackToTop"></PaperList>
|
|
|
- </TabPane>
|
|
|
- </Tabs>
|
|
|
- <div class="ev-list-operation">
|
|
|
- <div class="import-exercise common-save-btn">
|
|
|
- <div class="ev-list-paper-tools" style="display: flex;" v-show="currentTab === 'paper' ">
|
|
|
- <span @click="onShowPaperList" class="bank-tools-btn" v-if="isShowBackList">
|
|
|
- <Icon type="md-arrow-back" size="16" />
|
|
|
- <span>{{ $t('evaluation.index.backList') }}</span>
|
|
|
- </span>
|
|
|
- <span @click="onEditPaper" class="bank-tools-btn" v-if="isShowBackList">
|
|
|
- <Icon type="ios-create" size="16" />
|
|
|
- <span>{{ $t('evaluation.paperList.editPaper')}}</span>
|
|
|
- </span>
|
|
|
- <div style="display: flex;" v-show="($access.can('admin.*||exercise-upd') || !isSchool)">
|
|
|
- <span @click="goCreatePaper('auto')" class="bank-tools-btn">
|
|
|
- <Icon type="md-cube" size="16" />
|
|
|
- <span>{{ $t('evaluation.index.autoCreate') }}</span>
|
|
|
- </span>
|
|
|
- <span @click="goCreatePaper('manual')" class="bank-tools-btn">
|
|
|
- <Icon type="md-hand" size="16" />
|
|
|
- <span>{{ $t('evaluation.index.manualCreate') }}</span>
|
|
|
- </span>
|
|
|
- <!-- <span @click="goCreatePaper('import')" class="bank-tools-btn">
|
|
|
+ <div class="bank-container" ref="bankContainer">
|
|
|
+ <div class="back-to-top flex-col-center" :title="$t('evaluation.backToTop')" @click="onBackToTop">
|
|
|
+ <Icon type="ios-arrow-up" />
|
|
|
+ </div>
|
|
|
+ <Tabs :value="tabName" name="listTab" @on-click="onTabClick" :animated="false">
|
|
|
+ <TabPane :label="$t('evaluation.index.item')" name="exercise" tab="listTab">
|
|
|
+ <ExerciseList ref="exList" @toggleChange="onToggleChange"></ExerciseList>
|
|
|
+ </TabPane>
|
|
|
+ <TabPane :label="$t('evaluation.index.paper')" name="paper" tab="listTab">
|
|
|
+ <PaperList ref="paperList" @onPaperClick="isShowBackList = true" @onBackToTop="onBackToTop"></PaperList>
|
|
|
+ </TabPane>
|
|
|
+ </Tabs>
|
|
|
+ <div class="ev-list-operation">
|
|
|
+ <div class="import-exercise common-save-btn">
|
|
|
+ <div class="ev-list-paper-tools" style="display: flex;" v-show="currentTab === 'paper' ">
|
|
|
+ <span @click="onShowPaperList" class="bank-tools-btn" v-if="isShowBackList">
|
|
|
+ <Icon type="md-arrow-back" size="16" />
|
|
|
+ <span>{{ $t('evaluation.index.backList') }}</span>
|
|
|
+ </span>
|
|
|
+ <span @click="onEditPaper" class="bank-tools-btn" v-if="isShowBackList">
|
|
|
+ <Icon type="ios-create" size="16" />
|
|
|
+ <span>{{ $t('evaluation.paperList.editPaper')}}</span>
|
|
|
+ </span>
|
|
|
+ <div style="display: flex;" v-show="($access.can('admin.*||exercise-upd') || !isSchool)">
|
|
|
+ <span @click="goCreatePaper('auto')" class="bank-tools-btn">
|
|
|
+ <Icon type="md-cube" size="16" />
|
|
|
+ <span>{{ $t('evaluation.index.autoCreate') }}</span>
|
|
|
+ </span>
|
|
|
+ <span @click="goCreatePaper('manual')" class="bank-tools-btn">
|
|
|
+ <Icon type="md-hand" size="16" />
|
|
|
+ <span>{{ $t('evaluation.index.manualCreate') }}</span>
|
|
|
+ </span>
|
|
|
+ <!-- <span @click="goCreatePaper('import')" class="bank-tools-btn">
|
|
|
<Icon type="md-folder" size="16"/>
|
|
|
<span>{{ $t('evaluation.index.importCreate') }}</span>
|
|
|
<Tooltip :content="$t('tip.importPaper')" class="common-toolTip" placement="bottom-end" theme="light" max-width="200">
|
|
|
<Icon type="ios-information-circle-outline"/>
|
|
|
</Tooltip>
|
|
|
</span> -->
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <span @click="goCreateExercise"
|
|
|
- v-show="currentTab === 'exercise' && ($access.can('admin.*||exercise-upd') || !isSchool)"
|
|
|
- class="bank-tools-btn">
|
|
|
- <Icon type="md-add" size="16" />
|
|
|
- <span
|
|
|
- style="display: inline-block;margin-bottom: 2px;">{{ $t('evaluation.index.addExercise') }}</span>
|
|
|
- </span>
|
|
|
- <span @click="goCreatePaper('import',true)" class="bank-tools-btn" v-show="$access.can('admin.*||exercise-upd') || !isSchool">
|
|
|
- <Icon type="md-folder" size="16" />
|
|
|
- <span>{{ $t('evaluation.index.importCreate') }}</span>
|
|
|
- </span>
|
|
|
- <span @click="goShare" class="bank-tools-btn" v-show="$access.can('admin.*||exercise-upd')">
|
|
|
- <Icon type="ios-redo" size="16"/>
|
|
|
- <span>{{ $t('evaluation.share.shareResource') }}</span>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <span @click="goCreateExercise" v-show="currentTab === 'exercise' && ($access.can('admin.*||exercise-upd') || !isSchool)" class="bank-tools-btn">
|
|
|
+ <Icon type="md-add" size="16" />
|
|
|
+ <span style="display: inline-block;margin-bottom: 2px;">{{ $t('evaluation.index.addExercise') }}</span>
|
|
|
+ </span>
|
|
|
+ <span @click="goCreatePaper('import',true)" class="bank-tools-btn" v-show="$access.can('admin.*||exercise-upd') || !isSchool">
|
|
|
+ <Icon type="md-folder" size="16" />
|
|
|
+ <span>{{ $t('evaluation.index.importCreate') }}</span>
|
|
|
+ </span>
|
|
|
+ <span @click="goShare" class="bank-tools-btn" v-show="$access.can('admin.*||exercise-upd')">
|
|
|
+ <Icon type="ios-redo" size="16" />
|
|
|
+ <span>{{ $t('evaluation.share.shareResource') }}</span>
|
|
|
+ </span>
|
|
|
+ <span @click="doXkwAuth" class="bank-tools-btn" v-if="isTestSite">
|
|
|
+ <Icon type="ios-send" size="16" />
|
|
|
+ <span>学科网</span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
|
|
|
- import BaseImport from '../components/BaseImport'
|
|
|
- import PaperList from './TestPaperList'
|
|
|
- import ExerciseList from './ExerciseList'
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- PaperList,
|
|
|
- ExerciseList,
|
|
|
- BaseImport
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- isLoading: true,
|
|
|
- tabName: 'exercise',
|
|
|
- currentTab: 'exercise',
|
|
|
- isAllOpen: false,
|
|
|
- isShowBackList: false,
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- onBackToTop() {
|
|
|
- this.$refs.bankContainer.scrollIntoView()
|
|
|
- },
|
|
|
- onTabClick(val) {
|
|
|
- this.currentTab = val
|
|
|
- this.onBackToTop()
|
|
|
- },
|
|
|
- /* 展示试卷列表 */
|
|
|
- onShowPaperList() {
|
|
|
- this.$refs.paperList.isPreview = false
|
|
|
- this.$refs.paperList.isShowSheet = false
|
|
|
- this.isShowBackList = false
|
|
|
- this.$refs.bankContainer.scrollIntoView()
|
|
|
- },
|
|
|
- /* 编辑当前预览的试卷 */
|
|
|
- onEditPaper(){
|
|
|
- this.$refs.paperList.goToPaper(this.$refs.paperList.curPaper)
|
|
|
- },
|
|
|
+import BaseImport from '../components/BaseImport'
|
|
|
+import PaperList from './TestPaperList'
|
|
|
+import ExerciseList from './ExerciseList'
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ PaperList,
|
|
|
+ ExerciseList,
|
|
|
+ BaseImport
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isLoading: true,
|
|
|
+ tabName: 'exercise',
|
|
|
+ currentTab: 'exercise',
|
|
|
+ isAllOpen: false,
|
|
|
+ isShowBackList: false,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onBackToTop() {
|
|
|
+ this.$refs.bankContainer.scrollIntoView()
|
|
|
+ },
|
|
|
+ onTabClick(val) {
|
|
|
+ this.currentTab = val
|
|
|
+ this.onBackToTop()
|
|
|
+ },
|
|
|
+ /* 展示试卷列表 */
|
|
|
+ onShowPaperList() {
|
|
|
+ this.$refs.paperList.isPreview = false
|
|
|
+ this.$refs.paperList.isShowSheet = false
|
|
|
+ this.isShowBackList = false
|
|
|
+ this.$refs.bankContainer.scrollIntoView()
|
|
|
+ },
|
|
|
+ /* 编辑当前预览的试卷 */
|
|
|
+ onEditPaper() {
|
|
|
+ this.$refs.paperList.goToPaper(this.$refs.paperList.curPaper)
|
|
|
+ },
|
|
|
|
|
|
- /** 切换全部展开与折叠 */
|
|
|
- onHandleToggle() {
|
|
|
- this.$refs.exList.onHandleToggle(this.isAllOpen)
|
|
|
- this.isAllOpen = !this.isAllOpen
|
|
|
- },
|
|
|
-
|
|
|
- /* 跳转到分享页面 */
|
|
|
- goShare(){
|
|
|
- this.$router.push({
|
|
|
- name: 'shareCenter',
|
|
|
- params: {
|
|
|
- tabName: this.currentTab
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ /** 切换全部展开与折叠 */
|
|
|
+ onHandleToggle() {
|
|
|
+ this.$refs.exList.onHandleToggle(this.isAllOpen)
|
|
|
+ this.isAllOpen = !this.isAllOpen
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * exList的collapseList变化
|
|
|
- * @param list
|
|
|
- */
|
|
|
- onToggleChange(list) {
|
|
|
- this.isAllOpen = list.length !== 0
|
|
|
- },
|
|
|
+ /* 跳转到分享页面 */
|
|
|
+ goShare() {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'shareCenter',
|
|
|
+ params: {
|
|
|
+ tabName: this.currentTab
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 确认是否允许携带手机号进行注册 */
|
|
|
+ doConfirmAgree() {
|
|
|
+ return new Promise((r, j) => {
|
|
|
+ this.$Modal.confirm({
|
|
|
+ title: '授权提示',
|
|
|
+ content: '检测到您暂未绑定学科网账号,是否允许以醍摩豆云平台关联手机号进行认证?',
|
|
|
+ okText: '允许',
|
|
|
+ cancelText: '拒绝',
|
|
|
+ onOk: () => {
|
|
|
+ r(1)
|
|
|
+ },
|
|
|
+ onCancel: () => {
|
|
|
+ r(0)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- /** 返回创建试题页面 */
|
|
|
- goCreateExercise() {
|
|
|
- this.$router.push({
|
|
|
- name: this.$route.name === 'personalBank' ? 'newPrivateExercise' : 'newSchoolExercise',
|
|
|
- params: {
|
|
|
- scope: this.$route.name === 'personalBank' ? 'private' : 'school'
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ /* 跳转学科网 */
|
|
|
+ doXkwAuth() {
|
|
|
+ this.$api.auth.checkBind({}).then(async res => {
|
|
|
+ // 判断是否已经绑定学科网
|
|
|
+ let isBind = res.auth.find(i => i.type === 'xkw')
|
|
|
+ // 如果没有绑定 则询问用户是否允许携带手机号进行注册
|
|
|
+ let agree = isBind ? 1 : await this.doConfirmAgree()
|
|
|
+ // 判断资源类型
|
|
|
+ let module = this.currentTab === 'exercise' ? 'item' : 'paper'
|
|
|
+ // 存到本地
|
|
|
+ localStorage.setItem('xkw_module', module)
|
|
|
+ // 发送授权请求
|
|
|
+ this.$api.auth.xkwOauth({
|
|
|
+ module: module,
|
|
|
+ agree: agree
|
|
|
+ }).then(res => {
|
|
|
+ window.open(res.redirect)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- /** 前往组卷页面 */
|
|
|
- goCreatePaper(type) {
|
|
|
- this.$router.push({
|
|
|
- name: this.$route.name === 'personalBank' ? 'newPrivatePaper' : 'newSchoolPaper',
|
|
|
- params: {
|
|
|
- scope: this.$route.name === 'personalBank' ? 'private' : 'school',
|
|
|
- type: type,
|
|
|
- isFromItemBank: this.currentTab === 'exercise'
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * exList的collapseList变化
|
|
|
+ * @param list
|
|
|
+ */
|
|
|
+ onToggleChange(list) {
|
|
|
+ this.isAllOpen = list.length !== 0
|
|
|
+ },
|
|
|
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- let parentVm = this.$parent.$parent.$parent
|
|
|
- parentVm.$refs['evScroll'].scrollTo({
|
|
|
- y: 0
|
|
|
- },
|
|
|
- 500, 'easeInQuad'
|
|
|
- )
|
|
|
+ /** 返回创建试题页面 */
|
|
|
+ goCreateExercise() {
|
|
|
+ this.$router.push({
|
|
|
+ name: this.$route.name === 'personalBank' ? 'newPrivateExercise' : 'newSchoolExercise',
|
|
|
+ params: {
|
|
|
+ scope: this.$route.name === 'personalBank' ? 'private' : 'school'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- if (this.$route.params.tabName) {
|
|
|
- this.currentTab = this.$route.params.tabName
|
|
|
- this.tabName = this.$route.params.tabName
|
|
|
- }
|
|
|
+ /** 前往组卷页面 */
|
|
|
+ goCreatePaper(type) {
|
|
|
+ this.$router.push({
|
|
|
+ name: this.$route.name === 'personalBank' ? 'newPrivatePaper' : 'newSchoolPaper',
|
|
|
+ params: {
|
|
|
+ scope: this.$route.name === 'personalBank' ? 'private' : 'school',
|
|
|
+ type: type,
|
|
|
+ isFromItemBank: this.currentTab === 'exercise'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- if (this.$route.name === 'schoolBank') {
|
|
|
- this.$EventBus.$emit('showSchoolBank', true)
|
|
|
- } else {
|
|
|
- this.$EventBus.$emit('showSchoolBank', false)
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- isSchool() {
|
|
|
- return this.$route.name === "schoolBank";
|
|
|
- },
|
|
|
- paperScrollTop() {
|
|
|
- return this.$store.state.totalAnalysis.paperScrollTop
|
|
|
- },
|
|
|
- },
|
|
|
- // beforeRouteEnter(to, from, next) {
|
|
|
- // if(from.name !== 'answerSheet'){
|
|
|
- // to.meta.isKeep = false
|
|
|
- // }else{
|
|
|
- // // console.error('进入题库收到的',to.meta.isKeep)
|
|
|
- // to.meta.isKeep = true
|
|
|
- // }
|
|
|
- // next();
|
|
|
- // },
|
|
|
- // beforeRouteLeave(to, from, next) {
|
|
|
- // if(to.name === 'newSchoolPaper' || to.name === 'newPrivatePaper'){
|
|
|
- // // 设置下一个路由的 meta
|
|
|
- // to.meta.isKeep = false; // 让 A 缓存,即不刷新
|
|
|
- // }
|
|
|
- // if(to.name === 'answerSheet'){
|
|
|
- // from.meta.isKeep = true
|
|
|
- // }
|
|
|
- // next();
|
|
|
- // },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ let parentVm = this.$parent.$parent.$parent
|
|
|
+ parentVm.$refs['evScroll'].scrollTo({
|
|
|
+ y: 0
|
|
|
+ },
|
|
|
+ 500, 'easeInQuad'
|
|
|
+ )
|
|
|
+
|
|
|
+ if (this.$route.params.tabName) {
|
|
|
+ this.currentTab = this.$route.params.tabName
|
|
|
+ this.tabName = this.$route.params.tabName
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.$route.name === 'schoolBank') {
|
|
|
+ this.$EventBus.$emit('showSchoolBank', true)
|
|
|
+ } else {
|
|
|
+ this.$EventBus.$emit('showSchoolBank', false)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ isSchool() {
|
|
|
+ return this.$route.name === "schoolBank";
|
|
|
+ },
|
|
|
+ paperScrollTop() {
|
|
|
+ return this.$store.state.totalAnalysis.paperScrollTop
|
|
|
+ },
|
|
|
+ isTestSite(){
|
|
|
+ return window.location.host === 'test.teammodel.cn'
|
|
|
}
|
|
|
+ },
|
|
|
+ // beforeRouteEnter(to, from, next) {
|
|
|
+ // if(from.name !== 'answerSheet'){
|
|
|
+ // to.meta.isKeep = false
|
|
|
+ // }else{
|
|
|
+ // // console.error('进入题库收到的',to.meta.isKeep)
|
|
|
+ // to.meta.isKeep = true
|
|
|
+ // }
|
|
|
+ // next();
|
|
|
+ // },
|
|
|
+ // beforeRouteLeave(to, from, next) {
|
|
|
+ // if(to.name === 'newSchoolPaper' || to.name === 'newPrivatePaper'){
|
|
|
+ // // 设置下一个路由的 meta
|
|
|
+ // to.meta.isKeep = false; // 让 A 缓存,即不刷新
|
|
|
+ // }
|
|
|
+ // if(to.name === 'answerSheet'){
|
|
|
+ // from.meta.isKeep = true
|
|
|
+ // }
|
|
|
+ // next();
|
|
|
+ // },
|
|
|
+}
|
|
|
</script>
|
|
|
<style src="./index.less" lang="less" scoped></style>
|
|
|
<style>
|
|
|
- .bank-container .ivu-tabs {
|
|
|
- overflow: unset;
|
|
|
- }
|
|
|
+.bank-container .ivu-tabs {
|
|
|
+ overflow: unset;
|
|
|
+}
|
|
|
|
|
|
- .bank-container .ivu-tabs-bar {
|
|
|
- position: sticky;
|
|
|
- top: 0;
|
|
|
- padding: 8px 15px;
|
|
|
- z-index: 99;
|
|
|
- background-color: var(--body-bg);
|
|
|
- margin-bottom: 15px;
|
|
|
- }
|
|
|
+.bank-container .ivu-tabs-bar {
|
|
|
+ position: sticky;
|
|
|
+ top: 0;
|
|
|
+ padding: 8px 15px;
|
|
|
+ z-index: 99;
|
|
|
+ background-color: var(--body-bg);
|
|
|
+ margin-bottom: 15px;
|
|
|
+}
|
|
|
|
|
|
- .bank-container .ivu-tabs-nav .ivu-tabs-tab:active,
|
|
|
- .bank-container .ivu-tabs-nav .ivu-tabs-tab-active,
|
|
|
- .bank-container .ivu-tabs-nav .ivu-tabs-tab {
|
|
|
- color: var(--second-text-color);
|
|
|
- /* font-weight: bold; */
|
|
|
- font-size: 14px;
|
|
|
- }
|
|
|
+.bank-container .ivu-tabs-nav .ivu-tabs-tab:active,
|
|
|
+.bank-container .ivu-tabs-nav .ivu-tabs-tab-active,
|
|
|
+.bank-container .ivu-tabs-nav .ivu-tabs-tab {
|
|
|
+ color: var(--second-text-color);
|
|
|
+ /* font-weight: bold; */
|
|
|
+ font-size: 14px;
|
|
|
+}
|
|
|
|
|
|
- .bank-container .ivu-tabs-nav .ivu-tabs-tab-active {
|
|
|
- color: var(--tabs-text-color);
|
|
|
- font-weight: bold;
|
|
|
- }
|
|
|
+.bank-container .ivu-tabs-nav .ivu-tabs-tab-active {
|
|
|
+ color: var(--tabs-text-color);
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
|
|
|
- .bank-container .ivu-tabs-ink-bar {
|
|
|
- height: 2px;
|
|
|
- background: var(--tabs-bottom-color);
|
|
|
- /*margin-left:20px;*/
|
|
|
- }
|
|
|
+.bank-container .ivu-tabs-ink-bar {
|
|
|
+ height: 2px;
|
|
|
+ background: var(--tabs-bottom-color);
|
|
|
+ /*margin-left:20px;*/
|
|
|
+}
|
|
|
</style>
|