From a582c5e508d4e171fbf633aace6c2dc975ac28bf Mon Sep 17 00:00:00 2001
From: wanghongjun <1445693971@qq,com>
Date: Fri, 22 Mar 2024 17:14:47 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E8=AE=AF=E4=B8=AD=E5=BF=83=E5=BC=80?=
=?UTF-8?q?=E5=8F=91=EF=BC=8C=E5=88=86=E7=B1=BB=E5=85=A8=E9=83=A8=E6=A0=87?=
=?UTF-8?q?=E7=9A=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/category/index.js | 38 ++-
core/app.js | 7 +-
pages.json | 18 +-
pages/category/consulting/detail.vue | 269 ++++++++++++++++++++
pages/category/consulting/list.vue | 344 +++++++++++++++++++++++++
pages/category/index.vue | 359 +++++++++++++++------------
6 files changed, 875 insertions(+), 160 deletions(-)
create mode 100644 pages/category/consulting/detail.vue
create mode 100644 pages/category/consulting/list.vue
diff --git a/api/category/index.js b/api/category/index.js
index 7198be0..7cc810e 100644
--- a/api/category/index.js
+++ b/api/category/index.js
@@ -2,10 +2,46 @@ import request from '@/utils/request'
// api地址
const api = {
- list: 'category/list'
+ list: 'category/list',
+ consultingContextList: 'AgencyAddress/ConsultingContext/getList',
+ consultingContextSelection: 'AgencyAddress/ConsultingContext/getSelection',
+ consultingContextInfo: 'AgencyAddress/ConsultingContext/getInfo',
}
// 页面数据
export function list() {
return request.get(api.list)
}
+
+// 资讯中心列表
+export function consultingContextList(param) {
+ let paramArr = [];
+ for (let key in param) {
+ paramArr.push(key + '=' + param[key])
+ }
+ let paramStr = '?' + paramArr.join('&')
+ return request.get(api.consultingContextList + paramStr)
+}
+
+// 资讯信息详情
+export function consultingContextInfo(contextId) {
+ return request.get(api.consultingContextInfo + '?contextId=' + contextId)
+}
+
+// 获取资讯中心列表分类
+export function consultingContextSelection() {
+ return request.get(api.consultingContextSelection)
+}
+
+/**
+ * 加载更多列表数据
+ * @param {Object} resList 新列表数据
+ * @param {Object} oldList 旧列表数据
+ * @param {int} pageNo 当前页码
+ */
+export const getMoreListData = (resList, oldList, pageNo) => {
+ // 如果是第一页需手动制空列表
+ if (pageNo == 1) oldList = []
+ // 合并新数据
+ return oldList.concat(resList)
+}
\ No newline at end of file
diff --git a/core/app.js b/core/app.js
index a1b0bc3..d6d5f94 100644
--- a/core/app.js
+++ b/core/app.js
@@ -105,7 +105,12 @@ export const navTo = (url, query = {}, modo = 'navigateTo') => {
return true
}
// 生成query参数
- const queryStr = !util.isEmpty(query) ? '?' + util.urlEncode(query) : ''
+ let queryArr = [];
+ for (let key in query) {
+ queryArr.push(key + '=' + query[key])
+ }
+ let paramStr = queryArr.join('&')
+ const queryStr = !util.isEmpty(query) ? '?' + paramStr : ''
// 普通页面, 使用navigateTo
modo === 'navigateTo' && uni.navigateTo({
url: `/${url}${queryStr}`
diff --git a/pages.json b/pages.json
index 7404a85..82cae8c 100644
--- a/pages.json
+++ b/pages.json
@@ -37,7 +37,23 @@
{
"path": "pages/category/index",
"style": {
- "navigationBarTitleText": "全部分类"
+ "navigationBarTitleText": "全部分类",
+ "navigationBarTextStyle": "white",
+ "navigationBarBackgroundColor": "#1c223b"
+ }
+ },
+ {
+ "path": "pages/category/consulting/list",
+ "style": {
+ "navigationBarTitleText": "资讯中心",
+ "enablePullDownRefresh" : false
+ }
+ },
+ {
+ "path": "pages/category/consulting/detail",
+ "style": {
+ "navigationBarTitleText": "阅读全文",
+ "enablePullDownRefresh" : false
}
},
{
diff --git a/pages/category/consulting/detail.vue b/pages/category/consulting/detail.vue
new file mode 100644
index 0000000..b52d988
--- /dev/null
+++ b/pages/category/consulting/detail.vue
@@ -0,0 +1,269 @@
+
+
+
+
+
+
+
+
+
+ {{ item.consultingName }}
+
+
+
+
+
+
+
+
+
+
+ {{list.contextTitle}}
+ 无标题信息
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 暂无数据
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/category/consulting/list.vue b/pages/category/consulting/list.vue
new file mode 100644
index 0000000..ee39b9e
--- /dev/null
+++ b/pages/category/consulting/list.vue
@@ -0,0 +1,344 @@
+
+
+
+
+
+
+
+
+
+ {{ item.consultingName }}
+
+
+
+
+
+
+
+
+
+
+
+ 标题名称:
+ {{item.contextTitle}}
+
+
+ 发布时间:
+ {{item.contextCreationTime}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 暂无数据
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/category/index.vue b/pages/category/index.vue
index 61177da..e6799c5 100644
--- a/pages/category/index.vue
+++ b/pages/category/index.vue
@@ -1,44 +1,60 @@
-
-
+
+
+
+
- {{ item.name }}
+
+
+ {{ item.name }}
+
-
-
-
-
-
-
-
-
-
-
- {{ item.goods_name }}
-
-
-
-
-
-
-
-
-
-
-
- 暂无数据
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {{ item.goods_name }}
+
+
+
+
+
+
+
+
+
+ {{item.consultingName}}
+
+
+
+
+
+
+
+
+
+
+
+
+ 暂无数据
+
+
+
@@ -62,17 +78,20 @@
import { rpx2px,base64ToUint8Array} from '@/utils/util'
import pako from '@/core/pako'
+ import {consultingContextSelection} from "../../api/category";
// 左侧菜单(固定)
const menus = [
- { id: 'all', name: '全部标的数据', type:0},
- { id: 'rs', name: '文化资源数据', type: 1 },
- { id: 'rd', name: '文化数字内容', type: 2 },
+ {name: '全部标的', type:0 },
+ {name: '数据店铺', type: 1 },
+ {name: '资讯中心', type: 2 },
+ {name: '文化数据经纪商', type: 3 },
+ {name: '交易主体', type: 4 },
]
//分页大小
- let limit=30;
+ let limit=4;
// 最后一次刷新时间
let lastRefreshTime;
@@ -94,16 +113,18 @@
setting: {},
// 正在加载中
isLoading: true,
- // 一级分类:指针
- curIndex: 0,
- //默认显示第一页
- page:1,
- // 列表高度
- scrollHeight: 0,
+ // 一级分类:指针
+ curIndex: 0,
+ //默认显示第一页
+ page:1,
+ // 列表高度
+ scrollHeight: 0,
// 内容区竖向滚动条位置
scrollTop: 0,
- // 菜单
- menus,
+ // 菜单
+ menus,
+ type: 0,
+ informationList: [], // 资讯中心selected
}
},
@@ -125,27 +146,24 @@
this.onRefreshPage()
}
},
- created() {
- // 设置分类列表高度
- this.setListHeight()
- },
+ created() {
+ // 设置分类列表高度
+ this.setListHeight()
+ },
methods: {
-
// 设置列表内容的高度
setListHeight() {
const { windowHeight } = uni.getSystemInfoSync()
this.scrollHeight = windowHeight - rpx2px(96)
},
-
// 刷新页面
onRefreshPage() {
// 记录刷新时间
lastRefreshTime = new Date().getTime()
// 获取页面数据
this.getPageData()
- //加载分类数据
- this.getCatList()
-
+ //加载分类数据
+ this.getCatList()
},
// 获取页面数据
@@ -158,99 +176,93 @@
// SettingModel.data(false),
// 获取分类列表
// CategoryApi.list()
- //this.getAllGoods()
+ //this.getAllGoods()
])
.then(result => {
// 初始化分类模板设置
// app.initSetting(result[0])
// 初始化分类列表数据
// app.initCategory(result[1])
- //
})
.finally(() => app.isLoading = false)
},
-
-
-
// 一级分类:选中分类
handleSelectNav(index) {
this.curIndex = index
this.scrollTop = 0
- //
- this.getCatList()
+ this.getCatList()
},
-
- // 展示所有的数据
- getAllGoods(){
- let rd={"goods_status":1,"page":this.page,"limit":limit}
- this.bindData(rd)
- },
-
- // 查询分类 获取列表
- getCatList(){
- console.log("curindex",this.curIndex)
- let item = menus[this.curIndex]
- // console.log(item)
- let type= item.type
+ // 查询分类 获取列表
+ getCatList(){
+ let item = menus[this.curIndex]
+ let type = item.type
+ this.type = type
- if(type>0){
- let rd={"record_type":type,"goods_status":1,"page":this.page,"limit":limit}
- this.bindData(rd)
- }else{
- this.getAllGoods()
- }
+ if (type === 1) {
- },
-
- // 标的详情
- onTargetGoods(gislicode){
- // this.$toast(goodsId)
- this.$navTo('pages/goods/detail', { gislicode })
- },
-
-
- // 绑定数据
- async bindData(rd){
- GoodsApi.nbgoods(rd).then(res=>{
- this.list = res.data.data
- this.page=res.data.current_page
- console.log("res",res)
- this.getHomeListImage()
- });
- //
- //this.initList(this.list)
- },
- async getHomeListImage() {
- this.list.forEach((item, key) => {
- if (item.goods_image === "") {
- GoodsApi.nbgoodsImage({"id": item.id}).then(res2 => {
- if (res2.code === 200) {
- this.list[key].goods_image = res2.data.data[0].goods_image;
- this.list[key].gdimg = pako.inflateRaw(base64ToUint8Array(res2.data.data[0].goods_image), {to: 'string'})
- }
- })
- }
- })
- },
-
- // 处理列表中的特殊字段
- initList(newList) {
- newList.data.forEach(item => {
- item.gdimg = pako.inflateRaw(base64ToUint8Array(item.goods_image), {to: 'string'})
- })
- return newList
- },
+ } else if (type === 2) {
+ this.getConsultingContextSelection()
+ } else if (type === 3) {
+ } else if (type === 4) {
+ } else {
+ let rd={"goods_status":1,"page":this.page,"limit":limit}
+ this.bindData(rd)
+ }
+ },
+ // 标的详情
+ onTargetGoods(gislicode){
+ this.$navTo('pages/goods/detail', { gislicode })
+ },
+ // 标的详情
+ onConsulting(consultingId){
+ this.$navTo('pages/category/consulting/list', { consultingId })
+ },
+ // 全部标的
+ async bindData(rd){
+ GoodsApi.nbgoods(rd).then(res=>{
+ this.list = res.data.data
+ this.page=res.data.current_page
+ this.getHomeListImage()
+ });
+ },
+ async getHomeListImage() {
+ this.list.forEach((item, key) => {
+ if (item.goods_image === "") {
+ GoodsApi.nbgoodsImage({"id": item.id}).then(res2 => {
+ if (res2.code === 200) {
+ this.list[key].goods_image = res2.data.data[0].goods_image;
+ this.list[key].gdimg = pako.inflateRaw(base64ToUint8Array(res2.data.data[0].goods_image), {to: 'string'})
+ }
+ })
+ }
+ })
+ },
+ // 资讯中心
+ getConsultingContextSelection() {
+ const app = this
+ CategoryApi.consultingContextSelection().then(res=>{
+ if (res.resultCode == '00000000') {
+ app.informationList = res.data
+ } else {
+ app.$error('获取资讯信息失败')
+ }
+ });
+ },
+ // 处理列表中的特殊字段
+ initList(newList) {
+ newList.data.forEach(item => {
+ item.gdimg = pako.inflateRaw(base64ToUint8Array(item.goods_image), {to: 'string'})
+ })
+ return newList
+ },
},
- filters:{
- gdimg:function(value){
- return pako.inflateRaw(base64ToUint8Array(value), {to: 'string'})
- }
- }
-
-
-
+ filters:{
+ gdimg:function(value){
+ return pako.inflateRaw(base64ToUint8Array(value), {to: 'string'})
+ }
+ }
}
@@ -262,12 +274,12 @@