Commit 9d7c3ec9 by 潘建波

提交修改个人密码

1 parent ff0930a2
No preview for this file type
...@@ -4,7 +4,7 @@ console.log(process.env.NODE_ENV); ...@@ -4,7 +4,7 @@ console.log(process.env.NODE_ENV);
switch (process.env.NODE_ENV) { switch (process.env.NODE_ENV) {
case "development": case "development":
// baseUrl = "http://192.168.9.234:20080"; // 测试环境url // baseUrl = "http://192.168.9.234:20080"; // 测试环境url
baseUrl = "http://192.168.9.62:20080"; // 测试环境url baseUrl = "http://192.168.9.149:20080"; // 测试环境url
// baseUrl = "http://192.168.9.82:8080"; // 测试环境url // baseUrl = "http://192.168.9.82:8080"; // 测试环境url
// baseUrl = "http://192.168.9.61:8086"; // baseUrl = "http://192.168.9.61:8086";
// baseUrl = 'http://vion-panda.51vip.biz:52510'; // baseUrl = 'http://vion-panda.51vip.biz:52510';
......
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
return api.post(`${baseUrl}/api/v1/auth/users/${id}`, params) return api.post(`${baseUrl}/api/v1/auth/users/${id}`, params)
}, },
resetPwd(params,id) { resetPwd(params,id) {
return api.post(`${baseUrl}/api/v1/devconf_fx/users/${id}/reset`, params) return api.post(`${baseUrl}/api/v1/auth/users/${id}/password`, params)
}, },
delUser(params,id){ delUser(params,id){
return api.delete(`${baseUrl}/api/v1/auth/users/${id}`, params) return api.delete(`${baseUrl}/api/v1/auth/users/${id}`, params)
......
...@@ -39,7 +39,14 @@ export const constantRouterMap = [ ...@@ -39,7 +39,14 @@ export const constantRouterMap = [
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited. // which is lazy-loaded when the route is visited.
component: resolve => require(["../views/Show.vue"], resolve) component: resolve => require(["../views/Show.vue"], resolve)
} },{
path: "/resetpass",
name: "resetpassword",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: resolve => require(["../views/Resetpassword.vue"], resolve)
},
]; ];
export const asyncRouterMap = [ export const asyncRouterMap = [
{ {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
></span> ></span>
<div class="headRight"> <div class="headRight">
<span>{{ curdate }}</span> <span>{{ curdate }}</span>
<img src="../../assets/img/home/user.png" alt="" /> <img @click="resetpass" src="../../assets/img/home/user.png" alt="" />
<span class="exit" @click="logout()" <span class="exit" @click="logout()"
>退出<i class="el-icon-arrow-down"></i >退出<i class="el-icon-arrow-down"></i
></span> ></span>
...@@ -129,6 +129,9 @@ export default { ...@@ -129,6 +129,9 @@ export default {
this.$store.commit(types.ATOKEN, ""); this.$store.commit(types.ATOKEN, "");
localStorage.removeItem("atoken"); localStorage.removeItem("atoken");
this.$router.push("/login").catch(err => {err}); this.$router.push("/login").catch(err => {err});
},
resetpass(){
this.$router.push("/resetpass").catch(err => {err});
} }
}, },
created() { created() {
......
<template>
<div class="passform-box">
<div class="re-header">重置密码</div>
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
class="passform"
>
<div class="passformitem">
<el-form-item label="旧密码" prop="oldpassword">
<el-input v-model="ruleForm.oldpassword" type="password"></el-input>
</el-form-item>
</div>
<div class="passformitem">
<el-form-item label="新密码" prop="newpassword">
<el-input v-model="ruleForm.newpassword" type="password"></el-input>
</el-form-item>
</div>
<div class="passformitem">
<el-form-item label="密码确认" prop="checknewpassword">
<el-input
v-model="ruleForm.checknewpassword"
type="password"
></el-input>
</el-form-item>
</div>
<el-form-item>
<el-button @click="back('ruleForm')">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')"
>提交</el-button
>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
var validatePass = (rule, value, callback) => {
if (value === "") {
callback(new Error("请输入密码"));
} else {
if (this.ruleForm.checkPass !== "") {
this.$refs.ruleForm.validateField("checkPass");
}
callback();
}
};
var validatePass2 = (rule, value, callback) => {
if (value === "") {
callback(new Error("请再次输入密码"));
} else if (value !== this.ruleForm.newpassword) {
callback(new Error("两次输入密码不一致!"));
} else {
callback();
}
};
return {
ruleForm: {
oldpassword: "",
newpassword: "",
checknewpassword: ""
},
rules: {
oldpassword: [
{ required: true, message: "请输入旧密码", trigger: "blur" }
],
newpassword: [
{ validator: validatePass, trigger: "blur" },
{ required: true, message: "", trigger: "blur" }
],
checknewpassword: [
{ validator: validatePass2, trigger: "blur" },
{ required: true, message: "", trigger: "blur" }
]
}
};
},
methods: {
submitForm(formName) {
let data = {
old_pwd: this.ruleForm.oldpassword,
new_pwd: this.ruleForm.newpassword
};
this.$refs[formName].validate(valid => {
if (valid) {
let user_unid = sessionStorage.getItem("user_unid");
this.$api.ops.resetPwd(data, user_unid).then(res => {
this.$router.push("/login");
});
} else {
console.log("error submit!!");
return false;
}
});
},
back() {
this.$router.back(-1);
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
};
</script>
<style>
.passform {
margin: 20px;
width: 400px;
}
.passformitem {
margin-bottom: 20px;
}
.passform-box{
width: 400px;
}
.re-header{
margin-left: 60px;
margin-top: 20px;
}
</style>
...@@ -161,6 +161,9 @@ ...@@ -161,6 +161,9 @@
<script> <script>
import { SVG } from "@svgdotjs/svg.js"; import { SVG } from "@svgdotjs/svg.js";
var draw = null; var draw = null;
var childgroup = null;
var levalgroup = null;
var levalinecolor = "#333";
export default { export default {
data() { data() {
return { return {
...@@ -222,9 +225,7 @@ export default { ...@@ -222,9 +225,7 @@ export default {
}; };
this.curDevData = dev; this.curDevData = dev;
this.$api.device.getSubdev(this.parentData, obj).then(res => { this.$api.device.getSubdev(this.parentData, obj).then(res => {
for (var i = 0; i < 10; i++) { this.slaveData = res.list_data;
this.slaveData.push(res.list_data);
}
this.createdLeval(ev, this.slaveData); this.createdLeval(ev, this.slaveData);
}); });
}, },
...@@ -266,13 +267,14 @@ export default { ...@@ -266,13 +267,14 @@ export default {
var _this = this; var _this = this;
var nested = draw var nested = draw
.nested() .nested()
.size(120, 40) .size(130, 40)
.move(50, 50) .move(50, 50)
.data("sdv", data); .data("sdv", data);
var rect = nested var rect = nested
.rect(120, 40) .rect(130, 40)
.attr({ fill: "#f06" }) .attr({ fill: "#123e6c", opacity: 0.6 })
.radius(5); .stroke({ color: "#333", opacity: 0.5, width: 1 })
.radius(3);
var text = nested.text(function(add) { var text = nested.text(function(add) {
add add
.tspan(`${data.device_name}`) .tspan(`${data.device_name}`)
...@@ -286,32 +288,38 @@ export default { ...@@ -286,32 +288,38 @@ export default {
}); });
}, },
createdChild(data) { createdChild(data) {
if (childgroup) {
childgroup.clear();
}
childgroup = draw.group();
var _this = this; var _this = this;
data.map((ele, index) => { data.map((ele, index) => {
let point = { let point = {
x: 200, x: 200,
y: 70 * (index + 1) + 50 y: 65 * (index + 1) + 70
}; };
var polyline = draw var polyline = childgroup
.polyline([ .polyline([
[110, 90], [110, point.y - 45],
[110, point.y + 20], [110, point.y + 20],
[200, point.y + 20] [200, point.y + 20]
]) ])
.stroke({ width: 1, color: "red" }); .stroke({ width: 1, color: "#ddd" });
polyline.fill("none").stroke({ polyline.fill("none").stroke({
width: 2, width: 1,
color: "red" color: "#333"
}); });
ele.color = this.setsubcolor(index);
var nested = draw var nested = draw
.nested() .nested()
.size(120, 40) .size(130, 40)
.move(point.x, point.y) .move(point.x, point.y)
.data("childsdv", ele); .data("childsdv", ele);
var rect = nested var rect = nested
.rect(120, 40) .rect(130, 40)
.attr({ fill: "#f06" }) .stroke({ color: "#333", opacity: 0.5, width: 1 })
.radius(5); .attr({ fill: `rgb(${_this.setsubcolor(index)})`, opacity: 0.6 })
.radius(3);
var text = nested.text(function(add) { var text = nested.text(function(add) {
add add
.tspan(`${ele.device_name}`) .tspan(`${ele.device_name}`)
...@@ -319,15 +327,23 @@ export default { ...@@ -319,15 +327,23 @@ export default {
.fill({ color: "#fff" }), .fill({ color: "#fff" }),
add.tspan(`${ele.in_ip}`).newLine(); add.tspan(`${ele.in_ip}`).newLine();
}); });
childgroup.add(nested);
nested.click(function() { nested.click(function() {
let data = this.data("childsdv"); let data = this.data("childsdv");
this.curDevData = data;
_this.getleval(this, data); _this.getleval(this, data);
levalinecolor = data.color;
}); });
}); });
}, },
createdLeval(ev, data) { createdLeval(ev, data) {
let num = Math.ceil(data.length/6); if (levalgroup) {
for(let i = 0; i < num; i++){ levalgroup.clear();
}
var polyline = "";
levalgroup = draw.group();
let num = Math.ceil(data.length / 6);
for (let i = 0; i <= num; i++) {
var laveData = this.setslaveData(data, i); var laveData = this.setslaveData(data, i);
//当前点击节点信息 //当前点击节点信息
let linepoint = { let linepoint = {
...@@ -335,45 +351,65 @@ export default { ...@@ -335,45 +351,65 @@ export default {
y: ev.y() + 20 y: ev.y() + 20
}; };
var _this = this; var _this = this;
console.log(laveData);
laveData.map((ele, index) => { laveData.map((ele, index) => {
let point = { let point = {
x: 330 * i + 430, x: 250 * i + 430,
y: linepoint.y + i * 70 + 30 y: linepoint.y + index * 65 + 30
}; };
if (index == 0) { if (index == 0 && i == num - 1) {
var line = draw var line = draw
.polyline([ .polyline([
[linepoint.x, linepoint.y], [linepoint.x, linepoint.y],
[400, point.y - (index == 0 ? 30 : 58)] [point.x - 50, point.y - (index == 0 ? 30 : 58)]
]) ])
.stroke({ width: 1, color: "red" }); .stroke({ width: 1, color: "red" });
line.fill("none").stroke({ line.fill("none").stroke({
width: 2, width: 1,
color: "green" color: `rgb(${levalinecolor})`
}); });
levalgroup.add(line);
} }
if (linepoint.y < 200) { if (linepoint.y < 500) {
var polyline = draw polyline = draw
.polyline([ .polyline([
[400, linepoint.y], [point.x - 50, linepoint.y],
[400, point.y + 20], [point.x - 50, point.y + 20],
[450, point.y + 20] [point.x + 50, point.y + 20]
]) ])
.stroke({ width: 1, color: "red" }); .stroke({ width: 1, color: `rgb(${levalinecolor})` });
polyline.fill("none").stroke({ polyline.fill("none").stroke({
width: 2, width: 1,
color: "red" color: `rgb(${levalinecolor})`
}); });
levalgroup.add(polyline);
} else {
point = {
x: 250 * i + 430,
y: linepoint.y - index * 70 - 90
};
polyline = draw
.polyline([
[point.x - 50, linepoint.y],
[point.x - 50, point.y + 20],
[point.x + 50, point.y + 20]
])
.stroke({ width: 1, color: `rgb(${levalinecolor})` });
polyline.fill("none").stroke({
width: 1,
color: `rgb(${levalinecolor})`
});
levalgroup.add(polyline);
} }
var nested = draw var nested = draw
.nested() .nested()
.size(120, 40) .size(130, 40)
.move(point.x, point.y) .move(point.x, point.y)
.data("childsdv", ele); .data("childsdv", ele);
var rect = nested var rect = nested
.rect(120, 40) .rect(130, 40)
.attr({ fill: "#f06" }) .attr({ fill: `rgb(${_this.setsubcolor(index)})` })
.radius(5); .radius(3);
var text = nested.text(function(add) { var text = nested.text(function(add) {
add add
.tspan(`${ele.device_name}`) .tspan(`${ele.device_name}`)
...@@ -381,11 +417,11 @@ export default { ...@@ -381,11 +417,11 @@ export default {
.fill({ color: "#fff" }), .fill({ color: "#fff" }),
add.tspan(`${ele.in_ip}`).newLine(); add.tspan(`${ele.in_ip}`).newLine();
}); });
levalgroup.add(nested);
//事件点击 //事件点击
nested.click(function() { nested.click(function() {
let data = this.data("childsdv"); let data = this.data("childsdv");
_this.getleval(this, data); this.curDevData = data;
}); });
}); });
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!