上传文件
This commit is contained in:
parent
b41672ce8b
commit
ffe57d9938
@ -11,6 +11,7 @@ export interface Get {
|
||||
}
|
||||
|
||||
axios.interceptors.response.use((response)=>{
|
||||
console.log(response)
|
||||
if(response.data.code == 1001){
|
||||
router.push("/")
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ export async function sendsms(phone: string, type: number): Promise<boolean>{
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取国家数据
|
||||
* 获取国家与语言数据
|
||||
*/
|
||||
|
||||
interface Countries{
|
||||
@ -256,3 +256,24 @@ export async function getarchives(): Promise<[Countries[],Willsay[]]>{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 客户端语言
|
||||
*/
|
||||
|
||||
interface Language {
|
||||
dictionaryid: number;
|
||||
name: string;
|
||||
alias: string;
|
||||
code :string;
|
||||
position: number;
|
||||
publish: number;
|
||||
value: string;
|
||||
deleted_at: null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export async function getlanguages(): Promise<Language[]>{
|
||||
|
||||
return (await get<Language[]>("languages")).data;
|
||||
}
|
@ -94,9 +94,19 @@
|
||||
<a-upload
|
||||
list-type="picture"
|
||||
:customRequest="uploads"
|
||||
:beforeUpload="beforeVideoUpload"
|
||||
>
|
||||
<div class="upload-image">
|
||||
<PlaySquareOutlined style="fontSize: 22px;" />
|
||||
<PlaySquareOutlined
|
||||
style="fontsize: 22px"
|
||||
v-if="uploadprogress == 0"
|
||||
/>
|
||||
<a-progress
|
||||
type="circle"
|
||||
:percent="uploadprogress"
|
||||
:width="80"
|
||||
v-else
|
||||
/>
|
||||
</div>
|
||||
</a-upload>
|
||||
<div class="demand">
|
||||
@ -171,8 +181,8 @@
|
||||
ref="select"
|
||||
:getPopupContainer="triggerNode => triggerNode.parentNode"
|
||||
>
|
||||
<a-select-option v-for="(item, index) in ['英语', '中文']" :key="index" :value="item">
|
||||
{{ item }}
|
||||
<a-select-option v-for="(item, index) in languages" :key="index" :value="item.name">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
@ -266,7 +276,7 @@ import { uploadflie } from "@/utils/vod"
|
||||
import store from '@/store';
|
||||
import smile from "@/static/images/smile.png"
|
||||
import smilet from "@/static/images/smilet.png"
|
||||
import { getarchives } from "@/api/index"
|
||||
import { getarchives, getlanguages } from "@/api/index"
|
||||
|
||||
export default defineComponent({
|
||||
name: "Archives",
|
||||
@ -291,8 +301,10 @@ export default defineComponent({
|
||||
const modalNode = () => document.getElementsByClassName('modal-container')[0]
|
||||
|
||||
const chiveslist = ref<unknown>([[],[]]);
|
||||
const languages = ref<unknown>([])
|
||||
onMounted(async ()=>{
|
||||
chiveslist.value = await getarchives()
|
||||
languages.value = await getlanguages()
|
||||
})
|
||||
|
||||
/**
|
||||
@ -423,17 +435,8 @@ export default defineComponent({
|
||||
console.log('12');
|
||||
|
||||
}
|
||||
interface AntUpload{
|
||||
action: string;
|
||||
data: unknown;
|
||||
file: File;
|
||||
}
|
||||
async function uploads(file: AntUpload){
|
||||
let res = await uploadflie(file.file, (info) => {
|
||||
console.log(info)
|
||||
});
|
||||
console.log(res)
|
||||
}
|
||||
|
||||
|
||||
// uploadflie()3.
|
||||
|
||||
function setlevel(index: number, level: number){
|
||||
@ -441,6 +444,27 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传视频
|
||||
*/
|
||||
interface AntUpload{
|
||||
action: string;
|
||||
data: unknown;
|
||||
file: File;
|
||||
}
|
||||
const uploadprogress: Ref<number> = ref(0);
|
||||
async function uploads(file: AntUpload) {
|
||||
uploadprogress.value=0
|
||||
|
||||
let res = await uploadflie(file.file, (info: any) => {
|
||||
console.log(info);
|
||||
uploadprogress.value = info.percent.toFixed(2) * 100;
|
||||
});
|
||||
userinfo.value.video = res.video.url;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return {
|
||||
modalNode,
|
||||
formData,
|
||||
@ -467,7 +491,9 @@ export default defineComponent({
|
||||
smile,
|
||||
smilet,
|
||||
setlevel,
|
||||
chiveslist
|
||||
chiveslist,
|
||||
languages,
|
||||
uploadprogress
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -749,5 +775,8 @@ export default defineComponent({
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
::v-deep(.ant-upload-list) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -64,18 +64,18 @@
|
||||
<!-- 文件列表 -->
|
||||
<div v-if="form.video[0].length">
|
||||
<div
|
||||
v-for="(item, index) in form.video"
|
||||
:key="index"
|
||||
class="video-list"
|
||||
>
|
||||
<img src="@/static/images/link.png" class="link" />
|
||||
<span class="one-line-hide">{{ item.split('/')[item.split('/').length-1] }}</span>
|
||||
<img
|
||||
src="@/static/images/delete.png"
|
||||
@click="removeFile(0)"
|
||||
class="del"
|
||||
/>
|
||||
</div>
|
||||
v-for="(item, index) in form.video"
|
||||
:key="index"
|
||||
class="video-list"
|
||||
>
|
||||
<img src="@/static/images/link.png" class="link" />
|
||||
<span class="one-line-hide">{{ item.split('/')[item.split('/').length-1] }}</span>
|
||||
<img
|
||||
src="@/static/images/delete.png"
|
||||
@click="removeFile(0)"
|
||||
class="del"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demand">
|
||||
|
Loading…
Reference in New Issue
Block a user