1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- import { CDN_URL,API_BASE_URL,DISTRIBUTION } from '../../config/index';
- import http from '../../utils/http';
- let app = getApp();
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- },
- /**
- * 组件的初始数据
- */
- data: {
- cdn_url:CDN_URL,
- audioList:DISTRIBUTION,
- api_base_url:API_BASE_URL
- },
- /**
- * 组件的方法列表
- */
- methods: {
- getAudiosList(){
- http.get('/api/web/audio/list').then(res=>{
- let {data} = res;
- let target = [];
- for(let [key,value] of Object.entries(data)) {
- switch (key) {
- case '1':
- let obj1 = {};
- obj1['title'] = '主厅';
- obj1['list'] = value
- target = [...target,obj1]
- break;
- case '2':
- let obj2 = {};
- obj2['title'] = '附厅';
- obj2['list'] = value;
- target = [...target,obj2]
- break;
- case '3':
- let obj3 = {};
- obj3['title'] = '序厅';
- obj3['list'] = value;
- target = [...target, obj3];
- break;
- default:
- break
- }
- }
- this.setData({
- audioList:target
- })
- })
- },
- tapTitle(e){
- let {tag,index} = e.mark;
- let data = this.data.audioList
- if (!tag) {
- return
- }
- if (data[index]['tag'] == tag) {
- tag = ''
- }
- data[index]['tag'] = tag
- this.setData({
- audioList:data
- })
- }
- },
- attached: function () {
- //获取语音
- // this.getAudiosList();
- },
- detached: function () {
- app.globalData.AllExample = [];
- }
- })
|