zs 1 year ago
parent
commit
37cbab9ca5
3 changed files with 138 additions and 67 deletions
  1. 14 36
      src/views/innovation/detail.vue
  2. 108 31
      src/views/innovation/index.vue
  3. 16 0
      src/views/release/parts/match.vue

+ 14 - 36
src/views/innovation/detail.vue

@@ -6,12 +6,7 @@
           <el-col :span="24" class="one">
             <el-row :span="24" class="list">
               <el-col :span="4" class="left">
-                <el-image
-                  v-if="info.file && info.file.length > 0"
-                  class="image"
-                  :src="info.file[0].url"
-                  fit="fill"
-                />
+                <el-image v-if="info.file && info.file.length > 0" class="image" :src="info.file[0].url" fit="fill" />
                 <el-image v-else class="image" :src="news" fit="fill" />
               </el-col>
               <el-col :span="18" class="right">
@@ -22,13 +17,10 @@
                   <span class="type">{{ getDict(info.form, 'form') }}</span>
                   <span class="title">{{ info.name || '暂无比赛名称' }}</span>
                 </el-col>
-                <el-col :span="24" class="right_2">
-                  组织单位:{{ info.organization || '暂无组织单位' }}
-                </el-col>
+                <el-col :span="24" class="right_2"> 组织单位:{{ info.organization || '暂无组织单位' }} </el-col>
+                <el-col :span="24" class="right_2"> 行业:{{ getDict(info.industry, 'industry') }} </el-col>
                 <el-col :span="24" class="right_3">
-                  <el-col :span="20" class="right_3Left">
-                    比赛日期:{{ getTime(info.time) }}
-                  </el-col>
+                  <el-col :span="20" class="right_3Left"> 比赛日期:{{ getTime(info.time) }} </el-col>
                   <el-col :span="4" class="right_3Right">
                     {{ info.money || '免费' }}
                   </el-col>
@@ -63,11 +55,7 @@
               <el-container style="height: 500px">
                 <el-aside width="200px">
                   <el-menu default-active="rules1" class="el-menu" @select="selectOpen">
-                    <el-menu-item
-                      :index="item.label"
-                      v-for="(item, index) in menuList"
-                      :key="index"
-                    >
+                    <el-menu-item :index="item.label" v-for="(item, index) in menuList" :key="index">
                       <el-icon><Opportunity /></el-icon>
                       <span>{{ item.title }}</span>
                     </el-menu-item>
@@ -88,23 +76,12 @@
           <el-col :span="24" class="thr">
             <el-col :span="24" class="thr_1"> 相关推荐 </el-col>
             <el-col :span="24" class="thr_2">
-              <el-col
-                :span="11"
-                class="list"
-                v-for="(item, index) in list"
-                :key="index"
-                @click="toView(item)"
-              >
+              <el-col :span="11" class="list" v-for="(item, index) in list" :key="index" @click="toView(item)">
                 <div class="join" :class="[item.match_status == '0' ? 'join0' : 'join1']">
                   {{ getDict(item.match_status, 'status') }}
                 </div>
                 <el-col :span="6" class="left">
-                  <el-image
-                    v-if="item.file && item.file.length > 0"
-                    class="image"
-                    :src="item.file[0].url"
-                    fit="fill"
-                  />
+                  <el-image v-if="item.file && item.file.length > 0" class="image" :src="item.file[0].url" fit="fill" />
                   <el-image v-else class="image" :src="news" fit="fill" />
                 </el-col>
                 <el-col :span="18" class="right">
@@ -112,13 +89,9 @@
                     <span class="type">{{ getDict(item.form, 'form') }}</span>
                     <span class="title">{{ item.name || '暂无比赛名称' }}</span>
                   </el-col>
-                  <el-col :span="24" class="right_2">
-                    组织单位:{{ item.organization || '暂无组织单位' }}
-                  </el-col>
+                  <el-col :span="24" class="right_2"> 组织单位:{{ item.organization || '暂无组织单位' }} </el-col>
                   <el-col :span="24" class="right_3">
-                    <el-col :span="16" class="right_3Left">
-                      比赛日期:{{ getTime(item.time) }}
-                    </el-col>
+                    <el-col :span="16" class="right_3Left"> 比赛日期:{{ getTime(item.time) }} </el-col>
                     <el-col :span="8" class="right_3Right">
                       {{ item.money || '免费' }}
                     </el-col>
@@ -172,6 +145,7 @@ const statusList = ref([])
 const typeList = ref([])
 const formList = ref([])
 const cardTypeList = ref([])
+const industryList = ref([])
 const menuList = ref([
   { title: '大赛背景', label: 'rules1' },
   { title: '大赛主题和目标', label: 'rules2' },
@@ -241,6 +215,9 @@ const searchOther = async () => {
   // 证件类型
   result = await dictDataStore.query({ code: 'cardType', is_use: '0' })
   if ($checkRes(result)) cardTypeList.value = result.data
+  // 赛事行业
+  result = await dictDataStore.query({ code: 'matchIndustry', is_use: '0' })
+  if ($checkRes(result)) industryList.value = result.data
 }
 const searchMatch = async () => {
   const info = {
@@ -267,6 +244,7 @@ const getDict = (data, model) => {
   let res
   if (model == 'status') res = statusList.value.find((f) => f.value == data)
   else if (model == 'type') res = typeList.value.find((f) => f.value == data)
+  else if (model == 'industry') res = industryList.value.find((f) => f.value == data)
   else if (model == 'form') res = formList.value.find((f) => f.value == data)
   return get(res, 'label')
 }

+ 108 - 31
src/views/innovation/index.vue

@@ -29,20 +29,77 @@
                 </el-input>
               </el-col>
             </el-row>
-            <el-row class="one_2" v-for="(val, indexs) in searchList" :key="indexs">
-              <el-col :span="1" class="left">{{ val.title }}:</el-col>
+            <el-row class="one_2">
+              <el-col :span="1" class="left">状态:</el-col>
               <el-col :span="23" class="right">
                 <a-button
                   class="title"
-                  v-for="(item, index) in val.list"
+                  v-for="(item, index) in statusList"
                   :key="index"
                   type="link"
                   size="samll"
+                  @click="toSelect(item, 'one')"
+                  :class="[item.is_active ? 'show' : '']"
                 >
                   {{ item.label }}
                 </a-button>
               </el-col>
             </el-row>
+            <el-row class="one_2">
+              <el-col :span="1" class="left">技术:</el-col>
+              <el-col :span="23" class="right">
+                <a-button
+                  class="title"
+                  v-for="(item, index) in typeList"
+                  :key="index"
+                  type="link"
+                  size="samll"
+                  @click="toSelect(item, 'two')"
+                  :class="[item.is_active ? 'show' : '']"
+                >
+                  {{ item.label }}
+                </a-button>
+              </el-col>
+            </el-row>
+            <el-row class="one_2">
+              <el-col :span="1" class="left">行业:</el-col>
+              <el-col :span="22" class="right" v-if="oneShow">
+                <a-button
+                  class="title"
+                  v-for="(item, index) in industryList"
+                  :key="index"
+                  type="link"
+                  size="samll"
+                  @click="toSelect(item, 'thr')"
+                  :class="[item.is_active ? 'show' : '']"
+                >
+                  {{ item.label }}
+                </a-button>
+              </el-col>
+              <el-col :span="22" class="right" v-else>
+                <a-button
+                  class="title"
+                  v-for="(item, index) in industryList.slice(0, 12)"
+                  :key="index"
+                  type="link"
+                  size="samll"
+                  @click="toSelect(item, 'thr')"
+                  :class="[item.is_active ? 'show' : '']"
+                >
+                  {{ item.label }}
+                </a-button>
+              </el-col>
+              <el-col :span="1" class="button">
+                <span v-if="!oneShow" @click="oneShow = true">
+                  更多
+                  <el-icon><ArrowDown /></el-icon>
+                </span>
+                <span v-else @click="oneShow = false">
+                  收起
+                  <el-icon><ArrowUp /></el-icon>
+                </span>
+              </el-col>
+            </el-row>
           </el-col>
           <el-col :span="24" class="two">
             <el-row
@@ -122,34 +179,6 @@ const router = useRouter()
 // 加载中
 const loading = ref(false)
 const searchForm = ref({})
-const searchList = ref([
-  {
-    title: '状态',
-    list: [
-      { value: '0', label: '全部' },
-      { value: '1', label: '可报名' },
-      { value: '2', label: '已报名' },
-      { value: '3', label: '不可报名' }
-    ]
-  },
-  {
-    title: '类别',
-    list: [
-      { value: '0', label: '全部' },
-      { value: '1', label: '智能算法' },
-      { value: '2', label: '方案应用' }
-    ]
-  },
-  {
-    title: '技术',
-    list: [
-      { value: '0', label: '数据挖掘' },
-      { value: '1', label: '自然语言处理' },
-      { value: '2', label: '计算机视觉' },
-      { value: '3', label: 'AI其他' }
-    ]
-  }
-])
 // 搜索
 const input = ref('')
 // 列表
@@ -160,6 +189,9 @@ const total = ref(0)
 const typeList = ref([])
 const formList = ref([])
 const statusList = ref([])
+const industryList = ref([])
+// 是否展开
+const oneShow = ref(false)
 // 请求
 onMounted(async () => {
   loading.value = true
@@ -175,9 +207,15 @@ const searchOther = async () => {
   // 类别
   result = await dictDataStore.query({ code: 'matchForm', is_use: '0' })
   if ($checkRes(result)) formList.value = result.data
+  // 赛事行业
+  result = await dictDataStore.query({ code: 'matchIndustry', is_use: '0' })
+  if ($checkRes(result)) industryList.value = result.data
   // 赛事状态
   result = await dictDataStore.query({ code: 'matchStatus', is_use: '0' })
   if ($checkRes(result)) statusList.value = result.data
+  statusList.value.unshift({ value: '-1', label: '全部' })
+  industryList.value.unshift({ value: '-1', label: '全部' })
+  typeList.value.unshift({ value: '-1', label: '全部' })
 }
 const search = async (query = { skip: 0, limit }) => {
   const info = {
@@ -220,6 +258,37 @@ const onSearch = () => {
   else searchForm.value = {}
   search({ skip, limit })
 }
+// 选择查询
+const toSelect = (item, num) => {
+  if (num == 'one') {
+    for (const val of statusList.value) {
+      if (val.value == item.value) val.is_active = true
+      else val.is_active = false
+    }
+  }
+  if (num == 'two') {
+    for (const val of typeList.value) {
+      if (val.value == item.value) val.is_active = true
+      else val.is_active = false
+    }
+  }
+  if (num == 'thr') {
+    for (const val of industryList.value) {
+      if (val.value == item.value) val.is_active = true
+      else val.is_active = false
+    }
+  }
+}
+const currentPage = ref(1)
+// 分页
+const changePage = (page = currentPage.value) => {
+  search({ skip: (page - 1) * limit, limit: limit })
+}
+const sizeChange = (limits) => {
+  limit = limits
+  currentPage.value = 1
+  search({ skip: 0, limit: limit })
+}
 </script>
 <style scoped lang="scss">
 .main {
@@ -256,10 +325,14 @@ const onSearch = () => {
       }
 
       .right {
+        .show {
+          color: #2374ff !important;
+        }
         .title {
           color: #666;
           font-size: 14px;
           line-height: 15px;
+          margin: 0 10px;
           display: inline-block;
           overflow: hidden;
           text-decoration: none;
@@ -269,6 +342,10 @@ const onSearch = () => {
           color: #2374ff;
         }
       }
+      .button {
+        color: #2374ff;
+        font-size: 12px;
+      }
     }
   }
   .two {

+ 16 - 0
src/views/release/parts/match.vue

@@ -50,6 +50,18 @@
               </el-form-item>
             </el-col>
           </el-row>
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-select v-model="form.industry" clearable placeholder="请选择赛事行业">
+                <el-option
+                  v-for="(item, index) in industryList"
+                  :key="index"
+                  :label="item.label"
+                  :value="item.value"
+                />
+              </el-select>
+            </el-col>
+          </el-row>
           <el-row :gutter="20">
             <el-col :span="12">
               <el-form-item label="奖金(万元)" prop="money">
@@ -169,6 +181,7 @@ const statusList = ref([])
 const typeList = ref([])
 const matchList = ref([])
 const formList = ref([])
+const industryList = ref([])
 const rules = reactive({
   name: [{ required: true, message: '请输入赛事名称', trigger: 'blur' }],
   type: [{ required: true, message: '请选择赛事类型', trigger: 'change' }],
@@ -200,6 +213,9 @@ const searchOther = async () => {
   // 赛事状态
   result = await dictDataStore.query({ code: 'matchStatus', is_use: '0' })
   if ($checkRes(result)) matchList.value = result.data
+  // 赛事行业
+  result = await dictDataStore.query({ code: 'matchIndustry', is_use: '0' })
+  if ($checkRes(result)) industryList.value = result.data
 }
 // 上传图片
 const onFUpload = (e) => {