From cb7779098c51922d0d7f26568475d350a9f1fad0 Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Fri, 29 Jul 2022 19:08:22 +0800 Subject: [PATCH] 添加马甲认证,添加小红点更新 --- src/components/group/MyPreviewModal.vue | 2 src/assets/md.less | 2 src/components/mini/box13-reply.vue | 108 +++++++++++++++++++++++++++-------- src/components/fixed/footer.vue | 11 ++- src/components/mini/box-new-article.vue | 16 +++++ src/components/mini/tagInfo.vue | 10 +++ 6 files changed, 116 insertions(+), 33 deletions(-) diff --git a/src/assets/md.less b/src/assets/md.less index 42e1bda..13112e0 100644 --- a/src/assets/md.less +++ b/src/assets/md.less @@ -150,7 +150,7 @@ width: 390px; } blockquote { - border-left:.5em solid #eee; + border-left:.5em solid #cfcfcf; padding: 0 0 0 2em; margin-left:0; } diff --git a/src/components/fixed/footer.vue b/src/components/fixed/footer.vue index cfb2d40..f1ae58d 100644 --- a/src/components/fixed/footer.vue +++ b/src/components/fixed/footer.vue @@ -20,9 +20,14 @@ </template> <script> - document.write(unescape( - "%3Cspan id='cnzz_stat_icon_1276380514'%3E%3C/span%3E%3Cscript src='https://s23.cnzz.com/z_stat.php%3Fid%3D1276380514%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E" - )); + var _hmt = _hmt || []; + (function() { + var hm = document.createElement("script"); + hm.src = "https://hm.baidu.com/hm.js?7ec680274146b33760c579b79dfb8f7c"; + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(hm, s); + })(); + export default { data() { return { diff --git a/src/components/group/MyPreviewModal.vue b/src/components/group/MyPreviewModal.vue index 21fad6f..5800fd0 100644 --- a/src/components/group/MyPreviewModal.vue +++ b/src/components/group/MyPreviewModal.vue @@ -18,7 +18,7 @@ import VueMarkdown from 'vue-markdown' - import md5 from 'js-md5'; + //import md5 from 'js-md5'; export default { components: { VueMarkdown diff --git a/src/components/mini/box-new-article.vue b/src/components/mini/box-new-article.vue index 0d9e24b..b06bece 100644 --- a/src/components/mini/box-new-article.vue +++ b/src/components/mini/box-new-article.vue @@ -22,6 +22,7 @@ <a-icon type="lock" style="color:rgba(0,0,0,.25)" v-if="authStatus==3" /> <a-icon type="stop" style="color:rgba(0,0,0,.25)" v-if="authStatus==2" /> {{title}} + <a-badge :count="1" dot v-if="isAnyUpdate==1" title="最近有更新"></a-badge> </router-link> <!-- <a class="article-title" href="/mdDetail" :title="title"> {{title}}</a> --> <div class="article-meta-wrap" style="display: flex;"> @@ -49,7 +50,14 @@ </template> <script> + import { + NotificationOutlined + } from '@ant-design/icons-vue'; + export default { + components: { + NotificationOutlined + }, props: { "index": { default: 0, @@ -78,13 +86,19 @@ "publishDate": { default: "", }, + "updateDate": { + default: "", + }, "coverFileURL": { + default: "", + }, + "isAnyUpdate": { default: "", } }, data() { return { - img404: "this.onerror='';this.src=\"https://unpkg.zhimg.com/ahzo@1.0.3/blogpic/1.jpg\"", + img404: "this.onerror='';this.src=\"http://t.inleft.com/share/media_photo/1.jpg\"", } } } diff --git a/src/components/mini/box13-reply.vue b/src/components/mini/box13-reply.vue index 17a3f63..4b2c896 100644 --- a/src/components/mini/box13-reply.vue +++ b/src/components/mini/box13-reply.vue @@ -8,14 +8,20 @@ </a-input> </a-form-model-item> <a-form-model-item label="邮箱" prop="eMail"> - <a-input v-model="form.eMail" placeholder="保密项(非必填)"> + <a-input v-model="form.eMail" placeholder="保密项(选填)"> </a-input> </a-form-model-item> <a-form-model-item label="主页" prop="homePage"> <a-input v-model="form.homePage" placeholder="https:// or http://"> </a-input> </a-form-model-item> - + <a-form-model-item label="马甲认证" + v-show="form.nickName=='inleft'||form.nickName=='笔墨'||form.nickName=='阿墨'"> + <a-input-password v-model="form.authCode" autocomplete='new-password' type="password" + placeholder="我的授权码"> + <a-icon slot="prefix" type="lock" style="color:rgba(0,0,0,.25)" /> + </a-input-password> + </a-form-model-item> </a-form-model> </div> <div class="replyMsgInfo" v-if="showReplyMsgInfo"> @@ -31,23 +37,23 @@ <a-textarea :rows="4" v-model="form.visitorContent" :placeholder="replyHolder" /> </a-form-item> <div> - <a-button html-type="submit" type="primary" @click="send()" v-if="!showReplyMsgInfo" - :disabled="isSending || $attrs.isAllowedComment==0"> - 高低整两句 - </a-button> - <a-button html-type="submit" type="primary" v-else @click="send()" - :disabled="isSending || $attrs.isAllowedComment==0"> - 回复Ta - </a-button> - <span class="myTip" v-if="$attrs.isAllowedComment==0">很遗憾,评论已关闭</span> + <a-button html-type="submit" type="primary" @click="send()" v-if="!showReplyMsgInfo" + :disabled="isSending || $attrs.isAllowedComment==0"> + 高低整两句 + </a-button> + <a-button html-type="submit" type="primary" v-else @click="send()" + :disabled="isSending || $attrs.isAllowedComment==0"> + 回复Ta + </a-button> + <span class="myTip" v-if="$attrs.isAllowedComment==0">很遗憾,评论已关闭</span> </div> <div> - <a-checkbox style=" margin-left: 8px;" v-if="!showReplyMsgInfo" v-model="form.isSecretMsg"> - 悄悄说..<span class="myTip">(仅登录后可查看)</span> - </a-checkbox> <a-checkbox v-model="form.isReceiveMail"> 接收邮件回复通知 + </a-checkbox> + <a-checkbox style=" margin-left: 8px;" v-if="!showReplyMsgInfo" v-model="form.isSecretMsg"> + 悄悄说..<span class="myTip">(仅登录后可查看)</span> </a-checkbox> </div> </div> @@ -59,6 +65,9 @@ import { blogCommentAdd } from '../../api/blogArticleComment.js' + import md5 from 'js-md5'; + + const VisitorDataKey = "visitorData.inleft.com" export default { methods: { @@ -78,6 +87,11 @@ return } + if (this.form.isReceiveMail && this.form.eMail == "") { + this.$message.info("如果是想接收通知的话,你可能需要填上一个邮箱..") + return + } + var res; this.$refs.myForm.validate(valid => { if (valid) { @@ -88,14 +102,38 @@ res = false; } }); + + if (this.form.nickName == 'inleft' || this.form.nickName == '笔墨' || this.form.nickName == '阿墨') { + if (this.form.authCode == null || this.form.authCode == "") { + this.$message.info("不要成为我,你就是真的自己..") + return + } + } + + var articleId = this.$attrs.articleId; let commentType = (articleId == null || articleId == undefined) ? 1 : 2; - this.isSending = true; + //记录最新访客信息 + if (this.form.visitorId == 1) { + var today = new Date(); + var year = today.getFullYear() + ""; + var month = today.getMonth() + 1 + ""; + var date = today.getDate() + ""; + var num = ""; + for (var i = 0; i < 4; i++) { + num = num + Math.floor(Math.random() * 9) + ""; + } + this.form.visitorId = year + (month > 10 ? month : '0' + month) + date + num + } + + localStorage.setItem(VisitorDataKey, JSON.stringify(this.form)) + + this.isSending = true; blogCommentAdd({ parentId: this.msgInfo.parentId, replyId: this.msgInfo.replyId, - "visitorId": "1", + "visitorId": this.form.visitorId, "articleId": articleId, "commentType": commentType, "authStatus": this.form.isSecretMsg ? 2 : 1, @@ -104,6 +142,8 @@ "visitorHomePage": this.form.homePage, "visitorNickName": this.form.nickName, "commentContent": this.form.visitorContent, + "authCode": this.form.authCode != null && this.form.authCode != "" ? md5(this.form.authCode) : + '' }).then((res) => { this.isSending = false; if (res.code == 200) { @@ -129,6 +169,31 @@ }, data() { + let tempVisitorData = localStorage.getItem(VisitorDataKey); + let vistorData = { + nickName: "", + eMail: "", + homePage: "", + isReceiveMail: true, + isSecretMsg: false, + visitorContent: "", + parentId: 0, + replyId: 0, + visitorId: 1, + authCode: '' + }; + + if (tempVisitorData != null && tempVisitorData != undefined) { + tempVisitorData = JSON.parse(tempVisitorData); + vistorData.nickName = tempVisitorData.nickName; + vistorData.eMail = tempVisitorData.eMail; + vistorData.homePage = tempVisitorData.homePage; + vistorData.isReceiveMail = tempVisitorData.isReceiveMail; + vistorData.isSecretMsg = tempVisitorData.isSecretMsg; + vistorData.visitorId = tempVisitorData.visitorId; + vistorData.authCode = tempVisitorData.authCode; + } + return { isSending: false, replyHolder: "", @@ -147,16 +212,7 @@ span: 15, offset: 0 }, - form: { - nickName: "", - eMail: "", - homePage: "", - isReceiveMail: false, - isSecretMsg: false, - visitorContent: "", - parentId: 0, - replyId: 0 - }, + form: vistorData, rules: { "nickName": [{ message: '怎么称呼?', diff --git a/src/components/mini/tagInfo.vue b/src/components/mini/tagInfo.vue index 78ec9de..a7287f4 100644 --- a/src/components/mini/tagInfo.vue +++ b/src/components/mini/tagInfo.vue @@ -27,7 +27,7 @@ <span style="font-size: 10px;color: #999">(小乖)</span> </li> <br> - <li> touch: inleft@qq.com</li> + <li> touch: inleft#qq.com</li><span style="font-size: 10px;color: #999">替换#为@</span> </ul> </p> @@ -86,6 +86,14 @@ <br> <a-timeline-item color=""> <a-icon slot="dot" type="clock-circle-o" style="font-size: 18px;" /> + <h3 class="layui-timeline-title">2022-07-29</h3> + <span> + <router-link to="/comment">优化更新:记住到访的朋友</router-link> + </span> + <p class="myTip">你的名字.</p> + </a-timeline-item> + <a-timeline-item color=""> + <a-icon slot="dot" type="clock-circle-o" style="font-size: 18px;" /> <h3 class="layui-timeline-title">2022-03-03</h3> <span> <router-link to="/comment">碎碎念</router-link> -- Gitblit v1.9.1