123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809 |
- import {
- getClientTypeList
- } from "@/api/device/version";
- import {
- audioType,
- platform
- } from "@/api/music/platform";
- import {
- options
- } from "@/api/music/radio";
- import {
- list as categoryList
- } from "@/api/device/category";
- import {
- list as functionList
- } from "@/api/device/function";
- import {
- options as blogClass
- } from "@/api/music/blogclass";
- import {
- options as mapList
- } from "@/api/operation/map";
- // 设备列表
- const devMixin = {
- data() {
- return {
- devOptions: [],
- };
- },
- methods: {
- getDevList(e) {
- getClientTypeList(e ? e : {}).then((res) => {
- // console.log("获取设备列表==" + JSON.stringify(res));
- if (res.code === 0) {
- res.data.map((i) => {
- this.devOptions.push({
- value: i.clientTypeId,
- label: i.name,
- });
- });
- }
- });
- },
- },
- };
- // 设备模式
- const devModeMixin = {
- data() {
- return {
- devModeOptions: [{
- value: 1,
- label: "蓝牙",
- disabled: false,
- },
- {
- value: 2,
- label: "WIFI",
- disabled: false,
- },
- {
- value: 3,
- label: "传统蓝牙",
- disabled: false,
- },
- {
- value: 4,
- label: "4G",
- disabled: false,
- },
- ],
- };
- },
- };
- // 设备分类
- const devCategoryMixin = {
- data() {
- return {
- categoryOptions: [],
- };
- },
- methods: {
- getCateGory(status) {
- categoryList({
- status: status,
- isDelete: 0,
- }).then((res) => {
- res.data.map((i) => {
- this.categoryOptions.push({
- value: i.id,
- label: i.name,
- });
- });
- });
- },
- },
- };
- // 设备类型
- const devTypeMixin = {
- data() {
- return {
- devTypeOptions: [{
- value: 0,
- label: "音响",
- },
- {
- value: 1,
- label: "耳机",
- },
- {
- value: 2,
- label: "穿戴",
- },
- ],
- };
- },
- };
- // 功能权限
- const devFucMixin = {
- data() {
- return {
- devFucOptions: [],
- };
- },
- mounted() {
- functionList().then((res) => {
- if (res.code === 0) {
- res.data.map((i) => {
- this.devFucOptions.push({
- value: i.id,
- label: i.name,
- });
- });
- }
- });
- },
- };
- // 是否
- const yesOrNoMixin = {
- data() {
- return {
- yesOrNoOptions: [{
- value: 0,
- label: "否",
- },
- {
- value: 1,
- label: "是",
- },
- ],
- };
- },
- };
- // 服务时长
- const serviceTimeMixin = {
- data() {
- return {
- serviceTimeOptions: [{
- value: -1,
- label: "1天",
- },
- {
- value: 1,
- label: "7天",
- },
- {
- value: 2,
- label: "14天",
- },
- {
- value: 3,
- label: "1个月",
- },
- {
- value: 4,
- label: "3个月",
- },
- {
- value: 5,
- label: "6个月",
- },
- {
- value: 6,
- label: "1年",
- },
- {
- value: 7,
- label: "2年",
- },
- {
- value: 8,
- label: "3年",
- },
- {
- value: 9,
- label: "5年",
- },
- {
- value: 0,
- label: "永久",
- },
- ],
- };
- },
- };
- const serviceTypeMixin = {
- data() {
- return {
- // 服务类型
- serviceTypeOptions: [{
- value: 0,
- label: "签到",
- },
- {
- value: 1,
- label: "收听奖励",
- },
- {
- value: 2,
- label: "积分抽奖",
- },
- {
- value: 3,
- label: "打开手机通知",
- },
- {
- value: 4,
- label: "积分兑换",
- },
- {
- value: 5,
- label: "会员中心",
- },
- ],
- };
- },
- };
- // 是否免费
- const isFreeMixin = {
- data() {
- return {
- freeOptions: [{
- value: 0,
- label: "付费",
- },
- {
- value: 1,
- label: "免费",
- },
- ],
- };
- },
- };
- // 音频类型
- const audioMixin = {
- data() {
- return {
- audioOptions: [{
- value: 2,
- label: "广播电台",
- },
- {
- value: 6,
- label: "节目",
- },
- {
- value: 8,
- label: "播客专辑",
- },
- {
- value: 9,
- label: "歌手",
- },
- {
- value: 10,
- label: "歌单",
- },
- {
- value: 11,
- label: "歌曲",
- },
- {
- value: 12,
- label: "主播",
- },
- {
- value: 15,
- label: "音乐专辑",
- },
- ],
- audioTypeOptions: [],
- };
- },
- methods: {
- // 通过平台获取对应的音频类型
- getAudioType(e) {
- return new Promise((resolve, reject) => {
- platform(e).then((res) => {
- if (res.code === 0) {
- resolve(
- (this.audioTypeOptions = res.data[0].audioType
- .split(",")
- .map((i) => this.audioOptions.find((j) => j.value == i)))
- );
- }
- });
- }).catch((err) => {
- reject();
- });
- },
- },
- };
- // 性别
- const sexMixin = {
- data() {
- return {
- sexOptions: [{
- value: 0,
- label: "未知",
- },
- {
- value: 1,
- label: "男",
- },
- {
- value: 2,
- label: "女",
- },
- ],
- };
- },
- };
- // 所属地区
- const regionMixin = {
- data() {
- return {
- regionOptions: [{
- value: 0,
- label: "内地",
- },
- {
- value: 1,
- label: "港台",
- },
- {
- value: 2,
- label: "欧美",
- },
- {
- value: 3,
- label: "日本",
- },
- {
- value: 4,
- label: "韩国",
- },
- {
- value: 5,
- label: "其他",
- },
- ],
- };
- },
- };
- // 语种
- const languageMixin = {
- data() {
- return {
- languageOptions: [{
- value: 1,
- label: "国语",
- },
- {
- value: 2,
- label: "欧美",
- },
- {
- value: 3,
- label: "粤语",
- },
- {
- value: 4,
- label: "韩语",
- },
- {
- value: 5,
- label: "日语",
- },
- {
- value: 6,
- label: "其他",
- },
- ],
- };
- },
- };
- // 所属平台
- const platformMixin = {
- data() {
- return {
- platformTypeOptions: [],
- platformOptions: [],
- };
- },
- methods: {
- // 通过音频类型获取对应的平台
- getPlatform(e) {
- this.platformOptions = [];
- return new Promise((resolve, reject) => {
- audioType(e)
- .then((res) => {
- if (res.code === 0) {
- res.data.map((i) =>
- this.platformOptions.push({
- value: Number(i.id),
- label: i.name,
- joinType: i.joinType,
- })
- );
- e ? (this.platformTypeOptions = this.platformOptions) : "";
- resolve(this.platformOptions, this.platformTypeOptions);
- }
- })
- .catch((err) => {
- reject();
- });
- });
- },
- // 第三方资源平台不可编辑
- disabledPlatformId(e) {
- let value = this.platformOptions.find((i) => i.value == e);
- if (value) {
- return value.joinType.includes("1") ? true : false;
- }
- },
- // 禁止选择第三方平台
- disabledJoinType(e) {
- return e.split(",").includes("1");
- },
- },
- };
- // 上下架状态
- const onOrOffMixin = {
- data() {
- return {
- onOrOffOptions: [{
- value: 1,
- label: "上架",
- },
- {
- value: 2,
- label: "下架",
- },
- ],
- };
- },
- };
- // 上下架状态
- const disabledMixin = {
- data() {
- return {
- disabledOptions: [{
- value: 0,
- label: "上架",
- },
- {
- value: 1,
- label: "下架",
- },
- ],
- };
- },
- };
- // 付费类型
- const payTypeMixin = {
- data() {
- return {
- payTypeOptions: [{
- value: 1,
- label: "免费",
- },
- {
- value: 2,
- label: "全集购买",
- },
- {
- value: 3,
- label: "单集购买",
- },
- {
- value: 4,
- label: "Vip专享",
- },
- {
- value: 5,
- label: "亲子付费",
- },
- ],
- };
- },
- };
- // 专辑类型
- const albumTypeMixin = {
- data() {
- return {
- albumTypeOptions: [{
- value: 1,
- label: "Single",
- },
- {
- value: 2,
- label: "EP",
- },
- {
- value: 3,
- label: "Album",
- },
- {
- value: 4,
- label: "古典专辑",
- },
- {
- value: 5,
- label: "自制专辑",
- },
- ],
- };
- },
- };
- // 地域分类
- const addressMixin = {
- data() {
- return {
- addressOptions: [],
- };
- },
- mounted() {
- this.getAddress();
- },
- methods: {
- getAddress() {
- options({
- type: 2
- }).then((res) => {
- if (res.code === 0) {
- res.data.map((i) => {
- this.addressOptions.push({
- value: i.id,
- label: i.name,
- });
- });
- }
- });
- },
- },
- };
- // 广播分类
- const contentMixin = {
- data() {
- return {
- contentOptions: [],
- };
- },
- methods: {
- getContent(data) {
- options(data).then((res) => {
- if (res.code === 0) {
- res.data.map((i) => {
- this.contentOptions.push({
- value: i.id,
- label: i.name,
- });
- });
- }
- });
- },
- },
- };
- // 播客分类
- const blogClassMixin = {
- data() {
- return {
- blogClassOptions: [],
- };
- },
- mounted() {
- blogClass().then((res) => {
- if (res.code === 0) {
- res.data.map((i) => {
- this.blogClassOptions.push({
- value: i.id,
- label: i.name,
- });
- });
- }
- });
- },
- };
- // 时效性
- 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: "内容封面",
- },
- ],
- };
- },
- };
- // 通过频道属性查找音频类型
- const channelMixin = {
- data() {
- return {
- channelOptions: {
- 2: [{
- value: 2,
- label: "广播电台",
- }, ],
- 6: [{
- value: 6,
- label: "节目",
- },
- {
- value: 11,
- label: "歌曲",
- },
- ],
- 8: [{
- value: 8,
- label: "播客专辑",
- },
- {
- value: 10,
- label: "歌单",
- },
- {
- value: 15,
- label: "音乐专辑",
- },
- ],
- 16: [{
- value: 8,
- label: "播客专辑",
- }, ],
- 17: [{
- value: 2,
- label: "广播电台",
- }, ],
- },
- };
- },
- };
- // 手机系统
- const systemMixin = {
- data() {
- return {
- systemOptions: [{
- value: 1,
- label: "Android",
- },
- {
- value: 2,
- label: "iOS",
- },
- ],
- };
- },
- };
- // 省市区
- const mapMixin = {
- data() {
- return {
- mapOptions: [],
- };
- },
- async mounted() {
- await this.getMapOptions();
- },
- methods: {
- // 省市区
- getMapOptions() {
- return new Promise((reslove, reject) => {
- mapList().then((res) => {
- if (res.code === 0) {
- if (this.$route.path.search("/music/radio") !== -1) {
- res.data.unshift({
- adcode: "1",
- childList: [],
- citycode: "",
- id: "1",
- name: "中央台",
- });
- }
- reslove((this.mapOptions = res.data));
- }
- });
- });
- },
- areaFormatter(row) {
- if (this.mapOptions.length > 0) {
- let province = row.province ?
- this.mapOptions.find((i) => i.id == row.province) :
- "";
- let provinceName = province ? province.name : "";
- let city =
- province && province.childList.length > 0 ?
- province.childList.find((i) => i.id == row.city) :
- "";
- let cityName = city ? `-${city.name}` : "";
- let area =
- city && city.childList.length > 0 ?
- city.childList.find((i) => i.id == row.area) :
- "";
- let areaName = area ? `-${area.name}` : "";
- return `${provinceName}${cityName}${areaName}`;
- }
- },
- },
- };
- export {
- addressMixin,
- albumTypeMixin,
- audioMixin,
- blogClassMixin,
- channelMixin,
- contentMixin,
- coverMixin,
- currentMixin,
- devCategoryMixin,
- devFucMixin,
- devMixin,
- devModeMixin,
- devTypeMixin,
- disabledMixin,
- isFreeMixin,
- languageMixin,
- mapMixin,
- onOrOffMixin,
- payTypeMixin,
- platformMixin,
- regionMixin,
- serviceTimeMixin,
- serviceTypeMixin,
- sexMixin,
- systemMixin,
- yesOrNoMixin
- };
|