Parcourir la source

feat():修改token过期

geek il y a 4 ans
Parent
commit
d138dde370

+ 5 - 0
api/order.js

@@ -26,6 +26,11 @@ class order extends request {
         const res = await this.postRequest(`${this.BASE_URL}Order/payOrderAgain`,data)
         return res.data
     }
+
+    static async refreshCode(data) {
+        const res = await this.postRequest(`${this.BASE_URL}Order/changeCode`,data)
+        return res.data
+    }
     
     static async createOrder(data) {
         const res = await this.postRequest(`${this.BASE_URL}Order/createOrder`,data)

+ 7 - 1
api/product.js

@@ -7,7 +7,7 @@ class product extends request {
     // }
 
     static async getProductList(productType=1,page = 1, pageSize = 10) {
-        const res = await this.getRequest(`${this.BASE_URL}Product/index?productType=${productType}&page=${page}&pageSize=${pageSize}`)
+        const res = await this.getRequest(`${this.BASE_URL}Product/index?productTypeId=${productType}&page=${page}&pageSize=${pageSize}`)
         return res.data;
     }
     static async getProductById(id) {
@@ -15,5 +15,11 @@ class product extends request {
         return res.data;
     }
 
+    static async getProductTypeList(page = 1, pageSize = 10) {
+        const res = await this.getRequest(`${this.BASE_URL}Product/typeList?page=${page}&pageSize=${pageSize}`)
+        return res.data;
+    }
+    
+
 }
 export default product

+ 4 - 0
app.js

@@ -22,6 +22,8 @@ App({
     const auth = await wxp.getSetting()
     if (!auth.authSetting['scope.userInfo']){
       console.log('您还没有授权');
+      requestApi.HEAD.token = ''
+      wx.setStorageSync('token', '')
       return
     }
     // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
@@ -39,6 +41,8 @@ App({
     console.log(data)
     if (!data){
       console.log('你还没有授权')
+      requestApi.HEAD.token = ''
+      wx.setStorageSync('token', '')
       return
     }
     let _self = this;

+ 6 - 1
app.wxss

@@ -2,7 +2,8 @@
 @import '/miniprogram_npm/weui-miniprogram/weui-wxss/dist/style/weui.wxss';
 Page{
   /* background-color: #F7F7F7; */
-
+  height: 100%;
+  width: 100%;
 }
 
 .comments-end {
@@ -65,3 +66,7 @@ Page{
 .fw600{
   font-weight: 600;
 }
+
+.f30 {
+  font-size: 30rpx;
+}

BIN
images/logo.jpg


BIN
images/no-product.png


+ 6 - 4
pages/appointment/appointment.js

@@ -115,10 +115,12 @@ Page({
       package: rs.package,
       signType: rs.signType,
       paySign: rs.paySign,
-      success (res) { 
-        wx.navigateTo({
-          url: '../order/order?id=' + orderId,
-        })
+      success (res) {
+        setTimeout(()=>{
+          wx.navigateTo({
+            url: '../order/order?id=' + orderId,
+          })
+        },2000) 
       },
       fail (res) { 
         wx.navigateTo({

+ 1 - 1
pages/appointment/appointment.wxml

@@ -2,7 +2,7 @@
     <view class="shop-info card">
         <image class="address-icon" src="../../images/icons/location.png"></image>
         <view class="shop">
-            <view class="shop-name">品牌名{{shopName}}</view>
+            <view class="shop-name">{{storeName}}</view>
             <view class="address">{{address}}</view>
         </view>
     </view>

+ 2 - 2
pages/appointment/appointment.wxss

@@ -22,8 +22,8 @@
 }
 
 .container .shop-info .address-icon {
-  width: 50rpx;
-  height: 53rpx;
+  width: 70rpx;
+  height: 70rpx;
   position: absolute;
   top: 50%;
   transform: translateY(-50%);

+ 51 - 15
pages/index/index.js

@@ -43,7 +43,8 @@ Page({
     const self = this
 
     const tokenData = await commonApi.getToken();
-
+    console.log(tokenData)
+    console.log(requestApi.HEAD.token)
     if (tokenData.token && !requestApi.HEAD.token) {
       console.log('设置token')
       wx.setStorageSync('token', tokenData.token)
@@ -70,6 +71,12 @@ Page({
                 wx.setStorageSync('lat', latitude)
                 const rs = await storeApi.getNearStore(latitude, longitude)
                 console.log(rs.info);
+                if (!rs.info.distance) {
+                  wx.showModal({
+                    title: '提示',
+                    content: '该门店打样了哦',
+                  })
+                }
                 self.setData({
                   locationFlag: true,
                   storeInfo: rs.info
@@ -80,7 +87,7 @@ Page({
         }
       })
     } else {
-      const rs = await storeApi.getStoreByI(options.storeId)
+      const rs = await storeApi.getStoreById(options.storeId)
       self.setData({
         storeInfo: rs.info
       })
@@ -89,22 +96,22 @@ Page({
     //根据机型设置现有的tab-content盒子高度
     let windowHeight = parseInt(wx.getSystemInfoSync().windowHeight) * parseInt(750 / wx.getSystemInfoSync().windowWidth) - 185
 
-    await this.getProductList();
-    let tabs = this.data.tabs;
-    let activeTab = this.data.activeTab;
-    console.log(tabs[activeTab].list.length)
-    let productHeight = tabs[activeTab].list.length * 170 
-    this.setData({
-      tabHeight: windowHeight,
-      productHeight
+    // await this.getProductList();
+    self.setData({
+      tabHeight: windowHeight
     })
 
+
   },
   onShow: async function (op) {
     console.log(op)
     const self = this
+    if (self.data.isShow == 1) {
+      return
+    }
     const tokenData = await commonApi.getToken();
     if (tokenData.token && !requestApi.HEAD.token) {
+      console.log('onshow设置了token')
       wx.setStorageSync('token', tokenData.token)
       requestApi.HEAD.token = tokenData.token
     }
@@ -115,11 +122,28 @@ Page({
         chooseStoreId: 0
       })
     }
-
+    await this.productTypeList()
     await this.getProductList();
-
+    let tabs = this.data.tabs;
+    let activeTab = this.data.activeTab;
+    let defaultH  = '100%'
+    if (tabs[activeTab].list.length) {
+      defaultH = tabs[activeTab].list.length * 170
+    }
+    let productHeight = defaultH
+    self.setData({
+      productHeight,
+      isShow:1
+    })
   },
 
+  productTypeList: async function(){
+    const self = this
+    const rs = await productApi.getProductTypeList(1,10)
+    self.setData({
+      tabs: rs.list
+    })
+  },
 
   getProductList: async function (refresh = false) {
     const self = this
@@ -130,7 +154,7 @@ Page({
 
 
 
-    let prolist = await productApi.getProductList(activeTab + 1, pageNo[activeTab],10);
+    let prolist = await productApi.getProductList(tabs[activeTab].id, pageNo[activeTab],10);
     pageSum[activeTab] = prolist.pageCount;
     let list = prolist.list;
 
@@ -199,8 +223,20 @@ Page({
   },
   onTabClick(e) {
     const index = e.detail.index
+    let tabs =  this.data.tabs
+    let defaultH  = 600
+    if (tabs[index].list && tabs[index].list.length) {
+      defaultH = tabs[index].list.length * 170
+    }
+
+
+    let productHeight = defaultH
+    console.log(productHeight)
+
+    console.log(tabs[index].list)
     this.setData({
-      activeTab: index
+      activeTab: index,
+      productHeight
     })
   },
 
@@ -324,4 +360,4 @@ Page({
       url: '../appointment/appointment?' + 'shopId=' + shopId + '&productId=' + productId + '&address=' + address + "&shopName=" + shopName,
     })
   }
-})
+})

+ 10 - 5
pages/index/index.wxml

@@ -20,13 +20,13 @@
   </view>
   <!-- 产品信息 -->
   <view class="product">
-    <mp-tabs tabs="{{tabs}}" activeTab="{{activeTab}}" swiperClass="weui-tabs-swiper" bindtabclick="onTabClick" bindchange="onChange" activeClass="tab-bar-title__selected" tabUnderlineColor="#292E37" tabInactiveTextColor="#fff" tabActiveTextColor="#b1a384" tabBackgroundColor="#292E37" swiperHeight="{{productHeight}}">
-      <block wx:for="{{tabs}}" wx:key="title">
+    <mp-tabs tabs="{{tabs}}" tab-class="tabItem" activeTab="{{activeTab}}" swiperClass="weui-tabs-swiper" bindtabclick="onTabClick" bindchange="onChange" activeClass="tab-bar-title__selected" tabUnderlineColor="#292E37" tabInactiveTextColor="#fff" tabActiveTextColor="#b1a384" tabBackgroundColor="#292E37" swiperHeight="1100">
+      <block wx:for="{{tabs}}" wx:key="id">
         <view class="tab-content" data-set="{{item}}" slot="tab-content-{{index}}" bind:tap="handleClick" >
           <view class="shop-info">
-            <image class="shop-img" src="{{storeInfo.logo}}" lazy-load="false"></image>
+            <image class="shop-img" src="{{tabs[index].productTypeImg}}" lazy-load="false"></image>
           </view>
-          <view class="productinfo" >
+          <view wx:if="{{tabs[index].list.length}}"  class="productinfo" >
             <block wx:for="{{tabs[index].list}}" wx:key="id">
               <view class="product-item" data-productid="{{item.id}}" bindtap="gotoAppointment">
                 <image class="product-img" src="{{item.productImg}}" lazy-load="false" binderror="" bindload=""></image>
@@ -40,10 +40,15 @@
               </view>
             </block>
           </view>
+          <view wx:else>
+            <image class="noProduct"  src="../../images/no-product.png"></image>
+            <view class="noProductText">暂无产品</view>
+          </view>
         </view>
       </block>
     </mp-tabs>
     <!-- </view>
     </block> -->
   </view>
-</view>
+
+</view>

+ 49 - 9
pages/index/index.wxss

@@ -13,9 +13,13 @@ Page {
 }
 
 .container .shop {
-  border-top: 1rpx solid #ECECEC;
+  /* border-top: 1rpx solid #ECECEC; */
   width: 100%;
   background-color: #F7F7F7;
+  position: fixed;
+  z-index: 1;
+  /* top: 0rpx; */
+  height: 82rpx;
   /* 未获得授权时显示获取授权按钮 */
 }
 
@@ -63,13 +67,20 @@ Page {
   transform: translate(-50%);
 }
 
-.container .product {
-  height: 600px;
+.container{
+  display: flex;
+  height: 100%;
+}
+
+.product {
+  margin-top: 82rpx;
+  flex:1;
+  width: 100%;
 }
 
 .container .product .tab-content {
   overflow-y: auto;
-  height: 600px;
+  height: 100%;
 }
 
 .container .product .weui-tabs .weui-tabs-bar__wrp .weui-tabs-bar__content {
@@ -89,7 +100,7 @@ Page {
   width: 100%;
 }
 
-.container .product .weui-tabs .weui-tabs-bar__wrp .weui-tabs-bar__content .weui-tabs-bar__item:nth-of-type(2)::before, .container .product .weui-tabs .weui-tabs-bar__wrp .weui-tabs-bar__content .weui-tabs-bar__item:nth-of-type(2)::after {
+.container .product .weui-tabs .weui-tabs-bar__wrp .weui-tabs-bar__content .weui-tabs-bar__item:nth-of-type(n+2)::before {
   content: '';
   position: absolute;
   height: 40rpx;
@@ -97,7 +108,13 @@ Page {
   background-color: #fff;
 }
 
-.container .product .weui-tabs .weui-tabs-bar__wrp .weui-tabs-bar__content .weui-tabs-bar__item:nth-of-type(2)::before {
+.container .product .weui-tabs .weui-tabs-bar__wrp .weui-tabs-bar__content .weui-tabs-bar__item:nth-of-type(n+2)::before {
+  left: 0;
+  top: 50%;
+  transform: translateY(-50%);
+}
+
+.container .product .weui-tabs .weui-tabs-bar__wrp .weui-tabs-bar__content .weui-tabs-bar__item:nth-of-type(3)::before {
   left: 0;
   top: 50%;
   transform: translateY(-50%);
@@ -110,12 +127,12 @@ Page {
 }
 
 .container .product .shop-info {
-  width: 100%;
+  width: 750rpx;
   height: 500rpx;
 }
 
 .container .product .shop-info > image {
-  width: 100%;
+  width: 750rpx;
 }
 
 .container .product .productinfo {
@@ -139,7 +156,7 @@ Page {
 
 .container .product .productinfo .product-item .product-desc {
   height: 150rpx;
-  letter-spacing: 2rpx;
+  letter-spacing:1rpx;
   font-weight: 100;
   display: flex;
   flex-direction: column;
@@ -177,3 +194,26 @@ Page {
   font-size: 13px;
   color: #999;
 }
+
+.tabItem {
+  border-right: 1rpx ;
+}
+
+.noProduct {
+  width: 500rpx;
+    height: 460rpx;
+    position: relative;
+    left: 15%;
+    top: 50%;
+}
+
+.noProductText {
+  letter-spacing: 17rpx;
+    width: 100%;
+    font-size: 38rpx;
+    display: flex;
+    justify-content: center;
+    position: relative;
+    top: -58rpx;
+    color: #787878;
+}

+ 41 - 4
pages/order/order.js

@@ -1,4 +1,5 @@
 import orderApi from '../../api/order'
+import api from '../../utils/api';
 import drawQrcode from '../../utils/weapp.qrcode.js'
 // pages/order/order.js
 Page({
@@ -12,7 +13,9 @@ Page({
     //1显示订单详情,2显示确认支付,取消订单,3显示删除订单
     orderStatus: 1,
     timer: {},
-    codeUrl: ''
+    codeUrl: '',
+    percent:'1',
+    color:'#10AEFF'
   },
 
   /**
@@ -24,16 +27,49 @@ Page({
       orderId: orderId
     })
     // let order = await orderApi.getOrderById(orderId);
-
+    
 
 
   },
   //生成二维码
   createQrcode: function () {
+    const self = this
     drawById.call(wx, "qrCode", {
-      text: "1233", // 二维码内容
+      text: self.data.order.writeOffCode, // 二维码内容
     })
   },
+  createTimeForCode: async function (){
+    const self  = this
+    const order = this.data.order
+    console.log(order.writeOffOverTime)
+    let endTime = new Date(order.writeOffOverTime);
+
+    console.log(endTime.getTime())
+    var timerID = setInterval(async () => {
+      let nowTime = new Date();
+      let timer = endTime.getTime() - nowTime.getTime();
+
+      self.setData({
+        percent: 100 - (timer/1200),
+
+      })
+
+      if (timer < 60000 && timer > 1 && self.data.color !== '#f52e46') {
+        self.setData({
+          color:"#f52e46"
+        })
+      }
+      if (timer < 1) {
+        clearInterval(timerID);
+        await orderApi.refreshCode({orderId:order.id})
+        await self.orderInfo()
+        self.setData({
+          color:'#10AEFF'
+        })
+
+      }
+  },1000)
+},
 
   createTimeClock: function () {
     var self = this;
@@ -136,8 +172,9 @@ Page({
     if (order.info.status == 1) {
       this.createTimeClock()
     }
-    if (order.info.status == 2) {
+    if (order.info.status == 2 && order.info.writeOffStatus == 1) {
       this.drawCode(order.info.writeOffCode)
+      await this.createTimeForCode()
     }
   },
   rpxToPx(data) {

+ 7 - 2
pages/order/order.wxml

@@ -10,18 +10,23 @@
             <view class="code-text f13 c-707070" wx:if="{{order.writeOffStatus==1}}">
                 进店请出示二维码进行核销
             </view>
+
             <view wx:if="{{order.writeOffStatus==2}}">
                 <view class="refresh">券码已使用</view>
                 <view class="code-text f13 c-707070">该券码已核销</view>
             </view>
         </view>
+        <view wx:if="{{order.writeOffStatus==1}}" class="progress">
+                <view class="writeCode c-707070">核销码:<text class="codeText">{{order.writeOffCode}}</text><text class="codeTip">(2分钟刷新一次)</text></view>
+                <progress class="pro" active-mode="forwards" percent="{{percent}}" color="{{color}}" active stroke-width="3" />
+            </view>
     </view>
     <view class="order card">
         <view class="order-img">
             <image class="" src="{{order.productImg}}"></image>
         </view>
         <view class="order-info">
-            <view class="order-id f13 c-707070" style="font-size:30rpx;">{{order.orderSn}}</view>
+            <view class="order-id f30 c-707070" style="font-size:30rpx;">{{order.orderSn}}</view>
             <view class="order-title c-202020">{{order.productName}}</view>
             <view class="order-price f18">¥{{order.orderMoney}}</view>
             <view class="order-date f13 c-707070">
@@ -39,7 +44,7 @@
         <view class="f17 shop">场馆电话</view>
         <view class="tel f14 c-707070 " data-mobile="{{order.mobile}}" bindtap="call">
             <image src="../../images/icons/tel.png"></image>
-            {{order.mobile}}
+            {{order.storeMobile}}
         </view>
     </view>
     <view class="order-btn">

+ 36 - 5
pages/order/order.wxss

@@ -14,7 +14,8 @@
 
 .container .code-info {
   width: 100%;
-  height: 390rpx;
+  /* height: 390rpx; */
+  height: 500rpx;
   background-color: #fff;
 }
 
@@ -30,7 +31,7 @@
   background-color: #fff;
   width: 280rpx;
   height: 280rpx;
-  margin: 20rpx auto;
+  margin: 20rpx 0rpx 0rpx 23rpx;
 }
 
 .container .code-info .code .code-text {
@@ -39,8 +40,8 @@
 }
 
 .container .code-info .code .refresh {
-  width: 280rpx;
-  height: 280rpx;
+  width: 285rpx;
+  height: 285rpx;
   background-color: rgba(238, 238, 238, 0.95);
   position: absolute;
   top: 20rpx;
@@ -154,7 +155,7 @@
   font-size: 15px;
   text-align: center;
   line-height: 60rpx;
-  border-radius: 25rpx;
+  border-radius: 100rpx;
   color: #999;
   border: 1rpx solid #999;
   margin: 0 20rpx;
@@ -170,4 +171,34 @@
     color: #999;
     border: 1rpx solid #999;
     margin: 0px 20rpx;
+}
+
+.f30 {
+  font-size: 30rpx;
+}
+
+.progress {
+  margin-top: 50rpx;
+}
+
+.writeCode {
+  display: flex;
+  width: 100%;
+  justify-content: center;
+  align-items: center;
+}
+
+.codeText {
+  font-size: 40rpx;
+  color:#BA9D6E;
+  letter-spacing: 2rpx;
+}
+
+.codeTip {
+  font-size: 20rpx;
+}
+
+.pro  {
+  width: 600rpx;
+  margin-left: 90rpx;
 }

+ 78 - 5
pages/personorder/personorder.js

@@ -28,7 +28,8 @@ Page({
       {
         title: '已完成'
       },
-    ]
+    ],
+    tabh: 1220
   },
 
   /**
@@ -44,14 +45,15 @@ Page({
   getAllOrderList: async function (refresh = false) {
     const self = this
     let pageNo = this.data.pageNo;
-    if (!refresh) {
-      pageNo = [1,1,1,1]
-    }
+    // if (!refresh) {
+    //   pageNo = [1,1,1,1]
+    // }
     let tabs = this.data.tabs;
     let pageSum = this.data.pageSum;
     // 获取全部订单
-    var orderList = await orderApi.getAllOrderList(pageNo[0], 10);
+    var orderList = await orderApi.getAllOrderList(pageNo[0], 4);
     var list = orderList.list;
+    console.log(pageNo[0])
     if (!tabs[0].list) {
       tabs[0].list = []
     }
@@ -310,6 +312,77 @@ Page({
 
 
   },
+  scroolBottom: async function () {
+    console.log("到底啦")
+    var self = this;
+    let activeTab = this.data.activeTab;
+    if (activeTab == 0) {
+      console.log("all")
+      let pageNo = this.data.pageNo;
+      // pageNo[0]++;
+      // self.setData({
+      //   pageNo
+      // })
+      if (self.data.pageNo[0] <= self.data.pageSum[0]) {
+        pageNo[0]++;
+        self.setData({
+          pageNo
+        })
+        await this.getAllOrderList()
+        return
+      }
+
+    }
+    if (activeTab == 1) {
+      console.log("xiaofei")
+      let pageNo = this.data.pageNo;
+      // pageNo[1]++;
+      // self.setData({
+      //   pageNo
+      // })
+      if (self.data.pageNo[1] <= self.data.pageSum[1]) {
+        pageNo[1]++;
+      self.setData({
+        pageNo
+      })
+        await this.getwriteOffOrderList()
+        return
+      }
+    }
+    if (activeTab == 2) {
+      console.log("pingjia")
+      let pageNo = this.data.pageNo;
+      // pageNo[2]++;
+      // self.setData({
+      //   pageNo
+      // })
+      if (self.data.pageNo[2] <= self.data.pageSum[2]) {
+        pageNo[2]++;
+      self.setData({
+        pageNo
+      })
+        await this.getcommentOffOrderList()
+        return
+      }
+    }
+    if (activeTab == 4) {
+      let pageNo = this.data.pageNo;
+      // pageNo[3]++;
+      // self.setData({
+      //   pageNo
+      // })
+      if (self.data.pageNo[3] <= self.data.pageSum[3]) {
+        pageNo[3]++;
+      self.setData({
+        pageNo
+      })
+        await this.getfinishOrderList()
+        return
+      }
+    }
+
+
+  },
 
   /**
    * 用户点击右上角分享

+ 6 - 6
pages/personorder/personorder.wxml

@@ -1,23 +1,23 @@
 <!--pages/personorder/personorder.wxml-->
 <view class="container">
-    <mp-tabs tabs="{{tabs}}" activeTab="{{activeTab}}" swiperClass="weui-tabs-swiper" bindtabclick="onTabClick"
+    <mp-tabs tabs="{{tabs}}" class="tabs" activeTab="{{activeTab}}" swiperClass="weui-tabs-swiper" bindtabclick="onTabClick"
         bindchange="onChange" activeClass="tab-bar-title__selected" tabActiveTextColor="#BA9D6E"
-        swiperHeight="{{(tabs[activeTab].list.length)*420}}">
+        swiperHeight="{{tabh }}">
         <block wx:for="{{tabs}}" wx:key="title">
-            <view class="tab-content" data-set="{{item}}" slot="tab-content-{{index}}" bind:tap="handleClick">
+            <scroll-view scroll-y="true" bindscrolltolower="scroolBottom" class="tab-content" data-set="{{item}}" slot="tab-content-{{index}}" bind:tap="handleClick">
                 <view  class="orders" >
                     <block wx:for="{{tabs[index].list}}" wx:key="id">
                         <view class="orderinfo card">
                             <view class="order-item" bindtap="showOrderInfo" data-orderid="{{item.id}}"
                                 data-status="{{item.status}}" data-writestatus="{{item.writeOffStatus}}">
-                                <view class="pay-text">{{item.statusText}}</view>
+                                <view class="pay-text">{{item.orderSn}}</view>
                                 <view class="order-img">
                                     <image class="" src="{{item.productImg}}">
 
                                     </image>
                                 </view>
                                 <view class="order-desc">
-                                    <view class="order-id f13 c-707070">{{item.orderSn}}</view>
+                                    <view class="order-id f30 c-707070">{{item.statusText}}</view>
                                     <view class="order-title c-202020">
                                         <view class="title">{{item.productName}}</view>
 
@@ -55,7 +55,7 @@
                         </view>
                     </block>
                 </view>
-            </view>
+            </scroll-view>
         </block>
     </mp-tabs>
 

+ 16 - 3
pages/personorder/personorder.wxss

@@ -1,6 +1,12 @@
 .container .tab-content {
-  height: 95rpx;
-  line-height: 95rpx;
+  /* height: 95rpx;
+  line-height: 95rpx; */
+  height: 100%;
+  /* overflow-y: auto; */
+}
+.container{
+  height: 100%;
+  width: 100%;
 }
 
 .container .weui-tabs .weui-tabs-bar__wrp {
@@ -37,6 +43,7 @@
 
 .container .orders {
   margin-top: 20rpx;
+
 }
 
 .container .orders .orderinfo {
@@ -52,7 +59,7 @@
 
 .container .orders .orderinfo .order-item .pay-text {
   position: absolute;
-  top: -18rpx;
+  top: 2rpx;
   left: 20rpx;
   color: #BA9D6E;
   font-size: 14px;
@@ -141,3 +148,9 @@
   position: fixed;
   background-color: #FFF;
 }
+
+.tabs {
+  height: 100%;
+    position: fixed;
+    width: 100%;
+}

+ 1 - 1
pages/prompt/prompt.js

@@ -6,7 +6,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-    companyName:"测试公司"
+    companyName:"上海合申科技有限公司"
   },
 
   /**

+ 2 - 2
pages/prompt/prompt.wxml

@@ -1,10 +1,10 @@
 <!--pages/prompt/prompt.wxml-->
 <view class="container">
     <view class="logo">
-        <image class="logo-img" src="../../images/icons/tel.png"  >
+        <image class="logo-img" src="../../images/logo.jpg"  >
             
         </image>
-        <view class="info ">欢迎来到{{companyName}}</view>
+        <view class="info ">{{companyName}}</view>
     </view>
     <view class="desc">
         <view class="text-h f16">为提供更优质的服务,{{companyName}}需要获取以下信息:</view>

+ 33 - 13
utils/request.js

@@ -4,7 +4,8 @@ class request {
     static BASE_URL = 'https://llzlovesh.top/api/'
     static HEAD = {
         "Content-Type": "application/json",
-        "token": 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTI5NTc0MDQsImV4cCI6NDA3MDg4MDAwMCwidXNlcklkIjoxMjM0NTY3ODksInZpc2l0b3IiOiJ2aXNpdG9yNjAyM2M2ZGNkZmIwNiIsImlzQWRtaW4iOjAsImFkbWluSWQiOjB9.ojdQ3bieXuJ5sKCesjVfutwDpp8f8oL0-fSJMP72XZc'
+        "defaultToken": 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTY5MDg3NjAsImV4cCI6MjQ4MDgyMjM2MCwidXNlcklkIjoxMjM0NTY3ODksInZpc2l0b3IiOiJ2aXNpdG9yNjA2MDExZDg4NTQwYyIsImlzQWRtaW4iOjAsImFkbWluSWQiOjB9.7XrRxA3WYMBlqJWIXEw-71AxOxQvCc4VVVN6rlqn3uc',
+        "token":'',
     }
     static constructor() {
 
@@ -21,8 +22,12 @@ class request {
      * GET类型的网络请求
      */
     static getRequest(url, data, header = this.HEAD ) {
-        if (!this.HEAD.token){
-            header.token = wx.getStorageSync('token')
+
+        const token = wx.getStorageSync('token')
+        if (token) {
+            header.token = token
+        }else {
+            header.token = header.defaultToken
         }
         return this.requestAll(url, data, header, 'GET')
     }
@@ -31,8 +36,11 @@ class request {
      * DELETE类型的网络请求
      */
     static deleteRequest(url, data, header = this.HEAD ) {
-        if (!this.HEAD.token){
-            header.token = wx.getStorageSync('token')
+        const token = wx.getStorageSync('token')
+        if (token) {
+            header.token = token
+        }else {
+            header.token = header.defaultToken
         }
         return this.requestAll(url, data, header, 'DELETE')
     }
@@ -41,8 +49,11 @@ class request {
      * PUT类型的网络请求
      */
     static putRequest(url, data, header = this.HEAD ) {
-        if (!this.HEAD.token){
-            header.token = wx.getStorageSync('token')
+        const token = wx.getStorageSync('token')
+        if (token) {
+            header.token = token
+        }else {
+            header.token = header.defaultToken
         }
         return this.requestAll(url, data, header, 'PUT')
     }
@@ -51,15 +62,21 @@ class request {
      * POST类型的网络请求
      */
     static postRequest(url, data, header = this.HEAD) {
-        if (!this.HEAD.token){
-            header.token = wx.getStorageSync('token')
+        const token = wx.getStorageSync('token')
+        if (token) {
+            header.token = token
+        }else {
+            header.token = header.defaultToken
         }
         return this.requestAll(url, data, header, 'POST')
     }
 
     static upload(url, name, path, ortherData, header = this.HEAD){
-        if (!this.HEAD.token){
-            header.token = wx.getStorageSync('token')
+        const token = wx.getStorageSync('token')
+        if (token) {
+            header.token = token
+        }else {
+            header.token = header.defaultToken
         }
         return new Promise((resolve, reject) => {
             wx.uploadFile({
@@ -79,6 +96,9 @@ class request {
                                 title: res.data.message,
                             })
                         }
+                        if (res.data.code === 901) {
+                            _self.HEAD.token = ''
+                        }
                         //其它错误,提示用户错误信息
                         if (this._errorHandler != null) {
                             //如果有统一的异常处理,就先调用统一异常处理函数对异常进行处理
@@ -123,8 +143,8 @@ class request {
                                 title: res.data.message,
                             })
                         }
-                        if (res.data.code === 901){
-                            console.log(res.data)
+                        if (res.data.code === 901) {
+                            _self.HEAD.token = ''
                         }
                         //其它错误,提示用户错误信息
                         if (this._errorHandler != null) {