Browse Source

no message

featrue/v4.1
xpz2018 5 years ago
parent
commit
eeefb0e212
3 changed files with 16 additions and 16 deletions
  1. 1
      pages/api/user.js
  2. 15
      pages/login/index.js
  3. 16
      pages/login/index.wxml

1
pages/api/user.js

@ -11,6 +11,7 @@ const config = {
}
const wechatApplet = (params) => mPost('/uec/get/wechat-applet-session', params, config)
const loginCaptcha = (params) => mPost(`/uec/authorize/by-captcha`, params, config)
const loginPwd = (params) => mPost(`/uec/authorize/by-password`, params, config)
const postCaptcha = (params) => mPost(`/uec/get/auth-captcha`, params, config)
const getUserInfo = (params) => mGet('/uec/get/user-info', params, config)
const getAuthSession = () => mGet('/uec/create/identity-auth-session', null, config)

15
pages/login/index.js

@ -1,6 +1,6 @@
//获取应用实例
import { $wuxCountDown } from '../../components/index'
import { config, postCaptcha, loginCaptcha, wechatApplet, getUserInfo, loginWechat } from "../api/user"
import { config, postCaptcha, loginCaptcha, loginPwd, wechatApplet, getUserInfo, loginWechat } from "../api/user"
import { zconfig, loginToken } from "../api/ztb"
import { pconfig } from "../api/payment"
import { mconfig } from "../api/moment"
@ -20,7 +20,7 @@ Page({
second: null,
form: {
tmpAuthToken: null,
accountType: 'MOBILE',
accountType: 2,
password: null,
account: null,
captcha: null
@ -162,7 +162,14 @@ Page({
util.showToast(error)
})
} else {
// authorize/by-password 密码登录
loginPwd(this.data.form).then(result => {
storage.put('Authorization', result.data.token)
app.globalData.token = result.data.token
this.fetchUserInfo()
}).catch(error => {
wx.hideLoading()
util.showToast(error)
})
}
},
changeType: function () {
@ -215,7 +222,7 @@ Page({
this.setData({ wxflag: true })
}
this.data.userInfo = e.detail.userInfo
this.data.form.tmpAuthToken = error.data
this.data.form.tmpAuthToken = error.data.tmpAuthToken
util.showToast(error.message)
}
})

16
pages/login/index.wxml

@ -13,21 +13,13 @@
<text class="label" style="margin-left:24rpx">手机号码</text>
</view>
<view class="cu-form-group" style="min-height:120rpx;border-bottom:1rpx solid #eee;padding:0rpx">
<!-- <image style="width:40rpx;height:40rpx" src="/assets/image/icon_phone.png"></image> -->
<!-- <text class="cuIcon-mobile" style="font-size:40rpx"/>
<text class="label" style="margin-left:12rpx">手机号码</text>
<text style="height:40rpx;border-left:2rpx solid #666;margin-left:24rpx;margin-right:24rpx"></text> -->
<input id="account" type="number" placeholder-style="color:#aaa" maxlength="11" placeholder="请输入手机号" value="{{form.account}}" bindinput="bindInput" />
</view>
<view class="flex" style="margin-top: 40rpx">
<image style="width:40rpx;height:40rpx" src="{{type == 1 ? '/assets/image/icon_code.png' : '/assets/image/icon_pwd.png'}}"></image>
<text class="label" style="margin-left:24rpx">{{type == 1 ? '验证码' : '密码'}}</text>
</view>
<view wx:if="{{type == 1}}" class="cu-form-group" style="margin-top: 40rpx;min-height:120rpx;border-bottom:1rpx solid #eee;padding:0rpx;border-top:0rpx solid #eee;">
<!-- <image style="width:40rpx;height:40rpx" src="{{type == 1 ? '/assets/image/icon_code.png' : '/assets/image/icon_pwd.png'}}"></image> -->
<!-- <text class="cuIcon-{{type == 1 ? 'safe' : 'lock'}}" style="font-size:40rpx"/>
<text class="label" style="margin-left:12rpx">{{type == 1 ? '验证码' : '密码'}}</text>
<text style="height:40rpx;border-left:2rpx solid #666;margin-left:24rpx;margin-right:24rpx"></text> -->
<view wx:if="{{type == 1}}" class="cu-form-group" style="min-height:120rpx;border-bottom:1rpx solid #eee;padding:0rpx;border-top:0rpx solid #eee;">
<input id="captcha" type="number" placeholder-style="color:#aaa" maxlength="6" placeholder="请输入验证码" bindinput="bindInput" />
<wux-button outline type="positive" size="code" disabled="{{!mobileEnable || !codeEnable}}" bind:click="fetchCode">{{ second || '获取验证码' }}</wux-button>
</view>
@ -35,12 +27,12 @@
<input id="password" placeholder-style="color:#aaa" type="{{pwdType}}" maxlength="20" placeholder="请输入验密码" bindinput="bindInput" />
</view>
<!-- <view style="margin-top:24rpx;text-align:end;">
<view style="margin-top:24rpx;text-align:end;">
<text style="color:#008AFF;font-size:30rpx;padding: 12rpx 0rpx 12rpx 24rpx" bindtap="changeType">{{type == 1 ? '密码登录' : '验证码登录'}}</text>
</view> -->
</view>
<view style="margin-top:120rpx;margin-bottom:24px">
<wux-button block type="positive" disabled="{{loginEnable}}" bind:click="loginForm">注册</wux-button>
<wux-button block type="positive" disabled="{{loginEnable}}" bind:click="loginForm">{{type == 1 ? '注册' : '登录'}}</wux-button>
</view>
</view>

Loading…
Cancel
Save