Commit 64383881 by 谢明辉

a

1 parent 2c4365cf
This diff could not be displayed because it is too large.
......@@ -14,14 +14,14 @@
<i class="icon i-file"></i>
<span slot="title">合同信息</span>
</el-menu-item>
<el-menu-item index="/nav/manage" v-show="management">
<i class="icon i-setting"></i>
<span slot="title">后台管理</span>
</el-menu-item>
<el-menu-item index="/nav/user">
<i class="icon i-user"></i>
<span slot="title">个人管理</span>
</el-menu-item>
<el-menu-item index="/nav/manage" v-show="management">
<i class="icon i-setting"></i>
<span slot="title">后台管理</span>
</el-menu-item>
<el-menu-item index="" @click="exit">
<i class="icon i-login"></i>
<span slot="title">退出</span>
......@@ -39,65 +39,71 @@
</template>
<script>
export default {
name: "HelloWorld",
data() {
return {
management: false,
username: "",
department: "",
collapse: true,
contract_show: true,
};
},
export default {
name: "HelloWorld",
data() {
return {
management: false,
username: "",
department: "",
collapse: true,
contract_show: true
};
},
methods: {
contract() {
if (sessionStorage.getItem("modify")) {
sessionStorage.removeItem("modify");
methods: {
contract() {
if (sessionStorage.getItem("modify")) {
sessionStorage.removeItem("modify");
}
},
exit() {
this.$confirm("确认退出?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
sessionStorage.clear();
this.$router.push({ path: "/" });
})
.catch(() => {});
}
},
exit() {
this.$confirm("确认退出?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
sessionStorage.clear();
this.$router.push({ path: "/" });
})
.catch(() => {});
}
},
beforeCreate() {
if (!sessionStorage.getItem("login_check")) {
alert("请登录");
this.$router.push({ path: "/" });
}
},
created() {
if (sessionStorage.getItem("user_roles") != "null" && sessionStorage.getItem("user_roles")) {
var roles = JSON.parse(sessionStorage.getItem("user_roles"));
for (let i = 0; i < roles.length; i++) {
const e = roles[i];
if (e.role_unid == "91d5185d47e3bad099e17570b0dd0ed2") {
this.management = true;
beforeCreate() {
if (!sessionStorage.getItem("login_check")) {
alert("请登录");
this.$router.push({ path: "/" });
}
},
created() {
if (
sessionStorage.getItem("user_roles") != "null" &&
sessionStorage.getItem("user_roles")
) {
var roles = JSON.parse(sessionStorage.getItem("user_roles"));
for (let i = 0; i < roles.length; i++) {
const e = roles[i];
if (e.role_unid == "91d5185d47e3bad099e17570b0dd0ed2") {
}
}
} else {
this.contract_show = false;
}
if (sessionStorage.getItem("user_name") === "Admin") {
this.management = true;
}
if (sessionStorage.getItem("manager")) {
this.management = true;
this.contract_show = true;
}
}else{
this.contract_show = false;
}
if (sessionStorage.getItem("manager")) {
this.management = true;
this.contract_show = true;
}
}
};
};
</script>
<style>
.el-container > .el-main {
min-width: 1120px;
text-align: center;
padding-top: 0;
padding-left: 0;
......@@ -106,10 +112,10 @@ export default {
}
.el-container,
.el-aside {
min-width: 167px;
height: 100%;
}
.el-aside > .el-menu {
height: 100%;
}
</style>
......@@ -24,139 +24,141 @@
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('password_form')">提交</el-button>
<el-button @click="resetForm('password_form')">重置</el-button>
<el-button-group>
<el-button type="primary" @click="submitForm('password_form')">提交</el-button>
<el-button type="warning" @click="resetForm('password_form')">重置</el-button>
</el-button-group>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
export default {
name: "user",
data() {
return {
new_password_type: "password",
odd_password_type: "password",
new_password_view: "icon i-password-not-view",
odd_password_view: "icon i-password-not-view",
rtoken: "",
user_unid: "",
auth_base_url: disparch_data.auth_base_url,
password_form: {
odd_password: "",
new_password: "",
check_password: ""
},
password_form_rules: {
odd_password: {
required: true,
message: "请填写旧密码",
trigger: "blur"
export default {
name: "user",
data() {
return {
new_password_type: "password",
odd_password_type: "password",
new_password_view: "icon i-password-not-view",
odd_password_view: "icon i-password-not-view",
rtoken: "",
user_unid: "",
auth_base_url: this.$disparch_data.auth_base_url,
password_form: {
odd_password: "",
new_password: "",
check_password: ""
},
new_password: [
{
pattern: /^[A-Za-z\d]{6,}$/,
message: "密码至少6位",
trigger: "blur"
},
{
password_form_rules: {
odd_password: {
required: true,
message: "必须填写新密码",
message: "请填写旧密码",
trigger: "blur"
},
{
validator: (rule, value, callback) => {
if (value == this.password_form.odd_password) {
callback(new Error("新密码不能和旧密码相同"));
} else callback();
new_password: [
{
pattern: /^[A-Za-z0-9\x20-\x7f]{6,16}$/,
message: "密码至少6位,至多16位",
trigger: "blur"
},
trigger: "blur"
}
],
check_password: [
{
pattern: /^[A-Za-z\d]{6,}$/,
message: "密码至少6位",
trigger: "blur"
},
{
required: true,
message: "必须填写新密码",
trigger: "blur"
},
{
validator: (rule, value, callback) => {
if (value != this.password_form.new_password) {
callback(new Error("两次输入不一致"));
} else callback();
{
required: true,
message: "必须填写新密码",
trigger: "blur"
},
trigger: "blur"
{
validator: (rule, value, callback) => {
if (value == this.password_form.odd_password) {
callback(new Error("新密码不能和旧密码相同"));
} else callback();
},
trigger: "blur"
}
],
check_password: [
{
pattern: /^[A-Za-z0-9\x20-\x7f]{6,16}$/,
message: "密码至少6位,至多16位",
trigger: "blur"
},
{
required: true,
message: "必须填写新密码",
trigger: "blur"
},
{
validator: (rule, value, callback) => {
if (value != this.password_form.new_password) {
callback(new Error("两次输入不一致"));
} else callback();
},
trigger: "blur"
}
]
}
};
},
methods: {
show_odd_password() {
if (this.odd_password_type == "password") {
this.odd_password_type = "text";
this.odd_password_view = "icon i-password-view";
} else {
this.odd_password_type = "password";
this.odd_password_view = "icon i-password-not-view";
}
},
show_new_password() {
if (this.new_password_type == "password") {
this.new_password_type = "text";
this.new_password_view = "icon i-password-view";
} else {
this.new_password_type = "password";
this.new_password_view = "icon i-password-not-view";
}
},
submitForm(form) {
this.$refs[form].validate(valid => {
if (valid) {
this.$Axios({
method: "post",
url: this.auth_base_url + "users/" + this.user_unid + "/password",
headers: { authorization: this.rtoken },
data: {
old_pwd: this.password_form.odd_password,
new_pwd: this.password_form.new_password
}
})
.then(response => {
if (response.data.user_unid) {
this.$message({
type: "success",
message: "修改成功"
});
this.resetForm("password_form");
}
})
.catch(err => {
this.$message.error("修改失败");
this.resetForm("password_form");
});
}
]
}
};
},
methods: {
show_odd_password() {
if (this.odd_password_type == "password") {
this.odd_password_type = "text";
this.odd_password_view = "icon i-password-view";
} else {
this.odd_password_type = "password";
this.odd_password_view = "icon i-password-not-view";
});
},
resetForm(form) {
this.$refs[form].resetFields();
}
},
show_new_password() {
if (this.new_password_type == "password") {
this.new_password_type = "text";
this.new_password_view = "icon i-password-view";
created() {
if (!sessionStorage.getItem("user_unid")) {
this.$router.push("/");
} else {
this.new_password_type = "password";
this.new_password_view = "icon i-password-not-view";
this.rtoken = sessionStorage.getItem("rtoken");
this.user_unid = sessionStorage.getItem("user_unid");
}
},
submitForm(form) {
this.$refs[form].validate(valid => {
if (valid) {
this.$Axios({
method: "post",
url: this.auth_base_url + "users/" + this.user_unid + "/password",
headers: { authorization: this.rtoken },
data: {
old_pwd: this.password_form.odd_password,
new_pwd: this.password_form.new_password
}
})
.then(response => {
if (response.data.user_unid) {
this.$message({
type: "success",
message: "修改成功"
});
this.resetForm("password_form");
}
})
.catch(err => {
this.$message.error("修改失败");
this.resetForm("password_form");
});
}
});
},
resetForm(form) {
this.$refs[form].resetFields();
}
},
created() {
if (!sessionStorage.getItem("user_unid")) {
this.$router.push("/");
} else {
this.rtoken = sessionStorage.getItem("rtoken");
this.user_unid = sessionStorage.getItem("user_unid");
}
}
};
};
</script>
......
......@@ -9,7 +9,6 @@ import CollapseTransition from 'element-ui/lib/transitions/collapse-transition';
import 'element-ui/lib/theme-chalk/index.css'
import '../static/city-data'
// import "./mock"
import '../static/disparch'
import './assets/icons/iconfont.css'
import 'babel-polyfill'
......@@ -76,6 +75,23 @@ Axios.interceptors.response.use((response) => {
return Promise.reject(err);
});
{
if (window.location.host == 'localhost:8089') {
Vue.prototype.$disparch_data = {
code_base_url: "http://192.168.9.162:20080/api/v1/codes/",
contract_base_url: "http://192.168.9.162:20080/api/v1/financial/contracts/",
auth_base_url: "http://192.168.9.162:20080/api/v1/auth/"
}
} else {
var url = window.location.host;
Vue.prototype.$disparch_data = {
code_base_url: "http://" + url + "/api/v1/codes/",
contract_base_url: "http://" + url + "/api/v1/financial/contracts/",
auth_base_url: "http://" + url + "/api/v1/auth/"
}
}
}
new Vue({
......
disparch_data = {
code_base_url: "http://192.168.9.162:20080/api/v1/codes/",
contract_base_url: "http://192.168.9.162:20080/api/v1/financial/contracts/",
auth_base_url: "http://192.168.9.162:20080/api/v1/auth/"
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!