欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue 下列表側(cè)滑操作實(shí)例代碼詳解

 更新時(shí)間:2018年07月24日 15:21:08   作者:wzzehui  
本文通過(guò)實(shí)例代碼給大家介紹了vue 下列表側(cè)滑操作,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

由于是上線的項(xiàng)目且已經(jīng)按照數(shù)據(jù)邏輯去渲染了能看懂的看邏輯吧。有點(diǎn)多

效果如圖

<template>
 <div class="lottery-management-wrapper">
  <ul>
   <li class="lottery-management-list-wrapper">
    <div class="lottery-management-list" v-for="(item , index) in activityListData">
     <div class="lottery-management-list-left" @click="detailOfTheActivity(item)">
      <dl>
       <dd>
        <h3>{{item.activityName}}</h3>
        <p>活動(dòng)時(shí)間:{{item.beginTime}}至{{item.endTime}}</p>
       </dd>
       <dt :class="item.status == 3 ? 'txt-red': item.status == 0 ? 'txt-blue' : ''">{{item.status == 3 ? '進(jìn)行中': item.status == 1 ? '已結(jié)束': item.status == 0 ? '待啟用' : ''}}</dt>
      </dl>
     </div>
     <div class="lottery-management-list-right">
      <a @click="startActivityAlert = true;currentItem = item;currentIndex = index" v-if="item.status == 0">啟用活動(dòng)</a>
      <span @click="delActivityAlert = true;currentItem = item;currentIndex = index" v-if="item.status == 1">刪除活動(dòng)</span>
      <span @click="stopActivityAlert = true;currentItem = item;currentIndex = index" v-if="item.status == 3 || item.status == 0">結(jié)束活動(dòng)</span>
     </div>
    </div>
   </li>
  </ul>
  <div class="add-wrapper" @click="addAwardActivity">
   <span class="iconfont icon-tianjia1"></span>
   <span class="text">新增活動(dòng)</span>
  </div>
  <h4>商戶員工賬號(hào)只有活動(dòng)查看權(quán)限,沒(méi)有活動(dòng)操作權(quán)限</h4>
  <transition name="fade">
   <div class="mask-wrapper"
      v-show="delActivityAlert"
      @touchmove.prevent>
    <tipsBox title="操作提示"
         text1="是否刪除當(dāng)前活動(dòng)"
         button1="取消"
         button2="確定"
         @confirm="delActivity"
         @cancel="delActivityAlert = false">
    </tipsBox>
   </div>
  </transition>
  <transition name="fade2">
   <div class="mask-wrapper"
      v-show="stopActivityAlert"
      @touchmove.prevent>
    <tipsBox title="操作提示"
         text1="是否停止當(dāng)前活動(dòng)"
         button1="取消"
         button2="確定"
         @confirm="stopActivity"
         @cancel="stopActivityAlert = false">
    </tipsBox>
   </div>
  </transition>
  <transition name="fade3">
   <div class="mask-wrapper"
      v-show="startActivityAlert"
      @touchmove.prevent>
    <tipsBox title="操作提示"
         text1="是否啟用當(dāng)前活動(dòng)"
         button1="取消"
         button2="確定"
         @confirm="startActivity"
         @cancel="startActivityAlert = false">
    </tipsBox>
   </div>
  </transition>
 </div>
</template>
<script>
 import TipsBox from 'components/tipsBox/TipsBox';
 import {configs} from 'common/js/config.js';
 import {baseAjaxParam, baseAjaxErr} from 'common/js/publicFn.js';
 const activityListApi = configs.baseApi + '/marketing/rouletter/activityList';
 const overActivityApi = configs.baseApi + '/marketing/rouletter/overActivity';
 const delActivityApi = configs.baseApi + '/marketing/rouletter/delActivity';
 const startActivityApi = configs.baseApi + '/marketing/rouletter/startActivity';
 export default {
  data () {
   return {
    delActivityAlert: false,
    stopActivityAlert: false,
    startActivityAlert: false,
    activityListData: [],
    currentItem: null,
    currentIndex: null
   };
  },
  methods: {
   getActivityList () {
    let data = baseAjaxParam(this);
    this.$http.jsonp(activityListApi, {params: data}).then((res) => {
     if (res.body.code === 0) {
      this.activityListData = res.body.data;
      this.setSlide();
     } else {
      baseAjaxErr(this, res);
     }
    }).catch(function (err) {
     alert('服務(wù)器錯(cuò)誤:' + err.status);
     console.log(err);
    });
   },
   setSlide () {
    this.$nextTick(() => {
     let list = document.getElementsByClassName('lottery-management-list');
     if (list) {
      if (this.currentIndex !== null) {
       list[this.currentIndex].firstElementChild.style.marginLeft = '0';
      }
      for (let i = 0; i < list.length; i++) {
       (() => {
        let start = 0;
        list[i].ontouchstart = function (e) {
         start = e.touches[0].pageX;
        };
        list[i].ontouchmove = function () {
         list[i].ontouchend = function (e) {
          let end = e.changedTouches[0].pageX;
          let rightWidth = list[i].lastElementChild.offsetWidth;
          if (end < start) {
           list[i].firstElementChild.style.marginLeft = -rightWidth + 'px';
          }
          if (end > start) {
           list[i].firstElementChild.style.marginLeft = '0';
          }
         };
        };
       })(i);
      }
     }
    });
   },
   // 查看詳情
   detailOfTheActivity (item) {
    this.$router.push('/detailOfTheActivity?activityId=' + item.activityId);
   },
   // 刪除活動(dòng)
   delActivity () {
    if (this.$store.state.roleId !== '0' && this.$store.state.roleId !== 'ROL197001010800007e4b5ce2fe28308' && this.$store.state.roleId !== 'ROL197001010800004ca4238a0b92382') {
     if (!this.$store.state.authList['AUT20180705181442eQbFSPyr7HTOKji']) {
      this.$store.commit('popSet', {tips: '無(wú)權(quán)限操作', status: 1, time: 1500});
      return;
     }
    }
    this.delActivityAlert = false;
    let data = baseAjaxParam(this);
    data.activityId = this.currentItem.activityId;
    this.$http.jsonp(delActivityApi, {params: data}).then((res) => {
     if (res.body.code === 0) {
      this.$store.commit('popSet', {tips: '刪除動(dòng)成功', status: 0, time: 1500});
      this.getActivityList();
     } else {
      baseAjaxErr(this, res);
     }
    }).catch(function (err) {
     alert('服務(wù)器錯(cuò)誤:' + err.status);
     console.log(err);
    });
   },
   // 停止活動(dòng)
   stopActivity () {
    if (this.$store.state.roleId !== '0' && this.$store.state.roleId !== 'ROL197001010800007e4b5ce2fe28308' && this.$store.state.roleId !== 'ROL197001010800004ca4238a0b92382') {
     if (!this.$store.state.authList['AUT20180705181442eQbFSPyr7HTOKji']) {
      this.$store.commit('popSet', {tips: '無(wú)權(quán)限操作', status: 1, time: 1500});
      return;
     }
    }
    this.stopActivityAlert = false;
    let data = baseAjaxParam(this);
    data.activityId = this.currentItem.activityId;
    this.$http.jsonp(overActivityApi, {params: data}).then((res) => {
     if (res.body.code === 0) {
      this.$store.commit('popSet', {tips: '結(jié)束活動(dòng)成功', status: 0, time: 1500});
      this.getActivityList();
     } else {
      baseAjaxErr(this, res);
     }
    }).catch(function (err) {
     alert('服務(wù)器錯(cuò)誤:' + err.status);
     console.log(err);
    });
   },
   // 啟用活動(dòng)
   startActivity () {
    if (this.$store.state.roleId !== '0' && this.$store.state.roleId !== 'ROL197001010800007e4b5ce2fe28308' && this.$store.state.roleId !== 'ROL197001010800004ca4238a0b92382') {
     if (!this.$store.state.authList['AUT20180705181442eQbFSPyr7HTOKji']) {
      this.$store.commit('popSet', {tips: '無(wú)權(quán)限操作', status: 1, time: 1500});
      return;
     }
    }
    this.startActivityAlert = false;
    let data = baseAjaxParam(this);
    data.activityId = this.currentItem.activityId;
    this.$http.jsonp(startActivityApi, {params: data}).then((res) => {
     if (res.body.code === 0) {
      this.$store.commit('popSet', {tips: '啟用活動(dòng)成功', status: 0, time: 1500});
      this.getActivityList();
     } else {
      baseAjaxErr(this, res);
     }
    }).catch(function (err) {
     alert('服務(wù)器錯(cuò)誤:' + err.status);
     console.log(err);
    });
   },
   addAwardActivity () {
    if (this.$store.state.roleId !== '0' && this.$store.state.roleId !== 'ROL197001010800007e4b5ce2fe28308' && this.$store.state.roleId !== 'ROL197001010800004ca4238a0b92382') {
     if (!this.$store.state.authList['AUT20180705181442eQbFSPyr7HTOKji']) {
      this.$store.commit('popSet', {tips: '無(wú)權(quán)限操作', status: 1, time: 1500});
      return;
     }
    }
    this.$router.push('addAwardActivity');
   }
  },
  created () {
   this.getActivityList();
  },
  components: {
   TipsBox
  }
 };
</script>
<style lang="stylus" rel="stylesheet/stylus">
 @import '../../../common/stylus/mixin'
 .lottery-management-wrapper {
  width :100%;
  position :absolute;
  background-color :#ECF0F3;
  min-height :100%;
  .lottery-management-list-wrapper {
   width :100%;
   overflow hidden;
   .lottery-management-list {
    background-color :#fff;
    margin-bottom cal(10);
    overflow :hidden;
    width :200%;
    .lottery-management-list-left {
     width :cal(750);
     float :left;
     transition: margin-left .4s;
     dl {
      overflow :hidden;
      height :cal(128);
      dd {
       float left;
       width :80%;
       h3 {
        font-size :cal(28);
        color: #4A4A4A;
        margin:cal(32) 0 0 cal(50);
       }
       p {
        font-size : cal(18)
        color:#4A4A4A;
        margin:cal(16) 0 0 cal(50);
       }
      }
      dt {
       float :left;
       width :20%;
       color: #9B9B9B;
       font-size :cal(26);
       line-height :cal(128);
      }
      .txt-red {
       color:#D0021B;
      }
      .txt-blue {
       color:#4A90E2;
      }
     }
    }
    .lottery-management-list-right {
     float :left;
     overflow: hidden;
     font-size :cal(24);
     line-height :cal(128);
     color :#ffffff;
     text-align :center;
     a {
      float: left;
      background-color :#70AEF6;
      width :cal(190);
      color :#ffffff;
     }
     span {
      float: left;
      width :cal(128);
      background-color :#FE3A32;
     }
    }
   }
  }
  .add-wrapper {
   height: cal(100)
   box-sizing: border-box
   padding-top: cal(24)
   margin-bottom: cal(72)
   background: #fff
   text-align: center
   font-size: 0
   margin-top :cal(20)
   .icon-tianjia1 {
    color: #fe6f3f
    font-size: cal(54)
    vertical-align: top
    margin-right: cal(12)
   }
   .text {
    line-height: cal(60)
    vertical-align: top
    color: #fe6f3f
    font-size: cal(30)
   }
  }
  h4 {
   color: #D0021B;
   font-size :cal(24);
   text-align: center;
   margin-bottom :cal(100);
  }
  .mask-wrapper {
   position: fixed
   left: 0
   right: 0
   bottom: 0
   top: 0
   background: rgba(0,0,0,.5)
   &.fade-enter-active, &.fade-leave-active {
    transition: all 0.2s linear
   }
   &.fade-enter,&.fade-leave-active{
    opacity: 0
   }
   &.fade2-enter-active, &.fade2-leave-active {
    transition: all 0.2s linear
   }
   &.fade2-enter,&.fade2-leave-active{
    opacity: 0
   }
   &.fade3-enter-active, &.fade3-leave-active {
    transition: all 0.2s linear
   }
   &.fade3-enter,&.fade3-leave-active{
    opacity: 0
   }
  }
 }
</style>

總結(jié)

以上所述是小編給大家介紹的vue 下列表側(cè)滑操作實(shí)例代碼詳解,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

  • vue3頁(yè)面query參數(shù)變化并重新加載頁(yè)面數(shù)據(jù)方式

    vue3頁(yè)面query參數(shù)變化并重新加載頁(yè)面數(shù)據(jù)方式

    在Web開(kāi)發(fā)中,頁(yè)面間的跳轉(zhuǎn)及數(shù)據(jù)刷新是常見(jiàn)問(wèn)題,通過(guò)使用$router.push和$router.replace方法,可以控制頁(yè)面跳轉(zhuǎn)的行為,具體操作時(shí),若發(fā)現(xiàn)頁(yè)面ID變更后數(shù)據(jù)未刷新,可通過(guò)給router-view標(biāo)簽添加key值解決,若使用keep-alive
    2024-10-10
  • vue中Echarts圖表寬度沒(méi)占滿的問(wèn)題

    vue中Echarts圖表寬度沒(méi)占滿的問(wèn)題

    這篇文章主要介紹了vue中Echarts圖表寬度沒(méi)占滿的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • vue.js通過(guò)路由實(shí)現(xiàn)經(jīng)典的三欄布局實(shí)例代碼

    vue.js通過(guò)路由實(shí)現(xiàn)經(jīng)典的三欄布局實(shí)例代碼

    本文通過(guò)實(shí)例代碼給大家介紹了vue.js通過(guò)路由實(shí)現(xiàn)經(jīng)典的三欄布局,代碼簡(jiǎn)單易懂,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
    2018-07-07
  • 案例實(shí)操vue事件修飾符帶你快速了解與應(yīng)用

    案例實(shí)操vue事件修飾符帶你快速了解與應(yīng)用

    這篇文章主要介紹了vue常見(jiàn)的事件修飾符,在平時(shí)無(wú)論是面試還是學(xué)習(xí)工作中都會(huì)經(jīng)常遇到的,本文就帶你快速上手,需要的朋友可以參考下
    2023-03-03
  • 如何利用vue實(shí)現(xiàn)波譜擬合詳解

    如何利用vue實(shí)現(xiàn)波譜擬合詳解

    這篇文章主要給大家介紹了關(guān)于如何利用vue實(shí)現(xiàn)波譜擬合的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • vue-router重定向和路由別名的使用講解

    vue-router重定向和路由別名的使用講解

    今天小編就為大家分享一篇關(guān)于vue-router重定向和路由別名的使用講解,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
    2019-01-01
  • Vue3子組件實(shí)現(xiàn)v-model用法的示例代碼

    Vue3子組件實(shí)現(xiàn)v-model用法的示例代碼

    在Vue 3中,實(shí)現(xiàn)自定義的input組件并支持v-model綁定,涉及到對(duì)modelValue這個(gè)默認(rèn)prop的處理和對(duì)應(yīng)的update:modelValue事件的觸發(fā),本文給大家介紹了Vue3子組件實(shí)現(xiàn)v-model用法的示例,需要的朋友可以參考下
    2024-04-04
  • Vue.js仿微信聊天窗口展示組件功能

    Vue.js仿微信聊天窗口展示組件功能

    這篇文章主要介紹了Vue.js仿微信聊天窗口展示組件功能,需要的朋友可以參考下
    2017-08-08
  • 詳解搭建一個(gè)vue-cli的移動(dòng)端H5開(kāi)發(fā)模板

    詳解搭建一個(gè)vue-cli的移動(dòng)端H5開(kāi)發(fā)模板

    這篇文章主要介紹了詳解搭建一個(gè)vue-cli的移動(dòng)端H5開(kāi)發(fā)模板,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-01-01
  • vue實(shí)現(xiàn)中部導(dǎo)航欄布局功能

    vue實(shí)現(xiàn)中部導(dǎo)航欄布局功能

    這篇文章主要介紹了vue實(shí)現(xiàn)中部導(dǎo)航欄布局功能,本文圖文并茂,代碼實(shí)例相結(jié)合介紹的非常詳細(xì),需要的朋友參考下吧
    2019-07-07

最新評(píng)論