2 lines
4.6 KiB
JavaScript
2 lines
4.6 KiB
JavaScript
import{s as r,n as g}from"./index-2b234fd0.js";import{l as p}from"./lodash-3692acb0.js";const u={data(){return{visible:[],state:2,list:[],reason:"",columns:[{colKey:"title",title:"标题",align:"center"},{colKey:"content",title:"内容",align:"center"},{colKey:"member_info",title:"发布者",align:"center"},{colKey:"files",title:"图片",align:"center"},{colKey:"createtime",title:"创建时间",align:"center"},{colKey:"this_top",title:"置顶",align:"center"},{colKey:"select",title:"操作",width:200}],pagination:{page:1,size:5,total:0}}},mounted(){typeof r.state.user.association=="object"?this.association=r.state.user.association:this.association=JSON.parse(r.state.user.association);var t=this.$route.name.slice(-1);this.state=p.toInteger(t),this.getList()},methods:{delViewer(t){console.log(t)},tabIndexChange(t){this.state=t,this.pagination.page=1,this.getList()},topNews(t){console.log(t),this.$request.post("/tweets/pin",{id:t.id}).then(i=>{i.code==1?(this.$message.success("置顶成功"),this.getList()):this.$message.error(i.msg),console.log(i)}).catch(i=>{console.log(i)})},review(t,i){console.log(t),this.$request.post("/tweets/review",{id:t.id,status:i,reason:this.reason,member_id:t.member_id}).then(e=>{e.code==1?(this.$message.success(e.msg),this.getList()):this.$message.error(e.msg),console.log(e)}).catch(e=>{console.log(e)})},del(t){console.log(t),this.$request.post("/tweets/destroy",{id:t.id}).then(i=>{i.code==1?(this.$message.success("删除成功!"),this.pagination.page=1,this.getList()):this.$message.error(i.msg),console.log(i)}).catch(i=>{console.log(i)})},onCurrentChange(t){this.pagination.page=t,this.getList()},getList(){this.$request.post("/tweets/index",{state:this.state,page:this.pagination.page,size:this.pagination.size}).then(t=>{if(console.log(t),t.code==1){var i=t.data.paginator.data;const e=r.state.user.apiUrl,n=i.map(s=>({...s,files:s.files.length>0?s.files.map(o=>e+o):[]}));console.log(n),this.list=n,this.visible=Array(this.list.length).fill(!1),this.pagination.total=t.data.count}}).catch(t=>{console.log(t)})}}};var h=function(){var t=this,i=t.$createElement,e=t._self._c||i;return e("t-card",{attrs:{title:"青企圈列表",bordered:!1}},[e("div",{staticClass:"form-step-container"},[e("t-table",{attrs:{rowKey:"index",data:t.list,columns:t.columns,stripe:!1,bordered:!1,hover:!0,size:"large","table-layout":"auto",cellEmptyContent:"-",pagination:t.pagination},scopedSlots:t._u([{key:"member_info",fn:function(n){var s=n.row;return[e("div",[t._v(t._s(s.member.nikename))])]}},{key:"files",fn:function(n){var s=n.row,o=n.rowIndex;return[e("t-image-viewer",{attrs:{images:s.files},on:{close:function(a){return t.delViewer(t.index)}},scopedSlots:t._u([{key:"trigger",fn:function(a){var c=a.open;return[s.files.length>0?e("div",{staticStyle:{cursor:"pointer"},on:{click:c}},[e("img",{staticStyle:{width:"200px"},attrs:{alt:"test",src:s.files[0]}}),e("div",[t._v("预览图片 "+t._s(s.files.length)+"张")])]):t._e()]}}],null,!0),model:{value:t.visible[o],callback:function(a){t.$set(t.visible,o,a)},expression:"visible[rowIndex]"}})]}},{key:"this_top",fn:function(n){var s=n.row;return[s.is_top==0?e("t-tag",{staticStyle:{cursor:"pointer"},attrs:{theme:"success"},on:{click:function(o){return t.topNews(s)}}},[t._v("点击置顶")]):t._e(),s.is_top>0?e("t-tag",{staticStyle:{cursor:"pointer"},attrs:{theme:"warning"},on:{click:function(o){return t.topNews(s)}}},[t._v("取消置顶")]):t._e()]}},{key:"select",fn:function(n){var s=n.row;return[e("t-space",{attrs:{size:0}},[s.status==1?e("t-popconfirm",{attrs:{content:"确定要审核通过吗?"},on:{confirm:function(o){return t.review(s,1)}}},[e("t-button",{attrs:{theme:"primary"}},[t._v("通过")])],1):t._e(),s.status==1?e("t-popconfirm",{attrs:{theme:"danger"},on:{confirm:function(o){return t.review(s,2)}}},[e("template",{slot:"content"},[e("p",{staticClass:"title"},[t._v("拒绝理由")]),e("p",{staticClass:"describe",staticStyle:{"margin-top":"10px"}},[e("t-input",{attrs:{placeholder:"请输入拒绝理由"},model:{value:t.reason,callback:function(o){t.reason=o},expression:"reason"}})],1)]),e("t-button",{staticStyle:{margin:"0px 10px"},attrs:{theme:"warning"}},[t._v("拒绝")])],2):t._e(),e("t-popconfirm",{attrs:{content:"确认删除吗?"},on:{confirm:function(o){return t.del(s)}}},[e("t-button",{attrs:{theme:"danger"}},[t._v("删除")])],1)],1)]}}])}),e("div",{staticStyle:{"margin-top":"30px"}},[e("t-pagination",{attrs:{total:t.pagination.total,"page-size":t.pagination.size,showPageSize:!1},on:{"current-change":t.onCurrentChange}})],1)],1)])},m=[];const l={};var f=g(u,h,m,!1,d,null,null,null);function d(t){for(let i in l)this[i]=l[i]}const w=function(){return f.exports}();export{w as default};
|