SanHQin 10 miesięcy temu
rodzic
commit
efabae7e07

+ 4 - 0
src/App.vue

@@ -76,4 +76,8 @@ export default {
 .show {
   display: block !important;
 }
+
+.el-scrollbar .el-scrollbar__bar {
+  opacity: 1 !important;
+}
 </style>

+ 84 - 23
src/views/pocAiClassroom/doTask.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="doTask">
     <!-- <div class="dt_back" @click.stop="back()">返回</div> -->
-    <bar :num="1" @cutPage="back()">
+    <bar :num="1" @cutPage="back(1)">
       <template v-slot:title>
         <div class="dt_time" v-if="!isSubmit">
           <div class="dt_t_title">
@@ -974,6 +974,20 @@
         </div>
       </div>
     </van-popup>
+
+    <van-popup v-model="disabledShow2" round :close-on-click-overlay="false">
+      <div class="disabledShowBox">
+        <div class="dsb_top">
+          <div class="dsb_top_title">提示</div>
+          <div class="dsb_top_content">當前答題結果未保存,是否確認返回</div>
+        </div>
+        <div class="dsb_bottom2">
+          <span @click.stop="disabledShow2 = false">取消</span>
+          <span @click.stop="back(2)">确认</span>
+          <span @click.stop="saveAndBack()">保存并返回</span>
+        </div>
+      </div>
+    </van-popup>
   </div>
 </template>
 
@@ -989,6 +1003,8 @@ export default {
   data() {
     return {
       disabledShow: false,
+      disabledShow2: false,
+      isDoTaskCanShowDialog: false,
       showTaskIndex: 0,
       time: 0,
       time2: 0,
@@ -1028,7 +1044,7 @@ export default {
         'Y',
         'Z'
       ],
-      taskList: [ ],
+      taskList: [],
       taskMessage: {
         chapter: '第一章',
         grade: '小八',
@@ -1416,29 +1432,32 @@ export default {
           console.log('不结束练习')
         })
     },
-    saveTask() {
-      let _params = {
-        type: this.type,
-        userId: this.userId,
-        taskList: this.taskList,
-        showTaskIndex: this.showTaskIndex,
-        time: this.time + this.time2,
-        isSubmit: false
-      }
-
-      let _local = window.localStorage.getItem('pocTask') || JSON.stringify([])
+    saveTask(type=1) {
+      return new Promise(resolve => {
+        let _params = {
+          type: this.type,
+          userId: this.userId,
+          taskList: this.taskList,
+          showTaskIndex: this.showTaskIndex,
+          time: this.time + this.time2,
+          isSubmit: false
+        }
 
-      let _data = JSON.parse(_local)
+        let _local = window.localStorage.getItem('pocTask') || JSON.stringify([])
 
-      let _index = _data.findIndex(item => item.type == this.type && item.userId == this.userId)
-      if (_index != -1) {
-        _data[_index] = _params
-      } else {
-        _data.push(_params)
-      }
+        let _data = JSON.parse(_local)
 
-      window.localStorage.setItem('pocTask', JSON.stringify(_data))
-      this.$toast.success('保存成功')
+        let _index = _data.findIndex(item => item.type == this.type && item.userId == this.userId)
+        if (_index != -1) {
+          _data[_index] = _params
+        } else {
+          _data.push(_params)
+        }
+        this.isDoTaskCanShowDialog = false
+        window.localStorage.setItem('pocTask', JSON.stringify(_data))
+        if(type==1)this.$toast.success('保存成功')
+				resolve();
+      })
     },
     submitTask(type = 0) {
       if (!this.isDoAllTask && type == 0) {
@@ -1454,6 +1473,7 @@ export default {
           })
       } else {
         clearInterval(this.timer)
+        this.isDoTaskCanShowDialog = false //是否可以显示提交弹窗
         let _params = {
           type: this.type,
           userId: this.userId,
@@ -1478,10 +1498,18 @@ export default {
         this.sortTaskList()
       }
     },
-    back() {
+    back(type = 1) {
+      if (this.isDoTaskCanShowDialog && type == 1) {
+        return (this.disabledShow2 = true)
+      }
       this.$router.go(-1)
       // this.$router.push(`/pocAiClassroom`)
     },
+    saveAndBack() {
+      this.saveTask(2).then(_=>{
+				this.$router.go(-1)
+			})
+    },
     choseAnswer(_index) {
       const _type = typeof this.taskList[this.showTaskIndex].answer == 'object' ? 1 : 0
       if (_type == 0) {
@@ -1499,6 +1527,7 @@ export default {
           this.taskList[this.showTaskIndex].answer2.push(_index)
         }
       }
+      this.isDoTaskCanShowDialog = true
     },
     sortTaskList() {
       this.taskList.forEach(i => {
@@ -3413,6 +3442,38 @@ ${taskMsg}
   color: #fff !important;
 }
 
+.dsb_bottom2 {
+  width: 100%;
+  height: 60px;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  box-sizing: border-box;
+  padding: 10px 20px;
+}
+
+.dsb_bottom2 > span {
+  flex: 1;
+  height: 90%;
+  border-radius: 8px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 14px;
+  font-weight: bold;
+  background-color: #f0f2f5;
+  color: #3681fc;
+}
+
+.dsb_bottom2 > span:nth-child(2) {
+  margin: 0 10px;
+}
+
+.dsb_bottom2 > span:nth-child(3) {
+  background-color: #3681fc;
+  color: #fff !important;
+}
+
 .dt_is_top {
   width: 100%;
   height: calc(100% - 60px);

+ 7 - 5
src/views/pocAiClassroom/index.vue

@@ -698,7 +698,7 @@ export default {
 		},
 		getFirstEnterStatus(){
 			let data = window.localStorage.getItem('showDialog');
-			let first = window.localStorage.getItem('firstEnter');
+			let first = window.sessionStorage.getItem('firstEnter');
 			if(data){
 				data = JSON.parse(data)
 				if(data.type==1){
@@ -706,7 +706,8 @@ export default {
 					// 	return window.localStorage.removeItem('showDialog')
 					// };
 					let msg = `同學仔,歡迎返嚟!請問你想要繼續學習,定係想同我傾吓偈呢?`
-					if(first){
+					if(!first || first!=this.userId){
+						window.sessionStorage.setItem('firstEnter',this.userId)
 						let index = 0;
 						let timer = setInterval(()=>{
 							if(index<msg.length){
@@ -716,7 +717,7 @@ export default {
 								clearInterval(timer);
 								this.dialogMessage = msg
 								timer = null;
-								window.localStorage.removeItem('firstEnter')
+								
 							}
 						},200)
 					}else{
@@ -727,7 +728,8 @@ export default {
 				}else if(data.type==2){
 
 					let msg = `同學仔,歡迎返嚟!請問你想要繼續學習,定係想同我傾吓偈呢?`
-					if(first){
+					if(!first || first!=this.userId){
+						window.sessionStorage.setItem('firstEnter',this.userId)
 						let index = 0;
 						let timer = setInterval(()=>{
 							if(index<msg.length){
@@ -737,7 +739,7 @@ export default {
 								clearInterval(timer);
 								this.dialogMessage = msg
 								timer = null;
-								window.localStorage.removeItem('firstEnter')
+								
 							}
 						},200)
 					}else{

+ 17 - 10
src/views/pocAiClassroom/startIndex.vue

@@ -266,13 +266,16 @@
       </div>
       <div class="pa_or_bottom">
         <span>
-          <span v-for="(item, index) in openingRemarksMessage[0]" :key="0 + '-' + index" v-text="item"></span>
+          <span v-if="typeof openingRemarksMessage[0]=='object'" v-for="(item, index) in openingRemarksMessage[0]" :key="0 + '-' + index" v-text="item"></span>
+					<span v-if="typeof openingRemarksMessage[0]!='object'" v-text="openingRemarksMessage[0]"></span>
         </span>
         <span>
-          <span v-for="(item, index) in openingRemarksMessage[1]" :key="1 + '-' + index" v-text="item"></span>
+          <span v-if="typeof openingRemarksMessage[1]=='object'" v-for="(item, index) in openingRemarksMessage[1]" :key="1 + '-' + index" v-text="item"></span>
+					<span v-if="typeof openingRemarksMessage[1]!='object'" v-text="openingRemarksMessage[1]"></span>
         </span>
         <span>
-          <span v-for="(item, index) in openingRemarksMessage[2]" :key="2 + '-' + index" v-text="item"></span>
+          <span v-if="typeof openingRemarksMessage[2]=='object'" v-for="(item, index) in openingRemarksMessage[2]" :key="2 + '-' + index" v-text="item"></span>
+					<span v-if="typeof openingRemarksMessage[2]!='object'" v-text="openingRemarksMessage[2]"></span>
         </span>
       </div>
     </div>
@@ -804,18 +807,22 @@ export default {
     },
     openingRemarksAllFn() {
       if (!this.isAllOpeningRemarks) {
-        // this.isAllOpeningRemarks = true
-        // this.openingRemarksMessage = [
-        //   '👋📚 親愛嘅同學,哈囉!👋',
-        //   '我係你嘅專屬學習夥伴,希望能夠陪住你喺學習旅程中一齊進步。🚀🌟',
-        //   '我對好多知識都有認識📚,仲有唔會厭煩嘅耐心👀,無論你係想學嘢,定係需要啲情感支持💖或者生活建議🛠,我都好樂意做你嘅聆聽者同指導者,成為你嘅最佳拍檔🧚‍♂️。'
-        // ]
-				
+        this.isAllOpeningRemarks = true
+        this.openingRemarksMessage = [
+          '👋📚 親愛嘅同學,哈囉!👋',
+          '我係你嘅專屬學習夥伴,希望能夠陪住你喺學習旅程中一齊進步。🚀🌟',
+          '我對好多知識都有認識📚,仲有唔會厭煩嘅耐心👀,無論你係想學嘢,定係需要啲情感支持💖或者生活建議🛠,我都好樂意做你嘅聆聽者同指導者,成為你嘅最佳拍檔🧚‍♂️。'
+        ]
       } else {
 				if(this.userInfo.userId && this.userInfo.userId==this.userId){
 					window.localStorage.setItem('showDialog',JSON.stringify({type:2,time:new Date().getTime()}))
+<<<<<<< HEAD
 					if(this.$route.name=='pocStartIndex')this.$router.push('/pocAiClassroom');
 					return;
+=======
+					if(this.$route.name=='pocStartIndex')this.$router.push('/pocAiClassroom')
+					return 
+>>>>>>> master
 				}
         if (!this.showOpeningRemarks) return;
         this.showOpeningRemarks = false;