提交一波居民议事
This commit is contained in:
		
							
								
								
									
										382
									
								
								src/apps/AppVillageDiscuss/AppVillageDiscuss.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										382
									
								
								src/apps/AppVillageDiscuss/AppVillageDiscuss.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,382 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="AppVillageDiscuss">
 | 
			
		||||
    <AiTopFixed v-if="tabs.length>0">
 | 
			
		||||
      <div class="tab-select">
 | 
			
		||||
        <div class="item" :class="{active:type == item.dictValue}" v-for="(item) in tabs" :key="item.dictValue"
 | 
			
		||||
             @click="tabClick(item.dictValue)">{{ item.dictName }}<span/>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </AiTopFixed>
 | 
			
		||||
    <template v-if="datas.length > 0">
 | 
			
		||||
      <AiCard v-for="(item, i) in datas" :ref="item.id" :key="i" @click.native="toAdd(item, 1)">
 | 
			
		||||
        <template #custom>
 | 
			
		||||
          <div flex class="w-100">
 | 
			
		||||
            <div class="avatar" v-text="item.avatar"/>
 | 
			
		||||
            <div flex class="column start fill">
 | 
			
		||||
              <b class="color-333" v-text="item.createUserName"/>
 | 
			
		||||
              <span class="color-999" v-text="item.createTime"/>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="statusTag" :class="{over:item.status>0}"
 | 
			
		||||
                 v-text="item.status==0? item.type==0?'征集中':'投票中':$dict.getLabel('discussStatus',item.status)"/>
 | 
			
		||||
          </div>
 | 
			
		||||
          <p class="item-content">
 | 
			
		||||
            <u-parse :html="item.content"></u-parse>
 | 
			
		||||
          </p>
 | 
			
		||||
          <div v-if="item.images&&item.images.length">
 | 
			
		||||
            <div class="img-list" v-if="item.contentType != 1">
 | 
			
		||||
              <img :src="items.accessUrl" alt="" v-for="(items, index) in item.images" :key="index" v-if="index < 3"
 | 
			
		||||
                   @click.stop="previewImage(item.images, items.accessUrl)"/>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="img-list" v-else>
 | 
			
		||||
              <video class="video" :src="item.images[0].url"/>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </template>
 | 
			
		||||
      </AiCard>
 | 
			
		||||
      <u-loadmore :status="loadmore" color="#999" font-size="24" margin-top="32" margin-bottom="80"/>
 | 
			
		||||
    </template>
 | 
			
		||||
 | 
			
		||||
    <AiEmpty description="暂无数据" v-else></AiEmpty>
 | 
			
		||||
 | 
			
		||||
    <AiFixedBtn>
 | 
			
		||||
      <div class="addBtn iconfont iconfont-iconfangda" @tap.stop="toAdd()"/>
 | 
			
		||||
      <div class="addBtn iconfont iconfont-iconDouble_Up" @tap.stop="backTop" v-if="showBackTop"/>
 | 
			
		||||
    </AiFixedBtn>
 | 
			
		||||
 | 
			
		||||
    <u-modal v-model="deletShow" content="您确认要删除该条信息吗?" :show-cancel-button="true" :mask-close-able="true"
 | 
			
		||||
             :show-title="false" @confirm="delet"></u-modal>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import {mapState} from 'vuex'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: 'AppVillageDiscuss',
 | 
			
		||||
  appName: '居民议事',
 | 
			
		||||
  components: {},
 | 
			
		||||
  props: {},
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      datas: [],
 | 
			
		||||
      current: 1,
 | 
			
		||||
      size: 10,
 | 
			
		||||
      pages: 0,
 | 
			
		||||
      deletShow: false,
 | 
			
		||||
      deletId: '',
 | 
			
		||||
      type: '0',
 | 
			
		||||
      listName: '',
 | 
			
		||||
      tabIndex: 0,
 | 
			
		||||
      showBackTop: false
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    ...mapState(['user']),
 | 
			
		||||
    loadmore() {
 | 
			
		||||
      return this.pages <= this.current ? 'loading ' : 'nomore'
 | 
			
		||||
    },
 | 
			
		||||
    tabs() {
 | 
			
		||||
      return this.$dict.getDict("discussStatus")
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  onLoad(o) {
 | 
			
		||||
    this.moduleId = o.moduleId
 | 
			
		||||
    this.listName = o.listName
 | 
			
		||||
    this.getList()
 | 
			
		||||
    uni.$on('update', () => {
 | 
			
		||||
      this.getList()
 | 
			
		||||
    })
 | 
			
		||||
    this.$dict.load("discussStatus")
 | 
			
		||||
  },
 | 
			
		||||
  onShow() {
 | 
			
		||||
    document.title = "居民议事"
 | 
			
		||||
  },
 | 
			
		||||
  onPageScroll(obj) {
 | 
			
		||||
    this.showBackTop = obj.scrollTop > 0
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    previewImage(images, img) {
 | 
			
		||||
      uni.previewImage({
 | 
			
		||||
        urls: images.map(v => v.url),
 | 
			
		||||
        current: img
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    tabClick(type) {
 | 
			
		||||
      this.type = type
 | 
			
		||||
      this.current = 1
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    search() {
 | 
			
		||||
      this.current = 1
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
    getList() {
 | 
			
		||||
      let {current, type} = this
 | 
			
		||||
      this.$http.post('/app/appvillagediscuss/list', null, {
 | 
			
		||||
        params: {size: 20, current, type},
 | 
			
		||||
      })
 | 
			
		||||
      .then((res) => {
 | 
			
		||||
        if (res?.data) {
 | 
			
		||||
          res.data.records.forEach(e => {
 | 
			
		||||
            e.avatar = e.createUserName?.substring(0, 2) || "游客"
 | 
			
		||||
            if (e.images) {
 | 
			
		||||
              e.images = JSON.parse(e.images)
 | 
			
		||||
            }
 | 
			
		||||
          })
 | 
			
		||||
          this.datas = this.current > 1 ? [...this.datas, ...res.data.records] : res.data.records
 | 
			
		||||
          this.pages = res.data.pages
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    toAdd(item, type) {
 | 
			
		||||
      if (item?.id) {
 | 
			
		||||
        this.$refs?.[item.id]?.[0]?.handleClose()
 | 
			
		||||
      }
 | 
			
		||||
      if (type == '1') {
 | 
			
		||||
        uni.navigateTo({url: `./Detail?id=${item.id}`})
 | 
			
		||||
      }
 | 
			
		||||
      if (type == '2') {
 | 
			
		||||
        uni.navigateTo({url: `./Add?id=${item.id}`})
 | 
			
		||||
      }
 | 
			
		||||
      if (type == null) {
 | 
			
		||||
        uni.navigateTo({url: `./Add`})
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    toDetele(item) {
 | 
			
		||||
      this.deletShow = true
 | 
			
		||||
      this.deletId = item.id
 | 
			
		||||
      this.$refs?.[item.id]?.[0]?.handleClose()
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    delet() {
 | 
			
		||||
      this.$http.post(`/app/appcontentinfo/delete?ids=${this.deletId}`).then((res) => {
 | 
			
		||||
        if (res.code == 0) {
 | 
			
		||||
          this.current = 1
 | 
			
		||||
          this.$u.toast('删除成功!')
 | 
			
		||||
          this.getList()
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    backTop() {
 | 
			
		||||
      uni.pageScrollTo({
 | 
			
		||||
        scrollTop: 0
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  onReachBottom() {
 | 
			
		||||
    this.current++
 | 
			
		||||
    this.getList()
 | 
			
		||||
  },
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped lang="scss">
 | 
			
		||||
.AppVillageDiscuss {
 | 
			
		||||
  height: 100%;
 | 
			
		||||
 | 
			
		||||
  .avatar {
 | 
			
		||||
    height: 64px;
 | 
			
		||||
    width: 64px;
 | 
			
		||||
    color: #fff;
 | 
			
		||||
    background: $uni-color-primary;
 | 
			
		||||
    border-radius: 50%;
 | 
			
		||||
    font-size: 24px;
 | 
			
		||||
    text-align: center;
 | 
			
		||||
    line-height: 64px;
 | 
			
		||||
    margin-right: 16px;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .color-999 {
 | 
			
		||||
    color: #999999;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .color-333 {
 | 
			
		||||
    color: #333;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .w-100 {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .statusTag {
 | 
			
		||||
    padding: 0 12px;
 | 
			
		||||
    line-height: 30px;
 | 
			
		||||
    border: 1px solid #2573FF;
 | 
			
		||||
    color: #2573FF;
 | 
			
		||||
    font-size: 22px;
 | 
			
		||||
 | 
			
		||||
    &.over {
 | 
			
		||||
      border-color: #666;
 | 
			
		||||
      color: #666;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ::v-deep.AiTopFixed {
 | 
			
		||||
    .content {
 | 
			
		||||
      padding: 0;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .tab-select {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 96px;
 | 
			
		||||
    line-height: 96px;
 | 
			
		||||
    background: #3975C6;
 | 
			
		||||
    display: flex;
 | 
			
		||||
 | 
			
		||||
    .item {
 | 
			
		||||
      flex: 1;
 | 
			
		||||
      text-align: center;
 | 
			
		||||
      font-size: 28px;
 | 
			
		||||
      font-family: PingFangSC-Regular, PingFang SC;
 | 
			
		||||
      color: #CDDCF0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    .active {
 | 
			
		||||
      font-family: PingFangSC-Medium, PingFang SC;
 | 
			
		||||
      font-weight: 500;
 | 
			
		||||
      position: relative;
 | 
			
		||||
      color: #fff;
 | 
			
		||||
 | 
			
		||||
      span {
 | 
			
		||||
        width: 48px;
 | 
			
		||||
        height: 4px;
 | 
			
		||||
        background: #FFF;
 | 
			
		||||
        position: absolute;
 | 
			
		||||
        bottom: 14px;
 | 
			
		||||
        left: 50%;
 | 
			
		||||
        margin-left: -24px;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  ::v-deep .AiCard {
 | 
			
		||||
    background: #f3f6f9;
 | 
			
		||||
    position: relative;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    margin-bottom: 16px;
 | 
			
		||||
 | 
			
		||||
    & > .start {
 | 
			
		||||
      background: #fff;
 | 
			
		||||
      padding: 32px;
 | 
			
		||||
      border-radius: 16px;
 | 
			
		||||
 | 
			
		||||
      .titles {
 | 
			
		||||
        width: 600px;
 | 
			
		||||
        font-size: 32px;
 | 
			
		||||
        font-weight: 500;
 | 
			
		||||
        color: #333333;
 | 
			
		||||
        margin-bottom: 16px;
 | 
			
		||||
        line-height: 50px;
 | 
			
		||||
        word-break: break-all;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .item-content {
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        word-break: break-all;
 | 
			
		||||
        overflow: hidden;
 | 
			
		||||
        text-overflow: ellipsis;
 | 
			
		||||
        display: -webkit-box;
 | 
			
		||||
        -webkit-line-clamp: 4;
 | 
			
		||||
        -webkit-box-orient: vertical;
 | 
			
		||||
        font-size: 26px;
 | 
			
		||||
        font-family: PingFangSC-Regular, PingFang SC;
 | 
			
		||||
        color: #333;
 | 
			
		||||
        line-height: 44px;
 | 
			
		||||
        margin-top: 32px;
 | 
			
		||||
        margin-bottom: 16px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .img-list {
 | 
			
		||||
        margin-bottom: 24px;
 | 
			
		||||
 | 
			
		||||
        img {
 | 
			
		||||
          width: calc(33% - 16px);
 | 
			
		||||
          height: 204px;
 | 
			
		||||
          margin: 0 16px 8px 0;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .flex {
 | 
			
		||||
        display: flex;
 | 
			
		||||
        justify-content: space-between;
 | 
			
		||||
 | 
			
		||||
        .left {
 | 
			
		||||
          .garydiv {
 | 
			
		||||
            font-size: 28px;
 | 
			
		||||
            color: #999999;
 | 
			
		||||
            background: #eeeeee;
 | 
			
		||||
            border-radius: 24px;
 | 
			
		||||
            padding: 4px 16px;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          .times {
 | 
			
		||||
            font-size: 28px;
 | 
			
		||||
            color: #999999;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          .type {
 | 
			
		||||
            display: inline-block;
 | 
			
		||||
            padding: 0 16px;
 | 
			
		||||
            line-height: 48px;
 | 
			
		||||
            background: #EEE;
 | 
			
		||||
            border-radius: 24px;
 | 
			
		||||
            font-size: 24px;
 | 
			
		||||
            font-family: PingFangSC-Regular, PingFang SC;
 | 
			
		||||
            font-weight: 400;
 | 
			
		||||
            color: #999;
 | 
			
		||||
            margin-right: 16px;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        .right {
 | 
			
		||||
          font-size: 28px;
 | 
			
		||||
          color: #999;
 | 
			
		||||
 | 
			
		||||
          img {
 | 
			
		||||
            width: 32px;
 | 
			
		||||
            height: 32px;
 | 
			
		||||
            vertical-align: middle;
 | 
			
		||||
            margin-right: 8px;
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          .font {
 | 
			
		||||
            color: #4181ff;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .AiFixedBtn {
 | 
			
		||||
    .movableArea {
 | 
			
		||||
      .addBtn {
 | 
			
		||||
        display: flex;
 | 
			
		||||
        justify-content: center;
 | 
			
		||||
        align-items: center;
 | 
			
		||||
        width: 96px;
 | 
			
		||||
        height: 96px;
 | 
			
		||||
        flex-shrink: 0;
 | 
			
		||||
        box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
 | 
			
		||||
        font-size: 48px;
 | 
			
		||||
        background: #fff;
 | 
			
		||||
        color: $uni-color-primary;
 | 
			
		||||
        border-radius: 50%;
 | 
			
		||||
 | 
			
		||||
        & + .addBtn {
 | 
			
		||||
          margin-top: 22px;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ::v-deep uni-video {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
		Reference in New Issue
	
	Block a user