177 lines
4.4 KiB
Vue
177 lines
4.4 KiB
Vue
<template>
|
|
<view class="photo">
|
|
<view class="back">
|
|
<u-icon name="close" color="#999999" :size="30" @click="goBack"></u-icon>
|
|
</view>
|
|
<swiper class="swiper" circular autoplay @change="changeSwiper">
|
|
<swiper-item v-for="(simg,sindex) in list.photo" :key="sindex">
|
|
<image :src="simg.url" mode="aspectFill" @tap="viewImage" :data-index="sindex"></image>
|
|
</swiper-item>
|
|
</swiper>
|
|
<scroll-view scroll-y="true" class="bottom">
|
|
<view class="item">
|
|
<text>图片</text>
|
|
<view v-for="(item,index) in list.photo" :key="index" :style="{'background-color':index == swiper_id ? '#fff' : '#ede8e8'}"></view>
|
|
</view>
|
|
<view class="username">{{ list.member_nickname }}</view>
|
|
<view class="title">{{ list.article_title }}</view>
|
|
<view class="info">{{ list.article_content }}</view>
|
|
<view class="box">
|
|
<view class="label" v-for="(label,id) in list.label" :key="id">{{ label.name }}</view>
|
|
</view>
|
|
</scroll-view>
|
|
<userinfo class="userinfo" :list="list" :cart="cart_type" @openCart="openCart"></userinfo>
|
|
<shpoone class="shpoone" v-show="list.goods.length == 1 && cart_type"></shpoone>
|
|
<shoplist :list="list.goods" v-show="list.goods.length > 1 && cart_type" @hideCart="hideCart"></shoplist>
|
|
</view>
|
|
</template>
|
|
<style lang="scss" scoped>
|
|
.photo{
|
|
height: 100vh;
|
|
background-color: #ececec;
|
|
width: 100%;
|
|
.back{
|
|
padding-top: 28rpx;
|
|
padding-right: 31rpx;
|
|
text-align: right;
|
|
}
|
|
.swiper{
|
|
width: 100%;
|
|
height: 702rpx;
|
|
margin-top: 102rpx;
|
|
image{
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
.bottom{
|
|
position: fixed;
|
|
bottom: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
width: 700rpx;
|
|
height: 300rpx;
|
|
padding: 20rpx 30rpx;
|
|
background-color: #fff;
|
|
.item{
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 8rpx 16rpx;
|
|
font-size: 24rpx;
|
|
color: #fff;
|
|
border-radius: 10rpx;
|
|
background-color: #999;
|
|
>view{
|
|
width: 12rpx;
|
|
height: 12rpx;
|
|
border-radius: 50%;
|
|
margin-left: 10rpx;
|
|
}
|
|
}
|
|
.username{
|
|
margin: 20rpx 0;
|
|
font-size: 36rpx;
|
|
color: #333;
|
|
|
|
}
|
|
.title{
|
|
font-size: 26rpx;
|
|
color: #333;
|
|
}
|
|
.info{
|
|
margin: 20rpx 0;
|
|
display: -webkit-box;
|
|
-webkit-box-orient: vertical;
|
|
-webkit-line-clamp: 2;
|
|
overflow: hidden;
|
|
font-size: 28rpx;
|
|
}
|
|
.box {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
.label {
|
|
padding: 6rpx 10rpx;
|
|
margin: 0 10rpx 10rpx 0;
|
|
font-size: 24rpx;
|
|
color: #fff;
|
|
border-radius: 6rpx;
|
|
background-color: #000000;
|
|
opacity: 0.5;
|
|
}
|
|
}
|
|
}
|
|
.userinfo{
|
|
position: absolute;
|
|
right: 30rpx;
|
|
top: 50%;
|
|
transform: translateY(-285rpx);
|
|
}
|
|
.shpoone{
|
|
z-index: 999;
|
|
position: absolute;
|
|
right: 139rpx;
|
|
top: 54%;
|
|
transform: translateY(100rpx);
|
|
}
|
|
}
|
|
</style>
|
|
<script>
|
|
import userinfo from "../components/userinfo/index" // 点赞组件
|
|
import shpoone from "../components/shpoone/index" //
|
|
import shoplist from "../components/shoplist/index" // 商品列表
|
|
|
|
export default {
|
|
name:"photo",
|
|
onLoad(option) {
|
|
console.log(option);
|
|
},
|
|
components:{
|
|
userinfo,
|
|
shpoone,
|
|
shoplist
|
|
},
|
|
data(){
|
|
return {
|
|
list:{},
|
|
swiper_id: "",
|
|
cart_type: false,
|
|
}
|
|
},
|
|
methods:{
|
|
// 发现详情
|
|
articleInfo(article_id){
|
|
this.$u.api.articleInfo({article_id}).then((res)=>{
|
|
this.list = res.data.info;
|
|
})
|
|
},
|
|
// 改变swiper
|
|
changeSwiper(e) {
|
|
// console.log(e.detail.current);
|
|
this.swiper_id = e.detail.current; // 储存swiper id
|
|
},
|
|
// 更改购物车状态
|
|
openCart(data) {
|
|
console.log(data);
|
|
this.cart_type = data;
|
|
},
|
|
hideCart(data) {
|
|
// console.log(data);
|
|
this.cart_type = data;
|
|
},
|
|
// 预览图片
|
|
viewImage(e) {
|
|
console.log(e);
|
|
},
|
|
goBack() {
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
}
|
|
},
|
|
onLoad(o){
|
|
this.id = o.id
|
|
this.articleInfo(this.id)
|
|
}
|
|
}
|
|
</script> |