Browse Source

Merge branch 'feature_调研宝相关优化' of zhangs/surveyMaker into develop

wangs 5 years ago
parent
commit
2cabea6876

+ 2 - 0
index.html

@@ -3,6 +3,8 @@
   <head>
     <meta charset="utf-8">
     <title>调研宝H5编辑器</title>
+    <link rel="icon" href="static/favicon.ico" type="image/x-icon" />
+    <link rel="shortcut icon" href="static/favicon.ico" type="image/x-icon" />
   </head>
   <body>
     <div id="app"></div>

BIN
src/assets/images/add.png


BIN
src/assets/images/changeImg.png


BIN
src/assets/images/subtraction.png


File diff suppressed because it is too large
+ 1305 - 835
src/components/EditPanel.vue


+ 56 - 8
src/components/HeaderEdit.vue

@@ -7,22 +7,44 @@
     </div>
     <div class="tools">
       <div class="next_return">
-        <div class="return" title="撤销" @click="revocation" :style="`opacity:${operationList.length>1?'1':'.3'}`">
-          <img class="retutn_icon" src="../assets/images/button_return.png" alt="">
+        <div
+          class="return"
+          title="撤销"
+          @click="revocation"
+          :style="`opacity:${operationList.length>1?'1':'.3'}`"
+        >
+          <img class="retutn_icon" src="../assets/images/button_return.png" alt />
           <span>撤销</span>
         </div>
-        <div class="return" title="恢复" @click="recover" :style="`opacity:${nextList.length>0?'1':'.3'}`">
-          <img class="retutn_icon" src="../assets/images/button_next.png" alt="">
+        <div
+          class="return"
+          title="恢复"
+          @click="recover"
+          :style="`opacity:${nextList.length>0?'1':'.3'}`"
+        >
+          <img class="retutn_icon" src="../assets/images/button_next.png" alt />
           <span>恢复</span>
         </div>
         <div class="return" title="分享设置" @click="shareSetting">
-          <img class="retutn_icon" src="../assets/images/share_setting_edit_nor.png" alt="">
+          <img class="retutn_icon" src="../assets/images/share_setting_edit_nor.png" alt />
           <span>分享设置</span>
         </div>
         <div class="return" title="保存" @click="save">
-          <img class="retutn_icon" src="../assets/images/save_edit_nor.png" alt="">
+          <img class="retutn_icon" src="../assets/images/save_edit_nor.png" alt />
           <span>保存</span>
         </div>
+        <div title="缩放" class="zoom-title">
+          <img class="size" @click="zoom(false)" src="../assets/images/subtraction.png"></img>
+          <div class="zoom-num">
+            <span
+              style="font-size:14px;font-family:MicrosoftYaHei;color:rgba(100,107,129,1);line-height:19px"
+            >{{zoomNum*100}}%</span>
+            <span
+              style="font-size:14px;font-family:MicrosoftYaHei;color:rgba(100,107,129,1);line-height:19px;"
+            >缩放</span>
+          </div>
+          <img class="size" @click="zoom(true)" src="../assets/images/add.png"></img>
+        </div>
       </div>
     </div>
     <!-- <div class="next_return">
@@ -33,7 +55,7 @@
     <el-button @click="grid" class="preview " type="primary" style="margin-left: 50px;">网格参考线</el-button>
 
     <div class="right-panel">
-      <el-button @click="deploy" class="preview" type="primary" :loading="loading">预览</el-button> -->
+    <el-button @click="deploy" class="preview" type="primary" :loading="loading">预览</el-button>-->
     <!--<el-button @click="psd"-->
     <!--class="preview"-->
     <!--type="primary"-->
@@ -51,7 +73,7 @@
         <input type="file" id="psdFile" name="image" @change="uploadFn">
 
       </form>
-    </div> -->
+    </div>-->
     <!-- 分享设置 -->
     <ShareSetting v-if="isShareSetting" :close="closeShare" :shareModel="shareModel"></ShareSetting>
   </header>
@@ -67,7 +89,9 @@ export default {
   props: {
     goback: Function,
     save: Function,
+    zoom: Function,
     title: "",
+    zoomNum: Number,
     shareModel: ""
   },
   components: {
@@ -367,6 +391,30 @@ export default {
           margin-bottom: 8px;
         }
       }
+
+      .zoom-title {
+        margin-left: 80px;
+        display: flex;
+        flex-direction: row;
+        justify-content: center;
+        align-items: center;
+
+        .zoom-num {
+          display: flex;
+          flex-direction: column;
+          justify-content: center;
+          align-items: center;
+          width: 50px;
+        }
+
+        .size {
+          width: 20px;
+          padding: 5px;
+          object-fit: cover;
+          margin-left: 8px;
+          margin-right: 8px;
+        }
+      }
     }
   }
 }

+ 1 - 1
src/model/Element.js

@@ -56,7 +56,7 @@ export default class Element {
     this.animatedFont = ele.animatedFont || ''
     this.eleCanvas = ele.eleCanvas || ''
     this.swiperType = ele.swiperType || 'mtswiper'
-    this.isFixed = ele.isFixed || false
+    this.fixed = ele.fixed || false
     this.backgroundSelectedImg = ele.backgroundSelectedImg || ''
     this.backgroundUnselectedImg = ele.backgroundUnselectedImg || ''
     this.questionId = ele.questionId || 0

+ 3 - 0
src/util/appConst.js

@@ -11,6 +11,9 @@ if (process.env.NODE_ENV === 'test') {
 } else if (process.env.NODE_ENV === 'development') {//开发
   BACKEND_DOMAIN = 'http://192.168.0.16:5318'
   DIAOYANBAO_PATH = 'http://192.168.4.249:8080/#/preview?mgid='
+  QINIU_DOMAIN = 'https://gatewaytest.elab-plus.com'
+  // BACKEND_DOMAIN = 'http://gatewaytest.elab-plus.com/elab-diaoyanbao'
+  // DIAOYANBAO_PATH = 'http://h5test.elab-plus.com/diaoyanbao/#/preview?mgid='
 } else if (process.env.NODE_ENV === 'uat') {//UAT
   BACKEND_DOMAIN = 'https://api-uat.elaber.cn/'
   DIAOYANBAO_PATH = 'http://192.168.4.249:8080/#/preview?mgid='

File diff suppressed because it is too large
+ 1611 - 1216
src/views/h5editor/index.vue


+ 117 - 34
src/views/h5editor/overview.vue

@@ -2,10 +2,18 @@
   <div class="overview">
     <!-- 顶部tag -->
     <div class="preview-tag">
-      <div class="page-tag-btn tagPage" :class="{ active: viewState === 0 }" @click="function () { viewState = 0 }">
+      <div
+        class="page-tag-btn tagPage"
+        :class="{ active: viewState === 0 }"
+        @click="function () { viewState = 0 }"
+      >
         <div class="page-tag-btn-tip">页面</div>
       </div>
-      <div class="page-tag-btn tagElement" :class="{ active: viewState === 1 }" @click="function () { viewState = 1 }">
+      <div
+        class="page-tag-btn tagElement"
+        :class="{ active: viewState === 1 }"
+        @click="function () { viewState = 1 }"
+      >
         <div class="page-tag-btn-tip">元素</div>
       </div>
     </div>
@@ -13,35 +21,58 @@
     <div class="page-preview" style="z-index: 1;">
       <ul class="list custom-scrollbar">
         <li class="cover">
-          <img class="page_preview_tag" src="../../assets/images/page_preview_tag.png" alt="">
+          <img class="page_preview_tag" src="../../assets/images/page_preview_tag.png" alt />
           <div class="page_preview_tag_title">封面</div>
           <div class="item-page" v-for="(page,index) in pages" v-show="index==0">
             <span>1</span>
-            <div class="page" :class="{ active: page === editingPage }"
+            <div
+              class="page"
+              :class="{ active: page === editingPage }"
               :style="{ width: 70 + 4 + 'px', height: (70 / canvasWidth) * canvasHeight + 4 + 'px' }"
-              @click="setEditingPage(page,0)" @click.right="rightEvent()">
-              <Page :isOverView="true" class="content" :hideFoot="true"
+              @click="setEditingPage(page,0)"
+              @click.right="rightEvent()"
+            >
+              <Page
+                :isOverView="true"
+                class="content"
+                :hideFoot="true"
                 :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px', transform: 'scale(' + 70 / canvasWidth +')',backgroundColor: bodyBackgroundColor }"
-                :elements="page.elements" type="see" />
+                :elements="page.elements"
+                type="see"
+              />
             </div>
           </div>
         </li>
         <li class="cover">
-          <img class="page_preview_tag" src="../../assets/images/page_preview_tag.png" alt="">
+          <img class="page_preview_tag" src="../../assets/images/page_preview_tag.png" alt />
           <div class="page_preview_tag_title">题目</div>
           <div class="item-page" v-for="(page,index) in pages" v-show="isShow(index)">
             <span>{{index + 1 }}</span>
-            <div class="page" :class="{ active: page === editingPage }"
+            <div
+              class="page"
+              :class="{ active: page === editingPage }"
               :style="{ width: 70 + 4 + 'px', height: (70 / canvasWidth) * canvasHeight + 4 + 'px' }"
-              @click="setEditingPage(page,index)">
-              <Page :isOverView="true" class="content" :hideFoot="true"
+              @click="setEditingPage(page,index)"
+            >
+              <Page
+                :isOverView="true"
+                class="content"
+                :hideFoot="true"
                 :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px', transform: 'scale(' + 70 / canvasWidth +')',backgroundColor: bodyBackgroundColor }"
-                :elements="page.elements" type="see" />
+                :elements="page.elements"
+                type="see"
+              />
             </div>
-            <el-dropdown placement="bottom" trigger="click" class="operation"
-              @command="command=>operationCommand(command, page, index)">
+            <el-dropdown
+              placement="bottom"
+              trigger="click"
+              class="operation"
+              @command="command=>operationCommand(command, page, index)"
+            >
               <div class="operation_img"></div>
               <el-dropdown-menu slot="dropdown">
+                <el-dropdown-item command="insertBottom">向下插入新页面</el-dropdown-item>
+                <el-dropdown-item command="insertTop">向上插入新页面</el-dropdown-item>
                 <el-dropdown-item command="del">删除</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
@@ -49,19 +80,31 @@
           <div class="item-page-add" @click="addPage">添加题目页</div>
         </li>
         <li class="cover">
-          <img class="page_preview_tag" src="../../assets/images/page_preview_tag.png" alt="">
+          <img class="page_preview_tag" src="../../assets/images/page_preview_tag.png" alt />
           <div class="page_preview_tag_title">结论</div>
           <div class="item-page" v-for="(page,index) in pages" v-show="isShowResult(index)">
             <span>{{index + 1}}</span>
-            <div class="page" :class="{ active: page === editingPage }"
+            <div
+              class="page"
+              :class="{ active: page === editingPage }"
               :style="{ width: 70 + 4 + 'px', height: (70 / canvasWidth) * canvasHeight + 4 + 'px' }"
-              @click="setEditingPage(page,index)">
-              <Page :isOverView="true" class="content" :hideFoot="true"
+              @click="setEditingPage(page,index)"
+            >
+              <Page
+                :isOverView="true"
+                class="content"
+                :hideFoot="true"
                 :style="{ width: canvasWidth + 'px', height: canvasHeight + 'px', transform: 'scale(' + 70 / canvasWidth +')',backgroundColor: bodyBackgroundColor }"
-                :elements="page.elements" type="see" />
+                :elements="page.elements"
+                type="see"
+              />
             </div>
-            <el-dropdown placement="bottom" trigger="click" class="operation"
-              @command="command=>operationCommand(command, page, index)">
+            <el-dropdown
+              placement="bottom"
+              trigger="click"
+              class="operation"
+              @command="command=>operationCommand(command, page, index)"
+            >
               <div class="operation_img"></div>
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="del">删除</el-dropdown-item>
@@ -73,32 +116,52 @@
       </ul>
     </div>
     <!-- 图层 -->
-    <div class="list custom-scrollbar" style="z-index: 2;" v-show="viewState === 1"
-      :class="{ dragging: dragState === 1 }">
+    <div
+      class="list custom-scrollbar"
+      style="z-index: 2;"
+      v-show="viewState === 1"
+      :class="{ dragging: dragState === 1 }"
+    >
       <ul>
         <li v-for="(layer, index) in layersNoBg" :key="index">
-          <div class="layer" :class="{ active: editingLayer === layer}" @mousedown="moveLayer($event,layer)">
-            <span class="thumb" :style="{ backgroundImage: 'url(' + layer.imgSrc + ')' }"></span>{{ layer.type }}
+          <div
+            class="layer"
+            :class="{ active: editingLayer === layer}"
+            @mousedown="moveLayer($event,layer)"
+          >
+            <span class="thumb" :style="{ backgroundImage: 'url(' + layer.imgSrc + ')' }"></span>
+            {{ layer.type }}
           </div>
         </li>
       </ul>
-      <div v-for="(layer, index) in layersBg" :key="index" class="layer" :class="{ active: editingLayer === layer}"
-        @click="setEditingLayer(layer)">
-        <span class="thumb" :style="{ backgroundImage: 'url(' + layer.imgSrc + ')' }"></span>{{ layer.type }}
+      <div
+        v-for="(layer, index) in layersBg"
+        :key="index"
+        class="layer"
+        :class="{ active: editingLayer === layer}"
+        @click="setEditingLayer(layer)"
+      >
+        <span class="thumb" :style="{ backgroundImage: 'url(' + layer.imgSrc + ')' }"></span>
+        {{ layer.type }}
       </div>
     </div>
     <!-- 题目 -->
     <div class="topic-list" v-if="isShowQuestion">
       <div class="topic-top" @click="showTopic = !showTopic">
         <span>题目列表</span>
-        <img class="topic-top-arrow" :src="topicIcon" alt="">
+        <img class="topic-top-arrow" :src="topicIcon" alt />
       </div>
       <el-collapse-transition>
         <div v-show="showTopic">
           <div class="topic-group">
-            <el-checkbox v-model="item.isChecked" v-for="(item, index) in questionList" :label="item.name" :key="index"
-              @change="checked=>selectCheckbox(checked,item,index)" :disabled="isDisabled(index)">
-            </el-checkbox>
+            <el-checkbox
+              v-model="item.isChecked"
+              v-for="(item, index) in questionList"
+              :label="item.name"
+              :key="index"
+              @change="checked=>selectCheckbox(checked,item,index)"
+              :disabled="isDisabled(index)"
+            ></el-checkbox>
           </div>
         </div>
       </el-collapse-transition>
@@ -177,14 +240,34 @@ export default {
     },
     editingLayer() {
       return this.vxEditor["editorElement"];
-    },
+    }
   },
   methods: {
     operationCommand(command, page, index) {
       if (command == "del") {
         console.log("删除", index);
         this.deletePage(page, index);
+      } else if (command == "insertTop") {
+        console.log("插入", index);
+        this.insertPage(page, index, true);
+      } else if (command == "insertBottom") {
+        this.insertPage(page, index, false);
+      }
+    },
+    //插入题目页
+    insertPage(page, index, isTop) {
+      this.bodyBackgroundColor =
+        this.$store.state.editor.editorTheme.bodyBackgroundColor ||
+        "rgba(255,255,255,0)";
+      if (isTop) {
+        var position = index ;
+      } else {
+        var position = index + 1;
       }
+      this.$store.dispatch("addPagePosition", position);
+      this.isShowQuestion = true;
+      this.selectQuestions.push([]);
+      this.currentPage += 1;
     },
     isChecked(index) {
       var question = this.questionList[index].questionId;
@@ -475,7 +558,7 @@ export default {
       this.$store.dispatch("sortElementsByZindex");
     }
   },
-  components: { Page},
+  components: { Page },
   watch: {
     showTopic: function(val) {
       if (val) {

BIN
static/favicon.ico