psdMixin.js 1.15 KB
import { marketingApi } from '@/api'
export default {
  data () {
    return {
      option: [
        { text: '上传时间优先', value: 0 },
        { text: '发送次数优先', value: 1 },
        { text: '阅读数优先', value: 2 },
      ],
      psdGroupList: [],
      tab: [],
      updata: new Date().getTime()
    }
  },
  mounted () {
    marketingApi.getPsdGroupList().then(data => {
      console.log('素材组', data)
      let psdGroupList = [{
        text: '全部',
        value: '',
        active: true
      }]
      let tab = []
      data && data.map(e => {
        psdGroupList.push({
          text: e.materialGroupName,
          value: e.id,
          active: false
        })
        tab.push(e.materialGroupName)
      })
      
      let { groupId } = this
      if (groupId) {
        psdGroupList.map(e =>{
          if(e.value == groupId) e.active = true
          else e.active = false
        })
        this.clearData()
      }
      this.psdGroupList = psdGroupList
      if (this.$route.name == 'psd') {
        this.tab = tab
        this.change(0)
      }
      this.updata = new Date().getTime()
    })
  },
  methods: {

  }
}