<script>
	export default {
		onLaunch: function() {
			// console.log('App Launch')
		},
		onShow: function() {
			// console.log('App Show')
		},
		onHide: function() {
			// console.log('App Hide')
		},

		post: function(url, data,method) {

			// (showLoad == undefined || showLoad) ?
			//   wx.showLoading({
			//     title: '加载中',
			//   }) : ''
			// wx.showNavigationBarLoading()
			var promise = new Promise((resolve, reject) => {
				//init
				let that = this,
					token = uni.getStorageSync('token'),
					header = {
						token: token || ''
					},
					postData;
					// console.log(token,"token")
				//网络请求  
				uni.request({
					url: this.globalData.baseUrl + url,
					data: data,
					method: method,
					header: header,
					success: function(res) { //返回取得的数据
						console.log(res)
						if (res.data.code == 1) {
							resolve(res.data.data);
						} else {
							// uni.showToast({
							// 	title: res.data.msg,
							// 	icon: 'none',
							// })
							reject(res.data)
							if (res.data.code == '401') {}
						}
						// (showLoad || showLoad == undefined) ? wx.hideLoading(): "";
						// wx.hideNavigationBarLoading()
					},
					fail: function(e) {
						console.log(e)
						reject('网络出错');
						// (showLoad || showLoad == undefined) ? wx.hideLoading() : "";
						wx.hideNavigationBarLoading()
					},
					complete: function(daa) {
						console.log(daa)
					}
				})
			});
			return promise;
		},
		
		
		
		
		timeFormate(timestamp, timeType) {
			if (timestamp) {
				var timeStamp = timestamp.length == 13 ? timestamp : timestamp * 1000
				var date = new Date(timeStamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
				var Y = date.getFullYear() + '-';
				var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
				var D = date.getDate() + ' ';
				var h = date.getHours() + ':';
				var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
				var s = date.getSeconds();
				if (timeType == 'YYMMDD') {
					return Y + M + D;
				} else if (timeType == 'YYMMDDHHMM') {
					return Y + M + D + " " + h + m;
				} else {
					return h + m;
				}
			}
		},
		globalData: {
			userInfo: null,
			 //baseUrl: 'http://icrgangjuren.w.brotop.cn/'
			baseUrl:'https://icr.gangjuren.com/'
		}
	}
</script>

<style>
	/*每个页面公共css */
	/*每个页面公共css */
	body {
		background-color: #f6f6f6;
	}

	/* 布局 */
	.layor_start {
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}

	.layor_center {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.layor_between {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.layor_around {
		display: flex;
		justify-content: space-around;
		align-items: center;
	}

	.layor_end {
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}

	.flex_center {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.layor_start-warp {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
	}

	.register {
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
		position: fixed;
		top: 0rpx;
		left: 0;
		right: 0;
		z-index: 5;
	}
	.box{
		background: #F5F5F5;
	}
	.remaintime {
			display: flex;
			justify-content: space-between;
			align-items: center;
			width: 686rpx;
			height: 100rpx;
			background: rgba(62, 58, 57, 1);
			box-shadow: 0rpx 4rpx 18rpx rgba(0, 0, 0, 0.04);
			opacity: 1;
			border-radius: 10rpx;
			margin: 24rpx auto 0;
			padding: 0 18rpx 0 32rpx;
			box-sizing: border-box;
	
		}
		.remainleft {
			color: #fff;
			font-size: 28rpx;
		}
		
		.remainright {
			width: 48rpx;
			height: 48rpx;
			font-size: 0;
		}
		image{
			width:100%;
			height:100%;
		}
		.nodata{
			color:#999;
			font-size: 30rpx;
			text-align: center;
			margin-top:100rpx;
		}
</style>