瀏覽代碼

拉取代码

zhuxinbo 5 年之前
父節點
當前提交
daf0adb919
共有 1 個文件被更改,包括 118 次插入73 次删除
  1. 118 73
      src/views/modules/headerLibrary/index.vue

+ 118 - 73
src/views/modules/headerLibrary/index.vue

@@ -1,35 +1,37 @@
 <style lang="scss" scoped>
-.search-box p {
-  display: inline-block;
-  border: 1px solid #f2f2f2;
-  border-radius: 5px;
-  margin-right: 10px;
-  padding: 5px 10px;
-  cursor: pointer;
-}
-#office-iframe {
-  height: 800px;
-}
+  .search-box p {
+    display: inline-block;
+    border: 1px solid #f2f2f2;
+    border-radius: 5px;
+    margin-right: 10px;
+    padding: 5px 10px;
+    cursor: pointer;
+  }
+
+  #office-iframe {
+    height: 800px;
+  }
 </style>
 <template>
   <a-row :gutter="10">
     <a-col :sm="10" style="margin-bottom: 20px;z-index: 10">
       <a-card class="search-box" style="min-height:500px">
         <div>
-          行业
-          <a-cascader
-            style="margin-top: 1rem;width:300px"
-            :options="options"
-            :showSearch="{ filter }"
-            expandTrigger="hover"
-            @change="onChange"
-            placeholder="请选择行业"
-          >
+
+          <span style="width:100px;display:inline-block">行业</span>
+          <a-cascader style="margin-top: 1rem;width:300px" :options="options" :showSearch="{ filter }"
+            expandTrigger="hover" @change="onChange" placeholder="请选择行业">
             <a-icon type="smile" slot="suffixIcon" class="test" />
           </a-cascader>
         </div>
 
-        关键词
+        <span style="width:100px;display:inline-block">关键词</span>
+        <a-select style="width: 300px" @change="handleChange" @search="fetchUser" :filterOption="true">
+          <a-select-opt-group>
+            <span slot="label">Manager</span>
+            <a-select-option v-for="d in data" :key="d">{{d}}</a-select-option>
+          </a-select-opt-group>
+        </a-select>
       </a-card>
     </a-col>
     <a-col :sm="14" style="margin-bottom: 20px;z-index: 10">
@@ -39,59 +41,102 @@
 </template>
 
 <script>
-import { getAction, postAction } from '@/api/manage'
-import moment from 'moment'
-import $ from 'jquery'
-import qs from 'qs'
+  import {
+    getAction,
+    postAction
+  } from '@/api/manage'
+  import moment from 'moment'
+  import $ from 'jquery'
+  import qs from 'qs'
 
-export default {
-  name: 'online-training-list',
-  data() {
-    return {
-      options: []
-    }
-  },
-  components: {},
-  methods: {
-    getHangye() {
-      getAction('/ctop/creativeTitle/getTitleLabel', '').then(res => {
-        console.log(res)
-        if (res.success) {
-          this.options = res.result.map(item => {
-            return {
-              label: item.label,
-              value: item.value,
-              children:
-                item.children.length > 0
-                  ? [{ label: '不限', value: 0 }].concat(item.children)
-                  : [{ label: '不限', value: 0 }]
-            }
-          })
-        }
-      })
-    },
-    onChange(value, selectedOptions) {
-      console.log(value, selectedOptions)
+  export default {
+    name: 'online-training-list',
+    data() {
+      return {
+        options: [],
+        fetching: false,
+        value: [],
+        data: []
+      }
     },
-    getTitle() {
-      // /ctop/creativeTitle/titleSearch
-      getAction('/ctop/creativeTitle/titleSearch', { firstCategory: 1, secondCategory: 0, keywords: '游戏' }).then(
-        res => {
+    components: {},
+    methods: {
+      getHangye() {
+        getAction('/ctop/creativeTitle/getTitleLabel', '').then(res => {
           console.log(res)
-        }
-      )
-      // firstCategory,secondCategory,keywords
+          if (res.success) {
+            this.options = res.result.map(item => {
+              return {
+                label: item.label,
+                value: item.value,
+                children: item.children.length > 0 ? [{
+                  label: '不限',
+                  value: 0
+                }].concat(item.children) : [{
+                  label: '不限',
+                  value: 0
+                }]
+              }
+            })
+          }
+        })
+      },
+      onChange(value, selectedOptions) {
+        console.log(value, selectedOptions)
+      },
+      getTitle() {
+        // /ctop/creativeTitle/titleSuggestion
+        getAction('/ctop/creativeTitle/titleSearch', {
+          firstCategory: 1,
+          secondCategory: 0,
+          keywords: '游戏'
+        }).then(
+          res => {
+            console.log(res)
+          }
+        )
+        // firstCategory,secondCategory,keywords
+      },
+      getHangyeTitle() {
+        getAction('/ctop/creativeTitle/titleSuggestion', {
+          firstCategory: 1,
+          secondCategory: 0,
+          keywords: '游戏'
+        }).then(
+          res => {
+            console.log(res)
+          }
+        )
+      },
+      fetchUser(value) {
+        console.log('fetching user', value);
+        this.data = [];
+        this.fetching = true;
+
+        getAction('/ctop/creativeTitle/titleSuggestion', {
+          firstCategory: 1,
+          secondCategory: 0,
+          keywords: '游戏'
+        }).then(
+          res => {
+            this.data = res.result;
+            this.fetching = false;
+          }
+        )
+      },
+      handleChange(value) {
+        console.log(`selected ${value}`);
+      },
+      filter(inputValue, path) {
+        return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
+      }
+    },
+    mounted() {
+      this.$nextTick(() => {
+        this.getHangye()
+        this.getHangyeTitle()
+      })
     },
-    filter(inputValue, path) {
-      return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
-    }
-  },
-  mounted() {
-    this.$nextTick(() => {
-      this.getHangye()
-      this.getTitle()
-    })
-  },
-  created() {}
-}
-</script>
+    created() {}
+  }
+</script>