Merge pull request '小程序首页第一次打开时图片不显示bug修复' (#93) from dengjie into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/93
This commit is contained in:
odjbin
2023-02-05 10:01:01 +00:00
12 changed files with 33 additions and 34 deletions

View File

@@ -27,8 +27,8 @@
} }
}, },
created() { created() {
this.imgUrl = uni.getStorageSync('img_url')
this.getCertifiedCj() this.getCertifiedCj()
this.imgUrl = uni.getStorageSync('img_url')
}, },
methods: { methods: {
// 获取认证厂家列表 // 获取认证厂家列表

View File

@@ -32,8 +32,8 @@
} }
}, },
created() { created() {
this.imgUrl = uni.getStorageSync('img_url')
this.getNews() this.getNews()
this.imgUrl = uni.getStorageSync('img_url')
}, },
methods: { methods: {
getNews() { getNews() {

View File

@@ -66,8 +66,8 @@
styleIsolation: 'shared', // 解除样式隔离 styleIsolation: 'shared', // 解除样式隔离
}, },
created() { created() {
this.imgUrl = uni.getStorageSync('img_url')
this.getHistoryOrCollection() this.getHistoryOrCollection()
this.imgUrl = uni.getStorageSync('img_url')
}, },
methods: { methods: {
//获取历史记录 //获取历史记录

View File

@@ -53,8 +53,8 @@
// this.sortType = 2 // this.sortType = 2
// } // }
// }) // })
this.imgUrl = uni.getStorageSync('img_url')
this.getProductsByThumb() this.getProductsByThumb()
this.imgUrl = uni.getStorageSync('img_url')
}, },
methods: { methods: {
//获取按点赞量排列的产品列表 //获取按点赞量排列的产品列表

View File

@@ -38,7 +38,7 @@
export default { export default {
data() { data() {
return { return {
imgUrl: '', imgUrl: null,
tagsArray: [], tagsArray: [],
productList: [], productList: [],
pageNum: 1, // 当前页 pageNum: 1, // 当前页
@@ -47,15 +47,8 @@
} }
}, },
created() { created() {
// uni.$on("getCurrent", data => {
// if (data == 0) {
// this.sortType = 1
// } else if (data == 1) {
// this.sortType = 2
// }
// })
this.getProductsByTime()
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
this.getProductsByTime()
}, },
methods: { methods: {
//获取按上架时间排列的产品列表 //获取按上架时间排列的产品列表

View File

@@ -31,8 +31,8 @@
} }
}, },
onLoad() { onLoad() {
this.imgUrl = uni.getStorageSync('img_url')
this.getCertifiedCj() this.getCertifiedCj()
this.imgUrl = uni.getStorageSync('img_url')
}, },
onReachBottom() { onReachBottom() {
this.pageNum++ this.pageNum++

View File

@@ -57,10 +57,10 @@
} }
}, },
onLoad(option) { onLoad(option) {
this.imgUrl = uni.getStorageSync('img_url')
this.id = option.id this.id = option.id
this.getCertifiedCjDetail() this.getCertifiedCjDetail()
this.getCsTel() this.getCsTel()
this.imgUrl = uni.getStorageSync('img_url')
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false this.isLoad = false
return return

View File

@@ -36,8 +36,8 @@
} }
}, },
onLoad() { onLoad() {
this.imgUrl = uni.getStorageSync('img_url')
this.getNews() this.getNews()
this.imgUrl = uni.getStorageSync('img_url')
}, },
onReachBottom() { onReachBottom() {
this.pageNum++ this.pageNum++

View File

@@ -7,7 +7,7 @@
</u-image> </u-image>
<view class="bgContent"> <view class="bgContent">
<view> <view>
<u-image :src="item.cover" width="346rpx" height="320rpx" :lazy-load="true"> <u-image :src="imgUrl+item.cover" width="346rpx" height="320rpx" :lazy-load="true">
</u-image> </u-image>
<view class="img_tag">{{item.cate_name}}</view> <view class="img_tag">{{item.cate_name}}</view>
</view> </view>
@@ -43,10 +43,12 @@
pageNum: 1 pageNum: 1
}, },
queryTitle: null, queryTitle: null,
imgUrl: null,
productList: [] productList: []
} }
}, },
onLoad(options) { onLoad(options) {
this.imgUrl = uni.getStorageSync('img_url')
this.queryTitle = options.title this.queryTitle = options.title
this.goSearch() this.goSearch()
}, },

View File

@@ -124,10 +124,10 @@
} }
}, },
onLoad(option) { onLoad(option) {
this.imgUrl = uni.getStorageSync('img_url')
this.id = option.id this.id = option.id
this.getProductDetail() this.getProductDetail()
this.getCsTel() this.getCsTel()
this.imgUrl = uni.getStorageSync('img_url')
}, },
methods: { methods: {
//获取客服电话 //获取客服电话

View File

@@ -155,6 +155,7 @@
} }
}, },
onTabItemTap() { onTabItemTap() {
this.imgUrl = uni.getStorageSync('img_url')
console.log('----onShow') console.log('----onShow')
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
console.log(uni.getStorageSync('loginToken')) console.log(uni.getStorageSync('loginToken'))
@@ -164,8 +165,6 @@
// }) // })
return return
} }
this.imgUrl = uni.getStorageSync('img_url')
console.log(this.imgUrl)
this.isLoad = true this.isLoad = true
this.token = uni.getStorageSync('loginToken') this.token = uni.getStorageSync('loginToken')
this.tabCurrent = 0 this.tabCurrent = 0
@@ -173,8 +172,6 @@
this.needsPublishForm = {} this.needsPublishForm = {}
}, },
onLoad(options) { onLoad(options) {
console.log('---onLoad')
console.log(options.item)
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
//我的发布点击修改回显数据 //我的发布点击修改回显数据
if (options && options.item && uni.getStorageSync(options.item)) { if (options && options.item && uni.getStorageSync(options.item)) {

View File

@@ -34,9 +34,9 @@
</u-tabs> </u-tabs>
</view> </view>
<!-- 产品 --> <!-- 产品 -->
<productsByTime v-if="tabCurrent==0" ref="productsByTime" @getTimeLength="getTimeLength"> <productsByTime v-if="tabCurrent==0 && initStart" ref="productsByTime" @getTimeLength="getTimeLength">
</productsByTime> </productsByTime>
<productsByThumb v-if="tabCurrent==1" ref="productsByThumb" @getThumbLength="getThumbLength"> <productsByThumb v-if="tabCurrent==1 && initStart" ref="productsByThumb" @getThumbLength="getThumbLength">
</productsByThumb> </productsByThumb>
<view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;" <view style="font-size: 24rpx;color: #A3A3A3;text-align: center;padding: 26rpx 0;"
v-show="reachBottomLength===0"> v-show="reachBottomLength===0">
@@ -61,6 +61,7 @@
}, },
], ],
imgUrl: '', imgUrl: '',
initStart: false,
swiperList: [], swiperList: [],
reachBottomLength: '', reachBottomLength: '',
} }
@@ -75,18 +76,20 @@
this.$refs.productsByThumb.getProductsByThumb() this.$refs.productsByThumb.getProductsByThumb()
} }
}, },
onLoad() { created() {
this.getCategories()
this.getBanner()
this.getImgUrl() this.getImgUrl()
this.imgUrl = uni.getStorageSync('img_url')
wx.showShareMenu({
withShareTicket: true,
//设置下方的Menus菜单才能够让发送给朋友与分享到朋友圈两个按钮可以点击
menus: ["shareAppMessage", "shareTimeline"]
})
}, },
methods: { methods: {
init() {
this.imgUrl = uni.getStorageSync('img_url')
this.getCategories()
this.getBanner()
wx.showShareMenu({
withShareTicket: true,
//设置下方的Menus菜单才能够让发送给朋友与分享到朋友圈两个按钮可以点击
menus: ["shareAppMessage", "shareTimeline"]
})
},
//分享到微信好友 //分享到微信好友
onShareAppMessage(res) { onShareAppMessage(res) {
return { return {
@@ -158,10 +161,14 @@
this.$apiServe.getImgUrl().then(res => { this.$apiServe.getImgUrl().then(res => {
try { try {
uni.setStorageSync('img_url', res.data.data.img_url); uni.setStorageSync('img_url', res.data.data.img_url);
this.initStart = true
this.init()
} catch (e) { } catch (e) {
// error // error
} }
}).finally(_ => {}) }).finally(_ => {
})
} }
} }
} }