Просмотр исходного кода

Merge remote-tracking branch 'HS_MZAP/master'

yin_yu820 2 лет назад
Родитель
Сommit
0a6f57a144

+ 17 - 17
src/styles/style.css

@@ -5,17 +5,13 @@
 
 /* 导航栏样式 */
 
-.van-nav-bar {
-    background-color: #36a7f3!important;
-    z-index: 10000!important;
-}
-
-.van-nav-bar__title {
-    color: #fff!important;
-}
-
-.van-badge__wrapper {
-    color: #fff!important;
+:root:root {
+    /* 导航栏组件样式 */
+    --van-nav-bar-height: 40px;
+    --van-nav-bar-background: #36a7f3;
+    --van-nav-bar-title-text-color: #fff;
+    --van-nav-bar-z-index: 10000;
+    --van-nav-bar-icon-color: #fff;
 }
 
 
@@ -26,21 +22,23 @@
 
 .miniTitle,
 .title {
-    height: 40px;
-    line-height: 40px;
     color: #36a7f3;
 }
 
 .title {
-    font-size: 24px;
+    height: 50px;
+    line-height: 50px;
+    font-size: 22px;
     font-weight: 700;
     padding-left: 20px;
     border-bottom: 1px solid #eee;
-    margin-top: 5px;
+    margin-top: 3px;
 }
 
 .miniTitle {
-    font-size: 18px;
+    font-size: 16px;
+    height: 40px;
+    line-height: 40px;
 }
 
 
@@ -120,6 +118,7 @@
 .list_item {
     display: table;
     background: #fff;
+    width: 100%;
 }
 
 .item-left {
@@ -145,6 +144,7 @@
     color: #999999!important;
 }
 
-.van-swipe-cell__right .button {
+.van-swipe-cell__right .button,
+.van-swipe-cell__left .button {
     height: 100%;
 }

+ 96 - 14
src/views/activityMan/placeactivity/placeActivityList.vue

@@ -6,23 +6,30 @@
     left-arrow
     @click-left="onClickLeft"
     @click-right="onClickRight"
+    :style="{ 'background-color': selectColor }"
   >
     <template #right>
       <van-icon name="plus" size="18" />
     </template>
   </van-nav-bar>
   <div class="main">
-    <van-search
-      v-model="searchVal"
-      clearable
-      show-action
-      shape="round"
-      placeholder="请输入搜索关键词"
-      label="活动名称"
-      input-align="center"
-      @search="onSearch"
-      @cancel="onCancel"
-    />
+    <div class="search-area">
+      <van-search
+        v-model="searchVal"
+        clearable
+        show-action
+        shape="round"
+        placeholder="请输入搜索关键词"
+        label="活动名称"
+        input-align="center"
+        @search="onSearch"
+        @cancel="onCancel"
+      >
+      </van-search>
+      <van-dropdown-menu :overlay="false">
+        <van-dropdown-item title="点击更多搜索项"> </van-dropdown-item>
+      </van-dropdown-menu>
+    </div>
     <van-tabs
       v-show="!searchShow"
       v-model:active="active"
@@ -42,7 +49,8 @@
                 <p v-show="item.activityTime != ''" style="color: #c4c4c4">
                   {{ item.activityTime }}
                 </p>
-                <p style="color: red">待审核</p>
+                <p style="color: red" v-if="item.state == 1">已禁用</p>
+                <p style="color: green" v-if="item.state == 0">已启用</p>
               </div>
               <van-cell>
                 <template #title>
@@ -56,7 +64,26 @@
                 </template>
               </van-cell>
             </div>
-            <template #right>
+            <!-- 启用/禁用 -->
+            <template #left>
+              <van-button
+                v-if="item.state == 1"
+                square
+                class="button"
+                type="success"
+                text="启用"
+                @click="upUseitem(item)"
+              />
+              <van-button
+                v-if="item.state == 0"
+                square
+                class="button"
+                type="warning"
+                text="禁用"
+                @click="upUseitem(item)"
+              />
+            </template>
+            <template #right v-if="item.state == 0">
               <van-button
                 square
                 type="danger"
@@ -88,7 +115,8 @@
                 <p v-show="item.activityTime != ''" style="color: #c4c4c4">
                   {{ item.activityTime }}
                 </p>
-                <p style="color: red">已审核</p>
+                <p style="color: red" v-if="item.state == 1">已禁用</p>
+                <p style="color: green" v-if="item.state == 0">已启用</p>
               </div>
               <van-cell>
                 <template #title>
@@ -102,6 +130,25 @@
                 </template>
               </van-cell>
             </div>
+            <!-- 启用/禁用 -->
+            <template #left>
+              <van-button
+                v-if="item.state == 1"
+                square
+                class="button"
+                type="success"
+                text="启用"
+                @click="upUseitem(item)"
+              />
+              <van-button
+                v-if="item.state == 0"
+                square
+                class="button"
+                type="warning"
+                text="禁用"
+                @click="upUseitem(item)"
+              />
+            </template>
           </van-swipe-cell>
         </van-list>
       </van-tab>
@@ -153,6 +200,8 @@ export default {
     const onClickLeft = () => {
       history.back();
     };
+    // 导航栏颜色
+    const selectColor = ref(window.localStorage.getItem("MZ_COLOR"));
     let router = useRouter();
     // 上报
     const onClickRight = () => {
@@ -235,6 +284,34 @@ export default {
       searchVal.value = "";
       searchShow.value = false;
     };
+    // 启用/禁用
+    const upUseitem = (item) => {
+      xm.showConfirm({
+        title: "提示",
+        message: "确定修改该项吗?",
+      }).then((result) => {
+        if (result == "ok") {
+          if (item.state == 0) {
+            item.state = 1;
+          } else {
+            item.state = 0;
+          }
+          new placeActivityServer().save(item).then((res) => {
+            if (res.status == 200 || res.statusText == "OK") {
+              xm.showToast({
+                message: "修改成功",
+              });
+            }
+            index = 0;
+            loading.value = true;
+            list.value = [];
+            readList.value = [];
+            onLoad();
+            onLoad1();
+          });
+        }
+      });
+    };
     // 删除
     const deleteItem = (val) => {
       xm.showConfirm({
@@ -253,6 +330,7 @@ export default {
             list.value = [];
             readList.value = [];
             onLoad();
+            onLoad1();
           });
         }
       });
@@ -274,6 +352,8 @@ export default {
     return {
       active,
       onClickLeft,
+      // 导航栏颜色
+      selectColor,
       list,
       readList,
       onLoad,
@@ -282,6 +362,7 @@ export default {
       onLoad1,
       loading1,
       finished1,
+      // 搜索
       searchShow,
       searchVal,
       searchList,
@@ -292,6 +373,7 @@ export default {
       updateItem,
       goInfo,
       deleteItem,
+      upUseitem,
     };
   },
 };

+ 25 - 28
src/views/activityMan/placeactivity/placeActivityView.vue

@@ -195,14 +195,12 @@
             <van-uploader
               :after-read="afterRead"
               v-model="fileList"
-              :max-count="1"
+              :max-count="5"
               capture="camera"
               accept=""
+              :before-delete="deleteRead"
             >
               <van-button>上传文件</van-button>
-              <template #preview-cover="file">
-                <div class="preview-cover van-ellipsis">{{ file.name }}</div>
-              </template>
             </van-uploader>
           </template>
         </van-field>
@@ -380,30 +378,42 @@ export default {
     };
     // 文件上传
     let fileList = ref([]);
+    let fileupList = ref([]);
     const afterRead = (file) => {
-      fileList.value = [];
       // 此时可以自行将文件上传至服务器
       new tools()
         .uploadFile(file, `reporting/reportingActivities`)
-        .then(({ data }) => {
-          if (res.status == 200 || res.statusText == "OK") {
+        .then(({ data, status, statusText }) => {
+          if (status == 200 || statusText == "OK") {
             xm.showToast({
               message: "上传成功",
             });
-            placeActivity.value.safetyPlan = data.url;
-            fileList.value.push(data);
-            fileList.value[0].url = `${$base}` + fileList.value[0].url;
-            fileList.value[0].name = decodeURIComponent(
-              fileList.value[0].url.substring(
-                fileList.value[0].url.lastIndexOf("/") + 1
-              )
+            data.name = decodeURIComponent(
+              data.url.substring(data.url.lastIndexOf("/") + 1)
             );
+            fileupList.value.push(data);
           }
         });
     };
+    // 删除文件
+    const deleteRead = (file) => {
+      //删除文件操作
+      for (let index = 0; index < fileList.value.length; index++) {
+        if (file.file == fileList.value[index].file) {
+          let delurl = fileupList.value[index].url;
+          new tools().uploadFiledelete("", delurl).then(({ data }) => {});
+          fileupList.value.splice(index, 1);
+          fileList.value.splice(index, 1);
+        }
+      }
+    };
     // 提交数据
     const submit = () => {
       isLoading.value = true;
+      //保存前附件处理
+      siteInspection.enclosure = fileupList.value
+        .map((option) => option.url)
+        .join("|");
       new placeActivityServer().save(placeActivity.value).then((res) => {
         if (res.status == 200 || res.statusText == "OK") {
           xm.showToast({
@@ -436,6 +446,7 @@ export default {
       reselected,
       // 文件上传
       afterRead,
+      deleteRead,
       fileList,
       submit,
       subjectContentEditor,
@@ -445,9 +456,6 @@ export default {
 </script>
 
 <style scoped>
-.van-cell__value .van-field__right-icon .van-icon-location {
-  color: #36a7f3 !important;
-}
 .van-uploader .van-button {
   border: none;
   color: #36a7f3;
@@ -461,15 +469,4 @@ export default {
   text-align: center;
   margin-top: 80px;
 }
-.preview-cover {
-  position: absolute;
-  bottom: 0;
-  box-sizing: border-box;
-  width: 100%;
-  padding: 4px;
-  color: #fff;
-  font-size: 12px;
-  text-align: center;
-  background: rgba(0, 0, 0, 0.3);
-}
 </style>

+ 1 - 1
src/views/tab_a/tabAll.vue

@@ -97,7 +97,7 @@ import $base from "@/utils/config";
 
 		created(){
 			let id=this.$route.query.id;
-			window.xm.setNavigationBarTitle({ title: '智慧“和顺”'})
+			// window.xm.setNavigationBarTitle({ title: '智慧“和顺”'})
 			this.TokenLogin2();
 			//this.dataNumber();
 		},