Procházet zdrojové kódy

学生选科信息

shilipojs před 2 roky
rodič
revize
8e22acb98e

+ 19 - 22
src/views/elective/select/components/elective-esign-dialog.vue → src/components/MxDialog/ElectiveSign.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <!-- 做使用el-dialog做签字的弹框 -->
-    <el-dialog title="签字" v-if="dialogVisible" :visible.sync="dialogVisible" width="800px" append-to-body>
+    <el-dialog title="签字" :visible.sync="show" width="800px"  destroy-on-close >
       <!-- 使用这个签名组件 -->
       <vue-esign
         ref="esign"
@@ -26,7 +26,7 @@
         <div>
           <el-button @click="handleGenerate" type="primary">保存</el-button>
           <el-button @click="handleReset">清空画板</el-button>
-          <el-button @click="dialogVisible = false">取消</el-button>
+          <el-button @click="show = false">取消</el-button>
         </div>
       </span>
     </el-dialog>
@@ -36,11 +36,10 @@
 import { submitElectiveModels } from '@/api/webApi/elective/selected-subject'
 
 export default {
-  name: 'elective-esign-dialog',
-  props: ['generation'],
+  // props: ['generation'],
   data() {
     return {
-      dialogVisible: false, // 弹框是否开启
+      show: false, // 弹框是否开启
       lineWidth: 3, // 画笔的线条粗细
       lineColor: '#000000', // 画笔的颜色
       bgColor: '', // 画布的背景颜色
@@ -56,32 +55,31 @@ export default {
     }
   },
   methods: {
-    open() {
-      this.dialogVisible = true
-    },
     // 清空画板
     handleReset() {
       this.$refs.esign.reset()
     },
-    saveElective() {
-      submitElectiveModels({
-        models: this.generation.activeModel.selectedList,
-        esign:this.base64Img
-      }).then(res => {
-        if (res.code == 200) {
-          this.dialogVisible = false
-          this.$message.success('报名成功')
-          this.refreshData()
-        }
-      })
-    },
+    // saveElective() {
+    //   submitElectiveModels({
+    //     models: this.generation.activeModel.selectedList,
+    //     esign:this.base64Img
+    //   }).then(res => {
+    //     if (res.code == 200) {
+    //       this.dialogVisible = false
+    //       this.$message.success('报名成功')
+    //       this.refreshData()
+    //     }
+    //   })
+    // },
     // 生成签字图
     handleGenerate() {
       this.$refs.esign
         .generate() // 使用生成器调用把签字的图片转换成为base64图片格式
         .then((res) => {
           this.base64Img = res
-          this.saveElective()
+          // this.saveElective()
+          this.show = false
+          this.success()
           // 在这里向后端发请求把转换后的base64文件传给后端,后端接收以后再转换成图片做静态图片存储
           // 当然也可以把base64转成流文件blob格式的,类似上传给后端这样,具体哪种方式看后端要求
         })
@@ -93,7 +91,6 @@ export default {
           })
           return
         })
-      this.dialogVisible = true
     }
   }
 }

+ 7 - 1
src/components/MxDialog/index.js

@@ -1,9 +1,11 @@
 import Vue from 'vue';
 import DispatchMaster from './DispatchMaster';  // 班主任分班
 import DispatchStudent from './DispatchStudent';  // 学生分班
+import ElectiveSign from './ElectiveSign';  // 签名
 
 const DispatchMasterController = Vue.extend(DispatchMaster);  // 发送班主任分班
 const DispatchStudentController = Vue.extend(DispatchStudent);  // 发送学生分班
+const ElectiveSignController = Vue.extend(ElectiveSign);  // 学生签名
 
 let instance;
 
@@ -19,6 +21,11 @@ function initInstance(type) {
         el: document.createElement('div'),
       })
       break
+    case 'ElectiveSign':
+      instance = new ElectiveSignController({
+        el: document.createElement('div'),
+      })
+      break
   }
   // 标识已被挂载过一次
   instance.constrctType = type
@@ -30,7 +37,6 @@ export default (type,options,callback) => {
     console.log('挂载')
     initInstance(type); // 挂载
   }
-  console.log(1111111)
   Object.assign(instance, options);
   // 实例化后newInstance就是一个对象了,所以data内的数据会
   // 挂载到this下,传入一个对象与之合并

+ 21 - 9
src/views/career/bigdataSelectCourse/personalDivideClass.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
     <el-card class="box-card" >
       <div slot="header" class="clearfix text-center f20 pb10 pt10" >
-        凤凰中学2021级分班信息 张九一同学
+        {{ title }}
       </div>
       <div>
         <p class="mb10">
@@ -12,7 +12,7 @@
         <div v-if="isSign && isShow">
           <el-alert
             class="mb5"
-            title="通知:张九一同学您的新班级信息于2022年6月18日0点生效"
+            :title="`通知:${$store.getters.nickName}同学您的新班级信息于2022年6月18日0点生效`"
             type="info"
             :closable="false"
             show-icon>
@@ -29,11 +29,7 @@
 </template>
 
 <script>
-import store from '@/store/getters'
  export default {
-    mixins:[
-      store
-    ],
    data(){
      return{
        isSign:false,
@@ -42,7 +38,7 @@ import store from '@/store/getters'
          {
            year: 2021,
            group: '物化生',
-           name: '张九一',
+           name: this.$store.getters.nickName,
            oldClass: '2101',
            newClass: '2105',
          }
@@ -70,6 +66,14 @@ import store from '@/store/getters'
        }
      }
    },
+   computed:{
+      title(){
+        const store  = this.$store.getters
+        if(!store) return  ''
+        console.log(store)
+        return `${store.school.schoolName}${store.firstClassName}级分班信息  ${store.nickName}同学`
+     }
+   },
    methods: {
      showDispatchInfo() {
        if(!this.isSign){
@@ -80,8 +84,16 @@ import store from '@/store/getters'
 
      },
      toSign() {
-       this.isSign = true
-       this.$message.success('已完成签名')
+       // 签字
+       if(this.isSign) return
+       this.$Dialog('ElectiveSign',{},() => {
+          this.$message.success('已完成签名')
+          this.isSign = true
+       })
+       // if(!this.isSign) {
+       //   this.isSign = true
+       //   this.$message.success('已完成签名')
+       // }
      }
    }
  }

+ 1 - 1
src/views/elective/select/components/elective-table.vue

@@ -51,7 +51,7 @@ import ElectivePreferenceInfo from '@/views/elective/select/components/elective-
 import ElectivePreferenceReject from '@/views/elective/select/components/elective-preference-reject'
 import ElectivePreferenceCommand from '@/views/elective/select/components/elective-preference-command'
 import ElectiveAiAnalysisDialog from '@/views/elective/select/components/elective-ai-analysis-dialog'
-import ElectiveEsignDialog from '@/views/elective/select/components/elective-esign-dialog'
+import ElectiveEsignDialog from '@/components/MxDialog/ElectiveSign'
 import ElectiveMajorThumbnail from '@/views/elective/select/components/elective-major-thumbnail'
 import ElectiveMajorCollege from '@/views/elective/select/components/elective-major-college'
 import ElectivePreferenceBatch from '@/views/elective/select/components/elective-preference-batch'