|
@@ -0,0 +1,149 @@
|
|
|
+<template>
|
|
|
+ <div class="upload-video">
|
|
|
+ <div class="upload-box">
|
|
|
+ <input
|
|
|
+ class="upload-input"
|
|
|
+ ref="chooseFile"
|
|
|
+ type="file"
|
|
|
+ @change="addFile"
|
|
|
+ multiple
|
|
|
+ accept=".jpg,.png,.jpeg,"
|
|
|
+ />
|
|
|
+ <i class="iconfont icon-empty"></i>
|
|
|
+ <p>点击或将文件拖拽到这里上传</p>
|
|
|
+ <p class="gray-font">建议最佳:宽高比16:9,1280*720≤尺寸≤2560*1440,</p>
|
|
|
+ <p class="gray-font">
|
|
|
+ 支持JPG,PNG等图片格式。命名格式:推广书记名称-需求方-文案
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <div class="upload-list">
|
|
|
+ <div class="list-item" v-for="(item, index) in fileList" :key="index">
|
|
|
+ <i class="iconfont icon-paper-clip"></i>
|
|
|
+ <p>
|
|
|
+ {{ item.name }}
|
|
|
+ <i class="iconfont icon-guanbi" @click="deleteItem(index)"></i
|
|
|
+ ><a-progress
|
|
|
+ :showInfo="false"
|
|
|
+ :percent="item.percent"
|
|
|
+ status="active"
|
|
|
+ />
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <p class="gray-font footer-num">已选择:{{ fileList.length }}/20</p>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts">
|
|
|
+import { defineComponent, reactive, toRefs, ref } from "vue";
|
|
|
+import {} from "@/api";
|
|
|
+import { message, Progress } from "ant-design-vue";
|
|
|
+const UploadVideo = defineComponent({
|
|
|
+ components: {},
|
|
|
+ setup() {
|
|
|
+ const formRef = ref();
|
|
|
+ const state = reactive({
|
|
|
+ fileList: ref<any[]>([]),
|
|
|
+ });
|
|
|
+ return { ...toRefs(state) };
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+ methods: {
|
|
|
+ // 选择视频后
|
|
|
+ addFile(event: any) {
|
|
|
+ console.log(event.target.files);
|
|
|
+ event.target.files.forEach((item: any) => {
|
|
|
+ this.fileList.push({
|
|
|
+ file: item,
|
|
|
+ name: item.name,
|
|
|
+ percent: 0,
|
|
|
+ materialSize: (item.size / 1024 / 1024).toFixed(2) + "MB",
|
|
|
+ type: item.type.split("/")[0],
|
|
|
+ });
|
|
|
+ });
|
|
|
+ console.log("新增文件列表", this.fileList);
|
|
|
+ },
|
|
|
+ // 删除item
|
|
|
+ deleteItem(index: number) {
|
|
|
+ this.fileList.splice(index, 1);
|
|
|
+ },
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+export default UploadVideo;
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+@import "@/assets/common-style/frame.scss";
|
|
|
+.upload-video {
|
|
|
+ width: 100%;
|
|
|
+ padding: 0 10%;
|
|
|
+ .gray-font {
|
|
|
+ color: gray;
|
|
|
+ }
|
|
|
+ .upload-box {
|
|
|
+ cursor: pointer;
|
|
|
+ background: rgb(250, 250, 250);
|
|
|
+ border: 2px dashed rgb(212, 210, 210);
|
|
|
+ border-radius: 6px;
|
|
|
+ transition: all 0.3s;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ position: relative;
|
|
|
+ i {
|
|
|
+ color: rgb(168, 167, 167);
|
|
|
+ display: block;
|
|
|
+ font-size: 60px;
|
|
|
+ }
|
|
|
+ i,
|
|
|
+ p {
|
|
|
+ text-align: center;
|
|
|
+ transition: all 0.3s;
|
|
|
+ }
|
|
|
+ // 选择文件
|
|
|
+ .upload-input {
|
|
|
+ position: absolute;
|
|
|
+ display: block;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ opacity: 0;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .upload-box:hover {
|
|
|
+ i,
|
|
|
+ p {
|
|
|
+ color: #39a4ff !important;
|
|
|
+ }
|
|
|
+ border-color: #39a4ff;
|
|
|
+ }
|
|
|
+ .upload-list {
|
|
|
+ overflow: hidden;
|
|
|
+ .list-item {
|
|
|
+ margin-top: 10px;
|
|
|
+ .icon-paper-clip {
|
|
|
+ width: 14px;
|
|
|
+ font-size: 12px;
|
|
|
+ float: left;
|
|
|
+ padding-top: 3px;
|
|
|
+ }
|
|
|
+ p {
|
|
|
+ float: left;
|
|
|
+ width: calc(100% - 14px);
|
|
|
+ overflow: hidden;
|
|
|
+ .icon-guanbi {
|
|
|
+ display: block;
|
|
|
+ float: right;
|
|
|
+ font-size: 13px;
|
|
|
+ cursor: pointer;
|
|
|
+ &:hover {
|
|
|
+ color: rgb(248, 10, 157);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .footer-num {
|
|
|
+ position: relative;
|
|
|
+ top: 56px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|