2020-10-10 02:19:38 +00:00
|
|
|
|
import router from '@/router';
|
|
|
|
|
import store from '@/store';
|
2020-10-16 11:12:57 +00:00
|
|
|
|
import { LiveList, LivelistInfo, LoginData, UserInfo } from '@/types';
|
2020-10-10 02:19:38 +00:00
|
|
|
|
import { saveValue } from '@/utils/common';
|
|
|
|
|
import { message } from 'ant-design-vue';
|
2020-10-15 06:51:34 +00:00
|
|
|
|
import { del, get, post, put, setToken } from './base'
|
2020-09-24 07:33:12 +00:00
|
|
|
|
|
2020-10-09 01:45:13 +00:00
|
|
|
|
|
2020-10-10 00:59:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* 用户名密码登录
|
|
|
|
|
* @param phone 手机号
|
|
|
|
|
* @param password 密码
|
|
|
|
|
*/
|
|
|
|
|
|
2020-10-10 02:19:38 +00:00
|
|
|
|
export async function loginpass(phone: string, password: string){
|
|
|
|
|
const res = await post<LoginData>("login",{type: 2,username: phone, password: password});
|
|
|
|
|
console.log(res.code)
|
|
|
|
|
if(res.code == 1){
|
|
|
|
|
message.error(res.msg)
|
|
|
|
|
}else{
|
|
|
|
|
console.log(res.data)
|
2020-10-14 07:30:29 +00:00
|
|
|
|
if(!saveValue("token", res.data.api_token) && !saveValue("memberid", res.data.memberid) ){
|
2020-10-10 02:19:38 +00:00
|
|
|
|
message.error("存储错误, 请允许网页使用本地存储!")
|
|
|
|
|
}else{
|
|
|
|
|
setToken();
|
2020-10-14 01:32:12 +00:00
|
|
|
|
store.commit("login", true);
|
2020-10-10 06:34:23 +00:00
|
|
|
|
store.dispatch("setUserInfo");
|
2020-10-10 02:19:38 +00:00
|
|
|
|
router.push("/mine/archives")
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-10-09 06:31:10 +00:00
|
|
|
|
}
|
2020-10-10 00:59:54 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2020-10-10 02:19:38 +00:00
|
|
|
|
* 用户头像和用户名字
|
2020-10-10 00:59:54 +00:00
|
|
|
|
*/
|
2020-10-10 02:19:38 +00:00
|
|
|
|
export async function userinfo(){
|
|
|
|
|
const user = await get<UserInfo>('personalInfo');
|
2020-10-14 07:30:29 +00:00
|
|
|
|
// console.log(user.data.img)
|
2020-10-10 06:34:23 +00:00
|
|
|
|
if(user.code == 1001){
|
2020-10-15 01:21:00 +00:00
|
|
|
|
router.push("/")
|
2020-10-10 06:34:23 +00:00
|
|
|
|
return '未登录';
|
|
|
|
|
}
|
2020-10-16 11:12:57 +00:00
|
|
|
|
return user.data;
|
2020-10-10 02:19:38 +00:00
|
|
|
|
}
|
2020-10-12 02:50:58 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取用户绑定银行卡列表
|
|
|
|
|
*/
|
|
|
|
|
interface Wallect {
|
|
|
|
|
wallectid: number;
|
|
|
|
|
memberid: number;
|
|
|
|
|
type: number;
|
|
|
|
|
account: string;
|
|
|
|
|
mname: string;
|
|
|
|
|
bankcode: string;
|
|
|
|
|
bankname: string;
|
|
|
|
|
deleted_at: null;
|
|
|
|
|
created_at: string;
|
|
|
|
|
updated_at: string;
|
|
|
|
|
typeName: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getwallect(){
|
|
|
|
|
const res = await get<Array<Wallect>>('wallect')
|
|
|
|
|
console.log(res)
|
2020-10-15 12:12:21 +00:00
|
|
|
|
return res.data
|
2020-10-12 02:50:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 订阅者列表
|
|
|
|
|
*/
|
|
|
|
|
interface Teacherliked {
|
|
|
|
|
memberid: number;
|
|
|
|
|
name: string;
|
|
|
|
|
img: string;
|
|
|
|
|
live: string;
|
|
|
|
|
birthday: string;
|
|
|
|
|
mtongue: string;
|
|
|
|
|
interest: string;
|
|
|
|
|
|
|
|
|
|
}
|
2020-10-16 06:31:39 +00:00
|
|
|
|
export async function getteacherliked(data?:any){
|
|
|
|
|
const res = await get<Array<Teacherliked>>('teacherliked',data);
|
|
|
|
|
// console.log(res)
|
2020-10-16 06:52:21 +00:00
|
|
|
|
return res;
|
2020-10-12 02:50:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 视频列表
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
interface VideoList{
|
|
|
|
|
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;
|
|
|
|
|
statusname: string;
|
|
|
|
|
}
|
2020-10-16 11:12:57 +00:00
|
|
|
|
interface VideoListInfo {
|
|
|
|
|
data: VideoList[];
|
|
|
|
|
code: number;
|
|
|
|
|
msg: string;
|
|
|
|
|
total: number;
|
|
|
|
|
}
|
|
|
|
|
export async function getvideolist(data?:any): Promise<VideoListInfo>{
|
|
|
|
|
const res = await get<Array<VideoList>>('video',data)
|
2020-10-12 02:50:58 +00:00
|
|
|
|
console.log(res)
|
2020-10-16 11:12:57 +00:00
|
|
|
|
return res
|
2020-10-12 02:50:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 直播列表
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2020-10-14 00:57:57 +00:00
|
|
|
|
|
2020-10-16 01:34:55 +00:00
|
|
|
|
export async function getlivelist(data?:any):Promise<LivelistInfo> {
|
2020-10-14 00:57:57 +00:00
|
|
|
|
const res = await get<Array<LiveList>>('live',data);
|
2020-10-16 01:34:55 +00:00
|
|
|
|
console.log(res);
|
|
|
|
|
return res;
|
2020-10-12 09:27:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 列表统计
|
|
|
|
|
*/
|
|
|
|
|
|
2020-10-14 02:25:49 +00:00
|
|
|
|
interface StatisticList{
|
|
|
|
|
liveInfo: any;
|
|
|
|
|
videoInfo: any;
|
|
|
|
|
studentInfo: any;
|
|
|
|
|
}
|
2020-10-12 09:27:05 +00:00
|
|
|
|
|
|
|
|
|
export async function getstatisticlist() {
|
|
|
|
|
const res = await get<StatisticList>('statistics');
|
|
|
|
|
// console.log(res)
|
|
|
|
|
return {
|
2020-10-14 07:30:29 +00:00
|
|
|
|
liveInfo: res.data.liveInfo,
|
|
|
|
|
videoInfo:res.data.videoInfo,
|
|
|
|
|
studentInfo:res.data.studentInfo
|
2020-10-12 09:27:05 +00:00
|
|
|
|
}
|
2020-10-14 00:57:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发布直播
|
|
|
|
|
*/
|
|
|
|
|
interface Liveaddrule{
|
2020-10-15 06:51:34 +00:00
|
|
|
|
code: number,
|
|
|
|
|
msg: string
|
2020-10-14 02:25:49 +00:00
|
|
|
|
}
|
|
|
|
|
export async function liveadd(data:any) {
|
2020-10-14 00:57:57 +00:00
|
|
|
|
const res = await post<Liveaddrule>('live',data);
|
|
|
|
|
console.log(res)
|
2020-10-14 07:30:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发布视频
|
|
|
|
|
*/
|
2020-10-15 08:17:39 +00:00
|
|
|
|
export async function videoadd( form: any,data: any) {
|
2020-10-14 07:30:29 +00:00
|
|
|
|
const res=await post<Liveaddrule>('video',data)
|
2020-10-14 10:52:50 +00:00
|
|
|
|
if(res.code==0){
|
|
|
|
|
message.success("发布成功")
|
2020-10-15 08:17:39 +00:00
|
|
|
|
form.value = {
|
|
|
|
|
title: "",
|
|
|
|
|
img: "",
|
|
|
|
|
fileid: "",
|
|
|
|
|
fileurl: "",
|
|
|
|
|
fileduration: "",
|
|
|
|
|
desc: "",
|
|
|
|
|
video:[""],
|
|
|
|
|
}
|
2020-10-14 10:52:50 +00:00
|
|
|
|
}
|
2020-10-14 07:30:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 视频详情
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
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;
|
2020-10-14 08:27:24 +00:00
|
|
|
|
share:number,
|
|
|
|
|
watch:number
|
2020-10-14 07:30:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-14 10:52:50 +00:00
|
|
|
|
export async function videodetail(data?:any,ifupdate?:number) {
|
2020-10-14 07:30:29 +00:00
|
|
|
|
const res=await get<VideoDetail>('video/'+data)
|
2020-10-14 10:52:50 +00:00
|
|
|
|
if(ifupdate){
|
|
|
|
|
console.log(111)
|
|
|
|
|
return{
|
|
|
|
|
title: res.data.title,
|
|
|
|
|
img: res.data.img,
|
|
|
|
|
fileid: res.data.fileid,
|
|
|
|
|
fileurl: res.data.fileurl,
|
|
|
|
|
fileduration: res.data.fileduration,
|
|
|
|
|
desc:res.data.desc,
|
|
|
|
|
video:[res.data.fileurl],
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
return {
|
|
|
|
|
videoid: res.data.videoid,
|
|
|
|
|
memberid: res.data.memberid,
|
|
|
|
|
title: res.data.title,
|
|
|
|
|
img: res.data.img,
|
|
|
|
|
fileid: res.data.fileid,
|
|
|
|
|
fileurl: res.data.fileurl,
|
|
|
|
|
fileduration: res.data.fileduration,
|
|
|
|
|
status: res.data.status,
|
|
|
|
|
desc: res.data.desc,
|
|
|
|
|
deleted_at: res.data.deleted_at,
|
|
|
|
|
created_at: res.data.created_at,
|
|
|
|
|
updated_at: res.data.updated_at,
|
|
|
|
|
watch:res.data.watch,
|
|
|
|
|
share:res.data.share
|
|
|
|
|
}
|
2020-10-14 08:27:24 +00:00
|
|
|
|
}
|
2020-10-14 10:52:50 +00:00
|
|
|
|
|
2020-10-14 07:30:29 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-14 08:27:24 +00:00
|
|
|
|
|
|
|
|
|
|
2020-10-14 07:30:29 +00:00
|
|
|
|
/**
|
|
|
|
|
* 删除视频
|
|
|
|
|
*/
|
|
|
|
|
export async function videodel(data:any) {
|
2020-10-14 10:52:50 +00:00
|
|
|
|
const res = await del<Liveaddrule>('video/'+data);
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
message.success("删除成功")
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-14 07:30:29 +00:00
|
|
|
|
console.log(res)
|
2020-10-14 02:25:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-15 07:44:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* 新增账户
|
|
|
|
|
*/
|
|
|
|
|
export async function accountadd(data?:any) {
|
|
|
|
|
const res = await post<Liveaddrule>('wallect',data);
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
message.success("新增成功")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface SaleInfo{
|
|
|
|
|
total:number,
|
|
|
|
|
accountid:number,
|
|
|
|
|
memberid:number,
|
|
|
|
|
sn:string,
|
|
|
|
|
type:number,
|
|
|
|
|
typename:string,
|
|
|
|
|
money:string,
|
|
|
|
|
source:number,
|
|
|
|
|
remark:string,
|
|
|
|
|
deleted_at:string,
|
|
|
|
|
created_at:string,
|
|
|
|
|
updated_at:string,
|
|
|
|
|
basemoney:string
|
|
|
|
|
}
|
2020-10-19 07:59:19 +00:00
|
|
|
|
interface SaleInfolData{
|
|
|
|
|
data: SaleInfo[];
|
|
|
|
|
code: number;
|
|
|
|
|
msg: string;
|
|
|
|
|
total: number;
|
|
|
|
|
}
|
2020-10-15 07:44:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* 交易明细
|
|
|
|
|
* @param data
|
|
|
|
|
*/
|
2020-10-19 07:59:19 +00:00
|
|
|
|
|
2020-10-15 07:44:50 +00:00
|
|
|
|
export async function saleinfo(data?:any){
|
2020-10-19 07:59:19 +00:00
|
|
|
|
const res=await get<SaleInfolData>('account',data)
|
2020-10-15 07:44:50 +00:00
|
|
|
|
console.log(res)
|
2020-10-19 07:59:19 +00:00
|
|
|
|
return res
|
2020-10-15 07:44:50 +00:00
|
|
|
|
}
|
2020-10-14 02:25:49 +00:00
|
|
|
|
|
2020-10-15 07:44:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* 申请提现
|
|
|
|
|
*/
|
2020-10-16 06:31:39 +00:00
|
|
|
|
export async function cashout(data?:any,accountinfo?:any){
|
|
|
|
|
|
|
|
|
|
// data.type=data.typeid?data.typeid:0
|
|
|
|
|
// if(data.type!=0){
|
|
|
|
|
// delete data.typeid
|
|
|
|
|
// }
|
|
|
|
|
data.type=accountinfo.type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(data,'tixian')
|
|
|
|
|
console.log(accountinfo)
|
|
|
|
|
data.account=accountinfo.account
|
|
|
|
|
data.bankcode=accountinfo.bankcode
|
|
|
|
|
data.bankname=accountinfo.bankname
|
|
|
|
|
data.mname=accountinfo.mname
|
|
|
|
|
console.log(data)
|
2020-10-15 07:44:50 +00:00
|
|
|
|
const res = await post<Liveaddrule>('withdrawal',data);
|
|
|
|
|
if(res.code==0){
|
2020-10-19 01:10:38 +00:00
|
|
|
|
message.success(res.msg)
|
2020-10-19 07:59:19 +00:00
|
|
|
|
// userinfo()
|
|
|
|
|
store.dispatch("setUserInfo");
|
2020-10-16 06:31:39 +00:00
|
|
|
|
}else{
|
|
|
|
|
message.error(res.msg)
|
2020-10-15 07:44:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-10-15 12:12:21 +00:00
|
|
|
|
/**
|
|
|
|
|
* 账户详情
|
|
|
|
|
*/
|
|
|
|
|
interface AccountInfo{
|
|
|
|
|
wallectid:number,
|
|
|
|
|
typeid:number,
|
|
|
|
|
type:number,
|
|
|
|
|
account:number,
|
|
|
|
|
mname:string,
|
|
|
|
|
bankcode:string,
|
|
|
|
|
bankname:string
|
|
|
|
|
}
|
|
|
|
|
export async function getaccountinfo(data?: any){
|
|
|
|
|
const res=await get<AccountInfo>('wallect/'+data)
|
|
|
|
|
console.log(res,2333)
|
|
|
|
|
return {
|
|
|
|
|
accountid:res.data.wallectid,
|
|
|
|
|
type:res.data.type,
|
|
|
|
|
account:res.data.account,
|
|
|
|
|
mname:res.data.mname,
|
|
|
|
|
bankcode:res.data.bankcode,
|
|
|
|
|
bankname:res.data.bankname
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-10-14 02:25:49 +00:00
|
|
|
|
|
2020-10-15 12:12:21 +00:00
|
|
|
|
/**
|
|
|
|
|
* 账户编辑
|
|
|
|
|
*/
|
|
|
|
|
export async function editaccount(data?:any){
|
|
|
|
|
const res=await put<Liveaddrule>('wallect/'+data);
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
message.success("修改成功")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 删除账户
|
|
|
|
|
*/
|
|
|
|
|
export async function deleteaccount(data:any) {
|
|
|
|
|
|
|
|
|
|
const res = await del<Liveaddrule>('wallect/'+data);
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
message.success("删除成功")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
}
|
2020-10-16 06:31:39 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
2020-10-16 11:12:57 +00:00
|
|
|
|
* 交易明细 详情
|
2020-10-16 06:31:39 +00:00
|
|
|
|
*/
|
|
|
|
|
interface TransactionInfo{
|
|
|
|
|
accountid:number,
|
|
|
|
|
memberid:number,
|
|
|
|
|
sn:string,
|
|
|
|
|
type:number,
|
|
|
|
|
typename:string,
|
|
|
|
|
money:number,
|
|
|
|
|
source:number,
|
|
|
|
|
remark:string,
|
|
|
|
|
deleted_at:any,
|
|
|
|
|
created_at:string,
|
|
|
|
|
updated_at:string
|
|
|
|
|
}
|
|
|
|
|
export async function transactioninfo(data?: any){
|
|
|
|
|
const res = await get<TransactionInfo>('account/'+data)
|
|
|
|
|
// console.log(res)
|
|
|
|
|
return res.data
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-16 11:12:57 +00:00
|
|
|
|
/**
|
|
|
|
|
* 修改密码
|
|
|
|
|
*/
|
|
|
|
|
export async function editpassword(data?:any) :Promise<void> {
|
|
|
|
|
console.log(data,111)
|
|
|
|
|
const newdata={
|
|
|
|
|
memberid:0,
|
|
|
|
|
password:"",
|
|
|
|
|
topassword:""
|
|
|
|
|
}
|
|
|
|
|
newdata.memberid=store.state.userinfo.memberid
|
|
|
|
|
newdata.password=data.password
|
|
|
|
|
newdata.topassword=data.topassword
|
|
|
|
|
console.log(newdata)
|
|
|
|
|
const res = await post<Liveaddrule>('resetPassword',newdata)
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
message.success("修改成功")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-19 07:59:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* 提现记录 列表
|
|
|
|
|
*/
|
|
|
|
|
interface WithDrawal{
|
|
|
|
|
withdrawalid:number,
|
|
|
|
|
memberid:number,
|
|
|
|
|
sn:string,
|
|
|
|
|
status:number,
|
|
|
|
|
statusname:string,
|
|
|
|
|
type:number,
|
|
|
|
|
typename:string,
|
|
|
|
|
money:number
|
|
|
|
|
sxf:number,
|
|
|
|
|
international:number,
|
|
|
|
|
account:string,
|
|
|
|
|
mname:string,
|
|
|
|
|
bankcode:string,
|
|
|
|
|
bankname:string,
|
|
|
|
|
remark:string,
|
|
|
|
|
deleted_at:string,
|
|
|
|
|
created_at:string,
|
|
|
|
|
updated_at:string
|
|
|
|
|
}
|
|
|
|
|
interface WithdrawlData{
|
|
|
|
|
data: WithDrawal[];
|
|
|
|
|
code: number;
|
|
|
|
|
msg: string;
|
|
|
|
|
total: number;
|
|
|
|
|
}
|
|
|
|
|
export async function withdrawal(data?:any) {
|
|
|
|
|
console.log(data)
|
|
|
|
|
const res=await get<WithdrawlData>('withdrawal',data)
|
|
|
|
|
// console.log(res)
|
|
|
|
|
return res
|
|
|
|
|
}
|
2020-10-16 11:12:57 +00:00
|
|
|
|
|
2020-10-19 07:59:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* 提现记录 详情
|
|
|
|
|
*/
|
|
|
|
|
export async function withdrawlxq(data?:any){
|
|
|
|
|
const res=await get<WithDrawal>('withdrawal/'+data)
|
|
|
|
|
return res.data
|
|
|
|
|
}
|
2020-10-16 11:12:57 +00:00
|
|
|
|
|
2020-10-19 07:59:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* 评论(视频?)
|
|
|
|
|
*/
|
|
|
|
|
interface CommentList{
|
|
|
|
|
commentid:number,
|
|
|
|
|
memberid:number,
|
|
|
|
|
cid:number,
|
|
|
|
|
type:number,
|
|
|
|
|
score:number,
|
|
|
|
|
content:string,
|
|
|
|
|
deleted_at:null,
|
|
|
|
|
created_at:string,
|
|
|
|
|
updated_at:string,
|
|
|
|
|
name:string,
|
|
|
|
|
img:string
|
|
|
|
|
}
|
|
|
|
|
interface CommentlData{
|
|
|
|
|
data: CommentList[];
|
|
|
|
|
code: number;
|
|
|
|
|
msg: string;
|
|
|
|
|
total: number;
|
|
|
|
|
}
|
|
|
|
|
export async function getcommentlist(data?:any) {
|
|
|
|
|
const res=await get<CommentlData>('comments',data)
|
|
|
|
|
return res
|
|
|
|
|
}
|
2020-10-19 09:48:56 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发布评论
|
|
|
|
|
*/
|
|
|
|
|
interface SendData{
|
|
|
|
|
type?:number,
|
|
|
|
|
cid?:number,
|
|
|
|
|
teacherid?:number,
|
|
|
|
|
score?:number,
|
|
|
|
|
content?:string
|
|
|
|
|
}
|
|
|
|
|
export async function addcomment(data?:any):Promise<void> {
|
|
|
|
|
const res=await post<SendData>('comments',data)
|
|
|
|
|
|
|
|
|
|
}
|
2020-10-14 02:25:49 +00:00
|
|
|
|
/**
|
|
|
|
|
* 发送验证码
|
|
|
|
|
* @param phone 手机号
|
|
|
|
|
* @param type 国外1 国内0
|
|
|
|
|
*/
|
|
|
|
|
interface SendSms{
|
|
|
|
|
code: number;
|
|
|
|
|
msg: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function sendsms(phone: string, type: number): Promise<boolean>{
|
|
|
|
|
const res = await post<SendSms>("SendSms", {phone, type});
|
|
|
|
|
console.log(res);
|
|
|
|
|
if(res.code == 0){
|
|
|
|
|
message.success(res.msg);
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
message.error(res.msg);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2020-10-14 07:31:24 +00:00
|
|
|
|
}
|
2020-10-14 08:21:40 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2020-10-14 10:55:15 +00:00
|
|
|
|
* 获取国家与语言数据
|
2020-10-14 08:21:40 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
interface Countries{
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
country_code: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface Willsay{
|
|
|
|
|
languageid: number;
|
|
|
|
|
name: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getarchives(): Promise<[Countries[],Willsay[]]>{
|
|
|
|
|
return [(await get<Countries[]>("countries")).data, (await get<Willsay[]>("willsay")).data];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-10-14 10:55:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* 客户端语言
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
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;
|
2020-10-15 06:51:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改我的档案
|
|
|
|
|
*/
|
|
|
|
|
|
2020-10-16 11:12:57 +00:00
|
|
|
|
// export async function putmember(data: unknown): Promise<Liveaddrule>{
|
|
|
|
|
|
|
|
|
|
export async function putmember(data: any): Promise<any>{
|
2020-10-17 09:31:25 +00:00
|
|
|
|
|
|
|
|
|
data.interest={}
|
2020-10-16 11:12:57 +00:00
|
|
|
|
console.log(data)
|
2020-10-17 09:31:25 +00:00
|
|
|
|
for(let i=0;i<data.willsayValue.length;i++){
|
|
|
|
|
data.willsayValue[i].level=data.willsayValue[i].level+''
|
|
|
|
|
}
|
2020-10-16 11:12:57 +00:00
|
|
|
|
const newdata={
|
|
|
|
|
name:data.name,
|
|
|
|
|
mobile:data.mobile,
|
|
|
|
|
img:data.img,
|
|
|
|
|
country:data.countryValue,
|
|
|
|
|
live:data.live,
|
|
|
|
|
mtongue:data.mtongue,
|
|
|
|
|
email:data.email,
|
|
|
|
|
interest:JSON.stringify(data.interest),
|
|
|
|
|
willsay:JSON.stringify(data.willsayValue),
|
|
|
|
|
birthday:data.birthday,
|
|
|
|
|
zoneid:data.zoneid,
|
|
|
|
|
currency:data.currencyValue,
|
|
|
|
|
language:data.languageValue,
|
|
|
|
|
tlanguage:data.tlanguageValue,
|
|
|
|
|
video:data.video,
|
|
|
|
|
desc:data.desc
|
|
|
|
|
}
|
|
|
|
|
console.log(newdata)
|
|
|
|
|
return (await put<Liveaddrule>(`member/${store.state.userinfo.memberid}`, newdata) )
|
2020-10-17 09:31:25 +00:00
|
|
|
|
store.dispatch("setUserInfo");
|
2020-10-15 11:06:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 直播详情
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
interface LiveInfo {
|
|
|
|
|
liveid: number;
|
|
|
|
|
title: string;
|
|
|
|
|
img: string;
|
|
|
|
|
fileid: string;
|
|
|
|
|
fileurl: string;
|
|
|
|
|
fileduration: string;
|
|
|
|
|
vodid: string;
|
|
|
|
|
vodurl: string;
|
|
|
|
|
vodduration: string;
|
|
|
|
|
dateline: string;
|
|
|
|
|
livetime: number;
|
|
|
|
|
livenumber: number;
|
|
|
|
|
status: number;
|
|
|
|
|
desc: string;
|
|
|
|
|
deleted_at: null;
|
|
|
|
|
created_at: string;
|
|
|
|
|
updated_at: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface StudentList {
|
|
|
|
|
memberid: number;
|
|
|
|
|
name: string;
|
|
|
|
|
img: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getliveinfo(id: number){
|
|
|
|
|
const liveinfo = (await get<LiveInfo>(`live/${id}`)).data;
|
|
|
|
|
const studentlist = (await get<StudentList[]>("studentLive",{id})).data;
|
|
|
|
|
return {...liveinfo,studentlist}
|
2020-10-16 00:59:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 直播日历
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-16 06:47:35 +00:00
|
|
|
|
export async function getdatelist(start: string, end: string, teacherid: number) {
|
|
|
|
|
return (await get("teacherCalendar",{start, end, teacherid})).data
|
2020-10-16 00:59:17 +00:00
|
|
|
|
}
|
2020-10-16 02:47:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 取消直播
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
export async function cancellive(id: number, status: number){
|
|
|
|
|
const res = await post("cancelLive",{id, status})
|
|
|
|
|
if(res.code == 0){
|
|
|
|
|
message.success(res.msg);
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
message.error(res.msg);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|