Skip to content

Commit babf693

Browse files
committed
删除字数统计
1 parent 8468ae0 commit babf693

File tree

11 files changed

+28
-84
lines changed

11 files changed

+28
-84
lines changed

blog-api/src/main/java/com/rawchen/controller/admin/BlogAdminController.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ public Result updateBlog(@RequestBody com.rawchen.model.dto.Blog blog) {
188188
*/
189189
private Result getResult(com.rawchen.model.dto.Blog blog, String type) {
190190
//验证普通字段
191-
if (StringUtils.isEmpty(blog.getTitle(),blog.getFirstPicture(), blog.getContent(), blog.getDescription())
192-
|| blog.getWords() == null || blog.getWords() < 0) {
191+
if (StringUtils.isEmpty(blog.getTitle(),blog.getFirstPicture(), blog.getContent(), blog.getDescription())) {
193192
return Result.error("参数有误");
194193
}
195194

@@ -238,9 +237,7 @@ private Result getResult(com.rawchen.model.dto.Blog blog, String type) {
238237
}
239238

240239
Date date = new Date();
241-
if (blog.getReadTime() == null || blog.getReadTime() < 0) {
242-
blog.setReadTime((int) Math.round(blog.getWords() / 200.0));//粗略计算阅读时长
243-
}
240+
244241
if (blog.getViews() == null || blog.getViews() < 0) {
245242
blog.setViews(0);
246243
}

blog-api/src/main/java/com/rawchen/entity/Blog.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ public class Blog {
3131
private Date createTime;//创建时间
3232
private Date updateTime;//更新时间
3333
private Integer views;//浏览次数
34-
private Integer words;//文章字数
35-
private Integer readTime;//阅读时长(分钟)
3634
private String password;//密码保护
3735

3836
private User user;//文章作者(因为是个人博客,也可以不加作者字段,暂且加上)

blog-api/src/main/java/com/rawchen/model/dto/Blog.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public class Blog {
3434
private Date createTime;//创建时间
3535
private Date updateTime;//更新时间
3636
private Integer views;//浏览次数
37-
private Integer words;//文章字数
38-
private Integer readTime;//阅读时长(分钟)
3937
private String password;//密码保护
4038

4139
private User user;//文章作者(因为是个人博客,也可以不加作者字段,暂且加上)

blog-api/src/main/java/com/rawchen/model/vo/BlogDetail.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ public class BlogDetail {
2929
private Date createTime;//创建时间
3030
private Date updateTime;//更新时间
3131
private Integer views;//浏览次数
32-
private Integer words;//文章字数
33-
private Integer readTime;//阅读时长(分钟)
3432
private String password;//密码保护
3533

3634
private Category category;//文章分类

blog-api/src/main/java/com/rawchen/model/vo/BlogInfo.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ public class BlogInfo {
2525
private String description;//描述
2626
private Date createTime;//创建时间
2727
private Integer views;//浏览次数
28-
private Integer words;//文章字数
29-
private Integer readTime;//阅读时长(分钟)
3028
private Boolean top;//是否置顶
3129
private String password;//文章密码
3230
private Boolean privacy;//是否私密文章

blog-api/src/main/resources/mapper/BlogMapper.xml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
<result property="createTime" column="create_time"/>
1717
<result property="updateTime" column="update_time"/>
1818
<result property="views" column="views"/>
19-
<result property="words" column="words"/>
20-
<result property="readTime" column="read_time"/>
2119
<result property="password" column="password"/>
2220
<association property="user" javaType="com.rawchen.entity.User">
2321
<id property="id" column="user_id"/>
@@ -104,8 +102,6 @@
104102
<result property="description" column="description"/>
105103
<result property="createTime" column="create_time"/>
106104
<result property="views" column="views"/>
107-
<result property="words" column="words"/>
108-
<result property="readTime" column="read_time"/>
109105
<result property="top" column="is_top"/>
110106
<result property="password" column="password"/>
111107
<association property="category" javaType="com.rawchen.entity.Category">
@@ -121,8 +117,6 @@
121117
b.is_top,
122118
b.create_time,
123119
b.views,
124-
b.words,
125-
b.read_time,
126120
b.password,
127121
c.category_name
128122
from blog as b
@@ -138,8 +132,6 @@
138132
b.is_top,
139133
b.create_time,
140134
b.views,
141-
b.words,
142-
b.read_time,
143135
b.password,
144136
c.category_name
145137
from category as c
@@ -156,8 +148,6 @@
156148
b.is_top,
157149
b.create_time,
158150
b.views,
159-
b.words,
160-
b.read_time,
161151
b.password,
162152
c.category_name
163153
from (((tag as t left join blog_tag as bt on t.id = bt.tag_id) left join blog as b on bt.blog_id = b.id)
@@ -239,10 +229,10 @@
239229
<insert id="saveBlog" parameterType="com.rawchen.model.dto.Blog" useGeneratedKeys="true" keyProperty="id">
240230
insert into blog (title, first_picture, content, description, is_published, is_recommend, is_appreciation,
241231
is_comment_enabled,
242-
is_top, create_time, update_time, views, words, read_time, category_id, user_id, password)
232+
is_top, create_time, update_time, views, category_id, user_id, password)
243233
values (#{title}, #{firstPicture}, #{content}, #{description}, #{published}, #{recommend}, #{appreciation},
244234
#{commentEnabled},
245-
#{top}, #{createTime}, #{updateTime}, #{views}, #{words}, #{readTime}, #{category.id}, #{user.id},
235+
#{top}, #{createTime}, #{updateTime}, #{views}, #{category.id}, #{user.id},
246236
#{password})
247237
</insert>
248238

@@ -294,8 +284,6 @@
294284
b.create_time,
295285
b.update_time,
296286
b.views,
297-
b.words,
298-
b.read_time,
299287
b.password,
300288
c.id as category_id,
301289
c.category_name,
@@ -324,8 +312,6 @@
324312
<result property="createTime" column="create_time"/>
325313
<result property="updateTime" column="update_time"/>
326314
<result property="views" column="views"/>
327-
<result property="words" column="words"/>
328-
<result property="readTime" column="read_time"/>
329315
<result property="password" column="password"/>
330316
<association property="category" javaType="com.rawchen.entity.Category">
331317
<result property="name" column="category_name"/>
@@ -347,8 +333,6 @@
347333
b.create_time,
348334
b.update_time,
349335
b.views,
350-
b.words,
351-
b.read_time,
352336
b.password,
353337
c.category_name,
354338
t.tag_name as tag_name,
@@ -381,8 +365,6 @@
381365
create_time=#{createTime},
382366
update_time=#{updateTime},
383367
views=#{views},
384-
words=#{words},
385-
read_time=#{readTime},
386368
category_id=#{category.id},
387369
password=#{password}
388370
where id = #{id}

blog-cms/src/views/blog/blog/WriteBlog.vue

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
<el-form :model="form" :rules="formRules" ref="formRef" label-position="top">
77
<el-row :gutter="20">
88
<el-col :span="12">
9-
<el-form-item label="文章标题" prop="title">
9+
<el-form-item label="标题" prop="title">
1010
<el-input v-model="form.title" placeholder="请输入标题"></el-input>
1111
</el-form-item>
1212
</el-col>
1313
<el-col :span="12">
14-
<el-form-item label="文章首图" prop="firstPicture">
14+
<el-form-item label="封面图" prop="firstPicture">
1515
<el-input v-model="form.firstPicture" placeholder="文章首图,用于随机文章展示"></el-input>
1616
</el-form-item>
1717
</el-col>
1818
</el-row>
1919

20-
<el-alert title="注意:如果从 Typora 中复制 Markdown,粘贴时要选择粘贴为纯文本,否则代码块可能无法被 prismjs 高亮" type="warning" center show-icon></el-alert>
20+
<!-- <el-alert title="注意:如果从 Typora 中复制 Markdown,粘贴时要选择粘贴为纯文本,否则代码块可能无法被 prismjs 高亮" type="warning" center show-icon></el-alert> -->
2121

22-
<el-form-item label="文章描述" prop="description">
22+
<el-form-item label="描述" prop="description">
2323
<div id="vditor-description"></div>
2424
</el-form-item>
2525

26-
<el-form-item label="文章正文" prop="content">
26+
<el-form-item label="正文" prop="content">
2727
<div id="vditor-content"></div>
2828
</el-form-item>
2929

@@ -44,21 +44,8 @@
4444
</el-col>
4545
</el-row>
4646

47-
<el-row :gutter="20">
48-
<el-col :span="12">
49-
<el-form-item label="字数" prop="words">
50-
<el-input v-model="form.words" placeholder="请输入文章字数(自动计算阅读时长)" type="number"></el-input>
51-
</el-form-item>
52-
</el-col>
53-
<el-col :span="12">
54-
<el-form-item label="阅读时长(分钟)" prop="readTime">
55-
<el-input v-model="form.readTime" placeholder="请输入阅读时长(可选)默认 Math.round(字数 / 200)" type="number"></el-input>
56-
</el-form-item>
57-
</el-col>
58-
</el-row>
59-
6047
<el-form-item label="浏览次数" prop="views">
61-
<el-input v-model="form.views" placeholder="请输入文章字数(可选)默认为 0" type="number" style="width: 50%;"></el-input>
48+
<el-input v-model="form.views" placeholder="文章访问量(默认为 0" type="number" style="width: 50%;"></el-input>
6249
</el-form-item>
6350

6451
<el-form-item style="text-align: right;">
@@ -144,16 +131,10 @@
144131
title: [{required: true, message: '请输入标题', trigger: 'change'}],
145132
firstPicture: [{required: true, message: '请输入首图链接', trigger: 'change'}],
146133
cate: [{required: true, message: '请选择分类', trigger: 'change'}],
147-
tagList: [{required: true, message: '请选择标签', trigger: 'change'}],
148-
words: [{required: true, message: '请输入文章字数', trigger: 'change'}],
134+
// tagList: [{required: true, message: '请选择标签', trigger: 'change'}],
149135
},
150136
}
151137
},
152-
watch: {
153-
'form.words'(newValue) {
154-
this.form.readTime = newValue ? Math.round(newValue / 200) : null
155-
},
156-
},
157138
created() {
158139
this.getData()
159140
},

blog-view/src/assets/css/base.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ footer {
245245
}
246246

247247
.m-datetime {
248-
color: #00a7e0 !important;
248+
color: #5f5f5f !important;
249249
}
250250

251251
.m-datetime * {
@@ -257,7 +257,7 @@ footer {
257257
}
258258

259259
.m-views {
260-
color: #ff3f1f !important;
260+
color: #5f5f5f !important;
261261
}
262262

263263
.m-views * {
@@ -268,19 +268,19 @@ footer {
268268
margin-right: 3px !important;
269269
}
270270

271-
.m-common-black {
272-
color: #000 !important;
271+
.m-common-gray {
272+
color: #5f5f5f !important;
273273
}
274274

275-
.m-common-black * {
275+
.m-common-gray * {
276276
vertical-align: middle !important;
277277
}
278278

279-
.m-common-black * * {
279+
.m-common-gray * * {
280280
vertical-align: middle !important;
281281
}
282282

283-
.m-common-black i {
283+
.m-common-gray i {
284284
margin-right: 3px !important;
285285
}
286286

blog-view/src/components/blog/BlogItem.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,10 @@
1919
<i class="small calendar icon"></i><span>{{ item.createTime | dateFormat('YYYY-MM-DD')}}</span>
2020
</div>
2121
<div class="item m-views">
22-
<i class="small eye icon"></i><span>{{ item.views }}</span>
22+
<i class="el-icon-s-data"></i><span>{{ item.views }}</span>
2323
</div>
24-
<div class="item m-common-black">
25-
<i class="small pencil alternate icon"></i><span>字数≈{{ item.words }}字</span>
26-
</div>
27-
<div class="item m-common-black">
28-
<i class="small clock icon"></i><span>阅读时长≈{{ item.readTime }}分</span>
24+
<div class="item m-common-gray">
25+
<i class="el-icon-s-comment"></i><span>123</span>
2926
</div>
3027
</div>
3128
</div>

blog-view/src/views/blog/Blog.vue

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,17 @@
1717
<i class="small calendar icon"></i><span>{{ blog.createTime | dateFormat('YYYY-MM-DD') }}</span>
1818
</div>
1919
<div class="item m-views">
20-
<i class="small eye icon"></i><span>{{ blog.views }}</span>
20+
<i class="el-icon-s-data"></i><span>{{ blog.views }}</span>
2121
</div>
22-
<div class="item m-common-black">
23-
<i class="small pencil alternate icon"></i><span>字数≈{{ blog.words }}字</span>
22+
<div class="item m-common-gray">
23+
<i class="el-icon-s-comment"></i><span>123</span>
2424
</div>
25-
<div class="item m-common-black">
26-
<i class="small clock icon"></i><span>阅读时长≈{{ blog.readTime }}分</span>
27-
</div>
28-
<a class="item m-common-black" @click.prevent="bigFontSize=!bigFontSize">
25+
<a class="item m-common-gray" @click.prevent="bigFontSize=!bigFontSize">
2926
<div data-inverted="" data-tooltip="点击切换字体大小" data-position="top center">
3027
<i class="font icon"></i>
3128
</div>
3229
</a>
33-
<a class="item m-common-black" @click.prevent="changeFocusMode">
30+
<a class="item m-common-gray" @click.prevent="changeFocusMode">
3431
<div data-inverted="" data-tooltip="专注模式" data-position="top center">
3532
<i class="book icon"></i>
3633
</div>

0 commit comments

Comments
 (0)