licp
2024-05-31 4bad62e4fd67ba8759f79263e4b08bf9ab6d64d0
src/view/notice.vue
@@ -5,76 +5,25 @@
  :visible.sync="drawer"
  :direction="direction"
  :before-close="handleClose" style="height: 100vh;z-index: 9999999;" size="450px">
    <div class="head">
      <div class="head-search">
        <label>消息类型:</label>
        <el-select v-model="type" placeholder="请选择" style="width: 150px;" size="small" @change="handleType">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
      </div>
      <el-dropdown style="margin-right: 20px;" v-if="list.length>0" @command="handleDropdownAll">
        <span class="el-dropdown-link">
          <span class="more">&middot;&middot;&middot;</span>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item command="1">
            <i class="el-icon-check"></i>
            <span>标记所有消息为已读</span>
          </el-dropdown-item>
          <el-dropdown-item  command="2">
            <i class="el-icon-delete"></i>
            <span>删除所有已读消息</span>
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
    <div class="notice-content" v-loading="loading">
      <scroll-pagination @load="refresh" :finishLoding="finishLoding" :list="list">
        <div class="notice-content-item" v-for="(m,i) in list" :key="i">
          <div class="btns" v-if="m">
            <!-- v-if="m.messageType==2||m.messageType==3" -->
            <el-dropdown style="margin-right: 20px;" trigger="click" @command="e=>handleDropdown(e,m)" v-if="false">
              <span class="el-dropdown-link">
                <span class="more" style="line-height: 26px;display: inline-block;">&middot;&middot;&middot;</span>
              </span>
              <el-dropdown-menu slot="dropdown" v-if="m.messageType==2">
                <el-dropdown-item v-for="(n,j) in dropdownList0" :key="j" :command="n.value">
                  {{ n.label }}
                </el-dropdown-item>
              </el-dropdown-menu>
              <el-dropdown-menu slot="dropdown" v-if="m.messageType==3">
                <el-dropdown-item v-for="(n,j) in dropdownList1" :key="j" :command="n.value">
                  {{ n.label }}
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
            <i class="el-icon-close" style="cursor: pointer;" @click="handleDel(m)"></i>
          </div>
          <div class="content" @click="goNoticeDetail(m)" style="cursor: pointer;">
            <img :src="`../../static/img/notice-${m.messageType}.svg`" alt="" style="width: 50px;margin-right: 18px;">
            <div class="content-info">
              <h4 style="font-weight: normal;margin-bottom: 4px;display: flex;align-items: center;justify-content: space-between;">
                <span>{{ m.theme }}<el-tag :type="!m.viewStatus?'danger':'success'" size="small" v-if="m.messageType==1||m.messageType==2||m.messageType==3" style="margin-left: 8px;">{{ !m.viewStatus?'未处理':'已处理' }}</el-tag></span>
                <span class="time" style="color: #999999;font-size: 12px;">{{ m.createTime }}</span>
              </h4>
              <p style="color: #999999;font-size: 14px;margin-bottom: 6px;" class="ellipsis-multiline">{{ m.content }}</p>
              <p style="font-size: 12px;color: #999999;display: flex;align-items: center;justify-content: space-between;">
                <span>发送人:{{m.createUser}}</span>
                <span>收件人:{{ m.consigneeUser }}</span>
              </p>
            </div>
          </div>
          <div class="new-notice" v-if="!m.viewStatus">
            <span>new</span>
        <div
        class="notice-content-item"
        v-for="(m,i) in list"
        :key="i"
        :class="{readStyle:!m.viewStatus}"
        @click="goNoticeDetail(m)">
          <img :src="`../../static/img/notice-${m.viewStatus?0:1}-${m.messageType}.svg`" alt="" style="margin-right: 6px;">
          <div class="notice-content-item-left">
            <p>{{ m.theme }}</p>
            <p style="width: 100%;display: flex;align-items: center;justify-content: space-between;">
              <span>发送人:{{ m.createUser }}</span>
              <span>{{ m.createTime }}</span>
            </p>
          </div>
        </div>
      </scroll-pagination>
      <div v-if="list.length<1&&!loading" style="color:#909399;font-size:14px;text-align: center;margin-top:200px" >暂无数据</div>
      <!-- <div v-if="list.length<1&&!loading" style="color:#909399;font-size:14px;text-align: center;margin-top:200px" >暂无数据</div> -->
    </div>
  </el-drawer>
</div>
@@ -120,7 +69,22 @@
          value:4
        },
      ],
      list:[],
      list:[
        // {
        //   messageType:1,
        //   theme:'测试标题',
        //   createTime: '2019-08-30 15:46:17',
        //   createUser:'<USERNAME>',
        //   viewStatus:false,
        // },
        // {
        //   messageType:2,
        //   theme:'测试标题',
        //   createTime: '2019-08-30 15:46:17',
        //   createUser:'<USERNAME>',
        //   viewStatus:true,
        // },
      ],
      currentPage:1,
      pageSize: 8, // 一页7条
      total: null,
@@ -296,66 +260,43 @@
  cursor: pointer;
}
.notice-content{
  height: calc(100% - 60px);
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 0 16px;
}
.notice-content-item{
  position: relative;
  width: 100%;
  padding: 8px;
  padding: 9px;
  border-radius: 8px;
  box-sizing: border-box;
  border: 1px solid #EEEEEE;
  margin-bottom: 10px;
  overflow: hidden;
}
.btns{
  position: absolute;
  right: 20px;
  top: 4px;
  z-index: 4;
}
.notice-content-item .btns{
  opacity: 0;
}
.time{
  opacity: 1;
}
.notice-content-item:hover{
  box-shadow: 4px 4px 8px 0px rgba(51,51,51,0.04);
}
.notice-content-item:hover .btns{
  opacity: 1;
}
.notice-content-item:hover .time{
  opacity: 0;
}
.content{
  background: #FBF2ED;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.content-info{
  flex: 1;
.notice-content-item-left{
  width: 100%;
}
.new-notice{
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-top: 14px solid red;
  border-right: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 14px solid red;
.notice-content-item-left p:nth-child(1){
  font-size: 14px;
  color: #FF7756;
  line-height: 18px;
  margin-bottom: 8px;
}
.new-notice span{
  position: absolute;
.notice-content-item-left p:nth-child(2){
  color: #FFAB97;
  font-size: 12px;
  top: -13px;
  left: -17px;
  color: #fff;
  transform: rotate(-45deg) scale(0.8);
}
.readStyle{
  background: #E9F6F2;
}
.readStyle .notice-content-item-left p:nth-child(1){
  color: #198D8A;
}
.readStyle .notice-content-item-left p:nth-child(2){
  color: #90CBCD;
}
</style>