Przeglądaj źródła

4.18对接接口

bulusiLuo 3 lat temu
rodzic
commit
6037eb60e9

+ 1 - 1
package.json

@@ -11,7 +11,7 @@
   },
   "dependencies": {
     "axios": "0.18.1",
-    "core-js": "^2.6.11",
+    "core-js": "^2.6.12",
     "echarts": "^4.8.0",
     "element-resize-detector": "^1.2.2",
     "element-ui": "2.13.0",

+ 18 - 0
src/router/router.config.js

@@ -186,6 +186,24 @@ export const sysMenu = [
                     meta: { title: '停水公告' }
                 }]
             },
+            {
+                path: '',
+                pathId: 'regulations',
+                type: 'sys',
+                component: Layout,
+                // alwaysShow: true,
+                label: '政策法规',
+                meta: { title: '政策法规', icon: "iconfont iconkaohezonglan" },
+                children: [{
+                    path: 'regulations',
+                    name: 'regulations',
+                    type: 'sys',
+                    component: () =>
+                        import ('@/views/currentSystem/InfoDisclosure/regulations.vue'),
+                    label: '政策法规',
+                    meta: { title: '政策法规' }
+                }]
+            },
         ]
         
     },

+ 35 - 0
src/store/modules/notice.js

@@ -0,0 +1,35 @@
+import { getCurrentPage } from "@/api/currentpage";
+
+const getDefaultState = () => {
+  return {
+    // 返回的公告总数据
+    records: [],
+
+  }
+}
+
+const state = getDefaultState()
+
+const mutations = {
+  SET_RESULT: (state, records) => {
+    state.records = records
+  },
+}
+
+const actions = {
+    getCurrentPage({commit},data){
+        getCurrentPage(data).then(res=>{
+            if(res.code===1){
+                commit('SET_RESULT',res.result.records)
+            }
+        })
+    }
+}
+
+export default {
+    namespaced: true,
+    state,
+    mutations,
+    actions
+}
+

+ 19 - 7
src/views/currentSystem/InfoDisclosure/announcement.vue

@@ -36,18 +36,29 @@ export default {
       result: {},
       // 详情页数据
       detailObj: {},
+      /* 
+        moduleType        0公司动态 1信息公开
+        moduleFunction    0公司动态 1办事公开 2停水通知 3政策法规  
+      */
+      moduleType: 1,
+      moduleFunction: 2,
     };
   },
-  created() {
+  mounted() {
     // 请求停水列表数据与详情
-    getCurrentPage().then((res) => {
-      console.log(res);
-      if (res.code === 1) {
-        this.result = res.result;
-      }
-    });
+    this.getCurrentPage();
   },
   methods: {
+    // 获取数据
+    getCurrentPage() {
+      let data = { moduleType: 1, moduleFunction: 2 };
+      getCurrentPage(data).then((res) => {
+        console.log("lz", res);
+        if (res.code === 1) {
+          this.result = res.result;
+        }
+      });
+    },
     // 点击标题
     toDetail(proId) {
       this.ishowDetails = false;
@@ -56,6 +67,7 @@ export default {
           this.detailObj = item;
         }
       });
+      // console.log(this.detailObj.content);
     },
     backFn() {
       this.ishowDetails = true;

+ 23 - 16
src/views/currentSystem/InfoDisclosure/dataile.vue

@@ -3,16 +3,14 @@
     <!-- 详情页 -->
     <div class="main">
       <div class="title">
-        <h2>{{detailObj.theme}}</h2>  
+        <h2>{{ detailObj.theme }}</h2>
       </div>
-      <div class="content">
-        <p>
-          {{detailObj.content}}
-        </p>
+      <div class="contentText">
+        <!-- {{detailObj.content}} -->
       </div>
       <div class="down">
-        <div class="date">{{detailObj.createTime}}</div>
-        <div class="author">{{detailObj.createUserName}}</div>
+        <div class="date">{{ detailObj.createTime }}</div>
+        <div class="author">{{ detailObj.createUserName }}</div>
       </div>
       <p @click="backFn"><a href="javascript:;">⬅返回上一页</a></p>
     </div>
@@ -21,16 +19,26 @@
 
 <script>
 export default {
-  props:{
-    detailObj:{
-      type:Object,
-      default:{}
-    }
+  props: {
+    detailObj: {
+      type: Object,
+      default: {},
+    },
   },
   data() {
     return {};
   },
+  mounted() {
+    this.getContent();
+  },
   methods: {
+    getContent() {
+      let text1 = document.querySelector(".contentText");
+      let str = JSON.parse(JSON.stringify(this.detailObj.content))
+      let str1 =str.replace(`<img`,`<img style='width:100%;'`)
+      // .replace(`<p`,`<p style='text-indent:2em;min-height:48vh;'`)
+      text1.innerHTML = str1;
+    },
     backFn() {
       this.$emit("backFn");
     },
@@ -47,11 +55,9 @@ export default {
     color: #3f7ac0;
   }
   .main {
-    .content {
+    .contentText {
       text-indent: 2em;
-      min-height: 50vh;
-      border: 1px solid #ccc;
-      background-color: #fff;
+      min-height: 48vh;
       p {
         line-height: 24px;
         text-align: justify;
@@ -60,6 +66,7 @@ export default {
         padding: 8px;
         margin: 0;
       }
+      
     }
     .down {
       margin-top: 40px;

+ 72 - 61
src/views/currentSystem/InfoDisclosure/openWork.vue

@@ -3,63 +3,74 @@
     <!-- 办事公开 -->
     <div class="content">
       <div class="mian" v-if="ishowDetails">
-        <Notice :records="records" title="办事公开公告" @toDetail='toDetail'></Notice>
+        <Notice
+          :records="result.records"
+          title="办事公开公告"
+          @toDetail="toDetail"
+        ></Notice>
         <Pagination />
       </div>
-       <div class="datails" v-else>
-         <Datails :detailObj="detailObj" @backFn='backFn'></Datails>
-        </div> 
+      <div class="datails" v-else>
+        <Datails :detailObj="detailObj" @backFn="backFn"></Datails>
+      </div>
     </div>
   </div>
 </template>
 
 <script>
-import Pagination from '@/components/Pagination/index.vue'
-import Notice from '@/components/notice/index.vue'
-import Datails from './dataile.vue'
+import Pagination from "@/components/Pagination/index.vue";
+import Notice from "@/components/notice/index.vue";
+import Datails from "./dataile.vue";
+import { getCurrentPage } from "@/api/currentpage";
 export default {
-    components:{
-        Pagination,
-        Notice,
-        Datails
-    },
+  components: {
+    Pagination,
+    Notice,
+    Datails,
+  },
   data() {
     return {
-      ishowDetails:true,
-      detailObj:{
-            content: "hdahadhaod",
-            createTime: "2022-03-14 11:47:11",
-            createUserName: "luozhi",
-            id: 1,
-            theme:"办事公开"
-          },
-      records:[
-        {
-          id:1,
-          theme:'办事公开',
-          createTime:'2022-3.18'
-        },
-        {
-          id:2,
-          theme:'办事公开2',
-          createTime:'2022-3.18'
-        },
-        {
-          id:3,
-          theme:'办事公开3',
-          createTime:'2022-3.18'
-        },
-      ]
+      moduleType: 1,
+      moduleFunction: 1,
+      ishowDetails: true,
+      detailObj: {},
+      // 返回的公告总数据
+      result: {},
+      /* 
+        moduleType        0公司动态 1信息公开
+        moduleFunction    0公司动态 1办事公开 2停水通知 3政策法规  
+      */
+      moduleType: 1,
+      moduleFunction: 1,
     };
   },
+  mounted() {
+    // 请求停水列表数据与详情
+    this.getCurrentPage();
+  },
   methods: {
-    toDetail(){
-      this.ishowDetails=false
+    // 获取数据
+    getCurrentPage() {
+      let data = { moduleType: this.moduleType, moduleFunction: this.moduleFunction };
+      getCurrentPage(data).then((res) => {
+        console.log("lz", res);
+        if (res.code === 1) {
+          this.result = res.result;
+        }
+      });
     },
-    backFn(){
-      this.ishowDetails=true
-    }
-  }
+    toDetail(proId) {
+      this.ishowDetails = false;
+      this.result.records.forEach((item) => {
+        if (item.id === proId) {
+          this.detailObj = item;
+        }
+      });
+    },
+    backFn() {
+      this.ishowDetails = true;
+    },
+  },
 };
 </script>
 
@@ -67,25 +78,25 @@ export default {
 .t-container {
   width: 100%;
 }
-ul{
+ul {
   min-height: 50vh;
-    li{
-        display: flex;
-        justify-content: space-between;
-        align-items: center;
-        font-size: 20px;
-        position: relative;
-        margin: 20px 0 20px 10px;
-        .l::before{
-            content: '';
-            position: absolute;
-            left: -8px;
-            top: 8px;
-            width: 4px;
-            height: 4px;
-            background: #000;
-            border-radius: 50%;
-        }
+  li {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    font-size: 20px;
+    position: relative;
+    margin: 20px 0 20px 10px;
+    .l::before {
+      content: "";
+      position: absolute;
+      left: -8px;
+      top: 8px;
+      width: 4px;
+      height: 4px;
+      background: #000;
+      border-radius: 50%;
     }
+  }
 }
 </style>

+ 101 - 0
src/views/currentSystem/InfoDisclosure/regulations.vue

@@ -0,0 +1,101 @@
+<template>
+  <div class="t-container">
+    <!-- 政策法规 -->
+    <div class="content">
+      <div class="mian" v-if="ishowDetails">
+        <Notice
+          :records="records"
+          title="政策法规"
+          @toDetail="toDetail"
+        ></Notice>
+        <Pagination />
+      </div>
+      <div class="datails" v-else>
+        <Datails :detailObj="detailObj" @backFn="backFn"></Datails>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import Pagination from "@/components/Pagination/index.vue";
+import Notice from "@/components/notice/index.vue";
+import Datails from "./dataile.vue";
+import { getCurrentPage } from "@/api/currentpage";
+export default {
+  components: {
+    Pagination,
+    Notice,
+    Datails,
+  },
+  data() {
+    return {
+      // 是否展示详情页
+      ishowDetails: true,
+      // 返回的公告总数据
+      records: [],
+      // 详情页数据
+      detailObj: {},
+      moduleType:1,
+      moduleFunction:3,
+    };
+  },
+  mounted() {
+    // 请求停水列表数据与详情
+    this.getCurrentPage();
+  },
+  methods: {
+    // 获取数据
+    getCurrentPage() {
+      let data = {moduleType:1,moduleFunction:3}
+      this.$store.dispatch('notice/getCurrentPage',data)
+       getCurrentPage(data).then((res) => {
+        console.log("lz", res);
+        if (res.code === 1) {
+          this.records = res.result.records;
+        }
+      });
+    },
+    // 点击标题
+    toDetail(proId) {
+      this.ishowDetails = false;
+      this.records.forEach((item) => {
+        if (item.id === proId) {
+          this.detailObj = item;
+        }
+      });
+      // console.log(this.detailObj.content);
+    },
+    backFn() {
+      this.ishowDetails = true;
+    }
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.t-container {
+  width: 100%;
+}
+ul {
+  min-height: 50vh;
+  li {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    font-size: 20px;
+    position: relative;
+    margin: 20px 0 20px 10px;
+    .l::before {
+      content: "";
+      position: absolute;
+      left: -8px;
+      top: 8px;
+      width: 4px;
+      height: 4px;
+      background: #000;
+      border-radius: 50%;
+    }
+  }
+}
+</style>

+ 95 - 0
src/views/currentSystem/companyDynamics/companyDynamics copy.vue

@@ -0,0 +1,95 @@
+<template>
+  <div class="t-container" >
+    <div class="block" v-if="ishowDetails">
+      <ul>
+      <li v-for="item,index in 8" :key="index">
+        <img src="./images/u15.svg" alt="" />
+        <div class="content">
+          <h3>自来水公司送服务 进社区 “水叮咚”贴心解答居民用水疑问</h3>
+          <p>
+            对于老年人来说,面对面沟通、手把手指导是最高效的,在供水工作者的讲解下,我从购水到用水的疑问都得到了解答。”
+          </p>
+          <p>2022-03-08</p>
+        </div>
+        <div class="r">
+          <a href="javascript:;" @click="todetailFn">阅读更多></a>
+        </div>
+      </li>
+    </ul>
+    <Pagination />
+    </div>
+    <div class="datails" v-else>
+      <Detaile @backFn='backFn'></Detaile>
+    </div>
+  </div>
+</template>
+
+<script>
+import Pagination from "@/components/Pagination/index.vue";
+import Detaile from "./detail.vue";
+export default {
+  components: {
+    Pagination,Detaile
+  },
+  data() {
+    return {
+      ishowDetails:true,
+      moduleType:0,
+      moduleFunction:0,
+    };
+  },
+  methods: {
+    handleSizeChange(val) {
+      console.log(`每页 ${val} 条`);
+    },
+    handleCurrentChange(val) {
+      console.log(`当前页: ${val}`);
+    },
+    todetailFn(){
+      this.ishowDetails=false
+    },
+    backFn(){
+      this.ishowDetails=true
+    }
+  },
+};
+</script>
+ 
+<style lang="scss" scoped>
+.t-container {
+  width: 100%;
+}
+li {
+  width: 100%;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  .r {
+    height: 170px;
+    line-height: 340px;
+  }
+  a {
+    color: rgb(82, 168, 247);
+  }
+}
+.content {
+  width: 54%;
+  // margin: 0 20px;
+  p {
+    font-size: 20px;
+    color: #999;
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    -webkit-line-clamp: 2;
+    overflow: hidden;
+  }
+}
+h3 {
+  color: rgb(82, 168, 247);
+  font-size: 24px;
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    -webkit-line-clamp: 2;
+    overflow: hidden;
+}
+</style>

+ 76 - 65
src/views/currentSystem/companyDynamics/companyDynamics.vue

@@ -1,93 +1,104 @@
 <template>
-  <div class="t-container" >
-    <div class="block" v-if="ishowDetails">
-      <ul>
-      <li v-for="item,index in 8" :key="index">
-        <img src="./images/u15.svg" alt="" />
-        <div class="content">
-          <h3>自来水公司送服务 进社区 “水叮咚”贴心解答居民用水疑问</h3>
-          <p>
-            对于老年人来说,面对面沟通、手把手指导是最高效的,在供水工作者的讲解下,我从购水到用水的疑问都得到了解答。”
-          </p>
-          <p>2022-03-08</p>
-        </div>
-        <div class="r">
-          <a href="javascript:;" @click="todetailFn">阅读更多></a>
-        </div>
-      </li>
-    </ul>
-    <Pagination />
-    </div>
-    <div class="datails" v-else>
-      <Detaile @backFn='backFn'></Detaile>
+  <div class="t-container">
+    <!-- 停水公告 -->
+    <div class="content">
+      <div class="mian" v-if="ishowDetails">
+        <Notice
+          :records="result.records"
+          title="停水公告"
+          @toDetail="toDetail"
+        ></Notice>
+        <Pagination />
+      </div>
+      <div class="datails" v-else>
+        <Details :detailObj="detailObj" @backFn="backFn"></Details>
+      </div>
     </div>
   </div>
 </template>
 
 <script>
 import Pagination from "@/components/Pagination/index.vue";
-import Detaile from "./detail.vue";
+import Notice from "@/components/notice/index.vue";
+import Details from "./detail.vue";
+import { getCurrentPage } from "@/api/currentpage";
 export default {
   components: {
-    Pagination,Detaile
+    Pagination,
+    Notice,
+    Details,
   },
   data() {
     return {
-      ishowDetails:true
+      // 是否展示详情页
+      ishowDetails: true,
+      // 返回的公告总数据
+      result: {},
+      // 详情页数据
+      detailObj: {},
+      /* 
+        moduleType        0公司动态 1信息公开
+        moduleFunction    0公司动态 1办事公开 2停水通知 3政策法规  
+      */
+      moduleType: 0,
+      moduleFunction: 0,
     };
   },
+  mounted() {
+    // 请求停水列表数据与详情
+    this.getCurrentPage();
+  },
   methods: {
-    handleSizeChange(val) {
-      console.log(`每页 ${val} 条`);
+    // 获取数据
+    getCurrentPage() {
+      let data = { moduleType: this.moduleType, moduleFunction: this.moduleFunction };
+      getCurrentPage(data).then((res) => {
+        console.log("lz", res);
+        if (res.code === 1) {
+          this.result = res.result;
+        }
+      });
     },
-    handleCurrentChange(val) {
-      console.log(`当前页: ${val}`);
+    // 点击标题
+    toDetail(proId) {
+      this.ishowDetails = false;
+      this.result.records.forEach((item) => {
+        if (item.id === proId) {
+          this.detailObj = item;
+        }
+      });
+      // console.log(this.detailObj.content);
     },
-    todetailFn(){
-      this.ishowDetails=false
+    backFn() {
+      this.ishowDetails = true;
     },
-    backFn(){
-      this.ishowDetails=true
-    }
   },
 };
 </script>
- 
+
 <style lang="scss" scoped>
 .t-container {
   width: 100%;
 }
-li {
-  width: 100%;
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  .r {
-    height: 170px;
-    line-height: 340px;
-  }
-  a {
-    color: rgb(82, 168, 247);
-  }
-}
-.content {
-  width: 54%;
-  // margin: 0 20px;
-  p {
+ul {
+  min-height: 50vh;
+  li {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
     font-size: 20px;
-    color: #999;
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
-    -webkit-line-clamp: 2;
-    overflow: hidden;
+    position: relative;
+    margin: 20px 0 20px 10px;
+    .l::before {
+      content: "";
+      position: absolute;
+      left: -8px;
+      top: 8px;
+      width: 4px;
+      height: 4px;
+      background: #000;
+      border-radius: 50%;
+    }
   }
 }
-h3 {
-  color: rgb(82, 168, 247);
-  font-size: 24px;
-    display: -webkit-box;
-    -webkit-box-orient: vertical;
-    -webkit-line-clamp: 2;
-    overflow: hidden;
-}
-</style>
+</style>

+ 44 - 25
src/views/currentSystem/companyDynamics/detail.vue

@@ -3,16 +3,14 @@
     <!-- 详情页 -->
     <div class="main">
       <div class="title">
-        <h3>震惊!!!一男子竟然在吃饭</h3>
+        <h2>{{ detailObj.theme }}</h2>
       </div>
-      <div class="content">
-        <p>
-          正文:安华大厦大厦都i啊顶哈山东哈东哈哈都爱按时到是大红色动哈单号i的爱哦对哈说的好好家啊大家啊是滴哦恢复了技术的覅哈佛你啊大苏打ui啊的话手打收到发动i发给你了电脑啊iOS打开了烦恼都覅收到i回升幅度哈发附件咖啡机和
-        </p>
+      <div class="contentText">
+        <!-- {{detailObj.content}} -->
       </div>
       <div class="down">
-        <div class="date">2022-3-16</div>
-        <div class="author">某某某</div>
+        <div class="date">{{ detailObj.createTime }}</div>
+        <div class="author">{{ detailObj.createUserName }}</div>
       </div>
       <p @click="backFn"><a href="javascript:;">⬅返回上一页</a></p>
     </div>
@@ -21,10 +19,26 @@
 
 <script>
 export default {
+  props: {
+    detailObj: {
+      type: Object,
+      default: {},
+    },
+  },
   data() {
     return {};
   },
+  mounted() {
+    this.getContent();
+  },
   methods: {
+    getContent() {
+      let text1 = document.querySelector(".contentText");
+      let str = JSON.parse(JSON.stringify(this.detailObj.content))
+      let str1 =str.replace(`<img`,`<img style='width:100%;'`)
+      // .replace(`<p`,`<p style='text-indent:2em;min-height:48vh;'`)
+      text1.innerHTML = str1;
+    },
     backFn() {
       this.$emit("backFn");
     },
@@ -36,25 +50,30 @@ export default {
 .t-container {
   width: 100%;
   padding-left: 30px;
-}
-a {
-  font-size: 12px;
-  color: #3f7ac0;
-}
-.main {
-  .content {
-    text-indent: 2em;
-    p {
-      height: 20px;
-      line-height: 20px;
-      letter-spacing: 1px;
-    }
+  a {
+    font-size: 12px;
+    color: #3f7ac0;
   }
-  .down {
-    margin-top: 40px;
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
+  .main {
+    .contentText {
+      text-indent: 2em;
+      min-height: 48vh;
+      p {
+        line-height: 24px;
+        text-align: justify;
+        letter-spacing: 1px;
+        font-family: "仿宋";
+        padding: 8px;
+        margin: 0;
+      }
+      
+    }
+    .down {
+      margin-top: 40px;
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+    }
   }
 }
 </style>

+ 32 - 11
src/views/currentSystem/dashboard/index.vue

@@ -75,21 +75,21 @@
           </div>
           <div class="outWorkL_down_r">
             <ul v-if="ishowNews === 1">
-              <li v-for="item,index in 4" :key="index">
-                <div class="l" @click="toDetailFn">20220308公司动态通知人民都应该知道的事儿</div>
-                <div class="r">2022-03-08</div>
+              <li v-for="item,index in result.records" :key="index">
+                <div class="l" @click="toDetailFn">{{item.theme}}</div>
+                <div class="r">{{item.createTime.slice(0,10)}}</div>
               </li>
             </ul>
             <ul v-else-if="ishowNews === 2">
-              <li>
-                <div class="l">20220308政策法规</div>
-                <div class="r">2022-03-08</div>
+              <li v-for="item,index in result.records" :key="index">
+                <div class="l" @click="toDetailFn">{{item.theme}}</div>
+                <div class="r">{{item.createTime.slice(0,10)}}</div>
               </li>
             </ul>
             <ul v-else>
-              <li>
-                <div class="l">20220308办事公开</div>
-                <div class="r">2022-03-08</div>
+              <li v-for="item,index in result.records" :key="index">
+                <div class="l" @click="toDetailFn">{{item.theme}}</div>
+                <div class="r">{{item.createTime.slice(0,10)}}</div>
               </li>
             </ul>
           </div>
@@ -110,7 +110,7 @@
 
 <script>
 import { client } from "@/utils/index";
-
+import { getCurrentPage } from "@/api/currentpage";
 export default {
   name: "Dashboard",
   components: {},
@@ -124,6 +124,10 @@ export default {
       wxUrl: require("./images/linshi.png"),
       activeName: "first",
       ishowNews: 1,
+      // 返回的公告总数据
+      result: {},
+      moduleType: 0,
+      moduleFunction: 0,
     };
   },
   computed: {
@@ -131,8 +135,19 @@ export default {
       return [client().width * 0.8 + "px", client().height * 0.79 + "px"];
     },
   },
-  mounted() {},
+  mounted() {
+    this.getCurrentPage(0,0);
+  },
   methods: {
+    // 获取数据
+    getCurrentPage(moduleType,moduleFunction) {
+      let data = { moduleType: moduleType, moduleFunction: moduleFunction };
+      getCurrentPage(data).then((res) => {
+        if (res.code === 1) {
+          this.result = res.result;
+        }
+      });
+    },
     toDetailFn() {
       // this.$router.push('/detailpage')
       const param = {
@@ -147,14 +162,20 @@ export default {
       });
       this.$store.dispatch("permission/gotoPage", param);
     },
+    // 公司动态
     componyFn1() {
       this.ishowNews = 1;
+      this.getCurrentPage(0,0)
     },
+    // 政策法规
     componyFn2() {
       this.ishowNews = 2;
+      this.getCurrentPage(1,3)
     },
+    // 办事公开
     componyFn3() {
       this.ishowNews = 3;
+      this.getCurrentPage(1,1)
     },
     handleClick(tab, event) {
       console.log(tab, event);