解决冲突

This commit is contained in:
”chenxuelian“
2023-04-18 21:44:35 +08:00
33 changed files with 915 additions and 493 deletions

View File

@@ -24,7 +24,9 @@
</view>
<!-- 分类模块下的轮播图 -->
<view>
<u-swiper :list="swiperList" keyName="img" indicatorMode="line" radius="0" circular></u-swiper>
<u-swiper :list="swiperList" keyName="img" indicatorMode="line" radius="0" circular
@change="e => currentNum = e.current"
@click="handleSwiperList(currentNum==''?0:currentNum,swiperList)"></u-swiper>
</view>
<!-- 选项卡: 上架时间和点赞量 -->
@@ -34,9 +36,9 @@
</u-tabs>
</view>
<!-- 产品 -->
<productsByTime v-if="tabCurrent==0" ref="productsByTime" @getTimeLength="getTimeLength">
<productsByTime v-if="tabCurrent==0 && initStart" ref="productsByTime" @getTimeLength="getTimeLength">
</productsByTime>
<productsByThumb v-if="tabCurrent==1" ref="productsByThumb" @getThumbLength="getThumbLength">
<productsByThumb v-if="tabCurrent==1 && initStart" ref="productsByThumb" @getThumbLength="getThumbLength">
</productsByThumb>
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-show="reachBottomLength===0">
@@ -61,8 +63,10 @@
},
],
imgUrl: '',
initStart: false,
swiperList: [],
reachBottomLength: '',
currentNum: ''
}
},
onReachBottom() {
@@ -75,33 +79,41 @@
this.$refs.productsByThumb.getProductsByThumb()
}
},
onLoad() {
// this.login()
this.getCategories()
this.getBanner()
created() {
this.getImgUrl()
this.imgUrl = uni.getStorageSync('img_url')
},
methods: {
// login() {
// var that = this
// uni.login({
// "provider": "weixin",
// "onlyAuthorize": true, // 微信登录仅请求授权认证
// success: function(event) {
// const {
// code
// } = event
// that.$apiServe.login({
// code: code
// }).then(res => {
// var data = res.data.data
// // console.log('登录code换取的信息', data);
// uni.setStorageSync('token', data.token);
// })
// },
// })
// },
init() {
this.imgUrl = uni.getStorageSync('img_url')
this.getCategories()
this.getBanner()
wx.showShareMenu({
withShareTicket: true,
//设置下方的Menus菜单才能够让发送给朋友与分享到朋友圈两个按钮可以点击
menus: ["shareAppMessage", "shareTimeline"]
})
},
//分享到微信好友
onShareAppMessage(res) {
return {
title: '食瞳',
type: 0,
path: '/pages/index/index?id=' + distSource,
summary: "",
imageUrl: "https://pupil.hchyun.com/uploads/product/zhanwei02.png"
}
},
//分享到朋友圈
onShareTimeline(res) {
return {
title: '食瞳',
type: 0,
query: 'id=' + distSource,
summary: "",
imageUrl: "https://pupil.hchyun.com/uploads/product/zhanwei02.png"
}
},
//获取按上架时间排列的产品列表length
getTimeLength(e) {
this.reachBottomLength = e
@@ -129,12 +141,21 @@
getBanner() {
this.$apiServe.getBanner().then(res => {
let banner = res.data.data
for (const item of banner) {
item.img = this.imgUrl + item.img
if (banner) {
for (const item of banner) {
item.img = this.imgUrl + item.img
}
this.swiperList = res.data.data
}
this.swiperList = res.data.data
}).finally(_ => {})
},
//点击轮播图
handleSwiperList(currentNum, swiperList) {
swiperList[currentNum].link = swiperList[currentNum].link.replace(/\s*/g, "")
uni.navigateTo({
url: '/' + swiperList[currentNum].link
})
},
//点击搜索框跳转到搜索页面
toSearch() {
uni.navigateTo({
@@ -150,12 +171,17 @@
//获取图片url
getImgUrl() {
this.$apiServe.getImgUrl().then(res => {
res.data.data.img_url = res.data.data.img_url + '/'
try {
uni.setStorageSync('img_url', res.data.data.img_url);
this.initStart = true
this.init()
} catch (e) {
// error
}
}).finally(_ => {})
}).finally(_ => {
})
}
}
}