zs преди 8 месеца
родител
ревизия
ae468bf8a3
променени са 5 файла, в които са добавени 89 реда и са изтрити 19 реда
  1. 40 0
      src/store/api/platform/directory.js
  2. 37 6
      src/views/detail/news.vue
  3. 7 6
      src/views/detail/studyDetail.vue
  4. 1 1
      src/views/thirteen/index.vue
  5. 4 6
      src/views/thirteen/list.vue

+ 40 - 0
src/store/api/platform/directory.js

@@ -0,0 +1,40 @@
+import { defineStore } from 'pinia'
+import { AxiosWrapper } from '@/utils/axios-wrapper'
+import { get } from 'lodash-es'
+const url = '/directory'
+const axios = new AxiosWrapper()
+
+export const DirectoryStore = defineStore('directory', () => {
+  const query = async ({ skip = 0, limit = undefined, ...info } = {}) => {
+    let cond = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`${url}`, cond)
+    return res
+  }
+  const fetch = async (payload) => {
+    const res = await axios.$get(`${url}/${payload}`)
+    return res
+  }
+  const create = async (payload) => {
+    const res = await axios.$post(`${url}`, payload)
+    return res
+  }
+  const update = async (payload) => {
+    const id = get(payload, 'id', get(payload, 'id'))
+    const res = await axios.$post(`${url}/${id}`, payload)
+    return res
+  }
+  const del = async (payload) => {
+    const res = await axios.$delete(`${url}/${payload}`)
+    return res
+  }
+  return {
+    query,
+    fetch,
+    create,
+    update,
+    del
+  }
+})

+ 37 - 6
src/views/detail/news.vue

@@ -14,7 +14,12 @@
           </div>
         </el-col>
         <el-col :span="24" class="one_2">
-          <el-col :span="24" class="two">
+          <el-col :span="24" class="one_2_one">
+            <div class="menu" :class="[item.value == active ? 'menuTrue' : '']" v-for="(item, index) in newList" :key="index" @click="toActive(item)">
+              <span>{{ item.label }}</span>
+            </div>
+          </el-col>
+          <el-col :span="24" class="one_2_two">
             <el-col :span="18" class="left">
               <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click="toView(item)">
                 <el-col :span="6" class="left">
@@ -65,7 +70,7 @@
               </el-col>
             </el-col>
           </el-col>
-          <el-col :span="24" class="thr">
+          <el-col :span="24" class="one_2_thr">
             <el-pagination background layout="total, prev, pager, next" :page-sizes="[10, 20, 50, 100, 200]" :total="total" :page-size="limit" v-model:current-page="currentPage" @current-change="changePage" @size-change="sizeChange"> </el-pagination>
           </el-col>
         </el-col>
@@ -98,6 +103,12 @@ const achievementList = ref([])
 const projectList = ref([])
 // 搜索
 const searchForm = ref({})
+const active = ref('0')
+const newList = ref([
+  { value: '0', label: '政策信息' },
+  { value: '1', label: '新闻通知' },
+  { value: '2', label: '行业动态' }
+])
 // 请求
 onMounted(async () => {
   loading.value = true
@@ -124,12 +135,11 @@ const search = async (query = { skip, limit }) => {
   const info = {
     skip: query.skip,
     limit: query.limit,
-
+    type: active.value,
     status: '1',
     is_use: '0',
     ...searchForm.value
   }
-  if (route.query.type) info.type = route.query.type
   const res = await store.query(info)
   if (res.errcode == '0') {
     list.value = res.data
@@ -140,6 +150,10 @@ const search = async (query = { skip, limit }) => {
 const toSearchInfo = async () => {
   await search({ skip, limit })
 }
+const toActive = async (item) => {
+  active.value = item.value
+  await search({ skip, limit })
+}
 // 查看
 const toView = (item) => {
   router.push({ path: `/news/detail`, query: { id: item.id || item._id } })
@@ -209,7 +223,24 @@ const getUrl = (item) => {
       margin-top: 100px !important;
       padding: 30px !important;
       background-color: $global-color-fff;
-      .two {
+      .one_2_one {
+        display: flex;
+        margin: 0 0 20px 0;
+        .menu {
+          padding: 10px 20px;
+          margin: 0 10px 0 0;
+          color: #666666;
+          border: 1px solid #bbbbbb;
+          cursor: default;
+        }
+        .menuTrue {
+          color: $global-color-fff;
+          background: #1073ff;
+          border: none;
+          cursor: default;
+        }
+      }
+      .one_2_two {
         display: flex;
         width: 100%;
         background-color: #fff;
@@ -328,7 +359,7 @@ const getUrl = (item) => {
           }
         }
       }
-      .thr {
+      .one_2_thr {
         display: flex;
         flex-direction: row-reverse;
         padding: 20px;

+ 7 - 6
src/views/detail/studyDetail.vue

@@ -17,7 +17,7 @@
             <div class="table-colunm table-colunm1 textOne">{{ item.client || '暂无' }}</div>
             <div class="table-colunm table-colunm1 textOne">{{ item.partner || '暂无' }}</div>
             <div class="table-colunm table-colunm3 textOne">{{ item.brief || '暂无' }}</div>
-            <!-- <div class="table-colunm button" @click="toView(item)">查看详情</div> -->
+            <div class="table-colunm button" @click="toView(item)">查看详情</div>
           </div>
         </div>
         <div class="twoTotal">
@@ -32,8 +32,8 @@
 // 图片引入
 import lists from '/images/bg-tec-list.jpg'
 // 接口
-import { NotesStore } from '@/store/api/platform/notes'
-const store = NotesStore()
+import { DirectoryStore } from '@/store/api/platform/directory'
+const store = DirectoryStore()
 import { UserStore } from '@/store/user'
 const userStore = UserStore()
 const user = computed(() => userStore.user)
@@ -48,8 +48,8 @@ const column = ref([
   { name: '名称', key: 'name', style: { width: '420px' } },
   { name: '委托方', key: 'client', style: { width: '116px' } },
   { name: '合作方', key: 'partner', style: { width: '116px' } },
-  { name: '研究主旨', key: 'brief', style: { width: '450px' } }
-  // { name: '操作', key: 'operation', style: { width: '216px' } }
+  { name: '研究主旨', key: 'brief', style: { width: '450px' } },
+  { name: '操作', key: 'operation', style: { width: '216px' } }
 ])
 const list = ref([])
 let skip = 0
@@ -65,7 +65,7 @@ const search = async (query = { skip, limit }) => {
   if (route.query.id) {
     skip = query.skip
     limit = query.limit
-    const info = { skip: query.skip, limit: query.limit, is_use: '0', status: '1', journal: route.query.id }
+    const info = { skip: query.skip, limit: query.limit, is_use: '0', status: '1', notes: route.query.id }
     const res = await store.query(info)
     if (res.errcode == '0') {
       list.value = res.data
@@ -75,6 +75,7 @@ const search = async (query = { skip, limit }) => {
 }
 // 查看
 const toView = (item) => {
+  console.log(item)
   // router.push({ path: `/expert/detail`, query: { id: item.id || item._id } })
 }
 const currentPage = ref(1)

+ 1 - 1
src/views/thirteen/index.vue

@@ -53,7 +53,7 @@ const search = async (query = { skip, limit }) => {
 }
 // 查看详情
 const toView = async (item) => {
-  router.push({ path: '/study/detail', query: { id: item.id || item._id } })
+  router.push({ path: '/thirteen/list', query: { id: item.id || item._id } })
 }
 const getUrl = (item) => {
   if (item && item.length > 0) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`

+ 4 - 6
src/views/thirteen/list.vue

@@ -18,8 +18,6 @@
                 </el-col>
                 <el-col :span="24" class="center1">
                   <el-col :span="24" class="title">{{ info.name || '暂无' }}</el-col>
-                  <el-col :span="24" class="other_1" v-if="info.client"> 委托方: {{ info.client || '暂无' }} </el-col>
-                  <el-col :span="24" class="other_1" v-if="info.partner"> 合作方: {{ info.partner || '暂无' }} </el-col>
                   <el-col :span="24" class="other_2">{{ info.brief || '暂无' }}</el-col>
                 </el-col>
                 <el-col :span="24" class="bottom1">
@@ -124,11 +122,11 @@ const search = async (query = { skip, limit }) => {
   if (route.query.id) {
     skip = query.skip
     limit = query.limit
-    const info = { skip: query.skip, limit: query.limit, status: '1', is_use: '0', journal: route.query.id }
-    const res = await store.query(info)
+    const data = { skip: query.skip, limit: query.limit, status: '1', is_use: '0', journal: route.query.id }
+    const res = await store.query(data)
     if (res.errcode == '0') {
+      info.value = res.data[0]
       carouselList.value = res.data.slice(0, 3)
-      info.value = carouselList.value[0]
       list.value = res.data
       total.value = res.total
     }
@@ -136,7 +134,7 @@ const search = async (query = { skip, limit }) => {
 }
 // 轮播图改变
 const toChange = async (e) => {
-  info.value = carouselList.value[e]
+  if (e) info.value = carouselList.value[e]
 }
 // 查看详情
 const toView = async (item) => {