Commit 1fbe38dc authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 13e1e943 c5394d72
#开发环境 #开发环境
NODE_ENV = "development" NODE_ENV = "development"
VUE_APP_API_BASE_URL=http://192.168.0.252:11089 VUE_APP_API_BASE_URL=http://192.168.0.252:11071
VUE_APP_API_IMG_URL=http://192.168.0.252:11089/ VUE_APP_API_IMG_URL=http://192.168.0.252:11071/
# VUE_APP_API_BASE_URL=http://192.168.0.98:11078 # VUE_APP_API_BASE_URL=http://192.168.0.98:11078
# VUE_APP_API_IMG_URL=http://192.168.0.98:11078/ # VUE_APP_API_IMG_URL=http://192.168.0.98:11078/
#VUE_APP_API_BASE_URL=http://10.12.185.213:11071 #VUE_APP_API_BASE_URL=http://10.12.185.213:11071
\ No newline at end of file
<template>
<common-layout>
<div class="top">
<div class="header">
<img alt="logo" class="logo" src="@/assets/img/logo.png" />
<span class="title">{{ systemName }}</span>
</div>
<div class="desc">智慧政务先行者</div>
</div>
<!-- <div class="login">
<a-form @submit="onSubmit" :form="form">
<a-tabs
size="large"
:tabBarStyle="{ textAlign: 'center' }"
style="padding: 0 2px"
>
<a-tab-pane tab="账户密码登录" key="1">
<a-alert
type="error"
:closable="true"
v-if="error"
:message="error"
@close="onClose"
showIcon
style="margin-bottom: 24px"
/>
<a-form-item>
<a-input
autocomplete="autocomplete"
size="large"
placeholder="请输入账号"
v-decorator="[
'userName',
{
rules: [
{
required: true,
message: '请输入账户名',
whitespace: true,
},
],
},
]"
>
<a-icon slot="prefix" type="user" />
</a-input>
</a-form-item>
<a-form-item>
<a-input
size="large"
placeholder="请输入密码"
autocomplete="autocomplete"
type="password"
v-decorator="[
'password',
{
rules: [
{
required: true,
message: '请输入密码',
whitespace: true,
},
],
},
]"
>
<a-icon slot="prefix" type="lock" />
</a-input>
</a-form-item>
</a-tab-pane>
</a-tabs>
<div></div>
<a-form-item>
<a-button
:loading="logging"
style="width: 100%; margin-top: 24px"
size="large"
htmlType="submit"
type="primary"
>登录</a-button
>
</a-form-item>
</a-form>
</div> -->
</common-layout>
</template>
<script>
import CommonLayout from "@/layouts/CommonLayout";
import local from "@/utils/local";
// import {login, getRoutesConfig} from '@/services/user'
import { login } from "@/services/user";
// import { setAuthorization } from "@/utils/request";
// import {loadRoutes} from '@/utils/routerUtil'
import { mapMutations } from "vuex";
export default {
name: "Login",
components: { CommonLayout },
data() {
return {
logging: false,
error: "",
form: this.$form.createForm(this),
};
},
created() {
if (this.$route.query.loginName) {
const userName = this.$route.query.loginName;
// this.form.password = 'admin';
const password = "xhxADMIN8@a";
login(userName, password).then(this.afterLogin);
}
},
computed: {
systemName() {
return this.$store.state.setting.systemName;
},
},
methods: {
...mapMutations("account", ["setUser", "setPermissions", "setRoles"]),
onSubmit(e) {
e.preventDefault();
this.form.validateFields((err) => {
if (!err) {
this.logging = true;
const userName = this.form.getFieldValue("userName");
const password = this.form.getFieldValue("password");
login(userName, password).then(this.afterLogin);
}
});
},
afterLogin(res) {
this.logging = false;
const loginRes = res.data;
console.log(loginRes);
if (loginRes.code == 1) {
const { token } = loginRes.data;
local.setLocal("token", token);
// setAuthorization({ token: token, expireAt: new Date(expiresTime) });
this.$router.push("basicset/website");
this.$message.success(loginRes.msg, 3);
} else {
this.error = loginRes.msg;
}
},
onClose() {
this.error = false;
},
},
};
</script>
<style lang="less" scoped>
.ant-form-item {
margin-bottom: 0;
display: block;
align-items: normal;
}
.common-layout {
.top {
text-align: center;
.header {
height: 44px;
line-height: 44px;
a {
text-decoration: none;
}
.logo {
height: 44px;
vertical-align: top;
margin-right: 16px;
}
.title {
font-size: 33px;
color: @title-color;
font-family: "Myriad Pro", "Helvetica Neue", Arial, Helvetica,
sans-serif;
font-weight: 600;
position: relative;
top: 2px;
}
}
.desc {
font-size: 14px;
color: @text-color-second;
margin-top: 12px;
margin-bottom: 40px;
}
}
.login {
width: 368px;
margin: 0 auto;
@media screen and (max-width: 576px) {
width: 95%;
}
@media screen and (max-width: 320px) {
.captcha-button {
font-size: 14px;
}
}
.icon {
font-size: 24px;
color: @text-color-second;
margin-left: 16px;
vertical-align: middle;
cursor: pointer;
transition: color 0.3s;
&:hover {
color: @primary-color;
}
}
}
}
/deep/.ant-form-item-control {
height: 55px;
margin-bottom: 5px;
}
/deep/.ant-input {
width: 100% !important;
}
</style>
<template> <template>
<common-layout> <div>
<div class="top"> <div>页面跳转中......</div>
<div class="header"> </div>
<img alt="logo" class="logo" src="@/assets/img/logo.png" />
<span class="title">{{ systemName }}</span>
</div>
<div class="desc">智慧政务先行者</div>
</div>
<!-- <div class="login">
<a-form @submit="onSubmit" :form="form">
<a-tabs
size="large"
:tabBarStyle="{ textAlign: 'center' }"
style="padding: 0 2px"
>
<a-tab-pane tab="账户密码登录" key="1">
<a-alert
type="error"
:closable="true"
v-if="error"
:message="error"
@close="onClose"
showIcon
style="margin-bottom: 24px"
/>
<a-form-item>
<a-input
autocomplete="autocomplete"
size="large"
placeholder="请输入账号"
v-decorator="[
'userName',
{
rules: [
{
required: true,
message: '请输入账户名',
whitespace: true,
},
],
},
]"
>
<a-icon slot="prefix" type="user" />
</a-input>
</a-form-item>
<a-form-item>
<a-input
size="large"
placeholder="请输入密码"
autocomplete="autocomplete"
type="password"
v-decorator="[
'password',
{
rules: [
{
required: true,
message: '请输入密码',
whitespace: true,
},
],
},
]"
>
<a-icon slot="prefix" type="lock" />
</a-input>
</a-form-item>
</a-tab-pane>
</a-tabs>
<div></div>
<a-form-item>
<a-button
:loading="logging"
style="width: 100%; margin-top: 24px"
size="large"
htmlType="submit"
type="primary"
>登录</a-button
>
</a-form-item>
</a-form>
</div> -->
</common-layout>
</template> </template>
<script> <script>
import CommonLayout from "@/layouts/CommonLayout";
import local from "@/utils/local"; import local from "@/utils/local";
// import {login, getRoutesConfig} from '@/services/user'
import { login } from "@/services/user";
// import { setAuthorization } from "@/utils/request";
// import {loadRoutes} from '@/utils/routerUtil'
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
import { createMenus } from "@/router";
import { login } from "@/services/user";
export default { export default {
name: "Login",
components: { CommonLayout },
data() { data() {
return { return {};
logging: false,
error: "",
form: this.$form.createForm(this),
};
}, },
created() { created() {
if (this.$route.query.loginName) { if (this.$route.query.loginName) {
const userName = this.$route.query.loginName; const userName = this.$route.query.loginName;
// this.form.password = 'admin';
const password = "xhxADMIN8@a"; const password = "xhxADMIN8@a";
login(userName, password).then(this.afterLogin); login(userName, password).then((res) => {
const loginRes = res.data;
console.log(loginRes);
if (loginRes.code == 1) {
const { token } = loginRes.data;
local.setLocal("token", token);
let userInfo = {
id: loginRes.data.id,
userType: loginRes.data.userType,
currUserName: loginRes.data.currUserName,
};
this.getToken(token, userInfo, loginRes.data);
this.$message.success(loginRes.msg, 3);
} else {
this.error = loginRes.msg;
}
});
} }
}, },
computed: {
systemName() {
return this.$store.state.setting.systemName;
},
},
methods: { methods: {
...mapMutations("account", ["setUser", "setPermissions", "setRoles"]), ...mapMutations("site", [
onSubmit(e) { "SET_userInfo",
e.preventDefault(); "SET_token",
this.form.validateFields((err) => { "SET_SITE_ID",
if (!err) { "SET_siteName",
this.logging = true; "SET_sysName",
const userName = this.form.getFieldValue("userName"); "SET_sysLogo",
const password = this.form.getFieldValue("password"); "SET_path",
login(userName, password).then(this.afterLogin); ]),
} // 获取token
}); getToken(token, userInfo, data) {
}, // let { userInfo, siteid, siteName, sysName, sysLogo, path } =
afterLogin(res) { // this.$route.query;
this.logging = false; if (token) {
const loginRes = res.data; this.SET_userInfo(userInfo);
console.log(loginRes); this.SET_token(token);
if (loginRes.code == 1) { console.log(data);
const { token } = loginRes.data;
local.setLocal("token", token); // data.siteid ? this.SET_SITE_ID(data.siteid) : "";
// setAuthorization({ token: token, expireAt: new Date(expiresTime) }); // data.siteName ? this.SET_siteName(data.siteName) : "";
this.$router.push("basicset/website"); // this.SET_sysName(data.sysName);
this.$message.success(loginRes.msg, 3); // this.SET_sysLogo(data.sysLogo);
// this.SET_path(data.path);
// local.setLocal("siteId", data.siteid);
// local.setLocal("siteName", data.siteName);
// 动态菜单
createMenus();
this.$router.push("/website");
} else { } else {
this.error = loginRes.msg; this.$message.warning("跳转失败,请重新登录");
setTimeout(() => {
location.href = process.env.VUE_APP_API_portal_URL;
}, 2000);
} }
}, },
onClose() {
this.error = false;
},
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
.ant-form-item {
margin-bottom: 0;
display: block;
align-items: normal;
}
.common-layout {
.top {
text-align: center;
.header {
height: 44px;
line-height: 44px;
a {
text-decoration: none;
}
.logo {
height: 44px;
vertical-align: top;
margin-right: 16px;
}
.title {
font-size: 33px;
color: @title-color;
font-family: "Myriad Pro", "Helvetica Neue", Arial, Helvetica,
sans-serif;
font-weight: 600;
position: relative;
top: 2px;
}
}
.desc {
font-size: 14px;
color: @text-color-second;
margin-top: 12px;
margin-bottom: 40px;
}
}
.login {
width: 368px;
margin: 0 auto;
@media screen and (max-width: 576px) {
width: 95%;
}
@media screen and (max-width: 320px) {
.captcha-button {
font-size: 14px;
}
}
.icon {
font-size: 24px;
color: @text-color-second;
margin-left: 16px;
vertical-align: middle;
cursor: pointer;
transition: color 0.3s;
&:hover {
color: @primary-color;
}
}
}
}
/deep/.ant-form-item-control {
height: 55px;
margin-bottom: 5px;
}
/deep/.ant-input {
width: 100% !important;
}
</style>
This diff is collapsed.
const BASE_URL = const BASE_URL =
process.env.NODE_ENV === "development" process.env.NODE_ENV === "development"
? "/api" ? "/basics_api"
: process.env.VUE_APP_API_BASE_URL; : process.env.VUE_APP_API_BASE_URL;
module.exports = { module.exports = {
loginapi: { loginapi: {
......
...@@ -40,12 +40,12 @@ module.exports = { ...@@ -40,12 +40,12 @@ module.exports = {
disableHostCheck: true, disableHostCheck: true,
port: 8080, port: 8080,
proxy: { proxy: {
"/api": { "/basics_api": {
//此处要与 /services/api.js 中的 API_PROXY_PREFIX 值保持一致 //此处要与 /services/api.js 中的 API_PROXY_PREFIX 值保持一致
target: process.env.VUE_APP_API_BASE_URL, target: process.env.VUE_APP_API_BASE_URL,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
"^/api": "", "^/basics_api": "",
}, },
// cookieDomainRewrite: 'localhost', // cookieDomainRewrite: 'localhost',
}, },
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment