Browse Source

调整页面

wangningfei 3 years ago
parent
commit
ca0c1e20d3

+ 3 - 1
app.js

@@ -1,5 +1,6 @@
 //app.js
 import $api from './utils/api'
+import {BASEIMGURL} from './utils/config'
 App({
   onLaunch() {
     // 登录
@@ -42,6 +43,7 @@ App({
   globalData: {
     userInfo: null,
     api: $api,
-    openid: ''
+    openid: '',
+    BASEIMGURL
   }
 })

+ 6 - 6
app.json

@@ -2,14 +2,14 @@
   "pages": [
     "pages/index/index",
     "pages/detail/index",
-    "pages/add/index"
+    "pages/add/index",
+    "pages/my/index"
   ],
   "window": {
     "backgroundTextStyle": "light",
     "navigationBarBackgroundColor": "#fff",
     "navigationBarTitleText": "CoffeeTalk",
-    "navigationBarTextStyle": "black",
-    "navigationStyle": "custom"
+    "navigationBarTextStyle": "black"
   },
   "usingComponents": {
     "navBar": "/components/navBar/navBar"
@@ -19,12 +19,12 @@
     "list": [{
       "pagePath": "pages/index/index",
       "text": "",
-      "iconPath": "img/home.png",
+      "iconPath": "img/home2.png",
       "selectedIconPath": "img/home.png"
     }, {
-      "pagePath": "pages/detail/index",
+      "pagePath": "pages/my/index",
       "text": "",
-      "iconPath": "img/user.png",
+      "iconPath": "img/user2.png",
       "selectedIconPath": "img/user.png"
     }]
   },

+ 6 - 0
app.wxss

@@ -11,4 +11,10 @@
   -webkit-line-clamp: 3;
   -webkit-box-orient: vertical;
   word-break: break-all;
+}
+
+.no-msg{
+  text-align: center;
+  color:#fff;
+  font-size: 26rpx;
 }

BIN
img/.DS_Store


BIN
img/home.png


BIN
img/home2.png


BIN
img/location.png


BIN
img/over_time.png


BIN
img/time.png


BIN
img/user.png


BIN
img/user2.png


+ 73 - 2
pages/add/index.js

@@ -34,7 +34,77 @@ Page({
     dateTimeArray1: null,
     dateTime1: null,
     startYear: null,
-    endYear: null
+    endYear: null,
+
+    BASEIMGURL: '', //图片域名
+    imgList: []
+  },
+  //删除图片
+  removeImg(e) {
+
+    wx.showModal({
+      title: '提示',
+      content: '确定删除图片?',
+      success(res) {
+        if (res.confirm) {
+          console.log('用户点击确定')
+          let item = e.currentTarget.dataset.item;
+          let newImgList = this.data.imgList.filter(v => {
+            return item != v;
+          });
+          this.setData({
+            imgList: newImgList
+          })
+        } else if (res.cancel) {
+          console.log('用户点击取消')
+        }
+      }
+    })
+
+
+  },
+  updateImg() {
+    const that = this;
+    wx.chooseImage({
+      count: 1, // 默认9
+      sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
+      sourceType: ['album', 'camera'],
+      success: function (res) {
+        var tempFilePaths = res.tempFilePaths;
+        var tempFilesSize = res.tempFiles[0].size;
+        
+        wx.showLoading({
+          title: '上传中...',
+        });
+        console.log('size:', tempFilesSize)
+        if (tempFilesSize > 2000000) {   //图片小于或者等于1M时 可以执行获取图片
+          return wx.showToast({
+            title: '上传图片不能大于2M!',  //标题
+            icon: 'none'       //图标 none不使用图标,详情看官方文档
+          })
+        }
+        wx.uploadFile({
+          url: 'https://talk.cirray.cn/api/upload_image', //仅为示例,非真实的接口地址
+          filePath: tempFilePaths[0],
+          name: 'file',
+          formData: {},
+          success: function (res) {
+            // wx.hideLoading()
+            let imgList = [...that.data.imgList, that.data.BASEIMGURL + res.data];
+            that.setData({
+              imgList
+            });
+            wx.hideLoading()
+          },
+          fail(e) {
+            // wx.showToast({  
+            //   title: e,
+            // })
+            wx.hideLoading()
+          }
+        })
+      }
+    })
   },
   back() {
     wx.navigateBack()
@@ -161,7 +231,8 @@ Page({
       dateTime: obj.dateTime,
       dateTimeArray: obj.dateTimeArray,
       dateTimeArray1: obj1.dateTimeArray,
-      dateTime1: obj1.dateTime
+      dateTime1: obj1.dateTime,
+      BASEIMGURL: app.globalData.BASEIMGURL
     });
   },
 

+ 1 - 1
pages/add/index.json

@@ -1,5 +1,5 @@
 {
-  "navigationBarTitleText": "CoffeeTalk",
+  "navigationBarBackgroundColor": "#8F67E8",
   "navigationBarTextStyle": "white",
   "usingComponents": {}
 }

+ 18 - 22
pages/add/index.wxml

@@ -1,10 +1,12 @@
 <!--index.wxml-->
 <view class="container">
-	<navBar title-text="CoffeeTalk" back-icon="/img/nav/back@3x.png" background="none" bindback="back" />
+	<!-- <navBar title-text="CoffeeTalk" back-icon="/img/nav/back@3x.png" background="none" bindback="back" /> -->
 	<view class="title-img"></view>
 	<view class="list">
 		<scroll-view style="height: 100%;" scroll-y>
-			<view class="black-112"></view>
+			<view class="black-112">
+				
+			</view>
 			<!-- 活动名称 -->
 			<view class="label" catchtap="showInput" data-key='key1'>
 				<!-- <view class='icon'></view> -->
@@ -19,10 +21,12 @@
 			</view>
 			<!-- 活动地点 -->
 			<view class="label" catchtap="showInput" data-key='key2'>
-				<view class='icon'></view>
+				<view class='icon'>
+					<image src="../../img/location.png"></image>
+				</view>
 				<view class="input" wx:if='{{!isShowForm.key2}}'>
 					<view class="input-des"></view>
-					<input placeholder="输入活动名称" focus="{{inputFocus.key2}}" placeholder-class="text-888" value='{{form.key2}}' bindinput="inputVal" data-key='key2' bindblur="inputBlur"></input>
+					<input placeholder="输入活动地点" focus="{{inputFocus.key2}}" placeholder-class="text-888" value='{{form.key2}}' bindinput="inputVal" data-key='key2' bindblur="inputBlur"></input>
 				</view>
 				<view class="input-detail" wx:else>
 					<view class='input-title'>活动地点</view>
@@ -31,7 +35,9 @@
 			</view>
 			<!-- 选择活动时间 -->
 			<view class="label">
-				<view class='icon'></view>
+				<view class='icon'>
+					<image src="../../img/time.png"></image>
+				</view>
 				<view class="input" wx:if='{{!form.key3}}'>
 					<view class="input-des"></view>
 					<input disabled placeholder="输入活动时间"></input>
@@ -49,7 +55,9 @@
 			</view>
 			<!-- 选择报名截止时间 -->
 			<view class="label">
-				<view class='icon'></view>
+				<view class='icon'>
+					<image src="../../img/over_time.png"></image>
+				</view>
 				<view class="input" wx:if='{{!form.key4}}'>
 					<view class="input-des"></view>
 					<input disabled placeholder="选择报名截止时间"></input>
@@ -80,25 +88,13 @@
 			</view>
 			<!-- 添加图片 -->
 			<view class="pic-list">
-				<view class="pic-item">
-					<image class="pic" src="../../img/plus.png"></image>
-					<view class="pic-close">
-						<image src="../../img/close.png"></image>
-					</view>
-				</view>
-				<view class="pic-item">
-					<image class="pic" src="../../img/plus.png"></image>
-					<view class="pic-close">
-						<image src="../../img/close.png"></image>
-					</view>
-				</view>
-				<view class="pic-item">
-					<image class="pic" src="../../img/plus.png"></image>
-					<view class="pic-close">
+				<view class="pic-item" wx:for="{{imgList}}" wx:key='index'>
+					<image class="pic" src="{{item}}"></image>
+					<view class="pic-close" bindtap="removeImg" data-item='{{item}}'>
 						<image src="../../img/close.png"></image>
 					</view>
 				</view>
-				<view class="pic-add">
+				<view class="pic-add" bindtap="updateImg">
 					<image src="../../img/plus.png"></image>
 					<text>添加图片</text>
 				</view>

+ 14 - 4
pages/add/index.wxss

@@ -11,14 +11,17 @@ page {
 
 .title-img {
   width: 750rpx;
-  height: 372rpx;
-  background: linear-gradient(135deg, rgba(143, 103, 232, 1) 0%, rgba(99, 87, 204, 1) 100%);
+  /* height: 372rpx; */
+  height: 196rpx;
+  /* background: linear-gradient(135deg, rgba(143, 103, 232, 1) 0%, rgba(99, 87, 204, 1) 100%); */
+  background-color: #8F67E8;
   border-radius: 0px 0px 0px 70rpx;
 }
 
 .list {
   position: absolute;
-  top: 176rpx;
+  /* top: 176rpx; */
+  top: 0;
   left: 50rpx;
   right: 50rpx;
   bottom: 0;
@@ -43,6 +46,10 @@ page {
   height: 48rpx;
   margin-right: 40rpx;
 }
+.label .icon image{
+  width: 100%;
+  height: 100%;
+}
 
 .label .input {
   flex: 1;
@@ -132,11 +139,13 @@ page {
   border-radius: 10rpx;
   margin-right: 40rpx;
   margin-bottom: 20rpx;
+
 }
 
 .pic-item image.pic {
   width: 100%;
   height: 100%;
+  border-radius: 10rpx;
 }
 
 .pic-item .pic-close {
@@ -183,4 +192,5 @@ page {
   height: 112rpx;
   overflow: hidden;
   clear: both;
-}
+}
+

+ 5 - 0
pages/detail/index.js

@@ -44,6 +44,11 @@ Page({
       })
     }
   },
+  scrollView(){
+    this.setData({
+      isScroll: !this.data.isScroll
+    })
+  },
 
 
   /**

+ 10 - 6
pages/detail/index.wxml

@@ -1,8 +1,8 @@
 <!--pages/detail/index.wxml-->
 <view class="container">
-	<navBar title-text="CoffeeTalk" back-icon="/img/nav/back@3x.png" background="none" bindback="back" />
-	<view class="container-bg {{background[current]}}" style="height: {{navHeight}}px;"></view>
-	<view class="swiper" style="height: {{isScroll?'644':'862'}}rpx;">
+	<!-- <navBar title-text="CoffeeTalk" back-icon="/img/nav/back@3x.png" background="none" bindback="back" /> -->
+	<!-- <view class="container-bg {{background[current]}}" style="height: {{navHeight}}px;"></view> -->
+	<view class="swiper" style="height: {{isScroll?'468':'686'}}rpx;">
 		<swiper bindchange="change" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" current="{{current}}" indicator-color='rgba(255,255,255,.3)' indicator-active-color='#fff' style="height: 100%;">
 			<block wx:for="{{background}}" wx:key="*this">
 				<swiper-item>
@@ -11,7 +11,7 @@
 			</block>
 		</swiper>
 		<!--重置小圆点的样式  -->
-		<view class="dots" style='bottom:{{isScroll?"150":"12"}}rpx'>
+		<view class="dots" style='bottom:{{isScroll?"100":"12"}}rpx'>
 			<block wx:for="{{background}}" wx:for-index="index" wx:key="index">
 				<view class="dot {{index == current?'active':''}}"></view>
 			</block>
@@ -19,9 +19,13 @@
 		<!--重置小圆点的样式 end -->
 	</view>
 	<view class="section {{isScroll?'section-scroll':''}}">
-		<scroll-view style="height:100%;" scroll-y bindscroll="scroll">
+	<view class="black-70 pd-top" bindtap="scrollView">
+				<view class="line-active"></view>
+				</view>
+		<scroll-view style="height:100%;" scroll-y>
+		<!-- <scroll-view style="height:100%;" scroll-y bindscroll="scroll"> -->
 			<view class="pd">
-				<view class="black-70"></view>
+				
 				<view class="title">
 					<view class="title-l">Coffee Talk</view>
 					<view class="title-r">

+ 22 - 3
pages/detail/index.wxss

@@ -39,7 +39,7 @@
 
 .swiper {
   position: relative;
-  height: 862rpx;
+  height: 686rpx;
   transition: all ease .4s;
 }
 
@@ -61,16 +61,19 @@
 }
 
 .section {
+  position: relative;
   flex: 1;
-  transition: all ease .4s;
+  transition: all ease .3s;
   background: #fff;
   /* padding: 70rpx 50rpx 0; */
   /* box-sizing: border-box; */
   overflow: hidden;
-
+  box-sizing: border-box;
+  padding-top: 70rpx;
 }
 
 .title {
+  padding-top: 70rpx;
   display: flex;
   align-items: center;
   justify-content: space-between;
@@ -227,4 +230,20 @@ height:250rpx;
 .traffic-map map{
   width: 100%;
   height: 100%;
+}
+.line-active{
+  margin: 0 auto;
+  width: 100rpx;
+  height: 8rpx;
+  border-radius: 8rpx;
+  background-color: #8F67E8;
+}
+.pd-top{
+  position: absolute;
+  width: 500rpx;
+  top:0;
+  left: 50%;
+  transform: translateX(-50%);
+  padding-top: 20rpx;
+  box-sizing: border-box;
 }

+ 0 - 5
pages/index/index.js

@@ -62,10 +62,5 @@ Page({
     wx.navigateTo({
       url: '/pages/add/index',
     })
-  },
-  goDetail(){ 
-    wx.switchTab({
-      url: '/pages/detail/index',
-    })
   }
 })

+ 2 - 0
pages/index/index.json

@@ -1,3 +1,5 @@
 {
+  "navigationBarBackgroundColor": "#8F67E8",
+  "navigationBarTextStyle": "white",
   "usingComponents": {}
 }

+ 2 - 1
pages/index/index.wxml

@@ -5,11 +5,12 @@
     back-icon="/img/nav/back@3x.png"
     background="none"
     bindback="back"/> -->
-	<navBar title-text="CoffeeTalk"  background="none" />
+	<!-- <navBar title-text="CoffeeTalk"  background="none" /> -->
 	<view class="title-img"></view>
 	<view class="list">
 		<scroll-view style="height: 100%;" scroll-y>
 			<view class="black-112"></view>
+			<view class="no-msg">暂无数据~</view>
 			<view class="item"  bindtap="goDetail">
 				<view class="item-img"></view>
 				<view class="item-content">

+ 7 - 3
pages/index/index.wxss

@@ -11,14 +11,18 @@ page {
 
 .title-img {
   width: 750rpx;
-  height: 372rpx;
-  background: linear-gradient(135deg, rgba(143, 103, 232, 1) 0%, rgba(99, 87, 204, 1) 100%);
+  /* height: 372rpx; */
+  height: 196rpx;
+  /* background: linear-gradient(135deg, rgba(143, 103, 232, 1) 0%, rgba(99, 87, 204, 1) 100%); */
+  background-color: #8F67E8;
   border-radius: 0px 0px 0px 70rpx;
 }
 
 .list {
   position: absolute;
-  top: 176rpx;
+  /* top: 176rpx; */
+  /* top: 112rpx; */
+  top:0;
   left: 50rpx;
   right: 50rpx;
   bottom: 0;

+ 66 - 0
pages/my/index.js

@@ -0,0 +1,66 @@
+//index.js
+//获取应用实例
+const app = getApp()
+
+
+
+Page({
+  data: {
+    // userInfo: {},
+    // hasUserInfo: false,
+    // canIUse: wx.canIUse('button.open-type.getUserInfo')
+  },
+  onLoad: function () {
+    // if (app.globalData.userInfo) {
+    //   this.setData({
+    //     userInfo: app.globalData.userInfo,
+    //     hasUserInfo: true
+    //   })
+    // } else if (this.data.canIUse){
+    //   // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
+    //   // 所以此处加入 callback 以防止这种情况
+    //   app.userInfoReadyCallback = res => {
+    //     this.setData({
+    //       userInfo: res.userInfo,
+    //       hasUserInfo: true
+    //     })
+    //   }
+    // } else {
+    //   // 在没有 open-type=getUserInfo 版本的兼容处理
+    //   wx.getUserInfo({
+    //     success: res => {
+    //       app.globalData.userInfo = res.userInfo
+    //       this.setData({
+    //         userInfo: res.userInfo,
+    //         hasUserInfo: true
+    //       })
+    //     },
+    //     fail: res=>{
+    //       console.log(res)
+    //     }
+    //   })
+    // }
+  },
+  getUserInfo: function(e) {
+    console.log(e)
+    if(e.detail.userInfo){
+      app.globalData.userInfo = e.detail.userInfo
+      this.setData({
+        userInfo: e.detail.userInfo,
+        hasUserInfo: true
+      })
+    }else{
+      console.log('拒绝')
+      this.setData({
+        userInfo: {},
+        hasUserInfo: false
+      })
+    }
+    
+  },
+  goAdd(){
+    wx.navigateTo({
+      url: '/pages/add/index',
+    })
+  }
+})

+ 5 - 0
pages/my/index.json

@@ -0,0 +1,5 @@
+{
+  "navigationBarBackgroundColor": "#8F67E8",
+  "navigationBarTextStyle": "white",
+  "usingComponents": {}
+}

+ 84 - 0
pages/my/index.wxml

@@ -0,0 +1,84 @@
+<!--index.wxml-->
+<view class="container">
+	<!-- <navBar 
+    title-text="CoffeeTalk" 
+    back-icon="/img/nav/back@3x.png"
+    background="none"
+    bindback="back"/> -->
+	<!-- <navBar title-text="CoffeeTalk"  background="none" /> -->
+	<view class="title-img"></view>
+	<view class="list">
+		<scroll-view style="height: 100%;" scroll-y>
+			<view class="black-112"></view>
+      <view class="no-msg">暂无数据~</view>
+			<!-- <view class="item"  bindtap="goDetail">
+				<view class="item-img"></view>
+				<view class="item-content">
+					<view class="content-title">Coffee Talk</view>
+					<view class="content-addr">
+						<text class='addr-icon'></text>
+						<view>
+							<text class="addr">上海长宁区愚园路1107号1号楼509 - </text>
+							<text class="addr-m">距您364 m</text>
+						</view>
+					</view>
+					<view class="content-time">
+						<text class="time-icon"></text>
+						<view>
+							<text class="time">2020-07-22 14:00</text>
+							<text class="number">(最多3241 人)</text>
+						</view>
+					</view>
+				</view>
+				<view class="line"></view>
+				<view class="item-fn">
+					<view class="fn-l">
+						<view class="fn-t">免费</view>
+						<view class="fn-d">/人</view>
+					</view>
+					<view class="fn-r">立即参加</view>
+				</view>
+			</view>
+			<view class="black-38"></view>
+			<view class="item">
+				<view class="item-img"></view>
+				<view class="item-content">
+					<view class="content-title">Coffee Talk</view>
+					<view class="content-addr">
+						<text class='addr-icon'></text>
+						<view>
+							<text class="addr">上海长宁区愚园路1107号1号楼509 - </text>
+							<text class="addr-m">距您364 m</text>
+						</view>
+					</view>
+					<view class="content-time">
+						<text class="time-icon"></text>
+						<view>
+							<text class="time">2020-07-22 14:00</text>
+							<text class="number">(最多3241 人)</text>
+						</view>
+					</view>
+				</view>
+				<view class="line"></view>
+				<view class="item-fn">
+					<view class="fn-l">
+						<view class="fn-t">免费</view>
+						<view class="fn-d">/人</view>
+					</view>
+					<view class="fn-r">立即参加</view>
+				</view>
+			</view>
+			<view class="black-38"></view> -->
+		</scroll-view>
+	</view>
+	<!-- <view class="add" bindtap="goAdd">
+		<text>+</text>
+	</view> -->
+	<!-- <view class="userinfo">
+    <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
+    <block wx:else>
+      <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
+      <text class="userinfo-nickname">{{userInfo.nickName}}</text>
+    </block>
+  </view> -->
+</view>

+ 177 - 0
pages/my/index.wxss

@@ -0,0 +1,177 @@
+page {
+  background-color: #F0F2F6;
+}
+
+.container {
+  position: relative;
+  width: 100vw;
+  height: 100vh;
+  overflow: hidden;
+}
+
+.title-img {
+  width: 750rpx;
+  /* height: 372rpx; */
+  height: 196rpx;
+  /* background: linear-gradient(135deg, rgba(143, 103, 232, 1) 0%, rgba(99, 87, 204, 1) 100%); */
+  background-color: #8F67E8;
+  border-radius: 0px 0px 0px 70rpx;
+}
+
+.list {
+  position: absolute;
+  /* top: 176rpx; */
+  /* top: 112rpx; */
+  top:0;
+  left: 50rpx;
+  right: 50rpx;
+  bottom: 0;
+}
+
+.black-38 {
+  height: 38rpx;
+  clear: both;
+  overflow: hidden;
+  font-size: 0;
+}
+
+.list .item {
+  width: 100%;
+  background: rgba(255, 255, 255, 1);
+  border-radius: 24rpx;
+  overflow: hidden;
+}
+
+.item .item-img {
+  width: 610rpx;
+  height: 230rpx;
+  background-color: blue;
+}
+
+.item-content {
+  padding: 28rpx 40rpx 24rpx;
+}
+
+.item-content .content-title {
+  padding: 8rpx 0;
+  font-size: 40rpx;
+  font-weight: 400;
+  color: rgba(49, 49, 49, 1);
+}
+
+.content-addr {
+  display: flex;
+  align-items: center;
+  padding-bottom: 26rpx;
+}
+
+.addr-icon {
+  width: 20rpx;
+  height: 28rpx;
+  margin: 0 18rpx 0 6rpx;
+  background-color: red;
+}
+
+.addr-icon image {
+  width: 100%;
+  height: 100%;
+}
+
+.content-addr view {
+  display: flex;
+  align-items: center;
+}
+
+.addr {
+  font-size: 24rpx;
+  color: #313131;
+}
+
+.addr-m {
+  font-size: 20rpx;
+  color: #838383;
+}
+
+.content-time {
+  display: flex;
+  align-items: center;
+}
+
+.content-time view {
+  display: flex;
+  align-items: center;
+}
+
+.time-icon {
+  width: 24rpx;
+  height: 24rpx;
+  background-color: red;
+  margin: 0 18rpx 0 6rpx;
+}
+
+.time {
+  font-size: 28rpx;
+  color: #313131;
+  margin-right: 10rpx;
+}
+
+.number {
+  color: #A5A5A7;
+  font-size: 28rpx;
+}
+
+.line {
+  margin: 0 40rpx;
+  height: 0;
+  border-bottom: 2rpx dashed #E5E5E5;
+}
+
+.item-fn {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 28rpx 40rpx 38rpx;
+}
+
+.fn-t {
+  padding: 9rpx 0;
+  font-size: 48rpx;
+  color: #313131;
+}
+
+.fn-d {
+  font-size: 20rpx;
+  color: #313131;
+}
+
+.fn-r {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 300rpx;
+  height: 100rpx;
+  background: linear-gradient(135deg, rgba(143, 103, 232, 1) 0%, rgba(99, 87, 204, 1) 100%);
+  border-radius: 50rpx;
+  font-size: 32rpx;
+  color: #fff;
+}
+
+.black-112 {
+  height: 112rpx;
+  overflow: hidden;
+  clear: both;
+}
+
+.add {
+  position: absolute;
+  right: 16rpx;
+  bottom: 196rpx;
+  width: 80rpx;
+  height: 80rpx;
+  background: rgba(140, 102, 230, 0.75);
+  border-radius: 50%;
+  color: #fff;
+  font-size: 52rpx;
+  text-align: center;
+}
+

+ 1 - 1
utils/config.js

@@ -1,2 +1,2 @@
 export const BASEURL='https://talk.cirray.cn/api/'
-
+export const BASEIMGURL = 'http://cirraybucket.oss-cn-shanghai.aliyuncs.com/coffeetalk/'

+ 7 - 6
utils/request.js

@@ -1,4 +1,6 @@
-import {BASEURL} from './config'
+import {
+  BASEURL
+} from './config'
 
 const GET = 'GET';
 const POST = 'POST';
@@ -6,12 +8,11 @@ const PUT = 'PUT';
 const FORM = 'FORM';
 const DELETE = 'DELETE';
 
-const request = (method, url, data) => {
+const request = (method, url, data, header = {
+  'content-type': 'application/json'
+}) => {
   return new Promise(function (resolve, reject) {
     wx.showNavigationBarLoading() //在标题栏中显示加载
-    let header = {
-      'content-type': 'application/json'
-    };
     wx.request({
       url: BASEURL + url,
       method: method,
@@ -46,7 +47,7 @@ const request = (method, url, data) => {
         wx.hideLoading();
         reject(err)
       },
-      complete () {
+      complete() {
         wx.hideNavigationBarLoading(); //完成停止加载
         wx.stopPullDownRefresh(); //停止下拉刷新
       },