15179599649
2024-01-16 d4666564167976836fffe41a0f1f0a4ff3eaa68a
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);