| | |
| | | <template> |
| | | <div class="container"> |
| | | <div class="container" v-if="!showWelcome"> |
| | | <div class="container-left"> |
| | | <div |
| | | class="left-card" |
| | | :class="activeIndex == index ? 'left-card-active' : ''" |
| | | v-for="(item, index) in menuArr" |
| | | :key="index" |
| | | @click="openMenu(item, index)" |
| | | @click="openMenu(item.name, index)" |
| | | > |
| | | <span class="icon iconfont"></span> |
| | | <span class="card-text">{{ item.name }}</span> |
| | |
| | | <div class="touxiang"> |
| | | <img |
| | | v-if="item.headpic" |
| | | :src=" |
| | | item.headpic.indexOf('http') > -1 |
| | | ? item.headpic |
| | | : 'http://' + item.headpic |
| | | " |
| | | :src="`data:image/png;base64,${item.headpic}`" |
| | | alt="" |
| | | /> |
| | | |
| | | </div> |
| | | <span class="user-name">{{ item.username }}</span> |
| | | </div> |
| | |
| | | <span class="week">{{ weekday }}</span> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="line"> |
| | | <div class="name">NTP校时</div> |
| | | <el-switch |
| | |
| | | <div class="touxiang-big"> |
| | | <img |
| | | v-if="activeAccountItem.headpic" |
| | | :src=" |
| | | activeAccountItem.headpic.indexOf('http') > -1 |
| | | ? activeAccountItem.headpic |
| | | : 'http://' + activeAccountItem.headpic |
| | | " |
| | | :src="`data:image/png;base64,${activeAccountItem.headpic}`" |
| | | alt="" |
| | | /> |
| | | </div> |
| | |
| | | |
| | | <div class="change-pw" v-if="inAccountDetail && isChangePw"> |
| | | <div class="title">修改密码</div> |
| | | |
| | | <el-form |
| | | :model="passwordForm" |
| | | :rules="pwRules" |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="btns"> |
| | | <div class="cancel" @click="cancelChangePassword">取消</div> |
| | | <div class="cancel" @click="cancelPassword">取消</div> |
| | | <div class="ok" @click="SaveNewPassword('passwordForm')">保存</div> |
| | | </div> |
| | | </div> |
| | |
| | | <div |
| | | class="upload-jpg" |
| | | :class=" |
| | | selectedPic == index && url !== '' ? 'upload-jpg-mask' : '' |
| | | selectedPic == index? 'upload-jpg-border' : '' |
| | | " |
| | | v-for="(url, index) in jpgArr" |
| | | v-for="(item, index) in jpgArr" |
| | | :key="index" |
| | | @click="pickHeadDefPic(url, index)" |
| | | @click="pickHeadDefPic(item, index)" |
| | | > |
| | | <img v-if="url !== ''" :src="url" alt="" srcset="" /> |
| | | <img |
| | | v-if="item" |
| | | :src="`data:image/png;base64,${item.path}`" |
| | | alt="" |
| | | srcset="" |
| | | /> |
| | | <div class="img-mask" v-if="selectedPic == index"> |
| | | <span class="icon iconfont enable"></span> |
| | | </div> |
| | | </div> |
| | | |
| | | <el-upload |
| | | <!-- <el-upload |
| | | class="upload-demo" |
| | | action="https://jsonplaceholder.typicode.com/posts/" |
| | | :show-file-list="false" |
| | | :http-request="uploadUserPic" |
| | | > |
| | | <div class="upload-jpg-up">上传</div> |
| | | </el-upload> |
| | | <div v-if="loadedPic == ''" class="upload-jpg-up">上传</div> |
| | | </el-upload> --> |
| | | </div> |
| | | <div class="fill-group"> |
| | | <el-form |
| | |
| | | placeholder="必填" |
| | | v-model="addForm.userName" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="roleId"> |
| | | <div class="p-title">角色:</div> |
| | | <el-select v-model="addForm.roleId" placeholder="请选择角色"> |
| | | <el-option |
| | | v-for="(item, i) in roleList" |
| | | :key="i" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item prop="nickName"> |
| | | <div class="p-title">昵称:</div> |
| | |
| | | </div> |
| | | |
| | | <div class="btns"> |
| | | <div class="cancel" @click="cancelChangePassword">取消</div> |
| | | <div class="cancel" @click="cancelPassword">取消</div> |
| | | <div class="ok" @click="submitClock">保存</div> |
| | | </div> |
| | | </div> |
| | |
| | | style="width: 100%" |
| | | ></generalSettings> |
| | | </div> |
| | | <div class="welcome-page" v-else> |
| | | <div class="child" @click="openWelcome('账户',0)"> |
| | | <div class="child-info"> |
| | | <span class="icon iconfont welcome-icon"></span> |
| | | <span class="welcome-title">账户</span> |
| | | </div> |
| | | </div> |
| | | <div class="child" @click="openWelcome('日期时间',1)"> |
| | | <div class="child-info"> |
| | | <span class="icon iconfont welcome-icon"></span> |
| | | <span class="welcome-title">日期时间</span> |
| | | </div> |
| | | </div> |
| | | <div class="child" @click="openWelcome('集群管理',2)"> |
| | | <div class="child-info"> |
| | | <span class="icon iconfont welcome-icon"></span> |
| | | <span class="welcome-title">集群管理</span> |
| | | </div> |
| | | </div> |
| | | <div class="child" @click="openWelcome('网络设置',3)"> |
| | | <div class="child-info"> |
| | | <span class="icon iconfont welcome-icon"></span> |
| | | <span class="welcome-title">网络设置</span> |
| | | </div> |
| | | </div> |
| | | <div class="child" @click="openWelcome('键盘和语言',4)"> |
| | | <div class="child-info"> |
| | | <span class="icon iconfont welcome-icon"></span> |
| | | <span class="welcome-title">键盘和语言</span> |
| | | </div> |
| | | </div> |
| | | <div class="child" @click="openWelcome('通用设置',5)"> |
| | | <div class="child-info"> |
| | | <span class="icon iconfont welcome-icon"></span> |
| | | <span class="welcome-title">通用设置</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | deleteUser, |
| | | getUserMenus, |
| | | defHeadPics, |
| | | getRoles, |
| | | } from "@/api/user"; |
| | | import switchBar from "../components/switchBar"; |
| | | import ipInput from "@/components/subComponents/IPInput"; |
| | |
| | | activeAccountItem: {}, |
| | | syncMonth: "", |
| | | syncHour: "", |
| | | showWelcome: true, |
| | | syncDay: "", |
| | | syncMin: "", |
| | | syncSec: "00", |
| | |
| | | showMonthInput: false, |
| | | selectedPic: null, |
| | | showDayInput: false, |
| | | loadedPic: "", |
| | | cameraInfo: false, |
| | | dependentScene: false, |
| | | timestamp: 0, |
| | |
| | | syncType: "1", |
| | | equipmentTime: "", |
| | | equipmentDate: "", |
| | | roleList: [], |
| | | ntpTestLoading: false, |
| | | settime: "", |
| | | weekday: "", |
| | |
| | | { name: "通用设置" }, |
| | | ], |
| | | accountArr: [], |
| | | jpgArr: ["", "", "", "", "", "", "", "", ""], |
| | | jpgArr: [], |
| | | isManual: false, |
| | | isNtp: true, |
| | | activePage: "账户", |
| | |
| | | password: "", |
| | | headpic: "", |
| | | confirmPassword: "", |
| | | roleId: "", |
| | | }, |
| | | rules: { |
| | | userName: [ |
| | |
| | | }, |
| | | ], |
| | | password: [ |
| | | { required: true, message: '请输入密码', trigger: 'blur' }, |
| | | { min: 6, message: '长度至少为 6 位', trigger: 'blur' } |
| | | ], |
| | | { required: true, message: "请输入密码", trigger: "blur" }, |
| | | { min: 6, message: "长度至少为 6 位", trigger: "blur" }, |
| | | ], |
| | | confirmPassword: [{ validator: validatePass2, trigger: "blur" }], |
| | | }, |
| | | pwRules: { |
| | | // pw: [{ validator: validatePass3, trigger: "blur" }], |
| | | curPassword: [ |
| | | { required: true, message: '请输入密码', trigger: 'blur' }, |
| | | { min: 6, message: '长度至少为 6 位', trigger: 'blur' } |
| | | ], |
| | | curPassword: [ |
| | | { required: true, message: "请输入密码", trigger: "blur" }, |
| | | { min: 6, message: "长度至少为 6 位", trigger: "blur" }, |
| | | ], |
| | | newPassword: [ |
| | | { required: true, message: '请输入密码', trigger: 'blur' }, |
| | | { min: 6, message: '长度至少为 6 位', trigger: 'blur' } |
| | | ], |
| | | { required: true, message: "请输入密码", trigger: "blur" }, |
| | | { min: 6, message: "长度至少为 6 位", trigger: "blur" }, |
| | | ], |
| | | confirmPassword: [{ validator: validatePass4, trigger: "blur" }], |
| | | }, |
| | | }; |
| | |
| | | methods: { |
| | | fetchDefHeadPic() { |
| | | defHeadPics().then((res) => { |
| | | res.data.slice(0, 5).forEach((x, i) => { |
| | | this.jpgArr[i] = x; |
| | | }); |
| | | this.jpgArr = res.data; |
| | | }); |
| | | }, |
| | | fetchUserList(showLast = false) { |
| | |
| | | this.accountArr = res.data; |
| | | if (this.accountArr.length) { |
| | | this.activeAccountItem = this.accountArr[0]; |
| | | this.activeAccountIndex = 0; |
| | | } |
| | | if (showLast) { |
| | | this.cancelAdd(); |
| | | const lastIdx = this.accountArr.length - 1; |
| | | this.openAccount(this.accountArr[lastIdx], lastIdx); |
| | | |
| | | } |
| | | }); |
| | | }, |
| | |
| | | this.activeAccountItem = item; |
| | | this.activeAccountIndex = i; |
| | | this.inAccountDetail = false; |
| | | this.cancelSet(); |
| | | this.fetchMenu(); |
| | | }, |
| | | minusOne(typ) { |
| | | this.isSyncBrowser = false; |
| | |
| | | }, |
| | | fatherChange(item) { |
| | | item.children.forEach((x) => { |
| | | x.selected = false; |
| | | x.selected = item.selected; |
| | | }); |
| | | }, |
| | | childrenChange(item) { |
| | | let isAllSelected = item.children.every((x) => x.selected == true); |
| | | let isAllNotSelected = item.children.every((x) => x.selected == false); |
| | | if (isAllSelected) item.selected = true; |
| | | if (isAllNotSelected) item.selected = false; |
| | | }, |
| | | getMaxDay() { |
| | | const maxDay = new Date(+this.syncYrs, +this.syncMonth, 0).getDate(); |
| | | if (this.syncDay > maxDay) this.syncDay = maxDay; |
| | | item.selected = isAllSelected; |
| | | }, |
| | | plusOne(typ) { |
| | | this.isSyncBrowser = false; |
| | |
| | | id: this.activeAccountItem.id, |
| | | menuIds: arr, |
| | | }).then((res) => { |
| | | res.data; |
| | | if (res.success) { |
| | | this.$message.success(res.msg); |
| | | this.cancelSet(); |
| | | } |
| | | }); |
| | | }, |
| | | formatTime(number, format) { |
| | |
| | | n = n.toString(); |
| | | return n[1] ? n : "0" + n; |
| | | }, |
| | | uploadUserPic(params) { |
| | | let param = new FormData(); |
| | | param.append("file", params.file); |
| | | uploadHeadPic(param).then((res) => { |
| | | let index = this.jpgArr.findIndex((x) => x == ""); |
| | | this.$set(this.jpgArr, index, res.data); |
| | | }); |
| | | }, |
| | | // uploadUserPic(params) { |
| | | // let param = new FormData(); |
| | | // param.append("file", params.file); |
| | | // uploadHeadPic(param).then((res) => { |
| | | // this.jpgArr.push(res.data); |
| | | // this.loadedPic = res.data; |
| | | // }); |
| | | // }, |
| | | initClockConf(ntpTest = false) { |
| | | getClockInfo().then((rsp) => { |
| | | if (rsp && rsp.success) { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | openMenu(item, i) { |
| | | this.activePage = item.name; |
| | | openMenu(name, i) { |
| | | this.activePage = name; |
| | | this.activeIndex = i; |
| | | if (this.activePage == "日期时间") { |
| | | this.initClockConf(); |
| | | } |
| | | }, |
| | | openWelcome(name,i){ |
| | | this.showWelcome = false |
| | | this.openMenu(name,i) |
| | | }, |
| | | showInput(typ) { |
| | | this[`show${typ}Input`] = true; |
| | |
| | | this[`input${typ}`] = ""; |
| | | }, |
| | | syncBrowser(enable) { |
| | | this.isSyncBrowser = val; |
| | | this.isSyncBrowser = enable; |
| | | if (!enable) { |
| | | clearInterval(this.browserTimer); |
| | | } else { |
| | |
| | | showAddAccount() { |
| | | this.inAccountDetail = false; |
| | | this.isAddAccount = true; |
| | | getRoles().then((res) => { |
| | | if (res.success) { |
| | | this.roleList = res.data; |
| | | } |
| | | }); |
| | | }, |
| | | cancelAdd() { |
| | | this.inAccountDetail = false; |
| | | this.isAddAccount = false; |
| | | this.$refs["addForm"].resetFields(); |
| | | this.selectedPic = null; |
| | | }, |
| | | cancelChangePassword() { |
| | | cancelPassword() { |
| | | this.isChangePw = false; |
| | | this.inAccountDetail = false; |
| | | this.$refs['passwordForm'].resetFields() |
| | | this.$refs["passwordForm"].resetFields(); |
| | | }, |
| | | SaveNewPassword(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | |
| | | newPwd: this.passwordForm.newPassword, |
| | | }).then( |
| | | (res) => { |
| | | this.$message.success(res.data); |
| | | if (res.success) { |
| | | this.$message.success(res.msg); |
| | | this.cancelPassword(); |
| | | } |
| | | }, |
| | | (err) => { |
| | | this.$message.warning("保存失败," + err.msg); |
| | |
| | | } |
| | | }); |
| | | }, |
| | | pickHeadDefPic(url, i) { |
| | | this.addForm.headpic = url; |
| | | pickHeadDefPic(item, i) { |
| | | this.addForm.headpic = item.path; |
| | | this.selectedPic = i; |
| | | }, |
| | | testNTP() { |
| | |
| | | cancelSet() { |
| | | this.isSetPermission = false; |
| | | this.inAccountDetail = false; |
| | | this.sysMenus = []; |
| | | }, |
| | | showChangePassword() { |
| | | this.isChangePw = true; |
| | |
| | | openPermission() { |
| | | this.inAccountDetail = true; |
| | | this.isSetPermission = true; |
| | | this.fetchMenu(); |
| | | if (this.sysMenus.length == 0) { |
| | | this.fetchMenu(); |
| | | } |
| | | }, |
| | | parseTime() { |
| | | debugger; |
| | | [this.syncYrs, this.syncMonth, this.syncDay] = this.equipmentDate.split( |
| | | "-" |
| | | ); |
| | |
| | | }; |
| | | </script> |
| | | <style lang="scss"> |
| | | .welcome-page { |
| | | width: 100%; |
| | | height: 100%; |
| | | background-color: #f5f5f5; |
| | | display: -ms-flexbox; |
| | | padding: 0 50px; |
| | | -webkit-box-sizing: border-box; |
| | | box-sizing: border-box; |
| | | .child { |
| | | box-sizing: border-box; |
| | | background-color: white; |
| | | -webkit-box-flex: 0; |
| | | -ms-flex: 0 0 33.3%; |
| | | /* flex: 0 0 16%; */ |
| | | float: left; |
| | | width: 250px; |
| | | height: 200px; |
| | | margin: 50px 57px 30px 57px; |
| | | border-radius: 20px; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | cursor: pointer; |
| | | .child-info { |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: 62%; |
| | | justify-content: space-around; |
| | | .welcome-icon { |
| | | font-size: 72px; |
| | | } |
| | | .welcome-title { |
| | | font-size: 18px; |
| | | } |
| | | } |
| | | } |
| | | .child:hover { |
| | | -moz-box-shadow: 5px 5px 10px #ddd; |
| | | -webkit-box-shadow: 5px 5px 10px #ddd; |
| | | box-shadow: 5px 5px 10px #ddd; |
| | | transform: translate3d(0,-2.5px,0); |
| | | transition: all 0.3s; |
| | | } |
| | | } |
| | | .container { |
| | | height: 100%; |
| | | display: flex; |
| | |
| | | box-sizing: border-box; |
| | | .container-left { |
| | | height: 100%; |
| | | width: 210px; |
| | | width: 230px; |
| | | overflow: auto; |
| | | box-sizing: border-box; |
| | | flex-shrink: 0; |
| | |
| | | .account-left { |
| | | .add-account { |
| | | color: rgba(61, 104, 225, 1); |
| | | margin-top: 50px; |
| | | |
| | | margin-top: 30px; |
| | | .iconfont { |
| | | cursor: pointer; |
| | | font-size: 32px; |
| | |
| | | margin: 5px 15px; |
| | | height: 30px; |
| | | line-height: 30px; |
| | | width: 90px; |
| | | // width: 90px; |
| | | text-align: left; |
| | | font-size: 15px; |
| | | display: flex; |
| | |
| | | .user-role { |
| | | margin: 5px 0 0 15px; |
| | | font-size: 14px; |
| | | color: darkseagreen; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | .add-account-page { |
| | | .upload-group { |
| | | height: 130px; |
| | | height: 120px; |
| | | width: 360px; |
| | | margin: 0 auto; |
| | | overflow: hidden; |
| | | .upload-jpg { |
| | | height: 46px; |
| | | width: 46px; |
| | | position: relative; |
| | | height: 48px; |
| | | width: 48px; |
| | | float: left; |
| | | margin: 0 10px; |
| | | margin-bottom: 20px; |
| | | margin-bottom: 10px; |
| | | background-color: rgba(242, 242, 242, 1); |
| | | border: 3px solid transparent; |
| | | border: 2px solid transparent; |
| | | border-radius: 50%; |
| | | cursor: pointer; |
| | | img { |
| | | height: 46px; |
| | | width: 46px; |
| | | height: 48px; |
| | | width: 48px; |
| | | border-radius: 50%; |
| | | } |
| | | .img-mask { |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | height: 48px; |
| | | width: 48px; |
| | | background-color: rgba(0, 0, 0, 0.3); |
| | | color: white; |
| | | border-radius: 50%; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | .selected { |
| | | font-size: 22px; |
| | | } |
| | | } |
| | | } |
| | | .upload-jpg-mask { |
| | | border: 3px solid blue; |
| | | .upload-jpg-border { |
| | | border: 2px solid cornflowerblue; |
| | | } |
| | | .upload-jpg-up { |
| | | height: 52px; |
| | | width: 52px; |
| | | height: 48px; |
| | | width: 48px; |
| | | float: left; |
| | | display: flex; |
| | | background-color: rgba(242, 242, 242, 1); |
| | | margin: 0 10px; |
| | | margin-bottom: 20px; |
| | | border-radius: 25px; |
| | | border: 2px solid transparent; |
| | | border-radius: 50%; |
| | | |
| | | justify-content: center; |
| | | align-items: center; |
| | | font-size: 12px; |
| | | cursor: pointer; |
| | | } |
| | | .loaded-Pic { |
| | | } |
| | | } |
| | | .fill-group { |
| | | .p-title { |
| | | height: 34px; |
| | | text-align: left; |
| | | } |
| | | .el-form-item { |
| | | .el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |