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

登录模块完成

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