Handy_Cao 3 년 전
부모
커밋
1b8c1288ca
4개의 변경된 파일93개의 추가작업 그리고 9개의 파일을 삭제
  1. 36 1
      src/business/news/index.ts
  2. 21 8
      src/packages/mobile/views/news/list/index.vue
  3. 7 0
      src/services/api/news/index.ts
  4. 29 0
      src/types/model/news.d.ts

+ 36 - 1
src/business/news/index.ts

@@ -1,6 +1,6 @@
 import { shallowRef } from 'vue'
 import { useDataTable } from '@/hooks/datatable'
-import { querySiteColumnDetail } from '@/services/api/news'
+import { querySiteColumnDetail, querySiteColumnConfig } from '@/services/api/news'
 
 // 新闻资讯列表
 export function useSiteColumnDetail() {
@@ -35,4 +35,39 @@ export function useSiteColumnDetail() {
         pageCount,
         getSiteColumnDetail,
     }
+}
+
+// 查询资讯栏目配置
+export function useSiteColumnConfig() {
+  
+    const { dataList, total, pageIndex, pageSize, pageCount } = useDataTable<Model.SiteColumnConfigRsp>()
+    const loading = shallowRef(false)
+    
+    const getSiteColumnConfig = (columntype?: number) => {
+        loading.value = true
+        return querySiteColumnConfig({
+            data: {
+                columntype: columntype,
+                page: pageIndex.value,
+                pagesize: pageSize.value,
+            },
+            success: (res) => {
+                total.value = res.total
+                dataList.value = res.data
+            },
+            complete: () => {
+                loading.value = false
+            }
+        })
+    }
+
+    return {
+        loading,
+        dataList,
+        total,
+        pageIndex,
+        pageSize,
+        pageCount,
+        getSiteColumnConfig,
+    }
 }

+ 21 - 8
src/packages/mobile/views/news/list/index.vue

@@ -4,13 +4,7 @@
       <app-navbar title="市场资讯" />
     </template>
     <Tabs v-model:active="active" @click-tab="onClickTab">
-      <Tab title="宏观新闻">
-        <Empty v-if="empty" />
-      </Tab>
-      <Tab title="行业动态">
-        <Empty v-if="empty" />
-      </Tab>
-      <Tab title="厂家信息">
+      <Tab v-for="(item, index) in configs" :key="index" :title="item.columnname">
         <Empty v-if="empty" />
       </Tab>
     </Tabs>
@@ -31,20 +25,39 @@ import { ref, shallowRef } from 'vue'
 import { Cell, Tab, Tabs, Empty } from 'vant'
 import { formatDate } from '@/filters'
 import { useSiteColumnDetail } from '@/business/news'
+import { querySiteColumnConfig } from '@/services/api/news'
 import AppPullRefresh from '@mobile/components/base/pull-refresh/index.vue'
 
 /// tab激活项
 const active = ref(0);
 const empty = shallowRef(false)
+const configs = shallowRef<Model.SiteColumnConfigRsp[]>([])
+const config = shallowRef<Model.SiteColumnConfigRsp>({})
 
 const { dataList, pageIndex, pageCount, getSiteColumnDetail } = useSiteColumnDetail()
 /// Tab触发
 const onClickTab = (e) => {
   active.value = e.name
+  /// 设置选中的数据
+  if (configs.value.length>0) {
+    config.value = configs.value[e.name]
+  }
+  getSiteColumnDetail(config.value.id)
 }
 
+/// 查询栏目配置
+querySiteColumnConfig({
+  success: (res) => {
+    configs.value = res.data
+    /// 默认第一个
+    if (res.data.length > 0) {
+      config.value = res.data[0]
+    }
+  }
+})
+
 const onRefresh = (callback: () => void) => {
-  getSiteColumnDetail(active.value).finally(() => callback())
+  getSiteColumnDetail(config.value.id).finally(() => callback())
 }
 
 const onUpdated = (lists: Model.THJProductRsp[]) => {

+ 7 - 0
src/services/api/news/index.ts

@@ -6,4 +6,11 @@ import { HttpParams } from '@/services/http/interface'
  */
 export function querySiteColumnDetail(params: HttpParams<{ req: Model.SiteColumnDetailReq, rsp: Model.SiteColumnDetailRsp[] }>) {
     return httpRequest('/WrTrade2/QuerySiteColumnDetail', 'get', params);
+}
+
+/**
+ * 查询资讯栏目配置
+ */
+ export function querySiteColumnConfig(params: HttpParams<{ req: Model.SiteColumnConfigReq, rsp: Model.SiteColumnConfigRsp[] }>) {
+    return httpRequest('/WrTrade2/QuerySiteColumnConfig', 'get', params);
 }

+ 29 - 0
src/types/model/news.d.ts

@@ -19,4 +19,33 @@ declare namespace Model {
         title: string; // 标题
         updatedate: string; // 修改时间
     }
+
+     /** 查询资讯栏目配置 请求 */
+     interface SiteColumnConfigReq {
+        page?: number; // 页码
+        pagesize?: number; // 每页条数
+        columntype?: number; // 栏目类型 - 1:行情资讯 10:会员服务 30:关于我们 100:核心企业栏目-百色
+    }
+
+    /** 查询资讯栏目配置 响应 */
+    interface SiteColumnConfigRsp {
+        // 栏目名称
+        columnname: string
+        // 栏目类型 - 1:行情资讯 10:会员服务 30:关于我们 100:核心企业栏目-百色
+        columntype: number
+        // 创建时间
+        creaedate: string
+        // 创建人
+        creatorid: number
+        // ID(SEQ_SITE_COLUMNCONFIG)
+        id: number
+        // 是否展示 - 0:不展示 1:展示
+        isshow: number
+        // 操作人
+        modifierid: number
+        // 排序
+        sort: number
+        // 修改时间
+        updatedate: string
+    }
 }