合成照相馆小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
photo_uniapp/pages/user/portrait/detail.vue

114 lines
2.5 KiB

<template>
<view class="container">
<custom_navbar :title="navbar_title" @getNavHeight="getNavHeight" :theme="theme" left="true" />
<view class="xcontent" :style="'margin-top:'+margin_top+'px'">
<view class="imgList" v-if="imgList.length > 0">
<view class="imgBox" v-for="(item,index) in imgList" :key="index">
<image :src="item" mode="aspectFill"></image>
</view>
</view>
<u-empty icon="/static/img/user/nodata.png" mode="list" text="你还没有面部档案" width="180rpx" marginTop="120px" v-if="imgList.length == 0"></u-empty>
<view class="newBtn" v-if="imgList.length == 0" @click="newInfo">去创建</view>
</view>
</view>
</template>
<script>
import custom_navbar from "../../index/components/header.vue";
export default {
components: {
custom_navbar
},
data() {
return {
id:0,
imgList:[],
navbar_title: '面部档案',
theme: "blue",
margin_top: 0,
}
},
onLoad(options){
var _this =this;
console.log('options', options);
_this.id = options.id;
_this.getDetail();
},
onPageScroll(e) {
if (e.scrollTop > 50) {
this.theme = 'white';
} else {
this.theme = 'blue';
}
},
methods: {
getNavHeight(e) {
this.margin_top += e;
},
getDetail()
{
var _this =this;
var id = _this.id;
if(id > 0)
{
var post ={id:_this.id};
_this.$api.get('api/portrait/details',post,function(rs){
console.log('档案详情',rs);
var imgs = rs.users_images;
imgs.forEach((item, index) => {
imgs[index] = _this.$api.ossurl(item);
})
_this.imgList = imgs;
});
}
},
newInfo(){
var _this =this;
if(_this.id == 0)
{
_this.$user.session('ai_face_success','');
}
uni.navigateTo({
url:'/pagesA/merge/face_1'
})
},
}
}
</script>
<style lang="scss">
.container{width: 100%; padding-top: 20rpx;}
.xcontent{ width: 710rpx; height: auto; margin: 0rpx auto;}
.imgList{width: 100%; height: auto; display: flex; flex-wrap: wrap;
justify-content: space-between;
align-items: center; /* 如果需要垂直居中子元素 */
}
.imgBox{width: 130rpx; height: 130rpx; margin-top: 10rpx;}
.imgBox image{width: 130rpx; height: 130rpx;}
.newBtn{
width: 400rpx;
height: 88rpx;
line-height: 88rpx;
border-radius: 48rpx;
border: 2rpx solid #9B75FF;
text-align: center;
margin: 20rpx auto;
color: #9B75FF;
font-size: 30rpx;
font-weight: bold;
}
</style>