2 lines
9.4 KiB
JavaScript
2 lines
9.4 KiB
JavaScript
|
var e=Object.defineProperty,l=(l,a,t)=>(((l,a,t)=>{a in l?e(l,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[a]=t})(l,"symbol"!=typeof a?a+"":a,t),t);import{g as a,r as t,h as s,k as i,p as o,c as r,w as c,i as d,o as u,b as n,e as f,a as m,q as p,F as _,z as b,u as h,A as v,f as y,aj as g,I as k,an as w,S as C,y as x,E as U,x as I}from"./index-CH9-aFWw.js";import{_ as V}from"./uni-icons.DST64Pwo.js";import{o as j,r as N}from"./uni-app.es.DPi2kvld.js";import{_ as z}from"./uni-popup.ICCw_VFK.js";import{_ as E}from"./_plugin-vue_export-helper.BCo6x5W8.js";/* empty css */const D=E({__name:"video",setup(e){const E=a(new class{constructor(){l(this,"videoId",""),l(this,"videoUrl",""),l(this,"imageUrl",""),l(this,"title",""),l(this,"content",""),l(this,"talk",""),l(this,"subscriber",""),l(this,"locationName",""),l(this,"location",""),l(this,"productUrl",""),l(this,"productId",""),l(this,"showTime",""),l(this,"oneself",0),l(this,"isDraft",""),l(this,"type","")}});let D=a([]);const B=t(""),S=a([]),q=a({data:[],pageNum:1,pageSize:20,total:0}),P=a([]),L=t("");function R(){s.upload_image({value:E.imageUrl,type:1,success:e=>{E.imageUrl=e.value}})}function F(){s.upload_video({success:e=>{E.videoUrl=e.value}})}function $(){return new Promise(((e,l)=>{i.video.getLabel({query:{parentId:0,search:B.value}}).then((l=>{if(200==l.code){const a=l.data;return D.length=0,D.push(...a),e(D),void(!a[0]&&B.value&&s.alert({content:`当前没有${B.value}的话题,是否添加?`}).then((e=>{e.confirm&&i.video.setLabel({data:{parentId:0,name:B.value}}).then((e=>{200!=e.code?s.alert({content:e.msg,showCancel:!1}):$()}))})))}s.alert({content:l.msg,showCancel:!1})}))}))}function T(e,l){S.splice(l,1)}function A(){q.data.length>=q.total||(q.pageNum++,O())}function O(){return new Promise(((e,l)=>{i.video.searchFriendByName({path:[L.value],query:{pageNum:q.pageNum,pageSize:q.pageSize}}).then((l=>{if(200==l.code)return q.pageNum&&(q.data.length=0),q.data.push(...l.rows),q.total=l.total,void e(q.data);s.alert({content:l.msg,showCancel:!1})}))}))}function G(e){const l={...E};let a="publishVideo";if(E.videoId&&(a="updateVideo"),l.isDraft=e||0,l.videoUrl)if(l.imageUrl){if(0==l.isDraft){if(!l.title)return void s.alert("标题不能为空");if(!l.content)return void s.alert("正文不能为空")}S[0]&&(l.talkId=S.map((e=>e.id)).join(","),l.talk=S.map((e=>e.name)).join(",")),P[0]&&(l.subscriberId=P.map((e=>e.userId)).join(","),l.subscriber=P.map((e=>e.userNickname)).join(",")),l.videoUrl=s.replace_url(l.videoUrl),l.imageUrl=s.replace_url(l.imageUrl),i.video[a]({data:l}).then((e=>{200!=e.code?s.alert({content:e.msg,showCancel:!1}):s.alert({content:0==l.isDraft?"视频发布成功,请等待后台审核":"保存草稿成功",showCancel:!1,confirmText:"我知道了"}).then((e=>{v()}))}))}else s.alert("封面不能为空");else s.alert("视频不能为空")}return j((e=>{e.videoId?(E.videoId=e.videoId,Promise.all([new Promise(((e,l)=>{i.video.getVideoById({query:{videoId:E.videoId}}).then((l=>{200!=l.code?s.alert({content:l.msg,showCancel:!1}):e(l.data)}))})),$()]).then((e=>{const l=e[0];e[1],e[2],console.log("release getDetail",l),E.videoUrl=s.format_url(l.videoUrl,"video"),E.imageUrl=s.format_url(l.imageUrl,"img"),E.title=l.title,E.content=l.content,E.isDraft=l.isDraft,l.talkId.split(",").forEach((e=>{for(let l=0;l<D.length;l++){const a=D[l];e==a.id&&S.push(a)}})),l.subscriber=l.subscriber.split(","),l.subscriberId.split(",").forEach(((e,a)=>{P.push({userId:e,userNickname:l.subscriber[a]})}))}))):$()})),(e,l)=>{const a=d,t=y,s=N(o("uni-icons"),V),i=g,v=k,j=w,H=C,J=I,K=N(o("uni-popup"),z);return u(),r(a,{class:"appbw"},{default:c((()=>[n(a,{class:"form mtb30 mlr30 c666 f32"},{default:c((()=>[n(a,{class:"line mtb20"},{default:c((()=>[n(a,{class:"key"},{default:c((()=>[f("上传封面")])),_:1}),n(a,{class:"value mt20 imgList"},{default:c((()=>[E.imageUrl?(u(),r(a,{key:0,class:"imgs wh200 br10"},{default:c((()=>[n(t,{src:E.imageUrl,class:"br10",mode:"aspectFill"},null,8,["src"])])),_:1})):(u(
|