| | |
| | | <div class="account-list"> |
| | | <div |
| | | class="account-card" |
| | | :class="activeAccountIndex == index ? 'account-card-active' : ''" |
| | | v-for="(item, index) in accountArr" |
| | | :key="index" |
| | | ref="account-card" |
| | | @click="openAccount(item, index)" |
| | | > |
| | | <div class="touxiang"> |
| | | <img src="" alt="" /> |
| | | <img :src="item.headpic" alt="" /> |
| | | </div> |
| | | <span class="user-name">{{ item.name }}</span> |
| | | <span class="user-name">{{ item.username }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="add-account"> |
| | |
| | | v-if="inAccountDetail == false && isAddAccount == false" |
| | | > |
| | | <div class="content-top"> |
| | | <div class="touxiang-big"></div> |
| | | <div class="touxiang-big"> |
| | | <img :src="activeAccountItem.headpic" alt="" /> |
| | | </div> |
| | | <div class="user-desc"> |
| | | <div class="username"> |
| | | <span class="icon iconfont" style="margin-right: 5px" |
| | | ></span |
| | | > |
| | | |
| | | <span>飞利浦</span> |
| | | <span>{{ activeAccountItem.username }}</span> |
| | | </div> |
| | | <div class="nickname"> |
| | | <span>昵称:</span> |
| | | <span v-show="!showInputNickName">{{ inputNickName }}</span> |
| | | <span v-show="!showInputNickName">{{ |
| | | activeAccountItem.nickname |
| | | }}</span> |
| | | <input |
| | | type="text" |
| | | class="input-nick" |
| | |
| | | v-show="showInputNickName" |
| | | v-model="inputNickName" |
| | | @blur="hideInputNick" |
| | | @keydown.enter="hideInputNick" |
| | | @keydown.enter="blurInputNick" |
| | | /> |
| | | <span class="icon iconfont" @click="editNickName" |
| | | ></span |
| | |
| | | |
| | | <el-form |
| | | :model="passwordForm" |
| | | :rules="rules" |
| | | :rules="pwRules" |
| | | ref="passwordForm" |
| | | class="password-form" |
| | | > |
| | | <el-form-item> |
| | | <el-form-item prop="pw"> |
| | | <div class="p-title">当前密码:</div> |
| | | |
| | | <el-input |
| | |
| | | show-password |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-form-item prop="newPw"> |
| | | <div class="p-title">新密码:</div> |
| | | <el-input |
| | | placeholder="必填" |
| | |
| | | show-password |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-form-item prop="confirmNewPw"> |
| | | <div class="p-title">确认密码:</div> |
| | | <el-input |
| | | placeholder="必填" |
| | |
| | | v-for="(item, index) in jpgArr" |
| | | :key="index" |
| | | ></div> |
| | | <!-- <div |
| | | class="upload-jpg" |
| | | style="height: 0px; visibility: hidden" |
| | | ></div> |
| | | <div |
| | | class="upload-jpg" |
| | | style="height: 0px; visibility: hidden" |
| | | ></div> |
| | | <div |
| | | class="upload-jpg" |
| | | style="height: 0px; visibility: hidden" |
| | | ></div> |
| | | <div |
| | | class="upload-jpg" |
| | | style="height: 0px; visibility: hidden" |
| | | ></div> --> |
| | | |
| | | <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> |
| | | <div class="fill-group"> |
| | | <el-form |
| | |
| | | ref="addForm" |
| | | class="add-form" |
| | | > |
| | | <el-form-item> |
| | | <el-form-item prop="userName"> |
| | | <div class="p-title">用户名:</div> |
| | | |
| | | <el-input |
| | | placeholder="必填" |
| | | v-model="addForm.userName" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-form-item prop="nickName"> |
| | | <div class="p-title">昵称:</div> |
| | | <el-input |
| | | placeholder="必填" |
| | | v-model="addForm.nickName" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-form-item prop="password"> |
| | | <div class="p-title">密码:</div> |
| | | <el-input |
| | | placeholder="必填" |
| | |
| | | show-password |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-form-item prop="confirmPassword"> |
| | | <div class="p-title">确认密码:</div> |
| | | <el-input |
| | | placeholder="必填" |
| | |
| | | </div> |
| | | <div class="btns"> |
| | | <div class="cancel" @click="cancelAdd">取消</div> |
| | | <div class="ok">保存</div> |
| | | <div class="ok" @click="saveAddAccount('addForm')">保存</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | size="small" |
| | | :controls="false" |
| | | ></el-input-number> |
| | | <!-- :disabled="syncType === '2'" --> |
| | | <!-- :disabled="syncType === '2'" --> |
| | | <el-button |
| | | type="text" |
| | | @click="testNTP" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getDevInfo, |
| | | getAlarmConfig, |
| | | saveDevInfo, |
| | | saveAlarmConfig, |
| | | getClockInfo, |
| | | saveClockInfo, |
| | | testNTPserver, |
| | | getResourceConfig, |
| | | saveResourceConfig, |
| | | } from "@/api/system"; |
| | | import { getClockInfo, saveClockInfo, testNTPserver } from "@/api/system"; |
| | | import { uploadHeadPic, addUser, getUsers, updateUser,updatePassword } from "@/api/user"; |
| | | import switchBar from "../components/switchBar"; |
| | | import ipInput from "@/components/subComponents/IPInput"; |
| | | import clusterManagement from "../views/clusterManagement"; |
| | |
| | | generalSettings, |
| | | }, |
| | | data() { |
| | | var validatePass = (rule, value, callback) => { |
| | | if (value === "") { |
| | | callback(new Error("请输入密码")); |
| | | } else { |
| | | if (this.addForm.checkPass !== "") { |
| | | this.$refs.addForm.validateField("checkPassword"); |
| | | } |
| | | callback(); |
| | | } |
| | | }; |
| | | var validatePass2 = (rule, value, callback) => { |
| | | if (value === "") { |
| | | callback(new Error("请再次输入密码")); |
| | | } else if (value !== this.addForm.password) { |
| | | callback(new Error("两次输入密码不一致!")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | showAccount: true, |
| | | syncYrs: "", |
| | | activeAccountItem: {}, |
| | | syncMonth: "", |
| | | syncHour: "", |
| | | syncDay: "", |
| | |
| | | browserTimer: null, |
| | | timezone: "", |
| | | isRealtime: false, |
| | | inputNickName: "兔兔", |
| | | inputNickName: "", |
| | | showHourInput: false, |
| | | showMinInput: false, |
| | | showSecInput: false, |
| | |
| | | { name: "键盘和语言" }, |
| | | { name: "通用设置" }, |
| | | ], |
| | | accountArr: [{ name: "贝蒂" }, { name: "朱迪" }, { name: "卡尔" }], |
| | | accountArr: [], |
| | | jpgArr: [{}, {}, {}, {}, {}, {}, {}, {}, {}], |
| | | isManual: false, |
| | | isNtp: true, |
| | |
| | | newPassword: "", |
| | | confirmPassword: "", |
| | | }, |
| | | activeAccount: 0, |
| | | activeAccountIndex: 0, |
| | | addForm: { |
| | | userName: "", |
| | | nickName: "", |
| | | password: "", |
| | | headpic: "", |
| | | confirmPassword: "", |
| | | }, |
| | | rules: { |
| | | password: [{ validator: validatePass, trigger: "blur" }], |
| | | confirmPassword: [{ validator: validatePass2, trigger: "blur" }], |
| | | // age: [{ validator: checkAge, trigger: "blur" }], |
| | | }, |
| | | pwRules:{ |
| | | pw: [{ validator: validatePass3, trigger: "blur" }], |
| | | newPw: [{ validator: validatePass3, trigger: "blur" }], |
| | | confirmNewPw: [{ validator : validatePass4, trigger: "blur" }], |
| | | } |
| | | }; |
| | | }, |
| | | beforeDestroy() { |
| | |
| | | s.style.backgroundColor = "rgba(61, 104, 225, 1)"; |
| | | s.style.color = "#fff"; |
| | | this.$nextTick(() => { |
| | | // this.initSysinfo(); |
| | | // this.initResourceConfig(); |
| | | this.initClockConf(); |
| | | }); |
| | | |
| | | this.fetchUserList(); |
| | | }, |
| | | methods: { |
| | | fetchUserList() { |
| | | getUsers().then((res) => { |
| | | this.accountArr = res.data; |
| | | if (this.accountArr.length) { |
| | | this.activeAccountItem = this.accountArr[0]; |
| | | } |
| | | }); |
| | | }, |
| | | blurInputNick() { |
| | | this.$refs["input-nick"].blur(); |
| | | }, |
| | | editNickName() { |
| | | this.showInputNickName = true; |
| | | this.inputNickName = this.activeAccountItem.nickname; |
| | | this.$refs["input-nick"].focus(); |
| | | }, |
| | | hideInputNick() { |
| | | this.showInputNickName = false; |
| | | updateUser({ |
| | | id: this.activeAccountItem.id, |
| | | nickname: this.inputNickName, |
| | | }).then((res) => { |
| | | this.$message.success(res.msg); |
| | | this.fetchUserList(); |
| | | }); |
| | | }, |
| | | openAccount(item, i) { |
| | | this.$refs[`account-card`].forEach((x) => { |
| | | x.style.backgroundColor = "rgba(248, 248, 248, 1)"; |
| | | x.style.color = "#2c3e50"; |
| | | }); |
| | | this.$refs[`account-card`][i].style.backgroundColor = |
| | | "rgba(61, 104, 225, 1)"; |
| | | this.$refs[`account-card`][i].style.color = "#fff"; |
| | | this.activeAccountItem = item; |
| | | this.activeAccountIndex = i; |
| | | }, |
| | | minusOne(typ) { |
| | | this.isSyncBrowser = false; |
| | |
| | | n = n.toString(); |
| | | return n[1] ? n : "0" + n; |
| | | }, |
| | | uploadUserPic(params) { |
| | | let param = new FormData(); |
| | | param.append("file", params.file); |
| | | uploadHeadPic(param).then((res) => { |
| | | this.addForm.headpic = res.data; |
| | | }); |
| | | }, |
| | | initClockConf(ntpTest = false) { |
| | | getClockInfo().then((rsp) => { |
| | | if (rsp && rsp.success) { |
| | |
| | | cancelChangePassword() { |
| | | this.isChangePw = false; |
| | | this.inAccountDetail = false; |
| | | }, |
| | | saveAddAccount(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | let data = { |
| | | username: this.addForm.userName, |
| | | password: this.addForm.password, |
| | | nickname: this.addForm.nickName, |
| | | headpic: this.addForm.headpic, |
| | | }; |
| | | addUser(data).then( |
| | | (res) => { |
| | | this.$message.success(res.data); |
| | | }, |
| | | (err) => { |
| | | this.$message.warning("保存失败," + err.msg); |
| | | } |
| | | ); |
| | | } else { |
| | | console.log("error submit!!"); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | testNTP() { |
| | | this.ntpTestLoading = true; |
| | |
| | | border-right: 5px solid rgba(248, 248, 248, 1); |
| | | box-sizing: border-box; |
| | | .account-left { |
| | | |
| | | .add-account { |
| | | color: rgba(61, 104, 225, 1); |
| | | margin-top: 50px; |
| | |
| | | width: 35px; |
| | | background-color: bisque; |
| | | border-radius: 17.5px; |
| | | img { |
| | | border: none; |
| | | |
| | | height: 35px; |
| | | width: 35px; |
| | | border-radius: 17.5px; |
| | | } |
| | | } |
| | | .user-name { |
| | | margin-left: 10px; |
| | | font-size: 14px; |
| | | } |
| | | } |
| | | |
| | | |
| | | .account-card-active { |
| | | background-color: rgba(61, 104, 225, 1); |
| | | color: #fff; |
| | | } |
| | | } |
| | | .datetime-left { |
| | | .time-card { |
| | |
| | | height: 100px; |
| | | background-color: bisque; |
| | | border-radius: 50px; |
| | | img { |
| | | border: none; |
| | | |
| | | width: 100px; |
| | | height: 100px; |
| | | border-radius: 50px; |
| | | } |
| | | } |
| | | .user-desc { |
| | | height: 100px; |
| | |
| | | .iconfont { |
| | | font-size: 14px; |
| | | margin-left: 5px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | .add-account-page { |
| | | // background-color: lightcyan; |
| | | // padding: 10px 50px; |
| | | .upload-group { |
| | | height: 120px; |
| | | width: 350px; |
| | |
| | | background-color: antiquewhite; |
| | | margin-bottom: 20px; |
| | | border-radius: 25px; |
| | | } |
| | | .upload-jpg-up { |
| | | height: 50px; |
| | | width: 50px; |
| | | float: left; |
| | | display: flex; |
| | | background-color: rgba(242, 242, 242, 1); |
| | | margin: 0 10px; |
| | | margin-bottom: 20px; |
| | | border-radius: 25px; |
| | | justify-content: center; |
| | | align-items: center; |
| | | font-size: 12px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .fill-group { |
| | |
| | | line-height: 40px; |
| | | position: relative; |
| | | font-size: 14px; |
| | | margin-bottom: 10px; |
| | | } |
| | | .ip-input-container { |
| | | max-width: none !important; |