|
@@ -20,7 +20,7 @@
|
|
|
type="text"
|
|
|
placeholder="请输入账号"
|
|
|
v-decorator="[
|
|
|
- 'usercode',
|
|
|
+ 'userCode',
|
|
|
{rules: [{ required: true, message: '请检查账号输入' }], validateTrigger: 'change'}
|
|
|
]"
|
|
|
>
|
|
@@ -39,29 +39,9 @@
|
|
|
>
|
|
|
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
|
|
|
</a-input-password>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item>
|
|
|
|
|
|
- <a-row :gutter="8">
|
|
|
- <a-col :span="16">
|
|
|
- <a-input
|
|
|
- size="large"
|
|
|
- placeholder="请输入验证码"
|
|
|
- v-decorator="[
|
|
|
- 'captchaCode',
|
|
|
- {rules: [{ required: true, message: '请输入验证码' }], validateTrigger: 'blur'}
|
|
|
- ]"
|
|
|
- >
|
|
|
- <a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
|
|
|
- </a-input>
|
|
|
- </a-col>
|
|
|
- <a-col :span="8">
|
|
|
-
|
|
|
- <img class="verify-code" @click="updateCaptchaCode" :src="img" alt="">
|
|
|
-
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
</a-form-item>
|
|
|
+
|
|
|
</a-tab-pane>
|
|
|
<a-tab-pane key="tab2" tab="微信登录">
|
|
|
|
|
@@ -78,34 +58,49 @@
|
|
|
type="primary"
|
|
|
htmlType="submit"
|
|
|
class="login-button"
|
|
|
- :loading="state.loginBtn"
|
|
|
+
|
|
|
:disabled="state.loginBtn"
|
|
|
>确定</a-button>
|
|
|
</a-form-item>
|
|
|
-
|
|
|
+ <!-- :loading="state.loginBtn" -->
|
|
|
</a-form-item></a-form>
|
|
|
|
|
|
- <two-step-captcha
|
|
|
+ <!-- <two-step-captcha
|
|
|
v-if="requiredTwoStepCaptcha"
|
|
|
:visible="stepCaptchaVisible"
|
|
|
@success="stepCaptchaSuccess"
|
|
|
@cancel="stepCaptchaCancel"
|
|
|
- ></two-step-captcha>
|
|
|
-
|
|
|
+ ></two-step-captcha> -->
|
|
|
+
|
|
|
+ <!-- @fail="onFail"
|
|
|
+ @refresh="onRefresh" -->
|
|
|
+ <s-dialog :visible="visible" @cancle="visible = false" title="滑动验证">
|
|
|
+ <slide-verify
|
|
|
+ :l="42"
|
|
|
+ :r="10"
|
|
|
+ :w="310"
|
|
|
+ :h="155"
|
|
|
+ @success="userLogin"
|
|
|
+
|
|
|
+ slider-text="向右滑"
|
|
|
+ ></slide-verify>
|
|
|
+ </s-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import md5 from 'md5'
|
|
|
-import TwoStepCaptcha from '@/components/tools/TwoStepCaptcha'
|
|
|
+// import TwoStepCaptcha from '@/components/tools/TwoStepCaptcha'
|
|
|
import { mapActions } from 'vuex'
|
|
|
+import SDialog from '@/components/Model'
|
|
|
// import { timeFix } from '@/utils/util'
|
|
|
// import { getSmsCaptcha, get2step } from '@/api/login'
|
|
|
// import { getVerifyCode } from '@/api/user'
|
|
|
export default {
|
|
|
name: 'Login',
|
|
|
components: {
|
|
|
- TwoStepCaptcha
|
|
|
+ // TwoStepCaptcha,
|
|
|
+ SDialog
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
@@ -125,7 +120,8 @@ export default {
|
|
|
smsSendBtn: false
|
|
|
},
|
|
|
img: '',
|
|
|
- key: 1
|
|
|
+ key: 1,
|
|
|
+ visible: false
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
@@ -163,32 +159,18 @@ export default {
|
|
|
},
|
|
|
handleSubmit (e) {
|
|
|
e.preventDefault()
|
|
|
- const {
|
|
|
+ const {
|
|
|
form: { validateFields },
|
|
|
state,
|
|
|
- customActiveKey,
|
|
|
- Login
|
|
|
- } = this
|
|
|
+ customActiveKey
|
|
|
|
|
|
- state.loginBtn = true
|
|
|
+ } = this
|
|
|
|
|
|
- const validateFieldsKey = customActiveKey === 'tab1' ? ['username', 'password', 'captchaCode'] : ['mobile', 'captcha']
|
|
|
- console.log(Login, 'Login')
|
|
|
- validateFields(validateFieldsKey, { force: true }, async (err, values) => {
|
|
|
+ const validateFieldsKey = customActiveKey === 'tab1' ? ['userCode', 'password'] : ['mobile', 'captcha']
|
|
|
+ validateFields(validateFieldsKey, { force: true }, (err, values) => {
|
|
|
if (!err) {
|
|
|
- console.log('login form', values)
|
|
|
- const loginParams = { ...values }
|
|
|
- loginParams.password = md5(values.password)
|
|
|
- const data = await Login(loginParams)
|
|
|
-
|
|
|
- console.log(data)
|
|
|
-
|
|
|
- // Login(loginParams)
|
|
|
- // .then((res) => this.loginSuccess(res))
|
|
|
- // .catch(err => this.requestFailed(err))
|
|
|
- // .finally(() => {
|
|
|
- // state.loginBtn = false
|
|
|
- // })
|
|
|
+ this.userInfo = { ...values }
|
|
|
+ this.visible = true
|
|
|
} else {
|
|
|
console.log('aaa')
|
|
|
setTimeout(() => {
|
|
@@ -196,7 +178,18 @@ export default {
|
|
|
}, 600)
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+
|
|
|
+ // 验证通过,用户开始登陆
|
|
|
+ async userLogin () {
|
|
|
+ const { userInfo, Login } = this
|
|
|
+ // state.loginBtn = true
|
|
|
+ const loginParams = { ...userInfo }
|
|
|
+ loginParams.password = md5(loginParams.password)
|
|
|
+ const data = await Login(loginParams)
|
|
|
+ console.log(data)
|
|
|
}
|
|
|
+
|
|
|
// getCaptcha (e) {
|
|
|
// e.preventDefault()
|
|
|
// const { form: { validateFields }, state } = this
|