瀏覽代碼

小程序:首页接口对接

panyong 2 年之前
父節點
當前提交
26da20ac6a

二進制
htmldev/wxMini/image/common/logo.png


+ 1 - 1
htmldev/wxMini/pages/businessDetail/businessDetail.js

@@ -23,7 +23,7 @@ Page({
         value: '2'
       }
     ],
-    active: '1',
+    active: '2',
     objShopDetail: {}
   },
   ...pages.methods,

+ 2 - 1
htmldev/wxMini/pages/businessDetail/businessDetail.json

@@ -3,7 +3,8 @@
     "customer-tab": "../../components/customer-tab/index",
     "goods-item-large": "../../components/goods-item-large",
     "van-loading": "@vant/weapp/loading/index",
-    "business-detail-large": "../../components/business-detail-large"
+    "business-detail-large": "../../components/business-detail-large",
+    "goods-item-normal": "../../components/goods-item-normal"
   },
   "backgroundTextStyle": "dark",
   "enablePullDownRefresh": true,

+ 1 - 6
htmldev/wxMini/pages/businessDetail/businessDetail.wxml

@@ -29,12 +29,7 @@
 <view
   class="waterfall"
   hidden="{{active === '1'}}">
-  <view class="waterfall-left">
-    <goods-item-large/>
-  </view>
-  <view class="waterfall-right">
-    <goods-item-large/>
-  </view>
+  <goods-item-normal/>
 </view>
 <view class="pullup-wrapper" wx:if="{{!isRefresh && active === '2'}}">
   <van-loading

+ 1 - 141
htmldev/wxMini/pages/login/login.js

@@ -1,5 +1,4 @@
-const { isMobile } = require('../../utils/validate')
-const { sendCode, miniPhoneLogin, miniLogin } = require('../../api/common')
+const { miniLogin } = require('../../api/common')
 const { login, sessionStorageKey } = require('../../api/request')
 const app = getApp()
 Page({
@@ -8,15 +7,8 @@ Page({
    * 页面的初始数据
    */
   data: {
-    form: {
-      cellphone: '',
-      code: ''
-    },
-    numCount: 60,
-    checked: false,
     booLock: false
   },
-  timer: null,
   wxCode: '',
 
   /**
@@ -51,138 +43,6 @@ Page({
    * 生命周期函数--监听页面卸载
    */
   onUnload() {
-    clearInterval(this.timer)
-  },
-  bindTip() {
-    wx.showToast({
-      title: '请阅读并勾选协议',
-      icon: 'none'
-    })
-  },
-  bindChange() {
-    this.setData({
-      checked: !(this.data.checked)
-    })
-  },
-  mobileEventhandle(e) {
-    const val = e.detail.value.replace(/[^\d]$/, '').replace(/^0/, '').replace(/(\d{11}(.*))/, '$1')
-
-    this.setData({
-      'form.cellphone': val
-    })
-
-    return {
-      value: val
-    }
-  },
-  codeEventhandle(e) {
-    const val = e.detail.value.replace(/[^\d]$/, '').replace(/(\d{6}(.*))/, '$1')
-
-    this.setData({
-      'form.code': val
-    })
-
-    return {
-      value: val
-    }
-  },
-  funCutDown() {
-    let numCount = this.data.numCount
-    this.timer = setInterval(() => {
-      if (numCount === 0) {
-        clearInterval(this.timer)
-        this.setData({
-          numCount: 0
-        })
-        return
-      }
-      numCount--
-      this.setData({
-        numCount: numCount
-      })
-    }, 1000)
-  },
-  async funGetCode() {
-    const numCount = this.data.numCount
-    const { cellphone } = this.data.form
-
-    if (!isMobile(cellphone)) {
-      wx.showToast({
-        title: '请输入正确的手机号~',
-        icon: 'none'
-      })
-      return
-    }
-    if (numCount < 60 && numCount > 0) {
-      return
-    }
-    this.setData({
-      numCount: 60,
-      code: ''
-    })
-
-    this.funCutDown()
-
-    try {
-      const { status } = await sendCode({ phone: cellphone, type: 1 })
-      let title = '验证码发送成功'
-      if (status) {
-      } else {
-        title = '验证码发送失败'
-      }
-      wx.showToast({
-        title: title,
-        icon: 'none'
-      })
-    } catch (err) {}
-  },
-  async bindEvent() {
-    const { cellphone, code } = this.data.form
-
-    if (!this.data.checked) {
-      this.bindTip()
-      return
-    }
-    this.setData({
-      booLock: true
-    })
-
-    try {
-      const { status, data } = await miniPhoneLogin({
-        wxCode: this.wxCode,
-        cellphone,
-        code
-      })
-
-      if (status) {
-        try {
-          wx.setStorageSync(sessionStorageKey, data.token)
-        } catch (err) {}
-
-        await app.fetchUserData()
-
-        const pages = getCurrentPages()
-        if (pages.length > 1) {
-          const route = pages[pages.length - 2]
-          wx.navigateBack({
-            delta: 1
-          })
-          route.bindCallBack && route.bindCallBack()
-        }
-      } else {
-        wx.showToast({
-          title: '登录出错了,请重试',
-          icon: 'none'
-        })
-        this.getWxCode()
-      }
-    } catch (err) {
-      this.getWxCode()
-    }
-
-    this.setData({
-      booLock: false
-    })
   },
   async getPhoneNumber(e) {
     const { errMsg, encryptedData, iv } = e.detail

+ 10 - 138
htmldev/wxMini/pages/login/login.scss

@@ -7,153 +7,25 @@
 
 .title {
   width: 100%;
-  padding-left: 39rpx;
+  padding-left: 30rpx;
   line-height: 72rpx;
   font-size: 48rpx;
   color: rgba(51, 51, 51, 1);
 }
 
-input {
-  height: 72rpx;
-  background-color: transparent;
-  padding: 15rpx 10rpx;
-  font-size: 28rpx;
-  color: rgba(68, 68, 68, 1);
-  border-bottom: 1rpx solid rgba(153, 153, 153, 1);
+.logo {
+  width: 286rpx;
+  height: 286rpx;
+  margin-top: 120rpx;
 }
 
-.placeholder {
-  color: #999999;
-  font-size: 28rpx;
-}
-
-.mobile {
-  display: block;
-  width: 672rpx;
-  margin-top: 92rpx;
-}
-
-.code-box {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  width: 672rpx;
-  margin-top: 50rpx;
-
-  .ver-code {
-    width: 388rpx;
-  }
-
-  button {
-    width: 285rpx;
-    height: 72rpx;
-    justify-content: flex-end;
-
-    &[type='default'] {
-      color: rgba(68, 68, 68, 1);
-      background-color: transparent;
-    }
-
-    &[disabled][type='default'] {
-      color: #999999;
-      background-color: transparent;
-    }
-  }
-
-  text {
-    font-size: 28rpx;
-  }
-
-  text:nth-of-type(2) {
-    width: 72rpx;
-  }
-}
-
-.agreement-wrap {
-  display: flex;
-  align-items: center;
-  width: 100%;
-  margin-top: 18rpx;
-
-  .checked-wrap {
-    display: flex;
-    align-items: center;
-    height: 34rpx;
-    padding: 0 19rpx 0 39rpx;
-  }
-
-  image {
-    width: 34rpx;
-    height: 34rpx;
-  }
-
-  .text-wrap {
-    display: flex;
-    flex-flow: row wrap;
-    font-size: 0;
-  }
-
-  text {
-    line-height: 34rpx;
-    font-size: 28rpx;
-  }
-}
-
-.footer {
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  margin-top: 104rpx;
-}
-
-.login {
+button.login {
   width: 504rpx;
   height: 76rpx;
+  margin-top: 118rpx;
   border-radius: 38rpx;
   font-size: 32rpx;
-
-  &[type='primary'] {
-    color: #FFFFFF;
-    background-color: rgba(145, 179, 121, 1);
-  }
-
-  &[disabled][type=primary] {
-    color: #FFFFFF;
-    background-color: #DFDFDF;
-  }
-}
-
-.auth {
-  position: relative;
-  left: 0;
-  top: 0;
-  margin-top: 48rpx;
-
-  .disabled {
-    position: absolute;
-    left: 0;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    z-index: 1;
-  }
-
-  button {
-    width: 504rpx;
-    height: 76rpx;
-
-    &[type='default'] {
-      color: rgba(145, 179, 121, 1);
-      background-color: transparent;
-    }
-  }
-
-  text {
-    font-size: 28rpx;
-  }
-
-  image {
-    width: 24rpx;
-    height: 22rpx;
-  }
+  font-weight: 500;
+  color: #FFFFFF;
+  background-color: rgba(145, 179, 121, 1);
 }

+ 11 - 66
htmldev/wxMini/pages/login/login.wxml

@@ -1,68 +1,13 @@
 <view class="wrapper">
-  <block>
-    <view class="title">欢迎登录</view>
-  </block>
-  <input class="mobile"
-         type="number"
-         placeholder="请输入手机号码"
-         maxlength="11"
-         placeholder-class="placeholder"
-         value="{{form.cellphone}}"
-         bindinput="mobileEventhandle"/>
-  <view class="code-box">
-    <input class="ver-code"
-           type="number"
-           placeholder="6位短信验证码"
-           maxlength="6"
-           placeholder-class="placeholder"
-           value="{{form.code}}"
-           bindinput="codeEventhandle"/>
-    <button
-      type="default"
-      disabled="{{!(numCount === 0 || numCount === 60) || form.cellphone.length < 11}}"
-      bind:tap="funGetCode">
-      <text>获取验证码</text>
-      <text hidden="{{numCount === 0 || numCount === 60}}">{{'(' + numCount + 's)'}}</text>
-    </button>
-  </view>
-  <view class="agreement-wrap">
-    <view
-      class="checked-wrap"
-      bind:tap="bindChange">
-      <image
-        src="../../image/common/unselected.png"
-        wx:if="{{!checked}}"></image>
-      <image
-        src="../../image/common/selected.png"
-        wx:if="{{checked}}"></image>
-    </view>
-    <view class="text-wrap">
-      <text style="color:rgba(102, 102, 102, 1);">同意</text>
-      <text
-        style="color:rgba(107, 133, 89, 1);"
-        wx:for="{{'《xxAPP商家协议》'}}"
-        wx:key="index">{{item}}</text>
-    </view>
-  </view>
-  <view class="footer">
-    <button class="login"
-            type="primary"
-            disabled="{{!(form.cellphone.length === 11 && form.code.length === 6) || booLock}}"
-            bind:tap="bindEvent">确定
-    </button>
-    <view class="auth">
-      <view
-        class="disabled"
-        hidden="{{checked}}"
-        bind:tap="bindTip"></view>
-      <button
-        type="default"
-        disabled="{{booLock}}"
-        open-type="getPhoneNumber"
-        bindgetphonenumber="getPhoneNumber">
-        <text>微信登陆</text>
-        <image src="../../image/common/arrow_0.png"></image>
-      </button>
-    </view>
-  </view>
+  <view class="title">欢迎进入</view>
+  <image
+    class="logo"
+    src="../../image/common/logo.png"></image>
+  <button
+    class="login"
+    type="default"
+    disabled="{{booLock}}"
+    open-type="getPhoneNumber"
+    bindgetphonenumber="getPhoneNumber">微信登陆
+  </button>
 </view>