|
@@ -1,25 +1,25 @@
|
|
|
<template>
|
|
|
<view class="sub-base-container">
|
|
|
<view class="tree-info">
|
|
|
- <image class="image" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></image>
|
|
|
+ <image class="image" mode="aspectFill" :src="getImageUrl(treeData.treeImages[0].filename)"></image>
|
|
|
<view class="info-cont">
|
|
|
<view class="tree-name">果树档案</view>
|
|
|
<view class="text-wrap">
|
|
|
<view class="row-text">
|
|
|
<text class="label">树木名称</text>
|
|
|
- <text>茜茜荔</text>
|
|
|
+ <text>{{treeName}}</text>
|
|
|
</view>
|
|
|
<view class="row-text">
|
|
|
<text class="label">树木编号</text>
|
|
|
- <text>LCJGHN-GZCH-LBY0011</text>
|
|
|
+ <text>{{treeData.buyList[0].code}}</text>
|
|
|
</view>
|
|
|
<view class="row-text">
|
|
|
<text class="label">来自农场</text>
|
|
|
- <text>从化荔枝博览园</text>
|
|
|
+ <text>{{treeData.countyName}}{{treeData.farmName}}</text>
|
|
|
</view>
|
|
|
<view class="row-text">
|
|
|
<text class="label">品种树龄</text>
|
|
|
- <text>井岗红糯-18年</text>
|
|
|
+ <text>{{treeData.pz}}-{{treeData.age}}年</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -41,7 +41,7 @@
|
|
|
</view>
|
|
|
<view class="diary-cont">
|
|
|
<template v-if="active === 0">
|
|
|
- <view class="text">今天是我开花的日子今天是我开花的日子今天是我开花的日子今天是我开花的日子</view>
|
|
|
+ <view class="text">{{diaryData.content}}</view>
|
|
|
<view class="photo">
|
|
|
<image class="img" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></image>
|
|
|
</view>
|
|
@@ -51,14 +51,14 @@
|
|
|
<image class="img" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></image>
|
|
|
<image class="img float" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></image>
|
|
|
</view>
|
|
|
- <view class="text">今天是我开花的日子今天是我开花的日子今天是我开花的日子今天是我开花的日子</view>
|
|
|
+ <view class="text">{{diaryData.content}}</view>
|
|
|
</view>
|
|
|
<view class="template-2" v-else="active === 2">
|
|
|
<view class="photo-group">
|
|
|
<image class="img" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></image>
|
|
|
<image class="img float" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></image>
|
|
|
</view>
|
|
|
- <view class="text">今天是我开花的日子今天是我开花的日子今天是我开花的日子今天是我开花的日子</view>
|
|
|
+ <view class="text">{{diaryData.content}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -77,6 +77,56 @@
|
|
|
<script setup>
|
|
|
import config from "@/api/config.js"
|
|
|
import {ref} from "vue"
|
|
|
+ import TREE from '@/api/tree.js'
|
|
|
+ import {
|
|
|
+ onLoad
|
|
|
+ } from '@dcloudio/uni-app'
|
|
|
+ const resize = "?x-oss-process=image/resize,w_1000";
|
|
|
+
|
|
|
+ const getImageUrl = (filename) =>{
|
|
|
+ if (filename?.startsWith("https")) {
|
|
|
+ return filename; // 直接使用完整 URL
|
|
|
+ } else {
|
|
|
+ return config.BASE_IMG_URL + filename + resize; // 拼接基础 URL
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const sampleId = ref('')
|
|
|
+ onLoad((options)=>{
|
|
|
+ sampleId.value = options.sampleId
|
|
|
+ featchGetSampleDiary()
|
|
|
+ getBySampleId()
|
|
|
+ })
|
|
|
+
|
|
|
+ const diaryData = ref({})
|
|
|
+ const featchGetSampleDiary = () =>{
|
|
|
+ const params = {
|
|
|
+ sampleId:110950,
|
|
|
+ createDateStart:'2025-04-13',
|
|
|
+ createDateEnd:'2025-04-13',
|
|
|
+ page:1,
|
|
|
+ limit:1
|
|
|
+ }
|
|
|
+ TREE.getSampleDiary(params).then(res =>{
|
|
|
+ if(res.data.length){
|
|
|
+ diaryData.value = res.data[0]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const treeData = ref({})
|
|
|
+ const treeName = ref('')
|
|
|
+ const getBySampleId = () => {
|
|
|
+ TREE.getBySampleId({
|
|
|
+ sampleId: sampleId.value
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ treeData.value = data || {}
|
|
|
+ treeName.value = data.buyList[0].treeName || (data.buyList[0].nickname.length ? data.buyList[0]
|
|
|
+ .nickname.slice(0, 3) + "荔" : data.buyList[0].owner.slice(0, 3) + "荔")
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
function formatDate(timestamp,type) {
|
|
|
const date = new Date(timestamp);
|