kitchendDevice/pages/add/Preview.vue

273 lines
4.5 KiB
Vue
Raw Normal View History

2025-03-25 10:17:30 +08:00
<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>
2025-04-02 09:49:39 +08:00
<!-- -->
<view class="title title2">
<view class="">菜谱类型</view>
<view>{{menu[cookIndex].name}}</view>
</view>
2025-03-25 10:17:30 +08:00
<!-- 食材 -->
<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">
2025-04-02 09:49:39 +08:00
{{ite.weight}}{{ite.unit}}
2025-03-25 10:17:30 +08:00
</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 {
2025-04-02 09:49:39 +08:00
info: {
2025-11-25 14:21:22 +08:00
FMimg: "",
2025-04-02 09:49:39 +08:00
cook_label: null,
title: "",
description: "",
food_list: [],
cover: null, //封面id
step_list: []
},
cookIndex: null,
2025-03-25 10:17:30 +08:00
}
},
2025-04-02 09:49:39 +08:00
computed: {
2025-11-25 14:21:22 +08:00
...mapState(["user", "configInfo"]),
2025-04-02 09:49:39 +08:00
menu() {
2025-11-25 14:21:22 +08:00
return this.configInfo.cookbook_label
2025-04-02 09:49:39 +08:00
},
},
2025-03-25 10:17:30 +08:00
onLoad(options) {
let that = this
2025-04-02 09:49:39 +08:00
let info = JSON.parse(options.info)
2025-03-25 10:17:30 +08:00
that.info = info
2025-04-02 09:49:39 +08:00
that.cookIndex = that.menu.findIndex(ite => ite.id == info.cook_label)
console.log("预览", info)
2025-03-25 10:17:30 +08:00
},
methods: {}
}
</script>
<style lang="scss" scoped>
.content {
2025-11-25 14:21:22 +08:00
padding: 0 30rpx;
2025-03-25 10:17:30 +08:00
}
.topimg {
width: 100%;
2025-11-25 14:21:22 +08:00
height: 340rpx;
2025-03-25 10:17:30 +08:00
background: #fff;
2025-11-25 14:21:22 +08:00
border-radius: 20rpx;
2025-03-25 10:17:30 +08:00
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
flex-direction: column;
2025-11-25 14:21:22 +08:00
margin: 20rpx 0;
2025-03-25 10:17:30 +08:00
overflow: hidden;
position: relative;
.iconfont {
2025-11-25 14:21:22 +08:00
font-size: 60rpx;
2025-03-25 10:17:30 +08:00
color: $maincolor;
}
text {
display: inline-block;
width: 100%;
text-align: center;
2025-11-25 14:21:22 +08:00
font-size: 24rpx;
2025-03-25 10:17:30 +08:00
color: #999;
}
.text {
font-size: 16px;
color: #666;
margin-bottom: 3px;
}
image {
width: 100%;
height: inherit;
}
}
.step {
.image {
2025-11-25 14:21:22 +08:00
height: 340rpx;
2025-03-25 10:17:30 +08:00
margin: auto;
background: #f7f7f7;
2025-11-25 14:21:22 +08:00
border-radius: 20rpx;
2025-03-25 10:17:30 +08:00
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 {
2025-11-25 14:21:22 +08:00
font-size: 60rpx;
2025-03-25 10:17:30 +08:00
color: #ff4c4f;
margin-bottom: 5px;
}
}
}
.title {
2025-11-25 14:21:22 +08:00
padding: 20rpx;
2025-03-25 10:17:30 +08:00
.table {
font-size: 16px;
font-weight: bold;
}
.user {
display: flex;
justify-content: space-between;
align-items: center;
2025-11-25 14:21:22 +08:00
margin-top: 30rpx;
2025-03-25 10:17:30 +08:00
.left {
display: flex;
align-items: center;
image {
2025-11-25 14:21:22 +08:00
width: 50rpx;
height: 50rpx;
2025-03-25 10:17:30 +08:00
margin-right: 5px;
border-radius: 50%;
}
}
.right {
display: flex;
}
}
}
.desc {
width: 100%;
2025-11-25 14:21:22 +08:00
line-height: 50rpx;
margin-bottom: 20rpx;
2025-03-25 10:17:30 +08:00
}
.h4 {
2025-11-25 14:21:22 +08:00
margin: 20rpx 0;
padding-top: 20rpx;
2025-03-25 10:17:30 +08:00
border-top: 1px solid #f7f7f7;
.close {
color: #fff;
width: 100px;
display: flex;
align-items: center;
justify-content: center;
2025-11-25 14:21:22 +08:00
border-radius: 20rpx;
2025-03-25 10:17:30 +08:00
background-color: $maincolor;
image {
2025-11-25 14:21:22 +08:00
width: 50rpx;
height: 50rpx;
2025-03-25 10:17:30 +08:00
}
}
}
.step {
2025-11-25 14:21:22 +08:00
margin-bottom: 120rpx;
2025-03-25 10:17:30 +08:00
}
.foodlist {
2025-11-25 14:21:22 +08:00
border-radius: 20rpx;
2025-03-25 10:17:30 +08:00
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;
2025-11-25 14:21:22 +08:00
border-radius: 20rpx 20rpx 0 0;
2025-03-25 10:17:30 +08:00
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
.item {
2025-11-25 14:21:22 +08:00
width: 40%;
2025-03-25 10:17:30 +08:00
display: flex;
flex-wrap: wrap;
justify-content: center;
icon {
font-size: 21px;
}
text {
display: inline-block;
text-align: center;
width: 100%;
}
}
}
2025-04-02 09:49:39 +08:00
.title2 {
display: flex;
align-items: center;
justify-content: space-between;
}
2025-03-25 10:17:30 +08:00
</style>