File was renamed from src/pages/settings/index/App.vue |
| | |
| | | |
| | | <div |
| | | class="container-center" |
| | | v-if="activePage == '账户' || activePage == '日期时间'" |
| | | v-if="activeIndex == 0 || activeIndex == 1" |
| | | > |
| | | <div class="account-left" v-if="activePage == '账户'"> |
| | | <div class="account-left" v-if="activeIndex == 0"> |
| | | <div class="account-list"> |
| | | <div |
| | | class="account-card" |
| | |
| | | :src="`data:image/png;base64,${item.headpic}`" |
| | | alt="" |
| | | /> |
| | | <span class="user-name">{{ item.username }}</span> |
| | | </div> |
| | | <span class="user-name">{{ item.username }}</span> |
| | | <el-tag |
| | | style="margin-left: 100px" |
| | | size="mini" |
| | | v-if="item.id == curUserID" |
| | | >我的</el-tag |
| | | > |
| | | <el-tag size="mini" v-if="item.id == curUserID">我的</el-tag> |
| | | </div> |
| | | </div> |
| | | <div class="add-account"> |
| | | <div class="add-account" v-if="curUserRole != '普通用户'"> |
| | | <!-- <span class="icon iconfont" @click="openAdd"></span> --> |
| | | <i class="el-icon-circle-plus" style="font-size: 38px; |
| | | " @click="openAdd"></i> |
| | | <i |
| | | class="el-icon-circle-plus" |
| | | style="font-size: 38px" |
| | | @click="openAdd" |
| | | ></i> |
| | | </div> |
| | | </div> |
| | | <div class="datetime-left" v-if="activePage == '日期时间'"> |
| | | <div class="datetime-left" v-if="activeIndex == 1"> |
| | | <div class="time-card"> |
| | | <div class="head"> |
| | | <span class="icon iconfont"></span> |
| | |
| | | </div> |
| | | <div |
| | | class="container-right" |
| | | v-if="activePage == '账户' || activePage == '日期时间'" |
| | | v-if="activeIndex == 0 || activeIndex == 1" |
| | | > |
| | | <div class="account-right" v-if="activePage == '账户'"> |
| | | <div class="account-right" v-if="activeIndex == 0"> |
| | | <div |
| | | class="account-content" |
| | | v-if="inAccountDetail == false && isAddAccount == false" |
| | |
| | | <div class="item-btn" @click="showChangePassword">修改密码</div> |
| | | <div |
| | | class="item-btn" |
| | | v-if=" |
| | | activeUserRole !== '超级管理员' || |
| | | (curUserRole == '管理员' && activeUserRole == '普通用户') |
| | | " |
| | | v-if="isShowDeleteAccount" |
| | | @click="deleteAccount" |
| | | > |
| | | 删除账户 |
| | | </div> |
| | | <div class="item-btn" @click="openPermission">权限设置</div> |
| | | <div |
| | | v-if="isShowPermitBtn" |
| | | class="item-btn" |
| | | @click="openPermission" |
| | | > |
| | | 权限设置 |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <div class="fill-group"> |
| | | <el-form |
| | | :model="addForm" |
| | | :rules="rules" |
| | | :rules="addRules" |
| | | ref="addForm" |
| | | class="add-form" |
| | | > |
| | | <el-form-item prop="userName"> |
| | | <div class="p-title">用户名:</div> |
| | | <el-input |
| | | placeholder="必填,长度为2~10位字符,不能以数字开头、不允许有汉字" |
| | | placeholder="必填,长度为 2 ~ 10 位字符,不能以数字开头,不允许包含汉字" |
| | | v-model="addForm.userName" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="roleId"> |
| | | <el-form-item prop="roleId" v-if="curUserRole != '普通用户'"> |
| | | <div class="p-title">角色:</div> |
| | | <el-select v-model="addForm.roleId" placeholder="请选择角色"> |
| | | <el-option |
| | |
| | | <el-form-item prop="nickName"> |
| | | <div class="p-title">昵称:</div> |
| | | <el-input |
| | | placeholder="选填" |
| | | placeholder="选填,长度为 2 ~ 10 位字符" |
| | | v-model="addForm.nickName" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="password"> |
| | | <div class="p-title">密码:</div> |
| | | <el-input |
| | | placeholder="必填" |
| | | placeholder="必填,至少为 6 位" |
| | | v-model="addForm.password" |
| | | show-password |
| | | ></el-input> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="datetime-right" v-if="activePage == '日期时间'"> |
| | | <div class="datetime-right" v-if="activeIndex == 1"> |
| | | <div class="ntp-time" v-if="isNtp"> |
| | | <el-form label-width="160px"> |
| | | <el-form-item label="服务器地址"> |
| | |
| | | </div> |
| | | |
| | | <clusterManagement |
| | | v-if="activePage == '集群管理'" |
| | | v-if="activeIndex == 2" |
| | | style="width: 100%" |
| | | ></clusterManagement> |
| | | <netSettings |
| | | v-if="activePage == '网络设置'" |
| | | v-if="activeIndex == 3" |
| | | style="width: 100%" |
| | | ></netSettings> |
| | | <keyboardLanguage |
| | | v-if="activePage == '键盘和语言'" |
| | | v-if="activeIndex == 4" |
| | | style="width: 100%" |
| | | ></keyboardLanguage> |
| | | <generalSettings |
| | | v-if="activePage == '通用设置'" |
| | | v-if="activeIndex == 5" |
| | | style="width: 100%" |
| | | ></generalSettings> |
| | | </div> |
| | | <div class="welcome-page" v-else> |
| | | <div class="child" @click="openWelcome(item, i)" v-for="(item,i) in menuArr" :key="i"> |
| | | <div |
| | | class="child" |
| | | @click="openWelcome(item, i)" |
| | | v-for="(item, i) in menuArr" |
| | | :key="i" |
| | | > |
| | | <div class="child-info"> |
| | | <span class="icon iconfont welcome-icon">{{ item.icon }}</span> |
| | | <span class="welcome-title">{{item.name}}</span> |
| | | <span class="welcome-title">{{ item.name }}</span> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import netSettings from "../views/NetSettings"; |
| | | import keyboardLanguage from "../views/keyboardLanguage"; |
| | | import generalSettings from "../views/generalSettings"; |
| | | import { pad0 } from "@/api/utils"; |
| | | |
| | | export default { |
| | | name: "settings", |
| | | components: { |
| | |
| | | generalSettings, |
| | | }, |
| | | data() { |
| | | var validatePass2 = (rule, value, callback) => { |
| | | var v2 = (rule, value, callback) => { |
| | | console.log("rule", rule); |
| | | if (value === "") { |
| | | callback(new Error("请再次输入密码")); |
| | | } else if (value !== this.addForm.password) { |
| | |
| | | callback(); |
| | | } |
| | | }; |
| | | var validatePass4 = (rule, value, callback) => { |
| | | var v4 = (rule, value, callback) => { |
| | | console.log("rule", rule); |
| | | if (value === "") { |
| | | callback(new Error("请再次输入密码")); |
| | | } else if (value !== this.passwordForm.newPassword) { |
| | | callback(new Error("两次输入密码不一致!")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | const v1 = (rule, value, callback) => { |
| | | if (value.trim() === "") { |
| | | callback(new Error("请输入用户名")); |
| | | this.addForm.userName = ""; |
| | | } else if (isNaN(Number(value[0])) == false) { |
| | | callback(new Error("不能以数字开头")); |
| | | } else if (/[\u4E00-\u9FA5]/g.test(value)) { |
| | | callback(new Error("不能输入汉字")); |
| | | } else if (value.length < 2 || value.length > 10) { |
| | | callback(new Error("长度为 2 - 10 个字符")); |
| | | } else { |
| | | callback(); |
| | | } |
| | |
| | | jpgArr: [], |
| | | isManual: false, |
| | | isNtp: true, |
| | | activePage: "账户", |
| | | // activePage: "账户", |
| | | activeIndex: 0, |
| | | clockTimer: null, |
| | | inputHour: "", |
| | |
| | | confirmPassword: "", |
| | | roleId: "", |
| | | }, |
| | | rules: { |
| | | userName: [ |
| | | { required: true, message: "请输入用户名", trigger: "blur" }, |
| | | { |
| | | min: 2, |
| | | max: 10, |
| | | message: "长度在 2 到 10 个字符", |
| | | trigger: "blur", |
| | | }, |
| | | addRules: { |
| | | userName: [{ validator: v1, trigger: "blur" }], |
| | | nickName: [ |
| | | { min: 2, max: 10, message: "长度为 2 - 10 位", trigger: "blur" }, |
| | | ], |
| | | password: [ |
| | | { required: true, message: "请输入密码", trigger: "blur" }, |
| | | { min: 6, message: "长度至少为 6 位", trigger: "blur" }, |
| | | ], |
| | | confirmPassword: [{ validator: validatePass2, trigger: "blur" }], |
| | | confirmPassword: [{ validator: v2, trigger: "blur" }], |
| | | }, |
| | | pwRules: { |
| | | // pw: [{ validator: validatePass3, trigger: "blur" }], |
| | | curPassword: [ |
| | | { 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" }], |
| | | confirmPassword: [{ validator: v4, trigger: "blur" }], |
| | | }, |
| | | }; |
| | | }, |
| | |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | confirmChangePic() { |
| | | updateUser({ |
| | | id: this.activeAccountItem.id, |
| | |
| | | this.activeAccountIndex = i; |
| | | this.inAccountDetail = false; |
| | | this.cancelSet(); |
| | | this.cancelAdd(); |
| | | this.cacelChoosePic(); |
| | | this.fetchMenu(); |
| | | this.cancelPassword(); |
| | | this.showInputNickName = false; |
| | | }, |
| | | minusOne(typ) { |
| | |
| | | if (num == -1) { |
| | | num = 23; |
| | | } |
| | | this.syncHour = this.padZero(num); |
| | | this.syncHour = pad0(+num); |
| | | break; |
| | | case "min": |
| | | num = +this.syncMin - 1; |
| | | if (num == -1) { |
| | | num = 59; |
| | | } |
| | | this.syncMin = this.padZero(num); |
| | | this.syncMin = pad0(+num); |
| | | break; |
| | | case "sec": |
| | | num = +this.syncSec + 1; |
| | | if (num == -1) { |
| | | num = 59; |
| | | } |
| | | this.syncSec = this.padZero(num); |
| | | this.syncSec = pad0(+num); |
| | | break; |
| | | case "yrs": |
| | | num = +this.syncYrs - 1; |
| | | this.syncYrs = this.padZero(num); |
| | | this.syncYrs = pad0(+num); |
| | | break; |
| | | case "mth": |
| | | num = +this.syncMonth - 1; |
| | |
| | | num = 12; |
| | | this.minusOne("yrs"); |
| | | } |
| | | this.syncMonth = this.padZero(num); |
| | | this.syncMonth = pad0(+num); |
| | | break; |
| | | case "day": |
| | | num = +this.syncDay - 1; |
| | |
| | | ).getDate(); |
| | | num = maxDay; |
| | | } |
| | | this.syncDay = this.padZero(num); |
| | | this.syncDay = pad0(+num); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | if (num == 24) { |
| | | num = 0; |
| | | } |
| | | this.syncHour = this.padZero(num); |
| | | this.syncHour = pad0(+num); |
| | | break; |
| | | case "min": |
| | | num = +this.syncMin + 1; |
| | | if (num == 60) { |
| | | num = 0; |
| | | } |
| | | this.syncMin = this.padZero(num); |
| | | this.syncMin = pad0(+num); |
| | | break; |
| | | case "sec": |
| | | num = +this.syncSec + 1; |
| | | if (num == 60) { |
| | | num = 0; |
| | | } |
| | | this.syncSec = this.padZero(num); |
| | | this.syncSec = pad0(+num); |
| | | break; |
| | | case "yrs": |
| | | num = +this.syncYrs + 1; |
| | | this.syncYrs = this.padZero(num); |
| | | this.syncYrs = pad0(+num); |
| | | break; |
| | | case "mth": |
| | | num = +this.syncMonth + 1; |
| | | if (num == 13) { |
| | | num = 1; |
| | | } |
| | | this.syncMonth = this.padZero(num); |
| | | this.syncMonth = pad0(+num); |
| | | break; |
| | | case "day": |
| | | num = +this.syncDay + 1; |
| | |
| | | if (num > maxDay) { |
| | | num = 1; |
| | | } |
| | | this.syncDay = this.padZero(num); |
| | | this.syncDay = pad0(+num); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | } |
| | | return format; |
| | | }, |
| | | padZero(n) { |
| | | n = +n; |
| | | return n < 10 ? "0" + n : "" + n; |
| | | }, |
| | | formatNumber(n) { |
| | | n = n.toString(); |
| | | return n[1] ? n : "0" + n; |
| | |
| | | }); |
| | | }, |
| | | openMenu(name, i) { |
| | | this.activePage = name; |
| | | this.activeIndex = i; |
| | | if (this.activePage == "日期时间") { |
| | | if (this.activeIndex == 1) { |
| | | this.initClockConf(); |
| | | } |
| | | }, |
| | |
| | | }, |
| | | hideInput(typ) { |
| | | if (this[`input${typ}`]) { |
| | | this[`sync${typ}`] = this.padZero(this[`input${typ}`]); |
| | | this[`sync${typ}`] = pad0(+this[`input${typ}`]); |
| | | } |
| | | this[`show${typ}Input`] = false; |
| | | this[`input${typ}`] = ""; |
| | |
| | | this.addForm.headpic = this.jpgArr[0].path; |
| | | getRoles().then((res) => { |
| | | if (res.success) { |
| | | this.roleList = res.data.slice(0, 2); |
| | | this.roleList = res.data; |
| | | } |
| | | }); |
| | | }, |
| | |
| | | if (this.passwordForm.curPassword == "") { |
| | | data = { |
| | | userId: this.activeAccountItem.id, |
| | | oldPwd: "", |
| | | newPwd: this.passwordForm.newPassword, |
| | | }; |
| | | } else { |
| | |
| | | updatePassword(data).then( |
| | | (res) => { |
| | | if (res.success) { |
| | | this.$message.success(res.msg); |
| | | this.cancelPassword(); |
| | | this.$message.success("密码" + res.msg); |
| | | setTimeout(() => { |
| | | this.cancelPassword(); |
| | | }, 1000); |
| | | } |
| | | }, |
| | | (err) => { |
| | |
| | | const info = JSON.parse(sessionStorage.getItem("userInfo")); |
| | | return info.id; |
| | | }, |
| | | isShowDeleteAccount() { |
| | | if (this.curUserRole == "超级管理员") { |
| | | if (this.activeUserRole == "超级管理员") { |
| | | return false; |
| | | } |
| | | return true; |
| | | } else if (this.curUserRole == "管理员") { |
| | | if (this.activeUserRole == "普通用户") { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | return false; |
| | | }, |
| | | isShowPermitBtn(){ |
| | | if (this.curUserRole == "管理员") { |
| | | if (this.activeUserRole == "普通用户") { |
| | | return true |
| | | } |
| | | return false |
| | | }else if (this.curUserRole == "普通用户"){ |
| | | return false |
| | | } |
| | | return true |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | 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%; |
| | | float: left; |
| | | width: 250px; |
| | | height: 200px; |
| | |
| | | justify-content: center; |
| | | align-items: center; |
| | | cursor: pointer; |
| | | -moz-box-shadow: 2px 2px 4px rgb(226, 226, 226); |
| | | -webkit-box-shadow: 2px 2px 4px rgb(226, 226, 226); |
| | | box-shadow: 2px 2px 4px rgb(226, 226, 226); |
| | | .child-info { |
| | | display: flex; |
| | | flex-direction: column; |
| | |
| | | } |
| | | } |
| | | .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; |
| | | -moz-box-shadow: 5px 5px 15px rgb(218, 218, 218); |
| | | -webkit-box-shadow: 5px 5px 15px rgb(218, 218, 218); |
| | | box-shadow: 5px 5px 15px rgb(218, 218, 218); |
| | | transform: translate3d(0, -3px, 0); |
| | | transition: all 0.4s; |
| | | } |
| | | } |
| | | .container { |
| | |
| | | border-right: 5px solid rgba(248, 248, 248, 1); |
| | | box-sizing: border-box; |
| | | .account-left { |
| | | .account-list{ |
| | | height: 530px; |
| | | height: 100%; |
| | | .account-list { |
| | | height: calc(85%); |
| | | overflow: auto; |
| | | } |
| | | .add-account { |
| | |
| | | box-sizing: border-box; |
| | | border-radius: 10px; |
| | | cursor: pointer; |
| | | justify-content: space-between; |
| | | |
| | | .touxiang { |
| | | height: 35px; |
| | | width: 35px; |
| | | background-color: bisque; |
| | | border-radius: 17.5px; |
| | | display: flex; |
| | | align-items: center; |
| | | img { |
| | | border: none; |
| | | |
| | |
| | | .touxiang-big { |
| | | width: 100px; |
| | | height: 100px; |
| | | background-color: bisque; |
| | | position: relative; |
| | | border-radius: 50px; |
| | | img { |
| | | border: none; |
| | | |
| | | width: 100px; |
| | | height: 100px; |
| | | position: relative; |
| | |
| | | } |
| | | .list-btn { |
| | | display: flex; |
| | | |
| | | flex-direction: column; |
| | | align-items: center; |
| | | .item-btn { |
| | |
| | | text-decoration: underline; |
| | | } |
| | | } |
| | | |
| | | } |
| | | .manual-time { |
| | | .clock-wrap { |