From d1ff7bacc5dfaae256e36c9b8843bc16410bfd95 Mon Sep 17 00:00:00 2001 From: WeiRan <2392355487@qq.com> Date: Mon, 26 Aug 2024 14:01:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=A7=E5=93=81=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/market/product.js | 10 ++ src/views/market/product/index.vue | 142 +++++++++++++++++++++-------- 2 files changed, 114 insertions(+), 38 deletions(-) diff --git a/src/api/market/product.js b/src/api/market/product.js index d19c399..303f2bc 100644 --- a/src/api/market/product.js +++ b/src/api/market/product.js @@ -7,3 +7,13 @@ export function selectList(data){ data: data }) } + + +export function selectTypeList(data){ + return request({ + url:"/market/product/typeList", + method: "POST", + data: data + }) +} + diff --git a/src/views/market/product/index.vue b/src/views/market/product/index.vue index ebd0dc4..9103ae9 100644 --- a/src/views/market/product/index.vue +++ b/src/views/market/product/index.vue @@ -1,41 +1,66 @@ @@ -45,7 +70,7 @@ //例如:import 《组件名称》 from '《组件路径》, -import {selectList} from "@/api/market/product"; +import {selectList, selectTypeList} from "@/api/market/product"; export default { name: 'Product', @@ -55,12 +80,17 @@ export default { data() { //这里存放数据" - return { //产品列表 productList:[], product:{}, - ruleForm:{}, + ruleForm:{ + pageNum:1, + pageSize:9, + productType:'' + }, + total:0, + typeList:[] }; }, //计算属性 类似于data概念", @@ -72,13 +102,25 @@ export default { //产品列表 getList(){ selectList(this.ruleForm).then(response=>{ - this.productList=response.data + console.log(response) + this.productList=response.data.productListResps + this.total=response.data.total }) }, //查询 submitForm(){ this.getList() }, + //选择类型 + chosetype(index1){ + this.ruleForm.productType=this.typeList[index1] + this.getList() + }, + //选择全部 + choseall(){ + this.ruleForm.productType='' + this.getList() + }, //接口测试页面 // test(product){ // // let url = `http://21.12.0.10/prod-api/doc.html#/cloud-market/客户控制层/findListByuserPhone?userId=${this.userId}`; @@ -95,11 +137,28 @@ export default { console.error('无效的 address 或 product 未定义'); // 或者您可以根据需要处理错误情况 } + }, + handleSizeChange(val) { + console.log(`每页 ${val} 条`); + this.ruleForm.pageSize=val + this.getList() + }, + handleCurrentChange(val) { + console.log(`当前页: ${val}`); + this.ruleForm.pageNum=val + this.getList() + }, + //产品类型 + gettypeList(){ + selectTypeList().then(response=>{ + this.typeList=response.data + }) } }, //生命周期 - 创建完成(可以访问当前this实例)", created() { this.getList() + this.gettypeList() }, //生命周期 - 挂载完成(可以访问DOM元素)", mounted() { @@ -124,7 +183,14 @@ export default { .box-card{ margin: 10px 0; } -/*.box-card:not(:last-child) {*/ -/* margin-bottom: 20px; !* 你可以根据需要调整这个值 *!*/ -/*}*/ +.el-header { + background-color: #B3C0D1; + color: #333; + line-height: 60px; +} + +.el-aside { + color: #333; +} +