# uniapp-music-project **Repository Path**: zhao-jingtao-l/uniapp-music-project ## Basic Information - **Project Name**: uniapp-music-project - **Description**: 网易云音乐微信小程序 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-03-19 - **Last Updated**: 2024-03-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: uni-app, weixin, Axios ## README # 网易云微信小程序细节 ## 一、设置主题 ```ts "window": { "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#c20c0c", "navigationBarTitleText": "网易云音乐", "navigationBarTextStyle": "white" } ``` ## 二、设置tabber ```json "tabBar": { "color": "#777777", "selectedColor": "#c20c0c", "list": [ { "pagePath": "pages/SongList/SongList", "text": "首页", "iconPath": "./image/music1.png", "selectedIconPath": "./image/music.png" }, { "pagePath": "pages/Find/Find", "text": "发现", "iconPath": "./image/find1.png", "selectedIconPath": "./image/find.png" } ] } ``` ## 三、封装请求 ```ts /* 封装 网络请求 */ class Request { request(url, method, data, loading) { return new Promise((resolve, reject) => { // 判断是否把 loading 状态传递过来了 if (loading) { wx.showLoading({ title: '数据加载中', }) } wx.request({ url: 'http://localhost:3000' + url, data: data || {}, method: method, success: (result) => { resolve(result) }, fail: (res) => { reject(res) }, complete: (res) => { setTimeout(() => { // 请求完成的时候 就把 loadding 隐藏了即可 wx.hideLoading() }, 150) }, }) }) } /* 这里携带 laodding 就是通过传递参数来决定是不是 有loadding */ // get 请求 get(url, data, loadding) { return this.request(url, "get", data, loadding) } // post 请求 post(url, data, loadding) { return this.request(url, "post", data, loadding) } } // 导出封装实例 export default new Request() ```