wenningning 2 роки тому
батько
коміт
e405e0322e

+ 2 - 1
.gitignore

@@ -1,6 +1,7 @@
 .DS_Store
 node_modules/
-unpackage/
+sleep/unpackage/
+/sleep/unpackage/
 dist/
 build/
 /node_modules

+ 0 - 17
sleep/api/index.js

@@ -1,17 +0,0 @@
-const home=require('./modules/home')
-const user=require('./modules/user')
-const search=require('./modules/search')
-const song=require('./modules/song')
-const rankList=require('./modules/rankList')
-const singer=require('./modules/singer')
-
-export default{
-	...home,
-	...user,
-	...search,
-	...song,
-	...rankList,
-	...singer
-}
-
-

+ 0 - 82
sleep/api/modules/home.js

@@ -1,82 +0,0 @@
-import request from '@/utils/request'
-import {getCache} from "@/utils/cache.js"
-
-/**
- *  首页的轮播图 banner
- *  @param  {Number} 
- *  @return {Array}
- */
-export const getBanner = (params) => {
-	var num = 0
-	switch (uni.getSystemInfoSync().platform) {
-		case 'android':
-			num = 1
-			break;
-		case 'ios':
-			num = 2
-			break;
-		default:
-			break;
-	}
-	return request.get(`/banner?type=${num}`, params)
-}
-
-/**
- *  首页 发现好歌单  list
- *  @param  {Number} 
- *  @return {Array}
- */
-export const getRecommendList = (params) => {
-	return request.post('/personalized', {...params,cookie: getCache('COOKIE')})
-}
-
-/**
- *  首页 新歌 list
- *  @return {Array}
- */
-export const getNewSongList = () => {
-	return request.get('/personalized/newsong')
-}
-
-
-/**
- *  首页 每日推荐歌曲 ---需要登录
- *  @return {Array}
- */
-export const getDayRecommendList = () => {
-	return request.get('/recommend/songs')
-}
-
-/**
- *  首页 每日推荐歌单 ---需要登录
- *  @return {Array}
- */
-export const getDayRecommendMusicList = () => {
-	return request.get('/recommend/resource')
-}
-
-/**
- *  首页 热门歌手 ---需要登录
- *  @return {Array}
- */
-export const getHotSingerList = () => {
-	return request.post('/top/artists', {
-		offset: 0,
-		limit: 18
-	})
-}
-
-/**
- *  网友精选歌单
- *  @return {Array}
- */
-export const getSelectionData = () => {
-	return request.get('/top/playlist', {
-		limit: 10,
-		order: 'hot'
-	})
-}
-
-
-
-

+ 0 - 9
sleep/api/modules/rankList.js

@@ -1,9 +0,0 @@
-import request from '@/utils/request'
-
-/**
- *  首页 歌手单曲
- *  @return {Array}
- */
-export const getRankList = () => {
-	return request.get('/toplist/detail')
-}

+ 0 - 67
sleep/api/modules/search.js

@@ -1,67 +0,0 @@
-import request from '@/utils/request'
-
-/**
- *  默认搜索关键词
- *  @return {Object}
- */
-export const getDefaultSearch = (params) => {
-  return request.get('/search/default', params)
-}
-
-/**
- *  热门搜索 详细
- *  @return {Array}
- */
-export const getHotDetailSearch = (params) => {
-  return request.get('/search/hot/detail', params)
-}
-
-/**
- *  搜索建议
- *  @param {String} keywords
- *  @param {String} type
- *  @return {Array}
- */
-export const getSuggestList = (params) => {
-  let data = {
-    ...params,
-    type: 'mobile',
-  }
-  return request.get('/search/suggest', data)
-}
-
-/**
- *  搜索
- *  @param {String} keywords
- *  @return {Array}
- */
-export const getSearchList = (params) => {
-  return request.get('/cloudsearch', params)
-}
-
-/**
- *  根据id去获取音乐url
- *  @param  {Number} id
- *  @return {Array}
- */
-export const getMusicUrl = (params) => {
-  return request.get('/song/url', params)
-}
-
-/**
- *  判断是否有版权
- *  @param  {Number} id
- *  @return {Array}
- */
-export const checkMusicUrl = (params) => {
-  return request.get('/check/music', params)
-}
-
-/**
- *  根据id去获取歌词
- *  @param  {Number} id
- *  @return {Array}
- */
-export const getLyric = (params) => {
-  return request.get('/lyric', params)
-}

+ 0 - 29
sleep/api/modules/singer.js

@@ -1,29 +0,0 @@
-import request from '@/utils/request'
-
-/**
- *  获取所有 热门歌手
- *  @return {Array}
- */
-export const getSingerList = () => {
-	return request.get('/toplist/artist')
-}
-
-
-/**
- *  获取 歌手基本信息
- *  @param {String}  id
- *  @return {Array}
- */
-export const getSingerInfo = (params) => {
-	return request.get('/artist/detail', params)
-}
-
-
-/**
- *  歌手 全部歌曲
- *  @param {String}  id
- *  @return {Array}
- */
-export const getSingerAllMusic = (params) => {
-	return request.get('/artist/songs', params)
-}

+ 0 - 35
sleep/api/modules/song.js

@@ -1,35 +0,0 @@
-import request from '@/utils/request'
-
-/**
- *  歌单 获取歌单分类标签
- *  @return {Array}
- */
-export const getSongTagList = (params) => {
-	return request.get('/playlist/catlist', params)
-}
-
-/**
- *  歌单  所有歌单
- *  @return {Array}
- */
-export const getSongList = (params) => {
-	return request.get('/top/playlist', params)
-}
-
-/**
- *  首页 歌单详情
- *  @param  {string} id
- *  @return {Array}
- */
-export const getPlayListData = (params) => {
-	return request.get('/playlist/detail', params)
-}
-
-/**
- *  首页 通过id获取歌曲详情  
- *  @param  {string} ids
- *  @return {Array}
- */
-export const getPlayDetail = (params) => {
-	return request.get('/song/detail', params)
-}

+ 0 - 48
sleep/api/modules/user.js

@@ -1,48 +0,0 @@
-import request from '@/utils/request'
-
-/**
- *  游客登录
- *  @param  {Number} phone 
- *  @param  {Number} password 
- *  @return {Array}
- */
-export const login = params => {
-	return request.get('/register/anonimous', params)
-}
-
-/**
- *  获取登录状态
- */
-export const getLoginStatus = params => {
-	return request.get('/login/status', params)
-}
-
-
-
-/**
- *  喜欢音乐 或取消喜欢
- */
-export const likeMusic = params => {
-	return request.get('/like', params)
-}
-
-/**
- *  喜欢音乐列表
- */
-export const likeData = params => {
-	return request.get('/likelist', params)
-}
-
-/**
- *  获取用户喜欢的歌单
- */
-export const getUserInfo = params => {
-	return request.get('/user/playlist', params)
-}
-
-/**
- *  获取用户最近播放记录
- */
-export const getUserHistory = params => {
-	return request.get('/user/record', params)
-}

+ 32 - 0
sleep/api/sleep_report.js

@@ -0,0 +1,32 @@
+
+/**
+ * 睡眠报告API
+ */
+import request, { Method } from '@/utils/request'
+
+// 获取最近一天的睡眠报告
+export function getNewListByUnionId(params){
+    return request({
+        url: `xiaomian/get_new_list_by_union_id`,
+        config: {method: Method.POST, needToken: true, loading: true},
+        params
+    })
+}
+
+// 获取日历上有值的天数
+export function getSleepReportDaysTag(params){
+    return request({
+        url: `xiaomian/get_sleep_report_days_tag`,
+        config: {method: Method.POST, needToken: true, loading: true},
+        params
+    })
+}
+
+// 设置睡眠预警参数
+export function pushSleepWarn(params){
+    return request({
+        url: `xiaomian/push/warn`,
+        config: {method: Method.POST, needToken: true, loading: true},
+        params
+    })
+}

+ 7 - 10
sleep/main.js

@@ -7,9 +7,6 @@ Vue.config.productionTip = false
 App.mpType = 'app'
 
 
-import api from "@/api/index"
-Vue.prototype.$api = api;
-
 import musicControl from "@/components/musicControl/index.vue"
 Vue.component('music-control', musicControl)
 
@@ -24,13 +21,13 @@ Vue.component('cu-custom', cuCustom)
 
 import {audio} from '@/plugins/audio/index.js'
 Vue.prototype.$audio =audio
-
-import {UniSteps} from './uni_modules/uni-steps/components/uni-steps/uni-steps.vue'
-Vue.component('uni-steps', UniSteps)
-
-import {UniSection} from './uni_modules/uni-section/components/uni-section/uni-section.vue'
-Vue.component('uni-section', UniSection)
-
+
+import {UniSteps} from './uni_modules/uni-steps/components/uni-steps/uni-steps.vue'
+Vue.component('uni-steps', UniSteps)
+
+import {UniSection} from './uni_modules/uni-section/components/uni-section/uni-section.vue'
+Vue.component('uni-section', UniSection)
+
 
 const app = new Vue({
 	...App,

+ 70 - 70
sleep/pages.json

@@ -1,35 +1,35 @@
 {
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
-			"path": "pages/index/index",
+			"path": "pages/home/index",
+			"style": {
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+			"path": "pages/monthReport/monthReport",
+			"style": {
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+			"path": "pages/weekReport/weekReport",
+			"style": {
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+			"path": "pages/alertSetting/alertSetting",
+			"style": {
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+			"path": "pages/report/report",
 			"style": {
 				"enablePullDownRefresh": true
 			}
-		}, 
-		{
-			"path": "pages/monthReport/monthReport",
-			"style": {
-				"enablePullDownRefresh": true
-			}
-		}, 
-		{
-			"path": "pages/weekReport/weekReport",
-			"style": {
-				"enablePullDownRefresh": true
-			}
-		}, 
-		{
-			"path": "pages/alertSetting/alertSetting",
-			"style": {
-				"enablePullDownRefresh": true
-			}
-		}, 
-		{
-			"path": "pages/report/report",
-			"style": {
-				"enablePullDownRefresh": true
-			}
-		}, 
+		},
 		{
 			"path": "pages/login/index",
 			"style": {
@@ -83,16 +83,16 @@
 				"enablePullDownRefresh": false
 			}
 		},{
-			"path": "pages/home/index",
+			"path": "pages/index/index",
+			"style": {
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/shareUser/shareUser",
 			"style": {
 				"enablePullDownRefresh": false
 			}
-		},
-		{
-			"path": "pages/shareUser/shareUser",
-			"style": {
-				"enablePullDownRefresh": false
-			}
 		},
 		{
 			"path": "pages/singerPlayList/index",
@@ -102,19 +102,19 @@
 		}
         ,{
             "path" : "pages/auth/auth",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
+            "style" :
+            {
+                "navigationBarTitleText": "",
+                "enablePullDownRefresh": false
+            }
+
         }
         ,{
             "path" : "pages/detail/detail",
-            "style" : {
-                "navigationBarTitleText": "nvue-swiper"
-            }
-            
+            "style" : {
+                "navigationBarTitleText": "nvue-swiper"
+            }
+
         }
     ],
 	"globalStyle": {
@@ -123,32 +123,32 @@
 		"navigationBarTitleText": "",
 		"navigationBarBackgroundColor": "#ffffff",
 		"backgroundColor": "#ffffff"
-	},
-	"tabBar": {
-		"color": "#ffffff",
-		"selectedColor": "#ffffff",
-		"borderStyle": "black",
-		"backgroundColor": "#167DF2",
-		"list": [{
-			"pagePath": "pages/home/index",
-			"iconPath": "static/tabBar/home.png",
-			"selectedIconPath": "static/tabBar/homeSel.png",
-			"text": "首页"
-		}, {
-			"pagePath": "pages/report/report",
-			"iconPath": "static/tabBar/report.png",
-			"selectedIconPath": "static/tabBar/reportSel.png",
-			"text": "报告"
-		}, {
-			"pagePath": "pages/index/index",
-			"iconPath": "static/tabBar/discover.png",
-			"selectedIconPath": "static/tabBar/discoverSel.png",
-			"text": "发现"
-		}, {
-			"pagePath": "pages/my/index",
-			"iconPath": "static/tabBar/my.png",
-			"selectedIconPath": "static/tabBar/mySel.png",
-			"text": "我的"
-		}]
+	},
+	"tabBar": {
+		"color": "#ffffff",
+		"selectedColor": "#ffffff",
+		"borderStyle": "black",
+		"backgroundColor": "#167DF2",
+		"list": [{
+			"pagePath": "pages/home/index",
+			"iconPath": "static/tabBar/home.png",
+			"selectedIconPath": "static/tabBar/homeSel.png",
+			"text": "首页"
+		}, {
+			"pagePath": "pages/report/report",
+			"iconPath": "static/tabBar/report.png",
+			"selectedIconPath": "static/tabBar/reportSel.png",
+			"text": "报告"
+		}, {
+			"pagePath": "pages/index/index",
+			"iconPath": "static/tabBar/discover.png",
+			"selectedIconPath": "static/tabBar/discoverSel.png",
+			"text": "发现"
+		}, {
+			"pagePath": "pages/my/index",
+			"iconPath": "static/tabBar/my.png",
+			"selectedIconPath": "static/tabBar/mySel.png",
+			"text": "我的"
+		}]
 	}
 }

+ 76 - 76
sleep/pages/home/index.vue

@@ -2,16 +2,16 @@
 	<view class="flex-col justify-start home-container">
 		<view class="container-bg"></view>
 		<cu-custom bgColor="#fff"><view slot="content" style="color: #FFFFFF">UU睡眠</view></cu-custom>
-		
+
 		<view class="flex-col home-module space-y-20">
-			
+
 			<!-- no device added -->
 			<view v-if="!deviceAdded">
 				<view class="flex-col items-start home-header space-y-10">
 					<text class="home-header-title">欢迎回来!</text>
 					<text class="font_3 text_3 home-header-subtitle">我是小云,您的健康智慧管家。</text>
 				</view>
-				
+
 				<view class="flex-row items-center home_add_devive space-x-10">
 				  <image
 				    class="image_4"
@@ -19,7 +19,7 @@
 				  />
 				  <text class="text_5">添加设备</text>
 				</view>
-				
+
 				<view class="home-ad flex-col group_5 space-y-40">
 					<view class="flex-col home-header space-y-6">
 						<view class="flex-row items-center space-x-8">
@@ -32,15 +32,15 @@
 								/>
 							</view>
 						</view>
-						
+
 						<view class="flex-row items-center space-x-10">
 							<text class="font_5 text_3 text_10">AI时代,全家人的睡眠健康顾问</text>
 						</view>
-					</view>			
+					</view>
 				</view>
-				
+
 				<view class="flex-col">
-				  <view class="flex-col group_5">		  
+				  <view class="flex-col group_5">
 					<view class="flex-col home_blank_heart">
 				      <view class="flex-row items-center group_7 space-x-4">
 				        <image
@@ -58,7 +58,7 @@
 				        <view class="shrink-0 self-end section_5"></view>
 				      </view>
 				    </view>
-					
+
 				    <view class="flex-col home_blank_breath">
 				      <view class="flex-row items-center group_10 space-x-4">
 				        <image
@@ -76,9 +76,9 @@
 				        <view class="shrink-0 self-end section_5"></view>
 				      </view>
 				    </view>
-					
+
 				  </view>
-				  
+
 				  <view class="flex-row items-center home_blank_alert space-x-16">
 				    <image
 				      class="image_8"
@@ -91,16 +91,16 @@
 				  </view>
 				</view>
 			</view>
-			
-			
+
+
 			<!-- device added -->
 			<view v-if="deviceAdded" class="flex-col">
-				
+
 				<view class="flex-col items-start home-header space-y-10">
 					<text class="home-header-title">欢迎回来!</text>
 					<text class="font_3 text_3 home-header-subtitle">我是小云,您的健康智慧管家。</text>
 				</view>
-				
+
 				<!-- home device -->
 				<view class="flex-col home-device space-y-15">
 					<view class="flex-row home-device-header">
@@ -120,31 +120,31 @@
 								</view>
 							</view>
 						</view>
-						
+
 						<view class="flex-row items-center section_5 space-x-4">
 							<image class="shrink-0 image_8"	src="../../static/home/homeIconChange.png"/>
 							<text class="font_3">切换</text>
 						</view>
 					</view>
-					
+
 					<view class="flex-row justify-center self-center home-device-status space-x-8">
 						<text class="font_4 text_7">当前状态</text>
 						<text class="font_4">在床</text>
 					</view>
-					
+
 					<view>
 						<uni-steps :options="list1" :active="active" />
 					</view>
-					
+
 					<view class="flex-row self-center items-center home-device-setting">
-						<image 
+						<image
 							class="shrink-0 image_8"
 							src="../../static/home/homeIconSet.png"
 						/>
 						<text>设置目标</text>
 					</view>
 				</view>
-				
+
 				<view class="home-report flex-col group_5 space-y-40">
 					<view class="flex-col home-header space-y-6">
 						<view class="flex-row items-center space-x-8">
@@ -157,15 +157,15 @@
 								/>
 							</view>
 						</view>
-						
+
 						<view class="flex-row items-center space-x-10">
 							<text class="font_5 text_3 text_10">小云已为您生成最后一份睡眠报告</text>
 							<text class="font_5 text_3 text_11">2021-08-24</text>
 						</view>
 					</view>
-					
+
 				</view>
-				
+
 				<view class="flex-col space-y-40 home-data">
 					<view class="flex-row group_6 equal-division">
 						<view class="flex-row group_7 space-x-6 home-data-item equal-division-item">
@@ -181,7 +181,7 @@
 							</view>
 							<text class="self-start font_7 text_14">次/分</text>
 						</view>
-	          
+
 						<view class="flex-row justify-center group_8 space-x-6 home-data-item equal-division-item">
 							<view class="flex-col space-y-20">
 								<view class="flex-row space-x-4">
@@ -197,7 +197,7 @@
 						</view>
 					</view>
 				</view>
-			
+
 				<view class="flex-col home-alert space-y-4">
 					<view @click="jumpToAlertSetting" class="flex-row items-center space-x-4 home-alert-header">
 						<image
@@ -206,7 +206,7 @@
 						/>
 						<text class="font_1">实时预警</text>
 					</view>
-					
+
 					<view @click="handleAlertSetting" class="flex-col home-alert-list">
 						<view class="flex-row justify-between items-center list-item" :key="i" v-for="(item, i) in list_alerts">
 							<view class="flex-row items-center space-x-6">
@@ -217,7 +217,7 @@
 								<text class="font_8">心率警报</text>
 								<text class="font_9 text_16">2:25</text>
 							</view>
-							
+
 							<view class="flex-row items-baseline space-x-4">
 								<text class="font_10">102</text>
 								<text class="font_8">次/分</text>
@@ -227,16 +227,16 @@
 				</view>
 			</view>
 	  </view>
-	  
+
 	  <!-- <tab-bar currentPage="home" /> -->
-	  
-	</view>
-</template>
-
-<script>
-export default {
-	data() {
-		return {
+
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
 			deviceAdded: true,
 			list_alerts: [null, null],
 			active: 4,
@@ -248,25 +248,25 @@ export default {
 				title: '起床目标 7:00AM'
 			}, {
 				title: '今日起床 7:14AM'
-			}]
-		};
-	},
-	created() {
-		
-	},
-	computed: {
-		
-	},
-	methods: {
+			}]
+		};
+	},
+	created() {
+
+	},
+  onLoad() {
+
+  },
+	methods: {
 		handleAlertSetting() {
 			uni.navigateTo({
 				url: "/pages/alertSetting/alertSetting"
 			});
-		}
-	}
-};
-</script>
-
+		}
+	}
+};
+</script>
+
 <style lang="scss" scoped>
 	.equal-division {
 		.equal-division-item {
@@ -274,7 +274,7 @@ export default {
 			flex: 1 1 10.81rem;
 		}
 	}
-	
+
 	.home_add_devive {
 	  margin-right: 1.25rem;
 	  margin: 1rem;
@@ -283,7 +283,7 @@ export default {
 	  border-radius: 1rem;
 	  backdrop-filter: blur(0.63rem);
 	  width: 20.94rem;
-	  
+
 	  .image_4 {
 	    margin-left: 6.38rem;
 	    width: 1.5rem;
@@ -303,13 +303,13 @@ export default {
 	    margin-left: 0.63rem;
 	  }
 	}
-	
+
 	.home_ad {
 	  margin-left: 2.25rem;
 	  background: url(../../static/home/homeBg2.png);
 	  background-repeat: no-repeat;
 	  background-size: contain;
-	  
+
 	  .text_6 {
 	    padding: 0.13rem 0;
 	    color: #ffffff;
@@ -346,11 +346,11 @@ export default {
 	    margin-left: 0.38rem;
 	  }
 	}
-	
+
 	.group_5 {
 	  padding-left: 1rem;
 	  padding-right: 1rem;
-	  
+
 	  .font_2 {
 	    font-size: 0.69rem;
 	    font-family: PingFangSC;
@@ -369,7 +369,7 @@ export default {
 		background: linear-gradient(180deg, rgba(52, 26, 75, 1) 0%, rgba(22, 125, 242, 1) 100%);
 		backdrop-filter: blur(20px);
 		padding:1rem 0rem 2rem 1rem;
-		
+
 	    .group_7 {
 	      padding-bottom: 1.13rem;
 	      .image_6 {
@@ -395,7 +395,7 @@ export default {
 	    background: linear-gradient(180deg, rgba(52, 26, 75, 1) 0%, rgba(22, 125, 242, 1) 100%);
 	    backdrop-filter: blur(20px);
 	    padding:1rem 0rem 2rem 1rem;
-		
+
 	    .group_10 {
 	      padding-bottom: 1.25rem;
 	      .image_7 {
@@ -483,8 +483,8 @@ export default {
 	    margin-left: 1rem;
 	  }
 	}
-	
-	
+
+
 .container-bg {
 	position: fixed;
 	left: -130px;
@@ -506,12 +506,12 @@ export default {
   overflow-y: auto;
   overflow-x: hidden;
   height: 100%;
-  
+
   .home-module {
     padding: 1.75rem 0 3.38rem;
     overflow-y: auto;
 	z-index: 100;
-	
+
     .home-header {
       padding: 0 1.25rem;
       .home-header-title {
@@ -558,19 +558,19 @@ export default {
       background-color: #0233c699;
       border-radius: 1rem;
       backdrop-filter: blur(0.63rem);
-	  
+
 	  .home-device-setting {
 		  width: 70px;
 		  height: 20px;
 		  opacity: 1;
 		  border-radius: 7px;
 		  background: linear-gradient(90deg, rgba(255, 35, 247, 1) 0%, rgba(91, 30, 154, 1) 100%);
-		  
+
 		  .image_8 {
 			  width: 10px;
 			  height: 10px;
 		  }
-		  
+
 		  font-size: 10px;
 		  font-weight: 400;
 		  line-height: 10px;
@@ -630,14 +630,14 @@ export default {
       line-height: 0.69rem;
       color: #ffffff;
     }
-	
+
     .home-report {
       margin: 0 1.25rem;
       padding: 1rem 0;
       background-image: url(../../static/home/homeReportBg.png);
       background-size: contain;
       background-repeat: no-repeat;
-	  
+
       .space-y-6 {
         & > view:not(:first-child),
         & > text:not(:first-child),
@@ -652,7 +652,7 @@ export default {
 		background-image: url(../../static/home/homeBg2.png);
 		background-size: contain;
 		background-repeat: no-repeat;
-		
+
 		.space-y-6 {
 		  & > view:not(:first-child),
 		  & > text:not(:first-child),
@@ -661,11 +661,11 @@ export default {
 		  }
 		}
 	}
-	
+
 	.home-data {
 		margin: 0rem 1.25rem;
 		padding: 1rem 0rem;
-		
+
 		.home-data-item {
 			padding: 1rem 0rem;
 			margin: 0 0.3rem;
@@ -678,11 +678,11 @@ export default {
 	.group_6 {
 	  overflow-x: hidden;
 	  width: 100%;
-	  
+
 	  .group_7 {
 	    overflow-x: hidden;
 	    width: 10rem;
-		
+
 	    .group_9 {
 	      margin-left: 2.25rem;
 	    }
@@ -692,7 +692,7 @@ export default {
 	  }
 	  .group_8 {
 	    width: 10rem;
-		
+
 	    .text_15 {
 	      margin-top: 3.63rem;
 	    }
@@ -851,4 +851,4 @@ export default {
     }
   }
 }
-</style>
+</style>

+ 158 - 210
sleep/pages/index/index.vue

@@ -1,34 +1,34 @@
-<template>
-	<view class="recommend-container page-background">
-		<view class="bg-black">
-			<cu-custom bgColor="#000000"><view slot="content" style="color: #ffffff">UU睡眠</view></cu-custom>
-		</view>
-		<scroll-view :style="{ height: height }" class="main-container" scroll-y>
-			
-			<view class="bg-black">
-				<view class="banner-wrapper">
-					<swiper class="screen-swiper square-dot" style="min-height: 317upx;" :indicator-dots="true" :circular="true" :autoplay="true" interval="5000" duration="500">
-						<swiper-item v-for="item in swiperList" :key="item.bannerId">
-							<image :src="item.pic || item.imageUrl" mode="scaleToFill" class="banner-img"></image>
-						</swiper-item>
-					</swiper>
-				</view>
+<template>
+	<view class="recommend-container page-background">
+		<view class="bg-black">
+			<cu-custom bgColor="#000000"><view slot="content" style="color: #ffffff">UU睡眠</view></cu-custom>
+		</view>
+		<scroll-view :style="{ height: height }" class="main-container" scroll-y>
+
+			<view class="bg-black">
+				<view class="banner-wrapper">
+					<swiper class="screen-swiper square-dot" style="min-height: 317upx;" :indicator-dots="true" :circular="true" :autoplay="true" interval="5000" duration="500">
+						<swiper-item v-for="item in swiperList" :key="item.bannerId">
+							<image :src="item.pic || item.imageUrl" mode="scaleToFill" class="banner-img"></image>
+						</swiper-item>
+					</swiper>
+				</view>
 			</view>
-			
+
 			<view class="music-wrapper" v-if="recommendList.length > 0">
 				<box-title title="UU推荐" buttonName="更多" iconName="right" @handlePlay="handleNative('../songList/index')"></box-title>
 				<song-list :currentList="recommendList"></song-list>
 			</view>
-			
-			
-			<view class="music-wrapper" v-if="dayRecommendList.length > 0">
-				<box-title title="睡眠音乐" buttonName="更多" iconName="kaishi2" @handlePlay="handlePlay('dayRecommendList')"></box-title>
-				<music-list :currentList="dayRecommendList"></music-list>
+
+
+			<view class="music-wrapper" v-if="dayRecommendList.length > 0">
+				<box-title title="睡眠音乐" buttonName="更多" iconName="kaishi2" @handlePlay="handlePlay('dayRecommendList')"></box-title>
+				<music-list :currentList="dayRecommendList"></music-list>
 			</view>
-			
+
 			<view class="music-wrapper" v-if="dayRecommendList.length > 0">
 				<box-title title="睡眠小知识" buttonName="更多" iconName="kaishi2" @handlePlay="handlePlay('dayRecommendList')"></box-title>
-				
+
 				<view class="flex-col justify-start knowledge-list">
 				  <view class="flex-row items-center space-x-14 knowledge-item">
 				    <view class="flex-col flex-auto space-y-8">
@@ -42,7 +42,7 @@
 				      src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/649415135a7e3f0310661c1e/649415b654fe0000116ae544/16874496879438729687.png"
 				    />
 				  </view>
-				  
+
 				  <view class="flex-row items-center space-x-14 knowledge-item">
 				    <view class="flex-col flex-auto space-y-8">
 				      <text class="self-start font_4 knowledge-item-title">睡眠科普:你真的了解睡眠吗?</text>
@@ -55,7 +55,7 @@
 				      src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/649415135a7e3f0310661c1e/649415b654fe0000116ae544/16874496879438729687.png"
 				    />
 				  </view>
-				  
+
 				  <view class="flex-row items-center space-x-14 knowledge-item">
 				    <view class="flex-col flex-auto space-y-8">
 				      <text class="self-start font_4 knowledge-item-title">睡眠科普:你真的了解睡眠吗?</text>
@@ -69,24 +69,24 @@
 				    />
 				  </view>
 				</view>
-			</view>
-			
+			</view>
+
 		</scroll-view>
-		
+
 		<music-control />
-		
-		<!-- <tab-bar currentPage="index" /> -->
-	</view>
-</template>
-
-<script>
-import songList from './components/songList.vue';
-import musicList from './components/musicList.vue';
-import { getImage, getName } from '@/utils/index.js';
-export default {
-	data() {
-		return {
-			//轮播图
+
+		<!-- <tab-bar currentPage="index" /> -->
+	</view>
+</template>
+
+<script>
+import songList from './components/songList.vue';
+import musicList from './components/musicList.vue';
+import { getImage, getName } from '@/utils/index.js';
+export default {
+	data() {
+		return {
+			//轮播图
 			swiperList: [
 				{
 					"pic": "http://p1.music.126.net/ZuDmYz9gKTes67weCA6roQ==/109951168702825545.jpg",
@@ -100,7 +100,7 @@ export default {
 					"pic": "http://p1.music.126.net/xK69a1N5DCqNQXts64y3xA==/109951168703821815.jpg",
 					"bannerId": "1687869708598159"
 				}
-			],
+			],
 			recommendList: [
 				{
 				    "id": 331841455,
@@ -126,7 +126,7 @@ export default {
 				    "playCount": 29329484,
 				    "trackCount": 361,
 				    "highQuality": false,
-				    "alg": "alg_high_quality"        
+				    "alg": "alg_high_quality"
 				},
 				{
 				    "id": 2042205655,
@@ -139,7 +139,7 @@ export default {
 				    "playCount": 25818546,
 				    "trackCount": 41,
 				    "highQuality": false,
-				    "alg": "alg_high_quality"        
+				    "alg": "alg_high_quality"
 				},
 				{
 				    "id": 2139324915,
@@ -152,9 +152,9 @@ export default {
 				    "playCount": 69736672,
 				    "trackCount": 514,
 				    "highQuality": false,
-				    "alg": "alg_high_quality"    
-				}        
-			],
+				    "alg": "alg_high_quality"
+				}
+			],
 			dayRecommendList: [
 				{
 					"id": 159400773,
@@ -191,174 +191,122 @@ export default {
 					"name": "时光背面的我",
 					"picUrl": "http://p2.music.126.net/VOcPF6uCGAlwESFyyGqHrg==/109951166141514551.jpg"
 				}
-			],
-			dayRecommendMusicList: [],
-			newSongList: [],
-			hotSingerList: [],
-			selectData: [],
-		};
-	},
-	components: {
-		songList,
-		musicList
-	},
-	computed: {
-		cookie() {
-			return this.$store.state.cookie;
-		},
-		height() {
-			let height = this.CustomBar / (uni.upx2px(this.CustomBar) / this.CustomBar) + 220;
-			return `calc(100%  - ${height}rpx)`;
-		}
-	},
-	onShow() {
-		// this.getDayRecommendData();
-		// this.getDayRecommendMusicData();
-	},
-	created() {
-		// this.getData();
-	},
-	onPullDownRefresh() {
-		// this.getData();
-		setTimeout(() => {
-			uni.stopPullDownRefresh();
-		}, 1000);
-	},
-	methods: {
-		getData() {
-			this.getBannerData();
-			this.getRecommendData();
-			this.getNewSongData();
-			this.getSelectionData();
-			this.getHotSingerData();
-		},
-
-		//播放全部 猜你喜欢
-		handlePlay(key) {
-			const list = this[key].map(item => {
-				return {
-					src: '',
-					title: item.name,
-					singer: getName(item),
-					coverImgUrl: getImage(item),
-					id: item.id
-				};
-			});
-			this.$store.dispatch('playAllMUsic', list);
-		},
-
-		handleNative(val) {
-			uni.navigateTo({
-				url: val
-			});
-		},
-
-		// 获取轮播图数据
-		async getBannerData() {
-			const data = await this.$api.getBanner();
-			
-			this.swiperList = data.banners || [];
-		},
-
-		//获取推荐歌单数据
-		async getRecommendData() {
-			const data = await this.$api.getRecommendList();
-			
-			this.recommendList = data.result.slice(0, 8);
-		},
-
-		//获取猜你喜欢歌曲
-		async getDayRecommendData() {
-			const { data } = await this.$api.getDayRecommendList();
-			console.log('data recommend');
-			console.log(data);
-			this.dayRecommendList = data.dailySongs;
-		},
-
-		//获取推荐歌单
-		async getDayRecommendMusicData() {
-			const data = await this.$api.getDayRecommendMusicList();
-			this.dayRecommendMusicList = data.recommend || [];
-		},
-
-		//获取新歌数据
-		async getNewSongData() {
-			const data = await this.$api.getNewSongList();
-			this.newSongList = data.result.slice(0, 9);
-		},
-
-		//获取网友精选歌单
-		async getSelectionData() {
-			const data = await this.$api.getSelectionData();
-			this.selectData = data.playlists || [];
-		},
-
-		//获取热门歌手数据
-		async getHotSingerData() {
-			const data = await this.$api.getHotSingerList();
-			this.hotSingerList = (data.artists || []).slice(0, 10);
-		},
-
-		toSearch() {
-			uni.navigateTo({
-				url: '../search/index'
-			});
-		}
-	}
-};
-</script>
-
+			],
+			dayRecommendMusicList: [],
+			newSongList: [],
+			hotSingerList: [],
+			selectData: [],
+		};
+	},
+	components: {
+		songList,
+		musicList
+	},
+	computed: {
+		cookie() {
+			return this.$store.state.cookie;
+		},
+		height() {
+			let height = this.CustomBar / (uni.upx2px(this.CustomBar) / this.CustomBar) + 220;
+			return `calc(100%  - ${height}rpx)`;
+		}
+	},
+	onShow() {
+		// this.getDayRecommendData();
+		// this.getDayRecommendMusicData();
+	},
+	created() {
+		// this.getData();
+	},
+	onPullDownRefresh() {
+		// this.getData();
+		setTimeout(() => {
+			uni.stopPullDownRefresh();
+		}, 1000);
+	},
+	methods: {
+
+		//播放全部 猜你喜欢
+		handlePlay(key) {
+			const list = this[key].map(item => {
+				return {
+					src: '',
+					title: item.name,
+					singer: getName(item),
+					coverImgUrl: getImage(item),
+					id: item.id
+				};
+			});
+			this.$store.dispatch('playAllMUsic', list);
+		},
+
+		handleNative(val) {
+			uni.navigateTo({
+				url: val
+			});
+		},
+
+
+		toSearch() {
+			uni.navigateTo({
+				url: '../search/index'
+			});
+		}
+	}
+};
+</script>
+
 <style lang="scss" scoped>
 .bg-black {
 	background-color: #000000;
-}
-.recommend-container {
+}
+.recommend-container {
 	position: relative;
-	background-color: #000000;
+	background-color: #000000;
 	height: 100%;
-	padding-bottom: 100px;
-
-	.main-container {
-		position: relative;
-		.banner-wrapper {
-			box-sizing: border-box;
-			padding: 10px;
-			.banner-img {
-				height: 158px;
-				border-radius: 6px;
-			}
-		}
-		.list-wrapper {
-			margin-top: 8px;
-			padding-bottom: 12px;
-			.list-item {
-				text-align: center;
-				font-size: 24rpx;
-			}
-			.list-ico {
-				font-size: 72rpx;
-				margin-bottom: 6px;
-			}
-			.list-title {
-				font-size: 28rpx;
-			}
-		}
-
-		.music-wrapper {
-			margin-top: 5px;
-			background: #000000;
-			box-sizing: border-box;
+	padding-bottom: 100px;
+
+	.main-container {
+		position: relative;
+		.banner-wrapper {
+			box-sizing: border-box;
+			padding: 10px;
+			.banner-img {
+				height: 158px;
+				border-radius: 6px;
+			}
+		}
+		.list-wrapper {
+			margin-top: 8px;
+			padding-bottom: 12px;
+			.list-item {
+				text-align: center;
+				font-size: 24rpx;
+			}
+			.list-ico {
+				font-size: 72rpx;
+				margin-bottom: 6px;
+			}
+			.list-title {
+				font-size: 28rpx;
+			}
+		}
+
+		.music-wrapper {
+			margin-top: 5px;
+			background: #000000;
+			box-sizing: border-box;
 			padding: 15px;
-			
-			&:last-of-type {
-				margin-bottom: 0;
-			}
-		}
+
+			&:last-of-type {
+				margin-bottom: 0;
+			}
+		}
 	}
-	
+
 	.knowledge-list {
 		margin-top: 1rem;
-		
+
 	  .space-x-14 {
 	    & > view:not(:first-child),
 	    & > text:not(:first-child),
@@ -393,11 +341,11 @@ export default {
 	      height: 3.75rem;
 	    }
 	  }
-	  
+
 	  .knowledge-item {
 		  margin-left: 3px;
 		  margin-bottom: 20px;
 	  }
-	}
-}
-</style>
+	}
+}
+</style>

+ 73 - 208
sleep/store/index.js

@@ -1,208 +1,73 @@
-import Vue from "vue";
-import Vuex from "vuex";
-import {
-	getCache,
-	setCache
-} from "@/utils/cache.js";
-import {
-	login
-} from "@/api/modules/user.js";
-import {
-	getMusicUrl
-} from "@/api/modules/search.js";
-import {
-	audio
-} from "@/plugins/audio/index.js";
-Vue.use(Vuex);
-
-const store = new Vuex.Store({
-	state: {
-		userInfo: getCache("USER_INFO"),
-		cookie: getCache("COOKIE"),
-		historyList: getCache("HISTORY") || [],
-		paused: true,
-		playInfo: getCache("PLAY_INFO") || {},
-	},
-	mutations: {
-		SET_USERINFO(state, val) {
-			state.userInfo = val;
-			setCache("USER_INFO", val);
-		},
-		SET_COOKIE(state, cookie) {
-			state.cookie = cookie;
-		},
-		SET_HISROTY(state, val) {
-			if (state.historyList.indexOf(val) == -1) {
-				state.historyList.unshift(val);
-				setCache("HISTORY", state.historyList);
-			}
-		},
-		CLEAR_HISTORY(state) {
-			state.historyList = [];
-			setCache("HISTORY", []);
-		},
-		SET_PLAY_INFO(state, playInfo) {
-			state.playInfo = playInfo;
-			setCache("PLAY_INFO", playInfo);
-		},
-		SET_PASUED(state, paused) {
-			state.paused = paused;
-		},
-	},
-	actions: {
-		login({
-			commit
-		}, userInfo) {
-			const timestamp = new Date().getTime();
-			return new Promise((resolve, reject) => {
-				login()
-					.then((res) => {
-						if (res.account) {
-							commit("SET_USERINFO", res.account);
-						}else if(res.userId){
-							//游客
-							commit("SET_USERINFO", {id:res.userId});
-						}
-						setCache("COOKIE", res.cookie);
-						commit("SET_COOKIE", res.cookie);
-						resolve();
-					})
-					.catch((err) => {
-						console.log(err);
-						reject(err);
-					});
-			});
-		},
-		addHistoryList({
-			commit
-		}, val) {
-			commit("SET_HISROTY", val);
-		},
-		clearHistoryList({
-			commit
-		}) {
-			commit("CLEAR_HISTORY");
-		},
-		changePlay({
-			state,
-			commit,
-			dispatch
-		}, count) {
-			if (audio.audiolist.length == 1) {
-				audio.operate(0);
-				commit("SET_PASUED", false);
-				return;
-			}
-			audio.changeplay(count);
-			let playIndex = audio.audiolist.findIndex(
-				(item) => item.id == state.playInfo.id
-			);
-			let tempIndex = -1;
-			if (count === 1) {
-				//下一首
-				if (playIndex == audio.audiolist.length - 1) {
-					tempIndex = 0;
-				} else {
-					tempIndex = playIndex + 1;
-				}
-			} else {
-				if (playIndex == 0) {
-					tempIndex = audio.audiolist.length - 1;
-				} else {
-					tempIndex = playIndex - 1;
-				}
-			}
-			dispatch("playMusic", audio.audiolist[tempIndex]);
-		},
-		//从对应歌曲列表中删除 当前歌曲
-		removeMusic({
-			state,
-			commit
-		}, val) {
-			let audioList = [...audio.audiolist];
-			let index = audioList.findIndex((item) => item.id == val.id);
-			audioList.splice(index, 1);
-			audio.setAudio(audioList);
-			setCache("PLAY_LIST", audioList);
-			if (audioList.length == 0) {
-				commit("SET_PASUED", true);
-				commit("SET_PLAY_INFO", {});
-			}
-		},
-
-		//播放全部
-		async playAllMUsic({
-			state,
-			commit
-		}, list) {
-			const data = await getMusic(list[0].id);
-			list[0].src = data.url;
-			audio.setAudio(list);
-			setCache("PLAY_LIST", list);
-			audio.operate(0);
-			commit("SET_PLAY_INFO", list[0]);
-			commit("SET_PASUED", false);
-		},
-
-		//点击播放
-		async playMusic({
-			state,
-			commit
-		}, val) {
-			let audioList = [...audio.audiolist];
-			let index = audioList.findIndex((item) => item.id === val.id);
-			//如果当前播放列表不存在当前音乐
-			if (index === -1) {
-				const data = await getMusic(val.id);
-				val.src = data.url;
-				let playIndex = 0;
-				if (state.playInfo) {
-					playIndex = audioList.findIndex(
-						(item) => item.id == state.playInfo.id
-					);
-				}
-				audioList.splice(playIndex + 1, 0, val);
-				audio.setAudio(audioList);
-				setCache("PLAY_LIST", audioList);
-				audio.operate(playIndex === -1 ? 0 : playIndex + 1);
-				commit("SET_PLAY_INFO", val);
-				commit("SET_PASUED", false);
-			} else {
-				//如果不存在src
-				if (!val.src) {
-					const data = await getMusic(val.id);
-					val.src = data.url;
-					audioList[index] = val;
-					audio.setAudio(audioList);
-					setCache("PLAY_LIST", audioList);
-				} else {
-					val.src = `https://music.163.com/song/media/outer/url?id=${val.id}.mp3`;
-				}
-				audio.operate(index);
-				commit("SET_PLAY_INFO", audioList[index]);
-				commit("SET_PASUED", false);
-			}
-		},
-	},
-});
-
-const getMusic = (id) => {
-	return new Promise(async (resolve, reject) => {
-		let res = await getMusicUrl({
-			id: id,
-		});
-		let musicList = res.data || [];
-		if (musicList.length > 0) {
-			resolve(musicList[0]);
-		} else {
-			uni.showToast({
-				title: "暂无该音乐版权",
-				icon: "none",
-				duration: 2000,
-			});
-			reject();
-		}
-	});
-};
-
-export default store;
+import Vue from 'vue'
+import Vuex from 'vuex'
+
+Vue.use(Vuex)
+
+const store = new Vuex.Store({
+	state: {
+		hasLogin: false,
+		loginProvider: "",
+		openid: null,
+		testvuex:false,
+		colorIndex: 0,
+		colorList: ['#FF0000','#00FF00','#0000FF']
+	},
+	mutations: {
+		login(state, provider) {
+			state.hasLogin = true;
+			state.loginProvider = provider;
+		},
+		logout(state) {
+			state.hasLogin = false
+			state.openid = null
+		},
+		setOpenid(state, openid) {
+			state.openid = openid
+		},
+		setTestTrue(state){
+			state.testvuex = true
+		},
+		setTestFalse(state){
+			state.testvuex = false
+		},
+		setColorIndex(state,index){
+			state.colorIndex = index
+		}
+	},
+	getters:{
+		currentColor(state){
+			return state.colorList[state.colorIndex]
+		}
+	},
+	actions: {
+		// lazy loading openid
+		getUserOpenId: async function ({
+										   commit,
+										   state
+									   }) {
+			return await new Promise((resolve, reject) => {
+				if (state.openid) {
+					resolve(state.openid)
+				} else {
+					uni.login({
+						success: (data) => {
+							commit('login')
+							setTimeout(function () { //模拟异步请求服务器获取 openid
+								const openid = '123456789'
+								console.log('uni.request mock openid[' + openid + ']');
+								commit('setOpenid', openid)
+								resolve(openid)
+							}, 1000)
+						},
+						fail: (err) => {
+							console.log('uni.login 接口调用失败,将无法正常使用开放接口等服务', err)
+							reject(err)
+						}
+					})
+				}
+			})
+		}
+	}
+})
+
+export default store

+ 54 - 136
sleep/utils/request.js

@@ -1,145 +1,63 @@
-import {
-	getCache
-} from "@/utils/cache.js"
+import Vue from 'vue'
 
-const baseURL = 'http://47.98.43.231:3000'
-
-
-
-
-
-
-const request = {
-	get(url, data) {
-		return new Promise((resolve, reject) => {
-			uni.request({
-				url: baseURL + url,
-				data: {
-					...data,
-					cookie: getCache('COOKIE')
-				},
-				header: {
-					'Accept': 'application/json',
-					'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
-				},
-
-				method: "GET",
-				success: (response) => {
-					let res = response.data
-					if (res.code === 200 || url == '/check/music') {
-						resolve(res)
-					} else {
-						reject(res)
-						showError(res);
-					}
-				},
-				fail: (error) => {
-					if (error && error.response) {
-						reject(error.response)
-						showError(error.response);
-					}
-				},
-
-
-			});
-		})
-
-	},
-	post(url, data) {
-
-		return new Promise((resolve, reject) => {
-			uni.request({
-				url: baseURL + url,
-				data: data,
-				header: {
-					'Accept': 'application/json',
-					'Content-Type': 'application/json',
-				},
-				method: "POST",
-				success: (response) => {
-					let res = response.data
-					if (res.code === 200) {
-						resolve(res)
-					} else {
-						reject(res)
-						showError(res);
+const config = {
+	timeout: 15000,
+	baseURL: 'http://127.0.0.1:7000',
+	headers: {
+		'Content-Type':'application/x-www-form-urlencoded'
+	}
+}
 
-					}
-				},
-				fail: (error) => {
-					if (error && error.response) {
-						reject(error.response)
-						showError(error.response);
-					}
-				},
-			});
-		})
-	},
+export const Method = {
+	GET: 'GET',
+	POST: 'POST',
+	PUT: 'PUT',
+	DELETE: 'DELETE'
 }
 
-const showError = error => {
-	let errorMsg = ''
-	if (error.message) {
-		errorMsg = error.message
+function service(options) {
+	let url = config.baseURL + '/' + options.url
+	if (options.url.includes("http")){
+		url = options.url
+	}
+	let headers = config.headers
+	if (options.config.isJson){
+		headers['Content-Type']='application/json'
 	} else {
-		switch (error.code) {
-			case 400:
-				errorMsg = '请求参数错误'
-				break
-			case 301:
-				errorMsg = '未授权,请登录'
-				break;
-			case 302:
-				errorMsg = '未授权,请登录'
-				break
-			case 403:
-				errorMsg = '跨域拒绝访问'
-				break
-			case 404:
-				errorMsg = '请求地址不存在'
-				break
-			case 408:
-				errorMsg = '请求超时'
-				break
-			case 500:
-				errorMsg = '服务器内部错误'
-				break
-			case 501:
-				errorMsg = '服务未实现'
-				break
-			case 502:
-				errorMsg = '网关错误'
-				break
-			case 503:
-				errorMsg = '服务不可用'
-				break
-			case 504:
-				errorMsg = '网关超时'
-				break
-			case 505:
-				errorMsg = 'HTTP版本不受支持'
-				break
-			default:
-				errorMsg = "请求失败"
-				break
-		}
+		headers['Content-Type']='application/x-www-form-urlencoded'
 	}
-
-	uni.showToast({
-		title: errorMsg,
-		icon: 'none',
-		duration: 3000,
-		complete: function() {
-			setTimeout(function() {
-				if ([301,302].includes(error.code)) {
-					uni.navigateTo({
-						url: '../login/index'
-					});
+	if (options.config.loading){
+		uni.showLoading()
+	}
+	return new Promise((resolve,reject)=>{
+		// console.log(options, config);
+		uni.request({
+			url: url,
+			data: options.params,
+			header: headers,
+			timeout: config.timeout,
+			method: options.config.method,
+			success(res) {
+				uni.hideLoading()
+				if (res.statusCode == 200){
+					resolve(res.data)
+				} else{
+					if (url.indexOf("/wx_mobile") === -1) {
+						Vue.prototype.$message.error(res.data.message)
+					}
+					reject(res)
 				}
-				uni.hideToast();
-			}, 3000);
-		}
-	});
+			},
+			fail(err){
+				uni.hideLoading()
+				console.log(err);
+				Vue.prototype.$message.error(err.data.message)
+				reject(err)
+			}
+		});
+	})
 }
 
-export default request
+export default function request(options){
+	return service(options)
+}