eslint
This commit is contained in:
		@@ -36,9 +36,9 @@
 | 
			
		||||
            <b v-text="op.createUserName" />
 | 
			
		||||
            <span class="tags">{{ data.createUserId === op.createUserId ? '话事人' : '居民' }}</span>
 | 
			
		||||
          </div>
 | 
			
		||||
          <u-icon name="thumb-up" :label="op.suport" :color="op.isSuport ? 'red' : '#ccc'"  @click="like(op.id)" />
 | 
			
		||||
          <u-icon name="thumb-up" :label="op.suport" :color="op.isSuport ? 'red' : '#ccc'" @click="like(op.id)" />
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="content" v-text="op.content" />
 | 
			
		||||
        <div class="content" v-text="op.content" @click="dele" />
 | 
			
		||||
        <div class="content color-999" v-text="op.createTime" />
 | 
			
		||||
      </div>
 | 
			
		||||
      <AiEmpty v-if="!data.messages.length"></AiEmpty>
 | 
			
		||||
@@ -57,7 +57,7 @@
 | 
			
		||||
        <div class="vote-item" v-for="(item, index) in data.voteList" :key="index">
 | 
			
		||||
          <span>{{ item.content }}</span>
 | 
			
		||||
          <i>{{ item.count }}</i>
 | 
			
		||||
          <em :style="{width: item.percentage}"></em>
 | 
			
		||||
          <em :style="{ width: item.percentage }"></em>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
@@ -98,7 +98,7 @@ export default {
 | 
			
		||||
      content: '',
 | 
			
		||||
      flag: false,
 | 
			
		||||
      pageShow: false,
 | 
			
		||||
      isAnnouncer: false
 | 
			
		||||
      isAnnouncer: false,
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
@@ -120,70 +120,79 @@ export default {
 | 
			
		||||
  methods: {
 | 
			
		||||
    getDetail() {
 | 
			
		||||
      this.$loading()
 | 
			
		||||
      this.$http.post(`/app/appvillagediscuss/queryDetailById?id=${this.id}`).then((res) => {
 | 
			
		||||
        if (res?.data) {
 | 
			
		||||
          this.data = {
 | 
			
		||||
            ...res.data,
 | 
			
		||||
            avatar: res.data.createUserName?.substr(0, 2) || '游客',
 | 
			
		||||
            messages: res.data.messages ? res.data.messages.map(v => {
 | 
			
		||||
              return {
 | 
			
		||||
                ...v,
 | 
			
		||||
                isSuport: v.suportUser ? v.suportUser.indexOf(this.user.id) > -1 : false
 | 
			
		||||
              }
 | 
			
		||||
            }) : []
 | 
			
		||||
          }
 | 
			
		||||
          this.data.images = JSON.parse(res.data.images)
 | 
			
		||||
          this.isAnnouncer = this.user.id === res.data.createUserId
 | 
			
		||||
      this.$http
 | 
			
		||||
        .post(`/app/appvillagediscuss/queryDetailById?id=${this.id}`)
 | 
			
		||||
        .then((res) => {
 | 
			
		||||
          if (res?.data) {
 | 
			
		||||
            this.data = {
 | 
			
		||||
              ...res.data,
 | 
			
		||||
              avatar: res.data.createUserName?.substr(0, 2) || '游客',
 | 
			
		||||
              messages: res.data.messages
 | 
			
		||||
                ? res.data.messages.map((v) => {
 | 
			
		||||
                    return {
 | 
			
		||||
                      ...v,
 | 
			
		||||
                      isSuport: v.suportUser ? v.suportUser.indexOf(this.user.id) > -1 : false,
 | 
			
		||||
                    }
 | 
			
		||||
                  })
 | 
			
		||||
                : [],
 | 
			
		||||
            }
 | 
			
		||||
            this.data.images = JSON.parse(res.data.images)
 | 
			
		||||
            this.isAnnouncer = this.user.id === res.data.createUserId
 | 
			
		||||
 | 
			
		||||
          var discussTime = (new Date(res.data.discussDeadline).getTime() * 1) / 1000
 | 
			
		||||
          var nowTime = (new Date().getTime() * 1) / 1000
 | 
			
		||||
          if (discussTime >= nowTime) {
 | 
			
		||||
            this.timestamp = discussTime - nowTime
 | 
			
		||||
          }
 | 
			
		||||
            var discussTime = (new Date(res.data.discussDeadline).getTime() * 1) / 1000
 | 
			
		||||
            var nowTime = (new Date().getTime() * 1) / 1000
 | 
			
		||||
            if (discussTime >= nowTime) {
 | 
			
		||||
              this.timestamp = discussTime - nowTime
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
          if (res.data.voteType === '1') {
 | 
			
		||||
            const total = Object.values(res.data.statistic).reduce((x, y) => {
 | 
			
		||||
              return x + y
 | 
			
		||||
            })
 | 
			
		||||
            this.data.voteList = res.data.voteItems.map(v => {
 | 
			
		||||
              return {
 | 
			
		||||
                ...v,
 | 
			
		||||
                count: res.data.statistic[v.item],
 | 
			
		||||
                percentage: (res.data.statistic[v.item] / total) * 100 + '%'
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          }
 | 
			
		||||
            if (res.data.voteType === '1') {
 | 
			
		||||
              const total = Object.values(res.data.statistic).reduce((x, y) => {
 | 
			
		||||
                return x + y
 | 
			
		||||
              })
 | 
			
		||||
              this.data.voteList = res.data.voteItems.map((v) => {
 | 
			
		||||
                return {
 | 
			
		||||
                  ...v,
 | 
			
		||||
                  count: res.data.statistic[v.item],
 | 
			
		||||
                  percentage: (res.data.statistic[v.item] / total) * 100 + '%',
 | 
			
		||||
                }
 | 
			
		||||
              })
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            this.$hideLoading()
 | 
			
		||||
            this.pageShow = true
 | 
			
		||||
          } else {
 | 
			
		||||
            this.$hideLoading()
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        .catch(() => {
 | 
			
		||||
          this.$hideLoading()
 | 
			
		||||
          this.pageShow = true
 | 
			
		||||
        } else {
 | 
			
		||||
          this.$hideLoading()
 | 
			
		||||
        }
 | 
			
		||||
      }).catch(() => {
 | 
			
		||||
        this.$hideLoading()
 | 
			
		||||
      })
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    like (id) {
 | 
			
		||||
    like(id) {
 | 
			
		||||
      this.$loading()
 | 
			
		||||
      this.$http.post(`/app/appvillagediscussmessage/suport?id=${id}&userId=${this.user.id}`).then(res => {
 | 
			
		||||
        this.$hideLoading()
 | 
			
		||||
        if (res.code === 0) {
 | 
			
		||||
          this.$u.toast('点赞成功')
 | 
			
		||||
      this.$http
 | 
			
		||||
        .post(`/app/appvillagediscussmessage/suport?id=${id}&userId=${this.user.id}`)
 | 
			
		||||
        .then((res) => {
 | 
			
		||||
          this.$hideLoading()
 | 
			
		||||
          if (res.code === 0) {
 | 
			
		||||
            this.$u.toast('点赞成功')
 | 
			
		||||
 | 
			
		||||
          this.$nextTick(() => {
 | 
			
		||||
            this.getDetail()
 | 
			
		||||
          })
 | 
			
		||||
        } else {
 | 
			
		||||
          this.$u.toast(res.msg)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      }).catch((e) => {
 | 
			
		||||
        this.$hideLoading()
 | 
			
		||||
        this.$u.toast(e)
 | 
			
		||||
      })
 | 
			
		||||
            this.$nextTick(() => {
 | 
			
		||||
              this.getDetail()
 | 
			
		||||
            })
 | 
			
		||||
          } else {
 | 
			
		||||
            this.$u.toast(res.msg)
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
        .catch((e) => {
 | 
			
		||||
          this.$hideLoading()
 | 
			
		||||
          this.$u.toast(e)
 | 
			
		||||
        })
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    dele() {},
 | 
			
		||||
 | 
			
		||||
    publish() {
 | 
			
		||||
      if (this.flag) return
 | 
			
		||||
      if (!this.content) {
 | 
			
		||||
@@ -251,15 +260,17 @@ export default {
 | 
			
		||||
    handleComplete() {
 | 
			
		||||
      this.$confirm('是否要结束公示')
 | 
			
		||||
        .then(() => {
 | 
			
		||||
          this.$http.post('/app/appvillagediscuss/finishPublic', {
 | 
			
		||||
            status: '2',
 | 
			
		||||
            id: this.id
 | 
			
		||||
          }).then((res) => {
 | 
			
		||||
            if (res?.code == 0) {
 | 
			
		||||
              this.$u.toast('已结束公示!')
 | 
			
		||||
              this.getDetail()
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
          this.$http
 | 
			
		||||
            .post('/app/appvillagediscuss/finishPublic', {
 | 
			
		||||
              status: '2',
 | 
			
		||||
              id: this.id,
 | 
			
		||||
            })
 | 
			
		||||
            .then((res) => {
 | 
			
		||||
              if (res?.code == 0) {
 | 
			
		||||
                this.$u.toast('已结束公示!')
 | 
			
		||||
                this.getDetail()
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
        })
 | 
			
		||||
        .catch(() => 0)
 | 
			
		||||
    },
 | 
			
		||||
@@ -282,7 +293,7 @@ export default {
 | 
			
		||||
    text-align: center;
 | 
			
		||||
    color: #fff;
 | 
			
		||||
    font-size: 32px;
 | 
			
		||||
    background: #1365DD;
 | 
			
		||||
    background: #1365dd;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  &.detail-active {
 | 
			
		||||
@@ -377,7 +388,7 @@ export default {
 | 
			
		||||
    text-align: center;
 | 
			
		||||
    color: #fff;
 | 
			
		||||
    font-size: 24px;
 | 
			
		||||
    background: #1AAAFF;
 | 
			
		||||
    background: #1aaaff;
 | 
			
		||||
    border-radius: 8px;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -399,10 +410,10 @@ export default {
 | 
			
		||||
      line-height: 64px;
 | 
			
		||||
      margin-bottom: 16px;
 | 
			
		||||
      padding: 0 32px;
 | 
			
		||||
      background: #FFFFFF;
 | 
			
		||||
      background: #ffffff;
 | 
			
		||||
      border-radius: 8px;
 | 
			
		||||
      overflow: hidden;
 | 
			
		||||
      border: 1px solid #95CBFF;
 | 
			
		||||
      border: 1px solid #95cbff;
 | 
			
		||||
 | 
			
		||||
      em {
 | 
			
		||||
        position: absolute;
 | 
			
		||||
@@ -410,13 +421,13 @@ export default {
 | 
			
		||||
        top: 0;
 | 
			
		||||
        z-index: 0;
 | 
			
		||||
        height: 100%;
 | 
			
		||||
        background: #DCE8F4;
 | 
			
		||||
        background: #dce8f4;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      span {
 | 
			
		||||
        position: relative;
 | 
			
		||||
        z-index: 1;
 | 
			
		||||
        color: #5B84B3;
 | 
			
		||||
        color: #5b84b3;
 | 
			
		||||
        font-size: 28px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
@@ -424,7 +435,7 @@ export default {
 | 
			
		||||
        position: relative;
 | 
			
		||||
        z-index: 1;
 | 
			
		||||
        font-style: normal;
 | 
			
		||||
        color: #5B84B3;
 | 
			
		||||
        color: #5b84b3;
 | 
			
		||||
        font-size: 28px;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
@@ -494,7 +505,7 @@ export default {
 | 
			
		||||
    .u-input {
 | 
			
		||||
      background: #f7f7f7;
 | 
			
		||||
      border-radius: 8px 8px 0 0;
 | 
			
		||||
      padding: 10px!important;
 | 
			
		||||
      padding: 10px !important;
 | 
			
		||||
      margin: 0 30px 0 30px;
 | 
			
		||||
      .uni-textarea-placeholder {
 | 
			
		||||
        padding: 16px 0 0 16px;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user