Browse Source

创作者详情页修改

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

94
pages/creator/creatorDetail.vue

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

Loading…
Cancel
Save