|
...
|
...
|
@@ -35,8 +35,8 @@ |
|
35
|
35
|
:before-upload="beforeUploadIconPic"
|
|
36
|
36
|
>
|
|
37
|
37
|
<div v-if="iconPic">
|
|
38
|
|
- <img :src="iconPic" />
|
|
39
|
|
- <div style="background-color: #ccc">重新上传</div>
|
|
|
38
|
+ <img :src="iconPic" class="m-auto" />
|
|
|
39
|
+ <div style="background-color: #ccc; margin-top: 20px">重新上传</div>
|
|
40
|
40
|
</div>
|
|
41
|
41
|
<div v-else>
|
|
42
|
42
|
<PlusOutlined style="font-size: 30px" />
|
|
...
|
...
|
@@ -95,6 +95,7 @@ |
|
95
|
95
|
import type { FileItem } from '/@/components/Upload/src/typing';
|
|
96
|
96
|
import { logoUpload, iconUpload, bgUpload, getPlatForm, updatePlatForm } from '/@/api/oem/index';
|
|
97
|
97
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
|
|
98
|
+ import { createLocalStorage } from '/@/utils/cache/index';
|
|
98
|
99
|
export default defineComponent({
|
|
99
|
100
|
components: {
|
|
100
|
101
|
BasicForm,
|
|
...
|
...
|
@@ -146,7 +147,7 @@ |
|
146
|
147
|
}
|
|
147
|
148
|
return isJpgOrPng && isLt2M;
|
|
148
|
149
|
};
|
|
149
|
|
-
|
|
|
150
|
+ // Icon上传
|
|
150
|
151
|
async function customUploadIconPic({ file }) {
|
|
151
|
152
|
if (beforeUploadIconPic(file)) {
|
|
152
|
153
|
const formData = new FormData();
|
|
...
|
...
|
@@ -158,9 +159,9 @@ |
|
158
|
159
|
}
|
|
159
|
160
|
}
|
|
160
|
161
|
const beforeUploadIconPic = (file: FileItem) => {
|
|
161
|
|
- const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
|
|
162
|
+ const isJpgOrPng = file.type === 'image/x-icon';
|
|
162
|
163
|
if (!isJpgOrPng) {
|
|
163
|
|
- createMessage.error('只能上传图片文件!');
|
|
|
164
|
+ createMessage.error('只能上传.icon图片文件!');
|
|
164
|
165
|
}
|
|
165
|
166
|
const isLt2M = (file.size as number) / 1024 < 500;
|
|
166
|
167
|
if (!isLt2M) {
|
|
...
|
...
|
@@ -198,12 +199,16 @@ |
|
198
|
199
|
compState.value.loading = true;
|
|
199
|
200
|
await updatePlatForm({
|
|
200
|
201
|
...fieldValue,
|
|
201
|
|
- background: unref(bgPic),
|
|
202
|
|
- icon: unref(bgPic),
|
|
203
|
202
|
logo: unref(logoPic),
|
|
|
203
|
+ icon: unref(iconPic),
|
|
|
204
|
+ background: unref(bgPic),
|
|
204
|
205
|
});
|
|
205
|
206
|
compState.value.loading = false;
|
|
206
|
207
|
createMessage.success('保存信息成功');
|
|
|
208
|
+
|
|
|
209
|
+ // 保存一份数据到本地缓存中.
|
|
|
210
|
+ const storage = createLocalStorage();
|
|
|
211
|
+ storage.set('PlatformInfo', fieldValue);
|
|
207
|
212
|
} catch (e) {
|
|
208
|
213
|
createMessage.error('保存信息失败');
|
|
209
|
214
|
}
|
...
|
...
|
|