mirror of https://github.com/rocboss/paopao-ce
optmize #286
parent
37bff87877
commit
20d9f182ce
@ -0,0 +1,259 @@
|
||||
// Copyright 2022 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"image"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/internal/servants/web/broker"
|
||||
"github.com/rocboss/paopao-ce/pkg/app"
|
||||
"github.com/rocboss/paopao-ce/pkg/convert"
|
||||
"github.com/rocboss/paopao-ce/pkg/errcode"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var uploadAttachmentTypeMap = map[string]core.AttachmentType{
|
||||
"public/image": core.AttachmentTypeImage,
|
||||
"public/avatar": core.AttachmentTypeImage,
|
||||
"public/video": core.AttachmentTypeVideo,
|
||||
"attachment": core.AttachmentTypeOther,
|
||||
}
|
||||
|
||||
func GeneratePath(s string) string {
|
||||
n := len(s)
|
||||
if n <= 2 {
|
||||
return s
|
||||
}
|
||||
|
||||
return GeneratePath(s[:n-2]) + "/" + s[n-2:]
|
||||
}
|
||||
|
||||
func GetFileExt(s string) (string, error) {
|
||||
switch s {
|
||||
case "image/png":
|
||||
return ".png", nil
|
||||
case "image/jpg":
|
||||
return ".jpg", nil
|
||||
case "image/jpeg":
|
||||
return ".jpeg", nil
|
||||
case "image/gif":
|
||||
return ".gif", nil
|
||||
case "video/mp4":
|
||||
return ".mp4", nil
|
||||
case "video/quicktime":
|
||||
return ".mov", nil
|
||||
case "application/zip",
|
||||
"application/x-zip",
|
||||
"application/octet-stream",
|
||||
"application/x-zip-compressed":
|
||||
return ".zip", nil
|
||||
default:
|
||||
return "", errcode.FileInvalidExt.WithDetails("仅允许 png/jpg/gif/mp4/mov/zip 类型")
|
||||
}
|
||||
}
|
||||
func GetImageSize(img image.Rectangle) (int, int) {
|
||||
b := img.Bounds()
|
||||
width := b.Max.X
|
||||
height := b.Max.Y
|
||||
return width, height
|
||||
}
|
||||
|
||||
func fileCheck(uploadType string, size int64) error {
|
||||
if uploadType != "public/video" &&
|
||||
uploadType != "public/image" &&
|
||||
uploadType != "public/avatar" &&
|
||||
uploadType != "attachment" {
|
||||
return errcode.InvalidParams
|
||||
}
|
||||
|
||||
if size > 1024*1024*100 {
|
||||
return errcode.FileInvalidSize.WithDetails("最大允许100MB")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func UploadAttachment(c *gin.Context) {
|
||||
response := app.NewResponse(c)
|
||||
|
||||
uploadType := c.Request.FormValue("type")
|
||||
file, fileHeader, err := c.Request.FormFile("file")
|
||||
if err != nil {
|
||||
logrus.Errorf("api.UploadAttachment err: %v", err)
|
||||
response.ToErrorResponse(errcode.FileUploadFailed)
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
if err = fileCheck(uploadType, fileHeader.Size); err != nil {
|
||||
cErr, _ := err.(*errcode.Error)
|
||||
response.ToErrorResponse(cErr)
|
||||
return
|
||||
}
|
||||
|
||||
contentType := fileHeader.Header.Get("Content-Type")
|
||||
fileExt, err := GetFileExt(fileHeader.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
logrus.Errorf("GetFileExt err: %v", err)
|
||||
response.ToErrorResponse(err.(*errcode.Error))
|
||||
return
|
||||
}
|
||||
|
||||
// 生成随机路径
|
||||
randomPath := uuid.Must(uuid.NewV4()).String()
|
||||
ossSavePath := uploadType + "/" + GeneratePath(randomPath[:8]) + "/" + randomPath[9:] + fileExt
|
||||
|
||||
objectUrl, err := objectStorage.PutObject(ossSavePath, file, fileHeader.Size, contentType, false)
|
||||
if err != nil {
|
||||
logrus.Errorf("putObject err: %v", err)
|
||||
response.ToErrorResponse(errcode.FileUploadFailed)
|
||||
return
|
||||
}
|
||||
|
||||
// 构造附件Model
|
||||
attachment := &core.Attachment{
|
||||
FileSize: fileHeader.Size,
|
||||
Content: objectUrl,
|
||||
}
|
||||
|
||||
if userID, exists := c.Get("UID"); exists {
|
||||
attachment.UserID = userID.(int64)
|
||||
}
|
||||
|
||||
attachment.Type = uploadAttachmentTypeMap[uploadType]
|
||||
if attachment.Type == core.AttachmentTypeImage {
|
||||
var src image.Image
|
||||
src, err = imaging.Decode(file)
|
||||
if err == nil {
|
||||
attachment.ImgWidth, attachment.ImgHeight = GetImageSize(src.Bounds())
|
||||
}
|
||||
}
|
||||
|
||||
attachment, err = broker.CreateAttachment(attachment)
|
||||
if err != nil {
|
||||
logrus.Errorf("service.CreateAttachment err: %v", err)
|
||||
response.ToErrorResponse(errcode.FileUploadFailed)
|
||||
}
|
||||
|
||||
response.ToResponse(attachment)
|
||||
}
|
||||
|
||||
func DownloadAttachmentPrecheck(c *gin.Context) {
|
||||
response := app.NewResponse(c)
|
||||
|
||||
contentID := convert.StrTo(c.Query("id")).MustInt64()
|
||||
// 加载content
|
||||
content, err := broker.GetPostContentByID(contentID)
|
||||
if err != nil {
|
||||
logrus.Errorf("service.GetPostContentByID err: %v", err)
|
||||
response.ToErrorResponse(errcode.InvalidDownloadReq)
|
||||
}
|
||||
user, _ := c.Get("USER")
|
||||
if content.Type == core.ContentTypeChargeAttachment {
|
||||
// 加载post
|
||||
post, err := broker.GetPost(content.PostID)
|
||||
if err != nil {
|
||||
logrus.Errorf("service.GetPost err: %v", err)
|
||||
response.ToResponse(gin.H{
|
||||
"paid": false,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 发布者或管理员免费下载
|
||||
if post.UserID == user.(*core.User).ID || user.(*core.User).IsAdmin {
|
||||
response.ToResponse(gin.H{
|
||||
"paid": true,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 检测是否有购买记录
|
||||
response.ToResponse(gin.H{
|
||||
"paid": broker.CheckPostAttachmentIsPaid(post.ID, user.(*core.User).ID),
|
||||
})
|
||||
return
|
||||
}
|
||||
response.ToResponse(gin.H{
|
||||
"paid": false,
|
||||
})
|
||||
}
|
||||
|
||||
func DownloadAttachment(c *gin.Context) {
|
||||
response := app.NewResponse(c)
|
||||
|
||||
contentID := convert.StrTo(c.Query("id")).MustInt64()
|
||||
|
||||
// 加载content
|
||||
content, err := broker.GetPostContentByID(contentID)
|
||||
if err != nil {
|
||||
logrus.Errorf("service.GetPostContentByID err: %v", err)
|
||||
response.ToErrorResponse(errcode.InvalidDownloadReq)
|
||||
}
|
||||
|
||||
// 收费附件
|
||||
if content.Type == core.ContentTypeChargeAttachment {
|
||||
user, _ := c.Get("USER")
|
||||
|
||||
// 加载post
|
||||
post, err := broker.GetPost(content.PostID)
|
||||
if err != nil {
|
||||
logrus.Errorf("service.GetPost err: %v", err)
|
||||
response.ToResponse(gin.H{
|
||||
"paid": false,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
paidFlag := false
|
||||
|
||||
// 发布者或管理员免费下载
|
||||
if post.UserID == user.(*core.User).ID || user.(*core.User).IsAdmin {
|
||||
paidFlag = true
|
||||
}
|
||||
|
||||
// 检测是否有购买记录
|
||||
if broker.CheckPostAttachmentIsPaid(post.ID, user.(*core.User).ID) {
|
||||
paidFlag = true
|
||||
}
|
||||
|
||||
if !paidFlag {
|
||||
// 未购买,则尝试购买
|
||||
err := broker.BuyPostAttachment(&core.Post{
|
||||
Model: &core.Model{
|
||||
ID: post.ID,
|
||||
},
|
||||
UserID: post.UserID,
|
||||
AttachmentPrice: post.AttachmentPrice,
|
||||
}, user.(*core.User))
|
||||
if err != nil {
|
||||
logrus.Errorf("service.BuyPostAttachment err: %v", err)
|
||||
if err == errcode.InsuffientDownloadMoney {
|
||||
|
||||
response.ToErrorResponse(errcode.InsuffientDownloadMoney)
|
||||
} else {
|
||||
|
||||
response.ToErrorResponse(errcode.DownloadExecFail)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
objectKey := objectStorage.ObjectKey(content.Content)
|
||||
signedURL, err := objectStorage.SignURL(objectKey, 60)
|
||||
if err != nil {
|
||||
logrus.Errorf("client.SignURL err: %v", err)
|
||||
response.ToErrorResponse(errcode.DownloadReqError)
|
||||
return
|
||||
}
|
||||
response.ToResponse(gin.H{
|
||||
"signed_url": signedURL,
|
||||
})
|
||||
}
|
@ -1 +1 @@
|
||||
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-5590db51.js";import{u as a}from"./vue-router-88cc84d1.js";import{F as i,e as c,a2 as u}from"./naive-ui-2035804c.js";import{d as l,c as d,L as t,$ as o,o as f,e as x}from"./@vue-ca177dbe.js";import{_ as g}from"./index-f9e09224.js";import"./vuex-d28e9067.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./@vicons-6d35273b.js";import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-707ed124.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default};
|
||||
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-5097b22a.js";import{u as a}from"./vue-router-88cc84d1.js";import{F as i,e as c,a2 as u}from"./naive-ui-2035804c.js";import{d as l,c as d,L as t,$ as o,o as f,e as x}from"./@vue-ca177dbe.js";import{_ as g}from"./index-71354138.js";import"./vuex-d28e9067.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./@vicons-6d35273b.js";import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default};
|
@ -1 +1 @@
|
||||
import{_ as F}from"./post-skeleton-5cb6f6d4.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-5590db51.js";import{u as z}from"./vuex-d28e9067.js";import{b as A}from"./vue-router-88cc84d1.js";import{a as R}from"./formatTime-000dbebb.js";import{d as S,r as n,j as V,c as o,L as a,$ as p,o as e,Y as u,O as l,F as I,a2 as L,K as M,a as s,M as _,a4 as O}from"./@vue-ca177dbe.js";import{F as P,G as $,I as j,H as q}from"./naive-ui-2035804c.js";import{_ as D}from"./index-f9e09224.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./@vicons-6d35273b.js";import"./moment-b7869f98.js";import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-707ed124.js";/* empty css */const E={key:0,class:"pagination-wrap"},G={key:0,class:"skeleton-wrap"},H={key:1},K={key:0,class:"empty-wrap"},T={class:"bill-line"},U=S({__name:"Anouncement",setup(Y){const d=z(),g=A(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return V(()=>{}),(m,J)=>{const y=N,k=$,x=F,w=j,B=q,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",E,[a(k,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",G,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",H,[r.value.length===0?(e(),o("div",K,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(I,null,L(r.value,t=>(e(),M(B,{key:t.id},{default:p(()=>[s("div",T,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:O({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(R)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=D(U,[["__scopeId","data-v-d4d04859"]]);export{kt as default};
|
||||
import{_ as F}from"./post-skeleton-fdd699ea.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-5097b22a.js";import{u as z}from"./vuex-d28e9067.js";import{b as A}from"./vue-router-88cc84d1.js";import{a as R}from"./formatTime-000dbebb.js";import{d as S,r as n,j as V,c as o,L as a,$ as p,o as e,Y as u,O as l,F as I,a2 as L,K as M,a as s,M as _,a4 as O}from"./@vue-ca177dbe.js";import{F as P,G as $,I as j,H as q}from"./naive-ui-2035804c.js";import{_ as D}from"./index-71354138.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./@vicons-6d35273b.js";import"./moment-b7869f98.js";import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const E={key:0,class:"pagination-wrap"},G={key:0,class:"skeleton-wrap"},H={key:1},K={key:0,class:"empty-wrap"},T={class:"bill-line"},U=S({__name:"Anouncement",setup(Y){const d=z(),g=A(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return V(()=>{}),(m,J)=>{const y=N,k=$,x=F,w=j,B=q,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",E,[a(k,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",G,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",H,[r.value.length===0?(e(),o("div",K,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(I,null,L(r.value,t=>(e(),M(B,{key:t.id},{default:p(()=>[s("div",T,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:O({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(R)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=D(U,[["__scopeId","data-v-d4d04859"]]);export{kt as default};
|
@ -1 +1 @@
|
||||
import{_ as z}from"./post-item.vue_vue_type_style_index_0_lang-c93cad29.js";import{_ as B}from"./post-skeleton-5cb6f6d4.js";import{_ as F}from"./main-nav.vue_vue_type_style_index_0_lang-5590db51.js";import{u as P}from"./vuex-d28e9067.js";import{b as R,u as $}from"./vue-router-88cc84d1.js";import{K as b,_ as I}from"./index-f9e09224.js";import{d as K,r as a,j as L,c as e,L as n,$ as m,Y as M,O as u,o as t,F as N,a2 as S,K as V}from"./@vue-ca177dbe.js";import{F as j,G as q,I as E,H as G}from"./naive-ui-2035804c.js";import"./content-a3ccbaf1.js";import"./@vicons-6d35273b.js";import"./nonesir-video-db921567.js";import"./formatTime-000dbebb.js";import"./moment-b7869f98.js";import"./copy-to-clipboard-ca358197.js";import"./toggle-selection-93f4ad84.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const H={key:0,class:"skeleton-wrap"},O={key:1},T={key:0,class:"empty-wrap"},U={key:0,class:"pagination-wrap"},Y=K({__name:"Collection",setup(A){const d=P(),g=R();$();const s=a(!1),p=a([]),_=a(+g.query.p||1),i=a(20),r=a(0),l=()=>{s.value=!0,b({page:_.value,page_size:i.value}).then(o=>{s.value=!1,p.value=o.list,r.value=Math.ceil(o.pager.total_rows/i.value),window.scrollTo(0,0)}).catch(o=>{s.value=!1})},v=o=>{_.value=o,l()};return L(()=>{l()}),(o,D)=>{const f=F,h=B,k=E,y=z,w=G,C=j,x=q;return t(),e("div",null,[n(f,{title:"收藏"}),n(C,{class:"main-content-wrap",bordered:""},{default:m(()=>[s.value?(t(),e("div",H,[n(h,{num:i.value},null,8,["num"])])):(t(),e("div",O,[p.value.length===0?(t(),e("div",T,[n(k,{size:"large",description:"暂无数据"})])):u("",!0),(t(!0),e(N,null,S(p.value,c=>(t(),V(w,{key:c.id},{default:m(()=>[n(y,{post:c},null,8,["post"])]),_:2},1024))),128))]))]),_:1}),r.value>0?(t(),e("div",U,[n(x,{page:_.value,"onUpdate:page":v,"page-slot":M(d).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):u("",!0)])}}});const Bt=I(Y,[["__scopeId","data-v-1e709369"]]);export{Bt as default};
|
||||
import{_ as z}from"./post-item.vue_vue_type_style_index_0_lang-09a3d19d.js";import{_ as B}from"./post-skeleton-fdd699ea.js";import{_ as F}from"./main-nav.vue_vue_type_style_index_0_lang-5097b22a.js";import{u as P}from"./vuex-d28e9067.js";import{b as R,u as $}from"./vue-router-88cc84d1.js";import{K as b,_ as I}from"./index-71354138.js";import{d as K,r as a,j as L,c as e,L as n,$ as m,Y as M,O as u,o as t,F as N,a2 as S,K as V}from"./@vue-ca177dbe.js";import{F as j,G as q,I as E,H as G}from"./naive-ui-2035804c.js";import"./content-3f1d28f2.js";import"./@vicons-6d35273b.js";import"./nonesir-video-db921567.js";import"./formatTime-000dbebb.js";import"./moment-b7869f98.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const H={key:0,class:"skeleton-wrap"},O={key:1},T={key:0,class:"empty-wrap"},U={key:0,class:"pagination-wrap"},Y=K({__name:"Collection",setup(A){const d=P(),g=R();$();const s=a(!1),p=a([]),_=a(+g.query.p||1),i=a(20),r=a(0),l=()=>{s.value=!0,b({page:_.value,page_size:i.value}).then(o=>{s.value=!1,p.value=o.list,r.value=Math.ceil(o.pager.total_rows/i.value),window.scrollTo(0,0)}).catch(o=>{s.value=!1})},v=o=>{_.value=o,l()};return L(()=>{l()}),(o,D)=>{const f=F,h=B,k=E,y=z,w=G,C=j,x=q;return t(),e("div",null,[n(f,{title:"收藏"}),n(C,{class:"main-content-wrap",bordered:""},{default:m(()=>[s.value?(t(),e("div",H,[n(h,{num:i.value},null,8,["num"])])):(t(),e("div",O,[p.value.length===0?(t(),e("div",T,[n(k,{size:"large",description:"暂无数据"})])):u("",!0),(t(!0),e(N,null,S(p.value,c=>(t(),V(w,{key:c.id},{default:m(()=>[n(y,{post:c},null,8,["post"])]),_:2},1024))),128))]))]),_:1}),r.value>0?(t(),e("div",U,[n(x,{page:_.value,"onUpdate:page":v,"page-slot":M(d).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):u("",!0)])}}});const Bt=I(Y,[["__scopeId","data-v-1e709369"]]);export{Bt as default};
|
@ -1 +1 @@
|
||||
import{u as M,b as P}from"./vue-router-88cc84d1.js";import{d as b,o as t,c as n,a,L as s,M as v,r as i,j as R,$ as h,Y as S,O as y,F as k,a2 as U,K as V}from"./@vue-ca177dbe.js";import{o as q,F as D,G as L,I as T,H as j}from"./naive-ui-2035804c.js";import{_ as C,N as E}from"./index-f9e09224.js";import{_ as G}from"./post-skeleton-5cb6f6d4.js";import{_ as H}from"./main-nav.vue_vue_type_style_index_0_lang-5590db51.js";import{u as K}from"./vuex-d28e9067.js";import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./evtd-b614532e.js";import"./@css-render-480a363d.js";import"./vooks-2c48c2b5.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-707ed124.js";import"./@vicons-6d35273b.js";/* empty css */const O={class:"avatar"},Y={class:"base-info"},A={class:"username"},J={class:"uid"},Q=b({__name:"contact-item",props:{contact:null},setup(c){const p=M(),m=e=>{p.push({name:"user",query:{username:e}})};return(e,o)=>{const _=q;return t(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=l=>m(c.contact.username))},[a("div",O,[s(_,{size:"large",src:c.contact.avatar},null,8,["src"])]),a("div",Y,[a("div",A,[a("strong",null,v(c.contact.nickname),1),a("span",null," @"+v(c.contact.username),1)]),a("div",J,"UID. "+v(c.contact.user_id),1)])])}}});const W=C(Q,[["__scopeId","data-v-08ee9b2e"]]),X={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=b({__name:"Contacts",setup(c){const p=K(),m=P(),e=i(!1),o=i([]),_=i(+m.query.p||1),l=i(20),d=i(0),$=r=>{_.value=r,g()};R(()=>{g()});const g=(r=!1)=>{o.value.length===0&&(e.value=!0),E({page:_.value,page_size:l.value}).then(u=>{e.value=!1,o.value=u.list,d.value=Math.ceil(u.pager.total_rows/l.value),r&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(u=>{e.value=!1})};return(r,u)=>{const w=H,x=G,I=T,z=W,B=j,N=D,F=L;return t(),n(k,null,[a("div",null,[s(w,{title:"好友"}),s(N,{class:"main-content-wrap",bordered:""},{default:h(()=>[e.value?(t(),n("div",X,[s(x,{num:l.value},null,8,["num"])])):(t(),n("div",Z,[o.value.length===0?(t(),n("div",tt,[s(I,{size:"large",description:"暂无数据"})])):y("",!0),(t(!0),n(k,null,U(o.value,f=>(t(),V(B,{key:f.user_id},{default:h(()=>[s(z,{contact:f},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),d.value>0?(t(),n("div",et,[s(F,{page:_.value,"onUpdate:page":$,"page-slot":S(p).state.collapsedRight?5:8,"page-count":d.value},null,8,["page","page-slot","page-count"])])):y("",!0)],64)}}});const It=C(ot,[["__scopeId","data-v-3b2bf978"]]);export{It as default};
|
||||
import{u as M,b as P}from"./vue-router-88cc84d1.js";import{d as b,o as t,c as n,a,L as s,M as v,r as i,j as R,$ as h,Y as S,O as y,F as k,a2 as U,K as V}from"./@vue-ca177dbe.js";import{o as q,F as D,G as L,I as T,H as j}from"./naive-ui-2035804c.js";import{_ as C,N as E}from"./index-71354138.js";import{_ as G}from"./post-skeleton-fdd699ea.js";import{_ as H}from"./main-nav.vue_vue_type_style_index_0_lang-5097b22a.js";import{u as K}from"./vuex-d28e9067.js";import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./evtd-b614532e.js";import"./@css-render-480a363d.js";import"./vooks-2c48c2b5.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";import"./@vicons-6d35273b.js";/* empty css */const O={class:"avatar"},Y={class:"base-info"},A={class:"username"},J={class:"uid"},Q=b({__name:"contact-item",props:{contact:null},setup(c){const p=M(),m=e=>{p.push({name:"user",query:{username:e}})};return(e,o)=>{const _=q;return t(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=l=>m(c.contact.username))},[a("div",O,[s(_,{size:"large",src:c.contact.avatar},null,8,["src"])]),a("div",Y,[a("div",A,[a("strong",null,v(c.contact.nickname),1),a("span",null," @"+v(c.contact.username),1)]),a("div",J,"UID. "+v(c.contact.user_id),1)])])}}});const W=C(Q,[["__scopeId","data-v-08ee9b2e"]]),X={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=b({__name:"Contacts",setup(c){const p=K(),m=P(),e=i(!1),o=i([]),_=i(+m.query.p||1),l=i(20),d=i(0),$=r=>{_.value=r,g()};R(()=>{g()});const g=(r=!1)=>{o.value.length===0&&(e.value=!0),E({page:_.value,page_size:l.value}).then(u=>{e.value=!1,o.value=u.list,d.value=Math.ceil(u.pager.total_rows/l.value),r&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(u=>{e.value=!1})};return(r,u)=>{const w=H,x=G,I=T,z=W,B=j,N=D,F=L;return t(),n(k,null,[a("div",null,[s(w,{title:"好友"}),s(N,{class:"main-content-wrap",bordered:""},{default:h(()=>[e.value?(t(),n("div",X,[s(x,{num:l.value},null,8,["num"])])):(t(),n("div",Z,[o.value.length===0?(t(),n("div",tt,[s(I,{size:"large",description:"暂无数据"})])):y("",!0),(t(!0),n(k,null,U(o.value,f=>(t(),V(B,{key:f.user_id},{default:h(()=>[s(z,{contact:f},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),d.value>0?(t(),n("div",et,[s(F,{page:_.value,"onUpdate:page":$,"page-slot":S(p).state.collapsedRight?5:8,"page-count":d.value},null,8,["page","page-slot","page-count"])])):y("",!0)],64)}}});const It=C(ot,[["__scopeId","data-v-3b2bf978"]]);export{It as default};
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{_ as M}from"./post-item.vue_vue_type_style_index_0_lang-c93cad29.js";import{_ as N}from"./post-skeleton-5cb6f6d4.js";import{_ as S}from"./main-nav.vue_vue_type_style_index_0_lang-5590db51.js";import{u as U}from"./vuex-d28e9067.js";import{b as V}from"./vue-router-88cc84d1.js";import{A as D,_ as L}from"./index-f9e09224.js";import{d as R,r,j,c as a,L as t,Y as _,K as h,$ as u,O as d,o as e,a as s,M as f,F as q,a2 as A}from"./@vue-ca177dbe.js";import{F as E,G,o as H,f as K,g as O,I as T,H as Y}from"./naive-ui-2035804c.js";import"./content-a3ccbaf1.js";import"./@vicons-6d35273b.js";import"./nonesir-video-db921567.js";import"./formatTime-000dbebb.js";import"./moment-b7869f98.js";import"./copy-to-clipboard-ca358197.js";import"./toggle-selection-93f4ad84.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const J={class:"profile-baseinfo"},Q={class:"avatar"},W={class:"base-info"},X={class:"username"},Z={class:"uid"},tt={key:0,class:"skeleton-wrap"},et={key:1},ot={key:0,class:"empty-wrap"},st={key:1,class:"pagination-wrap"},nt=R({__name:"Profile",setup(at){const o=U(),k=V(),i=r(!1),p=r([]),l=r(+k.query.p||1),c=r(20),m=r(0),g=()=>{i.value=!0,D({username:o.state.userInfo.username,page:l.value,page_size:c.value}).then(n=>{i.value=!1,p.value=n.list,m.value=Math.ceil(n.pager.total_rows/c.value),window.scrollTo(0,0)}).catch(n=>{i.value=!1})},y=n=>{l.value=n,g()};return j(()=>{g()}),(n,_t)=>{const w=S,I=H,b=K,P=O,x=N,z=T,B=M,$=Y,C=E,F=G;return e(),a("div",null,[t(w,{title:"主页"}),_(o).state.userInfo.id>0?(e(),h(C,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{default:u(()=>[s("div",J,[s("div",Q,[t(I,{size:"large",src:_(o).state.userInfo.avatar},null,8,["src"])]),s("div",W,[s("div",X,[s("strong",null,f(_(o).state.userInfo.nickname),1),s("span",null," @"+f(_(o).state.userInfo.username),1)]),s("div",Z,"UID. "+f(_(o).state.userInfo.id),1)])]),t(P,{class:"profile-tabs-wrap",animated:""},{default:u(()=>[t(b,{name:"post",tab:"泡泡"})]),_:1}),i.value?(e(),a("div",tt,[t(x,{num:c.value},null,8,["num"])])):(e(),a("div",et,[p.value.length===0?(e(),a("div",ot,[t(z,{size:"large",description:"暂无数据"})])):d("",!0),(e(!0),a(q,null,A(p.value,v=>(e(),h($,{key:v.id},{default:u(()=>[t(B,{post:v},null,8,["post"])]),_:2},1024))),128))]))]),_:1})):d("",!0),m.value>0?(e(),a("div",st,[t(F,{page:l.value,"onUpdate:page":y,"page-slot":_(o).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):d("",!0)])}}});const Lt=L(nt,[["__scopeId","data-v-1d87d974"]]);export{Lt as default};
|
||||
import{_ as M}from"./post-item.vue_vue_type_style_index_0_lang-09a3d19d.js";import{_ as N}from"./post-skeleton-fdd699ea.js";import{_ as S}from"./main-nav.vue_vue_type_style_index_0_lang-5097b22a.js";import{u as U}from"./vuex-d28e9067.js";import{b as V}from"./vue-router-88cc84d1.js";import{A as D,_ as L}from"./index-71354138.js";import{d as R,r,j,c as a,L as t,Y as _,K as h,$ as u,O as d,o as e,a as s,M as f,F as q,a2 as A}from"./@vue-ca177dbe.js";import{F as E,G,o as H,f as K,g as O,I as T,H as Y}from"./naive-ui-2035804c.js";import"./content-3f1d28f2.js";import"./@vicons-6d35273b.js";import"./nonesir-video-db921567.js";import"./formatTime-000dbebb.js";import"./moment-b7869f98.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-2c48c2b5.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./@css-render-480a363d.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const J={class:"profile-baseinfo"},Q={class:"avatar"},W={class:"base-info"},X={class:"username"},Z={class:"uid"},tt={key:0,class:"skeleton-wrap"},et={key:1},ot={key:0,class:"empty-wrap"},st={key:1,class:"pagination-wrap"},nt=R({__name:"Profile",setup(at){const o=U(),k=V(),i=r(!1),p=r([]),l=r(+k.query.p||1),c=r(20),m=r(0),g=()=>{i.value=!0,D({username:o.state.userInfo.username,page:l.value,page_size:c.value}).then(n=>{i.value=!1,p.value=n.list,m.value=Math.ceil(n.pager.total_rows/c.value),window.scrollTo(0,0)}).catch(n=>{i.value=!1})},y=n=>{l.value=n,g()};return j(()=>{g()}),(n,_t)=>{const w=S,I=H,b=K,P=O,x=N,z=T,B=M,$=Y,C=E,F=G;return e(),a("div",null,[t(w,{title:"主页"}),_(o).state.userInfo.id>0?(e(),h(C,{key:0,class:"main-content-wrap profile-wrap",bordered:""},{default:u(()=>[s("div",J,[s("div",Q,[t(I,{size:"large",src:_(o).state.userInfo.avatar},null,8,["src"])]),s("div",W,[s("div",X,[s("strong",null,f(_(o).state.userInfo.nickname),1),s("span",null," @"+f(_(o).state.userInfo.username),1)]),s("div",Z,"UID. "+f(_(o).state.userInfo.id),1)])]),t(P,{class:"profile-tabs-wrap",animated:""},{default:u(()=>[t(b,{name:"post",tab:"泡泡"})]),_:1}),i.value?(e(),a("div",tt,[t(x,{num:c.value},null,8,["num"])])):(e(),a("div",et,[p.value.length===0?(e(),a("div",ot,[t(z,{size:"large",description:"暂无数据"})])):d("",!0),(e(!0),a(q,null,A(p.value,v=>(e(),h($,{key:v.id},{default:u(()=>[t(B,{post:v},null,8,["post"])]),_:2},1024))),128))]))]),_:1})):d("",!0),m.value>0?(e(),a("div",st,[t(F,{page:l.value,"onUpdate:page":y,"page-slot":_(o).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):d("",!0)])}}});const Lt=L(nt,[["__scopeId","data-v-1d87d974"]]);export{Lt as default};
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{w as x,x as S,y as z,z as I,_ as j}from"./index-f9e09224.js";import{p as E}from"./@vicons-6d35273b.js";import{d as F,r as _,n as $,j as q,a1 as U,o as l,c as u,L as n,$ as a,K as T,e as A,M as w,O as m,Y as r,w as D,a6 as K,F as Y,a2 as G}from"./@vue-ca177dbe.js";import{o as H,M as L,j as J,e as P,O as Q,L as R,F as W,f as X,g as Z,a as tt,k as et}from"./naive-ui-2035804c.js";import{_ as ot}from"./main-nav.vue_vue_type_style_index_0_lang-5590db51.js";import{u as nt}from"./vuex-d28e9067.js";import"./vue-router-88cc84d1.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./evtd-b614532e.js";import"./@css-render-480a363d.js";import"./vooks-2c48c2b5.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const st={key:0,class:"tag-item"},at={key:0,class:"tag-quote"},ct={key:1,class:"tag-quote tag-follow"},lt={key:0,class:"options"},it=F({__name:"tag-item",props:{tag:null,showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(s){const e=s,g=_(!1),d=$(()=>{let o=[];return e.tag.is_following===0?o.push({label:"关注",key:"follow"}):(e.tag.is_top===0?o.push({label:"置顶",key:"stick"}):o.push({label:"取消置顶",key:"unstick"}),o.push({label:"取消关注",key:"unfollow"})),o}),i=o=>{switch(o){case"follow":z({topic_id:e.tag.id}).then(t=>{e.tag.is_following=1,window.$message.success("关注成功")}).catch(t=>{console.log(t)});break;case"unfollow":S({topic_id:e.tag.id}).then(t=>{e.tag.is_following=0,window.$message.success("取消关注")}).catch(t=>{console.log(t)});break;case"stick":x({topic_id:e.tag.id}).then(t=>{e.tag.is_top=t.top_status,window.$message.success("置顶成功")}).catch(t=>{console.log(t)});break;case"unstick":x({topic_id:e.tag.id}).then(t=>{e.tag.is_top=t.top_status,window.$message.success("取消置顶")}).catch(t=>{console.log(t)});break}};return q(()=>{g.value=!1}),(o,t)=>{const k=U("router-link"),f=H,v=L,c=J,h=P,y=Q,p=R;return!s.checkFollowing||s.checkFollowing&&s.tag.is_following===1?(l(),u("div",st,[n(p,null,{header:a(()=>[(l(),T(v,{type:"success",size:"large",round:"",key:s.tag.id},{avatar:a(()=>[n(f,{src:s.tag.user.avatar},null,8,["src"])]),default:a(()=>[n(k,{class:"hash-link",to:{name:"home",query:{q:s.tag.tag,t:"tag"}}},{default:a(()=>[A(" #"+w(s.tag.tag),1)]),_:1},8,["to"]),s.showAction?m("",!0):(l(),u("span",at,"("+w(s.tag.quote_num)+")",1)),s.showAction?(l(),u("span",ct,"("+w(s.tag.quote_num)+")",1)):m("",!0)]),_:1}))]),"header-extra":a(()=>[s.showAction?(l(),u("div",lt,[n(y,{placement:"bottom-end",trigger:"click",size:"small",options:r(d),onSelect:i},{default:a(()=>[n(h,{type:"success",quaternary:"",circle:"",block:""},{icon:a(()=>[n(c,null,{default:a(()=>[n(r(E))]),_:1})]),_:1})]),_:1},8,["options"])])):m("",!0)]),_:1})])):m("",!0)}}});const _t=F({__name:"Topic",setup(s){const e=nt(),g=_([]),d=_("hot"),i=_(!1),o=_(!1),t=_(!1);D(o,()=>{o.value||(window.$message.success("保存成功"),e.commit("refreshTopicFollow"))});const k=$({get:()=>{let c="编辑";return o.value&&(c="保存"),c},set:c=>{}}),f=()=>{i.value=!0,I({type:d.value,num:50}).then(c=>{g.value=c.topics,i.value=!1}).catch(c=>{console.log(c),i.value=!1})},v=c=>{d.value=c,c=="follow"?t.value=!0:t.value=!1,f()};return q(()=>{f()}),(c,h)=>{const y=ot,p=X,B=L,C=Z,V=it,M=tt,N=et,O=W;return l(),u("div",null,[n(y,{title:"话题"}),n(O,{class:"main-content-wrap tags-wrap",bordered:""},{default:a(()=>[n(C,{type:"line",animated:"","onUpdate:value":v},K({default:a(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),r(e).state.userLogined?(l(),T(p,{key:0,name:"follow",tab:"关注"})):m("",!0)]),_:2},[r(e).state.userLogined?{name:"suffix",fn:a(()=>[n(B,{checked:o.value,"onUpdate:checked":h[0]||(h[0]=b=>o.value=b),checkable:""},{default:a(()=>[A(w(r(k)),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(N,{show:i.value},{default:a(()=>[n(M,null,{default:a(()=>[(l(!0),u(Y,null,G(g.value,b=>(l(),T(V,{tag:b,showAction:r(e).state.userLogined&&o.value,checkFollowing:t.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Vt=j(_t,[["__scopeId","data-v-15794a53"]]);export{Vt as default};
|
||||
import{w as x,x as S,y as z,z as I,_ as j}from"./index-71354138.js";import{p as E}from"./@vicons-6d35273b.js";import{d as F,r as _,n as $,j as q,a1 as U,o as l,c as u,L as n,$ as a,K as T,e as A,M as w,O as m,Y as r,w as D,a6 as K,F as Y,a2 as G}from"./@vue-ca177dbe.js";import{o as H,M as L,j as J,e as P,O as Q,L as R,F as W,f as X,g as Z,a as tt,k as et}from"./naive-ui-2035804c.js";import{_ as ot}from"./main-nav.vue_vue_type_style_index_0_lang-5097b22a.js";import{u as nt}from"./vuex-d28e9067.js";import"./vue-router-88cc84d1.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-973e5707.js";import"./evtd-b614532e.js";import"./@css-render-480a363d.js";import"./vooks-2c48c2b5.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const st={key:0,class:"tag-item"},at={key:0,class:"tag-quote"},ct={key:1,class:"tag-quote tag-follow"},lt={key:0,class:"options"},it=F({__name:"tag-item",props:{tag:null,showAction:{type:Boolean},checkFollowing:{type:Boolean}},setup(s){const e=s,g=_(!1),d=$(()=>{let o=[];return e.tag.is_following===0?o.push({label:"关注",key:"follow"}):(e.tag.is_top===0?o.push({label:"置顶",key:"stick"}):o.push({label:"取消置顶",key:"unstick"}),o.push({label:"取消关注",key:"unfollow"})),o}),i=o=>{switch(o){case"follow":z({topic_id:e.tag.id}).then(t=>{e.tag.is_following=1,window.$message.success("关注成功")}).catch(t=>{console.log(t)});break;case"unfollow":S({topic_id:e.tag.id}).then(t=>{e.tag.is_following=0,window.$message.success("取消关注")}).catch(t=>{console.log(t)});break;case"stick":x({topic_id:e.tag.id}).then(t=>{e.tag.is_top=t.top_status,window.$message.success("置顶成功")}).catch(t=>{console.log(t)});break;case"unstick":x({topic_id:e.tag.id}).then(t=>{e.tag.is_top=t.top_status,window.$message.success("取消置顶")}).catch(t=>{console.log(t)});break}};return q(()=>{g.value=!1}),(o,t)=>{const k=U("router-link"),f=H,v=L,c=J,h=P,y=Q,p=R;return!s.checkFollowing||s.checkFollowing&&s.tag.is_following===1?(l(),u("div",st,[n(p,null,{header:a(()=>[(l(),T(v,{type:"success",size:"large",round:"",key:s.tag.id},{avatar:a(()=>[n(f,{src:s.tag.user.avatar},null,8,["src"])]),default:a(()=>[n(k,{class:"hash-link",to:{name:"home",query:{q:s.tag.tag,t:"tag"}}},{default:a(()=>[A(" #"+w(s.tag.tag),1)]),_:1},8,["to"]),s.showAction?m("",!0):(l(),u("span",at,"("+w(s.tag.quote_num)+")",1)),s.showAction?(l(),u("span",ct,"("+w(s.tag.quote_num)+")",1)):m("",!0)]),_:1}))]),"header-extra":a(()=>[s.showAction?(l(),u("div",lt,[n(y,{placement:"bottom-end",trigger:"click",size:"small",options:r(d),onSelect:i},{default:a(()=>[n(h,{type:"success",quaternary:"",circle:"",block:""},{icon:a(()=>[n(c,null,{default:a(()=>[n(r(E))]),_:1})]),_:1})]),_:1},8,["options"])])):m("",!0)]),_:1})])):m("",!0)}}});const _t=F({__name:"Topic",setup(s){const e=nt(),g=_([]),d=_("hot"),i=_(!1),o=_(!1),t=_(!1);D(o,()=>{o.value||(window.$message.success("保存成功"),e.commit("refreshTopicFollow"))});const k=$({get:()=>{let c="编辑";return o.value&&(c="保存"),c},set:c=>{}}),f=()=>{i.value=!0,I({type:d.value,num:50}).then(c=>{g.value=c.topics,i.value=!1}).catch(c=>{console.log(c),i.value=!1})},v=c=>{d.value=c,c=="follow"?t.value=!0:t.value=!1,f()};return q(()=>{f()}),(c,h)=>{const y=ot,p=X,B=L,C=Z,V=it,M=tt,N=et,O=W;return l(),u("div",null,[n(y,{title:"话题"}),n(O,{class:"main-content-wrap tags-wrap",bordered:""},{default:a(()=>[n(C,{type:"line",animated:"","onUpdate:value":v},K({default:a(()=>[n(p,{name:"hot",tab:"热门"}),n(p,{name:"new",tab:"最新"}),r(e).state.userLogined?(l(),T(p,{key:0,name:"follow",tab:"关注"})):m("",!0)]),_:2},[r(e).state.userLogined?{name:"suffix",fn:a(()=>[n(B,{checked:o.value,"onUpdate:checked":h[0]||(h[0]=b=>o.value=b),checkable:""},{default:a(()=>[A(w(r(k)),1)]),_:1},8,["checked"])]),key:"0"}:void 0]),1024),n(N,{show:i.value},{default:a(()=>[n(M,null,{default:a(()=>[(l(!0),u(Y,null,G(g.value,b=>(l(),T(V,{tag:b,showAction:r(e).state.userLogined&&o.value,checkFollowing:t.value},null,8,["tag","showAction","checkFollowing"]))),256))]),_:1})]),_:1},8,["show"])]),_:1})])}}});const Vt=j(_t,[["__scopeId","data-v-15794a53"]]);export{Vt as default};
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
import{t as p}from"./toggle-selection-93f4ad84.js";var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function y(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var m=p,f={"text/plain":"Text","text/html":"Url",default:"Text"},g="Copy to clipboard: #{key}, Enter";function b(a){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,t)}function w(a,t){var r,d,i,n,l,e,c=!1;t||(t={}),r=t.debug||!1;try{i=m(),n=document.createRange(),l=document.getSelection(),e=document.createElement("span"),e.textContent=a,e.ariaHidden="true",e.style.all="unset",e.style.position="fixed",e.style.top=0,e.style.clip="rect(0, 0, 0, 0)",e.style.whiteSpace="pre",e.style.webkitUserSelect="text",e.style.MozUserSelect="text",e.style.msUserSelect="text",e.style.userSelect="text",e.addEventListener("copy",function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),typeof o.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var s=f[t.format]||f.default;window.clipboardData.setData(s,a)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,a);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))}),document.body.appendChild(e),n.selectNodeContents(e),l.addRange(n);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(o){r&&console.error("unable to copy using execCommand: ",o),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",a),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(s){r&&console.error("unable to copy using clipboardData: ",s),r&&console.error("falling back to prompt"),d=b("message"in t?t.message:g),window.prompt(d,a)}}finally{l&&(typeof l.removeRange=="function"?l.removeRange(n):l.removeAllRanges()),e&&document.body.removeChild(e),i()}return c}var v=w;const h=y(v);export{h as a,C as c};
|
@ -1 +0,0 @@
|
||||
import{t as p}from"./toggle-selection-93f4ad84.js";var v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y=p,f={"text/plain":"Text","text/html":"Url",default:"Text"},m="Copy to clipboard: #{key}, Enter";function g(o){var a=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return o.replace(/#{\s*key\s*}/g,a)}function b(o,a){var r,i,d,n,l,e,c=!1;a||(a={}),r=a.debug||!1;try{d=y(),n=document.createRange(),l=document.getSelection(),e=document.createElement("span"),e.textContent=o,e.ariaHidden="true",e.style.all="unset",e.style.position="fixed",e.style.top=0,e.style.clip="rect(0, 0, 0, 0)",e.style.whiteSpace="pre",e.style.webkitUserSelect="text",e.style.MozUserSelect="text",e.style.msUserSelect="text",e.style.userSelect="text",e.addEventListener("copy",function(t){if(t.stopPropagation(),a.format)if(t.preventDefault(),typeof t.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var s=f[a.format]||f.default;window.clipboardData.setData(s,o)}else t.clipboardData.clearData(),t.clipboardData.setData(a.format,o);a.onCopy&&(t.preventDefault(),a.onCopy(t.clipboardData))}),document.body.appendChild(e),n.selectNodeContents(e),l.addRange(n);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(t){r&&console.error("unable to copy using execCommand: ",t),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(a.format||"text",o),a.onCopy&&a.onCopy(window.clipboardData),c=!0}catch(s){r&&console.error("unable to copy using clipboardData: ",s),r&&console.error("falling back to prompt"),i=g("message"in a?a.message:m),window.prompt(i,o)}}finally{l&&(typeof l.removeRange=="function"?l.removeRange(n):l.removeAllRanges()),e&&document.body.removeChild(e),d()}return c}var D=b;export{D as a,v as c};
|
@ -1 +0,0 @@
|
||||
var y={},x={get exports(){return y},set exports(f){y=f}};(function(f){var u={single_source_shortest_paths:function(o,e,t){var r={},n={};n[e]=0;var i=u.PriorityQueue.make();i.push(e,0);for(var p,c,s,h,_,v,a,d,l;!i.empty();){p=i.pop(),c=p.value,h=p.cost,_=o[c]||{};for(s in _)_.hasOwnProperty(s)&&(v=_[s],a=h+v,d=n[s],l=typeof n[s]>"u",(l||d>a)&&(n[s]=a,i.push(s,a),r[s]=c))}if(typeof t<"u"&&typeof n[t]>"u"){var m=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(m)}return r},extract_shortest_path_from_predecessor_list:function(o,e){for(var t=[],r=e;r;)t.push(r),o[r],r=o[r];return t.reverse(),t},find_path:function(o,e,t){var r=u.single_source_shortest_paths(o,e,t);return u.extract_shortest_path_from_predecessor_list(r,t)},PriorityQueue:{make:function(o){var e=u.PriorityQueue,t={},r;o=o||{};for(r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t.queue=[],t.sorter=o.sorter||e.default_sorter,t},default_sorter:function(o,e){return o.cost-e.cost},push:function(o,e){var t={value:o,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};f.exports=u})(x);export{y as d};
|
@ -0,0 +1 @@
|
||||
var l={exports:{}};(function(y){var u={single_source_shortest_paths:function(o,e,t){var r={},n={};n[e]=0;var i=u.PriorityQueue.make();i.push(e,0);for(var f,p,s,c,_,h,a,v,d;!i.empty();){f=i.pop(),p=f.value,c=f.cost,_=o[p]||{};for(s in _)_.hasOwnProperty(s)&&(h=_[s],a=c+h,v=n[s],d=typeof n[s]>"u",(d||v>a)&&(n[s]=a,i.push(s,a),r[s]=p))}if(typeof t<"u"&&typeof n[t]>"u"){var m=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(m)}return r},extract_shortest_path_from_predecessor_list:function(o,e){for(var t=[],r=e;r;)t.push(r),o[r],r=o[r];return t.reverse(),t},find_path:function(o,e,t){var r=u.single_source_shortest_paths(o,e,t);return u.extract_shortest_path_from_predecessor_list(r,t)},PriorityQueue:{make:function(o){var e=u.PriorityQueue,t={},r;o=o||{};for(r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t.queue=[],t.sorter=o.sorter||e.default_sorter,t},default_sorter:function(o,e){return o.cost-e.cost},push:function(o,e){var t={value:o,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};y.exports=u})(l);var x=l.exports;export{x as d};
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{Z as B}from"./index-f9e09224.js";import{u as E}from"./vuex-d28e9067.js";import{u as S}from"./vue-router-88cc84d1.js";import{j as A}from"./vooks-2c48c2b5.js";import{D as C,y as D,z as N,F as P}from"./@vicons-6d35273b.js";import{a3 as x,a4 as R,j as I,e as V,a5 as j,h as F}from"./naive-ui-2035804c.js";import{d as H,r as f,j as L,o as a,c as g,Y as o,L as e,$ as t,O as c,a as $,K as _,e as q,M as U,F as K}from"./@vue-ca177dbe.js";const Y={key:0},Z={class:"navbar"},oe=H({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(r){const i=r,n=E(),m=S(),l=f(!1),k=f("left"),u=d=>{d?(localStorage.setItem("PAOPAO_THEME","dark"),n.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),n.commit("triggerTheme","light"))},w=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return L(()=>{localStorage.getItem("PAOPAO_THEME")||u(A()==="dark")}),(d,p)=>{const y=B,b=x,O=R,s=I,h=V,M=j,T=F;return a(),g(K,null,[o(n).state.drawerModelShow?(a(),g("div",Y,[e(O,{show:l.value,"onUpdate:show":p[0]||(p[0]=z=>l.value=z),width:212,placement:k.value,resizable:""},{default:t(()=>[e(b,null,{default:t(()=>[e(y)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(T,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[$("div",Z,[o(n).state.drawerModelShow&&!r.back?(a(),_(h,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(s,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),r.back?(a(),_(h,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(s,null,{default:t(()=>[e(o(D))]),_:1})]),_:1})):c("",!0),q(" "+U(i.title)+" ",1),i.theme?(a(),_(M,{key:2,value:o(n).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(s,{component:o(N)},null,8,["component"])]),"unchecked-icon":t(()=>[e(s,{component:o(P)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};
|
||||
import{Z as B}from"./index-71354138.js";import{u as E}from"./vuex-d28e9067.js";import{u as S}from"./vue-router-88cc84d1.js";import{j as A}from"./vooks-2c48c2b5.js";import{D as C,y as D,z as N,F as P}from"./@vicons-6d35273b.js";import{a3 as x,a4 as R,j as I,e as V,a5 as j,h as F}from"./naive-ui-2035804c.js";import{d as H,r as f,j as L,o as a,c as g,Y as o,L as e,$ as t,O as c,a as $,K as _,e as q,M as U,F as K}from"./@vue-ca177dbe.js";const Y={key:0},Z={class:"navbar"},oe=H({__name:"main-nav",props:{title:{default:""},back:{type:Boolean,default:!1},theme:{type:Boolean,default:!0}},setup(r){const i=r,n=E(),m=S(),l=f(!1),k=f("left"),u=d=>{d?(localStorage.setItem("PAOPAO_THEME","dark"),n.commit("triggerTheme","dark")):(localStorage.setItem("PAOPAO_THEME","light"),n.commit("triggerTheme","light"))},w=()=>{window.history.length<=1?m.push({path:"/"}):m.go(-1)},v=()=>{l.value=!0};return L(()=>{localStorage.getItem("PAOPAO_THEME")||u(A()==="dark")}),(d,p)=>{const y=B,b=x,O=R,s=I,h=V,M=j,T=F;return a(),g(K,null,[o(n).state.drawerModelShow?(a(),g("div",Y,[e(O,{show:l.value,"onUpdate:show":p[0]||(p[0]=z=>l.value=z),width:212,placement:k.value,resizable:""},{default:t(()=>[e(b,null,{default:t(()=>[e(y)]),_:1})]),_:1},8,["show","placement"])])):c("",!0),e(T,{size:"small",bordered:!0,class:"nav-title-card"},{header:t(()=>[$("div",Z,[o(n).state.drawerModelShow&&!r.back?(a(),_(h,{key:0,class:"drawer-btn",onClick:v,quaternary:"",circle:"",size:"medium"},{icon:t(()=>[e(s,null,{default:t(()=>[e(o(C))]),_:1})]),_:1})):c("",!0),r.back?(a(),_(h,{key:1,class:"back-btn",onClick:w,quaternary:"",circle:"",size:"small"},{icon:t(()=>[e(s,null,{default:t(()=>[e(o(D))]),_:1})]),_:1})):c("",!0),q(" "+U(i.title)+" ",1),i.theme?(a(),_(M,{key:2,value:o(n).state.theme==="dark","onUpdate:value":u,size:"small",class:"theme-switch-wrap"},{"checked-icon":t(()=>[e(s,{component:o(N)},null,8,["component"])]),"unchecked-icon":t(()=>[e(s,{component:o(P)},null,8,["component"])]),_:1},8,["value"])):c("",!0)])]),_:1})],64)}}});export{oe as _};
|
@ -0,0 +1 @@
|
||||
import{p as D,a as F,_ as P,b as I,c as R}from"./content-3f1d28f2.js";import{d as A,n as x,a1 as E,o as a,c as u,L as i,a6 as K,Y as t,$ as n,a as l,F as Y,a2 as G,a0 as v,e as _,M as c,K as p,O as r}from"./@vue-ca177dbe.js";import{u as J}from"./vuex-d28e9067.js";import{b as Q,u as U}from"./vue-router-88cc84d1.js";import{b}from"./formatTime-000dbebb.js";import{a as W}from"./copy-to-clipboard-1dd3075d.js";import{i as X,j as Z,l as tt,m as et}from"./@vicons-6d35273b.js";import{o as st,M as ot,j as nt,e as at,O as it,a as rt,L as ct}from"./naive-ui-2035804c.js";const pt={class:"post-item"},lt={class:"nickname-wrap"},_t={class:"username-wrap"},mt={key:3},ut={class:"timestamp-mobile"},dt={class:"item-header-extra"},ht={key:0,class:"timestamp"},gt=["innerHTML"],kt={class:"opt-item"},ft={class:"opt-item"},Mt=A({__name:"post-item",props:{post:null},setup(C){const $=C;Q();const k=U(),d=J(),z=x(()=>[{label:"复制链接",key:"copyTweetLink"}]),M=o=>{switch(o){case"copyTweetLink":W(`${window.location.origin}/#/post?id=${e.value.id}`),window.$message.success("链接已复制到剪贴板");break}},e=x(()=>{let o=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},$.post);return o.contents.map(s=>{(+s.type==1||+s.type==2)&&o.texts.push(s),+s.type==3&&o.imgs.push(s),+s.type==4&&o.videos.push(s),+s.type==6&&o.links.push(s),+s.type==7&&o.attachments.push(s),+s.type==8&&o.charge_attachments.push(s)}),o}),f=o=>{k.push({name:"post",query:{id:o}})},T=(o,s)=>{if(o.target.dataset.detail){const m=o.target.dataset.detail.split(":");if(m.length===2){d.commit("refresh"),m[0]==="tag"?k.push({name:"home",query:{q:m[1],t:"tag"}}):k.push({name:"user",query:{username:m[1]}});return}}f(s)};return(o,s)=>{const m=st,L=E("router-link"),y=ot,h=nt,O=at,S=it,w=F,q=P,B=I,N=R,j=rt,H=ct;return a(),u("div",pt,[i(H,{"content-indented":""},K({avatar:n(()=>[i(m,{round:"",size:30,src:t(e).user.avatar},null,8,["src"])]),header:n(()=>[l("span",lt,[i(L,{onClick:s[0]||(s[0]=v(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:t(e).user.username}}},{default:n(()=>[_(c(t(e).user.nickname),1)]),_:1},8,["to"])]),l("span",_t," @"+c(t(e).user.username),1),t(e).is_top?(a(),p(y,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:n(()=>[_(" 置顶 ")]),_:1})):r("",!0),t(e).visibility==1?(a(),p(y,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:n(()=>[_(" 私密 ")]),_:1})):r("",!0),t(e).visibility==2?(a(),p(y,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:n(()=>[_(" 好友可见 ")]),_:1})):r("",!0),t(d).state.desktopModelShow?r("",!0):(a(),u("div",mt,[l("span",ut,c(t(b)(t(e).created_on))+" "+c(t(e).ip_loc),1)]))]),"header-extra":n(()=>[l("div",dt,[t(d).state.desktopModelShow?(a(),u("span",ht,c(t(e).ip_loc?t(e).ip_loc+" · ":t(e).ip_loc)+" "+c(t(b)(t(e).created_on)),1)):r("",!0),t(d).state.desktopModelShow?r("",!0):(a(),p(S,{key:1,placement:"bottom-end",trigger:"click",size:"small",options:t(z),onSelect:M},{default:n(()=>[i(O,{quaternary:"",circle:""},{icon:n(()=>[i(h,null,{default:n(()=>[i(t(X))]),_:1})]),_:1})]),_:1},8,["options"]))])]),footer:n(()=>[t(e).attachments.length>0?(a(),p(w,{key:0,attachments:t(e).attachments},null,8,["attachments"])):r("",!0),t(e).charge_attachments.length>0?(a(),p(w,{key:1,attachments:t(e).charge_attachments,price:t(e).attachment_price},null,8,["attachments","price"])):r("",!0),t(e).imgs.length>0?(a(),p(q,{key:2,imgs:t(e).imgs},null,8,["imgs"])):r("",!0),t(e).videos.length>0?(a(),p(B,{key:3,videos:t(e).videos},null,8,["videos"])):r("",!0),t(e).links.length>0?(a(),p(N,{key:4,links:t(e).links},null,8,["links"])):r("",!0)]),action:n(()=>[i(j,{justify:"space-between"},{default:n(()=>[l("div",kt,[i(h,{size:"18",class:"opt-item-icon"},{default:n(()=>[i(t(Z))]),_:1}),_(" "+c(t(e).upvote_count),1)]),l("div",{class:"opt-item",onClick:s[3]||(s[3]=v(g=>f(t(e).id),["stop"]))},[i(h,{size:"18",class:"opt-item-icon"},{default:n(()=>[i(t(tt))]),_:1}),_(" "+c(t(e).comment_count),1)]),l("div",ft,[i(h,{size:"18",class:"opt-item-icon"},{default:n(()=>[i(t(et))]),_:1}),_(" "+c(t(e).collection_count),1)])]),_:1})]),_:2},[t(e).texts.length>0?{name:"description",fn:n(()=>[l("div",{onClick:s[2]||(s[2]=g=>f(t(e).id))},[(a(!0),u(Y,null,G(t(e).texts,g=>(a(),u("span",{key:g.id,class:"post-text",onClick:s[1]||(s[1]=v(V=>T(V,t(e).id),["stop"])),innerHTML:t(D)(g.content).content},null,8,gt))),128))])]),key:"0"}:void 0]),1024)])}}});export{Mt as _};
|
@ -1 +0,0 @@
|
||||
import{p as D,a as F,_ as P,b as I,c as R}from"./content-a3ccbaf1.js";import{d as A,n as b,a1 as E,o as a,c as u,L as i,a6 as K,Y as t,$ as n,a as l,F as Y,a2 as G,a0 as v,e as _,M as c,K as p,O as r}from"./@vue-ca177dbe.js";import{u as J}from"./vuex-d28e9067.js";import{b as Q,u as U}from"./vue-router-88cc84d1.js";import{b as x}from"./formatTime-000dbebb.js";import{a as W}from"./copy-to-clipboard-ca358197.js";import{i as X,j as Z,l as tt,m as et}from"./@vicons-6d35273b.js";import{o as st,M as ot,j as nt,e as at,O as it,a as rt,L as ct}from"./naive-ui-2035804c.js";const pt={class:"post-item"},lt={class:"nickname-wrap"},_t={class:"username-wrap"},mt={key:3},ut={class:"timestamp-mobile"},dt={class:"item-header-extra"},ht={key:0,class:"timestamp"},gt=["innerHTML"],kt={class:"opt-item"},ft={class:"opt-item"},Mt=A({__name:"post-item",props:{post:null},setup(C){const $=C;Q();const k=U(),d=J(),z=b(()=>[{label:"复制链接",key:"copyTweetLink"}]),M=o=>{switch(o){case"copyTweetLink":W(`${window.location.origin}/#/post?id=${e.value.id}`),window.$message.success("链接已复制到剪贴板");break}},e=b(()=>{let o=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},$.post);return o.contents.map(s=>{(+s.type==1||+s.type==2)&&o.texts.push(s),+s.type==3&&o.imgs.push(s),+s.type==4&&o.videos.push(s),+s.type==6&&o.links.push(s),+s.type==7&&o.attachments.push(s),+s.type==8&&o.charge_attachments.push(s)}),o}),f=o=>{k.push({name:"post",query:{id:o}})},T=(o,s)=>{if(o.target.dataset.detail){const m=o.target.dataset.detail.split(":");if(m.length===2){d.commit("refresh"),m[0]==="tag"?k.push({name:"home",query:{q:m[1],t:"tag"}}):k.push({name:"user",query:{username:m[1]}});return}}f(s)};return(o,s)=>{const m=st,L=E("router-link"),y=ot,h=nt,O=at,S=it,w=F,q=P,B=I,N=R,j=rt,H=ct;return a(),u("div",pt,[i(H,{"content-indented":""},K({avatar:n(()=>[i(m,{round:"",size:30,src:t(e).user.avatar},null,8,["src"])]),header:n(()=>[l("span",lt,[i(L,{onClick:s[0]||(s[0]=v(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{username:t(e).user.username}}},{default:n(()=>[_(c(t(e).user.nickname),1)]),_:1},8,["to"])]),l("span",_t," @"+c(t(e).user.username),1),t(e).is_top?(a(),p(y,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:n(()=>[_(" 置顶 ")]),_:1})):r("",!0),t(e).visibility==1?(a(),p(y,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:n(()=>[_(" 私密 ")]),_:1})):r("",!0),t(e).visibility==2?(a(),p(y,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:n(()=>[_(" 好友可见 ")]),_:1})):r("",!0),t(d).state.desktopModelShow?r("",!0):(a(),u("div",mt,[l("span",ut,c(t(x)(t(e).created_on))+" "+c(t(e).ip_loc),1)]))]),"header-extra":n(()=>[l("div",dt,[t(d).state.desktopModelShow?(a(),u("span",ht,c(t(e).ip_loc?t(e).ip_loc+" · ":t(e).ip_loc)+" "+c(t(x)(t(e).created_on)),1)):r("",!0),t(d).state.desktopModelShow?r("",!0):(a(),p(S,{key:1,placement:"bottom-end",trigger:"click",size:"small",options:t(z),onSelect:M},{default:n(()=>[i(O,{quaternary:"",circle:""},{icon:n(()=>[i(h,null,{default:n(()=>[i(t(X))]),_:1})]),_:1})]),_:1},8,["options"]))])]),footer:n(()=>[t(e).attachments.length>0?(a(),p(w,{key:0,attachments:t(e).attachments},null,8,["attachments"])):r("",!0),t(e).charge_attachments.length>0?(a(),p(w,{key:1,attachments:t(e).charge_attachments,price:t(e).attachment_price},null,8,["attachments","price"])):r("",!0),t(e).imgs.length>0?(a(),p(q,{key:2,imgs:t(e).imgs},null,8,["imgs"])):r("",!0),t(e).videos.length>0?(a(),p(B,{key:3,videos:t(e).videos},null,8,["videos"])):r("",!0),t(e).links.length>0?(a(),p(N,{key:4,links:t(e).links},null,8,["links"])):r("",!0)]),action:n(()=>[i(j,{justify:"space-between"},{default:n(()=>[l("div",kt,[i(h,{size:"18",class:"opt-item-icon"},{default:n(()=>[i(t(Z))]),_:1}),_(" "+c(t(e).upvote_count),1)]),l("div",{class:"opt-item",onClick:s[3]||(s[3]=v(g=>f(t(e).id),["stop"]))},[i(h,{size:"18",class:"opt-item-icon"},{default:n(()=>[i(t(tt))]),_:1}),_(" "+c(t(e).comment_count),1)]),l("div",ft,[i(h,{size:"18",class:"opt-item-icon"},{default:n(()=>[i(t(et))]),_:1}),_(" "+c(t(e).collection_count),1)])]),_:1})]),_:2},[t(e).texts.length>0?{name:"description",fn:n(()=>[l("div",{onClick:s[2]||(s[2]=g=>f(t(e).id))},[(a(!0),u(Y,null,G(t(e).texts,g=>(a(),u("span",{key:g.id,class:"post-text",onClick:s[1]||(s[1]=v(V=>T(V,t(e).id),["stop"])),innerHTML:t(D)(g.content).content},null,8,gt))),128))])]),key:"0"}:void 0]),1024)])}}});export{Mt as _};
|
@ -1 +1 @@
|
||||
import{U as c}from"./naive-ui-2035804c.js";import{d as r,o as s,c as n,a2 as l,a as o,L as t,F as p}from"./@vue-ca177dbe.js";import{_ as i}from"./index-f9e09224.js";const m={class:"user"},d={class:"content"},u=r({__name:"post-skeleton",props:{num:{default:1}},setup(_){return(f,k)=>{const e=c;return s(!0),n(p,null,l(new Array(_.num),a=>(s(),n("div",{class:"skeleton-item",key:a},[o("div",m,[t(e,{circle:"",size:"small"})]),o("div",d,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(u,[["__scopeId","data-v-ab0015b4"]]);export{b as _};
|
||||
import{U as c}from"./naive-ui-2035804c.js";import{d as r,o as s,c as n,a2 as l,a as o,L as t,F as p}from"./@vue-ca177dbe.js";import{_ as i}from"./index-71354138.js";const m={class:"user"},d={class:"content"},u=r({__name:"post-skeleton",props:{num:{default:1}},setup(_){return(f,k)=>{const e=c;return s(!0),n(p,null,l(new Array(_.num),a=>(s(),n("div",{class:"skeleton-item",key:a},[o("div",m,[t(e,{circle:"",size:"small"})]),o("div",d,[t(e,{text:"",repeat:3}),t(e,{text:"",style:{width:"60%"}})])]))),128)}}});const b=i(u,[["__scopeId","data-v-ab0015b4"]]);export{b as _};
|
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue