Bläddra i källkod

改成单个数据

吕君喜 2 år sedan
förälder
incheckning
c4cdbc97d0
1 ändrade filer med 8 tillägg och 53 borttagningar
  1. 8 53
      src/views/page.vue

+ 8 - 53
src/views/page.vue

@@ -51,11 +51,14 @@ export default {
       EventBus.$emit('loading', val);
     },
     $route(){
-      this.dispath()
     }
   },
   created(){
-    this.dispath()
+    let {id } = this.$route.params;
+    if(id=="main") id = '679773f089e7bbf1b50a43e2c83645be';
+    this.uuid = id
+    console.log("uuid", id)
+    this.init()
   },
   mounted(){
     if(!this.isMobile) {
@@ -66,49 +69,15 @@ export default {
   },
   methods: {
     ...mapActions('pages', ['setPage']),
-    dispath(){
-      const { id } = this.$route.params;
-      if( id == "main"){
-        this.uuid = ""
-        this.paperId = 0
-        this.init()
-      }else if( id.length == 32 ){
-        this.uuid = id
-        this.paperId = 0
-        this.init()
-      }else{
-        this.nodeId = +id;
-        this.getPageInfo();
-      }
-    },
     init(){
-      let {paperId,uuid} = this.uuid;
+      let uuid = this.uuid;
       if(this.loading) return;
       this.loading = true;
-      fetch("paper.getpaperinfo", {paperId,uuid}).then((res) => {
+      fetch("paper.getpaper", {uuid}).then((res) => {
         this.loading = false;
         this.isMain = true
-        let {nodes, slider} = res;
+        console.log( res, res)
         this.page = res;
-        this.page.nodes = {
-          logo: {
-            type: "image",
-            image: res.logo,
-            style: "position: absolute; z-index: 111; top: 80px; width: 50vw; left: 50%;margin-left: -25vw;pointer-events:none;"
-          },
-          slider:{
-            type: "slider",
-            style: "height: 200px;",
-            children: slider.split(",").map((url)=>{
-              return {image: url}
-            })
-          },
-          matrix: {
-            type: "matrix",
-            style: "height: 200px;",
-            children: nodes
-          }
-        }
         this.setPage(this.page);
         res.title && (document.title = res.title);
       }).catch(() => {
@@ -116,20 +85,6 @@ export default {
         this.error = true;
       })
     },
-    getPageInfo() {
-      let nodeId = this.nodeId;
-      if( !nodeId ) return;
-      fetch("paper.getnodeinfo", {nodeId}).then((res) => {
-        this.isMain = false
-        this.page = res
-        this.setPage(res);
-        res.title && (document.title = res.title);
-      }).catch((res) => {
-        console.log("catch", res);
-        this.loading = false;
-        this.error = true;
-      })
-    },
     back(){
       this.$router.back();
     }