From d4666564167976836fffe41a0f1f0a4ff3eaa68a Mon Sep 17 00:00:00 2001
From: 15179599649 <zhangyiyao89@qq.com>
Date: Tue, 16 Jan 2024 10:07:24 +0800
Subject: [PATCH] '提交内容'

---
 src/views/Addmessage/index.vue |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/views/Addmessage/index.vue b/src/views/Addmessage/index.vue
index 51b8d3c..29e406d 100644
--- a/src/views/Addmessage/index.vue
+++ b/src/views/Addmessage/index.vue
@@ -26,7 +26,8 @@
       <span>请勿涉及不文明及违规内容,违法必究!</span>
     </div>
     <div class="bottom">
-      <van-button type="primary" @click="submit()">添加留言</van-button>
+      <van-button type="primary" @click="submit(2)" v-show="!this.shownim">匿名添加</van-button>
+      <van-button type="primary" @click="submit(1)">添加留言</van-button>
     </div>
   </div>
 </template>
@@ -39,14 +40,17 @@
       messagecom: "",
       fileindex: null,
       FileList: [],
-      submitlist: []
+      submitlist: [],
+      shownim: false
     };
   },
   mounted() {
     localStorage.setItem("Appraising", "message");
   },
   computed: {},
-  created() {},
+  created() {
+    this.shownim = localStorage.getItem("tokensave") == "111";
+  },
   methods: {
     // 上传图片后的操作
     afterread(event, indexto) {
@@ -77,7 +81,8 @@
       this.submitlist.splice(filelist.index, 1);
       this.FileList.splice(filelist.index, 1);
     },
-    submit() {
+    // 添加留言:1;匿名添加:2
+    submit(index) {
       let toData = {
         userName: "匿名用户",
         content: this.messagecom,
@@ -91,6 +96,11 @@
       if (this.messagecom == "" && this.submitlist.length == 0) {
         this.$toast.fail("留言内容不能为空");
       } else {
+        if (index == 2) {
+          toData.userDept = "";
+          toData.userPost = "";
+          toData.userName = "匿名用户";
+        }
         leaveWords(toData).then(res => {
           setTimeout(() => {
             this.$router.push("/");
@@ -138,8 +148,10 @@
     position: absolute;
     bottom: 50px;
     width: 100%;
+    display: flex;
     .van-button {
-      width: 90%;
+      margin: 0px 10px;
+      flex: 1;
       font-size: 18px;
       border-radius: 5px;
       background: linear-gradient(to right, #01bdfc, #017bfc);

--
Gitblit v1.9.3