ソースを参照

refactor: 使用 JSON 傳遞參數

terry 3 ヶ月 前
コミット
8a38134c07

+ 5 - 2
TEAMModelOS/ClientApp/src/components/hiTeachSideMenu/syllabus/index.vue

@@ -1204,8 +1204,11 @@ export default {
     /* 编辑当前册别 */
     doEditVolume() {
       const path = '/home/' + (this.isSchool ? 'syllabus' : 'personalSyllabus');
-      // params={subjectIndex},{volumeIndex}
-      const query = `?params=${this.activeSubjectIndex},${this.activeVolumeIndex}`;
+      const params = {
+        subjectIndex: this.activeSubjectIndex,
+        volumeIndex: this.activeVolumeIndex
+      }
+      const query = `?params=${JSON.stringify(params)}`;
       callDesktopAppMethods.openExternal(path + query);
     },
     /* 删除当前册别 */

+ 1 - 1
TEAMModelOS/ClientApp/src/view/syllabus/Syllabus.vue

@@ -2890,7 +2890,7 @@ export default {
 
                  if (!this.isFirstLoadList && params) {
                      this.isFirstLoadList = true;
-                     let [subjectIndex, volumeIndex] = params.split(',');
+                     let { subjectIndex, volumeIndex } = JSON.parse(params);
 
                      subjectIndex = parseInt(subjectIndex) || 0;
                      volumeIndex = parseInt(volumeIndex) || 0;