diff --git a/src/api/index.ts b/src/api/index.ts index 920bcf3..5660d65 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,6 +1,6 @@ import router from '@/router'; import store from '@/store'; -import { LiveList, LoginData, UserInfo } from '@/types'; +import { LiveList, LoginData, UserInfo, VideoInfo } from '@/types'; import { saveValue } from '@/utils/common'; import { message } from 'ant-design-vue'; import { get, post, setToken } from './base' @@ -19,7 +19,7 @@ export async function loginpass(phone: string, password: string){ message.error(res.msg) }else{ console.log(res.data) - if(!saveValue("token", res.data?.api_token) && !saveValue("memberid", res.data?.memberid) ){ + if(!saveValue("token", res.data.api_token) && !saveValue("memberid", res.data.memberid) ){ message.error("存储错误, 请允许网页使用本地存储!") }else{ setToken(); @@ -35,30 +35,30 @@ export async function loginpass(phone: string, password: string){ */ export async function userinfo(){ const user = await get('personalInfo'); - // console.log(user.data?.img) + // console.log(user.data.img) if(user.code == 1001){ // router.push("/") return '未登录'; } return { - head: user.data?.img, - username: user.data?.name, - language: user.data?.language, - currency: user.data?.currency, - zoneStr: user.data?.zoneStr, - memberid: user.data?.memberid, - country: user.data?.country, - live: user.data?.live, - mtongue: user.data?.mtongue, - tlanguage: user.data?.tlanguage, - willsay: user.data?.willsay, - interest: user.data?.interest, - mobile: user.data?.mobile, - email: user.data?.email, - birthday: user.data?.birthday, - video: user.data?.video, - desc: user.data?.desc, - money: user.data?.money + head: user.data.img, + username: user.data.name, + language: user.data.language, + currency: user.data.currency, + zoneStr: user.data.zoneStr, + memberid: user.data.memberid, + country: user.data.country, + live: user.data.live, + mtongue: user.data.mtongue, + tlanguage: user.data.tlanguage, + willsay: user.data.willsay, + interest: user.data.interest, + mobile: user.data.mobile, + email: user.data.email, + birthday: user.data.birthday, + video: user.data.video, + desc: user.data.desc, + money: user.data.money } } @@ -123,9 +123,10 @@ interface VideoList{ statusname: string; } -export async function getvideolist() { +export async function getvideolist(): Promise { const res = await get>('video') console.log(res) + return res.data } /** @@ -134,7 +135,7 @@ export async function getvideolist() { -export async function getlivelist(data?:any) { +export async function getlivelist(data?:any):Promise { const res = await get>('live',data); // console.log(res); return res.data @@ -154,9 +155,9 @@ export async function getstatisticlist() { const res = await get('statistics'); // console.log(res) return { - liveInfo: res.data?.liveInfo, - videoInfo:res.data?.videoInfo, - studentInfo:res.data?.studentInfo + liveInfo: res.data.liveInfo, + videoInfo:res.data.videoInfo, + studentInfo:res.data.studentInfo } } @@ -170,6 +171,47 @@ interface Liveaddrule{ export async function liveadd(data:any) { const res = await post('live',data); console.log(res) + } + +/** + * 发布视频 + */ +export async function videoadd(data:any) { + const res=await post('video',data) +} + +/** + * 视频详情 + */ + +interface VideoDetail{ + videoid: number; + memberid: number; + title: string; + img: string; + fileid: string; + fileurl: string; + fileduration: string; + status: number; + desc: string; + deleted_at: null; + created_at: string; + updated_at: string; +} + +export async function videodetail(data?:any) { + const res=await get('video/'+data) + return res.data + +} + +/** + * 删除视频 + */ +export async function videodel(data:any) { + const res = await post('live',data); + console.log(res) + } } @@ -193,4 +235,4 @@ export async function sendsms(phone: string, type: number): Promise{ message.error(res.msg); return false; } -} \ No newline at end of file +} diff --git a/src/components/VideoItem.vue b/src/components/VideoItem.vue index 9ff5c2b..bd430de 100644 --- a/src/components/VideoItem.vue +++ b/src/components/VideoItem.vue @@ -1,34 +1,35 @@