Browse Source

创作者详情页修改

feature-1.0
gao1021514 4 years ago
parent
commit
6ddee179d2
  1. 92
      pages/creator/creatorDetail.vue

92
pages/creator/creatorDetail.vue

@ -39,15 +39,14 @@
activeColor="#11A8FD"></uni-segmented-control> activeColor="#11A8FD"></uni-segmented-control>
</view> </view>
<swiper class="swiper" :circular="false" :current="current" :indicator-dots="false" :autoplay="false" <swiper class="swiper" :circular="false" :current="current" :indicator-dots="false" :autoplay="false"
@change="changeItem" :duration="500"> @change="changeItem" :duration="500" :style="'height:'+swiperHeight+'rpx'">
<swiper-item v-for="(item,index) in imgList" :key="item" <swiper-item v-for="(item,index) in arrList" :key="index">
:current-item-id="item">
<view class="swiper-item bottom"> <view class="swiper-item bottom">
<image :src="item.imgUrl" mode="":style="'width:'+imgWidth+';height:'+imgHeight" @click="targetDetail(item)"></image> <image :src="val.imgUrl" mode="" :style="'width:'+imgWidth+'rpx;height:'+imgHeight+'rpx'"
@click="targetDetail(val)" v-for="(val,index) in imgList" :key="val"></image>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
</view> </view>
</template> </template>
@ -62,39 +61,43 @@
creatorInfo: {}, creatorInfo: {},
current: 0, current: 0,
typeId: 0, typeId: 0,
typeIdList:[], typeIdList: [],
arrList: [], arrList: [],
imgList:[], imgList: [],
imgWidth: 0, // imgWidth: 0, //
imgHeight: 0, // imgHeight: 0, //
swiperHeight: 0, // swiper
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 4,
} }
}, },
created() { created() {
uni.getSystemInfo({ uni.getSystemInfo({
success: res => { success: res => {
console.log(res) this.imgWidth = res.windowWidth - 60
this.imgWidth = res.windowWidth - 60 + 'rpx' this.imgHeight = (res.windowWidth - 60) * 2 - 30
this.imgHeight = (res.windowWidth - 60) * 2 - 30 + 'rpx' console.log('this.imgHeight', this.imgHeight)
} }
}) })
uni.getStorage({ uni.getStorage({
key: 'creatorDetail', key: 'creatorDetail',
success: res => { success: res => {
this.creatorInfo = res.data this.creatorInfo = res.data
console.log('getStorage', this.creatorInfo)
this.creatorInfo.typeList.forEach(item => { this.creatorInfo.typeList.forEach(item => {
this.arrList.push(item.typeName) this.arrList.push(item.typeName)
this.typeIdList.push(item.typeId) this.typeIdList.push(item.typeId)
}) })
console.log('arrList', this.arrList) this.getTypeImgsPage()
console.log('this.typeIdList', this.typeIdList)
} }
}) })
}, },
onLoad(){ //
this.getTypeImgsPage() onReachBottom() {
console.log(111)
if (this.imgList.length > 1) {
this.pageNum += 1
this.getTypeImgsPage()
}
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
if (res.from === 'button') { // if (res.from === 'button') { //
@ -113,25 +116,17 @@
// //
onClickItem(e) { onClickItem(e) {
this.current = e.currentIndex this.current = e.currentIndex
this.typeId = this.typeIdList[e.currentIndex] this.typeId = this.typeIdList[this.current]
this.imgList = []
const params = { this.getTypeImgsPage()
scanCode: this.creatorInfo.scanCode,
typeId: this.typeId,
pageNum: this.pageNum,
pageSize: this.pageSize,
}
getTypeImgsPage(params).then(response => {
if(response.data.code === 200){
this.imgList = response.data.rows
console.log('this.imgList',this.imgList)
}
});
}, },
// //
changeItem(e) { changeItem(e) {
// console.log('', e.detail) this.pageNum = 1
// this.current = e.detail.current this.current = e.detail.current
this.typeId = this.typeIdList[this.current]
this.imgList = []
this.getTypeImgsPage()
}, },
// //
targetDetail(item) { targetDetail(item) {
@ -150,29 +145,30 @@
}, },
// //
getTypeImgsPage() { async getTypeImgsPage() {
uni.showLoading({
title: '加载中'
});
const params = { const params = {
scanCode: this.creatorInfo.scanCode, scanCode: this.creatorInfo.scanCode,
typeId: this.typeIdList[0], typeId: this.typeIdList[0],
pageNum: this.pageNum, pageNum: this.pageNum,
pageSize: this.pageSize, pageSize: this.pageSize,
} }
console.log('params',params) const res = await getTypeImgsPage(params)
getTypeImgsPage(params).then(response =>{ if (res.data.code === 200) {
console.log('response',response) this.imgList.push(...res.data.rows)
}); this.swiperHeight = (this.imgHeight + 40) * Math.ceil(this.imgList.length / 2) + 40
console.log('this.imgList', this.swiperHeight)
// if (res.data.code === 200) { uni.hideLoading()
// this.imgList = response.data.rows } else {
// console.log('this.imgList',this.imgList) uni.hideLoading()
// } else { uni.showToast({
// uni.showModal({ title: res.data.msg,
// content: '', icon: 'none'
// showCancel: false })
// }); }
// }
} }
} }
} }
</script> </script>

Loading…
Cancel
Save