Sfoglia il codice sorgente

Merge branch 'master' of http://192.168.4.246:3000/zhangs/surveyMaker

zhangwf 5 anni fa
parent
commit
39c6a5c8be

+ 3 - 2
src/components/ShareSetting.vue

@@ -60,14 +60,15 @@ export default {
     close: {
       type: Function,
       default: null
-    }
+    },
+    currItem: ""
   },
   methods: {
     closeBtn() {
       this.close();
     },
     save() {
-      console.log("XXXX");
+      console.log("XXXX", this.currItem);
     }
   }
 };

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


+ 24 - 7
src/views/h5editor/overview.vue

@@ -77,16 +77,13 @@
     <!-- 题目 -->
     <div class="topic-list">
       <div class="topic-top" @click="showTopic = !showTopic">
-        <span>题目列表</span>
+        <span>题目列表{{testcaseId}}</span>
         <img class="topic-top-arrow" :src="topicIcon" alt="">
       </div>
       <el-collapse-transition>
         <div v-show="showTopic">
           <el-checkbox-group v-model="checkList" class="topic-group">
-            <el-checkbox label="1.复选框 A复选框 A复选框 A复选框 A复选框 A复选框 A复选框 A"></el-checkbox>
-            <el-checkbox label="2.复选框 B"></el-checkbox>
-            <el-checkbox label="3.复选框 C"></el-checkbox>
-            <el-checkbox label="4.选中且禁用" disabled></el-checkbox>
+            <el-checkbox v-for="item in questionList" :label="item.name" :key="item.name"></el-checkbox>
           </el-checkbox-group>
         </div>
       </el-collapse-transition>
@@ -96,7 +93,12 @@
   <script>
 import Page from "./../../components/Page";
 import AppConst from "../../util/appConst";
+import editorApi from "../../api/editor";
+
 export default {
+  props: {
+    testcaseId: ""
+  },
   data() {
     return {
       viewState: 0,
@@ -108,10 +110,25 @@ export default {
       questionPages: [],
       resultPageCount: 0,
       resultPages: [],
-      checkList: ["选中且禁用"],
+      checkList: ["4.选中且禁用"],
       showTopic: true,
-      topicIcon: "../../static/img/up-arrow.png"
+      topicIcon: "../../static/img/up-arrow.png",
+      questionList: []
+    };
+  },
+  mounted() {
+    let data = {
+      testcaseId: this.testcaseId
     };
+    console.log("testcaseId:", this.testcaseId);
+    editorApi.cncTestDetail(data).then(res => {
+      if (res.success) {
+        this.questionList = res.single.questionList;
+        console.log("success", this.questionList);
+      } else {
+        console.log("error");
+      }
+    });
   },
   computed: {
     vxEditor() {

+ 192 - 177
src/views/h5editor/themeList.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <HeaderBar/>
+    <HeaderBar />
     <div class="my-themes">
       <div class="container">
         <ul class="theme-list">
@@ -11,7 +11,7 @@
           </li>
           <template v-for="item in list">
             <li class="theme-item">
-              <div class="thumb" >
+              <div class="thumb">
                 <img :src="item.cover" alt="" v-if="item.cover">
                 <img src="../../assets/images/default.png" alt="" v-else>
                 <div class="cover">
@@ -38,208 +38,223 @@
         </ul>
       </div>
     </div>
-    <PreView :itemId="itemId" @hideView="isShowPreView=false" v-if="isShowPreView"/>
+    <PreView :itemId="itemId" @hideView="isShowPreView=false" v-if="isShowPreView" />
   </div>
 </template>
 
 <script>
-  import HeaderBar from '../../components/HeaderBar'
-  import tools from '../../util/tools'
-  import PreView from '../../components/PreView'
-  import  * as http  from '../../util/http'
-  export default {
-    data () {
-      return {
-        isShowPreView: false,
-        itemId: null
-      }
-    },
-    computed: {
-      list () {
-        return this.$store.state.editor.themeList
-      }
+import HeaderBar from "../../components/HeaderBar";
+import tools from "../../util/tools";
+import PreView from "../../components/PreView";
+import * as http from "../../util/http";
+export default {
+  data() {
+    return {
+      isShowPreView: false,
+      itemId: null
+    };
+  },
+  computed: {
+    list() {
+      return this.$store.state.editor.themeList;
+    }
+  },
+  mounted() {
+    this.$store.dispatch("getUserThemeList", "h5");
+  },
+  methods: {
+    toEditor(item) {
+      // this.$store.dispatch('setEditorTheme', item)
+      // this.$store.dispatch('setEditorPage', item.pages[0])
+      this.$store.state.editor.editorElement = {};
+      this.$store.state.editor.editorPage = {};
+      this.$store.state.editor.editorTheme = {};
+      this.$router.replace({
+        path: "/h5editor",
+        query: { itemId: item._id, testcaseId: item.testcaseId }
+      });
     },
-    mounted () {
-      this.$store.dispatch('getUserThemeList', 'h5')
+    copyTheme(_id) {
+      http
+        .get("/api/pages/" + _id)
+        .then(item => {
+          function deepClone(obj) {
+            let _obj = JSON.stringify(obj),
+              objClone = JSON.parse(_obj);
+            return objClone;
+          }
+          var _item = deepClone(item);
+          _item._id = null;
+          _item.id = null;
+          // this.$store.dispatch('saveTheme', _item)
+          // this.$store.state.editor.themeList.push(item)
+          this.$store.dispatch("createTheme", "h5");
+          this.$store.dispatch("saveTheme", tools.vue2json(_item)).then(() => {
+            this.$store.dispatch("getUserThemeList", "h5").then(() => {
+              this.$message.success("复制成功");
+            });
+          });
+        })
+        .catch(err => {
+          this.$message.error(err);
+        });
     },
-    methods: {
-      toEditor (item) {
-        // this.$store.dispatch('setEditorTheme', item)
-        // this.$store.dispatch('setEditorPage', item.pages[0])
-        this.$store.state.editor.editorElement = {}
-        this.$store.state.editor.editorPage = {}
-        this.$store.state.editor.editorTheme = {}
-        this.$router.replace({ path: '/h5editor', query: { itemId: item._id } })
-      },
-      copyTheme (_id) {
-        http.get('/api/pages/' + _id)
-          .then((item)=> {
-            function deepClone(obj){
-              let _obj = JSON.stringify(obj),
-                objClone = JSON.parse(_obj);
-              return objClone
-            }
-            var _item=deepClone(item)
-            _item._id=null
-            _item.id=null
-            // this.$store.dispatch('saveTheme', _item)
-            // this.$store.state.editor.themeList.push(item)
-            this.$store.dispatch('createTheme', 'h5')
-            this.$store.dispatch('saveTheme', tools.vue2json(_item)).then(() => {
-              this.$store.dispatch('getUserThemeList', 'h5').then(() => {
-                this.$message.success('复制成功')
-              })
-            })
-          })
-          .catch((err)=> {
-              this.$message.error(err)
-          })
-      },
-      deleteTheme (item) {
-        this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          this.$store.dispatch('deleteTheme', item)
-          this.$message({
-            type: 'success',
-            message: '删除成功!'
-          })
-        }).catch(() => {
+    deleteTheme(item) {
+      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          this.$store.dispatch("deleteTheme", item);
           this.$message({
-            type: 'info',
-            message: '已取消删除'
-          })
+            type: "success",
+            message: "删除成功!"
+          });
         })
-      },
-      create () {
-        this.$store.dispatch('createTheme', 'h5')
-        this.$store.dispatch('addPage')
-        let $this = this
-        this.$store.state.editor.editorTheme.createDate = new Date().getTime()
-        this.$store.dispatch('saveTheme', tools.vue2json(this.$store.state.editor.editorTheme)).then(() => {
-          this.$router.replace({ path: '/h5editor', query: { itemId: $this.$store.state.editor.editorTheme._id } })
-        })
-      },
-      showPreView (itemId) {
-        this.isShowPreView = true
-        this.itemId = itemId
-      }
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除"
+          });
+        });
+    },
+    create() {
+      this.$store.dispatch("createTheme", "h5");
+      this.$store.dispatch("addPage");
+      let $this = this;
+      this.$store.state.editor.editorTheme.createDate = new Date().getTime();
+      this.$store
+        .dispatch(
+          "saveTheme",
+          tools.vue2json(this.$store.state.editor.editorTheme)
+        )
+        .then(() => {
+          this.$router.replace({
+            path: "/h5editor",
+            query: { itemId: $this.$store.state.editor.editorTheme._id }
+          });
+        });
     },
-    components: {
-      HeaderBar, PreView
+    showPreView(itemId) {
+      this.isShowPreView = true;
+      this.itemId = itemId;
     }
+  },
+  components: {
+    HeaderBar,
+    PreView
   }
+};
 </script>
 
 <style lang="less" scoped>
-  .my-themes {
-    width: 100%;
-    height: 100%;
-    background-color: #f2f5f6;
-  }
+.my-themes {
+  width: 100%;
+  height: 100%;
+  background-color: #f2f5f6;
+}
 
-  .my-themes .container {
-    width: 1024px;
-    margin: 0 auto;
-    padding-top: 20px;
-  }
+.my-themes .container {
+  width: 1024px;
+  margin: 0 auto;
+  padding-top: 20px;
+}
 
-  .my-themes .theme-list {
-    overflow: hidden;
-  }
+.my-themes .theme-list {
+  overflow: hidden;
+}
 
-  .theme-item {
-    width: 230px;
-    height: 328px;
-    float: left;
-    margin-right: 20px;
-    margin-bottom: 20px;
-    background: #fff;
-  }
+.theme-item {
+  width: 230px;
+  height: 328px;
+  float: left;
+  margin-right: 20px;
+  margin-bottom: 20px;
+  background: #fff;
+}
 
-  .theme-item .thumb img {
+.theme-item .thumb img {
+  width: 100%;
+  height: 230px;
+  object-fit: cover;
+}
+.thumb {
+  position: relative;
+  .cover {
+    display: none;
+    position: absolute;
+    background: #000;
+    opacity: 0.5;
     width: 100%;
-    height: 230px;
-    object-fit: cover;
-  }
-  .thumb {
-    position: relative;
-    .cover {
-      display: none;
-      position: absolute;
-      background: #000;
-      opacity: 0.5;
-      width: 100%;
-      height: 100%;
-      top:0;
-      .toolbar {
+    height: 100%;
+    top: 0;
+    .toolbar {
+      color: #fff;
+      text-align: right;
+      cursor: pointer;
+      padding: 10px;
+      font-size: 18px;
+      i {
+        margin: 5px;
+      }
+    }
+    .preview {
+      text-align: center;
+      margin-top: 70px;
+      span {
+        border: 1px solid #fff;
+        padding: 5px 10px;
+        font-size: 20px;
         color: #fff;
-        text-align: right;
         cursor: pointer;
-        padding: 10px;
-        font-size: 18px;
-        i {
-          margin: 5px;
-        }
-      }
-      .preview {
-        text-align: center;
-        margin-top:70px;
-        span {
-          border: 1px solid #fff;
-          padding: 5px 10px;
-          font-size: 20px;
-          color: #fff;
-          cursor: pointer;
-        }
       }
     }
   }
-  .thumb:hover {
-    .cover {
-      display: block;
-    }
-  }
-  .theme-item .footer {
-    height: 98px;
-    padding: 10px;
-    background-color: #fff;
-    box-sizing: border-box;
-    position: relative;
+}
+.thumb:hover {
+  .cover {
+    display: block;
   }
+}
+.theme-item .footer {
+  height: 98px;
+  padding: 10px;
+  background-color: #fff;
+  box-sizing: border-box;
+  position: relative;
+}
 
-  .theme-item .footer > .title {
-    color: #4a4a4a;
-    font-size: 14px;
-    width: 100%;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
-  }
+.theme-item .footer > .title {
+  color: #4a4a4a;
+  font-size: 14px;
+  width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
 
-  .theme-item .footer > .content {
-    color: #83817b;
-    margin-top: 12px;
-    font-size: 14px;
-    max-height: 40px;
-    overflow: hidden;
-    line-height: 1.5;
-  }
-  .footer .delete {
-    position: absolute;
-    right: 10px;
-    bottom: 10px;
-  }
+.theme-item .footer > .content {
+  color: #83817b;
+  margin-top: 12px;
+  font-size: 14px;
+  max-height: 40px;
+  overflow: hidden;
+  line-height: 1.5;
+}
+.footer .delete {
+  position: absolute;
+  right: 10px;
+  bottom: 10px;
+}
 
-  .theme-item.create {
-    text-align: center;
-  }
+.theme-item.create {
+  text-align: center;
+}
 
-  .theme-item.create .create-area p {
-    font-size: 20px;
-    cursor: pointer;
-    margin-top: 100px;
-  }
+.theme-item.create .create-area p {
+  font-size: 20px;
+  cursor: pointer;
+  margin-top: 100px;
+}
 </style>

+ 2 - 2
src/views/myHistoryTest/myHistoryTest.html

@@ -40,7 +40,7 @@
       <div class="tools">
         <img v-if="item.canDelete" class="item-img delete" src="" alt="" @click="deleteTest(item)">
         <img class="item-img copy" src="" alt="" @click="copyTest(item)">
-        <img class="item-img share" src="" alt="" @click="shareTest()">
+        <img class="item-img share" src="" alt="" @click="shareTest(item)">
         <img class="item-img edit" src="" alt="" @click="editTest(item)" style="float:right;margin-right:10px;">
       </div>
       <div class="title">{{item.title}}</div>
@@ -58,5 +58,5 @@
   <div v-if="loading" class="loading">加载中...</div>
   <div v-if="noMore" class="loading">没有更多了</div>
   <!-- 分享设置 -->
-  <ShareSetting v-show="isShareSetting" :close="closeShare"></ShareSetting>
+  <ShareSetting v-show="isShareSetting" :close="closeShare" :currItem="currItem"></ShareSetting>
 </div>

+ 7 - 3
src/views/myHistoryTest/myHistoryTest.js

@@ -37,7 +37,8 @@ export default {
       ownHouseName: "所属项目",
       orderList: [{ orderName: "按创建时间排序", orderType: "created" }, { orderName: "按更新时间排序", orderType: "updated" }],
       currOrderName: "更新时间",
-      currOrderType: ""
+      currOrderType: "",
+      currItem: ""
     }
   },
   computed: {
@@ -168,12 +169,15 @@ export default {
 
     },
     editTest(item) {
-      this.$router.replace({ path: '/h5editor', query: { itemId: item._id } })
+      this.$router.replace({ path: '/h5editor', query: { itemId: item._id, testcaseId: item.testcaseId } })
     },
-    shareTest() {
+    shareTest(item) {
+      this.currItem = item;
+      console.log("XXXXX", item);
       this.isShareSetting = true;
     },
     closeShare() {
+      this.currItem = "";
       this.isShareSetting = false;
     }
   },