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

登录模块接口调整

parent e37dc190
......@@ -115,11 +115,11 @@ export default {
mounted() {
// this.getSysOptions();
// 用户登录状态有效检测
if (this.userInfo) {
setInterval(() => {
$axios.get("/apaas/system/v5/user/login/check");
}, 15 * 1000);
}
// if (this.userInfo) {
// setInterval(() => {
// $axios.get("/apaas/system/v5/user/login/check");
// }, 15 * 1000);
// }
},
methods: {
openMsg(data) {
......
......@@ -233,7 +233,7 @@ export default {
},
menuAction(n, parent) {
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") {
window.location.href = "/so/manage/ui//#/login";
this.$store.commit("setUserInfo", null);
......
......@@ -60,6 +60,7 @@ import axios from "@/request/http.js";
import { Encrypt } from "@/services/secret.js";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
import { menuData } from "./menu";
const router = useRouter();
......@@ -95,7 +96,7 @@ const loginAction = () => {
loginFormRef.value.validate((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) {
login();
} else {
......@@ -107,7 +108,7 @@ const loginAction = () => {
};
const login = () => {
axios
.post(`/apaas/system/v5/user/login`, {
.post(`/v1/api/user/login`, {
system_account: state.loginForm.userid,
password: Encrypt(state.loginForm.password),
})
......@@ -124,13 +125,17 @@ const login = () => {
});
};
const getUserInfo = () => {
return axios.get(`/apaas/system/v5/user/getUserInfo`);
return axios.get(`/v1/api/user/getUserInfo`);
};
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 = () => {
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) {
let data = (res[1].data.data && res[1].data.data[0].children) || [];
store.commit("setUserInfo", res[0].data.data);
......@@ -162,7 +167,7 @@ const getMenuObj = (menu, parentRowPath, menuObj) => {
});
};
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) {
state.imgId = res.data.data.id;
state.imgSrc = res.data.data.captcha;
......
......@@ -142,7 +142,7 @@ const loginAction = () => {
}; // 短信验证码登录
const getUserInfo = () => {
return axios.get(`/apaas/system/v5/user/getUserInfo`);
return axios.get(`/v1/api/user/getUserInfo`);
};
const getMenu = (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";
//获取用户信息
function getUser() {
return axios.get(`/apaas/system/v5/user/getUserInfo`);
return axios.get(`/v1/api/user/getUserInfo`);
}
//获取用户菜单信息
......
......@@ -4,10 +4,18 @@
<p class="login-title">登录</p>
<el-form :model="form" ref="form" class="login_forms">
<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-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
slot="suffix"
:title="visible ? '显示密码' : '隐藏密码'"
......@@ -19,7 +27,12 @@
</el-form-item>
<el-form-item prop="yzm" class="yzm">
<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()" />
</div>
</el-form-item>
......@@ -33,17 +46,17 @@
<script>
import { setCookie, clearCookie } from "../../services/cookie.js";
import menu from '../../router/function'
import {generateRoutes} from '../../router/index'
import inputTable from '../../components/input-table.vue';
import inputObjectTable from '../../components/input-object-table.vue';
import menu from "../../router/function";
import { generateRoutes } from "../../router/index";
import inputTable from "../../components/input-table.vue";
import inputObjectTable from "../../components/input-object-table.vue";
import CryptoJS from "crypto-js";
export default {
props: {},
components: {
inputTable,
inputObjectTable
inputObjectTable,
},
data() {
return {
......@@ -63,36 +76,36 @@ export default {
},
mounted() {},
methods: {
getMenuObj(menu,parentRowPath,menuObj){
menu.forEach((e,idx) => {
e.rowPath = parentRowPath + '.' + idx
menuObj[e.path] = e
if(e.children&&e.children.length){
this.getMenuObj(e.children,e.rowPath,menuObj)
getMenuObj(menu, parentRowPath, menuObj) {
menu.forEach((e, idx) => {
e.rowPath = parentRowPath + "." + idx;
menuObj[e.path] = e;
if (e.children && e.children.length) {
this.getMenuObj(e.children, e.rowPath, menuObj);
}
});
},
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) {
this.$store.commit("setUserInfo", res.data.data);
// if (res.data.data.userType == 1) {
//超管
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 = {}
this.getMenuObj(menu.adminMenu,'',menuObj)
this.$store.commit('setMenuObj',menuObj)
let menuObj = {};
this.getMenuObj(menu.adminMenu, "", menuObj);
this.$store.commit("setMenuObj", menuObj);
// }
generateRoutes()
generateRoutes();
// this.$router.push("/");
//跳转到工作台页面
window.location.href = '/so/manage/ui/#/'
window.location.href = "/so/manage/ui/#/";
}
});
},
......@@ -106,9 +119,7 @@ export default {
if (!this.form.yzm) {
return this.$message.error("请输入验证码");
}
this.$axios
.get(`/apaas/system/v5/user/verifyCaptcha?id=${this.imgId}&value=${this.form.yzm}`)
.then((res) => {
this.$axios.get(`/apaas/system/v5/user/verifyCaptcha?id=${this.imgId}&value=${this.form.yzm}`).then((res) => {
if (res.data.code == 200) {
this.login();
} else {
......@@ -117,11 +128,10 @@ export default {
});
},
login() {
this.$axios
.post(`/apaas/system/v5/user/login`, {
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) => {
if (res.data.code == 200) {
......@@ -183,7 +193,6 @@ export default {
height: 32px;
margin-left: 10px;
display: inline-block;
}
.btn_sub {
width: 400px;
......
......@@ -65,6 +65,12 @@ export default {
changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL
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: {
......
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