Kaynağa Gözat

编辑器-热点-编辑界面:退出界面时不再需要二次确认。

任一存 2 yıl önce
ebeveyn
işleme
141d97e2cc

+ 2 - 8
packages/qjkankan-editor/src/router/editorRouter.js

@@ -81,14 +81,8 @@ router.beforeEach(async (to, from, next) => {
     await OnlineDetector.listener();
     if (from.name == 'hotspot') {
       if (store.getters.isEditing) {
-        vue.$confirm({
-            content: i18n.t('hotspot.close_dialog'),
-            ok: () => {
-              vue.$bus.emit('delhotspot') 
-             return next()
-            }
-        });
-        return
+        vue.$bus.emit('delhotspot') 
+        return next()
       }
     }
 

+ 0 - 101
packages/qjkankan-editor/src/router/index.js

@@ -1,101 +0,0 @@
-import Vue from 'vue'
-import Router from 'vue-router'
-import { PCMenu } from "../config/menu.js";
-import { checkWork, checkLogin,getPanoInfo } from '@/api'
-import { $alert } from '@/components/shared/message'
-import store from '../Store'
-
-let vue = new Vue()
-
-import { LoginDetector,OnlineDetector } from "@/utils/starter";
-Vue.use(Router)
-
-const originalPush = Router.prototype.push
-Router.prototype.push = function push (location) {
-  return originalPush.call(this, location).catch(err => err)
-}
-
-let routes = [];
-PCMenu.forEach(item => {
-  routes.push({
-    name: item.name,
-    path: `${item.link}`,
-    meta: {
-      loading: null,
-      loadScene: !item.hidescene
-    },
-    component: () => import(`../views/${item.name}/index.vue`)
-  });
-});
-
-
-LoginDetector.register(
-  detector => new Promise(resolve => detector.resolve(resolve))
-);
-
-OnlineDetector.register(
-  detector => new Promise(resolve => detector.resolve(resolve))
-);
-
-//检验是不是该用户作品
-
-
-checkWork().then(res=>{
-  if (res.data) {
-    checkLogin().then(response => {
-      if (response.code == 3005) {
-        store.commit('UpdateIsShowState', false)
-        vue.$bus.emit('canLoad',false) 
-        return vue.$alert({content: '当前无操作权限'});
-      } else{
-        vue.$bus.emit('canLoad',true) 
-        LoginDetector.valid();
-      }
-    });
-  } 
-  else{
-    return vue.$alert({content: '该作品已被删除'});
-  }
-  
-})
-
-getPanoInfo().then(() => {
-  store.commit('UpdateIsShowState', true)
-  // if(response&&response.status == 1){
-  // }
-  OnlineDetector.valid();
-});
-
-
-const router = new Router({
-  routes: routes
-})
-
-
-router.beforeEach(async (to, from, next) => {
-  
-    await LoginDetector.listener();
-    await OnlineDetector.listener();
-    if (from.name == 'hotspot') {
-      if (store.getters.isEditing) {
-        vue.$confirm({
-            content: vue.$i18n.t('hotspot.close_dialog'),
-            ok: () => {
-              vue.$bus.emit('delhotspot') 
-             return next()
-            }
-        });
-        return
-      }
-    }
-
-
-    if (to.path == '/') {
-        return next({path: "/base" })
-    }
-    
-    next()
-})
-
-
-export default router;

+ 2 - 28
packages/qjkankan-editor/src/views/hotspot/EditPanel.vue

@@ -4,7 +4,7 @@
     <div class="hots-panel" v-show="show">
       <div class="ui-between header">
         <span>{{ editTitle }}{{ $i18n.t('hotspot.hotspot_name') }}</span>
-        <i class="iconfont icon_close" @click="confirmCancel"></i>
+        <i class="iconfont icon_close" @click="cancel"></i>
       </div>
       <div class="content" ref="content">
         <div class="icon-setting">
@@ -49,7 +49,7 @@
         </div>
       </div>
       <div class="ui-between footer" app-border dir-top>
-        <button class="ui-button deepcancel" :class="{ disable: false }" @click="confirmCancel">{{$i18n.t('hotspot.cancel')}}</button>
+        <button class="ui-button deepcancel" :class="{ disable: false }" @click="cancel">{{$i18n.t('hotspot.cancel')}}</button>
         <button class="ui-button submit" :class="{ disable: false }" @click="save">{{$i18n.t('hotspot.finish')}}</button>
       </div>
     </div>
@@ -326,32 +326,6 @@ export default {
       }
       return flag
     },
-
-    confirmCancel() {
-      if (this.editTitle != '编辑'&&this.editTitle != this.$i18n.t('hotspot.edit')) {
-        if (this.isAddChange()) {
-          this.$confirm({
-            content: this.$i18n.t('hotspot.close_dialog'),
-            ok: () => {
-              this.cancel()
-            }
-          });
-        } else {
-          this.cancel()
-        }
-      } else {
-        if (this.isDiffHotSpot() || this.isAddChange()) {
-          this.$confirm({
-            content: this.$i18n.t('hotspot.close_dialog'),
-            ok: () => {
-              this.cancel()
-            }
-          });
-        } else {
-          this.cancel()
-        }
-      }
-    },
     cancel() {
       this.$store.commit("SetHotspot", this.backupHotSpot);
       this.$emit("close", {

+ 1 - 8
packages/qjkankan-editor/src/views/hotspot/HotSpotList.vue

@@ -120,15 +120,8 @@ export default {
       }
       if (this.editTitle == '新增' || this.editTitle == this.$i18n.t('hotspot.add')) {
         if (this.showPanel) {
-          return this.$confirm({
-            content: this.$i18n.t('hotspot.close_dialog'),
-            ok: () => {
-              this.deleteKRHotspot(this.hotspot)
-              this.open(this.someData.hotspots[idx])
-            }
-          })
+          this.deleteKRHotspot(this.hotspot)
         }
-
       }
 
       this.open(this.someData.hotspots[idx])