From edf80bea2877255158263a7e8384cf3f921c984a Mon Sep 17 00:00:00 2001
From: "@fawn-nine" <1271023382@qq.com>
Date: Tue, 21 May 2024 16:29:23 +0800
Subject: [PATCH] 0521
---
pages/peanut/home.vue | 236 ++++++++++++++++++++++++++++--------------
pages/user/login.vue | 29 ++++--
2 files changed, 181 insertions(+), 84 deletions(-)
diff --git a/pages/peanut/home.vue b/pages/peanut/home.vue
index af31ae7..53bafaa 100644
--- a/pages/peanut/home.vue
+++ b/pages/peanut/home.vue
@@ -133,7 +133,7 @@
新书上市
-->
-
+
@@ -141,7 +141,7 @@
@click="yxTabsChange(item,index)">{{item.title}}
-
+
@@ -237,18 +237,19 @@
-
-
+
+
{{item.title}}
-
-
-
- {{item.title}}
-
-
+
+
+
+ {{item.title}}
+
+
@@ -264,7 +265,7 @@
¥{{item.activityPrice}}
+ v-if="item.activityPrice && item.activityPrice > 0">¥{{item.activityPrice}}
¥{{item.price}}
已售:{{item.sum_sales}} 件
@@ -329,7 +330,7 @@
'../../static/icon/home_ban_2.jpg',
'../../static/icon/home_ban_3.jpg',
],
- yingxiaoTags:[ // 营销标签列表
+ yingxiaoTags: [ // 营销标签列表
],
xinsList: [],
loadingNow: false,
@@ -341,17 +342,17 @@
bgiStyle: {
background: '#fff'
},
- YXBookList: [],
- catTagList:[ // 分类标签
+ YXBookList: [],
+ catTagList: [ // 分类标签
],
- curChildrenId:0,
+ curChildrenId: 0,
iconStyle: {
fontSize: '40rpx',
fontWeight: 'bold',
color: '#54a966',
},
tagList: [], // 推荐标签列表
- childrenCatList:[], // 二级分类
+ childrenCatList: [], // 二级分类
wztaglist: [{
splId: "-1",
labelName: "全部"
@@ -394,7 +395,8 @@
tjProList: [],
status: 3,
userMsg: {}, // 用户信息
- yxCurIndex:0, // 当前营销标签序号
+ yxCurIndex: 0, // 当前营销标签序号
+ SystemInfoSync: {}, // 屏幕尺寸
};
},
onPageScroll(e) {
@@ -409,7 +411,7 @@
},
onHide() {
this.page = 1
- this.tjProList = []
+ // this.tjProList = []
// if(this.tagList.length > 0){
// this.tabsid = this.tagList[0].splId
// }
@@ -417,24 +419,32 @@
//页面显示
onShow() {
// 隐藏原生的tabbar
- this.tjProList = []
- uni.hideTabBar();
- this.getData();
- this.getTags()
- this.getUserInfo()
- this.getYXTgs()
+ // this.getUserInfo()
+ // this.tjProList = []
+ // uni.hideTabBar();
+ // this.getData();
+ // this.getTags()
+ // this.getYXTgs()
+ this.requestAll()
+ },
+ onTabItemTap() {
+
},
// 页面加载完毕
onReady() {
// this.requestIapOrder()
+ // console.log(uni.getSystemInfoSync(), '屏幕')
+ },
+ mounted() {
+ this.requestAll()
},
// 下拉刷新
onPullDownRefresh() {
this.page = 1
this.tjProList = []
- this.getData()
- this.getTags()
this.getUserInfo()
+ // this.getData()
+ this.getTags()
this.getYXTgs()
// this.requestIapOrder()
uni.stopPullDownRefresh()
@@ -475,37 +485,52 @@
//方法
methods: {
...mapMutations(['setUserInfo']),
+ requestAll() {
+ this.getUserInfo()
+ this.tjProList = []
+ uni.hideTabBar();
+ // this.getData();
+ this.getTags()
+ this.getYXTgs()
+ },
// 获取营销标签列表
- getYXTgs(){
+ getYXTgs() {
this.$http
.post('book/labelAndMarket/marketTree')
.then(res => {
- console.log(res, '营销标签列表')
- if(res.result.length > 0){
+ // console.log(res, '营销标签列表')
+ if (res.result.length > 0) {
this.yingxiaoTags = res.result
this.getYXproducts()
- }
-
+ }
+
// console.log(res)
});
},
// ...mapMutations(['setLoadingShow']),
// 获取对应营销商品列表
- getYXproducts(item){
+ getYXproducts(item) {
var tag_id = null
- if(!item){
- console.log('没有传参')
+ if (!item) {
+ /// console.log('没有传参')
tag_id = this.yingxiaoTags[0].id
- }else{
+ } else {
tag_id = item.id
- }
+ }
this.$http
- .post('book/labelAndMarket/getShopProductListByMarketId',{
- 'marketId':tag_id
+ .post('book/labelAndMarket/getShopProductListByMarketId', {
+ 'marketId': tag_id
})
.then(res => {
- console.log(res.result, '营销商品列表')
- this.YXBookList = res.result
+ if (res.code == 0 && res.result.length > 0) {
+ this.YXBookList = res.result
+ }else{
+ this.YXBookList = []
+ }
+ // console.log(res.result, '营销商品列表')
+
+ }).catch( e =>{
+ this.YXBookList = []
});
},
// 获取用户详情
@@ -520,7 +545,7 @@
// }
},
// 获取商品标签
- getTags() {
+ getTags() {
this.loadingNow = false
this.$http
.post('book/labelAndMarket/labelTree')
@@ -529,36 +554,36 @@
if (res.code == 0 && res.result.length > 0) {
this.catTagList = res.result
this.tabsid = this.catTagList[0].id
- if(this.catTagList[0].isLast == 1){
+ if (this.catTagList[0].isLast == 1) {
this.getJtData(this.catTagList[0].id)
- }else{
+ } else {
this.childrenCatList = this.catTagList[0].children
this.curChildrenId = this.childrenCatList[0].id
this.getJtData(this.childrenCatList[0].id)
}
-
+
}
}).catch(e => {
console.log(e, 'e')
});
},
// 二级分类点击
- childrenChange(item,index){
+ childrenChange(item, index) {
// console.log(item,this.curChildrenId,'点击')
this.curChildrenId = this.childrenCatList[index].id
this.getJtData(this.childrenCatList[index].id)
},
- tabsChange(item,cindex) {
- this.tjProList = []
+ tabsChange(item, cindex) {
+ // this.tjProList = []
this.tabsid = item.id
- this.childrenCatList = []
- if(this.catTagList[cindex].isLast == 1){
+ this.childrenCatList = []
+ if (this.catTagList[cindex].isLast == 1) {
this.getJtData(this.catTagList[cindex].id)
- }else{
+ } else {
this.childrenCatList = this.catTagList[cindex].children
this.curChildrenId = this.childrenCatList[0].id
this.getJtData(this.childrenCatList[0].id)
-
+
}
// this.getJtData()
// if (this.tabsid == 15) {
@@ -570,9 +595,9 @@
// }
// this.page = 1
// // 获取推荐数据
-
+
},
- yxTabsChange(item,index) {
+ yxTabsChange(item, index) {
// this.yxtaglist = []
this.yxCurIndex = index
this.getYXproducts(item)
@@ -582,41 +607,42 @@
this.wztabsid = item.splId
this.page = 1
// 获取推荐数据
- this.getJtData()
+ // this.getJtData()
},
- getJtData(cid) {
- this.tjProList = []
+ getJtData(cid) {
+
this.$http
// .post('book/label/list',{
.post('book/labelAndMarket/getShopProductListByLabelId', {
- 'labelId': cid
+ 'labelId': cid
})
.then(res => {
if (res.code == 0 && res.result.length > 0) {
this.tjProList = res.result
- }
- else {
+ } else {
+ this.tjProList = []
this.status = 3
}
}).catch(e => {
+ this.tjProList = []
console.log(e, '商品分类列表报错')
});
},
// 获取折扣图书
- getOffSale() {
- this.$http
- .post('book/shopproduct/listactivityprice?limit=10&page=1')
- .then(res => {
- console.log(res, '折扣')
- if (res.code == 0 && res.page.list.length > 0) {
- this.offSaleList = res.page.list
- this.tabsNumber = 0
- }
+ // getOffSale() {
+ // this.$http
+ // .post('book/shopproduct/listactivityprice?limit=10&page=1')
+ // .then(res => {
+ // console.log(res, '折扣')
+ // if (res.code == 0 && res.page.list.length > 0) {
+ // this.offSaleList = res.page.list
+ // this.tabsNumber = 0
+ // }
- }).catch(e => {
- console.log(e, 'e')
- });
- },
+ // }).catch(e => {
+ // console.log(e, 'e')
+ // });
+ // },
// 新书上市
// getNewBook() {
// this.$http
@@ -788,7 +814,7 @@
},
// 获取列表数据
getData() {
-
+
// 获取限时秒杀
// this.$http
@@ -882,13 +908,39 @@