Commit bd86d569 authored by 吴婷慧's avatar 吴婷慧

登录模块完成

parent 2b3df4d2
...@@ -10,9 +10,7 @@ const GETUSERINFO = (params) => { ...@@ -10,9 +10,7 @@ const GETUSERINFO = (params) => {
}; };
// get corporate Code // get corporate Code
const GETCORPORATECODE = (data) => { const GETCORPORATECODE = (data) => {
return req.post(apis.corporateCodeList, { return req.post(apis.corporateCodeList, data);
data,
});
}; };
// 对象数组 // 对象数组
......
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
Table, Table,
InputNumber, InputNumber,
message, message,
pagination,
} from "ant-design-vue"; } from "ant-design-vue";
export default () => { export default () => {
...@@ -30,6 +31,7 @@ export default () => { ...@@ -30,6 +31,7 @@ export default () => {
Table, Table,
InputNumber, InputNumber,
message, message,
pagination,
]; ];
// 注册 // 注册
els.forEach((item) => { els.forEach((item) => {
......
import NProgress from "nprogress"; import NProgress from "nprogress";
import "nprogress/nprogress.css"; import "nprogress/nprogress.css";
// import store from "@/store/index"; import store from "@/store/index";
// 路由页面路由首位配置 // 路由页面路由首位配置
export default (VueRouter, router) => { export default (VueRouter, router) => {
...@@ -15,6 +15,7 @@ export default (VueRouter, router) => { ...@@ -15,6 +15,7 @@ export default (VueRouter, router) => {
// 页面路由切换时进度条 // 页面路由切换时进度条
// let router = new VueRouter(); // let router = new VueRouter();
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log(store);
NProgress.start(); NProgress.start();
next(); next();
}); });
......
...@@ -11,7 +11,7 @@ Vue.use(Vuex); ...@@ -11,7 +11,7 @@ Vue.use(Vuex);
export default new Vuex.Store({ export default new Vuex.Store({
modules: { modules: {
namespaced: true, // namespaced: true,
common, common,
}, },
plugins: [createPersistedState()], plugins: [createPersistedState()],
......
...@@ -7,6 +7,7 @@ const actions = { ...@@ -7,6 +7,7 @@ const actions = {
setMenuStack({ state }, data) { setMenuStack({ state }, data) {
console.log(data); console.log(data);
state.menuStack = data; state.menuStack = data;
state.token = JSON.stringify(data);
}, },
}; };
const mutations = { const mutations = {
...@@ -18,6 +19,9 @@ const mutations = { ...@@ -18,6 +19,9 @@ const mutations = {
setUserInfo(state, userInfo) { setUserInfo(state, userInfo) {
state.userInfo = userInfo; state.userInfo = userInfo;
}, },
setMenuStack(state, data) {
state.menuStack = data;
},
}; };
export default { export default {
namespaced: true, namespaced: true,
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<a-input <a-input
size="large" size="large"
v-model="form.userName" v-model="form.userName"
placeholder="请输入邮箱" placeholder="请输入用户名"
></a-input> ></a-input>
</a-form-model-item> </a-form-model-item>
<a-form-model-item prop="verificationCode"> <a-form-model-item prop="verificationCode">
......
...@@ -79,9 +79,8 @@ export default { ...@@ -79,9 +79,8 @@ export default {
}, },
_login() { _login() {
this.$apis.LOGIN(this.form).then((res) => { this.$apis.LOGIN(this.form).then((res) => {
console.log(res);
if (res.returnCode === "0000") { if (res.returnCode === "0000") {
console.log(res.content); this.$store.commit("common/setUserInfo", res.content);
this.$router.replace("/customer"); this.$router.replace("/customer");
} else { } else {
this.$message.error(res.returnMsg || "出现错误"); this.$message.error(res.returnMsg || "出现错误");
......
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
}, },
}, },
mounted() { mounted() {
console.log("this.apis", this.$apis.GETUSERINFO(), this.$lodash); // console.log("this.apis", this.$apis.GETUSERINFO(), this.$lodash);
}, },
}; };
</script> </script>
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
size="large" size="large"
placeholder="请选择保险公司" placeholder="请选择保险公司"
> >
<a-select-option v-for="item in companyCode" :key="item.code"> <a-select-option v-for="item in companyCode" :key="item.corpCode">
{{ item.name }} {{ item.longName }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
...@@ -111,16 +111,20 @@ export default { ...@@ -111,16 +111,20 @@ export default {
dataList: [], dataList: [],
pager: { pager: {
pageNum: 1, pageNum: 1,
pageSize: 1, pageSize: 10,
}, },
total: 0, total: 0,
}; };
}, },
mounted() { created() {
this._getCustomerList(); this._getCustomerList();
this._getCorporateCode();
}, },
computed: { computed: {
pagination() { pagination() {
if (!this.pager || !this.dataList.length) {
return false;
}
const { pageNum, pageSize } = this.pager; const { pageNum, pageSize } = this.pager;
const pages = Math.ceil(this.total / pageSize); const pages = Math.ceil(this.total / pageSize);
return { return {
...@@ -130,11 +134,16 @@ export default { ...@@ -130,11 +134,16 @@ export default {
align: "right", align: "right",
hideOnSinglePage: false, hideOnSinglePage: false,
itemRender: (current, type, originalElement) => { itemRender: (current, type, originalElement) => {
originalElement.children = undefined;
if (type === "prev") { if (type === "prev") {
originalElement.children = undefined;
originalElement.text = "上一页"; originalElement.text = "上一页";
} }
if (type === "page") { if (type === "page") {
if (current !== pageNum) {
return undefined;
}
// originalElement.children = undefined;
// originalElement.text = `${current} / ${pages}`;
return ( return (
<p> <p>
<span class="current-page">{current}</span> / {pages} <span class="current-page">{current}</span> / {pages}
...@@ -142,6 +151,7 @@ export default { ...@@ -142,6 +151,7 @@ export default {
); );
} }
if (type === "next") { if (type === "next") {
originalElement.children = undefined;
originalElement.text = "下一页"; originalElement.text = "下一页";
return ( return (
<div> <div>
...@@ -160,13 +170,19 @@ export default { ...@@ -160,13 +170,19 @@ export default {
}, },
methods: { methods: {
onChange(pager) { onChange(pager) {
console.log(pager);
const { current } = pager; const { current } = pager;
this.apger.pageNum = current; console.log(pager);
this.pager.pageNum = current;
// this._getCustomerList();
}, },
onShowSizeChange(e) { onShowSizeChange(e) {
e && e.stopPropagation(); e && e.stopPropagation();
console.log(e); const val = e.target.value;
if (!val) {
return false;
}
this.pager.pageSize = val;
this._getCustomerList();
}, },
handlerSearch() { handlerSearch() {
console.log(this.$refs.form.validate); console.log(this.$refs.form.validate);
...@@ -179,6 +195,15 @@ export default { ...@@ -179,6 +195,15 @@ export default {
this._getCustomerList(); this._getCustomerList();
}); });
}, },
_getCorporateCode() {
const params = {
longName: "",
payorId: 0,
};
this.$apis.GETCORPORATECODE(params).then((res) => {
this.companyCode = res.content || [];
});
},
_getCustomerList() { _getCustomerList() {
const data = { const data = {
...this.pageForm, ...this.pageForm,
...@@ -233,5 +258,8 @@ export default { ...@@ -233,5 +258,8 @@ export default {
background-color: #f8fafb; background-color: #f8fafb;
border: none; border: none;
} }
.ant-pagination-item:not(.ant-pagination-item-active) {
display: none;
}
} }
</style> </style>
...@@ -23,14 +23,16 @@ ...@@ -23,14 +23,16 @@
</template> </template>
<script> <script>
import { mapState } from "vuex";
export default { export default {
data() { data() {
return { return {};
userInfo: {
name: "Holo",
avator: "",
}, },
}; computed: {
...mapState({
userInfo: (state) => state.common.userInfo,
}),
}, },
methods: { methods: {
getPopupContainer() { getPopupContainer() {
......
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
} else if (item.path && item.path === key) { } else if (item.path && item.path === key) {
console.log(item, key); console.log(item, key);
menuStack.push(item); menuStack.push(item);
this.$store.dispatch("common/setMenuStack", menuStack); this.$store.commit("common/setMenuStack", menuStack);
return true; return true;
} }
} }
......
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
const menuStack = JSON.parse(JSON.stringify(this.menuStack)); const menuStack = JSON.parse(JSON.stringify(this.menuStack));
const isVisit = this.isVisit(menuStack[index].path); const isVisit = this.isVisit(menuStack[index].path);
menuStack.splice(index, 1); menuStack.splice(index, 1);
this.$store.dispatch("common/setMenuStack", menuStack); this.$store.commit("common/setMenuStack", menuStack);
if (isVisit) { if (isVisit) {
// 关闭的是当前正在查看的 // 关闭的是当前正在查看的
const i = Math.max(0, index - 1); const i = Math.max(0, index - 1);
......
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