Browse Source

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

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

4
pages.json

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

40
pages/creator/creatorDetail.vue

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

54
pages/index/index.vue

@ -1,24 +1,27 @@
<template>
<view class="container">
<view class="top">
<image class="back-img" src="../../static/img/start.gif" mode=""></image>
<view class="top-bottom">
</view>
<uni-search-bar class="uni-mt-10" placeholder="请输入喜欢的艺术家代号吧~" clearButton="auto" cancelButton="none"
@confirm="search" />
<text>热门艺术家</text>
<view class="user-list">
<view class="user-list-box" v-for="(item,index) in hotCreatorList" :key='item.id'
@click="goCreatorDetail(item.scanCode)">
<image :src="item.img" mode=""></image>
<text>{{item.scanCode}}</text>
<view v-if="!showChoiceness">
<view class="top">
<image class="back-img" src="../../static/img/start.gif" mode=""></image>
<view class="top-bottom">
</view>
<uni-search-bar class="uni-mt-10" placeholder="请输入喜欢的艺术家代号吧~" clearButton="auto" cancelButton="none"
@confirm="search" />
<text>热门艺术家</text>
<view class="user-list">
<view class="user-list-box" v-for="(item,index) in hotCreatorList" :key='item.id'
@click="goCreatorDetail(item.scanCode)">
<image :src="item.img" mode=""></image>
<text>{{item.scanCode}}</text>
</view>
</view>
</view>
<view class="middle">
<text>近期精选</text>
<image src="../../static/img/slide-top.svg" mode=""></image>
</view>
</view>
<view class="middle">
<text>近期精选</text>
<image src="../../static/img/slide-top.svg" mode=""></image>
</view>
<Choiceness v-else></Choiceness>
</view>
</template>
@ -28,13 +31,23 @@
creatorImgsDetails,
loginTiktok
} from '@/api/index.js'
import Choiceness from './choiceness.vue'
export default {
data() {
return {
hotCreatorList: [],
isTarget: true
isTarget: true,
showChoiceness:false
}
},
components:{
Choiceness,
},
//
onPullDownRefresh() {
this.showChoiceness = false
uni.stopPullDownRefresh()
},
created() {
const userInfo = uni.getStorageSync('userInfo')
if (!userInfo) {
@ -49,9 +62,10 @@
// scrollTopeasy-loadimage
if (e.scrollTop > 160) {
uni.redirectTo({
url: '../index/choiceness'
})
this.showChoiceness = true
// uni.redirectTo({
// url: '../index/choiceness'
// })
}
},
methods: {

Loading…
Cancel
Save