From 54e657f53d2028626f70b9d9eafabac6f6305dab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A7=8B=E4=BA=8E=E5=88=9D=E8=A7=81?= <752204717@qq.com>
Date: Mon, 11 Aug 2025 16:18:40 +0800
Subject: [PATCH] tijiao
---
pages.json | 2 +-
pages/articleList/PrecisionImageGrid.vue | 245 ++++
pages/articleList/article.vue | 1161 ++++++-----------
pages/articleList/common-editor.vue | 3 +
pages/articleList/index.vue | 269 ++--
pages/doctors/index.vue | 16 +-
pages/my/index.vue | 5 +
uni_modules/hb-comment/changelog.md | 19 +
.../components/hb-comment/hb-comment.vue | 746 +++++++++++
uni_modules/hb-comment/package.json | 83 ++
uni_modules/hb-comment/readme.md | 261 ++++
.../piaoyi-editor/piaoyi-editor.vue | 15 +-
12 files changed, 1966 insertions(+), 859 deletions(-)
create mode 100644 pages/articleList/PrecisionImageGrid.vue
create mode 100644 uni_modules/hb-comment/changelog.md
create mode 100644 uni_modules/hb-comment/components/hb-comment/hb-comment.vue
create mode 100644 uni_modules/hb-comment/package.json
create mode 100644 uni_modules/hb-comment/readme.md
diff --git a/pages.json b/pages.json
index 52f60fec..770b736d 100644
--- a/pages.json
+++ b/pages.json
@@ -88,7 +88,7 @@
"path": "pages/articleList/article",
"style": {
"navigationBarTitleText": "文章",
- "enablePullDownRefresh": true, // 禁止下拉刷新
+
"app-plus": {
"bounce": "none",
"titleNView": false,
diff --git a/pages/articleList/PrecisionImageGrid.vue b/pages/articleList/PrecisionImageGrid.vue
new file mode 100644
index 00000000..c93fe937
--- /dev/null
+++ b/pages/articleList/PrecisionImageGrid.vue
@@ -0,0 +1,245 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/articleList/article.vue b/pages/articleList/article.vue
index 37454a4d..a440bb37 100644
--- a/pages/articleList/article.vue
+++ b/pages/articleList/article.vue
@@ -1,28 +1,35 @@
-
-
-
-
- 去发布
+
+
+
+ 去发布
-
-
+
+
-
- {{
- loading
- ? "解析预计耗时约50秒,请稍后查看草稿箱中的内容。"
- : "好的,结合您的医案,下面是解析后的结果。"
- }}
+
+
+ {{ articleInfo.title }}
+
+
+
+
+
+
+ {{
+ articleInfo.taihuTalent.name
+ }}
+ {{
+ articleInfo.taihuTalent.title
+ }}
+
+
+ {{ articleInfo.readCount }}人阅读
+
+
+
+
+
-
+ > -->
-
-
+
+
+
@@ -1255,9 +862,8 @@ export default {
}
.home_wrap {
-
// padding-bottom: 300rpx;
- overflow: hidden;
+ overflow-y: auto;
.home_logo {
padding-top: 40rpx;
@@ -1293,7 +899,7 @@ export default {
.home_form {
height: 100%;
// margin-top: 60rpx;
-
+
position: relative;
.form_item {
@@ -1315,9 +921,7 @@ export default {
}
textarea,
- input
- {
-
+ input {
display: inline-block;
width: calc(100%);
height: 70rpx;
@@ -1326,10 +930,10 @@ export default {
// padding: 17rpx 30rpx;
font-size: 38rpx;
color: #303030;
-
+
box-sizing: border-box;
resize: none;
-
+
overflow-y: scroll;
}
}
@@ -1352,7 +956,6 @@ export default {
z-index: 999;
}
-
.submit_btn {
position: absolute;
right: 0rpx;
@@ -1570,13 +1173,6 @@ h3 {
}
}
-
-
-
-
-
-
-
.aiFlag {
position: absolute;
bottom: 55px;
@@ -1628,7 +1224,7 @@ h3 {
.footer_box {
background: #fff;
padding-top: 10rpx;
- height: 100rpx;
+ height: 80rpx;
position: fixed;
bottom: 0;
left: 0;
@@ -1652,22 +1248,20 @@ h3 {
.footer_item {
position: relative;
flex: 1;
- .button {
- width: 88%;
- background-color: #1985fd;
- margin: auto auto;
- margin-top: 10rpx;
- border-radius: 50px;
- line-height: 40px;
- height: 40px;
- text-align: center;
- color: #fff;
- font-weight: bold;
- }
- .savebutton {
- background-color: #e4f0ff;
- color: #1985fd;
- }
+ margin: 0 auto;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+}
+.footer_item .footer_item_icon {
+ display: flex;
+ align-items: center;
+ margin-bottom: 4rpx;
+ // justify-content: space-around;
+}
+.footer_item_count {
+ margin-left: 10rpx;
}
/deep/.u-upload__button {
background-color: #fff;
@@ -1679,24 +1273,27 @@ h3 {
height: 100%;
// padding-top: 20rpx;
width: 100%;
-
-
box-sizing: border-box !important;
uni-textarea {
border: none !important;
}
.analysis_title {
-
- margin-top: 30rpx;
- margin-bottom: 20rpx;
- color: #1781ff;
- font-size: 48rpx;
+ margin-top: 30rpx;
+ margin-bottom: 20rpx;
+ // color: #1781ff;
+ font-size: 32rpx;
+ font-weight: 700;
+ }
+ .analysis_title_detail {
+ margin-top: 30rpx;
+ margin-bottom: 50rpx;
+ // color: #1781ff;
+ font-size: 42rpx;
font-weight: 700;
}
}
/deep/.home_wrap_analysis {
-
.home_form {
padding-bottom: 0px;
}
@@ -1728,8 +1325,56 @@ h3 {
}
.content_detail {
background: #fff;
+ padding: 0 20rpx;
}
.message_wrap_detail {
padding: 0;
}
+.analysis_img_box {
+ margin-bottom: 30rpx;
+}
+.analysis_img {
+ display: flex;
+ align-items: center;
+ margin-bottom: 10rpx;
+ image {
+ width: 120rpx;
+ height: 120rpx;
+ border-radius: 120rpx;
+ margin-right: 20rpx;
+ }
+}
+.taihuTalentBox {
+ width: calc(100% - 140rpx);
+ color: #1b1b1b;
+ .taihuTalent_name {
+ margin-bottom: 20rpx;
+ font-size: 36rpx;
+ font-weight: 600;
+ }
+ .zhicheng {
+ background: #e4f0ff;
+ color: #1985fd;
+ padding: 4rpx 20rpx;
+ border-radius: 10rpx;
+ font-size: 24rpx;
+ line-height: 28rpx;
+ }
+} .orderModalShow {
+ width: 100%;
+ // max-height: 48vh;
+ // padding-bottom: 120rpx;
+ }
+
+ .popup_box {
+ padding: 20rpx;
+
+ box-sizing: border-box;
+ .curriulum_title_box {
+ .title {
+ text-align: center;
+ font-size: 34rpx !important;
+ }
+ }
+ }
diff --git a/pages/articleList/common-editor.vue b/pages/articleList/common-editor.vue
index dde11dfe..856d1183 100644
--- a/pages/articleList/common-editor.vue
+++ b/pages/articleList/common-editor.vue
@@ -1,5 +1,6 @@
+
@@ -43,6 +44,8 @@
methods: {
saveContens(e) {
this.txt = e.html
+ this.$emit('saveContens', this.txt)
+
}
},
onShareAppMessage(res) {
diff --git a/pages/articleList/index.vue b/pages/articleList/index.vue
index 661a1483..15707cee 100644
--- a/pages/articleList/index.vue
+++ b/pages/articleList/index.vue
@@ -4,18 +4,28 @@
- 新建文章
+ 发布文章
-
+
+
+
+
+
-->
-
- {{ statusTitle }}
- {{ item.createTime }}
-
-
- {{ item.title }}
-
-
-
-
-
-
+
+
+
+ {{ item.title }}
+
+ 医案{{
+ item.createTime ? item.createTime.split(" ")[0] : ""
+ }}
+
+
+
+ {{ item.readCount?item.readCount:0 }}阅读·
+ {{ item.likeCount?item.likeCount:0 }}点赞·
+ {{ item.commentCount?item.commentCount:0 }}评论
+
+ 分享
+
+
+
-
+
@@ -96,7 +123,9 @@
+
+
diff --git a/uni_modules/hb-comment/package.json b/uni_modules/hb-comment/package.json
new file mode 100644
index 00000000..6ef1ff63
--- /dev/null
+++ b/uni_modules/hb-comment/package.json
@@ -0,0 +1,83 @@
+{
+ "id": "hb-comment",
+ "displayName": "评论列表,回复,点赞,删除,留言板",
+ "version": "1.2.2",
+ "description": "评论列表,回复,点赞,删除,留言板",
+ "keywords": [
+ "评论列表",
+ "评论回复",
+ "评论点赞",
+ "评论删除",
+ "留言板"
+],
+ "repository": "https://github.com/dr34-m/hb-comment",
+"engines": {
+ },
+ "dcloudext": {
+ "category": [
+ "前端组件",
+ "通用组件"
+ ],
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "插件不采集任何数据",
+ "permissions": "无"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "App": {
+ "app-vue": "y",
+ "app-nvue": "y"
+ },
+ "H5-mobile": {
+ "Safari": "y",
+ "Android Browser": "y",
+ "微信浏览器(Android)": "y",
+ "QQ浏览器(Android)": "y"
+ },
+ "H5-pc": {
+ "Chrome": "y",
+ "IE": "y",
+ "Edge": "y",
+ "Firefox": "y",
+ "Safari": "y"
+ },
+ "小程序": {
+ "微信": "y",
+ "阿里": "y",
+ "百度": "y",
+ "字节跳动": "y",
+ "QQ": "y"
+ },
+ "快应用": {
+ "华为": "y",
+ "联盟": "y"
+ },
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/hb-comment/readme.md b/uni_modules/hb-comment/readme.md
new file mode 100644
index 00000000..7daf0c25
--- /dev/null
+++ b/uni_modules/hb-comment/readme.md
@@ -0,0 +1,261 @@
+## 接口使用,包括点赞回复评论删除逻辑,建议参考示例项目进行二次封装;
+
+## 本插件设计之初就是为小型项目设计,不支持分页,评论只有两级。如需改为多级或者需要支持分页,需要进行相当程度的改造。
+
+直接使用
+
+```html
+
+```
+
+后端返回数据格式(给到前端后前端整合成树):
+
+```js
+{
+ "readNumer": 193,
+ "commentList": [{
+ "id": 1, // 唯一主键
+ "owner": false, // 是否是拥有者,为true则可以删除,管理员全部为true
+ "hasLike": false, // 是否点赞
+ "likeNum": 2, // 点赞数量
+ "avatarUrl": "https://inews.gtimg.com/newsapp_ls/0/13797755537/0", // 评论者头像地址
+ "nickName": "超长昵称超长...", // 评论者昵称,昵称过长请在后端截断
+ "content": "啦啦啦啦", // 评论内容
+ "parentId": null, // 所属评论的唯一主键
+ "createTime": "2021-07-02 16:32:07" // 创建时间
+ },
+ {
+ "id": 2,
+ "owner": false,
+ "hasLike": false,
+ "likeNum": 2,
+ "avatarUrl": "https://inews.gtimg.com/newsapp_ls/0/13797761970/0",
+ "nickName": "寂寞无敌",
+ "content": "我是评论的评论",
+ "parentId": 1,
+ "createTime": "2021-07-02 17:05:50"
+ },
+ {
+ "id": 4,
+ "owner": true,
+ "hasLike": true,
+ "likeNum": 1,
+ "avatarUrl": "https://inews.gtimg.com/newsapp_ls/0/13797763270/0",
+ "nickName": "name111",
+ "content": "评论啦啦啦啦啦啦啦啦啦啦",
+ "parentId": null,
+ "createTime": "2021-07-13 09:37:50"
+ },
+ {
+ "id": 5,
+ "owner": false,
+ "hasLike": false,
+ "likeNum": 0,
+ "avatarUrl": "https://inews.gtimg.com/newsapp_ls/0/13797755537/0",
+ "nickName": "超长昵称超长...",
+ "content": "超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论超长评论",
+ "parentId": null,
+ "createTime": "2021-07-13 16:04:35"
+ },
+ {
+ "id": 13,
+ "owner": false,
+ "hasLike": false,
+ "likeNum": 0,
+ "avatarUrl": "https://inews.gtimg.com/newsapp_ls/0/13797755537/0",
+ "nickName": "超长昵称超长...",
+ "content": "@寂寞无敌 你怕不是个大聪明",
+ "parentId": 1,
+ "createTime": "2021-07-14 11:01:23"
+ }
+ ]
+}
+```
+
+假设后端返回数据为`res`,则`commentData`可以这样得到
+
+```js
+this.commentData = {
+ "readNumer": res.readNumer,
+ "commentSize": res.commentList.length,
+ "comment": this.getTree(res.commentList)
+}
+```
+
+其中`getTree`方法如下
+
+```js
+getTree(data) {
+ let result = [];
+ let map = {};
+ data.forEach(item => {
+ map[item.id] = item;
+ });
+ data.forEach(item => {
+ let parent = map[item.parentId];
+ if (parent) {
+ (parent.children || (parent.children = [])).push(item);
+ } else {
+ result.push(item);
+ }
+ });
+ return result;
+}
+```
+
+发布弹框借鉴了[@tenniswill](https://ext.dcloud.net.cn/publisher?id=74739)先生[评论内容发布组件](https://ext.dcloud.net.cn/plugin?id=1302)的思路,同时参照其评论区对代码作了优化
+
+## 后端的Python实现核心代码,可以参考
+
+* mysql结构,还有一张userlist表没有列出,请自己发挥
+
+```sql
+-- ----------------------------
+-- Table structure for comment
+-- ----------------------------
+DROP TABLE IF EXISTS `comment`;
+CREATE TABLE `comment` (
+ `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `article_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属文章id',
+ `comment_user_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '评论人id',
+ `parent_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '所属评论id,主评论为null',
+ `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '评论内容',
+ `like` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '点赞(存储点赞人id数组)',
+ `status` tinyint(3) UNSIGNED NULL DEFAULT 0 COMMENT '状态,0-未审核,1-展现,2-审核驳回,3-已删除',
+ `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '评论' ROW_FORMAT = Compact;
+
+-- ----------------------------
+-- Table structure for article_read
+-- ----------------------------
+DROP TABLE IF EXISTS `article_read`;
+CREATE TABLE `article_read` (
+ `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `article_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属文章id',
+ `read_num` int(10) UNSIGNED NULL DEFAULT 1 COMMENT '阅读数',
+ `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP,
+ `update_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `unionKey`(`article_id`) USING BTREE COMMENT '文章唯一'
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '阅读数' ROW_FORMAT = Compact;
+```
+
+* python核心代码,其中`CS`为项目中封装的一个通用方法,请自己发挥并替换
+
+```python
+# 提交评论
+def comment_article(articleId, userId, pId, content):
+ if userId is None:
+ raise CS.CustomException("请先登录", 500)
+ if pId == 'null':
+ pId = None
+ conn = CS.getCoon()
+ cursor = conn.cursor()
+ cursor.execute("insert into comment(article_id,comment_user_id,parent_id,content,status,`like`) values(%s,%s,%s,%s,1,'[]')",
+ (articleId, userId, pId, content))
+ conn.commit()
+ cursor.close()
+ conn.close()
+ return CS.ResultMap(None)
+
+
+# 点赞评论
+def like_comment(commentId, userId):
+ if userId is None:
+ raise CS.CustomException("请先登录", 500)
+ conn = CS.getCoon()
+ cursor = conn.cursor()
+ cursor.execute("select `like` from comment where id = %s", (commentId))
+ currentLike_json = cursor.fetchall()[0][0]
+ currentLike = json.loads(currentLike_json)
+ if userId in currentLike:
+ currentLike.remove(userId)
+ else:
+ currentLike.append(userId)
+ currentLike_json = json.dumps(currentLike)
+ cursor.execute("update comment set `like` = %s where id = %s", (currentLike_json, commentId))
+ conn.commit()
+ cursor.close()
+ conn.close()
+ return CS.ResultMap(None)
+
+
+# 删除评论
+def delete_comment(commentId, userId):
+ if userId is None:
+ raise CS.CustomException("请先登录", 500)
+ conn = CS.getCoon()
+ cursor = conn.cursor()
+ # userId = 1为超级管理员
+ if userId != 1:
+ cursor.execute("select comment_user_id from comment where id = %s and status = 1",(commentId))
+ commentUserIdRst = cursor.fetchall()
+ if str(commentUserIdRst) == '()':
+ raise CS.CustomException("评论不存在或已删除", 500)
+ if userId != commentUserIdRst[0][0]:
+ cursor.close()
+ conn.close()
+ raise CS.CustomException("无删除权限", 500)
+ cursor.execute("update comment set status=3 where id = %s or parent_id = %s", (commentId, commentId))
+ conn.commit()
+ cursor.close()
+ conn.close()
+ return CS.ResultMap(None)
+
+
+# 获取评论列表
+def get_article_comment(articleId, userId):
+ conn = CS.getCoon()
+ cursor = conn.cursor()
+ cursor.execute(
+ '''select
+ c.id,
+ c.comment_user_id,
+ u.avatar_url,
+ u.nick_name,
+ c.content,
+ c.like,
+ c.parent_id,
+ c.create_time
+ from comment c
+ left join userlist u on c.comment_user_id = u.id
+ where article_id = %s and status = 1''', (articleId))
+ commentList = cursor.fetchall()
+ cursor.execute("insert into article_read(article_id) values(%s) on DUPLICATE KEY UPDATE read_num=read_num+1", (articleId))
+ conn.commit()
+ cursor.execute("select read_num from article_read where article_id = %s", (articleId))
+ readNum = cursor.fetchall()[0][0]
+ cursor.close()
+ conn.close()
+ commentResult = []
+ for comment in commentList:
+ like = json.loads(comment[5])
+ commentEach = {
+ "id": comment[0],
+ "owner": False,
+ "hasLike": False,
+ "likeNum": len(like),
+ "avatarUrl": comment[2],
+ "nickName": "用户" if comment[3] == None else comment[3],
+ "content": comment[4],
+ "parentId": comment[6],
+ "createTime": time.strftime("%Y-%m-%d %H:%M:%S", datetime.datetime.timetuple(comment[7]))
+ }
+ if len(commentEach['nickName']) > 7:
+ commentEach['nickName'] = commentEach['nickName'][0:6] + '...'
+ if userId is not None:
+ # userId = 1为超级管理员
+ if userId == comment[1] or userId == 1:
+ commentEach["owner"] = True
+ if userId in like:
+ commentEach["hasLike"] = True
+ commentResult.append(commentEach)
+ result = {
+ "readNumer": readNum,
+ "commentList": commentResult
+ }
+ return CS.ResultMap(result)
+```
diff --git a/uni_modules/piaoyi-editor/components/piaoyi-editor/piaoyi-editor.vue b/uni_modules/piaoyi-editor/components/piaoyi-editor/piaoyi-editor.vue
index 2bc64068..c473f26b 100644
--- a/uni_modules/piaoyi-editor/components/piaoyi-editor/piaoyi-editor.vue
+++ b/uni_modules/piaoyi-editor/components/piaoyi-editor/piaoyi-editor.vue
@@ -7,7 +7,7 @@
-
+
@@ -393,11 +393,18 @@
.toolbar {
box-sizing: border-box;
border-bottom: 0;
- margin-bottom: 0;
- position: fixed;
+ margin-bottom: 10rpx;
+ padding-bottom: 4rpx;
+ position: -webkit-sticky; /* Safari */
+ position: sticky;
+ top: -1px; /* 距离顶部的距离 */
+ z-index: 10; /* 确保在其他内容之上 */
+ background-color: #d8e6ff;
+ border-bottom: 1rpx solid #5188e5;
+ /* position: fixed;
bottom: 10upx;
left: 0;
- right: 0;
+ right: 0; */
}