This commit is contained in:
周源 2022-05-07 10:30:12 +08:00
commit 86f4cf4c6d
5 changed files with 581 additions and 21941 deletions

21649
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -67,7 +67,7 @@
"core-js": "^3.6.5",
"flyio": "^0.6.2",
"regenerator-runtime": "^0.12.1",
"uview-ui": "^2.0.29",
"uview-ui": "^2.0.31",
"vue": "^2.6.11",
"vuex": "^3.2.0"
},

View File

@ -55,7 +55,7 @@
/* */
"mp-weixin" : {
/* */
"appid" : "wx79d2c832590cc08c",
"appid" : "wx4f17720066e6ab83",
"setting" : {
"urlCheck" : false,
"minified" : true

View File

@ -5,49 +5,48 @@
</view>
<view v-if="load == false">
<u-search height=42 margin="12px 0" searchIconColor="#251B1D" shape="square" :showAction="false"
v-model="artValue" placeholder="请输入名家名称"></u-search>
<u-tabs :scrollable="false" @click="clickTabs" :list="list1" :lineColor="`url(${lineBg}) 100% 100%`"
:activeStyle="{
color: '#251B1D',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#AFADB0 ',
transform: 'scale(1)'
}" itemStyle=" height: 50px;">
v-model="artValue" placeholder="请输入名家名称" @search='search'></u-search>
<u-tabs :scrollable="false" @click="clickTabs" :list="list1" :activeStyle="{
color: '#251B1D',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#AFADB0 ',
transform: 'scale(1)'
}" itemStyle=" height: 50px; ">
</u-tabs>
<view class="artworks">
<view class="art_item" v-for="(v,i) in isLoveList" :key="i">
<view class="art_item" v-for="(v, i) in workList" :key="i">
<view class="art_item_top">
<image src="../../static/artWork.png" mode="" @click="toDetail(i)"></image>
<view class="like" @click="like(i)">
<view :class=" isLoveList[i] ? 'img_selected' : 'img'">
<image :src="v.file" mode="" @click="toDetail(v.id)"></image>
<view class="like" @click="like(v.id, v.isGreat)">
<view :class="v.isGreat ? 'img_selected' : 'img'">
<!-- 红心 -->
</view>
<view class="select_num">
513
{{ v.likes }}
</view>
</view>
</view>
<view class=" art_item_bott" @click="toDetail(i)">
<view class=" art_item_bott" @click="toDetail(v.id)">
<view class="title">
摄影作品自由生活向美而生作品
{{ v.name }}
</view>
<view class="sub_title">
摄影作品
{{ v.type }}作品
</view>
<view class="img_box">
<view class=" puber">
<view class="avtor">
<image src="../../static/artWork.png" mode=""></image>
<image :src="v.user.images" mode=""></image>
</view>
<view class="autor">
谢xx
{{ v.user.nickName }}
</view>
</view>
<view class="time">
58分钟前
{{ v.createdAt }}
</view>
</view>
</view>
@ -59,117 +58,135 @@
</template>
<script>
export default {
data() {
return {
load: true,
isLoveList: [true, false, true, false],
artValue: '',
list1: [{
name: '全部',
type: '',
}],
workList: [],
pages: 1,
size: 20,
lineBg: '../../static/scrollLine.png',
};
},
//
onPullDownRefresh() {
export default {
data() {
return {
load: true,
artValue: '',
type: '',
list1: [{
name: '全部',
value: '',
}],
workList: [],
pages: 1,
size: 20,
};
},
//
onPullDownRefresh() {
this.pages = 1
this.getData()
setTimeout(function () {
uni.stopPullDownRefresh();
}, 1000);
},
//
onReachBottom() {
this.pages++
this.getMoreData();
},
onShow() {
this.list1 = [{
name: '全部',
type: '',
}],
this.pages = 1
this.getData()
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
this.getType()
},
methods: {
//
getType() {
let _this = this
this.http.request('/works/select?code=work_type', {}, "GET").then(res => {
if (res.code == 200) {
res.data.forEach(function (item) {
_this.list1.push({
name: item.label,
value: item.value
})
})
this.getData()
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
},
//
getData() {
let _this = this
this.http.request('/works/list', {
page: this.pages,
size: this.size,
nickName: this.artValue,
workType: this.type
}, "GET").then(res => {
if (res.code == 200) {
_this.workList = res.data.records
_this.workList.forEach(function (item) {
if (item.user.images != undefined) {
let img = JSON.parse(item.user.images)
item.user.images = img[0]
}
//
if (item.type != undefined) {
_this.list1.forEach(function (ele) {
if (item.type == ele.value) {
item.type = ele.name
}
})
}
//
if (item.file != undefined) {
let fileArr = item.file.split(',')
let gs = fileArr[0].substr(fileArr[0].lastIndexOf(".") + 1)
if (gs == 'jpg' || gs == 'jpeg' || gs == 'png') {
item.file = fileArr[0]
} else if (gs == 'doc' || gs == 'docx') {
item.file = '../../static/fileImg/workB'
} else if (gs == 'xls' || gs == 'xlsx') {
item.file = '../../static/fileImg/workB'
} else if (gs == 'pdf') {
item.file = '../../static/fileImg/pdfB'
} else if (gs == 'txt') {
item.file = '../../static/fileImg/pdfB'
}
}
})
_this.load = false
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
},
//
onReachBottom() {
this.pages++
this.getMoreData();
},
onShow() {
this.list1 = [{
name: '全部',
type: '',
}],
this.pages = 1
this.getData()
this.getType()
},
methods: {
//
getType() {
let _this = this
this.http.request('/works/select?code=work_type', {}, "GET").then(res => {
if (res.code == 200) {
res.data.forEach(function(item) {
_this.list1.push({
name: item.label,
value: item.value
})
})
_this.load = false
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
},
//
getData() {
let _this = this
this.http.request('/works/list', {
page: this.pages,
size: this.size
}, "GET").then(res => {
if (res.code == 200) {
_this.load = false
_this.workList = res.data.records
_this.workList.forEach(function(item) {
if (item.images != undefined) {
let img = JSON.parse(item.images)
item.images = img[0]
}
//
if (item.file != undefined) {
let fileArr = item.file.split(',')
let gs = fileArr[0].substr(fileArr[0].lastIndexOf(".") + 1)
if (gs == 'jpg' || gs == 'jpeg' || gs == 'png') {
item.file = fileArr[0]
} else if (gs == 'doc' || gs == 'docx') {
item.file = '../../static/fileImg/workB'
} else if (gs == 'xls' || gs == 'xlsx') {
item.file = '../../static/fileImg/workB'
} else if (gs == 'pdf') {
item.file = '../../static/fileImg/pdfB'
} else if (gs == 'txt') {
item.file = '../../static/fileImg/pdfB'
getMoreData() {
const _this = this
this.http.request('/works/list', {
page: this.pages,
size: this.size,
nickName: this.artValue,
workType: this.type
}, "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.type != undefined) {
_this.list1.forEach(function (ele) {
if (item.type == ele.value) {
item.type = ele.name
}
}
})
console.log(_this.workList)
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
},
//
getMoreData() {
const _this = this
this.http.request('/works/list', {
page: this.pages,
size: this.size
}, "GET").then(res => {
res.data.records.forEach(function(item) {
if (item.images != undefined) {
let img = JSON.parse(item.images)
item.images = img[0]
})
}
//
if (item.file != undefined) {
@ -189,140 +206,185 @@
}
_this.workList.push(item)
})
} else {
this.pages--
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
},
//
like(val1, val2) {
if (val2) {
this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => {
if (res.code == 200) {
this.pages = 1
this.getData()
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
},
like(i) {
this.$set(this.isLoveList, i, !this.isLoveList[i])
},
toDetail(val) {
console.log(val)
uni.navigateTo({
url: "/pages/ArtWorks/artWorkDetail"
} else {
this.http.request('/worksGreat/addGreat?type=1&workId=' + val1, "POST").then(res => {
if (res.code == 200) {
this.pages = 1
this.getData()
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
},
clickTabs(item) {
console.log('item', item);
}
},
//
toDetail(val) {
uni.navigateTo({
url: "/pages/ArtWorks/artWorkDetail?id=" + val
})
},
//
clickTabs(item) {
this.type = item.value
this.pages = 1
this.getData()
},
search() {
this.pages = 1
this.getData()
}
}
}
</script>
<style lang="scss">
/* /deep/ .u-tabs__wrapper__nav__item__text {
/* /deep/ .u-tabs__wrapper__nav__item__text {
font-size: 28rpx;
}*/
/deep/ .u-tabs__wrapper__nav__line {
height: 14px !important;
width: 30px !important;
background-color: transparent !important;
}
/deep/ .u-tabs__wrapper__nav__line {
height: 14px !important;
width: 30px !important;
background-color: transparent !important;
bottom: 2px !important;
margin-left: -5px;
}
page {
width: calc(100% - 32px);
margin: 0 16px;
}
page {
width: calc(100% - 32px);
margin: 0 16px;
}
image {
width: 100%;
height: 100%;
}
image {
width: 100%;
height: 100%;
}
.art_item {
margin-top: 16px;
border: 1px solid transparent;
.art_item {
margin-top: 16px;
border: 1px solid transparent;
.art_item_top {
position: relative;
height: 192px;
overflow: hidden;
border-radius: 8px;
.art_item_top {
position: relative;
height: 192px;
overflow: hidden;
border-radius: 8px;
.like {
position: absolute;
top: calc(100% - 40px);
left: calc(100% - 70px);
width: 59px;
height: 32px;
background: rgba(38, 18, 18, 0.27);
z-index: 10;
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
.like {
position: absolute;
top: calc(100% - 40px);
left: calc(100% - 70px);
width: 59px;
height: 32px;
background: rgba(38, 18, 18, 0.27);
z-index: 10;
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
.img {
width: 16px;
height: 16px;
background: url(../../static/spaceHeart.png) center/100% no-repeat;
float: left;
}
.img {
width: 16px;
height: 16px;
background: url(../../static/spaceHeart.png) center/100% no-repeat;
float: left;
}
.img_selected {
width: 16px;
height: 16px;
background: url(../../static/redHerart.png) center/100% no-repeat;
float: left;
}
.img_selected {
width: 16px;
height: 16px;
background: url(../../static/redHerart.png) center/100% no-repeat;
float: left;
}
.select_num {
float: left;
margin-left: 10rpx;
color: #fff;
}
.select_num {
float: left;
margin-left: 10rpx;
color: #fff;
}
}
}
.art_item_bott {
.title {
margin-top: 12px;
font-size: 16px;
font-weight: 600;
.select_num {
float: left;
margin-left: 10rpx;
color: #fff;
}
}
.art_item_bott {
.title {
margin-top: 12px;
font-size: 16px;
font-weight: 600;
color: #251B1D;
}
.sub_title {
font-size: 12px;
color: #AFADB0;
margin-top: 12px;
margin-bottom: 16px;
}
.img_box {
display: flex;
justify-content: space-between;
align-items: center;
.puber {
display: flex;
align-items: center;
.avtor {
border-radius: 12px;
overflow: hidden;
width: 24px;
height: 24px;
margin-right: 4px;
}
.autor {
color: #251B1D;
}
.sub_title {
font-size: 12px;
color: #AFADB0;
margin-top: 12px;
margin-bottom: 16px;
}
.img_box {
display: flex;
justify-content: space-between;
align-items: center;
.puber {
display: flex;
align-items: center;
.avtor {
border-radius: 12px;
overflow: hidden;
width: 24px;
height: 24px;
margin-right: 4px;
}
.autor {
color: #251B1D;
font-size: 12px;
}
}
.time {
color: #AFADB0;
font-size: 12px;
}
}
}
.time {
color: #AFADB0;
font-size: 12px;
}
}
}
</style>

View File

@ -1,100 +1,241 @@
<template>
<view class="workDetail">
<u-swiper :list="list" :autoplay="true" @change="e => currentNum = e.current" indicatorStyle="right: 20px">
<view slot="indicator" class="indicator-num">
<text class="indicator-num__text">{{ currentNum + 1 }}/{{ list.length }}</text>
</view>
</u-swiper>
<view class="work_name">
作品名称自由生活向美而生作品
<view style="height: 100%;width: 100%;">
<view class="">
<u-loading-page :loading="load"></u-loading-page>
</view>
<view class="work_desc">
摄影作品摄影作品摄影作品摄影作品摄影作品介绍作品介绍摄影作品自由生活向美而生作品
</view>
<view class="work_det">
<view class="det_box">
<view class="box_left">
<image src="../../static/workDetail/time.png" class="img"></image>
<view class="workDetail" v-if="load == false">
<u-swiper :list="list" :autoplay="true" @change="e => currentNum = e.current" indicatorStyle="right: 20px">
<view slot="indicator" class="indicator-num">
<text class="indicator-num__text">{{ currentNum + 1 }}/{{ list.length }}</text>
</view>
<view class="box_right">
昨天10:20
</u-swiper>
<view class="work_name">
{{detailData.name}}
</view>
<view class="work_desc">
{{detailData.introduce}}
</view>
<view class="work_det">
<view class="det_box">
<view class="box_left">
<image src="../../static/workDetail/time.png" class="img"></image>
</view>
<view class="box_right">
{{detailData.createdAt}}
</view>
</view>
<view class="det_box">
<view class="box_left">
<image src="../../static/workDetail/seen.png" class="img"></image>
</view>
<view class="box_right">
{{detailData.views}}浏览
</view>
</view>
<view class="det_box">
<view class="box_right">
类型:
</view>
<view class="box_right">
{{detailData.type}}
</view>
</view>
</view>
<view class="det_box">
<view class="box_left">
<image src="../../static/workDetail/seen.png" class="img"></image>
<view class="detailBottom">
<view class="bottom_box">
<view class="bottom_box_left" @click="clickHeart()">
<image src="../../static/workDetail/heart2.png" class="bot_img" v-if="detailData.isGreat"></image>
<image src="../../static/workDetail/heart1.png" class="bot_img" v-else></image>
</view>
<view class="bottom_box_right" @click="clickHeart()">
{{detailData.likes}}
</view>
</view>
<view class="box_right">
1288浏览
</view>
</view>
<view class="det_box">
<view class="box_right">
类型:
</view>
<view class="box_right">
摄影
</view>
</view>
</view>
<view class="detailBottom">
<view class="bottom_box" @click="clickHeart()">
<view class="bottom_box_left">
<image src="../../static/workDetail/heart1.png" class="bot_img" v-if="isLick == 0"></image>
<image src="../../static/workDetail/heart2.png" class="bot_img" v-else></image>
</view>
<view class="bottom_box_right">
24
</view>
</view>
<view class="bottom_box" @click="clickStar()">
<view class="bottom_box_left">
<image src="../../static/workDetail/star1.png" class="bot_img" v-if="isCon == 0"></image>
<image src="../../static/workDetail/star2.png" class="bot_img" v-else></image>
</view>
<view class="bottom_box_right">
55
</view>
</view>
<view class="bottom_box">
<view class="bottom_box_left">
<image src="../../static/workDetail/share.png" class="bot_img"></image>
</view>
<view class="bottom_box_right">
分享
<view class="bottom_box">
<view class="bottom_box_left" @click="clickStar()">
<image src="../../static/workDetail/star2.png" class="bot_img" v-if="detailData.isColl"></image>
<image src="../../static/workDetail/star1.png" class="bot_img" v-else></image>
</view>
<view class="bottom_box_right" @click="clickStar()">
{{detailData.collections}}
</view>
</view>
<!-- <view class="bottom_box">
<view class="bottom_box_left">
<image src="../../static/workDetail/share.png" class="bot_img"></image>
</view>
<view class="bottom_box_right">
分享
</view>
</view> -->
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [
'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper1.png',
],
currentNum: 1,
load: true,
list: [],
list1: [],
list2: [],
currentNum: 0,
isLick: 0,
isCon:0,
isCon: 0,
id: '',
iswx: 0,
detailData: {},
}
},
methods:{
clickHeart(){
if(this.isLick == 0){
this.isLick = 1
}else if(this.isLick == 1){
this.isLick = 0
onLoad(op) {
this.id = op.id
},
onShow() {
this.getType()
},
onReady() {
// this.load = false
// #ifdef MP-WEIXIN
this.iswx = 0
// #endif
// #ifndef MP-WEIXIN
//
this.iswx = 1
// #endif
},
methods: {
//
getType() {
let _this = this
this.http.request('/works/select?code=work_type', {}, "GET").then(res => {
if (res.code == 200) {
res.data.forEach(function(item) {
_this.list1.push({
name: item.label,
value: item.value
})
})
this.getData()
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
},
//
getData() {
let _this = this
this.list = []
this.http.request('/works/details', {
id: this.id
}, "GET").then(res => {
if (res.code == 200) {
//
if (res.data.type != undefined) {
_this.list1.forEach(function(ele) {
if (res.data.type == ele.value) {
res.data.type = ele.name
}
})
}
//
if (res.data.file != undefined) {
let fileArr = res.data.file.split(',')
fileArr.forEach(function(item) {
let gs = item.substr(item.lastIndexOf(".") + 1)
if (gs == 'jpg' || gs == 'jpeg' || gs == 'png') {
_this.list.push(item)
}
else if (gs == 'doc' || gs == 'docx') {
_this.list2.push({
name: res.data.name + '.doc',
img: '../../static/fileImg/workB',
url: item,
})
} else if (gs == 'xls' || gs == 'xlsx') {
_this.list2.push({
name: res.data.name + '.xls',
img: '../../static/fileImg/workB',
url: item,
})
} else if (gs == 'pdf') {
_this.list2.push({
name: res.data.name + '.pdf',
img: '../../static/fileImg/pdfB',
url: item,
})
} else if (gs == 'txt') {
_this.list2.push({
name: res.data.name + '.txt',
img: '../../static/fileImg/pdfB',
url: item,
})
}
})
}
this.detailData = res.data
_this.load = false
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
},
clickHeart() {
if (this.detailData.isGreat) {
this.http.request('/worksGreat/delGreat?type=1&workId=' + this.detailData.id, "POST").then(res => {
if (res.code == 200) {
this.getData()
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
} else{
this.http.request('/worksGreat/addGreat?type=1&workId=' + this.detailData.id, "POST").then(res => {
if (res.code == 200) {
this.getData()
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
}
},
clickStar(){
if(this.isCon == 0){
this.isCon = 1
}else if(this.isCon == 1){
this.isCon = 0
clickStar() {
if (this.detailData.isColl) {
this.http.request('/worksCollection/delCollection?workId=' + this.detailData.id, "POST").then(res => {
if (res.code == 200) {
this.getData()
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
} else {
this.http.request('/worksCollection/addCollection?workId=' + this.detailData.id, "POST").then(res => {
if (res.code == 200) {
this.getData()
}
}).catch(e => {
uni.showToast({
title: e.data.message,
icon: "none",
});
})
}
}
}
@ -102,10 +243,11 @@
</script>
<style lang="scss">
.workDetail{
.workDetail {
position: relative;
width: 100%;
height: 100%;
.indicator-num {
padding: 2px 0;
background-color: rgba(0, 0, 0, 0.35);
@ -113,13 +255,13 @@
width: 35px;
@include flex;
justify-content: center;
&__text {
color: #FFFFFF;
font-size: 12px;
}
}
.work_name {
width: 94%;
margin: 10px 3%;
@ -128,7 +270,7 @@
font-weight: 600;
color: #251B1D;
}
.work_desc {
width: 94%;
margin: 10px 3%;
@ -137,8 +279,8 @@
font-weight: 400;
color: #251B1D;
}
.work_det{
.work_det {
width: 94%;
margin: 10px 3%;
height: 17px;
@ -148,44 +290,51 @@
color: #AFADB0;
line-height: 17px;
overflow: hidden;
.det_box{
.det_box {
float: left;
margin-right: 20px;
overflow: hidden;
.box_left{
.box_left {
width: 16px;
height: 16px;
float: left;
.img{
.img {
width: 100%;
height: 100%;
}
}
.box_right{
.box_right {
margin-left: 2px;
float: left;
}
}
}
.detailBottom{
.detailBottom {
position: absolute;
width: 100%;
bottom: 10px;
.bottom_box{
width: 31%;
margin: 0 1%;
bottom: 1px;
.bottom_box {
width: 50%;
padding: 15px 0;
float: left;
.bottom_box_left{
margin-left: 30%;
.bottom_box_left {
margin-left: 40%;
float: left;
.bot_img{
.bot_img {
height: 24px;
width: 24px;
}
}
.bottom_box_right{
.bottom_box_right {
float: left;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
@ -197,6 +346,4 @@
}
}
}
</style>