huaisianhuang il y a 3 ans
Parent
commit
4aca0af1dc
2 fichiers modifiés avec 19 ajouts et 33 suppressions
  1. 2 0
      public/index.html
  2. 17 33
      src/views/Home.vue

+ 2 - 0
public/index.html

@@ -5,6 +5,8 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp"
+    crossorigin="anonymous">
     <title><%= htmlWebpackPlugin.options.title %></title>
   </head>
   <body>

+ 17 - 33
src/views/Home.vue

@@ -134,10 +134,8 @@ export default {
                 return false;
             }
         },
-        getData() {
-            const vm = this;
-            this.isLoading = true;
-            this.$http.get('http://www.googo.org:8050/api/get_2020_marketing_cal').then(res => {
+        getcalData() {
+          this.$http.get('http://www.googo.org:8050/api/get_2020_marketing_cal').then(res => {
                 console.log(res.data);
                 this.json = res.data;
                 this.json.splice(34);
@@ -157,41 +155,25 @@ export default {
                 })
                 console.log(this.json[2]);
             });
+        },
+        getData() {
+            const vm = this;
+            this.isLoading = true;
             this.$http.get('http://www.googo.org:8050/api/group_datas/').then(res => {
-                this.group_datas = res.data;
-                //console.log(this.group_datas);
-               // this.trends = this.json.filter(item => item['data_type'] === 'trends');
-                //this.keywords = this.json.filter(item => item['data_type'] === 'suggests');
-                
-            });
-            this.$http.get('http://www.googo.org:8050/api/user_groups/').then(res => {
+              this.group_datas = res.data;
+              vm.$http.get('http://www.googo.org:8050/api/user_groups/').then(res => {
                 //console.log(res.data);
-                this.user_groups = res.data;
-                this.user_groups.forEach(item => {
-                    this.group_datas.forEach(d => {
+                vm.user_groups = res.data;
+                vm.user_groups.forEach(item => {
+                    vm.group_datas.forEach(d => {
                         if(d.group_id === item.id) {
                             d.group_chinese_name = item.group_chinese_name;
                         }
                     })
                 });
-                /* this.trends = this.group_datas.filter(item => item['data_type'] === 'trends');
-                 this.keywords = this.group_datas.filter(item => item['data_type'] === 'suggests');
-                this.trends.forEach(item => { 
-                    item.times = this.GetObjVal(item.data.data);
-                    let newD = [];
-                    item.times.forEach((k, i) => {
-                        if(i%3===0){
-                            newD.push([]);
-                        }
-                        const page = parseInt(i/3);
-                        newD[page].push({times:k});
-                        console.log(newD);
-                        item.final = newD;
-                    });
-                }); */
-                this.user_groups.forEach(item => {
+                vm.user_groups.forEach(item => {
                     let arr = [];
-                    this.group_datas.forEach(d => {
+                    vm.group_datas.forEach(d => {
                         if(d.group_id == item.id) {
                             if(d['data_type'] == 'suggests') {
                                 arr.push({start: d.start, end: d.end, words: d.data.data});
@@ -203,8 +185,9 @@ export default {
                             }
                         }
                     })
+                    arr.reverse();
                 });
-                this.user_groups.forEach(item => {
+                vm.user_groups.forEach(item => {
                     if(item.trends) {
                         const temp = this.GetObjVal(item.trends);
                         let newD = [];
@@ -228,6 +211,7 @@ export default {
                 console.log(this.user_groups);
                 this.isLoading = false;
             })
+            });
         },
         mergeData() {
             this.user_groups.forEach(item => {
@@ -282,7 +266,7 @@ export default {
       this.selected = 3;
     };
     this.getData();
-    //this.getPack();
+    this.getcalData();
   },
 };
 </script>