sourceReport.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <template>
  2. <view class="source-report">
  3. <view class="source-content">
  4. <view class="source-box">
  5. <view class="steps" v-if="showStep">
  6. <view class="steps-list">
  7. <view class="steps-item" :class="{ active: activeIndex == index }"
  8. v-for="(item, index) in steps" :key="index">
  9. <view class="name">{{ item }}</view>
  10. <view class="dot"></view>
  11. </view>
  12. </view>
  13. </view>
  14. <!-- 位置 -->
  15. <view class="position-wrap" v-if="farmDetail?.name">
  16. <view class="address">
  17. <image class="location-img" :src="`${config.BASIC_IMG}home/adress-icon.png`" mode=""></image>
  18. <text>{{farmDetail.name}}({{farmDetail.address + farmDetail.district}})</text>
  19. </view>
  20. </view>
  21. <!-- 关闭,下一页 -->
  22. <view class="footer-btn">
  23. <div class="btn-item pre" v-show="activeIndex!==0" @click="hanldePrev">上一页</div>
  24. <view class="btn-item close" :class="{'isLeft': activeIndex===0, 'isRight': activeIndex===5}" @click="goBack">关闭</view>
  25. <view class="btn-item next" v-show="activeIndex!==5" @click="hanldeNext">下一页</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="report-info">
  30. <swiper ref="swiperRef" :indicator-dots="true" :autoplay="false" style="height: 100vh"
  31. :current="activeIndex" @change="handleSwiperChange">
  32. <swiper-item>
  33. <view class="item-content">
  34. <video v-if="videoUrl" :src="videoUrl" object-fit="cover" ref="myVideo" :show-fullscreen-btn="false"
  35. :autoplay="true" class="mp4" loop muted controls @canplay="onVideoReady">
  36. </video>
  37. <view class="mp4-title" :class="{'down': !showStep}">
  38. <text class="title-text">在线赏园</text>
  39. <view class="text">科学定义好吃,数字评估生态</view>
  40. </view>
  41. </view>
  42. </swiper-item>
  43. <swiper-item>
  44. <view class="item-content" v-if="reportData?.farmTeamImg">
  45. <up-image class="img-dom" width="100%" height="100vh"
  46. :src="reportData.farmTeamImg"
  47. mode="scaleToFill"></up-image>
  48. </view>
  49. </swiper-item>
  50. <swiper-item>
  51. <view class="item-content">
  52. <banner-two-vue ref="bannerTwoRef" :baseData="reportData" :activeIndex="activeIndex" @handleShow="handleShowPopup"></banner-two-vue>
  53. </view>
  54. </swiper-item>
  55. <swiper-item>
  56. <view class="item-content">
  57. <banner-three-vue :baseData="reportData"></banner-three-vue>
  58. </view>
  59. </swiper-item>
  60. <swiper-item>
  61. <view class="item-content">
  62. <banner-four-vue :baseData="reportData"></banner-four-vue>
  63. </view>
  64. </swiper-item>
  65. <swiper-item>
  66. <view class="item-content">
  67. <banner-five-vue :baseData="reportData"></banner-five-vue>
  68. </view>
  69. </swiper-item>
  70. </swiper>
  71. </view>
  72. <!-- 评分方法 -->
  73. <up-popup :show="showPopup" :round="12" mode="center" :closeable="true" bgCoor="transparent" @close="closePopup">
  74. <view class="banner-popup">
  75. <view class="popup-title">评分方法</view>
  76. <view class="popup-list popup-two">
  77. <view class="popup-item">
  78. <view class="label">
  79. <view><text class="name">{{ ruleName }}</text>{{ ruleObj[ruleName]?.text1 }}</view>
  80. </view>
  81. <view class="label">
  82. <view>{{ ruleObj[ruleName]?.text2 }}</view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </up-popup>
  88. </view>
  89. </template>
  90. <script setup>
  91. import config from "@/api/config.js"
  92. import bannerTwoVue from '../components/bannerTwo.vue';
  93. import bannerThreeVue from '../components/bannerThree.vue';
  94. import bannerFourVue from '../components/bannerFour.vue';
  95. import bannerFiveVue from '../components/bannerFive.vue';
  96. import {
  97. onMounted,
  98. ref,
  99. } from 'vue';
  100. import { onLoad } from '@dcloudio/uni-app'
  101. import HOME from '@/api/home.js'
  102. const props = defineProps({
  103. showStep: {
  104. type: Boolean,
  105. default: true,
  106. }
  107. })
  108. const activeIndex = ref(0)
  109. const steps = ["美景", "果园", "环境", "气象", "农事", "生态"];
  110. const videoUrl = ref(null)
  111. const farmDetail = ref(null)
  112. const myVideo = ref(null);
  113. const onVideoReady = () => {
  114. myVideo.value.play();
  115. };
  116. const swiperRef = ref(null);
  117. function handleSwiperChange(e) {
  118. activeIndex.value = e.detail.current
  119. }
  120. function hanldeNext() {
  121. activeIndex.value++
  122. }
  123. function hanldePrev() {
  124. activeIndex.value--
  125. }
  126. function goBack() {
  127. uni.navigateBack()
  128. }
  129. const currentFarmId = ref(null)
  130. onLoad(({farmId})=>{
  131. currentFarmId.value = farmId||766
  132. getFarmInfo()
  133. getReportData()
  134. getScoreRule()
  135. })
  136. const tableData = ref([])
  137. const reportData = ref(null)
  138. const getReportData = async () => {
  139. // 溯源报告
  140. const { data } = await HOME.getFarmReport({farmId: currentFarmId.value})
  141. reportData.value = data
  142. videoUrl.value = data.fineView;
  143. tableData.value = data.farmWorkAuths.filter(
  144. (item) => item.periodName === data.periodList[0]
  145. );
  146. };
  147. const getFarmInfo = () => {
  148. HOME.fetchFarmInfo({id: currentFarmId.value}).then(({data}) => {
  149. farmDetail.value = data
  150. })
  151. }
  152. // 评分方法弹窗
  153. const showPopup = ref(false)
  154. const bannerTwoRef = ref(null)
  155. const ruleName = ref("生境");
  156. const handleShowPopup = (name) => {
  157. ruleName.value = name;
  158. showPopup.value = true;
  159. bannerTwoRef.value.stopAutoClick()
  160. };
  161. function closePopup() {
  162. showPopup.value = false;
  163. bannerTwoRef.value.startAutoClick()
  164. }
  165. const ruleObj = ref({});
  166. const getScoreRule = () => {
  167. HOME.getScoreRule().then(({ data }) => {
  168. ruleObj.value = data;
  169. });
  170. };
  171. </script>
  172. <style lang="scss" scoped>
  173. .source-report {
  174. height: 100vh;
  175. width: 100%;
  176. overflow: hidden;
  177. position: relative;
  178. color: #fff;
  179. font-size: 28rpx;
  180. .source-content {
  181. position: absolute;
  182. z-index: 2;
  183. width: 100%;
  184. height: 100vh;
  185. pointer-events: none;
  186. .source-box {
  187. position: relative;
  188. width: 100%;
  189. height: 100%;
  190. }
  191. .steps {
  192. padding: 24rpx 8rpx;
  193. width: 100%;
  194. font-size: 26rpx;
  195. box-sizing: border-box;
  196. .line {
  197. background: rgba(255, 255, 255, 0.18);
  198. width: 100%;
  199. height: 3rpx;
  200. }
  201. .steps-list {
  202. display: flex;
  203. justify-content: space-between;
  204. width: 100%;
  205. border-bottom: 3rpx solid rgba(255, 255, 255, 0.18);
  206. }
  207. .steps-item {
  208. flex: 1;
  209. margin-bottom: -9rpx;
  210. .name {
  211. text-align: center;
  212. background: #035197;
  213. border-radius: 40rpx;
  214. padding: 6rpx;
  215. width: 108rpx;
  216. margin: 0 auto 16rpx;
  217. font-size: 24rpx;
  218. }
  219. .dot {
  220. width: 16rpx;
  221. height: 16rpx;
  222. background: rgba(0, 0, 0, 0.5);
  223. border-radius: 50%;
  224. margin: auto;
  225. position: relative;
  226. &::before {
  227. content: "";
  228. position: absolute;
  229. left: -4rpx;
  230. top: -4rpx;
  231. width: 24rpx;
  232. height: 24rpx;
  233. background: rgba(255, 255, 255, 0.3);
  234. border-radius: 50%;
  235. }
  236. }
  237. &.active {
  238. .name {
  239. background-image: linear-gradient(45deg, #ffd887, #ed9e1e);
  240. }
  241. .dot {
  242. background: #ffd489;
  243. }
  244. }
  245. }
  246. }
  247. .position-wrap {
  248. z-index: 2;
  249. position: absolute;
  250. bottom: 220rpx;
  251. left: 24rpx;
  252. width: calc(100% - 48rpx);
  253. display: flex;
  254. flex-direction: column;
  255. align-items: center;
  256. .address {
  257. width: 100%;
  258. color: #f0d09c;
  259. padding: 20rpx 0;
  260. background: rgba(0, 0, 0, 0.5);
  261. border-radius: 10rpx;
  262. box-sizing: border-box;
  263. display: flex;
  264. font-size: 26rpx;
  265. align-items: center;
  266. justify-content: center;
  267. .location-img {
  268. width: 34rpx;
  269. height: 38rpx;
  270. margin-right: 8rpx;
  271. }
  272. }
  273. }
  274. .footer-btn {
  275. position: absolute;
  276. z-index: 2;
  277. padding: 0 24rpx;
  278. width: 100%;
  279. box-sizing: border-box;
  280. display: flex;
  281. justify-content: space-between;
  282. left: auto;
  283. right: 0;
  284. bottom: 172rpx;
  285. .btn-item {
  286. font-size: 28rpx;
  287. color: #FFFFFF;
  288. padding: 14rpx 36rpx;
  289. width: 160rpx;
  290. box-sizing: border-box;
  291. border-radius: 50rpx;
  292. border: 2rpx solid rgba(255, 255, 255, 0.3);
  293. text-align: center;
  294. font-weight: 500;
  295. background: rgba(0, 0, 0, 0.6);
  296. pointer-events: all;
  297. }
  298. .pre {
  299. position: absolute;
  300. left: 24rpx;
  301. }
  302. .close {
  303. position: absolute;
  304. left: 50%;
  305. transform: translateX(-50%);
  306. &.isLeft {
  307. left: 24rpx;
  308. transform: none;
  309. }
  310. &.isRight {
  311. left: auto;
  312. right: 24rpx;
  313. transform: none;
  314. }
  315. }
  316. .next {
  317. position: absolute;
  318. left: auto;
  319. right: 24rpx;
  320. }
  321. .save {
  322. color: #ff8400;
  323. }
  324. }
  325. }
  326. .report-info {
  327. .item-content {
  328. height: 100vh;
  329. width: 100%;
  330. .mp4 {
  331. width: 100%;
  332. height: 100%;
  333. object-fit: cover;
  334. ::v-deep {
  335. .uni-video-video {
  336. object-fit: cover !important;
  337. }
  338. }
  339. }
  340. .mp4-title {
  341. position: absolute;
  342. top: 124rpx;
  343. left: 48rpx;
  344. font-size: 90rpx;
  345. &.down {
  346. top: 160rpx;
  347. }
  348. .title-text {
  349. font-family: "jiangxizhuokai";
  350. }
  351. .text {
  352. margin-top: 8rpx;
  353. font-size: 32rpx;
  354. }
  355. }
  356. }
  357. }
  358. }
  359. </style>
  360. <style lang="scss">
  361. .banner-popup {
  362. padding: 26rpx 32rpx 50rpx 32rpx;
  363. color: #000;
  364. width: 90vw;
  365. box-sizing: border-box;
  366. background: #fff;
  367. border-radius: 24rpx;
  368. margin: 0 auto;
  369. .box-item {
  370. .box-title {
  371. display: flex;
  372. align-items: center;
  373. color: #000;
  374. font-size: 30rpx;
  375. // img {
  376. // width: 30rpx;
  377. // height: 18rpx;
  378. // margin-right: 12rpx;
  379. // }
  380. .text {
  381. width: 100%;
  382. font-family: "jiangxizhuokai";
  383. display: flex;
  384. align-items: center;
  385. justify-content: space-between;
  386. .more {
  387. color: #bbbbbb;
  388. display: flex;
  389. align-items: center;
  390. font-size: 26rpx;
  391. }
  392. }
  393. }
  394. .tabs {
  395. margin-top: 20rpx;
  396. display: flex;
  397. justify-content: center;
  398. font-size: 26rpx;
  399. color: #666666;
  400. .tabs-item {
  401. padding: 6rpx 46rpx;
  402. border-radius: 40rpx;
  403. background: rgba(0, 0, 0, 0.09);
  404. &.active {
  405. color: #fff;
  406. background-image: linear-gradient(90deg, #ffd887, #ed9e1e);
  407. }
  408. }
  409. .tabs-item+.tabs-item {
  410. margin-left: 40rpx;
  411. }
  412. }
  413. }
  414. .popup-title {
  415. font-family: "PangMenZhengDao";
  416. font-size: 48rpx;
  417. margin: 32rpx 0;
  418. text-align: center;
  419. }
  420. .popup-list {
  421. .popup-item {
  422. position: relative;
  423. margin-left: 26rpx;
  424. &::before {
  425. content: "";
  426. position: absolute;
  427. left: -26rpx;
  428. top: 20rpx;
  429. width: 10rpx;
  430. height: 10rpx;
  431. border-radius: 50%;
  432. background: #999999;
  433. margin-right: 10rpx;
  434. }
  435. .label {
  436. font-size: 36rpx;
  437. .name {
  438. margin-right: 8rpx;
  439. }
  440. .num {
  441. color: #ff8400;
  442. }
  443. }
  444. .desc {
  445. margin-top: 8rpx;
  446. color: #999999;
  447. }
  448. }
  449. .popup-item+.popup-item {
  450. margin-top: 32rpx;
  451. }
  452. }
  453. .popup-two {
  454. .popup-item {
  455. .label {
  456. font-size: 28rpx;
  457. color: #999999;
  458. .name {
  459. color: #000;
  460. }
  461. }
  462. .label+.label {
  463. margin-top: 24rpx;
  464. }
  465. }
  466. }
  467. }
  468. </style>