Kaynağa Gözat

对接 答案回显

dusenyao 3 yıl önce
ebeveyn
işleme
ad4f4144ce

+ 65 - 47
package-lock.json

@@ -11,7 +11,7 @@
         "ailp-book-question-ui": "file:../ailp-book-question-ui-0.1.1.tgz",
         "awe-dnd": "^0.3.4",
         "axios": "^0.25.0",
-        "book-ui": "file:../book-ui-0.2.14.tgz",
+        "book-ui": "file:../book-ui-0.2.21.tgz",
         "core-js": "^3.20.3",
         "dayjs": "^1.10.7",
         "element-ui": "^2.15.6",
@@ -29,9 +29,9 @@
         "vuex": "^3.6.2"
       },
       "devDependencies": {
-        "@babel/core": "^7.16.7",
+        "@babel/core": "^7.16.12",
         "@babel/eslint-parser": "^7.16.5",
-        "@babel/preset-env": "^7.16.8",
+        "@babel/preset-env": "^7.16.11",
         "@rushstack/eslint-patch": "^1.1.0",
         "@vue/cli-plugin-babel": "~4.5.15",
         "@vue/cli-plugin-eslint": "~4.5.15",
@@ -52,7 +52,7 @@
         "postcss": "^8.4.5",
         "postcss-html": "^1.3.0",
         "prettier": "2.5.1",
-        "sass": "^1.48.0",
+        "sass": "^1.49.0",
         "sass-loader": "^10.2.0",
         "script-ext-html-webpack-plugin": "^2.1.5",
         "stylelint": "^14.0.1",
@@ -93,19 +93,20 @@
       }
     },
     "node_modules/@babel/core": {
-      "version": "7.16.7",
+      "version": "7.16.12",
+      "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.12.tgz",
+      "integrity": "sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg==",
       "dev": true,
-      "license": "MIT",
       "dependencies": {
         "@babel/code-frame": "^7.16.7",
-        "@babel/generator": "^7.16.7",
+        "@babel/generator": "^7.16.8",
         "@babel/helper-compilation-targets": "^7.16.7",
         "@babel/helper-module-transforms": "^7.16.7",
         "@babel/helpers": "^7.16.7",
-        "@babel/parser": "^7.16.7",
+        "@babel/parser": "^7.16.12",
         "@babel/template": "^7.16.7",
-        "@babel/traverse": "^7.16.7",
-        "@babel/types": "^7.16.7",
+        "@babel/traverse": "^7.16.10",
+        "@babel/types": "^7.16.8",
         "convert-source-map": "^1.7.0",
         "debug": "^4.1.0",
         "gensync": "^1.0.0-beta.2",
@@ -212,9 +213,10 @@
       }
     },
     "node_modules/@babel/helper-create-class-features-plugin": {
-      "version": "7.16.7",
+      "version": "7.16.10",
+      "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.10.tgz",
+      "integrity": "sha512-wDeej0pu3WN/ffTxMNCPW5UCiOav8IcLRxSIyp/9+IF2xJUM9h/OYjg0IJLHaL6F8oU8kqMz9nc1vryXhMsgXg==",
       "dev": true,
-      "license": "MIT",
       "dependencies": {
         "@babel/helper-annotate-as-pure": "^7.16.7",
         "@babel/helper-environment-visitor": "^7.16.7",
@@ -498,9 +500,10 @@
       }
     },
     "node_modules/@babel/parser": {
-      "version": "7.16.8",
+      "version": "7.16.12",
+      "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.12.tgz",
+      "integrity": "sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A==",
       "dev": true,
-      "license": "MIT",
       "bin": {
         "parser": "bin/babel-parser.js"
       },
@@ -741,11 +744,12 @@
       }
     },
     "node_modules/@babel/plugin-proposal-private-methods": {
-      "version": "7.16.7",
+      "version": "7.16.11",
+      "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.11.tgz",
+      "integrity": "sha512-F/2uAkPlXDr8+BHpZvo19w3hLFKge+k75XUprE6jaqKxjGkSYcK+4c+bup5PdW/7W/Rpjwql7FTVEDW+fRAQsw==",
       "dev": true,
-      "license": "MIT",
       "dependencies": {
-        "@babel/helper-create-class-features-plugin": "^7.16.7",
+        "@babel/helper-create-class-features-plugin": "^7.16.10",
         "@babel/helper-plugin-utils": "^7.16.7"
       },
       "engines": {
@@ -1494,9 +1498,10 @@
       }
     },
     "node_modules/@babel/preset-env": {
-      "version": "7.16.8",
+      "version": "7.16.11",
+      "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.11.tgz",
+      "integrity": "sha512-qcmWG8R7ZW6WBRPZK//y+E3Cli151B20W1Rv7ln27vuPaXU/8TKms6jFdiJtF7UDTxcrb7mZd88tAeK9LjdT8g==",
       "dev": true,
-      "license": "MIT",
       "dependencies": {
         "@babel/compat-data": "^7.16.8",
         "@babel/helper-compilation-targets": "^7.16.7",
@@ -1516,7 +1521,7 @@
         "@babel/plugin-proposal-object-rest-spread": "^7.16.7",
         "@babel/plugin-proposal-optional-catch-binding": "^7.16.7",
         "@babel/plugin-proposal-optional-chaining": "^7.16.7",
-        "@babel/plugin-proposal-private-methods": "^7.16.7",
+        "@babel/plugin-proposal-private-methods": "^7.16.11",
         "@babel/plugin-proposal-private-property-in-object": "^7.16.7",
         "@babel/plugin-proposal-unicode-property-regex": "^7.16.7",
         "@babel/plugin-syntax-async-generators": "^7.8.4",
@@ -1679,9 +1684,10 @@
       }
     },
     "node_modules/@babel/traverse": {
-      "version": "7.16.8",
+      "version": "7.16.10",
+      "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.10.tgz",
+      "integrity": "sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw==",
       "dev": true,
-      "license": "MIT",
       "dependencies": {
         "@babel/code-frame": "^7.16.7",
         "@babel/generator": "^7.16.8",
@@ -1689,7 +1695,7 @@
         "@babel/helper-function-name": "^7.16.7",
         "@babel/helper-hoist-variables": "^7.16.7",
         "@babel/helper-split-export-declaration": "^7.16.7",
-        "@babel/parser": "^7.16.8",
+        "@babel/parser": "^7.16.10",
         "@babel/types": "^7.16.8",
         "debug": "^4.1.0",
         "globals": "^11.1.0"
@@ -5482,9 +5488,9 @@
       "license": "MIT"
     },
     "node_modules/book-ui": {
-      "version": "0.2.14",
-      "resolved": "file:../book-ui-0.2.14.tgz",
-      "integrity": "sha512-6KHjmrdsmJertg+oV1DxAYCvhPL9AcwMuTouDnBq8mJxGH6ZoAww2MTZ/S4tO9P/JYVx7pEVtHrTVqm+XatZgw==",
+      "version": "0.2.21",
+      "resolved": "file:../book-ui-0.2.21.tgz",
+      "integrity": "sha512-JF9Q9D8amJKYtHwL9DMaEHAZ2QxSb6pZw+HBl+83y7KyJIkJvjuR2iDRZgOZmj49veJrm0ni7Jh4uOfM5EWeKQ==",
       "dependencies": {
         "awe-dnd": "^0.3.4",
         "axios": "^0.21.1",
@@ -18103,9 +18109,9 @@
       }
     },
     "node_modules/sass": {
-      "version": "1.48.0",
-      "resolved": "https://registry.npmjs.org/sass/-/sass-1.48.0.tgz",
-      "integrity": "sha512-hQi5g4DcfjcipotoHZ80l7GNJHGqQS5LwMBjVYB/TaT0vcSSpbgM8Ad7cgfsB2M0MinbkEQQPO9+sjjSiwxqmw==",
+      "version": "1.49.0",
+      "resolved": "https://registry.npmjs.org/sass/-/sass-1.49.0.tgz",
+      "integrity": "sha512-TVwVdNDj6p6b4QymJtNtRS2YtLJ/CqZriGg0eIAbAKMlN8Xy6kbv33FsEZSF7FufFFM705SQviHjjThfaQ4VNw==",
       "dev": true,
       "dependencies": {
         "chokidar": ">=3.0.0 <4.0.0",
@@ -22875,18 +22881,20 @@
       "dev": true
     },
     "@babel/core": {
-      "version": "7.16.7",
+      "version": "7.16.12",
+      "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.12.tgz",
+      "integrity": "sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg==",
       "dev": true,
       "requires": {
         "@babel/code-frame": "^7.16.7",
-        "@babel/generator": "^7.16.7",
+        "@babel/generator": "^7.16.8",
         "@babel/helper-compilation-targets": "^7.16.7",
         "@babel/helper-module-transforms": "^7.16.7",
         "@babel/helpers": "^7.16.7",
-        "@babel/parser": "^7.16.7",
+        "@babel/parser": "^7.16.12",
         "@babel/template": "^7.16.7",
-        "@babel/traverse": "^7.16.7",
-        "@babel/types": "^7.16.7",
+        "@babel/traverse": "^7.16.10",
+        "@babel/types": "^7.16.8",
         "convert-source-map": "^1.7.0",
         "debug": "^4.1.0",
         "gensync": "^1.0.0-beta.2",
@@ -22953,7 +22961,9 @@
       }
     },
     "@babel/helper-create-class-features-plugin": {
-      "version": "7.16.7",
+      "version": "7.16.10",
+      "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.10.tgz",
+      "integrity": "sha512-wDeej0pu3WN/ffTxMNCPW5UCiOav8IcLRxSIyp/9+IF2xJUM9h/OYjg0IJLHaL6F8oU8kqMz9nc1vryXhMsgXg==",
       "dev": true,
       "requires": {
         "@babel/helper-annotate-as-pure": "^7.16.7",
@@ -23141,7 +23151,9 @@
       }
     },
     "@babel/parser": {
-      "version": "7.16.8",
+      "version": "7.16.12",
+      "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.12.tgz",
+      "integrity": "sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A==",
       "dev": true
     },
     "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": {
@@ -23272,10 +23284,12 @@
       }
     },
     "@babel/plugin-proposal-private-methods": {
-      "version": "7.16.7",
+      "version": "7.16.11",
+      "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.11.tgz",
+      "integrity": "sha512-F/2uAkPlXDr8+BHpZvo19w3hLFKge+k75XUprE6jaqKxjGkSYcK+4c+bup5PdW/7W/Rpjwql7FTVEDW+fRAQsw==",
       "dev": true,
       "requires": {
-        "@babel/helper-create-class-features-plugin": "^7.16.7",
+        "@babel/helper-create-class-features-plugin": "^7.16.10",
         "@babel/helper-plugin-utils": "^7.16.7"
       }
     },
@@ -23686,7 +23700,9 @@
       }
     },
     "@babel/preset-env": {
-      "version": "7.16.8",
+      "version": "7.16.11",
+      "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.11.tgz",
+      "integrity": "sha512-qcmWG8R7ZW6WBRPZK//y+E3Cli151B20W1Rv7ln27vuPaXU/8TKms6jFdiJtF7UDTxcrb7mZd88tAeK9LjdT8g==",
       "dev": true,
       "requires": {
         "@babel/compat-data": "^7.16.8",
@@ -23707,7 +23723,7 @@
         "@babel/plugin-proposal-object-rest-spread": "^7.16.7",
         "@babel/plugin-proposal-optional-catch-binding": "^7.16.7",
         "@babel/plugin-proposal-optional-chaining": "^7.16.7",
-        "@babel/plugin-proposal-private-methods": "^7.16.7",
+        "@babel/plugin-proposal-private-methods": "^7.16.11",
         "@babel/plugin-proposal-private-property-in-object": "^7.16.7",
         "@babel/plugin-proposal-unicode-property-regex": "^7.16.7",
         "@babel/plugin-syntax-async-generators": "^7.8.4",
@@ -23839,7 +23855,9 @@
       }
     },
     "@babel/traverse": {
-      "version": "7.16.8",
+      "version": "7.16.10",
+      "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.10.tgz",
+      "integrity": "sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw==",
       "dev": true,
       "requires": {
         "@babel/code-frame": "^7.16.7",
@@ -23848,7 +23866,7 @@
         "@babel/helper-function-name": "^7.16.7",
         "@babel/helper-hoist-variables": "^7.16.7",
         "@babel/helper-split-export-declaration": "^7.16.7",
-        "@babel/parser": "^7.16.8",
+        "@babel/parser": "^7.16.10",
         "@babel/types": "^7.16.8",
         "debug": "^4.1.0",
         "globals": "^11.1.0"
@@ -26507,8 +26525,8 @@
       }
     },
     "book-ui": {
-      "version": "file:..\\book-ui-0.2.14.tgz",
-      "integrity": "sha512-6KHjmrdsmJertg+oV1DxAYCvhPL9AcwMuTouDnBq8mJxGH6ZoAww2MTZ/S4tO9P/JYVx7pEVtHrTVqm+XatZgw==",
+      "version": "file:..\\book-ui-0.2.21.tgz",
+      "integrity": "sha512-JF9Q9D8amJKYtHwL9DMaEHAZ2QxSb6pZw+HBl+83y7KyJIkJvjuR2iDRZgOZmj49veJrm0ni7Jh4uOfM5EWeKQ==",
       "requires": {
         "awe-dnd": "^0.3.4",
         "axios": "^0.21.1",
@@ -34975,9 +34993,9 @@
       }
     },
     "sass": {
-      "version": "1.48.0",
-      "resolved": "https://registry.npmjs.org/sass/-/sass-1.48.0.tgz",
-      "integrity": "sha512-hQi5g4DcfjcipotoHZ80l7GNJHGqQS5LwMBjVYB/TaT0vcSSpbgM8Ad7cgfsB2M0MinbkEQQPO9+sjjSiwxqmw==",
+      "version": "1.49.0",
+      "resolved": "https://registry.npmjs.org/sass/-/sass-1.49.0.tgz",
+      "integrity": "sha512-TVwVdNDj6p6b4QymJtNtRS2YtLJ/CqZriGg0eIAbAKMlN8Xy6kbv33FsEZSF7FufFFM705SQviHjjThfaQ4VNw==",
       "dev": true,
       "requires": {
         "chokidar": ">=3.0.0 <4.0.0",

+ 4 - 4
package.json

@@ -16,7 +16,7 @@
     "ailp-book-question-ui": "file:../ailp-book-question-ui-0.1.1.tgz",
     "awe-dnd": "^0.3.4",
     "axios": "^0.25.0",
-    "book-ui": "file:../book-ui-0.2.14.tgz",
+    "book-ui": "file:../book-ui-0.2.21.tgz",
     "core-js": "^3.20.3",
     "dayjs": "^1.10.7",
     "element-ui": "^2.15.6",
@@ -34,9 +34,9 @@
     "vuex": "^3.6.2"
   },
   "devDependencies": {
-    "@babel/core": "^7.16.7",
+    "@babel/core": "^7.16.12",
     "@babel/eslint-parser": "^7.16.5",
-    "@babel/preset-env": "^7.16.8",
+    "@babel/preset-env": "^7.16.11",
     "@rushstack/eslint-patch": "^1.1.0",
     "@vue/cli-plugin-babel": "~4.5.15",
     "@vue/cli-plugin-eslint": "~4.5.15",
@@ -57,7 +57,7 @@
     "postcss": "^8.4.5",
     "postcss-html": "^1.3.0",
     "prettier": "2.5.1",
-    "sass": "^1.48.0",
+    "sass": "^1.49.0",
     "sass-loader": "^10.2.0",
     "script-ext-html-webpack-plugin": "^2.1.5",
     "stylelint": "^14.0.1",

+ 8 - 1
src/components/course/CompletionView.vue

@@ -24,7 +24,14 @@
       <bookailp v-if="dialogVisible" :context="context" :ui-type="ui_type" :preview-width="800" :preview-height="450" />
     </template>
     <template v-else-if="category === 'NPC'">
-      <booknpc v-if="context" ref="previewAnswer" :context="context" :theme-color="themeColor" />
+      <booknpc
+        v-if="context"
+        :context="context"
+        task-model="ANSWER"
+        :is-show-save="false"
+        :book-answer-content="bookAnswerContent"
+        :theme-color="themeColor"
+      />
     </template>
     <template v-if="category == 'NNPE'">
       <booknnpe v-if="context" :context="context" :theme-color="themeColor" />

+ 31 - 3
src/components/course/FinishCourseware.vue

@@ -24,14 +24,21 @@
     />
 
     <template v-else-if="category === 'NPC'">
-      <booknpc v-if="context" ref="previewAnswer" :context="context" :theme-color="themeColor" />
+      <booknpc
+        v-if="context"
+        :is-show-save="true"
+        task-model=""
+        :context="context"
+        :theme-color="themeColor"
+        @finishTaskMaterial="saveNPCAnswer"
+      />
     </template>
 
     <template v-if="category == 'NNPE'">
       <booknnpe v-if="context" :context="context" :theme-color="themeColor" />
     </template>
 
-    <div slot="footer">
+    <div v-if="category !== 'NPC'" slot="footer">
       <el-button type="primary" @click="finishTaskMaterial">
         {{ $t('Key82') }}
       </el-button>
@@ -120,8 +127,29 @@ export default {
     });
   },
   methods: {
+    saveNPCAnswer(content) {
+      const loading = this.$loading();
+      FinishMyTaskMaterial_Student({
+        task_id: this.id,
+        material_type: 'COURSEWARE',
+        material_id: this.coursewareId,
+        exam_answer: {
+          content
+        }
+      })
+        .then(() => {
+          this.$message.success(this.$i18n.t('Key334'));
+          this.dialogClose();
+          this.$router.go(0);
+        })
+        .finally(() => {
+          loading.close();
+          this.exam_answer = '';
+        });
+    },
+
     finishTaskMaterial() {
-      if (this.exam_answer.length === 0 && this.sys_type === 'GCLS') {
+      if (this.exam_answer.length === 0 && this.category === 'GCLS') {
         this.$message.warning(this.$i18n.t('Key333'));
         return;
       }

+ 34 - 5
src/components/live/CurMaterial.vue

@@ -48,7 +48,15 @@
         />
       </template>
       <template v-else-if="category === 'NPC'">
-        <booknpc v-if="context" ref="previewAnswer" :context="context" :theme-color="themeColor" />
+        <booknpc
+          v-if="context"
+          :task-model="isFinished ? 'ANSWER' : ''"
+          :is-show-save="!isFinished"
+          :book-answer-content="bookAnswerContent"
+          :context="context"
+          :theme-color="themeColor"
+          @finishTaskMaterial="saveNPCAnswer"
+        />
       </template>
       <template v-if="category == 'NNPE'">
         <booknnpe v-if="context" :context="context" :theme-color="themeColor" />
@@ -88,9 +96,9 @@
 
     <div slot="footer">
       <el-button
-        v-if="isCurMaterial || (!isFinished && material_type === 'COURSEWARE')"
+        v-if="category !== 'NPC' && (isCurMaterial || (!isFinished && material_type === 'COURSEWARE'))"
         type="primary"
-        @click="finishMyMaterial"
+        @click="finishTaskMaterial"
       >
         {{ $t('Key82') }}
       </el-button>
@@ -351,8 +359,29 @@ export default {
       this.exam_answer = data;
     },
 
-    finishMyMaterial() {
-      if (this.material_type === 'COURSEWARE' && this.exam_answer.length === 0 && this.sys_type === 'GCLS') {
+    saveNPCAnswer(content) {
+      const loading = this.$loading();
+      FinishMyMaterial({
+        task_id: this.id,
+        material_type: 'COURSEWARE',
+        material_id: this.coursewareId,
+        exam_answer: {
+          content
+        }
+      })
+        .then(() => {
+          this.$message.success(this.$i18n.t('Key334'));
+          this.dialogClose();
+          this.$router.go(0);
+        })
+        .finally(() => {
+          loading.close();
+          this.exam_answer = '';
+        });
+    },
+
+    finishTaskMaterial() {
+      if (this.material_type === 'COURSEWARE' && this.exam_answer.length === 0 && this.category === 'GCLS') {
         this.$message.warning(this.$i18n.t('Key333'));
         return;
       }

+ 1 - 1
src/components/select/SelectCourse.vue

@@ -28,7 +28,7 @@
         </template>
 
         <template v-else-if="category === 'NPC'">
-          <booknpc v-if="context" ref="previewAnswer" :context="context" :theme-color="themeColor" />
+          <booknpc v-if="context" :context="context" task-model="" :is-show-save="false" :theme-color="themeColor" />
         </template>
 
         <template v-if="category == 'NNPE'">

+ 8 - 1
src/views/live/teacher/CompleteList.vue

@@ -64,7 +64,14 @@
           <bookailp :context="context" :ui-type="ui_type" :preview-width="800" :preview-height="450" />
         </template>
         <template v-else-if="category === 'NPC'">
-          <booknpc v-if="context" ref="previewAnswer" :theme-color="themeColor" :context="context" />
+          <booknpc
+            v-if="context"
+            task-model="ANSWER"
+            :is-show-save="false"
+            :book-answer-content="bookAnswerContent"
+            :context="context"
+            :theme-color="themeColor"
+          />
         </template>
         <template v-if="category == 'NNPE'">
           <booknnpe v-if="context" :context="context" :theme-color="themeColor" />

+ 1 - 1
src/views/task_details/ShowCourseware.vue

@@ -17,7 +17,7 @@
         />
       </template>
       <template v-else-if="category === 'NPC'">
-        <booknpc v-if="context" ref="previewAnswer" :context="context" :theme-color="themeColor" />
+        <booknpc v-if="context" :is-show-save="false" :context="context" :theme-color="themeColor" />
       </template>
       <template v-if="category == 'NNPE'">
         <booknnpe v-if="context" :context="context" :theme-color="themeColor" />