陈鹏铭 10 kuukautta sitten
vanhempi
commit
dc748a2bdb

+ 3 - 7
src/common/js/constant.js

@@ -1,11 +1,7 @@
 // 系统常量
-// const BASE_URI = '/h5Server' // 代理模式代理地址
-// const BASE_URI = "http://localhost:9010"; // 本地
-// const BASE_URI = "/mnpserver"; // 测试服
-// const BASE_URI = 'http://192.168.2.107:9012' // 测试崔伟
-// const BASE_URI = "http://localhost:9010"; // 旧测试
-// const BASE_URI = 'https://pgy.idea-sf.com:8043/mnpApi'
-const BASE_URI = 'https://hswkxc.idea-sf.com/gardenTestApi'
+// h5Server
+const BASE_URI = '/h5Server'
+// const BASE_URI = 'http://lifeline.idea-sf.com/lifelineApi'
 // const BASE_URI = 'https://hswkxc.idea-sf.com/gardenApi'
 
 

+ 310 - 0
src/pages/cityDangerReport/add.vue

@@ -0,0 +1,310 @@
+<template>
+  <div>
+    <div class="cityDangerReportForm">
+      <div class="row">
+        <div class="row-label">
+          <span class="isrequired">*</span>
+          <span>隐患描述</span>
+        </div>
+        <div class="row-value">
+          <van-field
+            v-model="form.hiddenTroubleDescription"
+            rows="4"
+            autosize
+            type="textarea"
+            maxlength="800"
+            placeholder="补充隐患的位置、隐患的大致情况、影响等信息"
+            show-word-limit
+          />
+        </div>
+      </div>
+      <div class="row pdb0">
+        <div class="row-label">
+          <span>上传现场图片</span>
+          <span class="tips">(最多9张)</span>
+        </div>
+        <div class="row-value">
+          <van-uploader
+            :max-count="9"
+            v-model="entryForm"
+            :after-read="afterRead"
+          />
+        </div>
+      </div>
+      <div class="row disflex pdb0 jcsb aligncenter">
+        <div class="row-label mb0">
+          <span class="isrequired">*</span>
+          <span>联系人</span>
+        </div>
+        <div class="row-value width300px">
+          <input type="text" placeholder="请填写" v-model="form.reportPeople" />
+        </div>
+      </div>
+      <div class="row disflex pdb0 jcsb aligncenter">
+        <div class="row-label mb0">
+          <span class="isrequired">*</span>
+          <span>联系电话</span>
+        </div>
+        <div class="row-value width300px">
+          <input
+            type="text"
+            placeholder="请填写"
+            placeholder-class="placestyle"
+            v-model="form.reportPeopleTel"
+          />
+        </div>
+      </div>
+      <div class="row disflex pdb0 jcsb aligncenter">
+        <div class="row-label mb0">
+          <span class="isrequired">*</span>
+          <span>所在区域</span>
+        </div>
+        <div class="row-value width300px" @click="show = true">
+          <div style="display: flex; justify-content: end">
+            <div style="color: rgba(179, 179, 179, 1)">
+              {{ form.area ? form.areaName : "请选择区域" }}
+            </div>
+            <van-icon name="arrow" />
+          </div>
+        </div>
+      </div>
+      <div class="row disflex pdb0 jcsb aligncenter">
+        <div class="row-label mb0">
+          <span class="isrequired">*</span>
+          <span>隐患位置</span>
+        </div>
+        <div class="row-value width300px">
+          <input
+            type="text"
+            v-model="form.hiddenTroubleAddress"
+            placeholder="请填写隐患位置"
+            placeholder-class="placestyle"
+          />
+        </div>
+      </div>
+    </div>
+    <van-popup v-model="show" position="bottom">
+      <van-picker
+        title=""
+        show-toolbar
+        :columns="columns"
+        @confirm="onConfirm"
+        @cancel="onCancel"
+        @change="onChange"
+        value-key="label"
+      />
+    </van-popup>
+    <div class="btn" v-if="!$route.query.id">
+      <van-button type="default" class="tj" @click="addForm">提交</van-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import { addForApp, getTroubleDetail } from "@/service/api_company.js";
+import { upload } from "@/service/api_upload";
+import { Toast } from "vant";
+export default {
+  data() {
+    return {
+      show: false,
+      columns: [
+        { label: "梁溪区", value: 320213, isSelected: false },
+        { label: "锡山区", value: 320205, isSelected: false },
+        { label: "惠山区", value: 320206, isSelected: false },
+        { label: "滨湖区", value: 320211, isSelected: false },
+        { label: "新吴区", value: 320214, isSelected: false },
+        { label: "经开区", value: 320299, isSelected: false },
+        { label: "江阴市", value: 320281, isSelected: false },
+        { label: "宜兴市", value: 320282, isSelected: false },
+      ],
+      form: {
+        createdBy: "10008611",
+      },
+      entryForm: [],
+      fileList: [
+        // { url: 'https://cloud-image', isImage: true },
+      ],
+    };
+  },
+  methods: {
+    async addForm() {
+      console.log(this.fileList);
+      console.log(this.form);
+      if (
+        !this.form.hiddenTroubleDescription ||
+        this.form.hiddenTroubleDescription.length == 0
+      ) {
+        return Toast("请填写隐患描述");
+      }
+      if (!this.form.reportPeople || this.form.reportPeople.length == 0) {
+        return Toast("请填写联系人");
+      }
+      if (!this.form.reportPeopleTel || this.form.reportPeopleTel.length == 0) {
+        return Toast("请填写联系电话");
+      }
+      if (!this.form.area || this.form.area.length == 0) {
+        return Toast("请选择所在区域");
+      }
+      if (
+        !this.form.hiddenTroubleAddress ||
+        this.form.hiddenTroubleAddress.length == 0
+      ) {
+        return Toast("请填写隐患位置");
+      }
+      let form = { ...this.form };
+      form.scenePhoto = JSON.stringify(this.entryForm);
+      let data = await addForApp(form);
+      console.log(data);
+      if (data.code == 200) {
+        Toast("提交成功");
+        this.$router.go(-1);
+      }
+    },
+    async getTroubleDetail() {
+      let data = await getTroubleDetail({ id: this.$route.query.id });
+      this.form = data;
+      let index = this.columns.findIndex((e) => e.value == data.area);
+      console.log(this.columns[index]);
+      console.log(JSON.parse(data.scenePhoto));
+      this.entryForm = JSON.parse(data.scenePhoto);
+      this.form.areaName = this.columns[index].label;
+    },
+    uploadImg(file) {
+      const formParam = new FormData(); // 创建form对象
+      formParam.append("file", file.file); // 通过append向form对象添加数据
+      const config = {
+        headers: {
+          "Content-Type": "multipart/form-data",
+          "MVVM-Key": String(new Date().getTime()),
+          xx: "anything",
+        }, // 这里是重点,需要和后台沟通好请求头,Content-Type不一定是这个值
+      }; // 添加请求头
+      return new Promise((resolve, reject) => {
+        upload(formParam, config)
+          .then((response) => {
+            console.log(response);
+            if (response.data) {
+              this.entryForm[this.entryForm.length - 1].url = response.data.msg;
+              this.entryForm[this.entryForm.length - 1].content = null;
+              this.entryForm[this.entryForm.length - 1].name =
+                response.data.name;
+
+              Toast("上传成功");
+              Toast.clear();
+              console.log(this.entryForm);
+            } else {
+              Toast("上传失败");
+              Toast.clear();
+            }
+          })
+          .catch((err, x) => {
+            reject(err, x);
+          });
+      });
+    },
+    afterRead(file) {
+      if (file instanceof Array) {
+        file.map((v) => {
+          this.uploadImg(v);
+        });
+      } else {
+        this.uploadImg(file);
+      }
+    },
+    onConfirm(e) {
+      this.form.area = e.value;
+      this.form.areaName = e.label;
+      console.log(e);
+      this.show = false;
+    },
+    onCancel() {
+      this.show = false;
+    },
+  },
+  mounted() {
+    if (this.$route.query.id) {
+      this.getTroubleDetail();
+    }
+  },
+};
+</script>
+
+<style lang="scss">
+.btn {
+  display: flex;
+  justify-content: space-around;
+  margin-top: 5vh;
+  button {
+    width: 75vw;
+    height: 15vw;
+  }
+  .tj {
+    background: rgba(13, 47, 118, 1);
+    color: white;
+  }
+}
+.placestyle {
+  text-align: right;
+}
+.disflex {
+  display: flex;
+}
+.aligncenter {
+  align-items: center;
+}
+.mb0 {
+  margin-bottom: 0px !important;
+}
+.jcsb {
+  justify-content: space-between;
+}
+.pdb0 {
+  padding-bottom: 0;
+}
+.width300px {
+  width: 300px;
+}
+.width100px {
+  width: 100px;
+}
+.cityDangerReportForm {
+  margin-top: 24px;
+  background: #ffffff;
+  padding: 24px;
+  box-sizing: border-box;
+  .isrequired {
+    color: red;
+  }
+  .row {
+    margin-bottom: 5.2vw;
+    padding-bottom: 5.2vw;
+    border-bottom: 1px solid #e6e6e6;
+  }
+  .row-label {
+    font-size: 36px;
+    margin-bottom: 16px;
+  }
+  .tips {
+    color: rgba(179, 179, 179, 1);
+    font-size: 24px;
+  }
+  .row-value {
+    font-size: 36px;
+    .van-cell {
+      font-size: 36px;
+      background: rgba(245, 247, 250, 1);
+    }
+    input {
+      width: 100%;
+      text-align: right;
+      font-size: 36px;
+    }
+    .van-image,
+    .van-uploader__upload {
+      height: 30vw;
+      width: 29vw;
+    }
+  }
+}
+</style>

+ 148 - 0
src/pages/cityDangerReport/index.vue

@@ -0,0 +1,148 @@
+<template>
+  <!-- 页面全局配置 -->
+  <div class="pageconfig">
+    <!--vuetop-->
+    <div class="morebox1 response">
+      <div class="flex2 response flex justify-end">
+        <div class="text3" @click="$router.push('/addcityDangerReport')">
+          新增 <van-icon name="add" />
+        </div>
+      </div>
+      <van-list
+        v-model="isUpLoading"
+        :finished="upFinished"
+        :immediate-check="false"
+        :offset="10"
+        finished-text="加载完成"
+        @load="onLoadList"
+      >
+        <div
+          class="morebox4 response"
+          v-for="item in reportList"
+          @click="toDetail(item.id)"
+        >
+          <div class="text5">
+            {{ item.hiddenTroubleDescription }}
+          </div>
+          <div class="flex6 response flex justify-between">
+            <div class="text7">提交时间:2024-7-21 13:00</div>
+            <div class="text8">已提交</div>
+          </div>
+        </div>
+      </van-list>
+    </div>
+
+    <!--vuebottom-->
+  </div>
+</template>
+<script>
+import { listForAppTrouble } from "@/service/api_company.js";
+export default {
+  data() {
+    return {
+      isUpLoading: false,
+      isDownLoading: false,
+      upFinished: false,
+      reportList: [],
+      search: {
+        pageNum: 1,
+        pageSize: "10",
+        createdBy: "10008611",
+      },
+    };
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    toDetail(id) {
+      this.$router.push("/addcityDangerReport?id=" + id);
+    },
+    async getList() {
+      listForAppTrouble(this.search).then((res) => {
+        if (res.data.rows.length) {
+          this.isDownLoading = false;
+          this.reportList.push(...res.data.rows);
+          this.isUpLoading = false;
+          if (this.reportList.length >= res.data.total) {
+            this.upFinished = true;
+          }
+        } else {
+          this.reportList = [];
+          this.isDownLoading = false;
+          this.isUpLoading = false;
+          this.upFinished = true;
+        }
+      });
+    },
+    onLoadList() {
+      this.search.pageNum++;
+      this.isDownLoading = false;
+      this.getList();
+    },
+  },
+};
+</script>
+c
+<style lang="scss">
+.pageconfig {
+  width: 100%;
+  overflow: hidden;
+  overflow-y: scroll;
+  height: 100vh;
+}
+
+/**pagedomcss**/
+.justify-end {
+  justify-content: end;
+}
+.morebox1 {
+  width: 100%;
+  background-color: rgba(255, 255, 255, 1);
+  margin-top: 24px;
+  padding: 20px 0 20px 0;
+}
+
+.flex2 {
+  width: 100%;
+  align-items: flex-start;
+}
+
+.text3 {
+  color: rgba(13, 47, 118, 1);
+  padding-right: 40px;
+  font-size: 36px;
+}
+
+.morebox4 {
+  width: 100%;
+  width: calc(100% - 64px);
+  font-size: 34px;
+  background-color: rgba(245, 247, 250, 1);
+  margin: 24px 32px;
+  padding: 24px;
+  border-radius: 24px;
+  box-sizing: border-box;
+}
+
+.text5 {
+  color: rgba(51, 51, 51, 1);
+  padding-bottom: 16px;
+  border-bottom: 2px solid rgba(230, 230, 230, 1);
+}
+
+.flex6 {
+  width: 100%;
+  margin-top: 20px;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.text7 {
+  color: rgba(136, 136, 136, 1);
+}
+
+.text8 {
+  color: rgba(45, 140, 240, 1);
+}
+</style>

+ 84 - 0
src/pages/citySafeNotic/detail.vue

@@ -0,0 +1,84 @@
+<template>
+  <div class="citySafeNoticDetail">
+    <div class="title">{{ detail.title }}</div>
+    <div class="time">
+      <van-icon name="underway-o" />
+      <div>发布日期:{{ detail.noticeTime }}</div>
+    </div>
+    <div class="text" v-html="detail.content"></div>
+    <div class="fj">
+      <div>附件:</div>
+      <div class="filename" v-for="item in annex" @click="openFiled(item.msg)">
+        {{ item.name }}
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { getNoticeById } from "@/service/api_company.js";
+export default {
+  data() {
+    return {
+      detail: {},
+      annex: [],
+      search: {
+        pageNum: "1",
+        createdBy: "smx_h5_userId",
+        pageSize: "10",
+      },
+    };
+  },
+  mounted() {
+    this.getNoticeById();
+  },
+  methods: {
+    openFiled(url) {
+      window.open(url);
+    },
+    async getNoticeById() {
+      let { data } = await getNoticeById({
+        id: this.$route.query.id,
+        createdBy: "smx_h5_userId",
+      });
+      this.detail = data;
+      this.annex = JSON.parse(data.annex);
+      console.log(JSON.parse(data.annex));
+    },
+  },
+};
+</script>
+
+<style lang="scss">
+.citySafeNoticDetail {
+  width: 100%;
+  background-color: rgba(255, 255, 255, 1);
+  margin-top: 24px;
+  padding: 20px 32px 20px 32px;
+  box-sizing: border-box;
+  .title {
+    font-size: 36px;
+    color: #333333;
+    font-weight: bold;
+  }
+  .time {
+    margin-top: 12px;
+    display: flex;
+    align-items: center;
+    font-size: 32px;
+  }
+  .text {
+    font-size: 32px;
+    margin-top: 24px;
+    img {
+      max-width: 100%;
+    }
+  }
+  .fj {
+    margin-top: 24px;
+  }
+  .filename {
+    color: rgba(31, 106, 255, 1);
+  }
+}
+</style>

+ 160 - 0
src/pages/citySafeNotic/index.vue

@@ -0,0 +1,160 @@
+<template>
+  <!-- 页面全局配置 -->
+  <div class="pageconfig">
+    <!--vuetop-->
+    <van-tabs v-model="active" color="rgba(78, 135, 255, 1)" @change="getTabs">
+      <van-tab title="全部" :name="`全部`"></van-tab>
+      <van-tab title="待阅" :name="0"></van-tab>
+      <van-tab title="已阅" :name="1"></van-tab>
+    </van-tabs>
+    <div class="morebox1 response">
+      <van-list
+        v-model="isUpLoading"
+        :finished="upFinished"
+        :immediate-check="false"
+        :offset="10"
+        finished-text="加载完成"
+        @load="onLoadList"
+      >
+        <div
+          class="morebox4 response"
+          v-for="item in noticList"
+          @click="toDetail(item.id)"
+        >
+          <div class="text5">
+            {{ item.title }}
+          </div>
+          <div class="flex6 response flex justify-between">
+            <div class="text7">提交时间:{{ item.noticeTime }}</div>
+            <div class="text8" v-if="item.isRead == 1">已阅</div>
+            <div class="text8" v-else style="color: rgba(226, 81, 0, 1)">
+              待阅
+            </div>
+          </div>
+        </div>
+      </van-list>
+    </div>
+
+    <!--vuebottom-->
+  </div>
+</template>
+<script>
+import { listForApp } from "@/service/api_company.js";
+export default {
+  data() {
+    return {
+      active: "",
+      isUpLoading: false,
+      isDownLoading: false,
+      upFinished: false,
+      noticList: [],
+      search: {
+        pageNum: 1,
+        pageSize: "10",
+        createdBy: "smx_h5_userId",
+      },
+    };
+  },
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    getTabs(e) {
+      console.log(e);
+      this.search.isRead = e == "全部" ? "" : e;
+      this.search.pageNum = 1;
+      this.isUpLoading = false;
+      this.isDownLoading = false;
+      this.upFinished = false;
+      this.noticList = [];
+      this.getList();
+    },
+    toDetail(id) {
+      this.$router.push("/citySafeNoticDetail?id=" + id);
+    },
+    async getList() {
+      listForApp(this.search).then((res) => {
+        if (res.data.rows.length) {
+          if (this.noticList.length >= res.data.total) {
+            this.upFinished = true;
+          } else {
+            this.isDownLoading = false;
+            this.noticList.push(...res.data.rows);
+            this.isUpLoading = false;
+          }
+        } else {
+          this.noticList = [];
+          this.isDownLoading = false;
+          this.isUpLoading = false;
+          this.upFinished = true;
+        }
+      });
+    },
+    onLoadList() {
+      this.search.pageNum++;
+      this.isDownLoading = false;
+      this.getList();
+    },
+  },
+};
+</script>
+
+<style lang="scss">
+.pageconfig {
+  width: 100%;
+}
+
+/**pagedomcss**/
+.justify-end {
+  justify-content: end;
+}
+.morebox1 {
+  width: 100%;
+  background-color: rgba(255, 255, 255, 1);
+  margin-top: 24px;
+  padding: 20px 0 20px 0;
+}
+
+.flex2 {
+  width: 100%;
+  align-items: flex-start;
+}
+
+.text3 {
+  color: rgba(13, 47, 118, 1);
+  padding-right: 40px;
+  font-size: 36px;
+}
+
+.morebox4 {
+  width: 100%;
+  width: calc(100% - 64px);
+  font-size: 34px;
+  background-color: rgba(245, 247, 250, 1);
+  margin: 24px 32px;
+  padding: 24px;
+  border-radius: 24px;
+  box-sizing: border-box;
+}
+
+.text5 {
+  color: rgba(51, 51, 51, 1);
+  padding-bottom: 16px;
+  border-bottom: 2px solid rgba(230, 230, 230, 1);
+}
+
+.flex6 {
+  width: 100%;
+  margin-top: 20px;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.text7 {
+  color: rgba(136, 136, 136, 1);
+}
+
+.text8 {
+  color: rgba(45, 140, 240, 1);
+}
+</style>

+ 34 - 1
src/router/index.js

@@ -18,6 +18,39 @@ const router = new Router({
             },
             component: () => import('@/pages/login/login.vue')
         },
+        {
+            path: '/citySafeNoticDetail',
+            name: 'citySafeNotic',
+            meta: {
+                title: '城市安全通知公告'
+            },
+            component: () => import('@/pages/citySafeNotic/detail.vue')
+        },
+        {
+            path: '/citySafeNotic',
+            name: 'citySafeNotic',
+            meta: {
+                title: '城市安全通知公告'
+            },
+            component: () => import('@/pages/citySafeNotic/index.vue')
+        },
+        {
+            path: '/cityDangerReport',
+            name: 'cityDangerReport',
+            meta: {
+                title: '城市隐患上报'
+            },
+            component: () => import('@/pages/cityDangerReport/index.vue')
+        },
+
+        {
+            path: '/addcityDangerReport',
+            name: 'addcityDangerReport',
+            meta: {
+                title: '城市隐患上报'
+            },
+            component: () => import('@/pages/cityDangerReport/add.vue')
+        },
         {
             path: '/home',
             name: 'home',
@@ -468,7 +501,7 @@ const router = new Router({
 // });
 
 // 路由守卫 拦截
-const whiteList = ['vistiorRegistration', 'login', 'register', 'QRcode', 'webView', 'registerbycpyinfo'] // 路由守卫白名单
+const whiteList = ['vistiorRegistration', 'login', 'register', 'QRcode', 'todo', 'webView', 'registerbycpyinfo', 'cityDangerReport', `addcityDangerReport`] // 路由守卫白名单
 
 router.beforeEach((to, from, next) => {
     /* 路由发生变化修改页面title */

+ 37 - 1
src/service/api_company.js

@@ -5,6 +5,8 @@ const company = '/wx/company'
 const record = '/wx/record'
 const warn = '/wx/warn'
 const companyExamine = '/wx/companyExamine'
+const SocialPublicNoticeController = '/wx/SocialPublicNoticeController'
+const PublicReportHiddenTroubleLifelineController = '/wx/PublicReportHiddenTroubleLifelineController'
 
 export function editInfo(data) {
     return request({
@@ -13,7 +15,41 @@ export function editInfo(data) {
         data: data
     })
 }
-
+export function listForAppTrouble(data) {
+    return request({
+        url: PublicReportHiddenTroubleLifelineController + '/listForApp',
+        method: 'post',
+        data: data
+    })
+}
+export function getTroubleDetail(data) {
+    return request({
+        url: PublicReportHiddenTroubleLifelineController + '/getById',
+        method: 'post',
+        data: data
+    })
+}
+export function addForApp(data) {
+    return request({
+        url: PublicReportHiddenTroubleLifelineController + '/addForApp',
+        method: 'post',
+        data: data
+    })
+}
+export function listForApp(data) {
+    return request({
+        url: SocialPublicNoticeController + '/listForApp',
+        method: 'post',
+        data: data
+    })
+}
+export function getNoticeById(data) {
+    return request({
+        url: SocialPublicNoticeController + '/getById',
+        method: 'post',
+        data: data
+    })
+}
 export function info(data) {
     return request({
         url: baseUri + company + '/info',

+ 1 - 1
src/service/api_upload.js

@@ -1,7 +1,7 @@
 import { request } from './request'
 
 const baseUri = ''
-const parkActivity = '/wx/fileController'
+const parkActivity = '/wx/PublicReportHiddenTroubleLifelineController'
 
 export function upload(data) {
     return request(

+ 5 - 0
src/service/request.js

@@ -29,7 +29,10 @@ export function request(request, isFile) {
         requestBody.headers = request.headers
         requestBody.headers['MVVM-Key'] = String(new Date().getTime())
         requestBody.headers['xx'] = 'anything'
+        requestBody.headers['Refere'] = 'xxxx'
+        requestBody.headers['Cache-Control'] = 'no-cache'
     }
+
     // console.log('request: ', request)
     return new Promise((resolve, reject) => {
         axios.defaults.withCredentials = true
@@ -89,6 +92,8 @@ export function request2(request) {
         requestBody.headers = request.headers
         requestBody.headers['MVVM-Key'] = String(new Date().getTime())
         requestBody.headers['xx'] = 'anything'
+        requestBody.headers['Refere'] = 'xxxx'
+        requestBody.headers['Cache-Control'] = 'no-cache'
         requestBody.headers['Content-Type'] = 'application/json;charset=UTF-8'
     }
     // console.log('request: ', request)

+ 2 - 2
vue.config.js

@@ -16,7 +16,7 @@ const CompressionPlugin = require("compression-webpack-plugin");
 
 module.exports = {
     // publicPath: '/mnpH5/', // 代理模式使用
-    publicPath: "/gardenTestH5/", // tomcat模式使用
+    publicPath: "/lifelineH5/", // tomcat模式使用
     outputDir: "dist",
     assetsDir: "assets",
     lintOnSave: process.env.NODE_ENV === "development",
@@ -31,7 +31,7 @@ module.exports = {
         proxy: {
             // 配置跨域
             "/h5Server": {
-                target: process.env.VUE_APP_API_URL,
+                target: `http://lifeline.idea-sf.com/lifelineApi`,
                 ws: true,
                 changOrigin: true, // 允许跨域
                 pathRewrite: {