This commit is contained in:
parent
e55bdd2c16
commit
491a9bb79e
@ -33,8 +33,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</n-modal>
|
</n-modal>
|
||||||
</n-scrollbar>
|
</n-scrollbar>
|
||||||
<n-upload multiple action="https://www.hxyouzi.com/api/file/upload" accept="image/*"
|
<n-upload multiple action="https://www.hxyouzi.com/pic/upload" accept="image/*"
|
||||||
:data="{ strategy_id: 2 }"
|
:data="{ strategy_id: 2 }"
|
||||||
:headers="{ Authorization: 'Bearer ' + '2|RKsuwoT7mbtuTW7Eguc566uwt7Wg4qgpGA6XTpM1' }" :show-file-list="false" :on-finish="fileFinish">
|
:headers="{ Authorization: 'Bearer ' + '2|RKsuwoT7mbtuTW7Eguc566uwt7Wg4qgpGA6XTpM1' }" :show-file-list="false" :on-finish="fileFinish">
|
||||||
<n-button type="primary">上传图片</n-button>
|
<n-button type="primary">上传图片</n-button>
|
||||||
</n-upload>
|
</n-upload>
|
||||||
@ -52,16 +52,16 @@ const bottomLen = ref(20)
|
|||||||
// console.log(4444, size.conH);
|
// console.log(4444, size.conH);
|
||||||
const list = ref([]);
|
const list = ref([]);
|
||||||
const token = cookie.get("token");
|
const token = cookie.get("token");
|
||||||
function fileFinish(file) {
|
// function fileFinish(file) {
|
||||||
const res = JSON.parse(file.event.currentTarget.response);
|
// const res = JSON.parse(file.event.currentTarget.response);
|
||||||
// console.log(res);
|
// // console.log(res);
|
||||||
if (res.code == 1) {
|
// if (res.code == 1) {
|
||||||
$msg.success(res.msg);
|
// $msg.success(res.msg);
|
||||||
getMyfile();
|
// getMyfile();
|
||||||
} else {
|
// } else {
|
||||||
$msg.error(res.msg);
|
// $msg.error(res.msg);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
async function getMyfile() {
|
async function getMyfile() {
|
||||||
list.value = [];
|
list.value = [];
|
||||||
@ -253,6 +253,23 @@ function arrCount() {
|
|||||||
acount.value = Math.floor(cw * 0.95 / (pw + 20))
|
acount.value = Math.floor(cw * 0.95 / (pw + 20))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fileFinish(file) {
|
||||||
|
const res = JSON.parse(file.event.currentTarget.response);
|
||||||
|
console.log("返回文件", res);
|
||||||
|
const r = await $http.file.uploadImg({
|
||||||
|
url: res.data.links.url,
|
||||||
|
filename: res.data.origin_name,
|
||||||
|
});
|
||||||
|
console.log("上传服务器", r);
|
||||||
|
|
||||||
|
if (r.code == 1) {
|
||||||
|
$msg.success(r.msg);
|
||||||
|
getMyfile();
|
||||||
|
} else {
|
||||||
|
$msg.error(r.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
arrCount()
|
arrCount()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user