xbx #24
20
src/types/index.d.ts
vendored
Normal file
20
src/types/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 只添加了一些必要的参数,并没有写完整,因为剩下的大部分用不到
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// 图片选择
|
||||||
|
export interface ImgInfo {
|
||||||
|
file: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单提交的验证
|
||||||
|
export interface FromSend {
|
||||||
|
preventDefault: Function;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 视频文件
|
||||||
|
export interface VideoInfo {
|
||||||
|
type: string;
|
||||||
|
name: string;
|
||||||
|
}
|
@ -53,6 +53,7 @@ import { defineComponent, reactive, Ref, ref } from 'vue';
|
|||||||
import { PlaySquareOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
import { PlaySquareOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
||||||
import NavBottom from '@/components/NavBottom.vue';
|
import NavBottom from '@/components/NavBottom.vue';
|
||||||
import { previewCover } from '@/static/js/common';
|
import { previewCover } from '@/static/js/common';
|
||||||
|
import { ImgInfo } from '@/types';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ReleaseWebcast',
|
name: 'ReleaseWebcast',
|
||||||
@ -81,7 +82,7 @@ export default defineComponent({
|
|||||||
/**
|
/**
|
||||||
* 封面改变触发事件
|
* 封面改变触发事件
|
||||||
*/
|
*/
|
||||||
function coverChange(info: any): void {
|
function coverChange(info: ImgInfo): void {
|
||||||
// console.log(info);
|
// console.log(info);
|
||||||
// 获取预览图片
|
// 获取预览图片
|
||||||
previewCover(info.file).then(url => previewImage.value = url);
|
previewCover(info.file).then(url => previewImage.value = url);
|
||||||
@ -108,7 +109,7 @@ export default defineComponent({
|
|||||||
/**
|
/**
|
||||||
* 删除封面
|
* 删除封面
|
||||||
*/
|
*/
|
||||||
function cancelCover(file: any): void {
|
function cancelCover(file: number): void {
|
||||||
console.log(file);
|
console.log(file);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -117,7 +118,7 @@ export default defineComponent({
|
|||||||
* @param file 上传的文件
|
* @param file 上传的文件
|
||||||
*/
|
*/
|
||||||
const beforeVideoUpload = (file: any): boolean => {
|
const beforeVideoUpload = (file: any): boolean => {
|
||||||
// console.log(file);
|
console.log(file);
|
||||||
if(file.type != '') {
|
if(file.type != '') {
|
||||||
// handleRemove(file);
|
// handleRemove(file);
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ import { useForm } from '@ant-design-vue/use';
|
|||||||
import NavBottom from '@/components/NavBottom.vue';
|
import NavBottom from '@/components/NavBottom.vue';
|
||||||
import RankList from './RankList.vue';
|
import RankList from './RankList.vue';
|
||||||
import { previewCover } from '@/static/js/common';
|
import { previewCover } from '@/static/js/common';
|
||||||
|
import { FromSend, ImgInfo } from "@/types/index"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ReleaseWebcast',
|
name: 'ReleaseWebcast',
|
||||||
@ -144,13 +145,14 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 是否显示封面预览 封面的路径
|
// 是否显示封面预览 封面的路径
|
||||||
const viewCover: Ref<boolean> = ref(false),
|
const viewCover: Ref<boolean> = ref(false);
|
||||||
previewImage: Ref<string> = ref('');
|
const previewImage: Ref<string> = ref('');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 封面改变触发事件
|
* 封面改变触发事件
|
||||||
*/
|
*/
|
||||||
function coverChange(info: any): void {
|
|
||||||
|
function coverChange(info: ImgInfo): void {
|
||||||
// console.log(info);
|
// console.log(info);
|
||||||
// 获取预览图片
|
// 获取预览图片
|
||||||
previewCover(info.file).then(url => previewImage.value = url);
|
previewCover(info.file).then(url => previewImage.value = url);
|
||||||
@ -162,7 +164,8 @@ export default defineComponent({
|
|||||||
/**
|
/**
|
||||||
* 表单提交
|
* 表单提交
|
||||||
*/
|
*/
|
||||||
const onSubmit = (e: any) => {
|
|
||||||
|
const onSubmit = (e: FromSend) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
validate().then(() => {
|
validate().then(() => {
|
||||||
console.log(toRaw(form));
|
console.log(toRaw(form));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user