Przeglądaj źródła

上传优化

gzb
wangzhonglu 1 rok temu
rodzic
commit
6b0331132a
2 zmienionych plików z 72 dodań i 53 usunięć
  1. 1
    1
      src/App.vue
  2. 71
    52
      src/views/news/index.vue

+ 1
- 1
src/App.vue Wyświetl plik

@@ -158,7 +158,7 @@ body,
158 158
   padding: 16px 0;
159 159
   text-align: right;
160 160
 }
161
-.ivu-radio-group {
161
+.ivu-form-item .ivu-radio-group {
162 162
   display: flex;
163 163
   justify-content: flex-start;
164 164
 }

+ 71
- 52
src/views/news/index.vue Wyświetl plik

@@ -78,34 +78,40 @@
78 78
           </RadioGroup>
79 79
         </FormItem>
80 80
         <FormItem label="封面" prop="newspic">
81
-          <Upload
82
-            :format="pictureFormat"
83
-            :max-size="10 * 1024"
84
-            action
85
-            :before-upload="
86
-              (file) => {
87
-                beforeUploadPicture(file, addForm);
88
-                return false;
89
-              }
90
-            "
91
-            :accept="getPictureAccept()"
92
-            :show-upload-list="false"
93
-          >
94
-            <img
95
-              style="width: 200px"
96
-              v-if="addForm.newspic"
97
-              :src="$api.showImageUrl + addForm.newspic"
98
-            />
99
-            <!-- <Button v-else icon="ios-cloud-upload-outline">上传封面</Button> -->
100
-            <div class="upload_img" v-else>
101
-              <Icon
102
-                type="ivu-icon ivu-icon- iconfont icon-shangchuan"
103
-                size="42"
104
-                color="#e6e6e6"
81
+          <div class="form_item_upload">
82
+            <Upload
83
+              :format="pictureFormat"
84
+              :max-size="10 * 1024"
85
+              action
86
+              :before-upload="
87
+                (file) => {
88
+                  beforeUploadPicture(file, addForm);
89
+                  return false;
90
+                }
91
+              "
92
+              :accept="getPictureAccept()"
93
+              :show-upload-list="false"
94
+            >
95
+              <img
96
+                style="width: 200px"
97
+                v-if="addForm.newspic"
98
+                :src="$api.showImageUrl + addForm.newspic"
105 99
               />
106
-              <p class="shangchuan_btn">上传图片</p>
100
+              <!-- <Button v-else icon="ios-cloud-upload-outline">上传封面</Button> -->
101
+              <div class="upload_img" v-else>
102
+                <Icon
103
+                  type="ivu-icon ivu-icon- iconfont icon-shangchuan"
104
+                  size="42"
105
+                  color="#e6e6e6"
106
+                />
107
+                <p class="shangchuan_btn">上传图片</p>
108
+              </div>
109
+            </Upload>
110
+            <div class="uptype">
111
+              <p>支持上传格式(10MB以内):</p>
112
+              <p>jpg、jpeg、png、bmp、jfif、webp.</p>
107 113
             </div>
108
-          </Upload>
114
+          </div>
109 115
         </FormItem>
110 116
         <FormItem label="置顶" prop="newsup">
111 117
           <RadioGroup v-model="addForm.newsup">
@@ -161,34 +167,40 @@
161 167
         :model="modifyForm"
162 168
       >
163 169
         <FormItem label="封面" prop="newspic">
164
-          <Upload
165
-            :format="pictureFormat"
166
-            :max-size="10 * 1024"
167
-            action
168
-            :before-upload="
169
-              (file) => {
170
-                beforeUploadPicture(file, modifyForm);
171
-                return false;
172
-              }
173
-            "
174
-            :accept="getPictureAccept()"
175
-            :show-upload-list="false"
176
-          >
177
-            <img
178
-              style="width: 200px"
179
-              v-if="modifyForm.newspic"
180
-              :src="$api.showImageUrl + modifyForm.newspic"
181
-            />
182
-            <!-- <Button v-else icon="ios-cloud-upload-outline">上传封面</Button> -->
183
-            <div class="upload_img" v-else>
184
-              <Icon
185
-                type="ivu-icon ivu-icon- iconfont icon-shangchuan"
186
-                size="42"
187
-                color="#e6e6e6"
170
+          <div class="form_item_upload">
171
+            <Upload
172
+              :format="pictureFormat"
173
+              :max-size="10 * 1024"
174
+              action
175
+              :before-upload="
176
+                (file) => {
177
+                  beforeUploadPicture(file, modifyForm);
178
+                  return false;
179
+                }
180
+              "
181
+              :accept="getPictureAccept()"
182
+              :show-upload-list="false"
183
+            >
184
+              <img
185
+                style="width: 200px"
186
+                v-if="modifyForm.newspic"
187
+                :src="$api.showImageUrl + modifyForm.newspic"
188 188
               />
189
-              <p class="shangchuan_btn">上传图片</p>
189
+              <!-- <Button v-else icon="ios-cloud-upload-outline">上传封面</Button> -->
190
+              <div class="upload_img" v-else>
191
+                <Icon
192
+                  type="ivu-icon ivu-icon- iconfont icon-shangchuan"
193
+                  size="42"
194
+                  color="#e6e6e6"
195
+                />
196
+                <p class="shangchuan_btn">上传图片</p>
197
+              </div>
198
+            </Upload>
199
+            <div class="uptype">
200
+              <p>支持上传格式(10MB以内):</p>
201
+              <p>jpg、jpeg、png、bmp、jfif、webp.</p>
190 202
             </div>
191
-          </Upload>
203
+          </div>
192 204
         </FormItem>
193 205
         <FormItem label="置顶" prop="newsup">
194 206
           <RadioGroup v-model="modifyForm.newsup">
@@ -616,6 +628,13 @@ export default {
616 628
   padding: 16px 0;
617 629
   text-align: right;
618 630
 }
631
+.form_item_upload {
632
+  display: flex;
633
+  justify-content: flex-start;
634
+  .uptype {
635
+    padding-left: 10px;
636
+  }
637
+}
619 638
 .upload_img {
620 639
   padding-top: 10px;
621 640
   width: 198px;

Ładowanie…
Anuluj
Zapisz