This commit is contained in:
lnn19986213 2024-05-08 16:35:48 +08:00
parent d0ed08d2ce
commit 0c4f73bb85
2 changed files with 163 additions and 70 deletions

View File

@ -18,12 +18,14 @@
transform: 'scale(1)'
}" itemStyle="height: 50px;">
</u-tabs> -->
<view class="goodPart">
<view class="goodPart" :style="{'height': 'calc(100vh - '+topPartHeight+'px)'}">
<scroll-view class="gpLeft" scroll-y="true">
<view :class="fil == '1'?'gplItem_C':'gplItem'" @click="Clickfilter" style="display: flex;">
<image src="../../static/shop/hot.png" style="height: 32rpx; width: 32rpx; margin: 6rpx 6rpx 0 24rpx;"></image>热门
<image src="../../static/shop/hot.png"
style="height: 32rpx; width: 32rpx; margin: 6rpx 6rpx 0 24rpx;"></image>热门
</view>
<view v-for="(item,index) in list1" :key="index" @click="chooseOneType(item.value,index)" :class="typeO == index?'gplItem_C':'gplItem'">
<view v-for="(item,index) in list1" :key="index" @click="chooseOneType(item.value,index)"
:class="typeO == index?'gplItem_C':'gplItem'">
{{item.name}}
</view>
</scroll-view>
@ -37,13 +39,16 @@
全部作品
<view class="line"></view>
</view>
<view v-for="(item,index) in list2" :key="index" @click="chooseTwoType(item.value,index)" :class="typeT == index?'gprtItem_C':'gprtItem'">
<view v-for="(item,index) in list2" :key="index" @click="chooseTwoType(item.value,index)"
:class="typeT == index?'gprtItem_C':'gprtItem'">
{{item.name}}
<view class="line"></view>
</view>
</scroll-view>
<scroll-view class="artworks" scroll-y="true" @scrolltolower="lower">
<u-empty v-if="workList.length < 1" mode="data" icon="../../static/orderE.png" text='暂无数据' marginTop="120">
<scroll-view class="artworks" scroll-y="true" @scrolltolower="lower" @scroll="scroll"
:scroll-top="scrollTop">
<u-empty v-if="workList.length < 1" mode="data"
icon="http://cdn.uviewui.com/uview/empty/data.png" text='暂无数据' marginTop="120">
</u-empty>
<view class="art_item" v-for="(v, i) in workList" :key="i">
<view class="art_item_top">
@ -63,14 +68,16 @@
</view>
<view class="sub_title" style="overflow: hidden;">
<view style="float: left; width: 40%">{{ v.typeName }}-{{ v.typesName }}作品</view>
<view style="float: right; width: 60%; display: flex; flex-wrap: wrap; justify-content: flex-end;">
<view
style="float: right; width: 60%; display: flex; flex-wrap: wrap; justify-content: flex-end;">
<view class="tag" v-for="(a,b) in v.workTag" :key="b">
{{a}}
</view>
</view>
</view>
<view class="img_box">
<view v-if="v.user" class=" puber" @click="toUser(v.user.id,v.user.images,v.user.userName,v.isFollow)">
<view v-if="v.user" class=" puber"
@click="toUser(v.user.id,v.user.images,v.user.userName,v.isFollow)">
<view class="avtor">
<image :src="v.user.images" mode=""></image>
</view>
@ -104,6 +111,9 @@
data() {
return {
load: true,
statusHeight: 0,
titleHeight: 50,
topPartHeight: 0,
artValue: '',
type: '',
types: '',
@ -122,9 +132,22 @@
sonId: '',
sonNum: '',
//
requestStatus: false
requestStatus: false,
scrollTop: 0,
old: {
scrollTop: 0
}
};
},
onReady() {
const systemMsg = uni.getSystemInfoSync();
this.statusHeight = systemMsg.statusBarHeight
// #ifdef MP-WEIXIN
const menuButtonInfo = uni.getMenuButtonBoundingClientRect() //
this.titleHeight = menuButtonInfo.height + (menuButtonInfo.top - systemMsg.statusBarHeight) * 2
// #endif
this.topPartHeight = this.statusHeight + this.titleHeight + 12
},
//
onPullDownRefresh() {
this.pages = 1
@ -147,7 +170,7 @@
this.getType()
},
onShow() {
if(this.sonId){
if (this.sonId) {
this.getSonData()
}
},
@ -175,7 +198,7 @@
//
getTypeE() {
let _this = this
this.http.request('/workType/'+ this.type, {}, "GET").then(res => {
this.http.request('/workType/' + this.type, {}, "GET").then(res => {
if (res.code == 200) {
res.data.forEach(function(item) {
_this.list2.push({
@ -209,12 +232,11 @@
if (res.code == 200) {
_this.workList = res.data.records
_this.workList.forEach(function(item) {
console.log(1)
if(item.user){
if (item.user) {
if (item.user.images) {
// let img = JSON.parse(item.user.images)
// item.user.images = img[0]
}else{
} else {
item.user.images = '../../static/txIcon.png'
}
}
@ -222,14 +244,15 @@
if (item.file) {
let fileArr = item.file.split(',')
let gs = fileArr[0].substr(fileArr[0].lastIndexOf(".") + 1)
if (gs == 'jpg' || gs == 'jpeg' || gs == 'png' || gs == 'bmp' || gs == 'gif' || gs == 'tif' || gs == 'tiff') {
if (gs == 'jpg' || gs == 'jpeg' || gs == 'png' || gs == 'bmp' || gs ==
'gif' || gs == 'tif' || gs == 'tiff') {
item.file = fileArr[0]
} else if (gs == 'pdf') {
item.file = '../../static/fileImg/pdfS.png'
}
}
if (item.workTag.length > 3) {
let tags = item.workTag.slice(0,3)
let tags = item.workTag.slice(0, 3)
item.workTag = tags
}
})
@ -249,6 +272,11 @@
},
//
getMoreData() {
if (this.requestStatus) {
// return
return false;
}
this.requestStatus = true;
const _this = this
this.http.request('/works/list', {
page: this.pages,
@ -259,25 +287,39 @@
}, "GET").then(res => {
if (res.data.records.length > 0) {
res.data.records.forEach(function(item) {
if (item.user.images != undefined) {
let img = JSON.parse(item.user.images)
item.user.images = img[0]
if (item.user) {
if (item.user.images) {
// let img = JSON.parse(item.user.images)
// item.user.images = img[0]
} else {
item.user.images = '../../static/txIcon.png'
}
}
//
if (item.file != undefined) {
if (item.file) {
let fileArr = item.file.split(',')
let gs = fileArr[0].substr(fileArr[0].lastIndexOf(".") + 1)
if (gs == 'jpg' || gs == 'jpeg' || gs == 'png' || gs == 'bmp' || gs == 'gif' || gs == 'tif' || gs == 'tiff') {
if (gs == 'jpg' || gs == 'jpeg' || gs == 'png' || gs == 'bmp' || gs ==
'gif' || gs == 'tif' || gs == 'tiff') {
item.file = fileArr[0]
} else if (gs == 'pdf') {
item.file = '../../static/fileImg/pdfS.png'
}
}
if (item.workTag.length > 3) {
let tags = item.workTag.slice(0, 3)
item.workTag = tags
}
_this.workList.push(item)
})
} else {
this.pages--
}
setTimeout(() => {
//
// requestStatus
this.requestStatus = false;
}, 500);
}).catch(e => {
uni.showToast({
@ -287,7 +329,7 @@
})
},
//
like(val1, val2,num) {
like(val1, val2, num) {
if (val2) {
this.workList[num].isGreat = false
this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => {
@ -317,7 +359,7 @@
}
},
//
toDetail(val,num) {
toDetail(val, num) {
this.sonId = val
this.sonNum = num
uni.navigateTo({
@ -325,10 +367,10 @@
})
},
//
chooseOneType(item,index) {
if(index == 0){
chooseOneType(item, index) {
if (index == 0) {
this.type = ''
}else{
} else {
this.type = item
this.getTypeE()
}
@ -339,26 +381,29 @@
this.list2 = []
this.orderBy = ''
this.pages = 1
this.goTop()
this.getData()
},
//
chooseTwoType(val,val2) {
chooseTwoType(val, val2) {
this.types = val
this.typeT = val2
this.orderBy = ''
this.pages = 1
this.goTop()
this.getData()
},
search() {
this.pages = 1
this.getData()
},
toUser(val1,val2,val3,val4){
toUser(val1, val2, val3, val4) {
uni.navigateTo({
url: "/pagesA/my/myWorks?id=" + val1 + '&userName=' + val3 + '&userImg=' + val2 + '&isFollow=' + val4
url: "/pagesA/my/myWorks?id=" + val1 + '&userName=' + val3 + '&userImg=' + val2 +
'&isFollow=' + val4
})
},
Clickfilter(){
Clickfilter() {
let _this = this
if (this.fil == 0) {
this.fil = 1
@ -367,6 +412,7 @@
this.type = ''
this.types = ''
this.list2 = []
this.goTop()
this.http.request('/works/hot', {}, "GET").then(res => {
if (res.code == 200) {
_this.workList = res.data
@ -374,14 +420,15 @@
if (item.user.images) {
// let img = JSON.parse(item.user.images)
// item.user.images = img[0]
}else{
} else {
item.images = '../../static/txIcon.png'
}
//
if (item.file) {
let fileArr = item.file.split(',')
let gs = fileArr[0].substr(fileArr[0].lastIndexOf(".") + 1)
if (gs == 'jpg' || gs == 'jpeg' || gs == 'png' || gs == 'bmp' || gs == 'gif' || gs == 'tif' || gs == 'tiff') {
if (gs == 'jpg' || gs == 'jpeg' || gs == 'png' || gs == 'bmp' || gs ==
'gif' || gs == 'tif' || gs == 'tiff') {
item.file = fileArr[0]
} else if (gs == 'pdf') {
item.file = '../../static/fileImg/pdfS.png'
@ -397,8 +444,8 @@
})
}
},
lower(){
if(this.fil == 0){
lower() {
if (this.fil == 0) {
this.pages++
this.getMoreData();
}
@ -415,6 +462,17 @@
icon: "none",
});
})
},
scroll: function(e) {
console.log(e)
this.old.scrollTop = e.detail.scrollTop
},
goTop: function(e) {
// view
this.scrollTop = this.old.scrollTop
this.$nextTick(function() {
this.scrollTop = 0
});
}
}
}
@ -427,6 +485,7 @@
background-color: transparent !important;
bottom: 2px !important;
}
.search_box {
width: calc(100% - 32px);
margin: 0 16px;
@ -459,6 +518,7 @@
font-size: 30rpx;
text-align: center;
}
.gplItem_C {
width: 162rpx;
padding: 20rpx 0;
@ -467,7 +527,7 @@
text-align: center;
background: #E8E8E8;
border-radius: 0 50px 50px 0;
border-left: 6rpx solid #99241B ;
border-left: 6rpx solid #99241B;
}
}
@ -488,20 +548,23 @@
padding: 0 30rpx;
margin: 0 10rpx;
float: left;
.line{
.line {
width: calc(100% - 40rpx);
min-width: 36rpx;
margin: 0 auto;
height: 6rpx;
}
}
.gprtItem_C {
height: 64rpx;
line-height: 64rpx;
padding: 0 30rpx;
margin: 0 10rpx;
float: left;
.line{
.line {
width: calc(100% - 40rpx);
min-width: 36rpx;
margin: 0 auto;
@ -510,10 +573,12 @@
}
}
}
.artworks {
background-color: #ffffff;
height: calc(100% - 55px);
margin-left: 16rpx;
.art_item {
margin: 8px 0;
border: 1px solid transparent;
@ -558,6 +623,7 @@
}
}
}
.art_item_bott {
.title {
margin-top: 12px;
@ -572,7 +638,7 @@
margin-top: 12px;
margin-bottom: 16px;
.tag{
.tag {
// width: 80rpx;
text-align: center;
border: 1rpx solid #AFADB0;
@ -617,6 +683,4 @@
}
}
}
</style>

View File

@ -46,7 +46,8 @@
<view class="line"></view>
</view>
</scroll-view>
<scroll-view class="artworks" scroll-y="true" @scrolltolower="lower">
<scroll-view class="artworks" scroll-y="true" @scrolltolower="lower" @scroll="scroll"
:scroll-top="scrollTop">
<u-empty v-if="workList.length < 1" icon="http://cdn.uviewui.com/uview/empty/data.png">
</u-empty>
<view class="art_item" v-for="(v,i) in workList" :key="i" @click="goOrderDet(v.id)">
@ -117,6 +118,10 @@
orderBy: '',
lineBg: '../../static/scrollLine.png',
typesOf: '',
scrollTop: 0,
old: {
scrollTop: 0
}
};
},
onReady() {
@ -229,6 +234,11 @@
},
//
getMoreData() {
if (this.requestStatus) {
// return
return false;
}
this.requestStatus = true;
let _this = this
this.http.request('/goods/list', {
page: this.pages,
@ -256,6 +266,11 @@
if (res.data.records.length == 0) {
this.pages--
}
setTimeout(() => {
//
// requestStatus
this.requestStatus = false;
}, 500);
}
}).catch(e => {
uni.showToast({
@ -280,6 +295,7 @@
this.list2 = []
this.orderBy = ''
this.pages = 1
this.goTop()
this.getData()
},
//
@ -288,6 +304,7 @@
this.typeT = val2
this.orderBy = ''
this.pages = 1
this.goTop()
this.getData()
},
changeTypesOf(val) {
@ -319,6 +336,7 @@
this.types = ''
this.list2 = []
this.pages = 1
this.goTop()
this.getData()
}
},
@ -335,6 +353,17 @@
lower() {
this.pages++
this.getMoreData();
},
scroll: function(e) {
console.log(e)
this.old.scrollTop = e.detail.scrollTop
},
goTop: function(e) {
// view
this.scrollTop = this.old.scrollTop
this.$nextTick(function() {
this.scrollTop = 0
});
}
}
}