Skip to content

Commit 15f4654

Browse files
committed
fix #12
1 parent 7f2cb54 commit 15f4654

25 files changed

+81
-12502
lines changed

console/pages/admin/articles/index.vue

+17-3
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,14 @@
8585
href="javascript:void(0)">{{ tag.title
8686
}}</a>
8787
</span>
88-
<span class="fn-nowrap">{{ item.commentCount }} {{ $t('comment', $store.state.locale) }}</span> •
89-
<span class="fn-nowrap">{{ item.viewCount }} {{ $t('view', $store.state.locale) }}</span> •
88+
<span class="fn-nowrap">
89+
<span :data-uvstatcmt="item.id">{{ item.commentCount }}</span>
90+
{{ $t('comment', $store.state.locale) }}
91+
</span> •
92+
<span class="fn-nowrap">
93+
<span :data-uvstatcmt="item.url">{{ item.viewCount }}</span>
94+
{{ $t('view', $store.state.locale) }}
95+
</span> •
9096
<time class="fn-nowrap">{{ item.createdAt }}</time>
9197
</div>
9298
</div>
@@ -114,6 +120,8 @@
114120
</template>
115121

116122
<script>
123+
import Uvstat from '../../../../theme/node_modules/uvstat'
124+
117125
export default {
118126
data () {
119127
return {
@@ -126,7 +134,8 @@
126134
windowSize: 1,
127135
list: [],
128136
userCount: 1,
129-
keyword: ''
137+
keyword: '',
138+
uvstat: null
130139
}
131140
},
132141
head () {
@@ -244,7 +253,12 @@
244253
}
245254
},
246255
mounted () {
256+
this.$set(this, 'uvstat', new Uvstat())
247257
this.getList()
258+
},
259+
updated () {
260+
this.uvstat.renderStat()
261+
this.uvstat.renderCmtStat()
248262
}
249263
}
250264
</script>

pipe.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"Server": "http://localhost:5897",
33
"StaticServer": "",
4-
"StaticResourceVersion": "1579417833933",
4+
"StaticResourceVersion": "1579435715878",
55
"RuntimeMode": "dev",
66
"LogLevel": "debug",
77
"ShowSQL": false,

theme/js/article.js

+4
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ export const ShowEditor = (reply, id, commentId) => {
105105
location.href = `${$('#pipeLang').data('server')}/start`
106106
return
107107
}
108+
if ($('#vcomment').length === 1) {
109+
$('#vcomment .commentToggleEditorBtn').first().click()
110+
return
111+
}
108112
if (commentId) {
109113
$editor.data('commentid', commentId)
110114
} else {

theme/js/common.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import NProgress from 'nprogress'
1010
import pjax from './lib/pjax'
1111
import Uvstat from 'uvstat'
1212
import Vcomment from 'vcmt'
13+
import { InitVcomment } from './article'
1314

1415
/**
1516
* @description 评论数、浏览数展现
1617
*/
1718
const showStat = () => {
18-
const uvstat = new Uvstat()
19-
uvstat.addStat()
20-
uvstat.renderStat()
21-
uvstat.renderCmtStat()
19+
window.uvstat.addStat()
20+
window.uvstat.renderStat()
21+
window.uvstat.renderCmtStat()
2222
}
2323

2424
/**
@@ -249,6 +249,8 @@ export const initPjax = (cb) => {
249249
LazyLoadCSSImage()
250250
LazyLoadImage()
251251
ParseMarkdown()
252+
showStat()
253+
InitVcomment()
252254
cb && cb()
253255
},
254256
})
@@ -276,6 +278,7 @@ export const initPjax = (cb) => {
276278
})
277279
LazyLoadCSSImage()
278280
addCopyright()
281+
window.uvstat = new Uvstat()
279282
showStat()
280283
// if ('serviceWorker' in navigator && 'caches' in window && 'fetch' in window && config.RuntimeMode === 'prod') {
281284
// navigator.serviceWorker.register(`${config.Server}/sw.min.js?${config.StaticResourceVersion}`, {scope: '/'})

theme/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

theme/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
"qrious": "^4.0.2",
4646
"turndown": "^5.0.3",
4747
"uvstat": "^1.0.7",
48-
"vcmt": "^1.0.11"
48+
"vcmt": "^1.0.12"
4949
}
5050
}

theme/sw.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

theme/x/9IPHP/article.html

+3
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,11 @@ <h2 class="article__title">
128128
</div>
129129
<div class="fn-mg5"></div>
130130
</article>
131+
<div id="b3logPipeComments"></div>
131132
{{if .Commentable}}
132133
<div class="comment">
134+
<div id="vcomment"
135+
data-name="{{.Article.Author.Name}}" data-postId="1576897303524"></div>
133136
{{template "comment/comments" .}}
134137
</div>
135138
{{end}}

theme/x/9IPHP/js/common.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)