273 lines
4.5 KiB
Vue
273 lines
4.5 KiB
Vue
<template>
|
||
<view class="content addFood">
|
||
<!-- 封面 -->
|
||
<view class="topimg">
|
||
<image :src="info.FMimg" mode="aspectFill"></image>
|
||
</view>
|
||
<!-- 信息 -->
|
||
<view class="title">
|
||
<view class="table">{{info.title}}</view>
|
||
</view>
|
||
<!-- -->
|
||
<view class="title title2">
|
||
<view class="">菜谱类型:</view>
|
||
<view>{{menu[cookIndex].name}}</view>
|
||
</view>
|
||
<!-- 食材 -->
|
||
<view class="food">
|
||
<view class="desc">
|
||
{{info.description}}
|
||
</view>
|
||
<view class="h4">
|
||
所需食材
|
||
</view>
|
||
<view class="foodlist">
|
||
<view class="item" v-for="(ite,ind) in info.food_list" :key="ind" v-if="info.food_list.length">
|
||
<view class="name">{{ite.name}}</view>
|
||
<view class="weight">
|
||
{{ite.weight}}{{ite.unit}}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 步骤 -->
|
||
<view class="step">
|
||
<view class="stepList" v-for="(ite,ind) in info.step_list" :key="ind" v-if="info.step_list.length">
|
||
<view class="top">
|
||
<text>步骤{{ind +1}}</text>
|
||
</view>
|
||
<view class="right">
|
||
<view class="desc">
|
||
{{ite.description}}
|
||
</view>
|
||
<view class="image" v-for="(it,id) in ite.pic_img">
|
||
<image :src="it" mode="aspectFill" class="mt-10"></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
mapState
|
||
} from "vuex";
|
||
export default {
|
||
data() {
|
||
return {
|
||
info: {
|
||
FMimg: "",
|
||
cook_label: null,
|
||
title: "",
|
||
description: "",
|
||
food_list: [],
|
||
cover: null, //封面id
|
||
step_list: []
|
||
},
|
||
cookIndex: null,
|
||
}
|
||
},
|
||
computed: {
|
||
...mapState(["user", "configInfo"]),
|
||
menu() {
|
||
return this.configInfo.cookbook_label
|
||
},
|
||
},
|
||
onLoad(options) {
|
||
let that = this
|
||
let info = JSON.parse(options.info)
|
||
that.info = info
|
||
that.cookIndex = that.menu.findIndex(ite => ite.id == info.cook_label)
|
||
console.log("预览", info)
|
||
},
|
||
methods: {}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.content {
|
||
padding: 0 30rpx;
|
||
}
|
||
|
||
.topimg {
|
||
width: 100%;
|
||
height: 340rpx;
|
||
background: #fff;
|
||
border-radius: 20rpx;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
flex-direction: column;
|
||
margin: 20rpx 0;
|
||
overflow: hidden;
|
||
position: relative;
|
||
|
||
.iconfont {
|
||
font-size: 60rpx;
|
||
color: $maincolor;
|
||
}
|
||
|
||
text {
|
||
display: inline-block;
|
||
width: 100%;
|
||
text-align: center;
|
||
font-size: 24rpx;
|
||
color: #999;
|
||
}
|
||
|
||
.text {
|
||
font-size: 16px;
|
||
color: #666;
|
||
margin-bottom: 3px;
|
||
}
|
||
|
||
image {
|
||
width: 100%;
|
||
height: inherit;
|
||
}
|
||
}
|
||
|
||
.step {
|
||
.image {
|
||
height: 340rpx;
|
||
margin: auto;
|
||
background: #f7f7f7;
|
||
border-radius: 20rpx;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
|
||
image {
|
||
width: 100%;
|
||
height: inherit;
|
||
display: inline-table;
|
||
}
|
||
|
||
icon {
|
||
font-size: 60rpx;
|
||
color: #ff4c4f;
|
||
margin-bottom: 5px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.title {
|
||
padding: 20rpx;
|
||
|
||
.table {
|
||
font-size: 16px;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.user {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-top: 30rpx;
|
||
|
||
.left {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
image {
|
||
width: 50rpx;
|
||
height: 50rpx;
|
||
margin-right: 5px;
|
||
border-radius: 50%;
|
||
}
|
||
}
|
||
|
||
.right {
|
||
display: flex;
|
||
}
|
||
}
|
||
}
|
||
|
||
.desc {
|
||
width: 100%;
|
||
line-height: 50rpx;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
|
||
.h4 {
|
||
margin: 20rpx 0;
|
||
padding-top: 20rpx;
|
||
border-top: 1px solid #f7f7f7;
|
||
|
||
.close {
|
||
color: #fff;
|
||
width: 100px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 20rpx;
|
||
background-color: $maincolor;
|
||
|
||
image {
|
||
width: 50rpx;
|
||
height: 50rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.step {
|
||
margin-bottom: 120rpx;
|
||
}
|
||
|
||
.foodlist {
|
||
border-radius: 20rpx;
|
||
background: #fff;
|
||
|
||
.item {
|
||
margin-top: 0 !important;
|
||
border-radius: 0px !important;
|
||
border-bottom: 1px solid #f7f7f7;
|
||
}
|
||
|
||
.name {
|
||
border-right: none !important;
|
||
}
|
||
}
|
||
|
||
.foot {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
background: #fff;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 5px 0px;
|
||
border-radius: 20rpx 20rpx 0 0;
|
||
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
||
|
||
.item {
|
||
width: 40%;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: center;
|
||
|
||
icon {
|
||
font-size: 21px;
|
||
}
|
||
|
||
text {
|
||
display: inline-block;
|
||
text-align: center;
|
||
width: 100%;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
.title2 {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
</style> |