parent
28f6136aa2
commit
682031ec2e
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 849 B |
@ -1,101 +1,117 @@
|
||||
import { login, logout, getInfo } from '@/api/login'
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||
import { login, logout, getInfo } from "@/api/login";
|
||||
import { getToken, setToken, removeToken } from "@/utils/auth";
|
||||
|
||||
const user = {
|
||||
state: {
|
||||
token: getToken(),
|
||||
id: '',
|
||||
name: '',
|
||||
avatar: '',
|
||||
id: "",
|
||||
name: "",
|
||||
avatar: "",
|
||||
roles: [],
|
||||
permissions: []
|
||||
dept: {},
|
||||
permissions: [],
|
||||
},
|
||||
|
||||
mutations: {
|
||||
SET_TOKEN: (state, token) => {
|
||||
state.token = token
|
||||
state.token = token;
|
||||
},
|
||||
SET_ID: (state, id) => {
|
||||
state.id = id
|
||||
state.id = id;
|
||||
},
|
||||
SET_NAME: (state, name) => {
|
||||
state.name = name
|
||||
state.name = name;
|
||||
},
|
||||
SET_AVATAR: (state, avatar) => {
|
||||
state.avatar = avatar
|
||||
state.avatar = avatar;
|
||||
},
|
||||
SET_ROLES: (state, roles) => {
|
||||
state.roles = roles
|
||||
state.roles = roles;
|
||||
},
|
||||
SET_DEPT: (state, dept) => {
|
||||
state.dept = dept;
|
||||
},
|
||||
SET_PERMISSIONS: (state, permissions) => {
|
||||
state.permissions = permissions
|
||||
}
|
||||
state.permissions = permissions;
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
// 登录
|
||||
Login({ commit }, userInfo) {
|
||||
const username = userInfo.username.trim()
|
||||
const password = userInfo.password
|
||||
const code = userInfo.code
|
||||
const uuid = userInfo.uuid
|
||||
const username = userInfo.username.trim();
|
||||
const password = userInfo.password;
|
||||
const code = userInfo.code;
|
||||
const uuid = userInfo.uuid;
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid).then(res => {
|
||||
setToken(res.token)
|
||||
commit('SET_TOKEN', res.token)
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
login(username, password, code, uuid)
|
||||
.then((res) => {
|
||||
setToken(res.token);
|
||||
commit("SET_TOKEN", res.token);
|
||||
resolve();
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
GetInfo({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
const user = res.user
|
||||
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
|
||||
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
||||
commit('SET_ROLES', res.roles)
|
||||
commit('SET_PERMISSIONS', res.permissions)
|
||||
} else {
|
||||
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
||||
}
|
||||
commit('SET_ID', user.userId)
|
||||
commit('SET_NAME', user.userName)
|
||||
commit('SET_AVATAR', avatar)
|
||||
resolve(res)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
getInfo()
|
||||
.then((res) => {
|
||||
const user = res.user;
|
||||
const avatar =
|
||||
user.avatar == "" || user.avatar == null
|
||||
? require("@/assets/images/profile.jpg")
|
||||
: process.env.VUE_APP_BASE_API + user.avatar;
|
||||
if (res.roles && res.roles.length > 0) {
|
||||
// 验证返回的roles是否是一个非空数组
|
||||
commit("SET_ROLES", res.roles);
|
||||
|
||||
commit("SET_PERMISSIONS", res.permissions);
|
||||
} else {
|
||||
commit("SET_ROLES", ["ROLE_DEFAULT"]);
|
||||
}
|
||||
commit("SET_DEPT", user.dept);
|
||||
commit("SET_ID", user.userId);
|
||||
commit("SET_NAME", user.userName);
|
||||
commit("SET_AVATAR", avatar);
|
||||
resolve(res);
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 退出系统
|
||||
LogOut({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout(state.token).then(() => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
commit('SET_PERMISSIONS', [])
|
||||
removeToken()
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
logout(state.token)
|
||||
.then(() => {
|
||||
commit("SET_TOKEN", "");
|
||||
commit("SET_ROLES", []);
|
||||
commit("SET_PERMISSIONS", []);
|
||||
removeToken();
|
||||
resolve();
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 前端 登出
|
||||
FedLogOut({ commit }) {
|
||||
return new Promise(resolve => {
|
||||
commit('SET_TOKEN', '')
|
||||
removeToken()
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
commit("SET_TOKEN", "");
|
||||
removeToken();
|
||||
resolve();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default user
|
||||
export default user;
|
||||
|
@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<div class="model-left">
|
||||
<introduceTitle title="社区概况" />
|
||||
<div class="community-table">
|
||||
<div class="table-row">
|
||||
<div class="row-lable">地名</div>
|
||||
<div class="row-value">{{ xiaoquIntroduce.intro.shequ.diming }}</div>
|
||||
</div>
|
||||
<div class="table-row">
|
||||
<div class="row-lable">隶属</div>
|
||||
<div class="row-value">{{ xiaoquIntroduce.intro.shequ.lishu }}</div>
|
||||
</div>
|
||||
<div class="table-row">
|
||||
<div class="row-lable">行政代码</div>
|
||||
<div class="row-value">{{ xiaoquIntroduce.intro.shequ.xzdaima }}</div>
|
||||
</div>
|
||||
<div class="table-row">
|
||||
<div class="row-lable">身份证前6位</div>
|
||||
<div class="row-value">{{ xiaoquIntroduce.intro.shequ.id6 }}</div>
|
||||
</div>
|
||||
<div class="table-row">
|
||||
<div class="row-lable">长途区号</div>
|
||||
<div class="row-value">{{ xiaoquIntroduce.intro.shequ.ctquhao }}</div>
|
||||
</div>
|
||||
<div class="table-row">
|
||||
<div class="row-lable">邮政编码</div>
|
||||
<div class="row-value">{{ xiaoquIntroduce.intro.shequ.youzheng }}</div>
|
||||
</div>
|
||||
<div class="table-row">
|
||||
<div class="row-lable">车牌号码</div>
|
||||
<div class="row-value">{{ xiaoquIntroduce.intro.shequ.chep }}</div>
|
||||
</div>
|
||||
<div class="table-row">
|
||||
<div class="row-lable">行政级别</div>
|
||||
<div class="row-value">{{ xiaoquIntroduce.intro.shequ.jibie }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="introduce-content">
|
||||
<div>{{ xiaoquIntroduce.intro.kaiguo.text || "暂无数据" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import introduceTitle from "@/views/components/introduceTitle/subTtile.vue";
|
||||
import { mapGetters } from "vuex";
|
||||
export default {
|
||||
components: { introduceTitle },
|
||||
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
mounted() {},
|
||||
computed: {
|
||||
...mapGetters(["xiaoquIntroduce"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.model-left {
|
||||
flex: 1;
|
||||
padding: 25px 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
|
||||
.community-table {
|
||||
margin-top: 20px;
|
||||
height: 290px;
|
||||
border: 1px solid #1b4296;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
.table-row {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-family: "Alibaba-PuHuiTi-Regular.otf";
|
||||
border-bottom: 1px solid #1b4296;
|
||||
.row-lable {
|
||||
padding: 7px 0;
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
font-size: 15px;
|
||||
color: #00ff9c;
|
||||
border-right: 1px solid #1b4296;
|
||||
overflow: hidden;
|
||||
}
|
||||
.row-value {
|
||||
padding: 7px;
|
||||
flex: 1;
|
||||
font-size: 15px;
|
||||
color: #d3e9ff;
|
||||
}
|
||||
}
|
||||
& .table-row:last-child {
|
||||
border-bottom: 0px;
|
||||
}
|
||||
}
|
||||
.introduce-content {
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
margin-top: 20px;
|
||||
padding: 35px 15px;
|
||||
padding-right: 0;
|
||||
background: url("~@/assets/images/ui/introduce-text.png");
|
||||
background-size: 100% 100%;
|
||||
overflow: hidden;
|
||||
& > div {
|
||||
padding-right: 10px;
|
||||
height: 100%;
|
||||
font-size: 15px;
|
||||
color: #d3e9ff;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*全局滚动条样式*/
|
||||
::-webkit-scrollbar {
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
height: 10px;
|
||||
width: 1px;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
@ -1,3 +1,5 @@
|
||||
export { default as foldpanelLeft } from "./foldpanelLeft";
|
||||
export { default as foldpanelRight } from "./foldpanelRight";
|
||||
export { default as introduceTitle } from "./introduceTitle";
|
||||
|
||||
export { default as IndexModelLeft } from "./IndexModel/left.vue";
|
||||
export { default as IndexModelRight } from "./IndexModel/right.vue";
|
||||
|
@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<div class="introduce-title">
|
||||
<span class="main-title">{{ title }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: "标题",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.introduce-title {
|
||||
height: 40px;
|
||||
background: url("~@/assets/images/ui/user_title.png");
|
||||
background-size: 100% 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
.main-title {
|
||||
margin-left: 40px;
|
||||
font-size: 19px;
|
||||
color: #ffffff;
|
||||
font-family: "xiniu";
|
||||
background: linear-gradient(0deg, #00beff 0%, #ffffff 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue