master
bibi 3 years ago
parent dfca7c9ee2
commit ae4b8fa2b5

@ -1,3 +1,3 @@
NODE_ENV = 'development'
VUE_APP_URL = 'http://121.41.26.2251:8002/admin'
VUE_APP_CDN = 'http://121.41.26.2251:8002/admin'
VUE_APP_STATIC = 'http://121.41.26.2251:8002/admin'

@ -1,3 +1,3 @@
NODE_ENV = 'production'
VUE_APP_URL = 'http://121.41.26.2251:8002/admin'
VUE_APP_CDN = 'http://121.41.26.2251:8002/admin'
VUE_APP_URL = 'https://saas.kaidalai.cn/api/admin/'
VUE_APP_STATIC = 'https://saas.kaidalai.cn/api/admin/'

@ -12,10 +12,10 @@ export default {
install(Vue) {
Vue.mixin({
computed: {
...mapGetters(['getSelectedKeys', 'getOpenKeys'])
...mapGetters(['getToken','getCommunityCode','getSelectedKeys', 'getOpenKeys'])
},
methods: {
...mapActions(['setSelectedKeys', 'setOpenKeys'])
...mapActions(['setToken','setCommunityCode','setSelectedKeys', 'setOpenKeys'])
}
})
}

@ -1,18 +1,19 @@
/*
* @Author: your name
* @Date: 2021-11-18 17:34:50
* @LastEditTime: 2021-11-18 17:37:15
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /ansu-business/src/permission.js
*/
import NProgress from "nprogress"
import "nprogress/nprogress.css"
import router from "@/router"
import store from '@/store'
const whitePath = [ '/login']
// 判断登录
router.beforeEach((to, from, next) => {
NProgress.start()
const token = store.getters.getToken;
if(!token && !whitePath.includes(to.path)) {
next('/login');
} else {
next();
NProgress.done()
}
})
router.afterEach(() => {

@ -1,3 +1,11 @@
/*
* @Author: your name
* @Date: 2021-10-13 09:28:02
* @LastEditTime: 2022-01-05 13:44:32
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /data-show/src/request/index.js
*/
import axios from 'axios';
// import qs from 'qs';
import router from "@/permission"
@ -17,10 +25,10 @@ function filterRequestData(obj) {
}
//创建axios的实例
const httpService = axios.create({
baseURL: process.env.VUE_APP_URL + '/1',// TODO:具体的配置可以根据项目情况而来
baseURL: process.env.VUE_APP_URL,// TODO:具体的配置可以根据项目情况而来
timeout: 5000
})
// + communityCode
//axios的拦截--request
httpService.interceptors.request.use(config => {
const rqParams = filterRequestData(config.params);
@ -28,7 +36,7 @@ httpService.interceptors.request.use(config => {
// post 'Content-Type' === 'application/x-www-form-urlencoded'
config.headers['Content-Type'] = "application/json";
config.headers['manage-login-token'] = store.getters.getToken;
config.headers['device-type'] = "web";
// config.headers['device-type'] = "web";
if(config.method === 'post') {
config.data = rqData;
} else {
@ -43,14 +51,18 @@ httpService.interceptors.request.use(config => {
//4、axios的拦截--response
httpService.interceptors.response.use(response => {
// TODO:具体的code对应的处理可继续添加修改
let data = null;
// let data = null;
let msg = '';
let res = response.data;
if(res.code == 0){
data = res.data;
msg = res.msg || "";
return {data, msg};
} else if(res.code == 100000) {
// console.log(response);
if(res.code === 200){
// code = 200;
// data = res.data;
// msg = res.msg || "";
// console.log(msg);
// console.log(data);
return res;
} else if(res.code == 10010) {
router.replace({
path: '/login'
});

@ -7,6 +7,12 @@
* @FilePath: /ansu-business/src/store/actions.js
*/
const actions = {
setToken: ({commit}, log) => {
commit('setToken', log)
},
setCommunityCode: ({commit}, log) => {
commit('setCommunityCode', log)
},
setSelectedKeys: ({commit}, log) => {
commit('setSelectedKeys', log)
},

@ -12,7 +12,13 @@ const getters = {
},
getOpenKeys(state) {
return state.openKeys
}
},
getToken(state) {
return state.token
},
getCommunityCode(state) {
return state.communityCode
},
}
export default getters

@ -17,6 +17,14 @@ const mutations = {
let str = JSON.stringify(log);
sessionStorage.setItem('openKeys', str);
},
setToken: (state, log) => {
state.token = log;
sessionStorage.setItem('token', log);
},
setCommunityCode: (state, log) => {
state.communityCode = log;
sessionStorage.setItem('communityCode', log);
},
}
export default mutations

@ -8,6 +8,8 @@
*/
const state = {
selectedKeys: JSON.parse(sessionStorage.getItem('selectedKeys')) || ['/'],
openKeys: JSON.parse(sessionStorage.getItem('openKeys')) || []
openKeys: JSON.parse(sessionStorage.getItem('openKeys')) || [],
token: sessionStorage.getItem('token') || "",
communityCode: sessionStorage.getItem('communityCode') || "",
}
export default state

@ -27,7 +27,7 @@
}
.search-box {
margin: 30px;
margin: 20px;
}
.add-btn{

@ -0,0 +1,69 @@
/**
* 配置
* 表格列
*/
export const columns = [
{
title: "真实名称",
dataIndex: "actualName",
width: "12%",
},
{
title: "手机号",
dataIndex: "tel",
width: "14%",
},
{
title: "所属部门",
dataIndex: "departmentName",
width: "16%",
},
{
title: "岗位",
dataIndex: "positionName",
width: "10%",
},
{
title: "状态",
dataIndex: "status",
width: "16%",
customRender: function (status) {
switch (status) {
case 1:
return '正常'
case 2:
return '停用'
default:
break;
}
}
},
{
title: "备注",
dataIndex: "remake",
width: "300",
},
{
title: "操作",
dataIndex: "action",
key: "action",
width: "180",
fixed: "right",
scopedSlots: { customRender: "action" },
},
]
// 搜索项
export const searchForm = {
keyword: "",
departmentId: null,
positionId: null,
}
// 分页
export const pagination = {
current: 1,
total: 0,
pageSize: 10,
showTotal: (total) => `${total}`,
showSizeChanger: true,
showQuickJumper: true,
}

@ -0,0 +1,427 @@
<template>
<div>
<a-form-model
title="1d2"
layout="vertical"
ref="ruleForm"
:model="form"
:rules="rules"
:wrapper-col="{ span: 18 }"
>
<div>基本信息</div>
<a-divider></a-divider>
<a-row>
<a-col :span="12">
<a-form-model-item label="真实姓名" prop="actualName">
<a-input v-model="form.actualName" placeholder="请输入真实姓名" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="性别" prop="sex">
<a-select v-model="form.sex" placeholder="请选择性别">
<a-select-option v-for="item in sexOption" :key="item.id">{{
item.name
}}</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="身份证号" prop="idCard">
<a-input v-model="form.idCard" placeholder="请输入身份证号" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item ref="tel" label="手机号" prop="tel">
<a-input
v-model="form.tel"
placeholder="请输入手机号"
@blur="
() => {
$refs.tel.onFieldBlur();
}
"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="出生日期" prop="birthday">
<a-date-picker v-model="form.birthday" value-format="YYYY-MM-DD HH:mm:ss"/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="密码" prop="password">
<a-input
type="password"
placeholder="不输入默认为手机号后6位"
v-model="form.password"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="电子邮箱" prop="email">
<a-input placeholder="请输入电子邮箱" v-model="form.email" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="居住地址" prop="address">
<a-input placeholder="请输入居住地址" v-model="form.address" />
</a-form-model-item>
</a-col>
身份证照片
<a-upload
:action="`${$upload}`"
:headers="uploadHeaders"
list-type="picture-card"
:file-list="idcardfileList"
@preview="handlePreview"
@change="idcardhandleChange"
>
<div v-if="idcardfileList.length < 2">
<!-- <a-icon type="plus" /> -->
<a-icon :type="imgLoading ? 'loading' : 'plus'" />
<div class="ant-upload-text">点击上传</div>
</div>
</a-upload>
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
<img alt="example" style="width: 100%" :src="previewImage" />
</a-modal>
<span style="color: #00000073"
>单张最多不超过4M最多上传2张支持JPG,PNG格式</span
>
</a-row>
<div>入职信息</div>
<a-divider></a-divider>
<a-row>
<a-col :span="12">
<a-form-model-item label="岗位" prop='departmentIdPath'>
<a-cascader
:field-names="{
label: 'name',
value: 'id',
children: 'childList',
}"
:options="treeData"
placeholder="请选择"
change-on-select
@change="onChange"
v-model="cascVal"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="入职时间" prop="entryDate">
<a-date-picker
placeholder="请选择入职时间"
v-model="form.entryDate"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="薪资" prop="salary">
<a-input placeholder="请输入薪资" v-model="form.salary" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<div>上传资料</div>
<a-upload
:action="`${$baseUrl}/user/upload/uploadManageUserData`"
:headers="uploadHeaders"
list-type="picture"
:default-file-list="fileList"
>
<a-button> <a-icon type="upload"/> 点击上传 </a-button>
</a-upload>
<span style="color: #00000073">支持上传PNGJPG,PDF文件</span>
</a-col>
</a-row>
<div style="margin-top: 20px">联系信息</div>
<a-divider></a-divider>
<a-row>
<a-col :span="12">
<a-form-model-item label="紧急联系人" prop="emergencyContact">
<a-input
placeholder="请输入紧急联系人"
v-model="form.emergencyContact"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="紧急联系电话" prop="emergencyContactNumber">
<a-input
placeholder="请输入紧急联系电话"
v-model="form.emergencyContactNumber"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item
label="紧急联系地址"
prop="emergencyContactAddress"
>
<a-input
placeholder="请输入紧急联系地址"
v-model="form.emergencyContactAddress"
/>
</a-form-model-item>
</a-col>
</a-row>
<div>其他信息</div>
<a-divider></a-divider>
<a-row>
<a-col :span="12">
<a-form-model-item label="婚姻状态" prop="maritalStatus">
<a-select
placeholder="请选择婚姻状态"
v-model="form.maritalStatus"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="民族" prop="nation">
<a-select placeholder="请输入民族" v-model="form.nation" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="政治面貌" prop="politicalOutlook">
<a-select
placeholder="请选择政治面貌"
v-model="form.politicalOutlook"
/>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="户口类型" prop="accountType">
<a-select placeholder="请选择类型" v-model="form.accountType" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="备注" prop="remake">
<a-textarea
v-model="form.remake"
placeholder="请输入备注"
></a-textarea>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</div>
</template>
<script>
import { insertManageUser,departmentList,manageUserInfo,EditManageUser } from "@/api/basic/department";
import store from "@/store";
function getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
export default {
name: "Vueform",
props: {
type: {
type: String,
default:'add'
},
editId:Number,
},
watch: {
editId: {
handler(val) {
if(val === null){
return
}
this.form.id =val;
manageUserInfo({id:this.form.id}).then(res=>{
let data = res.data
this.form.actualName = data.actualName
this.form.sex = data.sex
this.form.idCard = data.idCard
this.form.tel = data.tel
this.telephoneNum = data.tel
this.form.birthday = data.birthday
this.form.password = data.password
this.form.email = data.email
this.form.address = data.address
this.form.entryDate = data.entryDate
this.form.salary = data.salary
this.form.emergencyContact = data.emergencyContact
this.form.emergencyContactNumber = data.emergencyContactNumber
this.form.emergencyContactAddress = data.emergencyContactAddress
this.form.maritalStatus = data.maritalStatus
this.form.nation = data.nation
this.form.politicalOutlook = data.politicalOutlook
this.form.accountType = data.accountType
this.form.remake = data.remake
//
this.cascVal = []
let path = data.departmentIdPath.split(':')
path.pop()
path.splice(0,1)
path.push(data.positionId)
path.forEach(element => {
this.cascVal.push(Number(element))
});
//
this.form.idCardImgUrls = data.idCardImgUrls || []
})
},
immediate: true,
},
},
data() {
return {
previewVisible: false,
previewImage: "",
imgLoading: false,
treeData:[],
cascVal:[],
telephoneNum:"",
uploadHeaders: {
"manage-login-token": store.getters.getToken,
},
sexOption: [
{
id: 1,
name: "男",
},
{
id: 2,
name: "女",
},
{
id: 3,
name: "保密",
},
],
form: {
id:null,
actualName: "",
sex: null,
idCard: "",
tel: "",
birthday: "",
password: "",
email: "",
address: "",
idCardImgUrls: [],
departmentId: "",
departmentIdPath: "",
positionId: "",
entryDate: "",
salary: "",
dataImgUrls: "",
emergencyContact: "",
emergencyContactNumber: "",
emergencyContactAddress: "",
maritalStatus: "",
nation: "",
politicalOutlook: "",
accountType: "",
remake: "",
},
rules: {
actualName: [
{ required: true, message: "请输入真实姓名", trigger: "blur" },
],
sex: [{ required: true, message: "请选择性别", trigger: "change" }],
idCard: [
{ required: true, message: "请输入身份证号", trigger: "blur" },
],
tel: [
{ required: true, message: "请输入手机号", trigger: "blur" },
{ min: 11, max: 11, message: "手机号只能为11位", trigger: "blur" },
],
entryDate: [
{ required: true, message: "请选择入职时间", trigger: "change" },
],
},
idcardfileList: [],
fileList:[]
};
},
created() {
this.getData()
},
methods: {
getData(){
departmentList().then((res) => {
this.treeData = res.data;
});
},
//
submit() {
this.$refs.ruleForm.validate((valid) => {
if (!valid) {
return;
}
if (this.type === "add") {
insertManageUser(this.form).then((res) => {
if(res.code===200){
this.$message.success(res.msg)
this.success()
this.close()
}
});
} else {
if(this.form.tel === this.telephoneNum){
this.form.tel = null
}
console.log(this.form);
EditManageUser(this.form).then((res) => {
if(res.code===200){
this.$message.success(res.msg)
this.success()
this.close()
}
});
}
});
},
//
close() {
this.$refs.ruleForm.resetFields();
this.cascVal = []
},
success(){
this.$emit('success')
},
async handlePreview(file) {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
},
onChange(data) {
// data [1,2,2]
// yyyy-mm-dd hh:mm:ss
let _data = JSON.parse(JSON.stringify(data))
this.form.positionId = _data.pop() //2
this.form.departmentId = _data[_data.length-1] //[1,2]==>2
let str = ''
// 1:2:
for (let i = 0; i < _data.length; i++) {
str += _data[i]+':'
}
// 0:1:2:
this.form.departmentIdPath = '0:'+ str
},
handleCancel() {
this.previewVisible = false;
},
idcardhandleChange(info) {
this.idcardfileList = info.fileList
if(info.file.status === 'done'){
this.form.idCardImgUrls.push(info.file.response.data)
}
},
},
};
</script>
<style lang="less" scoped>
</style>

@ -40,13 +40,25 @@ export default {
components: {
yMenu,
},
mounted(){
this.$router.push({ name: sessionStorage.getItem('routerName') });
// this.tagActive = Number(sessionStorage.getItem('index'))
},
watch: {
$route: {
handler(val) {
this.tags = val.matched;
sessionStorage.setItem('routerName',val.name)
},
immediate: true,
},
tagActive:{
handler(val) {
// console.log(val);
sessionStorage.setItem('modal',this.menuTags[val].value)
},
immediate: true,
}
},
data() {
return {

@ -1,16 +1,8 @@
<!--
* @Author: your name
* @Date: 2021-11-22 16:20:34
* @LastEditTime: 2021-11-22 16:20:34
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /ansu-business/src/views/Login/index.vue
-->
<template>
<div class="bg">
<div class="logo-box">
<img src="@/assets/images/logo.png" alt="" />
<span class="title">智慧小区平台</span>
<span class="title">智慧小区后台管理系统</span>
</div>
<div class="login-box">
<a-row>
@ -21,18 +13,23 @@
<!-- 登录 -->
<a-col class="box-b" v-if="status === 1">
<a-tabs v-model="activeName" @change="tabsSwitch">
<a-tab-pane key="1" tab="密码登录">
</a-tab-pane>
<a-tab-pane key="2" tab="验证码登录">
</a-tab-pane>
<!-- <a-tab-pane key="1" tab="密码登录">
</a-tab-pane> -->
<a-tab-pane key="2" tab="验证码登录"> </a-tab-pane>
</a-tabs>
<div class="login-input">
<div class="login-input" v-if="activeName === '1'">
<a-input placeholder="请输入手机号码"></a-input>
<a-input type="password" placeholder="请输入密码"></a-input>
<a-row>
<a-col :span="12" style="margin-left:23px"><a-checkbox></a-checkbox>&nbsp;&nbsp;</a-col>
<a-col :span="12" style="margin-left: 23px"
><a-checkbox></a-checkbox>&nbsp;&nbsp;</a-col
>
</a-row>
<a-button type="primary" style="width:90%;margin:30px">
<a-button
type="primary"
@click="login"
style="width: 90%; margin: 30px"
>
登录
</a-button>
<a-row style="margin-top: 20px; margin-left: 23px">
@ -40,7 +37,46 @@
<a-checkbox></a-checkbox>&nbsp;&nbsp;
</a-col>
<a-col :span="10">
<span class="logintext" @click="status=3"></span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="logintext" @click="status=2"></span>
<span class="logintext" @click="status = 3">忘记密码</span
>&nbsp;&nbsp;&nbsp;&nbsp;<span
class="logintext"
@click="status = 2"
>免费注册</span
>
</a-col>
</a-row>
</div>
<div class="login-input" v-else-if="activeName === '2'">
<a-input placeholder="请输入手机号码" v-model="form.tel"></a-input>
<a-input
placeholder="请输入验证码"
v-model="form.code"
style="width: 60%"
></a-input>
<a-button type="primary" @click="getCode"></a-button>
<a-row>
<a-col :span="12" style="margin-left: 23px"
><a-checkbox></a-checkbox>&nbsp;&nbsp;</a-col
>
</a-row>
<a-button
type="primary"
@click="login"
style="width: 90%; margin: 30px"
>
登录
</a-button>
<a-row style="margin-top: 20px; margin-left: 23px">
<a-col :span="14">
<a-checkbox></a-checkbox>&nbsp;&nbsp;
</a-col>
<a-col :span="10">
<span class="logintext" @click="status = 3">忘记密码</span
>&nbsp;&nbsp;&nbsp;&nbsp;<span
class="logintext"
@click="status = 2"
>免费注册</span
>
</a-col>
</a-row>
</div>
@ -52,9 +88,7 @@
ref="ruleForm"
:model="form"
:rules="rules"
:label-col="inline"
layout="vertical"
:wrapper-col="wrapperCol"
>
<a-form-model-item ref="tel" label="手机号码" prop="tel">
<a-input
@ -89,12 +123,11 @@
<a-input placeholder="请再次输入密码" />
</a-form-model-item>
<a-form-model-item>
<a-button type="primary" style="width:100%">
确定
</a-button>
<a-button type="primary" style="width: 100%"> 确定 </a-button>
</a-form-model-item>
<a-form-model-item>
<span>已有账号</span><span class="logintext" @click="status=1"></span>
<span>已有账号</span
><span class="logintext" @click="status = 1">登录</span>
</a-form-model-item>
</a-form-model>
</a-col>
@ -105,9 +138,7 @@
ref="ruleForm"
:model="form"
:rules="rules"
:label-col="inline"
layout="vertical"
:wrapper-col="wrapperCol"
>
<a-form-model-item ref="tel" label="手机号码" prop="tel">
<a-input
@ -142,12 +173,11 @@
<a-input placeholder="请再次输入密码" />
</a-form-model-item>
<a-form-model-item>
<a-button type="primary" style="width:100%">
确定
</a-button>
<a-button type="primary" style="width: 100%"> 确定 </a-button>
</a-form-model-item>
<a-form-model-item>
<span>已有账号</span><span class="logintext" @click="status=1"></span>
<span>已有账号</span
><span class="logintext" @click="status = 1">登录</span>
</a-form-model-item>
</a-form-model>
</a-col>
@ -157,14 +187,16 @@
</template>
<script>
// import { loginTel, sendTelCode } from "../../api/public/login";
export default {
name: "Login",
data() {
return {
status: 1,
activeName:'1',
activeName: "2",
form: {
tel:''
tel: "",
code: "",
},
rules: {
tel: [
@ -196,12 +228,41 @@ export default {
},
};
},
created() {
this.keyupEnter();
this.setCommunityCode(123456);
},
methods: {
login() {
this.$router.push({ name: "Console" });
// enter
keyupEnter() {
document.onkeydown = (e) => {
if (e.keyCode === 13 && e.target.baseURI.match(/loginTel/)) {
//
this.login();
}
};
},
// login() {
// loginTel(this.form).then(res=>{
// if (res.code === 200) {
// this.$message.success(res.msg);
// // token
// this.setToken(res.data);
// this.$router.push("/");
// } else {
// this.$message.error(res.msg);
// }
// })
// },
//
getCode(){},
// getCode() {
// sendTelCode(this.form).then((res) => {
// if (res) {
// // this.$message.success("");
// this.$message.success(res.msg +' ' +res.data);
// }
// });
// },
onSubmit() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
@ -218,7 +279,7 @@ export default {
},
tabsSwitch() {
console.log(this.activeName);
}
},
},
};
</script>
@ -244,7 +305,11 @@ export default {
margin-bottom: 13px;
}
.title {
font-size:28px;color:#333333;font-weight:500;margin-left: 20px;line-height: 93px;
font-size: 28px;
color: #333333;
font-weight: 500;
margin-left: 20px;
line-height: 93px;
}
}
.login-box {
@ -274,7 +339,7 @@ export default {
margin-bottom: 40px;
}
.logintext {
color: #205FBD;
color: #205fbd;
cursor: pointer;
}
/deep/.ant-form-item {

Loading…
Cancel
Save