gemercheung 2 年 前
コミット
af69f4ca66

+ 99 - 64
packages/qjkankan-editor/src/framework/EditorHead.vue

@@ -101,47 +101,49 @@ export default {
       if (!this.checkParams()) {
         return;
       }
-      this.fixData();
-      this.info.scenes = this.info.scenes.map((item) => {
-        if (typeof item.someData == "string") {
-          item.someData = item.someData.replace(hhhreg, "");
-        }
-        return item;
-      });
-      $waiting.show();
+      const isFixData = this.fixData();
+      if (isFixData) {
+        this.info.scenes = this.info.scenes.map((item) => {
+          if (typeof item.someData == "string") {
+            item.someData = item.someData.replace(hhhreg, "");
+          }
+          return item;
+        });
+        $waiting.show();
 
-      saveWorks(
-        {
-          password: this.info.password,
-          someData: { ...this.info, status: 1 },
-        },
-        () => {
-          this.$msg.success(this.$i18n.t("gather.save_done"));
-          document.title = this.info.name;
-          // this.getInfo().then((res) => {
-          //   // getInfo里调用了后端接口,底层用了jquery的网络请求方法,为啥会导致promise嵌套没有展平,res拿到的不是promise 对象的resolve值而是promise对象本身????
-          //   res.then(() => {
-          //     this.$store.commit("UpdateIsShowState", true);
-          //     $waiting.hide()
-          //     setTimeout(() => {
-          //       if (this.info.scenes.length <= 0 && this.isShow) {
-          //         return this.$alert({
-          //           content: this.$i18n.t('gather.at_least_one_scene'),
-          //         });
-          //       }
-          //       this.showPreview = true;
-          //     }, 500);
-          //   })
-          // });
-          $waiting.hide();
-          if (this.info.scenes.length <= 0 && this.isShow) {
-            return this.$alert({
-              content: this.$i18n.t("gather.at_least_one_scene"),
-            });
+        saveWorks(
+          {
+            password: this.info.password,
+            someData: { ...this.info, status: 1 },
+          },
+          () => {
+            this.$msg.success(this.$i18n.t("gather.save_done"));
+            document.title = this.info.name;
+            // this.getInfo().then((res) => {
+            //   // getInfo里调用了后端接口,底层用了jquery的网络请求方法,为啥会导致promise嵌套没有展平,res拿到的不是promise 对象的resolve值而是promise对象本身????
+            //   res.then(() => {
+            //     this.$store.commit("UpdateIsShowState", true);
+            //     $waiting.hide()
+            //     setTimeout(() => {
+            //       if (this.info.scenes.length <= 0 && this.isShow) {
+            //         return this.$alert({
+            //           content: this.$i18n.t('gather.at_least_one_scene'),
+            //         });
+            //       }
+            //       this.showPreview = true;
+            //     }, 500);
+            //   })
+            // });
+            $waiting.hide();
+            if (this.info.scenes.length <= 0 && this.isShow) {
+              return this.$alert({
+                content: this.$i18n.t("gather.at_least_one_scene"),
+              });
+            }
+            this.showPreview = true;
           }
-          this.showPreview = true;
-        }
-      );
+        );
+      }
     },
 
     fixData() {
@@ -167,7 +169,39 @@ export default {
           }
         });
       }
-
+      //开场校验
+      if (this.info.coverInfo.isShowCover === 1) {
+        if (this.info.coverInfo.coverSelect === "videoAndImg") {
+          if (
+            this.info.coverInfo.coverPc === "" ||
+            this.info.coverInfo.coverMo === "" ||
+            this.info.coverInfo.videoPc === "" ||
+            this.info.coverInfo.videoMo === ""
+          ) {
+            this.$msg.warning(this.$i18n.t("gather.converinfo_no_valid"));
+            return false;
+          }
+        }
+        if (this.info.coverInfo.coverSelect === "video") {
+          if (
+            this.info.coverInfo.videoPc === "" ||
+            this.info.coverInfo.videoMo === ""
+          ) {
+            this.$msg.warning(this.$i18n.t("gather.converinfo_no_valid"));
+            return false;
+          }
+        }
+        if (this.info.coverInfo.coverSelect === "img") {
+          if (
+            this.info.coverInfo.coverPc === "" ||
+            this.info.coverInfo.coverMo === ""
+          ) {
+            this.$msg.warning(this.$i18n.t("gather.converinfo_no_valid"));
+            return false;
+          }
+        }
+      }
+      return true;
       // this.lockHotspotResourceTree();
       // fodderId:[] 资源引用给后端
     },
@@ -209,31 +243,32 @@ export default {
       if (!this.checkParams()) {
         return;
       }
-      this.fixData();
-
-      this.info.scenes = this.info.scenes.map((item) => {
-        if (typeof item.someData == "string") {
-          item.someData = item.someData.replace(hhhreg, "");
-        }
-        return item;
-      });
-      $waiting.show();
+      const isFixData = this.fixData();
+      if (isFixData) {
+        this.info.scenes = this.info.scenes.map((item) => {
+          if (typeof item.someData == "string") {
+            item.someData = item.someData.replace(hhhreg, "");
+          }
+          return item;
+        });
+        $waiting.show();
 
-      saveWorks(
-        {
-          password: this.info.password,
-          someData: { ...this.info, status: 1 },
-        },
-        () => {
-          this.$msg.success(this.$i18n.t("gather.save_done"));
-          document.title = this.info.name;
-          $waiting.hide();
-          // this.getInfo();
-          // this.$store.commit("UpdateIsShowState", true);
-          this.$store.commit("TakeInfoSnapShotAtSave");
-        },
-        () => {}
-      );
+        saveWorks(
+          {
+            password: this.info.password,
+            someData: { ...this.info, status: 1 },
+          },
+          () => {
+            this.$msg.success(this.$i18n.t("gather.save_done"));
+            document.title = this.info.name;
+            $waiting.hide();
+            // this.getInfo();
+            // this.$store.commit("UpdateIsShowState", true);
+            this.$store.commit("TakeInfoSnapShotAtSave");
+          },
+          () => {}
+        );
+      }
     },
     getInfo() {
       return checkLogin().then((res) => {

+ 2 - 3
packages/qjkankan-editor/src/lang/_en.json

@@ -645,11 +645,10 @@
     "nothing_edit": "You haven't created any content yet",
     "at_least_one_scene": "At least one scene can be previewed. Please go to \"Scene Navigation\" to add",
     "exitVr": "Exit VR",
-
     "dir": "目录",
     "root_dir": "根目录",
-
-    "no_more_data": "没有更多数据了"
+    "no_more_data": "没有更多数据了",
+    "converinfo_no_valid": "请将开场封面内容填写完整!"
   },
   "personal_center": {
     "personal_center": "Personal Center",

+ 60 - 74
packages/qjkankan-editor/src/lang/_zh.json

@@ -551,19 +551,19 @@
       "delete_work": "删除作品",
       "comfirm_delete": "确定要删除作品吗?"
     },
-    "components":{
-      "prev":"上一张",
-      "next":"下一张",
-      "zoom_in":"放大",
-      "zoom_out":"缩小",
-      "delete":"删除",
-      "fullscreen":"全屏",
-      "cancel_fullscreen":"取消全屏",
-      "pano_setting":"全景图封面设置",
-      "drag_to_cut":"拖动画面截取封面",
-      "cutting":"截图",
-      "preview_cover":"封面预览",
-      "rename_material":"重命名素材"
+    "components": {
+      "prev": "上一张",
+      "next": "下一张",
+      "zoom_in": "放大",
+      "zoom_out": "缩小",
+      "delete": "删除",
+      "fullscreen": "全屏",
+      "cancel_fullscreen": "取消全屏",
+      "pano_setting": "全景图封面设置",
+      "drag_to_cut": "拖动画面截取封面",
+      "cutting": "截图",
+      "preview_cover": "封面预览",
+      "rename_material": "重命名素材"
     }
   },
   "gather": {
@@ -617,7 +617,6 @@
     "delete_success": "删除成功",
     "delete_fail": "删除失败",
     "loading": "加载中",
-
     "too_long_word": "名称过长,请上传标题在50字以内的图片",
     "too_long_word_audio": "名称过长,请上传标题在50字以内的音频",
     "too_long_word_video": "名称过长,请上传标题在50字以内的视频",
@@ -625,33 +624,25 @@
     "cutting": "正在切图处理",
     "material_upload_fail": "素材上传失败",
     "material_cutting_fail": "素材切图失败",
-
-
     "fill_complete": "请填写完整信息",
     "fill_phone": "请正确填写电话号码",
     "edit_success": "修改成功",
     "setting_success": "设置成功",
     "scene_link_copy_tips": "复制成功",
     "scene_link_copy_failed": "复制失败",
-
-
     "delete_material": "删除素材",
     "comfirm_delete_material": "确定要删除素材吗?",
-
     "can_not_delete_folder_when_uploading": "正在上传素材,请不要删除文件夹。",
     "delete_folder": "删除文件夹",
     "comfirm_delete_folder": "确定要删除文件夹以及包含的素材吗?",
-    
     "save_done": "保存成功",
-
     "nothing_edit": "您还未创建任何内容哦",
     "at_least_one_scene": "至少添加一个场景才可预览,请前往“场景导航”添加",
     "exitVr": "退出VR模式",
-
     "dir": "目录",
     "root_dir": "根目录",
-
-    "no_more_data": "没有更多数据了"
+    "no_more_data": "没有更多数据了",
+    "converinfo_no_valid": "请将开场封面内容填写完整"
   },
   "personal_center": {
     "personal_center": "个人中心",
@@ -670,35 +661,35 @@
     "save": "保存"
   },
   "edit_settings": {
-    "coverBase_button":"开场封面",
-    "coverBase_button_tips":"整个作品的开场内容,可以设置为图片或视频形式。",
-    "cover_pull_tit":"封面类型",
+    "coverBase_button": "开场封面",
+    "coverBase_button_tips": "整个作品的开场内容,可以设置为图片或视频形式。",
+    "cover_pull_tit": "封面类型",
     "cover_show": "显示开场封面",
-    "coverSelecVideoAndImg":"图片+视频",
-    "coverSelecImg":"图片",
-    "coverSelecVideo":"视频",
-    "coverImgTit":"图片设置",
-    "coverUpTit1":"建议1920*1080px,2M以内,jpg / gif / png格式",
-    "coverUpTit2":"建议750*1624px,1M以内,jpg / gif / png格式",
-    "coverUpTit3":"建议300*300px,100kb以内,jpg格式",
-    "coverUpTit4":"建议1920*1080px,5M以内,mp4格式",
-    "coverUpTit5":"建议750*1624px,5M以内,mp4格式",
-    "coverImgLoc1":"居中",
-    "coverImgLoc2":"全屏",
-    "coverImgBacTit":"背景设置",
-    "coverImgBacSelec1":"纯色填充",
-    "coverImgBacSelec2":"图片平铺",
-    "coverVideoTit":"视频设置",
-    "select_video":"选择视频",
-    "coverImageInWay":"进入方式",
-    "coverImageInWayTit":"是否开启3秒倒计时后自动进入",
-    "coverVideoInWay":"进入方式",
-    "coverVideoInWayTit":"视频播放完自动进入",
-    "coverVideoControl":"视频控件",
-    "coverVideoControlTit":"视频控件是否显示",
-    "coverImageOrder":"出现顺序",
-    "coverImageOrderTit1":"开场图片先出现",
-    "coverImageOrderTit2":"开场图片后出现",
+    "coverSelecVideoAndImg": "图片+视频",
+    "coverSelecImg": "图片",
+    "coverSelecVideo": "视频",
+    "coverImgTit": "图片设置",
+    "coverUpTit1": "建议1920*1080px,2M以内,jpg / gif / png格式",
+    "coverUpTit2": "建议750*1624px,1M以内,jpg / gif / png格式",
+    "coverUpTit3": "建议300*300px,100kb以内,jpg格式",
+    "coverUpTit4": "建议1920*1080px,5M以内,mp4格式",
+    "coverUpTit5": "建议750*1624px,5M以内,mp4格式",
+    "coverImgLoc1": "居中",
+    "coverImgLoc2": "全屏",
+    "coverImgBacTit": "背景设置",
+    "coverImgBacSelec1": "纯色填充",
+    "coverImgBacSelec2": "图片平铺",
+    "coverVideoTit": "视频设置",
+    "select_video": "选择视频",
+    "coverImageInWay": "进入方式",
+    "coverImageInWayTit": "是否开启3秒倒计时后自动进入",
+    "coverVideoInWay": "进入方式",
+    "coverVideoInWayTit": "视频播放完自动进入",
+    "coverVideoControl": "视频控件",
+    "coverVideoControlTit": "视频控件是否显示",
+    "coverImageOrder": "出现顺序",
+    "coverImageOrderTit1": "开场图片先出现",
+    "coverImageOrderTit2": "开场图片后出现",
     "auto_pano": "自动巡游",
     "enter_auto": "进入全景图自动巡游(3分钟完整巡游一次)",
     "set_bgm": "设置背景音乐",
@@ -710,7 +701,7 @@
     "hide": "隐藏",
     "show": "显示",
     "button_name": "按钮名称",
-    "button_type":"按钮类型",
+    "button_type": "按钮类型",
     "button_open_method": "打开方式",
     "button_placeholder": "请输入按钮名称",
     "please_input": "请输入",
@@ -769,22 +760,18 @@
     "自定义遮罩": "自定义遮罩",
     "自定义按钮": "自定义按钮",
     "开场封面": "开场封面",
-    
-
     "素材": "素材",
     "名称": "名称",
     "大小": "大小",
     "分辨率": "分辨率",
     "创建时间": "创建时间",
     "修改时间": "修改时间",
-
     "封面": "封面",
     "场景标题": "场景标题",
     "拍摄时间": "拍摄时间",
-
-    "一级分组":"一级分组",
-    "二级分组":"二级分组",
-    "默认二级分组":"默认二级分组"
+    "一级分组": "一级分组",
+    "二级分组": "二级分组",
+    "默认二级分组": "默认二级分组"
   },
   "navigation": {
     "scene_edit_tips": "请前往四维时代个人中心编辑场景",
@@ -820,7 +807,7 @@
   },
   "hotspot": {
     "hotspot_type": "热点类型",
-    "img_size":"最多添加20张图片",
+    "img_size": "最多添加20张图片",
     "hotspot_tips": "在全景图中添加图标热点,并设置热点的效果。",
     "add_hotspot": "添加热点",
     "current_hotspots": "当前全景图热点",
@@ -919,9 +906,8 @@
     "change_pdf": "更换PDF",
     "pdf_invalid_tip": "请选择50MB以内、PDF格式的文件",
     "add_article": "添加文章内容",
-    "edit_article":"编辑文章内容",
+    "edit_article": "编辑文章内容",
     "cancel_add_hotspot": "已编辑内容将不会保存,确定要关闭吗?"
-
   },
   "explanation": {
     "explanation_settings": "语音讲解",
@@ -936,7 +922,7 @@
     "menu_width": "58px",
     "play_width": "0"
   },
-  "tips_code":{
+  "tips_code": {
     "FAILURE_2020": "appId为空",
     "FAILURE_2021": "appId解析有误",
     "FAILURE_5001": "token为空",
@@ -955,16 +941,16 @@
     "FAILURE_3200": "请求第三方API失败",
     "FAILURE_3201": "请求第三方API返回失败",
     "FAILURE_error": "网络异常,请稍后再试",
-    "tips":"提示",
-    "relogin":"登录状态失效,请重新登录",
-    "goto_login":"去登录",
-    "login_success":"登录完毕,继续",
-    "need_one":"请至少保留一个场景。",
-    "not_less_than":"文件名称不允许超过50个字符",
-    "work_had_delete":"作品已被删除,无法编辑",
-    "material_can_not_delete":"素材已被引用,无法删除。",
-    "illegality_image":"不支持此图片",
-    "password_error":"密码错误",
+    "tips": "提示",
+    "relogin": "登录状态失效,请重新登录",
+    "goto_login": "去登录",
+    "login_success": "登录完毕,继续",
+    "need_one": "请至少保留一个场景。",
+    "not_less_than": "文件名称不允许超过50个字符",
+    "work_had_delete": "作品已被删除,无法编辑",
+    "material_can_not_delete": "素材已被引用,无法删除。",
+    "illegality_image": "不支持此图片",
+    "password_error": "密码错误",
     "FAILURE_3024": "存储空间已满",
     "loading_fail": "加载失败"
   }