Procházet zdrojové kódy

家教小程序前端——首页和登录完成8.16

Eric před 2 roky
rodič
revize
2b1720f0ee

+ 12 - 13
app.js

@@ -60,17 +60,17 @@ App({
         wx.hideToast()
       }
     })
-    WXAPI.queryConfigBatch('mallName,WITHDRAW_MIN,ALLOW_SELF_COLLECTION,order_hx_uids,subscribe_ids,share_profile,adminUserIds,goodsDetailSkuShowType,shopMod,needIdCheck,balance_pay_pwd,shipping_address_gps,shipping_address_region_level,shopping_cart_vop_open,cps_open,recycle_open,categoryMod,hide_reputation,show_seller_number,show_goods_echarts,show_buy_dynamic,goods_search_show_type,show_3_seller,show_quan_exchange_score,show_score_exchange_growth,show_score_sign,fx_subscribe_ids,share_pic,orderPeriod_open,order_pay_user_balance,wxpay_api_url,sphpay_open,fx_type').then(res => {
-      if (res.code == 0) {
-        res.data.forEach(config => {
-          wx.setStorageSync(config.key, config.value);
-        })
-        if (this.configLoadOK) {
-          this.configLoadOK()
-        }
-        // wx.setStorageSync('shopMod', '1') // 测试用,不要取消注释
-      }
-    })
+    // WXAPI.queryConfigBatch('mallName,WITHDRAW_MIN,ALLOW_SELF_COLLECTION,order_hx_uids,subscribe_ids,share_profile,adminUserIds,goodsDetailSkuShowType,shopMod,needIdCheck,balance_pay_pwd,shipping_address_gps,shipping_address_region_level,shopping_cart_vop_open,cps_open,recycle_open,categoryMod,hide_reputation,show_seller_number,show_goods_echarts,show_buy_dynamic,goods_search_show_type,show_3_seller,show_quan_exchange_score,show_score_exchange_growth,show_score_sign,fx_subscribe_ids,share_pic,orderPeriod_open,order_pay_user_balance,wxpay_api_url,sphpay_open,fx_type').then(res => {
+    //   if (res.code == 0) {
+    //     res.data.forEach(config => {
+    //       wx.setStorageSync(config.key, config.value);
+    //     })
+    //     if (this.configLoadOK) {
+    //       this.configLoadOK()
+    //     }
+    //     // wx.setStorageSync('shopMod', '1') // 测试用,不要取消注释
+    //   }
+    // })
     // ---------------检测navbar高度
     let menuButtonObject = wx.getMenuButtonBoundingClientRect();
     console.log("小程序胶囊信息",menuButtonObject)
@@ -121,14 +121,13 @@ App({
         })
       }
     }
-    // 自动登录
+    自动登录
     AUTH.checkHasLogined().then(isLogined => {
       if (!isLogined) {
         AUTH.authorize().then( aaa => {
           AUTH.bindSeller()
         })
       } else {
-        
         AUTH.bindSeller()
       }
     })

+ 21 - 11
miniprogram_npm/apifm-wxapi/index.js

@@ -95,7 +95,7 @@ module.exports =
 /* eslint-disable */
 // 小程序开发api接口工具包,https://github.com/gooking/wxapi
 // var API_BASE_URL = 'https://api.it120.cc';
-var API_BASE_URL = 'http://127.0.0.1:8888';
+var API_BASE_URL = 'http://127.0.0.1:8088';
 var subDomain = '-';
 var merchantId = '0';
 
@@ -231,7 +231,7 @@ module.exports = {
     });
   },
   kanjiaSet: function kanjiaSet(goodsId) {
-    return request('/shop/goods/kanjia/set/v2', true, 'get', { goodsId: goodsId });
+    return request('/api/user/shop/goods/kanjia/set/v2', true, 'get', { goodsId: goodsId });
   },
   kanjiaJoin: function kanjiaJoin(token, kjid) {
     return request('/shop/goods/kanjia/join', true, 'post', {
@@ -275,7 +275,7 @@ module.exports = {
     });
   },
   checkToken: function checkToken(token) {
-    return request('/user/check-token', true, 'get', {
+    return request('/login-server/login/check-token', false, 'get', {
       token: token
     });
   },
@@ -397,7 +397,7 @@ module.exports = {
     return request('/user/wxapp/register/simple', true, 'post', data);
   },
   authorize: function authorize(data) {
-    return request('/api/user/authorize', true, 'post', data);
+    return request('/login-server/login/authorize', false, 'post', data);
   },
   register_username: function register_username(data) {
     return request('/user/username/register', true, 'post', data);
@@ -406,7 +406,7 @@ module.exports = {
     return request('/user/m/register', true, 'post', data);
   },
   banners: function banners(data) {
-    return request('/banner/list', true, 'get', data);
+    return request('/page-server/page/bannerAndLBT', false, 'get',data);
   },
   goodsCategory: function goodsCategory() {
     return request('/shop/goods/category/all', true, 'get');
@@ -428,11 +428,21 @@ module.exports = {
     if (!data) {
       data = {}
     }
-    const shopIds = wx.getStorageSync('shopIds')
-    if (shopIds) {
-      data.shopId = shopIds
+    // const shopIds = wx.getStorageSync('shopIds')
+    // if (shopIds) {
+    //   data.shopId = shopIds
+    // }
+    return request('/page-server/page/getNearTeachers', false, 'post', data)
+  },
+  refreshNearTeacherList: (data) => {
+    if (!data) {
+      data = {}
     }
-    return request('/shop/goods/list/v2', true, 'post', data)
+    // const shopIds = wx.getStorageSync('shopIds')
+    // if (shopIds) {
+    //   data.shopId = shopIds
+    // }
+    return request('/page-server/page/refreshNearTeachers', false, 'post', data)
   },
   goodsDetail: function goodsDetail(id) {
     var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
@@ -690,7 +700,7 @@ module.exports = {
     });
   },
   userDetail: function userDetail(token) {
-    return request('/user/detail', true, 'get', {
+    return request('/user-server/user/detail', false, 'get', {
       token: token
     });
   },
@@ -1038,7 +1048,7 @@ module.exports = {
     return request('/comment/list', true, 'post', data);
   },
   modifyUserInfo: function modifyUserInfo(data) {
-    return request('/user/modify', true, 'post', data);
+    return request('/user-server/user/loginAndModifyUserInfo', false, 'get', data);
   },
   bindSaleman: function bindSaleman(token, uid) {
     return request('/user/bindSaleman', true, 'post', data);

+ 1 - 0
packageFx/pages/hehuorenfenxiao/fxmember.js

@@ -37,6 +37,7 @@ Page({
       })
     }
     AUTH.checkHasLogined().then(isLogined => {
+      console.log("用到了1")
       this.setData({
         wxlogin: isLogined
       })

+ 1 - 0
pages/goods-details/vop.js

@@ -70,6 +70,7 @@ Page({
     // 静默式授权注册/登陆
     AUTH.checkHasLogined().then(isLogined => {
       if (!isLogined) {
+        console.log("原来是你")
         AUTH.authorize().then( aaa => {
           AUTH.bindSeller()
         })

+ 1 - 0
pages/goods/fav.js

@@ -8,6 +8,7 @@ Page({
   },
   onShow: function () {
     AUTH.checkHasLogined().then(isLogined => {
+      console.log("用到了1")
       this.setData({
         wxlogin: isLogined
       })

+ 254 - 156
pages/index/index.js

@@ -17,24 +17,26 @@ Page({
     loadingMoreHidden: true,
     coupons: [],
     curPage: 1,
-    pageSize: 20
-  },
-  tabClick(e) {
-    // 商品分类点击
-    const category = this.data.categories.find(ele => {
-      return ele.id == e.currentTarget.dataset.id
-    })
-    if (category.vopCid1 || category.vopCid2) {
-      wx.navigateTo({
-        url: '/pages/goods/list-vop?cid1=' + (category.vopCid1 ? category.vopCid1 : '') + '&cid2=' + (category.vopCid2 ? category.vopCid2 : ''),
-      })
-    } else {
-      wx.setStorageSync("_categoryId", category.id)
-      wx.switchTab({
-        url: '/pages/category/category',
-      })
-    }
+    pageSize: 20,
+    province: "XX省",
+    city:"XX市"
   },
+  // tabClick(e) {
+  //   // 商品分类点击
+  //   const category = this.data.categories.find(ele => {
+  //     return ele.id == e.currentTarget.dataset.id
+  //   })
+  //   if (category.vopCid1 || category.vopCid2) {
+  //     wx.navigateTo({
+  //       url: '/pages/goods/list-vop?cid1=' + (category.vopCid1 ? category.vopCid1 : '') + '&cid2=' + (category.vopCid2 ? category.vopCid2 : ''),
+  //     })
+  //   } else {
+  //     wx.setStorageSync("_categoryId", category.id)
+  //     wx.switchTab({
+  //       url: '/pages/category/category',
+  //     })
+  //   }
+  // },
   tabClickCms(e) {
     // 文章分类点击
     const category = this.data.cmsCategories[e.currentTarget.dataset.idx]
@@ -91,6 +93,30 @@ Page({
     })
   },
   onLoad: function(e) {
+    wx.request({
+      url: 'https://pv.sohu.com/cityjson?ie=utf-8',
+      success(res){
+        let data = JSON.parse(res.data.split("=")[1].split(";")[0]);
+        let ip = data.cip;
+        wx.setStorageSync("ip",ip);
+        //通过ip获取当前经纬度
+        wx.request({
+          url: 'https://apis.map.qq.com/ws/location/v1/ip?ip='+ip+'&key=J5JBZ-3H5K3-ZHU3J-3XC2W-2NYPK-75FG4',
+          method: 'GET',
+          header: {
+            'content-type': 'application/x-www-form-urlencoded'
+          },
+          success: function (res) {
+            wx.setStorageSync("lat",res.data.result.location.lat);
+            wx.setStorageSync("lng",res.data.result.location.lng);
+            that.setData({
+                    province: res.data.result.ad_info.province,
+                    city:res.data.result.ad_info.city
+                  })
+          }
+        });
+      }
+    })
     wx.showShareMenu({
       withShareTicket: true,
     })
@@ -112,65 +138,69 @@ Page({
         AUTH.authorize().then( aaa => {
           AUTH.bindSeller()
           TOOLS.showTabBarBadge()
+          that.kanjiaGoods()
         })
       } else {
         AUTH.bindSeller()
         TOOLS.showTabBarBadge()
+        that.kanjiaGoods()
       }
     })
     this.initBanners()
-    this.categories()
-    this.cmsCategories()
+    // this.categories()
+    // this.cmsCategories()
     // https://www.yuque.com/apifm/nu0f75/wg5t98
-    WXAPI.goodsv2({
-      recommendStatus: 1
-    }).then(res => {
-      if (res.code === 0){
-        that.setData({
-          goodsRecommend: res.data.result
-        })
-      }      
-    })
-    that.getCoupons()
-    that.getNotice()
-    that.kanjiaGoods()
-    that.pingtuanGoods()
-    this.adPosition()
+
+    // WXAPI.goodsv2({
+    //   recommendStatus: 1
+    // }).then(res => {
+    //   if (res.code === 0){
+    //     that.setData({
+    //       goodsRecommend: res.data.result
+    //     })
+    //   }      
+    // })
+
+    // that.getCoupons()
+    // that.getNotice()
+    
+    // that.pingtuanGoods()
+    // this.adPosition()
     // 读取系统参数
-    this.readConfigVal()
-    getApp().configLoadOK = () => {
-      this.readConfigVal()
-    }
-  },
-  readConfigVal() {
-    wx.setNavigationBarTitle({
-      title: wx.getStorageSync('mallName')
-    })
-    this.setData({
-      mallName:wx.getStorageSync('mallName')?wx.getStorageSync('mallName'):'',
-      show_buy_dynamic: wx.getStorageSync('show_buy_dynamic')
-    })
-  },
-  async miaoshaGoods(){
-    // https://www.yuque.com/apifm/nu0f75/wg5t98
-    const res = await WXAPI.goodsv2({
-      miaosha: true
-    })
-    if (res.code == 0) {
-      res.data.result.forEach(ele => {
-        const _now = new Date().getTime()
-        if (ele.dateStart) {
-          ele.dateStartInt = new Date(ele.dateStart.replace(/-/g, '/')).getTime() - _now
-        }
-        if (ele.dateEnd) {
-          ele.dateEndInt = new Date(ele.dateEnd.replace(/-/g, '/')).getTime() -_now
-        }
-      })
-      this.setData({
-        miaoshaGoods: res.data.result
-      })
-    }
+    // this.readConfigVal()
+    // getApp().configLoadOK = () => {
+    //   this.readConfigVal()
+    // }
   },
+  // readConfigVal() {
+  //   wx.setNavigationBarTitle({
+  //     title: wx.getStorageSync('mallName')
+  //   })
+  //   this.setData({
+  //     mallName:wx.getStorageSync('mallName')?wx.getStorageSync('mallName'):'',
+  //     show_buy_dynamic: wx.getStorageSync('show_buy_dynamic')
+  //   })
+  // },
+  // async miaoshaGoods(){
+  //   // https://www.yuque.com/apifm/nu0f75/wg5t98
+  //   const res = await WXAPI.goodsv2({
+  //     miaosha: true
+  //   })
+  //   if (res.code == 0) {
+  //     res.data.result.forEach(ele => {
+  //       const _now = new Date().getTime()
+  //       if (ele.dateStart) {
+  //         ele.dateStartInt = new Date(ele.dateStart.replace(/-/g, '/')).getTime() - _now
+  //       }
+  //       if (ele.dateEnd) {
+  //         ele.dateEndInt = new Date(ele.dateEnd.replace(/-/g, '/')).getTime() -_now
+  //       }
+  //     })
+  //     this.setData({
+  //       miaoshaGoods: res.data.result
+  //     })
+  //   }
+  // },
   async initBanners(){
     const _data = {}
     // 读取头部轮播图
@@ -200,73 +230,73 @@ Page({
     })
     // 获取购物车数据,显示TabBarBadge
     TOOLS.showTabBarBadge()
-    this.goodsDynamic()
-    this.miaoshaGoods()
+    // this.goodsDynamic()
+    // this.miaoshaGoods()
     const refreshIndex = wx.getStorageSync('refreshIndex')
     if (refreshIndex) {
       this.onPullDownRefresh()
       wx.removeStorageSync('refreshIndex')
     }
   },
-  async goodsDynamic(){
-    const res = await WXAPI.goodsDynamic(0)
-    if (res.code == 0) {
-      this.setData({
-        goodsDynamic: res.data
-      })
-    }
-  },
-  async categories(){
-    const res = await WXAPI.goodsCategory()
-    let categories = [];
-    if (res.code == 0) {
-      const _categories = res.data.filter(ele => {
-        return ele.level == 1
-      })
-      categories = categories.concat(_categories)
-    }
-    this.setData({
-      categories: categories,
-      curPage: 1
-    });
-    this.getGoodsList(0);
-  },
-  async getGoodsList(categoryId, append) {
-    if (categoryId == 0) {
-      categoryId = "";
-    }
-    wx.showLoading({
-      "mask": true
-    })
-    // https://www.yuque.com/apifm/nu0f75/wg5t98
-    const res = await WXAPI.goodsv2({
-      categoryId: categoryId,
-      page: this.data.curPage,
-      pageSize: this.data.pageSize
-    })
-    wx.hideLoading()
-    if (res.code == 404 || res.code == 700) {
-      let newData = {
-        loadingMoreHidden: false
-      }
-      if (!append) {
-        newData.goods = []
-      }
-      this.setData(newData);
-      return
-    }
-    let goods = [];
-    if (append) {
-      goods = this.data.goods
-    }
-    for (var i = 0; i < res.data.result.length; i++) {
-      goods.push(res.data.result[i]);
-    }
-    this.setData({
-      loadingMoreHidden: true,
-      goods: goods,
-    });
-  },
+  // async goodsDynamic(){
+  //   const res = await WXAPI.goodsDynamic(0)
+  //   if (res.code == 0) {
+  //     this.setData({
+  //       goodsDynamic: res.data
+  //     })
+  //   }
+  // },
+  // async categories(){
+  //   const res = await WXAPI.goodsCategory()
+  //   let categories = [];
+  //   if (res.code == 0) {
+  //     const _categories = res.data.filter(ele => {
+  //       return ele.level == 1
+  //     })
+  //     categories = categories.concat(_categories)
+  //   }
+  //   this.setData({
+  //     categories: categories,
+  //     curPage: 1
+  //   });
+    // this.getGoodsList(0);
+  // },
+  // async getGoodsList(categoryId, append) {
+  //   if (categoryId == 0) {
+  //     categoryId = "";
+  //   }
+  //   wx.showLoading({
+  //     "mask": true
+  //   })
+  //   // https://www.yuque.com/apifm/nu0f75/wg5t98
+  //   const res = await WXAPI.goodsv2({
+  //     categoryId: categoryId,
+  //     page: this.data.curPage,
+  //     pageSize: this.data.pageSize
+  //   })
+  //   wx.hideLoading()
+  //   if (res.code == 404 || res.code == 700) {
+  //     let newData = {
+  //       loadingMoreHidden: false
+  //     }
+  //     if (!append) {
+  //       newData.goods = []
+  //     }
+  //     this.setData(newData);
+  //     return
+  //   }
+  //   let goods = [];
+  //   if (append) {
+  //     goods = this.data.goods
+  //   }
+  //   for (var i = 0; i < res.data.result.length; i++) {
+  //     goods.push(res.data.result[i]);
+  //   }
+  //   this.setData({
+  //     loadingMoreHidden: true,
+  //     goods: goods,
+  //   });
+  // },
   getCoupons: function() {
     var that = this;
     WXAPI.coupons().then(function (res) {
@@ -303,35 +333,103 @@ Page({
     this.setData({
       curPage: 1
     });
-    this.getGoodsList(0)
+    this.kanjiaGoodsRefresh()
+    // this.kanjiaGoods()
     wx.stopPullDownRefresh()
   },
-  // 获取砍价商品
+  // 获取热门教员
   async kanjiaGoods(){
     // https://www.yuque.com/apifm/nu0f75/wg5t98
     const res = await WXAPI.goodsv2({
-      kanjia: true
+      lat:wx.getStorageSync('lat'),
+      lng:wx.getStorageSync('lng'),
+      ip:wx.getStorageSync('ip'),
+      token:wx.getStorageSync('token')
     });
     if (res.code == 0) {
       const kanjiaGoodsIds = []
-      res.data.result.forEach(ele => {
+      res.data.forEach(ele => {
         kanjiaGoodsIds.push(ele.id)
       })
-      const goodsKanjiaSetRes = await WXAPI.kanjiaSet(kanjiaGoodsIds.join())
-      if (goodsKanjiaSetRes.code == 0) {
-        res.data.result.forEach(ele => {
-          const _process = goodsKanjiaSetRes.data.find(_set => {
-            return _set.goodsId == ele.id
-          })
-          if (_process) {
-            ele.process = 100 * _process.numberBuy / _process.number
-            ele.process = ele.process.toFixed(0)
-          }
-        })
+      // const goodsKanjiaSetRes = await WXAPI.kanjiaSet()
         this.setData({
-          kanjiaList: res.data.result
+          kanjiaList: res.data
         })
-      }
+    }else{
+      wx.showToast({
+        title: res.msg,
+        icon:"error",
+        duration: 2000
+      })
+    }
+  },
+  // 获取热门教员
+  async kanjiaGoodsRefresh(){
+    const _this = this
+    // https://www.yuque.com/apifm/nu0f75/wg5t98
+    const res = await WXAPI.refreshNearTeacherList({
+      lat:wx.getStorageSync('lat'),
+      lng:wx.getStorageSync('lng'),
+      ip:wx.getStorageSync('ip'),
+      token:wx.getStorageSync('token')
+    });
+    if (res.code == 0) {
+      wx.request({
+        url: 'https://pv.sohu.com/cityjson?ie=utf-8',
+        success(res){
+          let data = JSON.parse(res.data.split("=")[1].split(";")[0]);
+          let ip = data.cip;
+          wx.setStorageSync("ip",ip);
+          //通过ip获取当前经纬度
+          wx.request({
+            url: 'https://apis.map.qq.com/ws/location/v1/ip?ip='+ip+'&key=J5JBZ-3H5K3-ZHU3J-3XC2W-2NYPK-75FG4',
+            method: 'GET',
+            header: {
+              'content-type': 'application/x-www-form-urlencoded'
+            },
+            success: function (res) {
+              wx.setStorageSync("lat",res.data.result.location.lat);
+              wx.setStorageSync("lng",res.data.result.location.lng);
+
+              WXAPI.goodsv2({
+                lat:res.data.result.location.lat,
+                lng:res.data.result.location.lng,
+                ip:ip,
+                token:wx.getStorageSync('token')
+              }).then(res1 => {
+                if (res1.code == 0) {
+                  const kanjiaGoodsIds = []
+                  res1.data.forEach(ele => {
+                    kanjiaGoodsIds.push(ele.id)
+                  })
+                  // const goodsKanjiaSetRes = await WXAPI.kanjiaSet()
+                  _this.setData({
+                      kanjiaList: res1.data
+                    })
+                    wx.showToast({
+                      title: "刷新成功",
+                      duration: 2000
+                    })
+                }
+              })
+              that.setData({
+                      province: res.data.result.ad_info.province,
+                      city:res.data.result.ad_info.city
+                    })
+            }
+          });
+        }
+      })
+        that.setData({
+          province: res.data.result.ad_info.province,
+          city:res.data.result.ad_info.city
+        })
+    }else{
+      wx.showToast({
+        title: "刷新失败",
+        icon:"error",
+        duration: 2000
+      })
     }
   },
   goCoupons: function (e) {
@@ -339,19 +437,19 @@ Page({
       url: "/pages/coupons/index"
     })
   },
-  pingtuanGoods(){ // 获取团购商品列表
-    const _this = this
+  // pingtuanGoods(){ // 获取团购商品列表
+  //   const _this = this
     // https://www.yuque.com/apifm/nu0f75/wg5t98
-    WXAPI.goodsv2({
-      pingtuan: true
-    }).then(res => {
-      if (res.code === 0) {
-        _this.setData({
-          pingtuanList: res.data.result
-        })
-      }
-    })
-  },
+    // WXAPI.goodsv2({
+    //   pingtuan: true
+    // }).then(res => {
+    //   if (res.code === 0) {
+    //     _this.setData({
+    //       pingtuanList: res.data.result
+    //     })
+    //   }
+    // })
+  // },
   goSearch(){
     wx.navigateTo({
       url: '/pages/search/index'

+ 35 - 29
pages/index/index.wxml

@@ -3,7 +3,8 @@
   <view class="search" style="height:{{navHeight}}px;padding-top:{{navTop}}px">
     <view class="search-title" src="../../images/actLogo/ytlogo.png"
       style="height:{{navHeight-navTop-5}}px;line-height:{{navHeight-navTop-5}}px;width:{{132/52*(navHeight-navTop-5)}}px;">
-      {{mallName}}
+      自选教员
+      <!-- {{mallName}} -->
     </view>
     <input placeholder-class="search-placeholder"
       style="width:{{menuButtonObject.left-18-((132/52)*(navHeight-navTop-5))}}px" type="text" placeholder="输入关键词搜索" disabled
@@ -11,7 +12,10 @@
   </view>
 </view>
 </van-sticky>
-<navigator wx:if="{{shopInfo}}" url="/pages/shop/select">
+<van-divider custom-class="table-text" contentPosition="center">
+      <image class="table-icon-kanjia" src="../../images/order-details/icon-address.png"></image>{{province}}   {{city}}
+    </van-divider>
+<!-- <navigator wx:if="{{shopInfo}}" url="/pages/shop/select">
   <view class="shops-container">
     <view class="l">
       <image src="/images/order-details/icon-address.png"></image>
@@ -22,7 +26,7 @@
       <image src="/images/icon/next.png"></image>
     </view>
   </view>
-</navigator>
+</navigator> -->
 <wxs module="goodsDetailPage">
 module.exports = {
   url : function(item) {
@@ -59,7 +63,7 @@ module.exports = {
     </swiper>
   </view>
 </view>
-<view class="category-container">
+<!-- <view class="category-container">
   <view class="category-box">
     <view class="category-list" wx:for="{{categories}}" wx:key="id">
       <view class="category-column" bindtap="tabClick"
@@ -76,8 +80,8 @@ module.exports = {
       </view>
     </view>
   </view>
-</view>
-<view class="notice-box" wx:if="{{noticeList}}">
+</view> -->
+<!-- <view class="notice-box" wx:if="{{noticeList}}">
   <swiper class="notice_swiper" vertical autoplay circular interval="8000">
     <swiper-item wx:for="{{noticeList.dataList}}" wx:key="id">
       <van-notice-bar wx:if="{{noticeList}}" mode="link" text="{{ item.title }}" background="#FFFFFF"
@@ -86,11 +90,12 @@ module.exports = {
       </van-notice-bar>
     </swiper-item>
   </swiper>
-</view>
+</view> -->
+
 <view class="container">
-  <image wx:if="{{ adPositionIndexLivePic }}" class="live-banner" src="{{ adPositionIndexLivePic.val }}" mode="widthFix" bindtap="clickAdPositionIndexLive"></image>
+  <!-- <image wx:if="{{ adPositionIndexLivePic }}" class="live-banner" src="{{ adPositionIndexLivePic.val }}" mode="widthFix" bindtap="clickAdPositionIndexLive"></image> -->
   <!-- 秒杀开始 -->
-  <block wx:if="{{miaoshaGoods && miaoshaGoods.length > 0}}">
+  <!-- <block wx:if="{{miaoshaGoods && miaoshaGoods.length > 0}}">
     <van-divider custom-class="table-text" contentPosition="center">
       <image class="table-icon-miaosha" src="../../images/home/miaosha.png"></image> 限时秒杀
     </van-divider>
@@ -121,10 +126,10 @@ module.exports = {
         </view>
       </view>
     </view>
-  </block>
+  </block> -->
   <!-- 秒杀结束 -->
 
-  <view class="space"></view>
+  <!-- <view class="space"></view>
   <van-divider custom-class="table-text" wx:if="{{goodsRecommend.length > 0}}"
     contentPosition="center">
     <image class="table-icon-tuijian" src="../../images/home/recommend.png"></image> 爆品推荐
@@ -142,25 +147,26 @@ module.exports = {
           style='color:#aaa;text-decoration:line-through'>¥ {{item.originalPrice}}</view>
       </view>
     </view>
+  </view> -->
+  <view class="space"></view>
+  <view class="kanjia-container">
+    <van-divider custom-class="table-text" contentPosition="center">
+      <image class="table-icon-kanjia" src="../../images/home/recommend.png"></image> 热门教员
+    </van-divider>
+    <van-card custom-class="kanjia-vcard" currency="距你" wx:for="{{kanjiaList}}" wx:key="id" tag="{{item.picTag}}" price=" {{item.distance}} km"
+       desc="{{item.characteristic}}" title="{{item.trueNameLast}}老师" thumb="{{item.profilePhotoPath}}">
+    </van-card>
   </view>
   <view class="space"></view>
-  <view wx-if="{{kanjiaList.length > 0}}"
-    class="kanjia-container">
+  <view class="kanjia-container">
     <van-divider custom-class="table-text" contentPosition="center">
-      <image class="table-icon-kanjia" src="../../images/home/kanjia.png"></image> 疯狂砍价
+      <image class="table-icon-kanjia" src="../../images/home/recommend.png"></image> 附近学生
     </van-divider>
-    <van-card custom-class="kanjia-vcard" wx:for="{{kanjiaList}}" wx:key="id" price="{{item.kanjiaPrice}}"
-      origin-price="{{item.originalPrice}}" desc="{{item.characteristic}}" title="{{item.name}}" thumb="{{item.pic}}">
-      <view slot="footer">
-        <van-button custom-class="kjbtn" type="danger" size="small" data-id="{{item.id}}" data-supplytype="{{item.supplyType}}" data-yyid="{{item.yyId}}" bind:click="toDetailsTap">砍价
-        </van-button>
-      </view>
-      <view slot="price-top">
-        <van-progress custom-class="vprogress" percentage="{{item.process}}" color="#FDEDED;" />
-      </view>
+    <van-card custom-class="kanjia-vcard" currency="距你" wx:for="{{kanjiaList}}" wx:key="id" tag="{{item.picTag}}" price=" {{item.distance}} km"
+       desc="{{item.characteristic}}" title="{{item.name}}" thumb="{{item.pic}}">
     </van-card>
   </view>
-  <block wx:if="{{pingtuanList.length > 0}}">
+  <!-- <block wx:if="{{pingtuanList.length > 0}}">
     <view class='space'></view>
     <van-divider custom-class="table-text" contentPosition="center">
       <image class="table-icon-pingtuan" src="../../images/home/pingtuan.png"></image> 全民拼团
@@ -182,11 +188,11 @@ module.exports = {
         </view>
       </view>
     </view>
-  </block>
+  </block> -->
 
-  <view class='space'></view>
-  <van-divider custom-class="table-text" contentPosition="center">
-    <image class="table-icon-goodslist" src="../../images/home/goodslist.png"></image> 商品列表
+  <!-- <view class='space'></view> -->
+  <!-- <van-divider custom-class="table-text" contentPosition="center">
+    <image class="table-icon-goodslist" src="../../images/home/recommend.png"></image> 热门教员
   </van-divider>
   <view class="goods-container">
     <view class="goods-box" wx:for="{{goods}}" wx:key="id" bindtap="toDetailsTap" data-id="{{item.id}}" data-supplytype="{{item.supplyType}}" data-yyid="{{item.yyId}}">
@@ -202,7 +208,7 @@ module.exports = {
       </view>
     </view>
   </view>
-  <van-divider wx:if="{{ !loadingMoreHidden }}" contentPosition="center">没有更多啦</van-divider>
+  <van-divider wx:if="{{ !loadingMoreHidden }}" contentPosition="center">没有更多啦</van-divider> -->
 </view>
 <view class='coupons-float' bindtap="goCoupons">
   <image src="/images/gift.png"></image>

+ 12 - 0
pages/index/index.wxss

@@ -1,3 +1,15 @@
+/* 金额/虚拟价格 - 上浮 */
+.van-card__bottom{
+  padding-bottom: 80rpx!important;
+}
+
+/* 调整图像大小(最好用百分比) */
+.van-card__img{
+  width: 80%!important;
+  height: 80%!important;
+}
+
+
 .search-container {
   background-color: white;
 }

+ 40 - 37
pages/my/index.js

@@ -20,30 +20,30 @@ Page({
     // 判断有没有用户详细资料
     userInfoStatus: 0 // 0 未读取 1 没有详细信息 2 有详细信息
   },
-	onLoad() {
-    this.readConfigVal()
-    // 补偿写法
-    getApp().configLoadOK = () => {
-      this.readConfigVal()
-    }
-	},
+	// onLoad() {
+  //   this.readConfigVal()
+  //   // 补偿写法
+  //   getApp().configLoadOK = () => {
+  //     this.readConfigVal()
+  //   }
+	// },
   onShow() {
     const _this = this
     AUTH.checkHasLogined().then(isLogined => {
       if (isLogined) {
         _this.getUserApiInfo();
-        _this.getUserAmount();
-        _this.orderStatistics();
-        _this.cardMyList();
-        TOOLS.showTabBarBadge();
+        // _this.getUserAmount();
+        // _this.orderStatistics();
+        // _this.cardMyList();
+        // TOOLS.showTabBarBadge();
       } else {
         AUTH.authorize().then(res => {
           AUTH.bindSeller()
           _this.getUserApiInfo();
-          _this.getUserAmount();
-          _this.orderStatistics();
-          _this.cardMyList();
-          TOOLS.showTabBarBadge();
+          // _this.getUserAmount();
+          // _this.orderStatistics();
+          // _this.cardMyList();
+          // TOOLS.showTabBarBadge();
         })
       }
     })
@@ -65,30 +65,35 @@ Page({
   },
   async getUserApiInfo() {
     const res = await WXAPI.userDetail(wx.getStorageSync('token'))
-    if (res.code == 0) {
+    if (res.code == "0") {
       let _data = {}
       _data.apiUserInfoMap = res.data
-      if (res.data.base.mobile) {
-        _data.userMobile = res.data.base.mobile
+      if (res.data.mobile) {
+        _data.userMobile = res.data.mobile
       }
-      if (res.data.base.nick && res.data.base.avatarUrl) {
+      if (res.data.alias && res.data.avatar) {
         _data.userInfoStatus = 2
       } else {
         _data.userInfoStatus = 1
       }
-      if (this.data.order_hx_uids && this.data.order_hx_uids.indexOf(res.data.base.id) != -1) {
-        _data.canHX = true // 具有扫码核销的权限
-      }
-      const adminUserIds = wx.getStorageSync('adminUserIds')
-      if (adminUserIds && adminUserIds.indexOf(res.data.base.id) != -1) {
-        _data.isAdmin = true
-      }
-      if (res.data.peisongMember && res.data.peisongMember.status == 1) {
-        _data.memberChecked = false
-      } else {
-        _data.memberChecked = true
-      }
+      // if (this.data.order_hx_uids && this.data.order_hx_uids.indexOf(res.data.base.id) != -1) {
+      //   _data.canHX = true // 具有扫码核销的权限
+      // }
+      // const adminUserIds = wx.getStorageSync('adminUserIds')
+      // if (adminUserIds && adminUserIds.indexOf(res.data.base.id) != -1) {
+      //   _data.isAdmin = true
+      // }
+      // if (res.data.peisongMember && res.data.peisongMember.status == 1) {
+      //   _data.memberChecked = false
+      // } else {
+      //   _data.memberChecked = true
+      // }
       this.setData(_data);
+    }else{
+      wx.showToast({
+        title: res.msg,
+        icon: 'none'
+      })
     }
   },
   async memberCheckedChange() {
@@ -173,7 +178,7 @@ Page({
       lang: 'zh_CN',
       desc: '用于完善会员资料',
       success: res => {
-        console.log(res);
+        // console.log(res);
         this._updateUserInfo(res.userInfo)
       },
       fail: err => {
@@ -188,11 +193,9 @@ Page({
   async _updateUserInfo(userInfo) {
     const postData = {
       token: wx.getStorageSync('token'),
-      nick: userInfo.nickName,
-      avatarUrl: userInfo.avatarUrl,
-      city: userInfo.city,
-      province: userInfo.province,
-      gender: userInfo.gender,
+      openid: wx.getStorageSync('openid'),
+      alias: userInfo.nickName,
+      avatarUrl: userInfo.avatarUrl
     }
     const res = await WXAPI.modifyUserInfo(postData)
     if (res.code != 0) {

+ 1 - 1
pages/my/index.json

@@ -1,3 +1,3 @@
 {
-  "navigationBarTitleText": "会员中心"
+  "navigationBarTitleText": "个人中心"
 }

+ 4 - 3
pages/my/index.wxml

@@ -11,10 +11,11 @@
 </block>
 <block wx:if="{{ userInfoStatus == 2 }}">
   <view class="header-box">
-    <image class="avatar" src="{{ apiUserInfoMap.base.avatarUrl }}" mode="aspectFill"></image>
+    <image class="avatar" src="{{ apiUserInfoMap.avatar }}" mode="aspectFill"></image>
     <view class="r">
-      <view class="uid">用户ID: {{ apiUserInfoMap.base.id }}</view>
-      <view class="nick">{{ apiUserInfoMap.base.nick }}</view>
+      <view class="uid">用户ID: {{ apiUserInfoMap.uid }}</view>
+      <view class="nick">昵称:{{ apiUserInfoMap.alias }}</view>
+      <view class="nick">上次登录:{{ apiUserInfoMap.last_login_datetime }}</view>
     </view>
   </view>
   <view class="asset">

+ 33 - 33
pages/my/info.js

@@ -83,39 +83,39 @@ Page({
       this.setData(_data)
     }
   },
-  async formSubmit(e) {
-    console.log(e);
-    const postData = {
-      token: wx.getStorageSync('token'),
-      nick: this.data.nick
-    }
-    if (this.data.avatarUrlTmpFile) {
-      const res = await WXAPI.uploadFile(wx.getStorageSync('token'), this.data.avatarUrlTmpFile)
-      if (res.code == 0) {
-        postData.avatarUrl = res.data.url
-      }
-    }
-    if (this.data.genderIndex != -1) {
-      postData.gender = this.data.genderIndex*1 + 1
-    }
-    postData.extJsonStr = JSON.stringify(e.detail.value)
-    console.log(postData);
-    const res = await WXAPI.modifyUserInfo(postData)
-    if (res.code != 0) {
-      wx.showToast({
-        title: res.msg,
-        icon: 'none'
-      })
-    }
-    wx.showToast({
-      title: '编辑成功',
-    })
-    setTimeout(() => {
-      wx.navigateBack({
-        delta: 0,
-      })
-    }, 1000);
-  },
+  // async formSubmit(e) {
+  //   console.log(e);
+  //   const postData = {
+  //     token: wx.getStorageSync('token'),
+  //     nick: this.data.nick
+  //   }
+  //   if (this.data.avatarUrlTmpFile) {
+  //     const res = await WXAPI.uploadFile(wx.getStorageSync('token'), this.data.avatarUrlTmpFile)
+  //     if (res.code == 0) {
+  //       postData.avatarUrl = res.data.url
+  //     }
+  //   }
+  //   if (this.data.genderIndex != -1) {
+  //     postData.gender = this.data.genderIndex*1 + 1
+  //   }
+  //   postData.extJsonStr = JSON.stringify(e.detail.value)
+  //   console.log(postData);
+  //   const res = await WXAPI.modifyUserInfo(postData)
+  //   if (res.code != 0) {
+  //     wx.showToast({
+  //       title: res.msg,
+  //       icon: 'none'
+  //     })
+  //   }
+  //   wx.showToast({
+  //     title: '编辑成功',
+  //   })
+  //   setTimeout(() => {
+  //     wx.navigateBack({
+  //       delta: 0,
+  //     })
+  //   }, 1000);
+  // },
   chooseImage() {
     const _this = this
     wx.chooseImage({

+ 1 - 1
project.config.json

@@ -42,7 +42,7 @@
   "compileType": "miniprogram",
   "libVersion": "2.22.1",
   "appid": "wx18ddfb7e334b966b",
-  "projectname": "天使童装",
+  "projectname": "龙哥到家",
   "simulatorType": "wechat",
   "simulatorPluginLibVersion": {},
   "condition": {

+ 7 - 8
utils/auth.js

@@ -32,14 +32,15 @@ async function bindSeller() {
 // 检测登录状态,返回 true / false
 async function checkHasLogined() {
   const token = wx.getStorageSync('token')
+  const openid = wx.getStorageSync('openid')
   if (!token) {
     return false
   }
-  const loggined = await checkSession()
-  if (!loggined) {
-    wx.removeStorageSync('token')
-    return false
-  }
+  // const loggined = await checkSession()
+  // if (!loggined) {
+  //   wx.removeStorageSync('token')
+  //   return false
+  // }
   const checkTokenRes = await WXAPI.checkToken(token)
   if (checkTokenRes.code != 0) {
     wx.removeStorageSync('token')
@@ -133,7 +134,6 @@ async function authorize() {
     wx.login({
       success: function (res) {
         const code = res.code
-        // console.log("!!!"+code)
         let referrer = '' // 推荐人
         let referrer_storge = wx.getStorageSync('referrer');
         if (referrer_storge) {
@@ -141,7 +141,6 @@ async function authorize() {
         }
         // 下面开始调用注册接口
         const extConfigSync = wx.getExtConfigSync()
-        // console.log(extConfigSync.subDomain)
         if (extConfigSync.subDomain) {
           WXAPI.wxappServiceAuthorize({
             code: code,
@@ -167,7 +166,7 @@ async function authorize() {
             // console.log(res.code)
             if (res.code == 0) {
               wx.setStorageSync('token', res.data.token)
-              wx.setStorageSync('uid', res.data.uid)
+              wx.setStorageSync('openid', res.data.openid)
               resolve(res)
             } else {
               wx.showToast({