2 lines
9.5 KiB
JavaScript
2 lines
9.5 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,j as i,l as o,c as r,w as c,i as d,o as u,b as n,e as f,a as m,m as p,F as _,s as b,u as h,f as v,Y as y,I as g,_ as k,n as w,t as C,p as U,v as x}from"./index-CZsuXyof.js";import{_ as I}from"./uni-icons.CE6FQOeI.js";import{o as V,r as j}from"./uni-app.es.Cv5-J_i3.js";import{_ as N}from"./uni-popup.M4-7QhOy.js";import{_ as z}from"./_plugin-vue_export-helper.BCo6x5W8.js";/* empty css */import"./uni-popup.vue_vue_type_style_index_0_scoped_f0b957f8_lang.BhWYEB-t.js";const E=z({__name:"video",setup(e){const z=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 E=a([]);const B=t(""),D=a([]),L=a({data:[],pageNum:1,pageSize:20,total:0}),P=a([]),S=t("");function R(){s.upload_image({value:z.imageUrl,type:1,success:e=>{z.imageUrl=e.value}})}function q(){s.upload_video({success:e=>{z.videoUrl=e.value}})}function F(){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 E.length=0,E.push(...a),e(E),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}):F()}))})))}s.alert({content:l.msg,showCancel:!1})}))}))}function T(e,l){D.splice(l,1)}function $(){L.data.length>=L.total||(L.pageNum++,G())}function G(){return new Promise(((e,l)=>{i.video.searchFriendByName({path:[S.value],query:{pageNum:L.pageNum,pageSize:L.pageSize}}).then((l=>{if(200==l.code)return L.pageNum&&(L.data.length=0),L.data.push(...l.rows),L.total=l.total,void e(L.data);s.alert({content:l.msg,showCancel:!1})}))}))}function M(e){const l={...z};let a="publishVideo";if(z.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("正文不能为空")}D[0]&&(l.talkId=D.map((e=>e.id)).join(","),l.talk=D.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=>{uni.navigateBack()}))}))}else s.alert("封面不能为空");else s.alert("视频不能为空")}return V((e=>{e.videoId?(z.videoId=e.videoId,Promise.all([new Promise(((e,l)=>{i.video.getVideoById({query:{videoId:z.videoId}}).then((l=>{200!=l.code?s.alert({content:l.msg,showCancel:!1}):e(l.data)}))})),F()]).then((e=>{const l=e[0];e[1],e[2],console.log("release getDetail",l),z.videoUrl=s.format_url(l.videoUrl,"video"),z.imageUrl=s.format_url(l.imageUrl,"img"),z.title=l.title,z.content=l.content,z.isDraft=l.isDraft,l.talkId.split(",").forEach((e=>{for(let l=0;l<E.length;l++){const a=E[l];e==a.id&&D.push(a)}})),l.subscriber=l.subscriber.split(","),l.subscriberId.split(",").forEach(((e,a)=>{P.push({userId:e,userNickname:l.subscriber[a]})}))}))):F()})),(e,l)=>{const a=d,t=v,s=j(o("uni-icons"),I),i=y,V=g,O=k,Y=w,A=x,H=j(o("uni-popup"),N);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((()=>[z.imageUrl?(u(),r(a,{key:0,class:"imgs wh200 br10"},{default:c((
|