From eeefb0e212abdc7661d7c3824bf5b1ec2c131011 Mon Sep 17 00:00:00 2001
From: xpz2018 <107107461@qq.com>
Date: Thu, 14 Jan 2021 13:02:24 +0800
Subject: [PATCH] no message
---
pages/api/user.js | 1 +
pages/login/index.js | 15 +++++++++++----
pages/login/index.wxml | 16 ++++------------
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/pages/api/user.js b/pages/api/user.js
index 0ab8cac..70f3251 100644
--- a/pages/api/user.js
+++ b/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)
diff --git a/pages/login/index.js b/pages/login/index.js
index a536557..fc67e44 100644
--- a/pages/login/index.js
+++ b/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)
}
})
diff --git a/pages/login/index.wxml b/pages/login/index.wxml
index 4397ce4..ab285f0 100644
--- a/pages/login/index.wxml
+++ b/pages/login/index.wxml
@@ -13,21 +13,13 @@
手机号码
-
-
{{type == 1 ? '验证码' : '密码'}}
-
-
-
+
{{ second || '获取验证码' }}
@@ -35,12 +27,12 @@
-
+
- 注册
+ {{type == 1 ? '注册' : '登录'}}