评论区实现 前端Vue

根据后端部分定义评论区功能实现 golang后端部分-CSDN博客,重点需要实现三个部分,1.当前用户发起新根评论请求;2.评论区展示部分;3.某一根评论的子评论展示以及回复组件显示。

整体流程解释

数据从后端接收,整体在index文件中第一次进行存储,利用inject注入方式,将数据从父组件传递到子组件当中进行显示。对于每一个评论的获取,依赖评论数据中的评论id进行定位,进行后续的回复发送等等。

效果如下所示。

1.当前用户发起新根评论组件 组件名topCommentReply.vue

效果如下:

<template><div class="top-comment-input"><!-- 用户头像 --><img :src="userInfo.userAvatar" class="avatar" alt="用户头像" /><!-- 评论输入区域 --><div class="input-area"><textareav-model="commentContent"placeholder="说点什么..."rows="3"></textarea><div class="btn-wrapper"><button @click="submitComment" :disabled="isLoading" v-loading="isLoading">发布</button></div></div></div></template><script>import { ObjectId } from 'bson';export default {inject:["sendWSMessage", "userInfo", "videoId"],name: 'TopCommentReply',data() {return {commentContent: '',isLoading: false};},methods: {submitComment() {if (!this.commentContent.trim()) {this.$message.error('请输入评论内容');return;}this.isLoading = true;const replyComment = this.sendWSMessage;console.log('this.videoId', this.videoId);const comment = {"videoId": this.videoId,"curCommentId": new ObjectId().toString(),"userId": this.userInfo.userId,"userName": this.userInfo.userName,"userAvatar": this.userInfo.userAvatar,"content": this.commentContent,"commentType": 0,};replyComment(comment);this.$emit('post-submit-top-reply', comment);this.isLoading = false;}}};</script><style scoped>.top-comment-input {display: flex;gap: 12px;margin-bottom: 2em;}.avatar {width: 40px;height: 40px;border-radius: 50%;}.input-area {flex: 1;display: flex;flex-direction: column;gap: 10px;}.input-area textarea {width: 100%;padding: 10px;border-radius: 6px;border: 1px solid #ccc;resize: none;font-size: 14px;outline: none;}.btn-wrapper {display: flex;justify-content: flex-end;}.btn-wrapper button {padding: 8px 20px;background-color: #0f1014;color: #fff;border: none;border-radius: 4px;cursor: pointer;}.btn-wrapper button:hover {background-color: #2d2d2d;}.btn-wrapper button:disabled {opacity: 0.6;cursor: not-allowed;}</style>

2. 整体评论区部分分为两个组件commentSection.Vue和commentReplyItem.vue

2.1commentSection.Vue

<template><div class="firstglobals"><!-- 头像 --><div class="avatar"><img :src="data.userAvatar" style="width: 56px; height: 56px; border-radius: 50%;" alt="" /></div><!-- 内容 --><div class="content"><div class="usertop"><div style="display: flex;gap: 10px;"><div class="username">{{ data.userName }}</div><div class="tags" v-if="data.tag === 1">作者</div></div><div class="time">{{ formatTime(data.createTime) }}</div></div><div style="display: flex; flex-direction: column; margin-top: 1em;"><div class="text">{{ data.content }}</div><div style="display: flex; align-self: flex-end;"><img src="@/assets/images/点赞.png" style="width: 20px;" alt="" /></div><div class="but" @click="toggleReplyBox(data.curCommentId)">回复</div></div><div v-if="isReplyBoxVisible" class="reply-box"><textarea v-model="replyContent" placeholder="输入你的回复..." rows="3"></textarea><button @click="submitReply(data.curCommentId)" v-loading='isLoading'>发布</button></div><!-- 回复组件 --><div><div  v-if = "replyComments != null"><div  v-for="(item, index) in replyComments" :key="index"><CommentReplyItem :dataCode="dataCode" :replyData="item"@post-submit-reply="handleSubmitReply" /></div></div><div class="reply-buttons"><div v-show="!showAllReplies" class="load-more" @click="showReplies">加载更多回复   </div><div v-show="isSomeRepliesLoaded" class="load-more" @click="hideReplies">收起回复</div></div></div></div></div></template><script>import CommentReplyItem from '@/views/video/components/commentReplyItem.vue';import { getComment,  } from '@/apis/comment/comment.js';import { ObjectId } from 'bson';export default {name: 'CommentSection',components: {CommentReplyItem},props: {data: {type: Object,required: true,validator(value) {return ['userImg', 'userName', 'time', 'content','ReplyData', 'id', 'tag'].every(prop => prop in value);}},dataCode: {type: Number,default: null}},data() {return {replyContent: '',isLoading: false,showAllReplies: false,isSomeRepliesLoaded: false,isAllRepliesLoaded: false,replyComments: [],curPage: 1,totalPage: 10,};},computed: {isReplyBoxVisible() {return this.activeReplyId === this.data.curCommentId;},},inject: ['activeReplyId', 'setActiveReplyId', `sendWSMessage`, `userInfo`, `videoId`],methods: {formatTime(ts) {if (!ts) return '';const date = new Date(ts * 1000); return date.toLocaleString(); },handleSubmitReply(comment) {this.replyComments.push(comment);this.$emit('post-submit-reply', comment);},toggleReplyBox(id) {console.log('toggleReplyBox called with id:', id);console.log('this.activeReplyId1:', this.activeReplyId);if (this.setActiveReplyId) {this.setActiveReplyId(this.isReplyBoxVisible ? null : id);console.log('this.activeReplyId2:', this.activeReplyId);}},submitReply(id) {if (this.replyContent.trim()) {console.log('提交的回复内容:', this.replyContent);this.isLoading = true;const replyComment = this.sendWSMessage;console.log('this.videoId', this.videoId);const comment = {"videoId": this.videoId,"rootCommentId": id,"parentId": id,"parentUserId": this.data.userId,"parentUserName": this.data.userName,"curCommentId": new ObjectId().toString(),"userId": this.userInfo.userId,"userName": this.userInfo.userName,"userAvatar": this.userInfo.userAvatar,"content": this.replyContent,"commentType": 1,};replyComment(comment);this.replyComments.push(comment);this.isLoading = false;this.replyContent = '';this.setActiveReplyId(null);} else {this.$message.error('请输入回复内容');this.isLoading = false;}},async showReplies() {this.isSomeRepliesLoaded = true;const jsonData = {rootCommentId: this.data.curCommentId,commentType: 1,page: this.curPage,};try {this.curPage += 1;const [error, data] = await getComment(this.videoId, jsonData);if (error) throw error;if (data != null) {this.replyComments.push(...data.comments);console.log('获取评论成功:', data.comments);}} catch (err) {console.error('获取评论失败:', err);}},hideReplies() {this.isSomeRepliesLoaded = false;this.showAllReplies = false;this.curPage = 1;this.replyComments = [];},},mounted() {console.log("头像", this.data.userImg)console.log("评论数据", this.data);}};</script><style scoped>/* 样式部分保持不变 */.but {width: 60px;padding: 5px 0px;background: #f1f1f1;border-radius: 4px;display: flex;justify-content: center;align-content: center;font-weight: 400;font-size: 14px;color: #0f1014;text-align: left;font-style: normal;text-transform: none;}.tags {width: 32px;height: 18px;background: #0F1014;border-radius: 4px;color: #FFFFFF;font-weight: 400;font-size: 10px;line-height: 12px;text-align: center;display: flex;justify-content: center;align-items: center;}.but:hover {background: #ebe4e4;}.text {font-weight: 400;font-size: 18px;color: #000000;line-height: 21px;text-align: left;font-style: normal;text-transform: none;}.time {font-weight: 400;font-size: 12px;color: #666666;line-height: 14px;text-align: left;font-style: normal;text-transform: none;}.avatar {width: 56px;height: 56px;border-radius: 30px;}.usertop {display: flex;flex-direction: column;gap: 5px;}.username {font-weight: 700;font-size: 16px;color: #0f1014;line-height: 19px;text-align: left;font-style: normal;text-transform: none;}.content {display: flex;flex-direction: column;margin-left: 1em;margin-top: 10px;flex: 1;}.firstglobals {display: flex;justify-content: start;margin-top: 2em;}.reply-buttons {display: flex;gap: 10px; /* 两个按钮之间的间距 */
}.load-more {display: inline-flex; /* 让它变成“内联元素 + 可用 flex” */align-items: center;margin-top: 30px;color: #0066cc;cursor: pointer;font-size: 14px;
}.load-more:hover {text-decoration: underline;}.reply-box {margin-top: 10px;display: flex;flex-direction: column;gap: 10px;align-items: end;position: relative;width: 98%;align-self: flex-end;}.reply-box textarea {width: 100%;padding: 10px;border-radius: 4px;border: 1px solid #ddd;resize: none;outline: none;}.reply-box button {align-self: flex-end;padding: 10px 20px;border-radius: 4px;border: none;background-color: #070707;color: white;cursor: pointer;}.reply-box button:hover {background-color: #2d2d2d;}</style>

2.2commentReplyItem.vue

<template><div class="reply-comments"><div class="top-user"><div style="display: flex; justify-content: center; align-content: center; gap: 8px;"><img :src="replyData.userAvatar" style="width: 24px; height: 24px; border-radius: 50%;" alt=""><span class="username">{{ replyData.userName }}</span></div><div class="tags" v-if="replyData.anthTags === 1 || replyData.anthTags === 3">作者</div><div class="hf">回复</div><div style="display: flex; justify-content: center; align-content: center; gap: 8px;"><!-- <img :src="replyData.userImg2" style="width: 24px; height: 24px; border-radius: 50%;" alt=""> --><span class="username">{{ replyData.parentUserName }}</span></div><div class="tags" v-if="replyData.anthTags === 2 || replyData.anthTags === 3">作者</div><div class="time">{{ formatTime(replyData.createTime) }}</div></div><div class="content">{{ replyData.content }}</div><div style="display: flex; align-self: flex-end;"><img src="@/assets/images/点赞.png" style="width: 20px;" alt=""></div><div class="but" @click="toggleReplyBox()">回复</div><div v-if="isReplyBoxVisible" class="reply-box"><textarea v-model="replyContent" placeholder="输入你的回复..." rows="3"></textarea><button @click="submitReply(replyData.rootCommentId)" v-loading="isLoading">发布</button></div></div>
</template><script>import { ObjectId } from 'bson';
export default {name: 'CommentReplyItem',props: {replyData: {type: Object,required: true,validator(value) {return ['userImg1', 'userName1', 'userImg2', 'userName2','replytime', 'replycontent', 'anthTags', 'id'].every(prop => prop in value);}},dataCode: {type: Number,default: null}},data() {return {replyContent: '',isLoading: false};},computed: {isReplyBoxVisible() {return this.activeReplyId === this.replyData.curCommentId;}},inject: ['activeReplyId', 'setActiveReplyId', 'sendWSMessage', 'userInfo', 'videoId'],methods: {formatTime(ts) {if (!ts) return '';const date = new Date(ts * 1000); return date.toLocaleString(); },toggleReplyBox() {console.log('toggleReplyBox');if (this.setActiveReplyId) {this.setActiveReplyId(this.isReplyBoxVisible ? null : this.replyData.curCommentId);}},submitReply(id) {if (this.replyContent.trim()) {const replyComment = this.sendWSMessage;console.log('提交的回复内容:', this.replyContent);this.isLoading = true;console.log('this.videoId', this.videoId);const comment = {"videoId": this.videoId,"rootCommentId": id,"parentId": this.replyData.curCommentId,"parentUserId": this.replyData.userId,"parentUserName": this.replyData.userName,"curCommentId": new ObjectId().toString(),"userId": this.userInfo.userId,"userName": this.userInfo.userName,"userAvatar": this.userInfo.userAvatar,"content": this.replyContent,"commentType": 1,};replyComment(comment)this.$emit('post-submit-reply', comment);this.isLoading = false;this.replyContent = '';this.setActiveReplyId(null);} else {this.$message.error('请输入回复内容');}}},watch: {replyData: {handler(newValue) {console.log('newValue', newValue.anthTags);},deep: true}},mounted() {console.log("newValue", this.replyData.anthTags);}
};
</script><style scoped>
/* 样式部分保持不变 */
.but {width: 60px;padding: 5px 0px;background: #F1F1F1;border-radius: 4px;display: flex;justify-content: center;align-content: center;font-weight: 400;font-size: 14px;color: #0F1014;margin-left: 32px;cursor: pointer;
}.but:hover {background: #ebe4e4;
}.content {font-weight: 400;font-size: 18px;color: #000000;line-height: 21px;text-align: left;margin-left: 32px;margin-top: 10px;
}.time {font-weight: 400;font-size: 12px;color: #666666;line-height: 14px;text-align: left;
}.hf {font-weight: 400;font-size: 14px;color: #B9B9B9;line-height: 16px;text-align: left;
}.tags {width: 32px;height: 18px;background: #0F1014;border-radius: 4px;color: #FFFFFF;font-weight: 400;font-size: 10px;line-height: 12px;text-align: center;display: flex;justify-content: center;align-items: center;
}.username {height: 24px;font-weight: 500;font-size: 13px;color: #0F1014;line-height: 15px;display: flex;justify-content: center;align-items: center;
}.top-user {display: flex;align-items: center;gap: 8px;
}.reply-comments {display: flex;flex-direction: column;margin-top: 1em;
}.reply-box {margin-top: 10px;display: flex;flex-direction: column;gap: 10px;align-items: end;position: relative;width: 95%;align-self: flex-end;
}.reply-box textarea {width: 100%;padding: 10px;border-radius: 4px;border: 1px solid #ddd;resize: none;outline: none;
}.reply-box button {align-self: flex-end;padding: 10px 20px;border-radius: 4px;border: none;background-color: #070707;color: white;cursor: pointer;
}.reply-box button:hover {background-color: #2d2d2d;
}
</style>

3.index.Vue文件

<template><div class="video-page-container"><!-- 视频播放区 --><div class="video-player-wrapper"><easy-player:key="videoUrl"ref="videoplay":video-url="videoUrl":show-progress="true"format="hls"class="video-player"@error="restartPlayer"/></div><!-- 评论发布区 --><div class="top-comment"><TopCommentReply @post-submit-top-reply="recvTopHandler" /></div><!-- 评论列表区 --><div class="comments-section"><divv-for="comment in commentList":key="comment.id"class="comment-wrapper"><CommentSection :data="comment" /></div></div></div>
</template><script>
import { computed, ref } from 'vue';
import CommentSection from './components/commentSection.vue';
import TopCommentReply from './components/topCommentReply.vue';
import { getComment } from '@/apis/comment/comment.js';
import { ElMessage } from 'element-plus';export default {name: "VideoPlayer",components: {CommentSection,TopCommentReply},inject:["userInfo", "ws"],data() {return {videoId: this.$route.params.videoId,videoUrl: this.$route.query.videoUrl,userId: 0,userImg: "",// userInfo: {},activeReplyId: ref(null),commentList: [],};},created() {this.fetchComments();// this.initWebSocket();},// mounted() {//   this.initWebSocket();// },provide() {return {sendWSMessage: this.sendWSMessage,setActiveReplyId: this.setActiveReplyId,activeReplyId: computed(() => this.activeReplyId),// userInfo: computed(() => this.userInfo),videoId: computed(() => this.videoId),};},// beforeUnmount() {//   if (this.ws) {//     this.ws.close();//   }// },methods: {async fetchComments() {const jsonData = {rootCommentId: "-1",commentType: 0,page: 1,};try {const [error, data] = await getComment(this.videoId, jsonData);if (error) throw error;this.commentList = data.comments;} catch (err) {console.error('获取评论失败:', err);}},// initWebSocket() {//   const Url = "ws://192.168.229.130:8080/video/ws/comment?userId=";//   this.userId = sessionStorage.getItem('userId')//   const wsUrl = Url + this.userId;//   console.log("wsUrl", wsUrl);//   // console.log("ws userInfo", this.userInfo);//   // this.userInfo = {//   //   userId: this.userId,//   //   userAvatar: "http://localhost:8888/video/static/covers/57739617071403008.png",//   //   userName: "JohnDoe",//   // };//   this.ws = new WebSocket(wsUrl);//   this.ws.onopen = () => {//     console.log("WebSocket连接成功");//   };//   this.ws.onmessage = (event) => {//     const msg = JSON.parse(event.data);//     console.log("WebSocket消息:", msg);//   };//   this.ws.onerror = (error) => {//     console.error("WebSocket错误:", error);//   };//   this.ws.onclose = () => {//     console.log("WebSocket连接关闭");//   };// },recvTopHandler(comment) {this.commentList.push(comment);},sendWSMessage(comment) {if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {console.error('WebSocket未连接');return false;}try {const jsonStr = JSON.stringify(comment);this.ws.send(jsonStr);ElMessage.success('消息已发送');return true;} catch (error) {ElMessage.error('消息发送失败');console.error('消息发送失败:', error);return false;}},setActiveReplyId(id) {this.activeReplyId = id;},restartPlayer() {console.log("播放器出错,尝试重新加载...");},},
};
</script><style scoped>
.video-page-container {display: flex;flex-direction: column;align-items: center;width: 100%;
}/* 视频播放器区域 */
.video-player-wrapper {width: 100%;max-width: 1200px;background: #000;aspect-ratio: 16/9; /* 保持16:9比例 */margin-bottom: 20px;
}.video-player {width: 100%;height: 100%;object-fit: contain;
}/* 发布评论输入框 */
.top-comment {width: 100%;max-width: 1200px;padding: 10px;background: #fff;margin-bottom: 10px;
}/* 评论区列表 */
.comments-section {width: 100%;max-width: 1200px;background: #fff;padding: 10px;box-sizing: border-box;
}.comment-wrapper {border-bottom: 1px solid #eee;padding: 10px 0;
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/diannao/90065.shtml
繁体地址,请注明出处:http://hk.pswp.cn/diannao/90065.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

差分定位技术:原理、分类与应用场景

文章目录 简介基本概念位置差分伪距差分载波相位 差分定位技术精密单点定位&#xff08;PPP&#xff09;差分全球定位系统&#xff08;DGPS&#xff09;实时动态定位&#xff08;RTK&#xff09; 应用场景总结 简介 差分定位&#xff08;Differential Positioning&#xff09;是…

tomcat的tar包转换成rpm包的保姆级教程

环境说明 &#xff1a;centos 71. 安装打包工具&#xff1a;yum install -y rpm-build rpmdevtools2. 创建 RPM 打包环境&#xff1a;rpmdev-setuptree​输入之后是下面的结果~/rpmbuild/ ├── BUILD ├── RPMS ├── SOURCES ├── SPECS └── SRPMS​准备 Tomcat 源码…

【牛客算法】小美的数组删除

文章目录 一、题目介绍二、解题思路三、解题算法实现四、算法分析4.1 代码逻辑4.2 逆向遍历求MEX的设计精妙之处4.2.1 逆向遍历:解决MEX更新的连续性4.2.2 利用MEX的单调性4.2.3 空间复用与状态压缩4.2.4 与问题特性的完美契合4.2.5 总结:为什么说这个设计“妙”?五、算法复…

MyBatisPlus-01-环境初始化及简单应用

文章目录【README】【1】springboot集成mybatis-plus配置【1.1】目录结构【相关说明】【1.2】代码示例【pom.xml】【application.properties】【MybatisPlusNoteController】【UserAppService】【UserMapper】【UserPO】【建表语句】【2】演示【README】 本文代码参见&#xf…

Web爬虫编程语言选择指南

刚学爬虫的小伙伴常常为选择那种语言来写爬虫而烦恼&#xff0c;今天我将总结几种语言的优劣势&#xff0c;然后选择适合编写 Web爬虫 的编程语言。这就需要我们考虑开发效率、生态库支持、并发性能等因素。以下是主流选择及特点跟着一起看看吧&#xff1a; 1. Python&#xff…

学习日志06 python

加油&#xff0c;今天的任务是学习面向对象编程&#xff0c;设计一个简单的宠物管理系统&#xff08;宠物类、猫 / 狗子类&#xff09;&#xff0c;先做5道题目开启学习状态吧&#xff01;1 setdefault()在 Python 中&#xff0c;setdefault() 是字典&#xff08;dict&#xff…

基于Java+springboot 的车险理赔信息管理系统

源码、数据库、包调试源码编号&#xff1a;S595源码名称&#xff1a;基于springboot 的车险理赔信息管理系统用户类型&#xff1a;多角色&#xff0c;用户、事故调查员、管理员数据库表数量&#xff1a;14 张表主要技术&#xff1a;Java、Vue、ElementUl 、SpringBoot、Maven运…

MyDockFinder 绿色便携版 | 一键仿Mac桌面,非常简单

如果你既不想升级到Win11&#xff0c;又想体验Mac桌面的高级感&#xff0c;那么MyDockFinder将是你的最佳选择。这是一款专为Windows系统设计的桌面美化工具&#xff0c;能够将你的桌面转变成MacOS的风格。它提供了类似Dock栏和Finder的功能&#xff0c;让你在不更换操作系统的…

Babylon.js 材质克隆与纹理共享:你可能遇到的问题及解决方案

在 Babylon.js 中&#xff0c;材质&#xff08;Material&#xff09;和纹理&#xff08;Texture&#xff09;的克隆行为可能会影响渲染性能和内存管理&#xff0c;尤其是在多个材质共享同一纹理的情况下。本文将探讨&#xff1a;PBRMetallicRoughnessMaterial 的克隆机制&#…

信息素养复赛模拟1和模拟2的编程题标程

信息素养复赛模拟 11&#xff1a;楼层编号 #include<bits/stdc.h> using namespace std; int main(){int n, t;cin >> n >> t;int res 0;for(int i 1; i < n; i ){int x i;bool ok true;while(x){if(x % 10 t){ok false;}x / 10;}res ok;} cout &l…

Hadoop高可用集群搭建

Hadoop高可用(HA)集群是企业级大数据平台的核心基础设施&#xff0c;通过多主节点冗余和自动故障转移机制&#xff0c;确保系统在单点故障时仍能正常运行。本文将详细介绍如何基于CentOS 7搭建Hadoop 3.X高可用集群&#xff0c;涵盖环境准备、组件配置、集群启动及管理的全流程…

Next.js 实战笔记 1.0:架构重构与 App Router 核心机制详解

Next.js 实战笔记 1.0&#xff1a;架构重构与 App Router 核心机制详解 上一次写 Next 相关的东西都是 3 年前的事情了&#xff0c;这 3 年里 Next 也经历了 2-3 次的大版本变化。当时写的时候 Next 是 12 还是 13 的&#xff0c;现在已经是 15 了&#xff0c;从 build 到实现…

Pillow 安装使用教程

一、Pillow 简介 Pillow 是 Python 图像处理库 PIL&#xff08;Python Imaging Library&#xff09;的友好分支&#xff0c;是图像处理的事实标准。它支持打开、编辑、转换、保存多种图像格式&#xff0c;常用于图像批量处理、验证码识别、缩略图生成等应用场景。 二、安装 Pi…

SQL Server从入门到项目实践(超值版)读书笔记 20

9.4 数据的嵌套查询所谓嵌套查询&#xff0c;就是在一个查询语句中&#xff0c;嵌套进另一个查询语句&#xff0c;即&#xff0c;查询语句中可以使用另一个查询语句中得到的查询结果&#xff0c;子查询可以基于一张表或者多张表。子查询中常用的操作符有ANY、SOME、ALL、IN、EX…

【MySQL\Oracle\PostgreSQL】迁移到openGauss数据出现的问题解决方案

【MySQL\Oracle\PostgreSQL】迁移到openGauss数据出现的问题解决方案 问题1&#xff1a;序列值不自动刷新问题 下面SQL只针对单库操作以及每个序列只绑定一张表的情况 -- 自动生成的序列&#xff0c;设置序列值 with sequences as (select *from (select table_schema,table_…

【Maven】Maven命令大全手册:28个核心指令使用场景

Maven命令大全手册&#xff1a;28个核心指令使用场景 Maven命令大全手册&#xff1a;28个核心指令深度解析一、构建生命周期核心命令1. mvn clean2. mvn compile3. mvn test4. mvn package5. mvn install6. mvn deploy二、依赖管理命令7. mvn dependency:tree8. mvn dependency…

大语言模型(LLM)按架构分类

大语言模型&#xff08;LLM&#xff09;按架构分类的深度解析 1. 仅编码器架构&#xff08;Encoder-Only&#xff09; 原理 双向注意力机制&#xff1a;通过Transformer编码器同时捕捉上下文所有位置的依赖关系# 伪代码示例&#xff1a;BERT的MLM任务 masked_input "Th…

MySQL(120)如何进行数据脱敏?

数据脱敏&#xff08;Data Masking&#xff09;是指通过某种方式对敏感数据进行变形&#xff0c;使其在使用过程中无法识别原始数据&#xff0c;从而保护数据隐私。数据脱敏通常应用在开发、测试和数据分析等场景中。下面我们详细介绍如何在Java应用程序中进行数据脱敏&#xf…

使用 Dockerfile 构建基于 .NET9 的跨平台基础镜像

官方基础镜像准备 微软官方 dotnet sdk 基础镜像&#xff1a; docker pull mcr.microsoft.com/dotnet/sdk:9.0拉取 ubuntu 镜像&#xff1a; docker pull ubuntu:24.04更多资源请参考&#xff1a; dotnet sdk images&#xff0c;https://mcr.microsoft.com/en-us/artifact/mar/…

C++ : 线程库

C : 线程库一、线程thread1.1 thread类1.1.1 thread对象构造函数1.1.2 thread类的成员函数1.1.3 线程函数的参数问题1.2 this_thread 命名空间域1.2.1 chrono二、mutex互斥量库2.1 mutex的四种类型2.1.1 mutex 互斥锁2.2.2 timed_mutex 时间锁2.2.3 recursive_muetx 递归锁2.2.…