Commit 250ab78b by 张立顺

pc端电脑登录bug修复

1 parent 1f4d9e20
...@@ -4,7 +4,7 @@ import { checkLoginUserInfo, setLoginInfo, loginModal } from '~/login/lib/index' ...@@ -4,7 +4,7 @@ import { checkLoginUserInfo, setLoginInfo, loginModal } from '~/login/lib/index'
import md5 from '~/utils/lib/md5' import md5 from '~/utils/lib/md5'
import network from '~/utils/network' import network from '~/utils/network'
import { imgUrlMixin } from '~/mixins/index' import { imgUrlMixin } from '~/mixins/index'
let thisPage // let thisPage
Component({ Component({
behaviors: [imgUrlMixin], behaviors: [imgUrlMixin],
options: { options: {
...@@ -52,6 +52,7 @@ Component({ ...@@ -52,6 +52,7 @@ Component({
}, },
/**输入回调 */ /**输入回调 */
input(e) { input(e) {
const thisPage = wx.$router.getPageInstance()
const { value } = e.detail, const { value } = e.detail,
{ name } = e.currentTarget.dataset { name } = e.currentTarget.dataset
this.setData({ this.setData({
...@@ -116,6 +117,7 @@ Component({ ...@@ -116,6 +117,7 @@ Component({
}, },
/**检查输入框内容 */ /**检查输入框内容 */
checkFormData() { checkFormData() {
const thisPage = wx.$router.getPageInstance()
const { loginType, formData } = this.data const { loginType, formData } = this.data
if (loginType != 0) { if (loginType != 0) {
if (loginType == 1) { if (loginType == 1) {
...@@ -169,6 +171,7 @@ Component({ ...@@ -169,6 +171,7 @@ Component({
.then(({ code, data, message }) => { .then(({ code, data, message }) => {
this.setBtnLoading(false) this.setBtnLoading(false)
if (code == '0') { if (code == '0') {
const thisPage = wx.$router.getPageInstance()
if (loginType == 1) checkLoginUserInfo(data) if (loginType == 1) checkLoginUserInfo(data)
else { else {
const { autoLogin } = thisPage.data, const { autoLogin } = thisPage.data,
...@@ -221,6 +224,7 @@ Component({ ...@@ -221,6 +224,7 @@ Component({
}, },
/**设置登录按钮loading状态 */ /**设置登录按钮loading状态 */
setBtnLoading(loading = true) { setBtnLoading(loading = true) {
const thisPage = wx.$router.getPageInstance()
thisPage.setData({ thisPage.setData({
loading loading
}) })
...@@ -230,10 +234,13 @@ Component({ ...@@ -230,10 +234,13 @@ Component({
}, },
/**页面初始化 */ /**页面初始化 */
async init() { async init() {
this.setData({
code:3
})
network.getNetworkType() network.getNetworkType()
thisPage = wx.$router.getPageInstance()
try { try {
const { data, code, message } = await USERAPI.wxCodeLogin() const { data, code, message } = await USERAPI.wxCodeLogin()
const thisPage = wx.$router.getPageInstance()
if (code == '0') { if (code == '0') {
thisPage.setData({ thisPage.setData({
disabled: false disabled: false
......
...@@ -8,8 +8,9 @@ Page({ ...@@ -8,8 +8,9 @@ Page({
loginType: 0, loginType: 0,
/**按钮disabled */ /**按钮disabled */
disabled: true, disabled: true,
// disabled: false,
/**免登 */ /**免登 */
autoLogin: false autoLogin: false,
}, },
onRoute(options) {}, onRoute(options) {},
/** /**
...@@ -33,12 +34,11 @@ Page({ ...@@ -33,12 +34,11 @@ Page({
disabled: true disabled: true
}) })
} }
const login = this.selectComponent('#box')
if (login) login.init()
wx.hideHomeButton({ wx.hideHomeButton({
success: res => { success: res => {
wx.hideLoading() wx.hideLoading()
const login = this.selectComponent('#box')
if (login) login.init()
// this.checkLoginBtn()
} }
}) })
}, },
...@@ -73,15 +73,18 @@ Page({ ...@@ -73,15 +73,18 @@ Page({
autoLogin: e.detail autoLogin: e.detail
}) })
}, },
checkLoginBtn(disabled = false) { checkLoginBtn(disabled = false ) {
const { loginType } = this.data, const { loginType } = this.data,
{ {
data: { formData }, data: { formData },
loginToken // loginToken
} = this.selectComponent('#box') } = this.selectComponent('#box')
if (loginType == 0) { if (loginType == 0) {
disabled = loginToken // disabled = loginToken
} else disabled = loginType == 1 ? formData.phone && this.validate.methods.tel(formData.phone) && formData.code && formData.code.length == 4 : formData.account && formData.password disabled = this.loginToken
} else{
disabled = loginType == 1 ? formData.phone && this.validate.methods.tel(formData.phone) && formData.code && formData.code.length == 4 : formData.account && formData.password
}
this.setData({ this.setData({
disabled: !disabled disabled: !disabled
}) })
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<mask show="{{loading}}"></mask> <mask show="{{loading}}"></mask>
<navigation-bar navStyle="background-color: rgba(0,0,0,0)">生意助手</navigation-bar> <navigation-bar navStyle="background-color: rgba(0,0,0,0)">生意助手</navigation-bar>
<box loginType="{{loginType}}" disabled="{{disabled}}" id="box" /> <box loginType="{{loginType}}" disabled="{{disabled}}" id="box" />
{{test4}}
<agree show="{{loginType == 2}}" text="7天内免登陆" value="{{autoLogin}}" bindchange="changeAgree" /> <agree show="{{loginType == 2}}" text="7天内免登陆" value="{{autoLogin}}" bindchange="changeAgree" />
{{test}}
<type-list loginType="{{loginType}}" /> <type-list loginType="{{loginType}}" />
</view> </view>
\ No newline at end of file \ No newline at end of file
cxserviceShop 5393603egh(开发)
账号登录: 10988866666(超管)xiong110 账号登录: 10988866666(超管)xiong110
测试环境 bb123456 密码 bb123456 测试环境 bb123456 密码 bb123456
xiaoxiong1hao a123456 xiaoxiong1hao a123456
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!