138 lines
3.1 KiB
Vue
138 lines
3.1 KiB
Vue
|
<template>
|
||
|
<view class="loginBox">
|
||
|
<view class="logo-content">
|
||
|
<image style="width: 250rpx" :src="globalConfig" mode="widthFix"></image>
|
||
|
</view>
|
||
|
<u-form
|
||
|
:model="userform"
|
||
|
:rules="userRules"
|
||
|
class="loginForm"
|
||
|
ref="loginForm"
|
||
|
>
|
||
|
<u-form-item prop="loginCode" ref="item1" :borderBottom="true">
|
||
|
<u--input
|
||
|
v-model="userform.loginCode"
|
||
|
:border="'none'"
|
||
|
:placeholder="'请输入账号'"
|
||
|
prefixIcon="MIDDLEGROUND"
|
||
|
prefixIconStyle="font-size: 22px;color: #909399"
|
||
|
></u--input>
|
||
|
</u-form-item>
|
||
|
<u-form-item prop="loginPwd" ref="item1" :borderBottom="true">
|
||
|
<u--input
|
||
|
v-model="userform.loginPwd"
|
||
|
:border="'none'"
|
||
|
prefixIcon="lock"
|
||
|
:placeholder="'请输入密码'"
|
||
|
password
|
||
|
prefixIconStyle="font-size: 22px;color: #909399"
|
||
|
></u--input>
|
||
|
</u-form-item>
|
||
|
</u-form>
|
||
|
<view class="btn">
|
||
|
<u-button
|
||
|
text="认证"
|
||
|
size="normal"
|
||
|
type="primary"
|
||
|
@click="handlerSubmit"
|
||
|
></u-button>
|
||
|
</view>
|
||
|
<u-toast ref="uToast"></u-toast>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import { WeChatAuthen } from "@/api/login.js";
|
||
|
import logo from "@/static/logo.png";
|
||
|
import localStorage from "@/utils/localStorage";
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
globalConfig: logo,
|
||
|
userform: {
|
||
|
loginCode: "",
|
||
|
loginPwd: "",
|
||
|
},
|
||
|
userRules: {
|
||
|
loginCode: [
|
||
|
{
|
||
|
required: true,
|
||
|
message: "请输入账号",
|
||
|
trigger: ["change", "blur"],
|
||
|
},
|
||
|
],
|
||
|
loginPwd: [
|
||
|
{
|
||
|
required: true,
|
||
|
message: "请输入密码",
|
||
|
trigger: ["change", "blur"],
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
userid: "",
|
||
|
};
|
||
|
},
|
||
|
onReady() {
|
||
|
this.$ddFunction.setTitle("钉钉免登录认证");
|
||
|
},
|
||
|
methods: {
|
||
|
handlerSubmit() {
|
||
|
this.$refs.loginForm
|
||
|
.validate()
|
||
|
.then((res) => {
|
||
|
let params = {
|
||
|
...this.userform,
|
||
|
userID: localStorage.get("MIDDLEGROUND-USERID"),
|
||
|
};
|
||
|
this.submit(params);
|
||
|
})
|
||
|
.catch((errors) => {});
|
||
|
},
|
||
|
async submit(params) {
|
||
|
let res = await WeChatAuthen(params);
|
||
|
if (res.code == 1) {
|
||
|
this.$refs.uToast.show({
|
||
|
type: "success",
|
||
|
message: "认证成功!",
|
||
|
});
|
||
|
setTimeout(() => {
|
||
|
window.location.href = "http://ufidahz.com.cn:9085/app/index.html#/pages/loginAuthen/authenWeChat"
|
||
|
}, 1000);
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
.loginBox {
|
||
|
background: #ffffff;
|
||
|
|
||
|
.logo-content {
|
||
|
width: 100%;
|
||
|
font-size: 25px;
|
||
|
text-align: center;
|
||
|
padding-top: 20%;
|
||
|
|
||
|
image {
|
||
|
border-radius: 4px;
|
||
|
}
|
||
|
|
||
|
.title {
|
||
|
margin-left: 10px;
|
||
|
display: block;
|
||
|
}
|
||
|
}
|
||
|
.loginForm {
|
||
|
padding: 70rpx 80rpx;
|
||
|
}
|
||
|
.btn {
|
||
|
padding: 30rpx 80rpx;
|
||
|
}
|
||
|
}
|
||
|
</style>
|
||
|
<style scoped>
|
||
|
page {
|
||
|
background: #fff;
|
||
|
}
|
||
|
</style>
|