Forráskód Böngészése

新增农业云H5“通知公告”、“监测信息”、“政策法规”功能

张启 4 éve
szülő
commit
23a7bb0abd

+ 27 - 12
pages/meteorological/index.vue

@@ -1,19 +1,34 @@
 <template>
-	<view>
-		
-	</view>
+  <view class="meteorological">
+    <view class="page-content meteorological-content">
+      <view class="page-header meteorological-header">气象服务</view>
+      <view class="main-content meteorological-main"></view>
+    </view>
+  </view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			};
-		}
-	}
-</script>
+import { meteorologicalListData } from '@/agrcloud-api/meteorological';
 
-<style lang="scss">
+export default {
+  data() {
+    return {
+    };
+  },
+  onLoad() {
+  },
+  methods: {
+  }
+};
+</script>
 
+<style lang="scss" scoped>
+.meteorological {
+  .meteorological-content {
+    .meteorological-header {
+    }
+    .meteorological-main {
+    }
+  }
+}
 </style>

+ 234 - 11
pages/monitoring/index.vue

@@ -1,19 +1,242 @@
 <template>
-	<view>
-		
-	</view>
+  <view class="monitoring">
+    <view class="monitoring-content">
+      <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="handleScrolltolower">
+        <view class="monitoring-listbody">
+          <!-- 列表无数据 -->
+          <template v-if="list_empty">
+            <view class="monitoring-listbody-nodata">
+              <text class="monitoring-listbody-nodata-text">暂无数据</text>
+            </view>
+          </template>
+
+          <!-- 列表有数据 -->
+          <template v-else>
+            <view
+              class="listbody-item"
+              v-for="monitoringItem in monitoringList"
+              :key="monitoringItem.id"
+              @click="handleMonitoringDetails(monitoringItem)"
+            >
+              <view class="item-container">
+                <view class="container-left">
+                  <view class="left-title">{{ monitoringItem.artTitle }}</view>
+                  <view class="left-releasetime">发布时间:{{ monitoringItem.artInTime }}</view>
+                </view>
+                <view class="container-right">
+                  <view class="right-content">
+                    <template v-if="monitoringItem.artImage">
+                      <image
+                        :src="baseApiUrl + monitoringItem.artImage"
+                        mode="scaleToFill"
+                        class="right-content-image"
+                      />
+                    </template>
+                    <template v-else>
+                      <image
+                        src="@/static/agrcloud-images/agrcloud-empty-img.png"
+                        mode="scaleToFill"
+                        class="right-content-image"
+                      />
+                    </template>
+                  </view>
+                </view>
+                <view style="clear: both;"></view>
+              </view>
+            </view>
+          </template>
+
+          <!-- 加载更多组件 -->
+          <uni-load-more :status="loadStatus" v-if="!list_empty"></uni-load-more>
+        </view>
+      </scroll-view>
+    </view>
+  </view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			};
-		}
-	}
+import {
+  monitoringListData
+} from '@/agrcloud-api/monitoring';
+import uniLoadMore from "@/agrcloud-components/uni-load-more/uni-load-more.vue"
+
+export default {
+  name: 'monitoring',
+  components: {
+    uniLoadMore
+  },
+  data() {
+    return {
+      loadStatus: 'more',
+      list_empty: false,
+      pageTotal: 0,
+      pageCount: 0,
+      pagination: {
+        artCategoryId: '2',
+        pageNum: 1,
+        pageSize: 10
+      },
+      monitoringList: []
+    };
+  },
+  onLoad() {
+    this.initData();
+  },
+  methods: {
+    /** 初始化数据 */
+    initData() {
+      this.getMonitoringListData();
+    },
+    /** 获取政策法规之列表数据 */
+    getMonitoringListData() {
+      this.list_empty = false;
+      this.loadStatus = 'loading';
+
+      monitoringListData(this.pagination).then(res => {
+        // 数据总条数
+        this.pageTotal = res.total || 0;
+
+        // 如果列表为第一页,返回列表数据清空
+        if (this.pagination.pageNum == 1) {
+          this.monitoringList = [];
+        };
+
+        // 处理返回结果
+        if ((res.rows || []).length <= 0) { // 返回结果没有数据
+          if ((this.monitoringList || []).length <= 0) {
+            this.loadStatus = 'noMores';
+            this.list_empty = true;
+          } else {
+            this.loadStatus = 'noMores';
+          }
+        } else { //返回结果有数据
+          this.list_empty = false;
+
+          // 获取列表数据分页数量
+          this.pageCount = Math.ceil((res.total || 0) / this.pagination.pageSize);
+          if ((res.total || 0) % this.pagination.pageSize == 0) {
+            this.pageCount = Math.ceil((res.total || 0) / this.pagination.pageSize);
+            if (this.pageCount == 1) {
+              this.pageCount--;
+            }
+          } else {
+            this.pageCount--;
+          };
+
+          // 处理页面状态
+          if (this.pageCount === 0) {
+            this.loadStatus = 'noMores'
+          } else {
+            this.loadStatus = 'more'
+          }
+
+          // 组装返回数据
+          this.monitoringList.push.apply(this.monitoringList, res.rows || []);
+
+          uni.stopPullDownRefresh();
+        }
+
+      }).catch(err => {
+        this.loadStatus = 'noMores';
+      });
+    },
+    handleScrolltolower() {
+      this.loadStatus = 'loading';
+      if (this.pagination.pageNum - 1 >= this.pageCount) {
+        this.loadStatus = 'noMores';
+        return;
+      } else {
+        this.pagination.pageNum++;
+        this.getMonitoringListData();
+      }
+    },
+    /** 政策法规之详情数据操作 */
+    handleMonitoringDetails(param) {
+      this.$store.dispatch("SetMonitoringDetails", param).then(() => {
+        uni.navigateTo({
+          url: '/pages/monitoring/details/index'
+        });
+      }).catch(() => {
+        this.$msgbox('访问数据异常!', 'none');
+      });
+    }
+  }
+}
 </script>
 
-<style lang="scss">
+<style lang="scss" scoped>
+.monitoring {
+  padding-top: 25rpx;
+  width: 100%;
+
+  .monitoring-content {
+    width: 100%;
+
+    .scroll-Y {
+      height: calc(
+        100vh - 88rpx - 100rpx - env(safe-area-inset-bottom) -
+          var(--status-bar-height)
+      );
+    }
+
+    .monitoring-listbody {
+      width: 100%;
+
+      .listbody-item {
+        width: 750rpx;
+        height: 208rpx;
+        background: #ffffff;
+        margin-bottom: 24rpx;
+
+        .item-container {
+          padding: 24rpx;
+
+          .container-left {
+            float: left;
+            width: 478rpx;
+
+            .left-title {
+              height: 84rpx;
+              font-size: 30rpx;
+              font-family: PingFangSC-Medium, PingFang SC;
+              font-weight: 500;
+              color: #333333;
+              line-height: 42rpx;
+            }
+
+            .left-releasetime {
+              margin-top: 16rpx;
+            }
+          }
+
+          .container-right {
+            float: left;
+            margin-left: 24rpx;
+
+            .right-content {
+              width: 200rpx;
+              height: 160rpx;
+              border-radius: 8rpx;
+
+              .right-content-image {
+                width: 200rpx;
+                height: 160rpx;
+              }
+            }
+          }
+        }
+      }
+
+      &-nodata {
+        text-align: center;
+        margin-top: 20rpx;
 
+        &-text {
+          font-size: 30rpx;
+          color: #777777;
+        }
+      }
+    }
+  }
+}
 </style>

+ 234 - 11
pages/notice/index.vue

@@ -1,19 +1,242 @@
 <template>
-	<view>
-		
-	</view>
+  <view class="notice">
+    <view class="notice-content">
+      <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="handleScrolltolower">
+        <view class="notice-listbody">
+          <!-- 列表无数据 -->
+          <template v-if="list_empty">
+            <view class="notice-listbody-nodata">
+              <text class="notice-listbody-nodata-text">暂无数据</text>
+            </view>
+          </template>
+
+          <!-- 列表有数据 -->
+          <template v-else>
+            <view
+              class="listbody-item"
+              v-for="noticeItem in noticeList"
+              :key="noticeItem.id"
+              @click="handleNoticeDetails(noticeItem)"
+            >
+              <view class="item-container">
+                <view class="container-left">
+                  <view class="left-title">{{ noticeItem.artTitle }}</view>
+                  <view class="left-releasetime">发布时间:{{ noticeItem.artInTime }}</view>
+                </view>
+                <view class="container-right">
+                  <view class="right-content">
+                    <template v-if="noticeItem.artImage">
+                      <image
+                        :src="baseApiUrl + noticeItem.artImage"
+                        mode="scaleToFill"
+                        class="right-content-image"
+                      />
+                    </template>
+                    <template v-else>
+                      <image
+                        src="@/static/agrcloud-images/agrcloud-empty-img.png"
+                        mode="scaleToFill"
+                        class="right-content-image"
+                      />
+                    </template>
+                  </view>
+                </view>
+                <view style="clear: both;"></view>
+              </view>
+            </view>
+          </template>
+
+          <!-- 加载更多组件 -->
+          <uni-load-more :status="loadStatus" v-if="!list_empty"></uni-load-more>
+        </view>
+      </scroll-view>
+    </view>
+  </view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			};
-		}
-	}
+import {
+  noticeListData
+} from '@/agrcloud-api/notice';
+import uniLoadMore from "@/agrcloud-components/uni-load-more/uni-load-more.vue"
+
+export default {
+  name: 'notice',
+  components: {
+    uniLoadMore
+  },
+  data() {
+    return {
+      loadStatus: 'more',
+      list_empty: false,
+      pageTotal: 0,
+      pageCount: 0,
+      pagination: {
+        artCategoryId: '1',
+        pageNum: 1,
+        pageSize: 10
+      },
+      noticeList: []
+    };
+  },
+  onLoad() {
+    this.initData();
+  },
+  methods: {
+    /** 初始化数据 */
+    initData() {
+      this.getNoticeListData();
+    },
+    /** 获取通知公告之列表数据 */
+    getNoticeListData() {
+      this.list_empty = false;
+      this.loadStatus = 'loading';
+
+      noticeListData(this.pagination).then(res => {
+        // 数据总条数
+        this.pageTotal = res.total || 0;
+
+        // 如果列表为第一页,返回列表数据清空
+        if (this.pagination.pageNum == 1) {
+          this.noticeList = [];
+        };
+
+        // 处理返回结果
+        if ((res.rows || []).length <= 0) { // 返回结果没有数据
+          if ((this.noticeList || []).length <= 0) {
+            this.loadStatus = 'noMores';
+            this.list_empty = true;
+          } else {
+            this.loadStatus = 'noMores';
+          }
+        } else { //返回结果有数据
+          this.list_empty = false;
+
+          // 获取列表数据分页数量
+          this.pageCount = Math.ceil((res.total || 0) / this.pagination.pageSize);
+          if ((res.total || 0) % this.pagination.pageSize == 0) {
+            this.pageCount = Math.ceil((res.total || 0) / this.pagination.pageSize);
+            if (this.pageCount == 1) {
+              this.pageCount--;
+            }
+          } else {
+            this.pageCount--;
+          };
+
+          // 处理页面状态
+          if (this.pageCount === 0) {
+            this.loadStatus = 'noMores'
+          } else {
+            this.loadStatus = 'more'
+          }
+
+          // 组装返回数据
+          this.noticeList.push.apply(this.noticeList, res.rows || []);
+
+          uni.stopPullDownRefresh();
+        }
+
+      }).catch(err => {
+        this.loadStatus = 'noMores';
+      });
+    },
+    handleScrolltolower() {
+      this.loadStatus = 'loading';
+      if (this.pagination.pageNum - 1 >= this.pageCount) {
+        this.loadStatus = 'noMores';
+        return;
+      } else {
+        this.pagination.pageNum++;
+        this.getNoticeListData();
+      }
+    },
+    /** 通知公告之详情数据操作 */
+    handleNoticeDetails(param) {
+      this.$store.dispatch("SetNoticeDetails", param).then(() => {
+        uni.navigateTo({
+          url: '/pages/notice/details/index'
+        });
+      }).catch(() => {
+        this.$msgbox('访问数据异常!', 'none');
+      });
+    }
+  }
+}
 </script>
 
-<style lang="scss">
+<style lang="scss" scoped>
+.notice {
+  padding-top: 25rpx;
+  width: 100%;
+
+  .notice-content {
+    width: 100%;
+
+    .scroll-Y {
+      height: calc(
+        100vh - 88rpx - 100rpx - env(safe-area-inset-bottom) -
+          var(--status-bar-height)
+      );
+    }
+
+    .notice-listbody {
+      width: 100%;
+
+      .listbody-item {
+        width: 750rpx;
+        height: 208rpx;
+        background: #ffffff;
+        margin-bottom: 24rpx;
+
+        .item-container {
+          padding: 24rpx;
+
+          .container-left {
+            float: left;
+            width: 478rpx;
+
+            .left-title {
+              height: 84rpx;
+              font-size: 30rpx;
+              font-family: PingFangSC-Medium, PingFang SC;
+              font-weight: 500;
+              color: #333333;
+              line-height: 42rpx;
+            }
+
+            .left-releasetime {
+              margin-top: 16rpx;
+            }
+          }
+
+          .container-right {
+            float: left;
+            margin-left: 24rpx;
+
+            .right-content {
+              width: 200rpx;
+              height: 160rpx;
+              border-radius: 8rpx;
+
+              .right-content-image {
+                width: 200rpx;
+                height: 160rpx;
+              }
+            }
+          }
+        }
+      }
+
+      &-nodata {
+        text-align: center;
+        margin-top: 20rpx;
 
+        &-text {
+          font-size: 30rpx;
+          color: #777777;
+        }
+      }
+    }
+  }
+}
 </style>

+ 21 - 69
pages/regulations/details/index.vue

@@ -1,7 +1,7 @@
 <template>
-  <view class="page-content complaintsdetails">
-    <view class="complaintsdetails-content">
-      <view class="complaintsdetails-item complaintsdetails-plauser">
+  <view class="page-content regulationsdetails">
+    <view class="regulationsdetails-content">
+      <view class="regulationsdetails-item regulationsdetails-arttitle">
         <view class="item-content">
           <view class="item-text">
             <view class="item-textlable">
@@ -13,7 +13,7 @@
           </view>
         </view>
       </view>
-      <view class="complaintsdetails-item complaintsdetails-plaphone">
+      <view class="regulationsdetails-item regulationsdetails-artauthor">
         <view class="item-content">
           <view class="item-text">
             <view class="item-textlable">
@@ -25,7 +25,7 @@
           </view>
         </view>
       </view>
-      <view class="complaintsdetails-item complaintsdetails-planame">
+      <view class="regulationsdetails-item regulationsdetails-artsummary">
         <view class="item-content">
           <view class="item-text">
             <view class="item-textlable">
@@ -37,12 +37,12 @@
           </view>
         </view>
       </view>
-      <view class="complaintsdetails-placontent">
-        <view class="placontent-text">
-          <view class="placontent-textlable">
-            <text class="placontent-lable">内容:</text>
+      <view class="regulationsdetails-artcontent">
+        <view class="artcontent-text">
+          <view class="artcontent-textlable">
+            <text class="artcontent-lable">内容:</text>
           </view>
-          <view class="placontent-textvalue">
+          <view class="artcontent-textvalue">
             <view class="u-content">
               <u-parse
                 :html="regulationsDetailsObj.artContent"
@@ -78,9 +78,9 @@ export default {
   methods: {
     /** 初始化数据 */
     initData() {
-      const currComplaintsDetailsItem = (this.$store.getters || {}).regulationsDetailsObj || {};
+      const currRegulationDetailsItem = (this.$store.getters || {}).regulationsDetailsObj || {};
       regulationsViewData({
-        id: currComplaintsDetailsItem.artId
+        id: currRegulationDetailsItem.artId
       }).then(res => {
         this.regulationsDetailsObj = res.data || {};
       }).catch(() => {
@@ -92,14 +92,14 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.complaintsdetails {
+.regulationsdetails {
   padding: 0;
 
-  .complaintsdetails-content {
+  .regulationsdetails-content {
     width: 100%;
     padding-top: 24rpx;
 
-    .complaintsdetails-item {
+    .regulationsdetails-item {
       height: 138rpx;
       padding-left: 24rpx;
       background-color: #ffffff;
@@ -142,19 +142,19 @@ export default {
       }
     }
 
-    .complaintsdetails-placontent {
+    .regulationsdetails-artcontent {
       margin-top: 24rpx;
       background-color: #ffffff;
       min-height: 154rpx;
 
-      .placontent-text {
+      .artcontent-text {
         padding: 24rpx;
 
-        .placontent-textlable {
+        .artcontent-textlable {
           height: 42rpx;
           line-height: 42rpx;
 
-          .placontent-lable {
+          .artcontent-lable {
             height: 42rpx;
             font-size: 30rpx;
             font-family: PingFangSC-Regular, PingFang SC;
@@ -164,8 +164,8 @@ export default {
           }
         }
 
-        .placontent-textvalue {
-          .placontent-textarea {
+        .artcontent-textvalue {
+          .artcontent-textarea {
             min-height: 48rpx;
             font-size: 34rpx;
             font-family: PingFangSC-Regular, PingFang SC;
@@ -175,54 +175,6 @@ export default {
         }
       }
     }
-
-    .complaintsdetails-plares {
-      margin-top: 24rpx;
-      background-color: #ffffff;
-      min-height: 154rpx;
-
-      .plares-text {
-        padding: 24rpx;
-
-        .plares-textlable {
-          height: 42rpx;
-          line-height: 42rpx;
-
-          .plares-lable {
-            height: 42rpx;
-            font-size: 30rpx;
-            font-family: PingFangSC-Regular, PingFang SC;
-            font-weight: 400;
-            color: #666666;
-            line-height: 42rpx;
-          }
-        }
-
-        .plares-textvalue {
-          .plares-textarea {
-            min-height: 48rpx;
-            font-size: 34rpx;
-            font-family: PingFangSC-Regular, PingFang SC;
-            font-weight: 400;
-            color: #333333;
-          }
-        }
-
-        .plares-textnovalue {
-          height: 48rpx;
-          line-height: 48rpx;
-
-          .plares-value {
-            height: 48rpx;
-            font-size: 34rpx;
-            font-family: PingFangSC-Regular, PingFang SC;
-            font-weight: 400;
-            color: #333333;
-            line-height: 48rpx;
-          }
-        }
-      }
-    }
   }
 }
 </style>

+ 1 - 4
pages/regulations/index.vue

@@ -93,7 +93,6 @@ export default {
       this.loadStatus = 'loading';
 
       regulationsListData(this.pagination).then(res => {
-        debugger
         // 数据总条数
         this.pageTotal = res.total || 0;
 
@@ -142,7 +141,6 @@ export default {
       });
     },
     handleScrolltolower() {
-      debugger;
       this.loadStatus = 'loading';
       if (this.pagination.pageNum - 1 >= this.pageCount) {
         this.loadStatus = 'noMores';
@@ -166,8 +164,7 @@ export default {
 }
 </script>
 
-<style lang="scss"
-  scoped>
+<style lang="scss" scoped>
 .regulations {
   padding-top: 25rpx;
   width: 100%;