Files
t-admin/unpackage/dist/build/web/assets/pages-comment-edit.CSI06i-k.js
T
2025-06-13 21:16:12 +08:00

2 lines
4.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as e,e as a,K as t,L as l,v as o,C as n,s as m,r as i,a as r,a9 as u,c as d,w as s,am as c,i as f,o as _,h as p,j as h,m as D,V}from"./index-CS85kPhe.js";import{_ as b}from"./uni-easyinput.DiCyKNZM.js";import{_ as y}from"./uni-forms-item.g4VtziaR.js";import{_ as k}from"./uni-forms.DHOpViDo.js";import{v as g}from"./comment.Dh5wkaQ5.js";const U=a.database();U.command;function j(e){let a={};for(let t in g)e.includes(t)&&(a[t]=g[t]);return a}const v=e({data(){let e={content:"",root_id:"0",author_id:"",parent_id:"0",article_id:"",like_count:0,create_time:null,update_time:null,reply_count:0,ip_location:null};return{formData:e,formOptions:{},rules:{...j(Object.keys(e))}}},onLoad(e){if(e.id){const a=e.id;this.formDataId=a,this.getDetail(a)}},onReady(){this.$refs.form.setRules(this.rules)},methods:{submit(){t({mask:!0}),this.$refs.form.validate().then((e=>this.submitForm(e))).catch((()=>{})).finally((()=>{l()}))},submitForm(e){return U.collection("comment").doc(this.formDataId).update(e).then((e=>{o({title:"修改成功"}),this.getOpenerEventChannel().emit("refreshData"),setTimeout((()=>n()),500)})).catch((e=>{m({content:e.message||"请求服务失败",showCancel:!1})}))},getDetail(e){t({mask:!0}),U.collection("comment").doc(e).field("content,root_id,author_id,parent_id,article_id,like_count,create_time,update_time,reply_count,ip_location").get().then((e=>{const a=e.result.data[0];a&&(this.formData=a)})).catch((e=>{m({content:e.message||"请求服务失败",showCancel:!1})})).finally((()=>{l()}))}}},[["render",function(e,a,t,l,o,n){const m=i(r("uni-easyinput"),b),g=i(r("uni-forms-item"),y),U=i(r("uni-datetime-picker"),c),j=u("undefined"),v=D,C=V,I=f,w=i(r("uni-forms"),k);return _(),d(I,{class:"uni-container"},{default:s((()=>[p(w,{ref:"form",model:o.formData,validateTrigger:"bind"},{default:s((()=>[p(g,{name:"content",label:"评论内容",required:""},{default:s((()=>[p(m,{modelValue:o.formData.content,"onUpdate:modelValue":a[0]||(a[0]=e=>o.formData.content=e)},null,8,["modelValue"])])),_:1}),p(g,{name:"root_id",label:""},{default:s((()=>[p(m,{placeholder:"根评论ID(0表示自身是根评论)",modelValue:o.formData.root_id,"onUpdate:modelValue":a[1]||(a[1]=e=>o.formData.root_id=e)},null,8,["modelValue"])])),_:1}),p(g,{name:"author_id",label:"",required:""},{default:s((()=>[p(m,{placeholder:"作者ID(关联uni-id-users表)",modelValue:o.formData.author_id,"onUpdate:modelValue":a[2]||(a[2]=e=>o.formData.author_id=e)},null,8,["modelValue"])])),_:1}),p(g,{name:"parent_id",label:""},{default:s((()=>[p(m,{placeholder:"父评论ID(0表示无父评论)",modelValue:o.formData.parent_id,"onUpdate:modelValue":a[3]||(a[3]=e=>o.formData.parent_id=e)},null,8,["modelValue"])])),_:1}),p(g,{name:"article_id",label:"",required:""},{default:s((()=>[p(m,{placeholder:"关联文章ID",modelValue:o.formData.article_id,"onUpdate:modelValue":a[4]||(a[4]=e=>o.formData.article_id=e)},null,8,["modelValue"])])),_:1}),p(g,{name:"like_count",label:""},{default:s((()=>[p(m,{placeholder:"点赞数",type:"number",modelValue:o.formData.like_count,"onUpdate:modelValue":a[5]||(a[5]=e=>o.formData.like_count=e)},null,8,["modelValue"])])),_:1}),p(g,{name:"create_time",label:"",required:""},{default:s((()=>[p(U,{"return-type":"timestamp",modelValue:o.formData.create_time,"onUpdate:modelValue":a[6]||(a[6]=e=>o.formData.create_time=e)},null,8,["modelValue"])])),_:1}),p(g,{name:"update_time",label:""},{default:s((()=>[p(U,{"return-type":"timestamp",modelValue:o.formData.update_time,"onUpdate:modelValue":a[7]||(a[7]=e=>o.formData.update_time=e)},null,8,["modelValue"])])),_:1}),p(g,{name:"reply_count",label:""},{default:s((()=>[p(m,{placeholder:"回复数",type:"number",modelValue:o.formData.reply_count,"onUpdate:modelValue":a[8]||(a[8]=e=>o.formData.reply_count=e)},null,8,["modelValue"])])),_:1}),p(g,{name:"ip_location",label:""},{default:s((()=>[p(j,{modelValue:o.formData.ip_location,"onUpdate:modelValue":a[9]||(a[9]=e=>o.formData.ip_location=e)},null,8,["modelValue"])])),_:1}),p(I,{class:"uni-button-group"},{default:s((()=>[p(v,{type:"primary",class:"uni-button",style:{width:"100px"},onClick:n.submit},{default:s((()=>[h("提交")])),_:1},8,["onClick"]),p(C,{"open-type":"navigateBack",style:{"margin-left":"15px"}},{default:s((()=>[p(v,{class:"uni-button",style:{width:"100px"}},{default:s((()=>[h("返回")])),_:1})])),_:1})])),_:1})])),_:1},8,["model"])])),_:1})}]]);export{v as default};