Browse Source

近期精选改为子组件引入,创作者详情页面修改

feature-1.0
gao1021514 4 years ago
parent
commit
2f49cde11d
  1. 4
      pages.json
  2. 36
      pages/creator/creatorDetail.vue
  3. 22
      pages/index/index.vue

4
pages.json

@ -4,7 +4,7 @@
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",
"enablePullDownRefresh": false "enablePullDownRefresh": true
} }
}, },
{ {
@ -25,7 +25,7 @@
"path": "pages/creator/creatorDetail", "path": "pages/creator/creatorDetail",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": true "enablePullDownRefresh": false
} }
}, },
{ {

36
pages/creator/creatorDetail.vue

@ -38,9 +38,17 @@
<uni-segmented-control :current="current" :values="arrList" @clickItem="onClickItem" styleType="text" <uni-segmented-control :current="current" :values="arrList" @clickItem="onClickItem" styleType="text"
activeColor="#11A8FD"></uni-segmented-control> activeColor="#11A8FD"></uni-segmented-control>
</view> </view>
<view class="bottom"> <swiper class="swiper" :circular="false" :current="current" :indicator-dots="false" :autoplay="false"
<image :src="item.imgUrl" mode="" v-for="(item,index) in creatorInfo.typeImgList[index].imgList" :key="index" @change="changeItem" :duration="500">
:style="'width:'+imgWidth+';height:'+imgHeight" @click="targetDetail(item)"></image> <swiper-item v-for="(item,index) in creatorInfo.typeImgList" :key="item.typeId"
:current-item-id="item.typeId">
<view class="swiper-item bottom">
<image :src="val.imgUrl" mode="" v-for="(val,i) in item.imgList" :key="i"
:style="'width:'+imgWidth+';height:'+imgHeight" @click="targetDetail(val)"></image>
</view>
</swiper-item>
</swiper>
</view> </view>
</view> </view>
</template> </template>
@ -70,10 +78,12 @@
uni.getStorage({ uni.getStorage({
key: 'creatorDetail', key: 'creatorDetail',
success: res => { success: res => {
console.log('getStorage', res)
this.creatorInfo = res.data this.creatorInfo = res.data
this.current = res.data.typeImgList[0].typeId console.log('getStorage', this.creatorInfo)
this.arrList = res.data.typeImgList[0].typeName this.creatorInfo.typeImgList.forEach(item => {
this.arrList.push(item.typeName)
})
console.log('arrList', this.arrList)
} }
}) })
}, },
@ -82,7 +92,7 @@
console.log(res) console.log(res)
} }
return { return {
title: '来看看艺术家['+this.creatorInfo.scanCode+']精心准备的图片吧~', title: `来看看艺术家${this.creatorInfo.scanCode}精心准备的图片吧~`,
path: `/pages/creator/imgDetail?id=${this.creatorInfo.id}` path: `/pages/creator/imgDetail?id=${this.creatorInfo.id}`
} }
uni.showToast({ uni.showToast({
@ -91,8 +101,15 @@
}) })
}, },
methods: { methods: {
//
onClickItem(e) { onClickItem(e) {
console.log('点击', e) console.log('点击', e)
this.current = e.currentIndex
},
//
changeItem(e) {
console.log('点击', e.detail)
this.current = e.detail.current
}, },
// //
targetDetail(item) { targetDetail(item) {
@ -148,6 +165,10 @@
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
} }
button::after {
border: none;
}
} }
} }
@ -197,6 +218,7 @@
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
padding-bottom: 20px; padding-bottom: 20px;
image { image {
margin-top: 40rpx; margin-top: 40rpx;
margin-left: 40rpx; margin-left: 40rpx;

22
pages/index/index.vue

@ -1,5 +1,6 @@
<template> <template>
<view class="container"> <view class="container">
<view v-if="!showChoiceness">
<view class="top"> <view class="top">
<image class="back-img" src="../../static/img/start.gif" mode=""></image> <image class="back-img" src="../../static/img/start.gif" mode=""></image>
<view class="top-bottom"> <view class="top-bottom">
@ -20,6 +21,8 @@
<image src="../../static/img/slide-top.svg" mode=""></image> <image src="../../static/img/slide-top.svg" mode=""></image>
</view> </view>
</view> </view>
<Choiceness v-else></Choiceness>
</view>
</template> </template>
<script> <script>
@ -28,13 +31,23 @@
creatorImgsDetails, creatorImgsDetails,
loginTiktok loginTiktok
} from '@/api/index.js' } from '@/api/index.js'
import Choiceness from './choiceness.vue'
export default { export default {
data() { data() {
return { return {
hotCreatorList: [], hotCreatorList: [],
isTarget: true isTarget: true,
showChoiceness:false
} }
}, },
components:{
Choiceness,
},
//
onPullDownRefresh() {
this.showChoiceness = false
uni.stopPullDownRefresh()
},
created() { created() {
const userInfo = uni.getStorageSync('userInfo') const userInfo = uni.getStorageSync('userInfo')
if (!userInfo) { if (!userInfo) {
@ -49,9 +62,10 @@
// scrollTopeasy-loadimage // scrollTopeasy-loadimage
if (e.scrollTop > 160) { if (e.scrollTop > 160) {
uni.redirectTo({ this.showChoiceness = true
url: '../index/choiceness' // uni.redirectTo({
}) // url: '../index/choiceness'
// })
} }
}, },
methods: { methods: {

Loading…
Cancel
Save