Merge pull request #44 from rymcu/format

Format
This commit is contained in:
ronger 2022-10-11 08:21:14 +08:00 committed by GitHub
commit 53e6fef3a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 676 additions and 678 deletions

View File

@ -1,21 +1,21 @@
<template>
<el-row class="pt-5">
<el-col>
<el-col v-if="user" style="margin-top: 1rem;">
<el-col :xs="2" :sm="1" :xl="1">
<el-col style="margin-top: 1rem;" v-if="user">
<el-col :sm="1" :xl="1" :xs="2">
<el-avatar :src="avatar"></el-avatar>
</el-col>
<el-col :xs="22" :sm="23" :xl="23" style="padding-left: 1rem;">
<el-col :sm="23" :xl="23" :xs="22" style="padding-left: 1rem;">
<el-input @click.native="showComment" placeholder="请输入回帖内容"></el-input>
</el-col>
<el-col>
<el-drawer
:visible.sync="drawer"
:direction="direction"
:visible.sync="drawer"
size="50%">
<el-col slot="title">
<el-col>
<el-avatar v-show="commentAuthorAvatar" :src="commentAuthorAvatar"></el-avatar>
<el-avatar :src="commentAuthorAvatar" v-show="commentAuthorAvatar"></el-avatar>
<span class="text-default" style="padding-left: 1rem;">{{ commentTitle }}</span>
</el-col>
</el-col>
@ -23,53 +23,53 @@
<div id="contentEditor"></div>
</el-col>
<el-col style="margin-top: 1rem;padding-right:3rem;text-align: right;">
<el-button type="primary" :loading="loading" @click="postComment" plain>发布</el-button>
<el-button :loading="loading" @click="postComment" plain type="primary">发布</el-button>
</el-col>
</el-drawer>
</el-col>
</el-col>
<el-col v-else class="text-center" style="margin-top: 1rem;">
<el-button type="primary" size="medium" @click="gotoLogin" plain>登录</el-button>
<el-col class="text-center" style="margin-top: 1rem;" v-else>
<el-button @click="gotoLogin" plain size="medium" type="primary">登录</el-button>
后发布评论
</el-col>
<el-col>
<el-col v-for="comment in comment.data" :key="comment.idComment">
<el-card style="margin-top: 1rem;" :id="'comment-' + comment.idComment">
<el-col :xs="3" :sm="1" :xl="1">
<el-avatar v-show="comment.commenter.userAvatarURL" :src="comment.commenter.userAvatarURL"></el-avatar>
<el-avatar v-show="!comment.commenter.userAvatarURL"
src="https://static.rymcu.com/article/1578475481946.png"></el-avatar>
<el-col :key="comment.idComment" v-for="comment in comment.data">
<el-card :id="'comment-' + comment.idComment" style="margin-top: 1rem;">
<el-col :sm="1" :xl="1" :xs="3">
<el-avatar :src="comment.commenter.userAvatarURL" v-show="comment.commenter.userAvatarURL"></el-avatar>
<el-avatar src="https://static.rymcu.com/article/1578475481946.png"
v-show="!comment.commenter.userAvatarURL"></el-avatar>
</el-col>
<el-col :xs="21" :sm="23" :xl="23" style="padding-bottom: 10px;" v-if="comment.commentStatus === '0'">
<el-col :sm="23" :xl="23" :xs="21" style="padding-bottom: 10px;" v-if="comment.commentStatus === '0'">
<el-col style="margin-left: 1rem;">
<el-col v-show="comment.commentOriginalCommentId">
<el-col :span="16">
<el-link rel="nofollow" @click="onRouter('user', comment.commenter.userAccount)" :underline="false"
class="text-default">{{ comment.commenter.userNickname }}
<el-link :underline="false" @click="onRouter('user', comment.commenter.userAccount)" class="text-default"
rel="nofollow">{{ comment.commenter.userNickname }}
</el-link>
<small class="text-default" style="margin: 0 0.2rem">回复了</small><span
style="font-weight: bold;"> {{ comment.commentOriginalAuthorNickname }}</span>
</el-col>
<el-col :span="8" class="text-right" style="padding-right: 1rem;">
<el-link rel="nofollow" :underline="false" title="查看原评论"
@click.native="toggleShowOriginalComment(comment.commentOriginalCommentId)"><i
<el-link :underline="false" @click.native="toggleShowOriginalComment(comment.commentOriginalCommentId)" rel="nofollow"
title="查看原评论"><i
class="el-icon-reading"></i> 查看原评论
</el-link>
<el-tag v-show="isAuthor(comment.commentAuthorId)" size="mini" effect="plain"
style="margin-left: 5px;">
<el-tag effect="plain" size="mini" style="margin-left: 5px;"
v-show="isAuthor(comment.commentAuthorId)">
作者
</el-tag>
</el-col>
</el-col>
<el-col v-show="!comment.commentOriginalCommentId">
<el-col :span="16">
<el-link rel="nofollow" @click="onRouter('user', comment.commenter.userAccount)" :underline="false"
class="text-default">{{ comment.commenter.userNickname }}
<el-link :underline="false" @click="onRouter('user', comment.commenter.userAccount)" class="text-default"
rel="nofollow">{{ comment.commenter.userNickname }}
</el-link>
</el-col>
<el-col :span="8" class="text-right" style="padding-right: 1rem;">
<el-tag v-show="isAuthor(comment.commentAuthorId)" size="mini" effect="plain"
style="margin-left: 5px;">
<el-tag effect="plain" size="mini" style="margin-left: 5px;"
v-show="isAuthor(comment.commentAuthorId)">
作者
</el-tag>
</el-col>
@ -81,24 +81,24 @@
</el-col>
</el-col>
<el-col :span="16" style="padding-left: 1rem;">
<el-link rel="nofollow" :underline="false" class="text-default">{{ comment.timeAgo }}</el-link>
<el-link :underline="false" class="text-default" rel="nofollow">{{ comment.timeAgo }}</el-link>
</el-col>
<el-col :span="8" v-if="user" class="text-right" style="margin-bottom: 0.5rem;">
<el-link rel="nofollow" :underline="false" title="评论" @click.native="replyComment(comment)"><i
<el-col :span="8" class="text-right" style="margin-bottom: 0.5rem;" v-if="user">
<el-link :underline="false" @click.native="replyComment(comment)" rel="nofollow" title="评论"><i
class="el-icon-s-comment"></i> 评论
</el-link>
</el-col>
</el-col>
<el-col :xs="21" :sm="23" :xl="23" style="padding-bottom: 10px;" v-else>
<el-col :sm="23" :xl="23" :xs="21" style="padding-bottom: 10px;" v-else>
<el-col style="margin-left: 1rem;">
<el-col :span="16">
<el-link rel="nofollow" @click="onRouter('user', comment.commenter.userAccount)" :underline="false"
class="text-default">{{ comment.commenter.userNickname }}
<el-link :underline="false" @click="onRouter('user', comment.commenter.userAccount)" class="text-default"
rel="nofollow">{{ comment.commenter.userNickname }}
</el-link>
</el-col>
<el-col :span="8" class="text-right" style="padding-right: 1rem;">
<el-tag v-show="isAuthor(comment.commentAuthorId)" size="mini" effect="plain"
style="margin-left: 5px;">
<el-tag effect="plain" size="mini" style="margin-left: 5px;"
v-show="isAuthor(comment.commentAuthorId)">
作者
</el-tag>
</el-col>
@ -111,18 +111,18 @@
</el-col>
</el-col>
<el-col :span="16" style="padding-left: 1rem;">
<el-link rel="nofollow" :underline="false" class="text-default">{{ comment.timeAgo }}</el-link>
<el-link :underline="false" class="text-default" rel="nofollow">{{ comment.timeAgo }}</el-link>
</el-col>
</el-col>
</el-card>
<el-col :id="'original-' + comment.commentOriginalCommentId" style="background-color: #d9d9d9;padding-left: 1.5rem;
margin-top: 0.3rem;border-radius: 0.5rem;cursor: pointer;display: none;">
<el-col v-show="comment.commentOriginalCommentId" :span="2">
<el-col :span="2" v-show="comment.commentOriginalCommentId">
<p>
<span>{{ comment.commentOriginalAuthorNickname }} :</span>
</p>
</el-col>
<el-col v-show="comment.commentOriginalCommentId" :span="20">
<el-col :span="20" v-show="comment.commentOriginalCommentId">
<div class="vditor-reset comment-content" v-html="comment.commentOriginalContent"></div>
</el-col>
</el-col>
@ -133,11 +133,11 @@
</template>
<script>
import Vue from 'vue';
import {mapState} from 'vuex';
import apiConfig from '~/config/api.config';
import Vue from 'vue';
import {mapState} from 'vuex';
import apiConfig from '~/config/api.config';
export default {
export default {
name: "Comment",
props: {
fetching: {
@ -404,9 +404,9 @@ export default {
Vue.nextTick(function () {
//
const previewElements = document.getElementsByClassName("comment-content");
if (previewElements) {
if (previewElements && previewElements.length > 0) {
for (let i in previewElements) {
const previewElement = previewElements[i];
let previewElement = previewElements[i];
Vue.VditorPreview.codeRender(previewElement, 'zh_CN');
Vue.VditorPreview.highlightRender({
"enable": true,
@ -456,7 +456,7 @@ export default {
destroyed() {
this.$store.commit('comment/clearListData')
}
}
}
</script>
<style scoped>

View File

@ -1,16 +1,15 @@
<template>
<el-row justify="space-between" type="flex">
<el-col>
<el-col :xs="8" :sm="4" :md="4" :xl="3" style="padding-top: .5rem;text-align: left;">
<a rel="nofollow" class="navbar-brand" href="/">
<img src="@/assets/rymcu.png" alt="RYMCU" class="navbar-brand-img">
<el-row :gutter="20" justify="space-between" type="flex">
<el-col :md="4" :span="4" :xs="8">
<a class="navbar-brand" href="/" rel="nofollow">
<img alt="RYMCU" class="navbar-brand-img" src="@/assets/rymcu.png">
</a>
</el-col>
<el-col :xs="0" :sm="8" :md="8" :xl="12" style="text-align: center;">
<el-row type="flex" justify="center">
<el-col>
<el-menu :default-active="activeMenu" style="margin-top: -2px;border: 0;" mode="horizontal"
@select="handleSelectMenu">
<el-col :md="14" :span="10" :xs="0" style="max-height: 58px;overflow: hidden">
<el-menu :default-active="activeMenu" @select="handleSelectMenu" mode="horizontal"
style="margin-top: -2px;border: 0;">
<el-menu-item index="index">首页</el-menu-item>
<el-menu-item index="topic">专题</el-menu-item>
<el-menu-item index="portfolios">作品集</el-menu-item>
@ -18,22 +17,21 @@
<el-menu-item index="open-data">开放数据</el-menu-item>
</el-menu>
</el-col>
</el-row>
</el-col>
<el-col :xs="16" :sm="12" :md="12" :xl="9" style="padding-top: 1rem;">
<el-col :md="10" :span="10" :xs="16" style="line-height: 60px">
<client-only>
<el-col v-if="user" style="text-align: right;">
<el-col style="text-align: right;" v-if="user">
<el-popover
@show="handleShowPopover"
placement="bottom"
width="400"
trigger="click"
v-model="showPopover"
@show="handleShowPopover">
<el-input name="searchInput" v-model="queryString" @keyup.enter.native="querySearchAsync"
placeholder="搜索文章,作品集,用户">
<el-button slot="append" @click="querySearchAsync">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
style="fill: rgba(0, 0, 0, 1);">
width="400">
<el-input @keyup.enter.native="querySearchAsync" name="searchInput" placeholder="搜索文章,作品集,用户"
v-model="queryString">
<el-button @click="querySearchAsync" slot="append">
<svg height="24" style="fill: rgba(0, 0, 0, 1);" viewBox="0 0 24 24" width="24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"></path>
<path
@ -41,9 +39,9 @@
</svg>
</el-button>
</el-input>
<el-button slot="reference" circle size="small">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24"
style="fill: rgba(0, 0, 0, 1);">
<el-button circle size="small" slot="reference">
<svg height="14" style="fill: rgba(0, 0, 0, 1);" viewBox="0 0 24 24" width="14"
xmlns="http://www.w3.org/2000/svg">
<path
d="M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"></path>
<path
@ -51,42 +49,43 @@
</svg>
</el-button>
</el-popover>
<el-link rel="nofollow" :underline="false" style="padding-left: 10px;padding-right: 10px;"
href="/portfolio/post">创建作品集
<el-link :underline="false" href="/portfolio/post" rel="nofollow"
style="padding-left: 10px;padding-right: 10px;">创建作品集
</el-link>
<el-link rel="nofollow" :underline="false" style="padding-left: 10px;padding-right: 10px;"
href="/article/post">发帖
<el-link :underline="false" href="/article/post" rel="nofollow"
style="padding-left: 10px;padding-right: 10px;">发帖
</el-link>
<el-link rel="nofollow" :underline="false" style="padding-left: 10px;padding-right: 10px;">
<el-dropdown trigger="click" @command="handleCommand">
<el-link :underline="false" rel="nofollow" style="padding-left: 10px;padding-right: 10px;">
<el-dropdown @command="handleCommand" trigger="click">
<el-badge :value="notificationNumbers" class="item">
<el-link rel="nofollow" :underline="false" style="font-size: 1.4rem;">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
style="fill: rgba(0, 0, 0, 1);">
<el-link :underline="false" rel="nofollow" style="font-size: 1.4rem;">
<svg height="24" style="fill: rgba(0, 0, 0, 1);" viewBox="0 0 24 24" width="24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M19 13.586V10c0-3.217-2.185-5.927-5.145-6.742C13.562 2.52 12.846 2 12 2s-1.562.52-1.855 1.258C7.185 4.074 5 6.783 5 10v3.586l-1.707 1.707A.996.996 0 0 0 3 16v2a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1v-2a.996.996 0 0 0-.293-.707L19 13.586zM19 17H5v-.586l1.707-1.707A.996.996 0 0 0 7 14v-4c0-2.757 2.243-5 5-5s5 2.243 5 5v4c0 .266.105.52.293.707L19 16.414V17zm-7 5a2.98 2.98 0 0 0 2.818-2H9.182A2.98 2.98 0 0 0 12 22z"></path>
</svg>
</el-link>
</el-badge>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="notification in notifications" :key="notification.idNotification"
command="notification">{{ notification.dataSummary }}
<el-dropdown-item :key="notification.idNotification" command="notification"
v-for="notification in notifications">{{ notification.dataSummary }}
</el-dropdown-item>
<el-dropdown-item command="notification">查看所有消息</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-link>
<el-link rel="nofollow" :underline="false" style="margin-left: 10px;">
<el-dropdown trigger="click" @command="handleCommand">
<el-avatar v-if="avatarURL" size="small" :src="avatarURL"></el-avatar>
<el-avatar v-else size="small" src="https://static.rymcu.com/article/1578475481946.png"></el-avatar>
<el-link :underline="false" rel="nofollow" style="margin-left: 10px;">
<el-dropdown @command="handleCommand" trigger="click">
<el-avatar :src="avatarURL" size="small" v-if="avatarURL"></el-avatar>
<el-avatar size="small" src="https://static.rymcu.com/article/1578475481946.png" v-else></el-avatar>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item style="align-items: center;">
<el-avatar class="mr-3" v-if="avatarURL" size="small" style="margin-top: 1rem;"
:src="avatarURL"></el-avatar>
<el-avatar class="mr-3" v-else size="small" style="margin-top: 1rem;"
src="https://static.rymcu.com/article/1578475481946.png"></el-avatar>
<el-link rel="nofollow" :underline="false" style="margin-left: 10px;margin-bottom: 1rem;">
<el-avatar :src="avatarURL" class="mr-3" size="small" style="margin-top: 1rem;"
v-if="avatarURL"></el-avatar>
<el-avatar class="mr-3" size="small" src="https://static.rymcu.com/article/1578475481946.png"
style="margin-top: 1rem;"
v-else></el-avatar>
<el-link :underline="false" rel="nofollow" style="margin-left: 10px;margin-bottom: 1rem;">
{{ nickname }}
</el-link>
</el-dropdown-item>
@ -95,24 +94,24 @@
<el-dropdown-item command="drafts" divided>我的草稿</el-dropdown-item>
<el-dropdown-item command="wallet">我的钱包</el-dropdown-item>
<el-dropdown-item command="user-info" divided>设置</el-dropdown-item>
<el-dropdown-item v-if="hasPermissions" command="admin-dashboard">系统管理</el-dropdown-item>
<el-dropdown-item command="admin-dashboard" v-if="hasPermissions">系统管理</el-dropdown-item>
<el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-link>
</el-col>
<el-col v-else style="text-align: right;">
<el-col style="text-align: right;" v-else>
<el-popover
@show="handleShowPopover"
placement="bottom"
width="400"
trigger="click"
v-model="showPopover"
@show="handleShowPopover">
<el-input name="searchInput" v-model="queryString" @keyup.enter.native="querySearchAsync"
placeholder="搜索文章,作品集,用户">
<el-button slot="append" @click="querySearchAsync">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
style="fill: rgba(0, 0, 0, 1);">
width="400">
<el-input @keyup.enter.native="querySearchAsync" name="searchInput" placeholder="搜索文章,作品集,用户"
v-model="queryString">
<el-button @click="querySearchAsync" slot="append">
<svg height="24" style="fill: rgba(0, 0, 0, 1);" viewBox="0 0 24 24" width="24"
xmlns="http://www.w3.org/2000/svg">
<path
d="M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"></path>
<path
@ -120,9 +119,9 @@
</svg>
</el-button>
</el-input>
<el-button slot="reference" circle size="small">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24"
style="fill: rgba(0, 0, 0, 1);">
<el-button circle size="small" slot="reference">
<svg height="14" style="fill: rgba(0, 0, 0, 1);" viewBox="0 0 24 24" width="14"
xmlns="http://www.w3.org/2000/svg">
<path
d="M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"></path>
<path
@ -130,22 +129,21 @@
</svg>
</el-button>
</el-popover>
<el-link rel="nofollow" :underline="false" style="margin-left: 10px;" @click="login">登录</el-link>
<el-link href="/register" rel="nofollow" :underline="false" style="margin-left: 10px;">注册</el-link>
<el-link :underline="false" @click="login" rel="nofollow" style="margin-left: 10px;">登录</el-link>
<el-link :underline="false" href="/register" rel="nofollow" style="margin-left: 10px;">注册</el-link>
</el-col>
</client-only>
</el-col>
</el-col>
</el-row>
</template>
<script>
import {mapState} from 'vuex';
import {isBrowser} from '~/environment';
// import sockClient from '~/plugins/sockjs';
import {mapState} from 'vuex';
import {isBrowser} from '~/environment';
// import sockClient from '~/plugins/sockjs';
const Cookie = process.client ? require('js-cookie') : undefined
export default {
const Cookie = process.client ? require('js-cookie') : undefined
export default {
name: "PcHeader",
computed: {
...mapState({
@ -313,14 +311,14 @@ export default {
ctx.font = "14px 'Arial'";
ctx.textBaseline = "rymcu";
ctx.fillStyle = "#f60";
ctx.fillRect(125,1,62,20);
ctx.fillRect(125, 1, 62, 20);
ctx.fillStyle = "#069";
ctx.fillText(txt, 2, 15);
ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
ctx.fillText(txt, 4, 17);
let b64 = canvas.toDataURL().replace("data:image/png;base64,","");
let b64 = canvas.toDataURL().replace("data:image/png;base64,", "");
let bin = atob(b64);
let fingerprint = _ts.bin2hex(bin.slice(-16,-12));
let fingerprint = _ts.bin2hex(bin.slice(-16, -12));
_ts.$store.commit('setFingerprint', fingerprint);
},
bin2hex(str) {
@ -358,11 +356,11 @@ export default {
}
}
}
}
</script>
<style scoped>
.navbar-brand {
.navbar-brand {
color: inherit;
margin-right: 1rem;
font-size: 1.25rem;
@ -371,20 +369,20 @@ export default {
padding: 0;
transition: .3s opacity;
line-height: 3rem;
}
}
.navbar-brand-img {
.navbar-brand-img {
height: 3rem;
line-height: 3rem;
vertical-align: top;
width: auto;
}
}
.search-result-box {
.search-result-box {
min-width: 20vw !important;
}
}
.search-result-type {
.search-result-type {
padding-right: 5px;
}
}
</style>