index.vue 8.86 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
<template>
  <div class="interactive-wrapper height100">
    <el-row :gutter="16" style="margin-left:0;margin-right:0;height:calc(100% - 41px);">
      <el-col :span="6" class="height100">
        <el-card class="height100">
          <div class="tree-title">组织机构</div>
          <div class="tree-body">
            <el-input suffix-icon="el-icon-search" placeholder="请输入组织结构名称" v-model="filterText"></el-input>
            <el-tree
              class="filter-tree"
11
              :data="treeData"
12 13
              :props="defaultProps"
              default-expand-all
14
              accordion
15
              :filter-node-method="filterNode"
16
              @node-click="handleNodeClick"
17 18 19 20 21
              ref="tree"
            />
          </div>
        </el-card>
      </el-col>
22
      <el-col :span="18" class="height100" ref="rightBox">
23
        <el-card class="height100">
24 25 26 27 28
          <div class="content-title">
            <div class="title">“北京市政府”展板互动信息汇总</div>
            <div class="page-tip">
              <span class="page-tip-title">页面说明:</span>
              <span class="page-tips">可按照账号状态及所属单位进行信息筛选。可新增机顶盒账号,“*”为必填项。请先创建单位管理员账号,否则机顶盒无法激活</span>
29
            </div>
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
          </div>
          <div class="scrollBox" :style="{height:height+'px'}">
            <div class="content-item" v-for="(item,index) in tableData" :key="index">
              <h5 class="title">{{item.name}}</h5>
              <p>{{item.content}}</p>
              <div class="img-box">
                <img v-for="(j,idx) in item.images" :src="j" :key='idx' alt="">
                <!-- <img src="@/assets/audio-icon.png" alt="">
                <img src="@/assets/audio-icon.png" alt="">
                <img src="@/assets/video-icon.png" alt="">
                <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic139.nipic.com%2Ffile%2F20170825%2F24044964_112347917039_2.jpg&refer=http%3A%2F%2Fpic139.nipic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616393684&t=43405cf2c33d8addc98e0909da78f359" alt=""> -->
              </div>
              <div class="author">
                <div>{{item.username}}</div>
                <div>{{item.createTime}}</div>
              </div>
46 47
            </div>
          </div>
48 49 50 51 52 53 54 55 56 57
          <div class="partyt-pagination" style="margin:0 20px;">
            <el-pagination
              background
              @current-change="handleCurrentChange"
              :current-page="page.currentPage"
              :page-size="page.pageSize"
              layout="prev, pager, next, jumper"
              :total="page.total"
            ></el-pagination>
          </div>
58 59 60 61 62 63
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>
<script>
64

65 66 67
export default {
  data() {
    return {
68
      height:'',
69
      filterText: "",
70 71
      page: { currentPage: 1, pageSize: 10, total: 0 },
      treeData: [],
72 73
      defaultProps: {
        children: "children",
74
        label: "name"
75
      },
76 77
      selectAreaId:'',
      tableData: [
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
        {
          title: "建党百年,爱国主义教育",
          content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget.",
          author: "邢潇潇",
          files:['@/assets/audio-icon.png','@/assets/video-icon.png','https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic139.nipic.com%2Ffile%2F20170825%2F24044964_112347917039_2.jpg&refer=http%3A%2F%2Fpic139.nipic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616393684&t=43405cf2c33d8addc98e0909da78f359'],
          macUrl: "2021/01/02  14:34:22"
        },
        {
          title: "建党百年,爱国主义教育",
          content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget.",
          author: "邢潇潇",
          files:['@/assets/audio-icon.png','@/assets/video-icon.png','https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic139.nipic.com%2Ffile%2F20170825%2F24044964_112347917039_2.jpg&refer=http%3A%2F%2Fpic139.nipic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616393684&t=43405cf2c33d8addc98e0909da78f359'],
          macUrl: "2021/01/02  14:34:22"
        },
      ]
    };
  },
  watch: {
    filterText(val) {
      this.$refs.tree.filter(val);
    }
  },
100 101 102 103 104 105
  mounted(){
    this.height = this.$refs.rightBox.$el.offsetHeight-160
    // 获取全部组织机构数据
    this.getOrgData()
    this.onSearch()
  },
106
  methods: {
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
    // 查询
    onSearch() {
      this.page.currentPage = 1
      this.getTableData();
    },
    // 获得数据接口
    getTableData() {
      let vm = this;
      let param = {
        _index:this.page.currentPage,
        _size:this.page.pageSize,
        orgId: this.selectAreaId
      };
      vm.$https(
        {
          url: "interaction/getList",
          method: "post",
          authType: this.backToken
        },
        vm.$qs.stringify(param)
      ).then(res => {
          if(res.data.resultCode==='200'){
            let data = res.data.data;
            vm.page.total = data.total;
            vm.tableData = data.records;
            vm.tableData.forEach(item=>{
              item.images = item.images.split(',')
              item.images.forEach((result,index)=>{
                if (/\.(MP4|mp4)/.test(result)){
                  item.images[index] = require('@/assets/video-icon.png')
                }else if (/\.(MP3|mp3)/.test(result)){
                  item.images[index] = require('@/assets/audio-icon.png')
                }else {
                  item.images[index] = require('@/assets/default-img.jpeg')
                }
              })
            })
            
            vm.tableData = [...vm.tableData]
          }else{
            this.$message({type:'error',message:res.data.message})
          }
          
        })
        .catch(function(err) {
          console.log(err);
        })
    },
    // 获取组织机构数据
    getOrgData(){
      this.$https({
        method: "get",
        url: "organ/getList",
        authType: this.backToken
      }).then(res => {
        if(res.data.resultCode === '200'){
          this.treeData = res.data.data;
        }else{
          this.$message({type:'error',message:res.data.message})
        }
        },
        error => {
          console.log(error);
        }
      );
    },
    // 过滤树结构数据
174 175
    filterNode(value, data) {
      if (!value) return true;
176 177 178 179 180 181 182 183 184 185 186 187
      return data.name.indexOf(value) !== -1;
    },
    // 点击节点事件
    handleNodeClick(data) {
      this.selectAreaId = data.areaId
      this.getTableData()
    },
    // 分页
    handleCurrentChange(val) {
      this.page.currentPage = val;
      this.getTableData();
    },
188 189 190 191
  }
};
</script>
<style lang="less">
192
@import '../../../style/pagination.less';
193
.interactive-wrapper {
194 195 196
  .scrollBox {
    overflow: auto;
  }
197
  .page-tip {
198 199 200 201 202 203 204
    display: flex;
    font-size: 14px;
    color: #333333;
    .page-tip-title {
      font-weight: bold;
      padding-right: 10px;
    }
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
  }
  .el-card__body {
    padding: 0;
  }
  .tree-title {
    font-size: 16px;
    color: #fff;
    text-align: center;
    height: 56px;
    line-height: 56px;
    background: #9B1E23;
    border-radius: 8px 8px 0 0;
  }
  .tree-body {
    padding: 20px;
    .el-input__inner {
      background: #F8F8F8;
      border-radius: 22px;
    }
    .el-input__icon {
      font-size: 18px;
      color: #AC9374;
    }
    .el-tree-node__content:hover {
      border-radius: 20px;
    }
    .el-tree-node__content {
      height:30px;
      margin: 5px 0;
    }
  }
  .content-title {
237 238
    display: flex;
    justify-content: space-between;
239 240
    padding: 20px;
    border-bottom: 1px solid #eee;
241 242 243 244 245 246 247
    .title {
      font-size: 20px;
      color: #333;
    }
    .page-tips {
      width:500px;
    }
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
  }
  .content-item {
    font-size: 16px;
    margin: 20px;
    padding: 40px;
    background: #f8f8f8;
    .title {
      padding-bottom: 20px;
    }
    p {
      padding-bottom: 20px;
      border-bottom: 1px solid #bbb;
    }
    .img-box {
      padding: 20px;
      border-bottom: 1px solid #bbb;
      img {
        width: 90px;
        height: 90px;
        margin-right: 20px;
      }
    }
    .author {
      display: flex;
      justify-content: space-between;
      padding-top: 16px;
      font-size: 14px;
    }
  }
}
</style>