index.vue
3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<style lang="scss" scoped>
.qg-layout-placeholder {
width: 320px;
border: 2px solid #d2d2d2;
cursor: pointer;
border-radius: 10px;
&:hover {
box-shadow: 0 0 12px 3px #eaeaea;
}
&.current {
border-color: $primary;
}
~ .qg-layout-placeholder {
margin-left: 20px;;
}
}
.qg-setting-color {
display: inline-block;
width: 40px;
height: 40px;
border-radius: 8px;
position: relative;
opacity: 0.5;
&:hover {
opacity: 1;
}
~ .qg-setting-color {
margin-left: 10px;
}
&.active {
opacity: 1;
&:before, &:after {
content: '️';
display: inline-block;
width: 10px;
height: 2px;
background-color: #fff;
position: absolute;
border-radius: 2px;
}
&:before {
transform: rotate(51deg);
top: 21px;
left: 10px;
}
&:after {
width: 18px;
transform: rotate(-51deg);
top: 18px;
left: 14px;
}
}
}
</style>
<template>
<div class="app-container ">
<section class="qg-container">
<h4 class="qg-container__title">系统设置</h4>
<el-form ref="postForm" class="qg-container" :inline="true" :model="postForm" label-width="100px">
<el-form-item label="初始密码">
<el-input v-model.trim="postForm.initPassword" placeholder="输入密码" max-length="20"/>
</el-form-item>
<el-form-item label="">
<el-button
size="small"
type="primary"
@click="handleOk"
>保存
</el-button>
</el-form-item>
</el-form>
</section>
</div>
</template>
<script>
import {getInitPassword, addInitPassword, editInitPassword} from '@/api/moudles/uc/system.js';
export default {
name: 'System',
data() {
return {
postForm: {
id: null,
initPassword: ''
},
colorForm: {},
isInitial: false
};
},
created() {
this.getInitPassword();
},
methods: {
getInitPassword() {
getInitPassword().then((res) => {
if (!res.data) {
this.isInitial = true;
} else {
this.isInitial = false;
this.postForm.initPassword = res.data.initPassword;
this.postForm.id = res.data.id;
}
});
},
handleOk() {
let request = null;
if (this.isInitial) {
request = addInitPassword(this.postForm);
} else {
request = editInitPassword(this.postForm);
}
request.then(res => {
if (!res.success) {
this.$message.error(res.msg || '保存失败');
return;
}
this.$message.success(res.msg || '保存成功');
this.getInitPassword();
});
}
}
};
</script>