DESKTOP-O04BTUJ\muzen 2 lat temu
rodzic
commit
875cbb8003
1 zmienionych plików z 110 dodań i 16 usunięć
  1. 110 16
      src/mixin/index.js

+ 110 - 16
src/mixin/index.js

@@ -3,7 +3,8 @@ import {
 } from '@/api/device/version'
 
 import {
-  playform
+  platform,
+  audioType
 } from '@/api/music/platform'
 
 import {
@@ -127,7 +128,18 @@ const audioMixin = {
       }, {
         value: 15,
         label: '音乐专辑'
-      }]
+      }],
+      audioTypeOptions: []
+    }
+  },
+  methods: {
+    // 通过平台获取对应的音频类型
+    getAudioType(e) {
+      platform(e).then(res => {
+        if (res.code === 0) {
+          this.audioTypeOptions = res.data[0].audioType.split(',').map(i => this.audioOptions.find(j => j.value == i))
+        }
+      })
     }
   }
 }
@@ -142,6 +154,9 @@ const sexMixin = {
       }, {
         value: 1,
         label: '女'
+      }, {
+        value: 2,
+        label: '未知'
       }]
     }
   }
@@ -205,20 +220,48 @@ const languageMixin = {
 const platformMixin = {
   data() {
     return {
-      platformOptions: []
+      platformOptions: [{
+        value: 1,
+        label: '蜻蜓'
+      }, {
+        value: 2,
+        label: '官方电台'
+      }, {
+        value: 3,
+        label: '猫王好听'
+      }, {
+        value: 4,
+        label: '海外电台'
+      }, {
+        value: 5,
+        label: '音乐随身听'
+      }, {
+        value: 6,
+        label: 'QQ音乐'
+      }, {
+        value: 7,
+        label: 'HIFIVE音乐'
+      }, {
+        value: 8,
+        label: '看见音乐'
+      }]
     }
   },
-  mounted() {
-    playform(this.audioType).then(res => {
-      if (res.code === 0) {
-        res.data.map(i => {
-          this.platformOptions.push({
-            value: Number(i.id),
-            label: i.name
+  methods: {
+    // 通过音频类型获取对应的平台
+    getPlatform(e) {
+      this.platformOptions = []
+      audioType(e).then(res => {
+        if (res.code === 0) {
+          res.data.map(i => {
+            this.platformOptions.push({
+              value: Number(i.id),
+              label: i.name
+            })
           })
-        })
-      }
-    })
+        }
+      })
+    }
   }
 }
 
@@ -237,6 +280,21 @@ const onOrOffMixin = {
   }
 }
 
+// 禁用状态
+const disabledMixin = {
+  data() {
+    return {
+      disabledOptions: [{
+        value: 0,
+        label: '启用'
+      }, {
+        value: 1,
+        label: '禁用'
+      }]
+    }
+  }
+}
+
 // 付费类型
 const payTypeMixin = {
   data() {
@@ -344,8 +402,8 @@ const rewardMixin = {
         //   value: 3,
         //   label: '音响实物'
         // }, {
-        value: 4,
-        label: '积分'
+        //   value: 4,
+        //   label: '积分'
         // },{
         //   value: 5,
         //   label: '谢谢惠顾'
@@ -377,6 +435,39 @@ const classifyMixin = {
   }
 }
 
+// 时效性
+const currentMixin = {
+  data() {
+    return {
+      currentOptions: [{
+        value: 0,
+        label: '进行中'
+      }, {
+        value: 1,
+        label: '未开始'
+      }, {
+        value: 2,
+        label: '已过期'
+      }]
+    }
+  }
+}
+
+// 封面类型
+const coverMixin = {
+  data() {
+    return {
+      coverOptions: [{
+        value: 0,
+        label: '自定义封面'
+      }, {
+        value: 1,
+        label: '内容封面'
+      }]
+    }
+  }
+}
+
 export {
   devMixin,
   serviceTimeMixin,
@@ -387,10 +478,13 @@ export {
   languageMixin,
   platformMixin,
   onOrOffMixin,
+  disabledMixin,
   payTypeMixin,
   albumTypeMixin,
   addressMixin,
   contentMixin,
   rewardMixin,
-  classifyMixin
+  classifyMixin,
+  currentMixin,
+  coverMixin
 }