index.vue
5.89 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<template>
<div>
<Dec :content="content" />
<div class="setdata">
<div class="setlv">
<span style="float:left;line-height:65px;">成绩等级设置:</span>
<Slider :data="data" width="600" style="margin-left:120px" bgcolor="#56c68d" @change="change" />
<p class="dec">请按正确率划分成绩等级区间</p>
</div>
<div class="setinfo">
<span style="float:left;">自定义配置:</span>
<div class="viewbox" style="margin-left:120px;overflow:hidden">
<div class="infobox" style="float:left;">
<p>云平台显示名字</p>
<el-input
v-model="text"
type="text"
placeholder="请输入内容"
maxlength="10"
style="width:210px"
show-word-limit
/>
<p>云平台主页logo布局</p>
<el-switch
v-model="layoutSwitch"
active-color="#13ce66"
inactive-color="#ff4949"
@change="switchChange"
/>
<p>上传LOGO</p>
<el-upload
class="avatar-uploader"
action="https://jsonplaceholder.typicode.com/posts/"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon" />
</el-upload>
<p>图片规格:100*100 </p>
<p>文件大小:小于200K</p>
</div>
<div class="pcview" style="float:left;margin:0 20px">
<div class="login-pc">
<img :src="require('@/assets/images/logo.png')" class="login-logo" alt="">
<div class="login-title">{{ text }}</div>
</div>
<h2 class="viewtitle">云平台</h2>
</div>
<div class="nativeview" style="float:left;">
<div class="login-pc">
<img :src="require('@/assets/images/logo.png')" class="login-logo" alt="">
<div class="login-title">{{ text }}</div>
</div>
<h2 class="viewtitle">客户端</h2>
</div>
</div>
</div>
<div class="testtip" style="overflow:hidden;margin-top:20px;">
<span style="float:left;line-height:40px;">考试提示语:</span>
<div class="inputtip" style="float:left;">
<el-input
v-model="text"
type="text"
placeholder="请输入内容"
maxlength="15"
style="width:310px"
show-word-limit
/>
</div>
<div class="tipview" style="float:left;margin-left:20px;">
<div class="login-pc">
<img :src="require('@/assets/images/logo.png')" class="login-logo" alt="">
<div class="login-title">{{ text }}</div>
</div>
</div>
</div>
<el-button type="primary" style="display:block;margin:0 auto;margin-top:40px;">保存</el-button>
</div>
</div>
</template>
<script>
import { getLogoLayout } from '@/utils/auth'
import Dec from '@/components/Dec'
import Slider from './complate/slider'
export default {
name: 'Setdata',
components: {
Dec,
Slider
},
data() {
return {
content: '',
layoutSwitch: getLogoLayout() === 'topBottom',
text: '',
data: [
{
name: '不合格',
color: '#374c41',
bl: '50%'
},
{
name: '合格',
color: '#3c8574',
bl: '70%'
},
{
name: '良好',
color: '#45a472',
bl: '80%'
}
],
imageUrl: ''
}
},
methods: {
switchChange() {
if (this.layoutSwitch) {
this.$store.commit('user/SET_LOGOLAYOUT', 'topBottom')
} else {
this.$store.commit('user/SET_LOGOLAYOUT', 'leftRight')
}
},
change(data) {
this.data = data
},
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw)
},
beforeAvatarUpload(file) {
const isSize = new Promise(function(resolve, reject) {
const width = 100
const height = 100
const _URL = window.URL || window.webkitURL
const img = new Image()
img.onload = function() {
const valid = img.width <= width && img.height <= height
valid ? resolve() : reject()
}
img.src = _URL.createObjectURL(file)
}).then(() => {
return file
}, () => {
this.$message.error('上传的icon必须是等于或大于100*100!')
return Promise.reject()
})
return isSize
}
}
}
</script>
<style >
.setdata{
max-width: 1100px;
height: calc(100% - 65px);
background: #fff;
margin:0 auto;
padding:20px;
margin-top:15px;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 100px;
height: 100px;
line-height: 100px;
text-align: center;
}
.avatar {
width: 100px;
height: 100px;
display: block;
}
.login-pc{
width:590px;
height:800px;
overflow: hidden;
background: url("../../../assets/images/login.jpg") no-repeat;
background-size:cover;
zoom:0.5;
}
.login-pc .login-logo{
width:140px;
display: block;
margin: 0 auto;
margin-top:48px;
}
.login-pc .login-title{
font-size: 24px;
color:#000;
font-weight:bold;
text-align: center;
margin-top:190px;
}
.setlv{
overflow: hidden;
}
.setlv .dec{
font-size: 12px;
color:#bbb
}
.viewtitle{
text-align: center
}
</style>