Commit 250ab78b by 张立顺

pc端电脑登录bug修复

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