|
@@ -42,6 +42,30 @@
|
|
|
<span v-html="warningDetail.content"></span>
|
|
<span v-html="warningDetail.content"></span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+ <div class="photo-img-wrap-container" v-if="cropAlbum.length">
|
|
|
|
|
+ <div class="photo-img-wrap-title">
|
|
|
|
|
+ <div class="title-text">
|
|
|
|
|
+ <span>作物相册</span>
|
|
|
|
|
+ <span class="count">({{ cropAlbum.length }})</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <span class="more" @click="handleSeeMore">查看更多</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="photo-img-wrap">
|
|
|
|
|
+ <photo-provider :photo-closable="true">
|
|
|
|
|
+ <photo-consumer
|
|
|
|
|
+ v-for="(src, index) in cropAlbum"
|
|
|
|
|
+ intro="执行照片"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :src="base_img_url2 + src.filename"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div class="photo-img">
|
|
|
|
|
+ <img :src="base_img_url2 + src.filename + resize_300" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </photo-consumer>
|
|
|
|
|
+ </photo-provider>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
<div class="custom-bottom-fixed-btns" v-if="!isLink">
|
|
<div class="custom-bottom-fixed-btns" v-if="!isLink">
|
|
|
<div class="bottom-btn primary-btn" @click="showShareSheet = true">转发</div>
|
|
<div class="bottom-btn primary-btn" @click="showShareSheet = true">转发</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -54,17 +78,27 @@
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import customHeader from "@/components/customHeader.vue";
|
|
import customHeader from "@/components/customHeader.vue";
|
|
|
import { ref, onActivated } from "vue";
|
|
import { ref, onActivated } from "vue";
|
|
|
|
|
+import { base_img_url2, resize_300 } from "@/api/config";
|
|
|
import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
|
|
import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
|
|
|
import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
|
|
import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
|
|
|
-import { useRoute } from "vue-router";
|
|
|
|
|
|
|
+import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
+import wx from "weixin-js-sdk";
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
|
-
|
|
|
|
|
|
|
+const router = useRouter();
|
|
|
const showShareSheet = ref(false);
|
|
const showShareSheet = ref(false);
|
|
|
const shareOptions = ref([{ name: "微信", icon: "wechat", type: "wechat" }]);
|
|
const shareOptions = ref([{ name: "微信", icon: "wechat", type: "wechat" }]);
|
|
|
-const handleShareSelect = (option) => {
|
|
|
|
|
- console.log("option", option);
|
|
|
|
|
-
|
|
|
|
|
|
|
+const handleShareSelect = () => {
|
|
|
|
|
+ // const query = {
|
|
|
|
|
+ // askInfo: { title: "提醒客户", content: "是否分享该提醒给好友" },
|
|
|
|
|
+ // shareText: warningDetail.value.title,
|
|
|
|
|
+ // targetUrl: `warning_detail`,
|
|
|
|
|
+ // paramsPage: JSON.stringify(route.query),
|
|
|
|
|
+ // imageUrl: "https://birdseye-img.sysuimars.com/birdseye-look-mini/invite_bg.png",
|
|
|
|
|
+ // };
|
|
|
|
|
+ // wx.miniProgram.navigateTo({
|
|
|
|
|
+ // url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=sharePage`,
|
|
|
|
|
+ // });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const isLink = ref(true);
|
|
const isLink = ref(true);
|
|
@@ -76,6 +110,18 @@ onActivated(() => {
|
|
|
showImage.value = route.query.showImage === "true" ? true : false;
|
|
showImage.value = route.query.showImage === "true" ? true : false;
|
|
|
isLink.value = localStorage.getItem("SET_USER_CUR_ROLE") == 2 ? false : true;
|
|
isLink.value = localStorage.getItem("SET_USER_CUR_ROLE") == 2 ? false : true;
|
|
|
// isLink.value = true;
|
|
// isLink.value = true;
|
|
|
|
|
+ // console.log("route.query", route.query);
|
|
|
|
|
+ // if(route.query.miniJson){
|
|
|
|
|
+ // const data = JSON.parse(route.query.miniJson);
|
|
|
|
|
+ // }else{
|
|
|
|
|
+ // if (route.query.questInfo) {
|
|
|
|
|
+ // const infoObj = JSON.parse(route.query.questInfo);
|
|
|
|
|
+ // questInfo.value = {
|
|
|
|
|
+ // quest: infoObj.quest,
|
|
|
|
|
+ // answer: JSON.parse(infoObj.answer),
|
|
|
|
|
+ // };
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
if (route.query.questInfo) {
|
|
if (route.query.questInfo) {
|
|
|
const infoObj = JSON.parse(route.query.questInfo);
|
|
const infoObj = JSON.parse(route.query.questInfo);
|
|
|
questInfo.value = {
|
|
questInfo.value = {
|
|
@@ -83,6 +129,10 @@ onActivated(() => {
|
|
|
answer: JSON.parse(infoObj.answer),
|
|
answer: JSON.parse(infoObj.answer),
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
+ if(isLink.value){
|
|
|
|
|
+ // 获取图片数据
|
|
|
|
|
+ getFarmPhoto();
|
|
|
|
|
+ }
|
|
|
getWarningDetail();
|
|
getWarningDetail();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -97,7 +147,7 @@ const getWarningDetail = () => {
|
|
|
|
|
|
|
|
const activeUploadPopupRef = ref(null);
|
|
const activeUploadPopupRef = ref(null);
|
|
|
const handleAnswerClick = (item) => {
|
|
const handleAnswerClick = (item) => {
|
|
|
- if(item.value != 0) {
|
|
|
|
|
|
|
+ if (item.value != 0) {
|
|
|
activeUploadPopupRef.value.showPopup({
|
|
activeUploadPopupRef.value.showPopup({
|
|
|
gardenIdVal: route.query.farmId,
|
|
gardenIdVal: route.query.farmId,
|
|
|
problemTitleVal: questInfo.value.quest,
|
|
problemTitleVal: questInfo.value.quest,
|
|
@@ -110,6 +160,60 @@ const handleAnswerClick = (item) => {
|
|
|
const handleUploadSuccess = (data) => {
|
|
const handleUploadSuccess = (data) => {
|
|
|
console.log("data", data);
|
|
console.log("data", data);
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+const cropAlbum = ref([]);
|
|
|
|
|
+// 获取作物相册的三张照片(参考 patrolPhoto 的获取逻辑)
|
|
|
|
|
+const getFarmPhoto = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 先获取有图片的日期列表
|
|
|
|
|
+ const dateParams = {
|
|
|
|
|
+ farmId: route.query.farmId,
|
|
|
|
|
+ pageIndex: 0,
|
|
|
|
|
+ limit: 10,
|
|
|
|
|
+ };
|
|
|
|
|
+ const { data: dateData } = await VE_API.farm.findHasImagesDate(dateParams);
|
|
|
|
|
+ const dateList = Array.isArray(dateData) ? dateData : [];
|
|
|
|
|
+ if (!dateList.length) {
|
|
|
|
|
+ cropAlbum.value = [];
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const result = [];
|
|
|
|
|
+ let dateIndex = 0;
|
|
|
|
|
+
|
|
|
|
|
+ // 按日期依次取图片,直到凑够 3 张或没有更多日期
|
|
|
|
|
+ while (result.length < 3 && dateIndex < dateList.length) {
|
|
|
|
|
+ const currentDate = dateList[dateIndex];
|
|
|
|
|
+ const imgParams = {
|
|
|
|
|
+ farmId: route.query.farmId,
|
|
|
|
|
+ date: currentDate,
|
|
|
|
|
+ };
|
|
|
|
|
+ const { data } = await VE_API.farm.getImageInfo(imgParams);
|
|
|
|
|
+ const images = (data && Array.isArray(data.images)) ? data.images : [];
|
|
|
|
|
+
|
|
|
|
|
+ images.forEach((item) => {
|
|
|
|
|
+ if (result.length < 3) {
|
|
|
|
|
+ // 统一存成 filename 字段,供模板使用
|
|
|
|
|
+ result.push({
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ filename: item.resFilename || item.filename,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ dateIndex += 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ cropAlbum.value = result;
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.error("获取农场相册失败", e);
|
|
|
|
|
+ cropAlbum.value = [];
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handleSeeMore = () => {
|
|
|
|
|
+ router.push(`/farm_photo?farmId=${route.query.farmId}`);
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
@@ -171,6 +275,54 @@ const handleUploadSuccess = (data) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ .photo-img-wrap-container{
|
|
|
|
|
+ padding: 10px;
|
|
|
|
|
+ border-radius: 5px;
|
|
|
|
|
+ border: 1px solid rgba(233, 233, 233, 0.5);
|
|
|
|
|
+ .photo-img-wrap-title{
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ margin-bottom: 10px;
|
|
|
|
|
+ .title-text{
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ gap: 4px;
|
|
|
|
|
+ }
|
|
|
|
|
+ .more{
|
|
|
|
|
+ color: rgba(0, 0, 0, 0.6);
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .photo-img-wrap {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ gap: 10px;
|
|
|
|
|
+ ::v-deep {
|
|
|
|
|
+ .PhotoConsumer {
|
|
|
|
|
+ width: 31%;
|
|
|
|
|
+ height: 92px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ .photo-img {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ border: 2px solid transparent;
|
|
|
|
|
+ border-radius: 8px;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ img {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ border-radius: 8px;
|
|
|
|
|
+ object-fit: cover;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.article-box {
|
|
.article-box {
|
|
|
margin-bottom: 12px;
|
|
margin-bottom: 12px;
|
|
|
border-radius: 8px;
|
|
border-radius: 8px;
|