|
|
@@ -1,12 +1,13 @@
|
|
|
<script setup lang="ts">
|
|
|
-import {ElForm, ElFormItem, ElMessage} from "element-plus";
|
|
|
-import {ref, computed} from 'vue';
|
|
|
-import {createStore} from "../../api/store.ts";
|
|
|
-import {uploadFile} from "../../api/tool.ts";
|
|
|
+import {ElForm, ElFormItem, ElMessage} from "element-plus"
|
|
|
+import {computed, ref} from 'vue'
|
|
|
+import {createStore} from "../../api/store.ts"
|
|
|
+import {uploadImage} from "../../api/image.ts"
|
|
|
|
|
|
// 输入框值
|
|
|
-const name = ref('');
|
|
|
+const name = ref('')
|
|
|
const location = ref('')
|
|
|
+const logoURL = ref('')
|
|
|
|
|
|
// 用于前端阻拦不合法输入
|
|
|
const hasNameInput = computed(() => name.value != '')
|
|
|
@@ -40,11 +41,22 @@ function drop(e) {
|
|
|
}
|
|
|
|
|
|
function generateURL(file) {
|
|
|
- let fileSrc = URL.createObjectURL(file);
|
|
|
- setTimeout(() => {
|
|
|
- URL.revokeObjectURL(fileSrc);
|
|
|
- }, 1000);
|
|
|
- return fileSrc;
|
|
|
+ console.log(document.cookie.split(";")[0].split("=")[1])
|
|
|
+ const payload = {
|
|
|
+ file: files[0]
|
|
|
+ };
|
|
|
+ uploadImage(payload).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.logoURL = res.value;
|
|
|
+ console.log(this.logoURL);
|
|
|
+ return this.logoUrl;
|
|
|
+ });
|
|
|
+ // let fileSrc = URL.createObjectURL(file);
|
|
|
+ // setTimeout(() => {
|
|
|
+ // URL.revokeObjectURL(fileSrc);
|
|
|
+ // }, 1000);
|
|
|
+ // console.log(fileSrc);
|
|
|
+ // return fileSrc;
|
|
|
}
|
|
|
|
|
|
function remove(i) {
|
|
|
@@ -66,7 +78,7 @@ function handleCreateStore() {
|
|
|
file: files[0]
|
|
|
};
|
|
|
createStore(payload1).then(res => {
|
|
|
- uploadFile(payload2).then(res => {
|
|
|
+ uploadImage(payload2).then(res => {
|
|
|
ElMessage.success(`添加商户成功!`);
|
|
|
});
|
|
|
});
|
|
|
@@ -76,7 +88,7 @@ function handleCreateStore() {
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div class="flex flex-col items-center justify-center px-6 py-6 space-y-10 min-h-screen">
|
|
|
+ <div class="flex flex-col items-center justify-center px-6 py-6 space-y-10">
|
|
|
|
|
|
<span class="flex items-center text-2xl font-semibold text-gray-900">
|
|
|
Blue Whale Shopping Online
|