Commit 6fc4729c authored by 李鹏 's avatar 李鹏

登录模块接口调整

parent e37dc190
...@@ -115,11 +115,11 @@ export default { ...@@ -115,11 +115,11 @@ export default {
mounted() { mounted() {
// this.getSysOptions(); // this.getSysOptions();
// 用户登录状态有效检测 // 用户登录状态有效检测
if (this.userInfo) { // if (this.userInfo) {
setInterval(() => { // setInterval(() => {
$axios.get("/apaas/system/v5/user/login/check"); // $axios.get("/apaas/system/v5/user/login/check");
}, 15 * 1000); // }, 15 * 1000);
} // }
}, },
methods: { methods: {
openMsg(data) { openMsg(data) {
......
...@@ -233,7 +233,7 @@ export default { ...@@ -233,7 +233,7 @@ export default {
}, },
menuAction(n, parent) { menuAction(n, parent) {
if (n == "logout") { if (n == "logout") {
this.$axios.post("/apaas/system/v5/user/logout").then((res) => { this.$axios.post("/v1/api/user/logout").then((res) => {
if (res.data.code == "200") { if (res.data.code == "200") {
window.location.href = "/so/manage/ui//#/login"; window.location.href = "/so/manage/ui//#/login";
this.$store.commit("setUserInfo", null); this.$store.commit("setUserInfo", null);
......
...@@ -60,6 +60,7 @@ import axios from "@/request/http.js"; ...@@ -60,6 +60,7 @@ import axios from "@/request/http.js";
import { Encrypt } from "@/services/secret.js"; import { Encrypt } from "@/services/secret.js";
import { useStore } from "vuex"; import { useStore } from "vuex";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { menuData } from "./menu";
const router = useRouter(); const router = useRouter();
...@@ -95,7 +96,7 @@ const loginAction = () => { ...@@ -95,7 +96,7 @@ const loginAction = () => {
loginFormRef.value.validate((valid) => { loginFormRef.value.validate((valid) => {
if (valid) { if (valid) {
axios.get(`/apaas/system/v5/user/verifyCaptcha?id=${state.imgId}&value=${state.loginForm.yzm}`).then((res) => { axios.get(`/v1/api/user/verifyCaptcha?id=${state.imgId}&value=${state.loginForm.yzm}`).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
login(); login();
} else { } else {
...@@ -107,7 +108,7 @@ const loginAction = () => { ...@@ -107,7 +108,7 @@ const loginAction = () => {
}; };
const login = () => { const login = () => {
axios axios
.post(`/apaas/system/v5/user/login`, { .post(`/v1/api/user/login`, {
system_account: state.loginForm.userid, system_account: state.loginForm.userid,
password: Encrypt(state.loginForm.password), password: Encrypt(state.loginForm.password),
}) })
...@@ -124,13 +125,17 @@ const login = () => { ...@@ -124,13 +125,17 @@ const login = () => {
}); });
}; };
const getUserInfo = () => { const getUserInfo = () => {
return axios.get(`/apaas/system/v5/user/getUserInfo`); return axios.get(`/v1/api/user/getUserInfo`);
}; };
const getMenu = (search) => { const getMenu = (search) => {
return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`); // return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`);
return new Promise((resolve, reject) => {
resolve(menuData);
});
}; };
const getUser = () => { const getUser = () => {
Promise.all([getUserInfo(), getMenu("79a8f214-db78-4db7-9c28-db66276b4be2")]).then((res) => { Promise.all([getUserInfo(), getMenu("79a8f214-db78-4db7-9c28-db66276b4be2")]).then((res) => {
console.log("res", res);
if (res[0].data.code == 200 && res[1].data.code == 200) { if (res[0].data.code == 200 && res[1].data.code == 200) {
let data = (res[1].data.data && res[1].data.data[0].children) || []; let data = (res[1].data.data && res[1].data.data[0].children) || [];
store.commit("setUserInfo", res[0].data.data); store.commit("setUserInfo", res[0].data.data);
...@@ -162,7 +167,7 @@ const getMenuObj = (menu, parentRowPath, menuObj) => { ...@@ -162,7 +167,7 @@ const getMenuObj = (menu, parentRowPath, menuObj) => {
}); });
}; };
const getImg = (clearInput = false) => { const getImg = (clearInput = false) => {
axios.get(`/apaas/system/v5/user/getCaptcha??width=138&height=36`).then((res) => { axios.get(`/v1/api/user/getCaptcha?width=138&height=36`).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
state.imgId = res.data.data.id; state.imgId = res.data.data.id;
state.imgSrc = res.data.data.captcha; state.imgSrc = res.data.data.captcha;
......
...@@ -142,7 +142,7 @@ const loginAction = () => { ...@@ -142,7 +142,7 @@ const loginAction = () => {
}; // 短信验证码登录 }; // 短信验证码登录
const getUserInfo = () => { const getUserInfo = () => {
return axios.get(`/apaas/system/v5/user/getUserInfo`); return axios.get(`/v1/api/user/getUserInfo`);
}; };
const getMenu = (search) => { const getMenu = (search) => {
return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`); return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`);
......
This diff is collapsed.
...@@ -65,7 +65,7 @@ import menu from "./router/function.js"; ...@@ -65,7 +65,7 @@ import menu from "./router/function.js";
//获取用户信息 //获取用户信息
function getUser() { function getUser() {
return axios.get(`/apaas/system/v5/user/getUserInfo`); return axios.get(`/v1/api/user/getUserInfo`);
} }
//获取用户菜单信息 //获取用户菜单信息
......
...@@ -4,10 +4,18 @@ ...@@ -4,10 +4,18 @@
<p class="login-title">登录</p> <p class="login-title">登录</p>
<el-form :model="form" ref="form" class="login_forms"> <el-form :model="form" ref="form" class="login_forms">
<el-form-item> <el-form-item>
<el-input v-model.trim="form.userid" autofocus="autofocus" placeholder="请输入账号" @keyup.enter="login_remember_info()"></el-input> <el-input
v-model.trim="form.userid"
autofocus="autofocus"
placeholder="请输入账号"
@keyup.enter="login_remember_info()"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input type="password" v-model.trim="form.password" placeholder="请输入密码" @keyup.enter="login_remember_info()"> <el-input
type="password"
v-model.trim="form.password"
placeholder="请输入密码"
@keyup.enter="login_remember_info()">
<!-- <span <!-- <span
slot="suffix" slot="suffix"
:title="visible ? '显示密码' : '隐藏密码'" :title="visible ? '显示密码' : '隐藏密码'"
...@@ -19,7 +27,12 @@ ...@@ -19,7 +27,12 @@
</el-form-item> </el-form-item>
<el-form-item prop="yzm" class="yzm"> <el-form-item prop="yzm" class="yzm">
<div class="yzm_ctx"> <div class="yzm_ctx">
<el-input class="yzm_ipt" v-model.trim="form.yzm" placeholder="请输入验证码" :validate-event="false" @keyup.enter="login_remember_info()"></el-input> <el-input
class="yzm_ipt"
v-model.trim="form.yzm"
placeholder="请输入验证码"
:validate-event="false"
@keyup.enter="login_remember_info()"></el-input>
<img class="yzm_img" title="看不清?换一张" :src="imgSrc" @click="getImg()" /> <img class="yzm_img" title="看不清?换一张" :src="imgSrc" @click="getImg()" />
</div> </div>
</el-form-item> </el-form-item>
...@@ -33,17 +46,17 @@ ...@@ -33,17 +46,17 @@
<script> <script>
import { setCookie, clearCookie } from "../../services/cookie.js"; import { setCookie, clearCookie } from "../../services/cookie.js";
import menu from '../../router/function' import menu from "../../router/function";
import {generateRoutes} from '../../router/index' import { generateRoutes } from "../../router/index";
import inputTable from '../../components/input-table.vue'; import inputTable from "../../components/input-table.vue";
import inputObjectTable from '../../components/input-object-table.vue'; import inputObjectTable from "../../components/input-object-table.vue";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
export default { export default {
props: {}, props: {},
components: { components: {
inputTable, inputTable,
inputObjectTable inputObjectTable,
}, },
data() { data() {
return { return {
...@@ -63,36 +76,36 @@ export default { ...@@ -63,36 +76,36 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
getMenuObj(menu,parentRowPath,menuObj){ getMenuObj(menu, parentRowPath, menuObj) {
menu.forEach((e,idx) => { menu.forEach((e, idx) => {
e.rowPath = parentRowPath + '.' + idx e.rowPath = parentRowPath + "." + idx;
menuObj[e.path] = e menuObj[e.path] = e;
if(e.children&&e.children.length){ if (e.children && e.children.length) {
this.getMenuObj(e.children,e.rowPath,menuObj) this.getMenuObj(e.children, e.rowPath, menuObj);
} }
}); });
}, },
getUser() { getUser() {
this.$axios.get(`/apaas/system/v5/user/getUserInfo`).then((res) => { this.$axios.get(`/v1/api/user/getUserInfo`).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$store.commit("setUserInfo", res.data.data); this.$store.commit("setUserInfo", res.data.data);
// if (res.data.data.userType == 1) { // if (res.data.data.userType == 1) {
//超管 //超管
this.$store.commit("setMenu", menu.adminMenu); this.$store.commit("setMenu", menu.adminMenu);
menu.menuToRouter(menu.adminMenu) menu.menuToRouter(menu.adminMenu);
this.$store.commit('setRoute',menu.adminMenu) this.$store.commit("setRoute", menu.adminMenu);
//存储菜单对象信息 //存储菜单对象信息
let menuObj = {} let menuObj = {};
this.getMenuObj(menu.adminMenu,'',menuObj) this.getMenuObj(menu.adminMenu, "", menuObj);
this.$store.commit('setMenuObj',menuObj) this.$store.commit("setMenuObj", menuObj);
// } // }
generateRoutes() generateRoutes();
// this.$router.push("/"); // this.$router.push("/");
//跳转到工作台页面 //跳转到工作台页面
window.location.href = '/so/manage/ui/#/' window.location.href = "/so/manage/ui/#/";
} }
}); });
}, },
...@@ -106,9 +119,7 @@ export default { ...@@ -106,9 +119,7 @@ export default {
if (!this.form.yzm) { if (!this.form.yzm) {
return this.$message.error("请输入验证码"); return this.$message.error("请输入验证码");
} }
this.$axios this.$axios.get(`/apaas/system/v5/user/verifyCaptcha?id=${this.imgId}&value=${this.form.yzm}`).then((res) => {
.get(`/apaas/system/v5/user/verifyCaptcha?id=${this.imgId}&value=${this.form.yzm}`)
.then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.login(); this.login();
} else { } else {
...@@ -117,11 +128,10 @@ export default { ...@@ -117,11 +128,10 @@ export default {
}); });
}, },
login() { login() {
this.$axios this.$axios
.post(`/apaas/system/v5/user/login`, { .post(`/apaas/system/v5/user/login`, {
system_account: this.form.userid, system_account: this.form.userid,
password: CryptoJS.AES.encrypt(this.form.password,"swuE9cmCZQwrkYRV").toString(), password: CryptoJS.AES.encrypt(this.form.password, "swuE9cmCZQwrkYRV").toString(),
}) })
.then((res) => { .then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -183,7 +193,6 @@ export default { ...@@ -183,7 +193,6 @@ export default {
height: 32px; height: 32px;
margin-left: 10px; margin-left: 10px;
display: inline-block; display: inline-block;
} }
.btn_sub { .btn_sub {
width: 400px; width: 400px;
......
...@@ -65,6 +65,12 @@ export default { ...@@ -65,6 +65,12 @@ export default {
changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL
secure: false, //解决证书缺失问题 secure: false, //解决证书缺失问题
}, },
"/v1/api": {
target: "https://so.wodcloud.com/v1/api", // 所要代理的目标地址
rewrite: (path) => path.replace(/^\/v1\/api/, ""), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的)
changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL
secure: false, //解决证书缺失问题
},
}, },
}, },
build: { build: {
......
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