Selaa lähdekoodia

百分号错误,未修改直接返回,不弹窗

yuanyiming 1 vuosi sitten
vanhempi
commit
1c6ffdcd40
2 muutettua tiedostoa jossa 82 lisäystä ja 43 poistoa
  1. 3 3
      src/views/eva/studentDetail.vue
  2. 79 40
      src/views/eva/studentEvaluate.vue

+ 3 - 3
src/views/eva/studentDetail.vue

@@ -230,7 +230,7 @@ export default {
 
       selectStudentDetail(data).then(res => {
         this.studentInfo = res[0][0]
-        console.log('获取学生信息', this.studentInfo)
+        // console.log('获取学生信息', this.studentInfo)
       })
 
       // 获取所有学生记录总条数
@@ -304,7 +304,7 @@ export default {
         //   e.name=text
         //   e.id=value
         // }
-        console.log('filtrate', this.filtrate)
+        // console.log('filtrate', this.filtrate)
       })
     },
 
@@ -336,7 +336,7 @@ export default {
     selTerm() {
       this.termList = []
       selectTerm().then(res => {
-        console.log('获取学期筛选框', res[0])
+        // console.log('获取学期筛选框', res[0])
         res[0].forEach(e => {
           if (e.defaultC === 1) {
             this.termData = e.id

+ 79 - 40
src/views/eva/studentEvaluate.vue

@@ -312,8 +312,10 @@ export default {
       selectWData: [],
       // 学期
       termData: [],
+      termDataCopy: '',
       // 格式化后记录时间
       visitTime: '',
+      visitTimeCopy: '',
       // 地点
       place: '',
       placeId: 1,
@@ -415,6 +417,7 @@ export default {
           // console.log(e)
           if (e.defaultC === 1) {
             this.termData.push(e.id)
+            this.termDataCopy = e.id
           }
         })
         this.termList = res[0]
@@ -511,8 +514,31 @@ export default {
     repetitionSave(e) {
       if (this.selectWData.length === 0) return (this.wei = true)
 
+      let con = this.isModify()
+
+      if (con) {
+        this.noSave()
+        this.shareShow = 0
+        this.col()
+
+        // this.AddNewRecord()
+        return
+      }
+      this.addNewShowMask = 1
+      return
+      // this.addNewShowMask = 1
+
+      // this.repMaskNum = e
+      // this.repShowMask = true
+    },
+    // 判断是否更改信息
+
+    isModify() {
+      let isOk = 1
+
       if (this.shareShow) {
-        let isOk = 1
+        // 修改页面返回判断
+
         let conVal = []
         let imgVal = []
         let typeVal = []
@@ -528,57 +554,67 @@ export default {
 
         if (!this.arraysAreEqual(this.selectSData, conVal)) {
           isOk = 0
-          console.log(isOk)
         }
         if (!(this.termData[0] === this.oldRecordData.term)) {
           isOk = 0
-          console.log(isOk)
         }
         if (!this.arraysAreEqual(this.selectWData, typeVal)) {
           isOk = 0
-          console.log(isOk)
         }
         if (!(this.visitTime === this.oldRecordData.recordDate)) {
           isOk = 0
-          console.log(isOk)
         }
         if (!(this.place === this.oldRecordData.place)) {
           isOk = 0
-          console.log(isOk)
         }
         if (!(this.placeId === this.oldRecordData.placeId)) {
           isOk = 0
-          console.log(isOk)
         }
         if (!(this.observeCon === this.oldRecordData.recordTit)) {
           isOk = 0
-          console.log(isOk)
         }
         if (!(this.recordCon === this.oldRecordData.recordContent)) {
           isOk = 0
-          console.log(isOk)
         }
         if (!this.arraysAreEqual(this.imgList, imgVal)) {
           isOk = 0
-          console.log(isOk)
         }
-        if (isOk) {
-          this.noSave()
-          this.shareShow = 0
-          this.col()
-
-          // this.AddNewRecord()
-          return
+      } else {
+        // 发布页面返回判断
+        if (this.selectSData.length) {
+          isOk = 0
+        }
+        if (!(this.termData[0] === this.termDataCopy)) {
+          isOk = 0
+        }
+        if (this.selectWData.length) {
+          isOk = 0
+        }
+        if (this.visitTime !== this.visitTimeCopy) {
+          isOk = 0
+        }
+        if (this.place !== '') {
+          isOk = 0
+        }
+        if (this.placeId * 1 !== 1) {
+          isOk = 0
+        }
+        if (this.observeCon !== '') {
+          isOk = 0
+        }
+        if (this.recordCon !== '') {
+          isOk = 0
+        }
+        if (this.imgList.length) {
+          isOk = 0
         }
-        this.addNewShowMask = 1
-        return
-        // this.repMaskNum = e
-        // this.repShowMask = true
       }
-      this.addNewShowMask = 1
 
-      // this.repMaskNum = e
-      // this.repShowMask = true
+      if (!isOk) {
+        return false
+      } else {
+        return true
+      }
     },
     arraysAreEqual(arr1, arr2) {
       return JSON.stringify(arr1) === JSON.stringify(arr2)
@@ -629,10 +665,6 @@ export default {
         this.wei = true
         isOk = 1
       }
-      // if (this.visitTime === '') {
-      //   this.tim = true
-      //   isOk = 1
-      // }
       if (isOk === 1) return
 
       this.isShowMask = true
@@ -722,9 +754,9 @@ export default {
           contact: this.selectSData.join(','),
           type: this.selectWData.join(','),
           timing: this.visitTime,
-          place: this.place,
-          observeCon: this.observeCon,
-          recordCon: this.recordCon,
+          place: encodeURIComponent(this.place),
+          observeCon: encodeURIComponent(this.observeCon),
+          recordCon: encodeURIComponent(this.recordCon),
           imgList: this.imgList.join(','),
           term: this.termData[0],
           pid: this.placeId
@@ -772,9 +804,9 @@ export default {
           contact: this.selectSData.join(','),
           type: this.selectWData.join(','),
           timing: this.visitTime,
-          place: this.place,
-          observeCon: this.observeCon,
-          recordCon: this.recordCon,
+          place: encodeURIComponent(this.place),
+          observeCon: encodeURIComponent(this.observeCon),
+          recordCon: encodeURIComponent(this.recordCon),
           imgList: this.imgList.join(','),
           term: this.termData[0],
           pid: this.placeId
@@ -815,9 +847,9 @@ export default {
           contact: this.selectSData.join(','),
           type: this.selectWData.join(','),
           timing: this.visitTime,
-          place: this.place,
-          observeCon: this.observeCon,
-          recordCon: this.recordCon,
+          place: encodeURIComponent(this.place),
+          observeCon: encodeURIComponent(this.observeCon),
+          recordCon: encodeURIComponent(this.recordCon),
           imgList: this.imgList.join(','),
           term: this.termData[0],
           pid: this.placeId
@@ -854,7 +886,7 @@ export default {
       }
       // console.log('getRecord', this.$route.query.rid)
       selectRecordDetail(data).then(res => {
-        console.log('获取单个学生记录详情', res[0][0])
+        // console.log('获取单个学生记录详情', res[0][0])
         this.oldRecordData = res[0][0]
         const allData = res[0][0]
         if (allData.contact !== '') {
@@ -864,7 +896,7 @@ export default {
           this.selectWData = allData.type.split(',')
         }
 
-        console.log('this.selectSData', this.selectSData)
+        // console.log('this.selectSData', this.selectSData)
 
         this.studentInfo.name = allData.name
         this.studentInfo.cname = allData.cname
@@ -912,11 +944,18 @@ export default {
 
       // console.log(year, month, day, hours, minutes)
       this.visitTime = `${year}-${month}-${day} ${hours}:${minutes}`
+      this.visitTimeCopy = `${year}-${month}-${day} ${hours}:${minutes}`
+
       // console.log(this.visitTime)
     },
     SaveBack() {
       // console.log('好好好')
-      this.backShowMask = true
+      const con = this.isModify()
+      if (!con) {
+        this.backShowMask = true
+      } else {
+        this.$router.go(-1)
+      }
     },
     confirmBack() {
       this.$router.go(-1)