上传文件
This commit is contained in:
parent
b41672ce8b
commit
ffe57d9938
@ -11,6 +11,7 @@ export interface Get {
|
|||||||
}
|
}
|
||||||
|
|
||||||
axios.interceptors.response.use((response)=>{
|
axios.interceptors.response.use((response)=>{
|
||||||
|
console.log(response)
|
||||||
if(response.data.code == 1001){
|
if(response.data.code == 1001){
|
||||||
router.push("/")
|
router.push("/")
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ export async function sendsms(phone: string, type: number): Promise<boolean>{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取国家数据
|
* 获取国家与语言数据
|
||||||
*/
|
*/
|
||||||
|
|
||||||
interface Countries{
|
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
|
<a-upload
|
||||||
list-type="picture"
|
list-type="picture"
|
||||||
:customRequest="uploads"
|
:customRequest="uploads"
|
||||||
|
:beforeUpload="beforeVideoUpload"
|
||||||
>
|
>
|
||||||
<div class="upload-image">
|
<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>
|
</div>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
<div class="demand">
|
<div class="demand">
|
||||||
@ -171,8 +181,8 @@
|
|||||||
ref="select"
|
ref="select"
|
||||||
:getPopupContainer="triggerNode => triggerNode.parentNode"
|
:getPopupContainer="triggerNode => triggerNode.parentNode"
|
||||||
>
|
>
|
||||||
<a-select-option v-for="(item, index) in ['英语', '中文']" :key="index" :value="item">
|
<a-select-option v-for="(item, index) in languages" :key="index" :value="item.name">
|
||||||
{{ item }}
|
{{ item.name }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</div>
|
</div>
|
||||||
@ -266,7 +276,7 @@ import { uploadflie } from "@/utils/vod"
|
|||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
import smile from "@/static/images/smile.png"
|
import smile from "@/static/images/smile.png"
|
||||||
import smilet from "@/static/images/smilet.png"
|
import smilet from "@/static/images/smilet.png"
|
||||||
import { getarchives } from "@/api/index"
|
import { getarchives, getlanguages } from "@/api/index"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "Archives",
|
name: "Archives",
|
||||||
@ -291,8 +301,10 @@ export default defineComponent({
|
|||||||
const modalNode = () => document.getElementsByClassName('modal-container')[0]
|
const modalNode = () => document.getElementsByClassName('modal-container')[0]
|
||||||
|
|
||||||
const chiveslist = ref<unknown>([[],[]]);
|
const chiveslist = ref<unknown>([[],[]]);
|
||||||
|
const languages = ref<unknown>([])
|
||||||
onMounted(async ()=>{
|
onMounted(async ()=>{
|
||||||
chiveslist.value = await getarchives()
|
chiveslist.value = await getarchives()
|
||||||
|
languages.value = await getlanguages()
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -423,17 +435,8 @@ export default defineComponent({
|
|||||||
console.log('12');
|
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.
|
// uploadflie()3.
|
||||||
|
|
||||||
function setlevel(index: number, level: number){
|
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 {
|
return {
|
||||||
modalNode,
|
modalNode,
|
||||||
formData,
|
formData,
|
||||||
@ -467,7 +491,9 @@ export default defineComponent({
|
|||||||
smile,
|
smile,
|
||||||
smilet,
|
smilet,
|
||||||
setlevel,
|
setlevel,
|
||||||
chiveslist
|
chiveslist,
|
||||||
|
languages,
|
||||||
|
uploadprogress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -749,5 +775,8 @@ export default defineComponent({
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
::v-deep(.ant-upload-list) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue
Block a user