luobisheng
2022-11-15 34dd28374d5e3c69932e8a090460b3a461bc0ec5
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<template>
    <div class="createmyInterface">
        <main>
            <div class="mainContent">
                <el-form ref="user" label-width="140px" autoComplete="on" :model="myInterface"
                    :rules="createmyInterfaceRules" label-position="right">
                    <!-- 应用名称 -->
                    <el-form-item label="应用名称:" prop="applicationName">
                        <el-input v-model="myInterface.applicationName" placeholder="填写应用名称"></el-input>
                    </el-form-item>
                    <!-- 应用图标 -->
                    <el-form-item label="应用图标:" prop="applicationIconUrl">
                        <div class="iconBox">
                            <div class="upload">
                                <img src="@/assets/imgs/user/default-avatar.jpg" alt="">
                            </div>
                            <div class="iconView">
                                <span>示意图</span>
                                <img src="@/assets/imgs/user/default-avatar.jpg" alt="">
                            </div>
                            <div class="tip">
                                <span>只允许上传jpg,jpeg,png,svg格式的图片,建议尺寸为105px*105px</span>
                            </div>
                        </div>
                    </el-form-item>
                    <!-- 应用类型 -->
                    <el-form-item label="应用类型:" prop="applicationType">
                        <div class="optionItem">
                            <el-radio-group v-model="myInterface.applicationType">
                                <el-radio :label="1">网页应用</el-radio>
                            </el-radio-group>
                        </div>
                    </el-form-item>
                    <!--网站url  -->
                    <el-form-item label="网站url:" prop="websiteUrl">
                        <el-input v-model="myInterface.websiteUrl"></el-input>
                    </el-form-item>
                    <!-- 应用描述 -->
                    <el-form-item label="应用描述:" prop="description">
                        <el-input v-model="myInterface.description" placeholder="请填写描述"></el-input>
                    </el-form-item>
                    <!-- 按钮 -->
                    <el-form-item>
                        <div class="optionBtn">
                            <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">提交
                            </el-button>
                            <el-button class="btn reset">重置</el-button>
                        </div>
                    </el-form-item>
                </el-form>
            </div>
        </main>
    </div>
</template>
<script>
export default {
    data() {
        const validateApplicationName = (rule, value, callback) => {
            if (!value) {
                callback(new Error("请填写用户名称"));
            }
        };
        const validateApplicationIconUrl = (rule, value, callback) => {
            if (!value) {
                callback(new Error("请填写登录密码"));
            } else {
                const rep = /^\w+$/;
                if (!rep.test(value)) {
                    callback(new Error("密码只能是以数字、26个英文字母或者下划线组成的字符串"));
                }
            }
        };
        const validateApplicationType = (rule, value, callback) => {
            if (!value) {
                callback(new Error("请填写用户姓名"));
            } else {
                const rep = /^[\u4E00-\u9FA5]{2,4}$/;
                if (!rep.test(value)) {
                    callback("请输入正确的用户姓名");
                }
            }
        };
        const validatePhone = (rule, value, callback) => {
            if (!value) {
                callback(new Error("请填写手机号码"));
            } else {
                const rep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/
                if (!rep.test(value)) {
                    callback("请输入正确的手机号码");
                }
            }
        };
        return {
            myInterface: {
            },
            createmyInterfaceRules: {
                applicationName: [
                    { required: true, trigger: "blur", validator: validateApplicationName},
                ],
                applicationIconUrl: [
                    { required: true, trigger: "blur", validator: validateApplicationIconUrl },
                ],
                applicationType: [
                    { required: true, trigger: "blur", validator: validateApplicationType },
                ],
                websiteUrl: [
                    { required: true, trigger: "blur" },
                ],
                description: [
                    { required: false, trigger: "blur" },
                ],
            },
        }
    },
    created() {
        const that = this;
    },
    methods: {
        handleUser() {
            const { myInterface } = this;
            this.$axios.post('sccg/system/portal/thirdApp/add', {
                websiteUrl:myInterface.websiteUrl,
                applicationIconUrl:myInterface.applicationIconUrl,
                applicationType:0,
                description:myInterface.description,
                applicationName:myInterface.applicationName
            }).then(res => {
                // if (res.code === 200) {
                //     this.refresh();
                // }
            })
        },
    },
    props: ['refresh']
}
</script>
<style lang="scss" scoped>
.createmyInterface {
    border-radius: 1px;
    background-color: #09152f;
 
    main {
        text-align: left;
        padding: 0 55px;
        background-color: #09152f;
        padding-bottom: 50px;
        .mainContent {
            display: flex;
            justify-content: center;
            padding-top: 50px;
 
            .iconBox {
                display: flex;
 
                .upload {
                    display: flex;
                    align-items: flex-end;
 
                    img {
                        width: 120px;
                        height: 120px;
                        border-radius: 4px;
                    }
                }
 
                .iconView {
                    display: flex;
                    flex-direction: column;
                    margin-left: 30px;
                    justify-content: flex-end;
 
                    img {
                        width: 70px;
                        height: 70px;
                        border-radius: 4px;
                    }
                }
 
                .tip {
                    display: flex;
                    align-items: flex-end;
                    margin-left: 30px;
                    font-size: 12px;
 
                    span {
                        line-height: 20px;
                    }
                }
            }
            .optionBtn{
                margin-top: 30px;
                &::v-deep .el-button{
                    padding: 12px 40px;
                }
                .reset{
                    border: 1px solid #0079fe;
                    color: #0079fe;
                }
            }
            &::v-deep .el-form-item__label {
                color: #4b9bb7;
            }
 
            &::v-deep .el-input__inner {
                background-color: #09152f;
                border: 1px solid #17324c;
            }
 
            .addPerson {
                display: flex;
                list-style: none;
                padding: 0;
 
                li {
                    background-color: #cccccc;
                    width: 36px;
                    height: 36px;
                    border-radius: 50%;
                    color: #fff;
                    text-align: center;
                    font-size: 30px;
                    margin-left: 10px;
                }
            }
 
            .el-form-item__content {
                width: 400px;
 
                .el-select {
                    width: 100%;
                }
            }
 
            .optionHandleSp {
                display: flex;
 
                .areaNumber,
                .moreNumber {
                    flex: 1;
                }
 
                .telNumber {
                    flex: 2;
                }
            }
 
        }
    }
 
    footer {
        border-top: 1px solid #fff;
        height: 80px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding-right: 20px;
    }
}
</style>