当前位置: 首页 > news >正文

uniapp在H5端实现PDF和视频的上传、预览、下载

上传

在这里插入图片描述

上传页面

		<u-form-item :label="(form.ququ3 == 1 ? '参培' : form.ququ3 == 2 ? '授课' : '') + '证明材料'" prop="ququ6" required><u-button @click="upload" slot="right" type="primary" icon="arrow-upward" text="上传文件" size="small"></u-button></u-form-item><view class="red">只能上传视频和pdf文件(支持.pdf, .mp4, .avi, .ts)</view><view v-for="(item, i) in form.ququ6" :key="i" class="mb-20 flex "><view class="flex_l" @click="preview(item)"><image style="width: 46rpx;height: 46rpx;":src="item.split('.')[item.split('.').length - 1] == 'pdf' ? '/static/pdf.png' : '/static/video.png'"></image><view class="blue ml-20 u-line-1 flex-1 over-hidden">{{ item.split('-')[item.split('-').length - 1] }}</view></view><!-- <view class="blue" @click="preview(item)">预览</view> --></view>import { uploadFile } from '../../common/common'
upload() {uploadFile(6).then(res => {console.log(2222, res)this.form.ququ6 = this.form.ququ6.concat(res)})
},

上传方法

/*** 上传视频和pdf文件* @param {*} count 个数* @returns arr-- 最终结果   ['img','img']*/
export let uploadFile = (count = 1) => {return new Promise((resolve, reject) => {uni.chooseFile({count: count,extension: ['.pdf', '.mp4', '.avi', '.ts'],success: function (res) {uni.showLoading({title: '上传中'})let imgarr = res.tempFilePathslet arr = []imgarr.forEach(item => {uni.uploadFile({url: '/prod-api' + '/file/upload',filePath: item,name: 'file',header: {Authorization: uni.getStorageSync('token') || ''},success: (res) => {console.log(JSON.parse(res.data))arr.push(JSON.parse(res.data).data.url)if (arr.length == imgarr.length) {uni.hideLoading()let arr1 = arr.filter(item => ['pdf', 'mp4', 'avi', 'ts'].includes(item.split('.')[item.split('.').length - 1]))if (arr1.length != arr.length) {uni.showToast({title: '只能上传视频和pdf文件',icon: 'none'})}resolve(arr1)}},fail: () => {uni.showToast({title: '上传失败',icon: 'none'})}});})}});})
}

整个页面静态

<template><view class="ptb-20 plr-30 bg min100"><view class="bg-white radius-20 pd-30"><u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" labelWidth="100"><u-form-item label="培训主题名" prop="ququ1" required><u--input v-model="form.ququ1" disabledColor="#ffffff" placeholder="请输入主题名" border="none"></u--input></u-form-item><u-form-item label="培训分类" prop="ququ2" required @click="showPop(1)"><u--input class="disabled" v-model="form.ququ2" disabled disabledColor="#ffffff" placeholder="请选择培训分类"border="none"></u--input><u-icon slot="right" name="arrow-right"></u-icon></u-form-item><u-form-item label="本人所属类别" prop="ququ3" required><u-radio-group v-model="form.ququ3" placement="row"><u-radio class="mr-20" label="参培人" name='1'></u-radio><u-radio label="授课人" name='2'></u-radio></u-radio-group></u-form-item><u-form-item label="参与地点" prop="ququ4"><u--input v-model="form.ququ4" placeholder="请输入参与地点" border="none"></u--input></u-form-item><u-form-item label="起止日期" prop="ququ5" @click="showPop(2)" required><u--input class="disabled" v-model="form.ququ5" disabled disabledColor="#ffffff" placeholder="请选择起止日期"border="none"></u--input><u-icon slot="right" name="arrow-right"></u-icon></u-form-item><u-form-item :label="(form.ququ3 == 1 ? '参培' : form.ququ3 == 2 ? '授课' : '') + '证明材料'" prop="ququ6" required><u-button @click="upload" slot="right" type="primary" icon="arrow-upward" text="上传文件" size="small"></u-button></u-form-item><view class="red">只能上传视频和pdf文件(支持.pdf, .mp4, .avi, .ts)</view><view v-for="(item, i) in form.ququ6" :key="i" class="mb-20 flex "><view class="flex_l" @click="preview(item)"><image style="width: 46rpx;height: 46rpx;":src="item.split('.')[item.split('.').length - 1] == 'pdf' ? '/static/pdf.png' : '/static/video.png'"></image><view class="blue ml-20 u-line-1 flex-1 over-hidden">{{ item.split('-')[item.split('-').length - 1] }}</view></view><!-- <view class="blue" @click="preview(item)">预览</view> --></view><u-form-item label="备注" prop="ququ7"><u--textarea v-model="form.ququ7" placeholder="请输入备注" maxlength="150" count autoHeightborder="none"></u--textarea></u-form-item></u--form><!-- 下拉选择框 --><u-action-sheet :show="show" :actions="actions" title="请选择" @close="close" @select="confirmSelect"></u-action-sheet><!-- 日历选择范围 --><u-calendar :maxDate="maxDate" :minDate="minDate" monthNum="10" :show="showDate" mode="range" @confirm="confirmDate"@close="close"></u-calendar><view class="flex mt-60"><u-button @click="reset">重置</u-button><u-button type="primary" plain class="mlr-20" @click="save">保存草稿</u-button><u-button type="primary" @click="submit">提交审核</u-button></view></view></view>
</template><script>
import { uploadFile } from '../../common/common'
const d = new Date()
const year = d.getFullYear()
let month = d.getMonth() + 1
month = month < 10 ? `0${month}` : month
const date = d.getDate()
export default {data() {return {show: false,type: null,actions: [],showDate: false, // 日期选择maxDate: `${year}-${month + 1}-${date}`,minDate: `${year}-${month - 8}-${date}`,form: {ququ1: '',ququ2: '',ququ2Id: '',ququ3: '',ququ4: '',ququ5: '',ququ6: [],ququ7: '',},rules: {'ququ1': {required: true,message: '请输入主题名',trigger: ['blur']},'ququ2': {required: true,message: '请选择培训分类',trigger: ['blur', 'change']},'ququ3': {required: true,message: '请选择所属类别',trigger: ['blur', 'change']},'ququ5': {required: true,message: '请选择起止日期',trigger: ['blur', 'change']},},};},onLoad() {},methods: {showPop(type) {this.type = typeif (type == 1) {this.show = truethis.actions = [{name: '培训分类1',id: 1},{name: '培训分类2',id: 2},]} else {this.showDate = true}},close() {this.show = falsethis.showDate = falsethis.type = null},confirmSelect(e) {this.form['ququ2'] = e.namethis.form['ququ2Id'] = e.idthis.$refs.uForm.validateField('ququ2')},confirmDate(e) {console.log(e);this.form['ququ5'] = e[0] + '~' + e[e.length - 1]this.showDate = false},upload() {uploadFile(6).then(res => {console.log(2222, res)this.form.ququ6 = this.form.ququ6.concat(res)})},preview(item) {if (item.split('.')[item.split('.').length - 1] == 'pdf') {uni.navigateTo({url: '/pages/course/pdf?url=' + item})} else {// uni.navigateTo({//   url: '/pages/course/video?url=' + item// })window.open(item)}},submit() {this.$refs.uForm.validate().then(res => {if (!this.form.ququ6.length) {uni.$u.toast('请上传证明材料')return}uni.$u.toast('校验通过')this.$http('/system/user/profile', {avatar: this.form}, "post").then(res => {uni.showToast({title: '提交成功',})})}).catch(errors => {uni.$u.toast('校验失败')})},save() {this.$http('/system/user/profile', {avatar: this.form}, "post").then(res => {uni.showToast({title: '保存成功',})})},reset() {this.$refs.uForm.resetFields()},},};
</script><style scoped lang="scss"></style>

预览和下载

在这里插入图片描述

预览页面 PDF预览详见

 <view class="title-left bold mtb-20">附件记录</view><view v-for="(item, i) in form.ququ6" :key="i" class="mb-20 ml-30 flex"><view class="flex_l" @click="preview(item)"><image style="width: 46rpx;height: 46rpx;":src="item.split('.')[item.split('.').length - 1] == 'pdf' ? '/static/pdf.png' : '/static/video.png'"></image><view class="blue ml-20 u-line-1 flex-1 over-hidden">{{ item.split('-')[item.split('-').length - 1] }}</view></view><view class="green" @click="downLoad(item)">下载</view></view>data() {return {form: {ququ6: ["https://cscec83-learnplatform.oss-cn-shanghai.aliyuncs.com/test/2023-11-27/6a12b9ca-3ae9-435b-b023-0f9c119afad3-1.mp4", "https://cscec83-learnplatform.oss-cn-shanghai.aliyuncs.com/test/2023-11-27/53aa1f60-0735-4203-86b2-c2b8b019e8d9-我的哈哈.pdf"]}}},preview(item) {if (item.split('.')[item.split('.').length - 1] == 'pdf') {uni.navigateTo({url: '/pages/course/pdf?url=' + item})} else {// uni.navigateTo({//   url: '/pages/course/video?url=' + item// })window.open(item)}},downLoad(url) {if (url.split('.')[url.split('.').length - 1] == 'pdf') {window.open(url)} else {let xhr = new XMLHttpRequest();xhr.open('GET', url, true);xhr.responseType = 'blob'; // 返回类型blobxhr.onload = function () {if (xhr.readyState === 4 && xhr.status === 200) {let blob = this.response;// 转换一个blob链接let u = window.URL.createObjectURL(new Blob([blob]));let a = document.createElement('a');a.download = url.split('-')[url.split('-').length - 1]; //下载后保存的名称a.href = u;a.style.display = 'none';document.body.appendChild(a);a.click();a.remove();uni.hideLoading();}};xhr.send()}},

详情页面静态

<template><view class="mlr-30 pt-20"><view class="title-left bold mb-20">培训详情</view><u-cell-group :border="false"><u-cell :border="false" title="培训主题名" :value="userInfo.nickName"></u-cell><u-cell :border="false" title="培训分类" :value="userInfo.sex"></u-cell><u-cell :border="false" title="本人所属类别" :value="userInfo.sex == 1 ? '参培人' : '授课人'"></u-cell><u-cell :border="false" title="起止日期" :value="userInfo.phonenumber"></u-cell><u-cell :border="false" title="参与地点" :value="userInfo.nickName"></u-cell><u-cell :border="false" title="提交时间" :value="userInfo.nickName"></u-cell></u-cell-group><view class="title-left bold mtb-20">附件记录</view><view v-for="(item, i) in form.ququ6" :key="i" class="mb-20 ml-30 flex"><view class="flex_l" @click="preview(item)"><image style="width: 46rpx;height: 46rpx;":src="item.split('.')[item.split('.').length - 1] == 'pdf' ? '/static/pdf.png' : '/static/video.png'"></image><view class="blue ml-20 u-line-1 flex-1 over-hidden">{{ item.split('-')[item.split('-').length - 1] }}</view></view><view class="green" @click="downLoad(item)">下载</view></view><view class="title-left bold mb-20">审批详情</view><u-cell-group :border="false"><u-cell :border="false" title="审批状态" :value="userInfo.nickName"></u-cell><u-cell :border="false" title="当前审批人" :value="userInfo.sex"></u-cell></u-cell-group><view class="flex mt-60"><u-button @click="back">返回首页</u-button><u-button type="primary" plain class="mlr-20" @click="edit">修改</u-button><u-button type="primary" @click="revoke">撤回流程</u-button></view></view>
</template><script>
import {mapState
} from 'vuex'
export default {data() {return {form: {ququ6: ["https://cscec83-learnplatform.oss-cn-shanghai.aliyuncs.com/test/2023-11-27/6a12b9ca-3ae9-435b-b023-0f9c119afad3-1.mp4", "https://cscec83-learnplatform.oss-cn-shanghai.aliyuncs.com/test/2023-11-27/53aa1f60-0735-4203-86b2-c2b8b019e8d9-我的哈哈.pdf"]}}},computed: {...mapState(['userInfo']),},onLoad() {// 刷新个人信息this.$store.dispatch('updateUserInfo')this.img = this.userInfo.avatar ? this.userInfo.avatar : '/static/user-default.png'},methods: {preview(item) {if (item.split('.')[item.split('.').length - 1] == 'pdf') {uni.navigateTo({url: '/pages/course/pdf?url=' + item})} else {// uni.navigateTo({//   url: '/pages/course/video?url=' + item// })window.open(item)}},downLoad(url) {if (url.split('.')[url.split('.').length - 1] == 'pdf') {window.open(url)} else {let xhr = new XMLHttpRequest();xhr.open('GET', url, true);xhr.responseType = 'blob'; // 返回类型blobxhr.onload = function () {if (xhr.readyState === 4 && xhr.status === 200) {let blob = this.response;// 转换一个blob链接let u = window.URL.createObjectURL(new Blob([blob]));let a = document.createElement('a');a.download = url.split('-')[url.split('-').length - 1]; //下载后保存的名称a.href = u;a.style.display = 'none';document.body.appendChild(a);a.click();a.remove();uni.hideLoading();}};xhr.send()}},revoke() {this.$http('/system/user/profile', {avatar: 1}, "put").then(res => {uni.showToast({title: '撤回成功',})})},edit() {uni.navigateTo({url: './add?id=1'})},back() {uni.navigateBack()}}
}
</script><style lang="scss" scoped>
::v-deep .u-cell__body {padding: 5px 15px !important;
}
</style>

完整的上传视频、上传pdf、上传图片 方法封装(需要传递name、size、时长)

/***  上传图片*  count-- 可选张数* 	arr-- 最终结果   ['img','img']*/
export let upload = (count = 1) => {console.log(count);return new Promise((resolve, reject) => {uni.chooseImage({count: count,sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有success: function (res) {uni.showLoading({title: '上传中'})let imgarr = res.tempFilePathslet arr = []imgarr.forEach(item => {uni.uploadFile({url: '/prod-api' + '/file/upload',filePath: item,name: 'file',header: {Authorization: uni.getStorageSync('token') || ''},success: (res) => {console.log(JSON.parse(res.data))uni.hideLoading()arr.push(JSON.parse(res.data).data.url)if (arr.length == imgarr.length) {resolve(arr)}},fail: () => {uni.showToast({title: '上传失败',icon: 'none'})}});})}});})
}
/*** 上传pdf文件* @param {*} count 个数* @returns arr-- 最终结果   ['img','img']*/
export let uploadFile = (count = 1) => {return new Promise((resolve, reject) => {uni.chooseFile({count: count,extension: ['.pdf'],success: function (res) {console.log(888, res)uni.showLoading({title: '上传中'})let imgarr = res.tempFileslet arr = []imgarr.forEach(item => {uni.uploadFile({url: '/prod-api' + '/file/appUpload', //接口地址filePath: item.path, // 上传文件参数值name: 'file', // 上传文件参数名formData: {  // 额外参数fileName: item.name,size: (item.size / 1024 / 1024).toFixed(2),type: 'pdf',},header: { //请求头Authorization: uni.getStorageSync('token') || ''},success: (res) => {arr.push(JSON.parse(res.data).data)if (arr.length == imgarr.length) {uni.hideLoading()let arr1 = arr.filter(item => 'pdf' == item.fileName.split('.')[item.fileName.split('.').length - 1])if (arr1.length != arr.length) {uni.showToast({title: '只能上传pdf文件',icon: 'none'})}resolve(arr1)}},fail: () => {uni.showToast({title: '上传失败',icon: 'none'})}});})}});})
}
/** 上传视频* 	arr-- 最终结果   [{img1:'全路径',img2:'半路径'},{img1:'全路径',img2:'半路径'}]*/
export let uploadVideo = () => {return new Promise((resolve, reject) => {uni.chooseVideo({count: 1,success: function (res) {uni.showLoading({title: '上传中'})console.log(111111111111, res)uni.uploadFile({url: '/prod-api' + '/file/appUpload', //接口地址filePath: res.tempFilePath, // 上传文件参数值name: 'file', // 上传文件参数名formData: {  // 额外参数,formData传参fileName: res.name,size: (res.size / 1024 / 1024).toFixed(2),duration: res.duration,type: 'video',},header: { //请求头Authorization: uni.getStorageSync('token') || ''},success: (res) => {uni.hideLoading()if (JSON.parse(res.data).code == '200') {resolve(JSON.parse(res.data).data)} else {uni.showToast({title: JSON.parse(res.data).msg,icon: 'none'})}},fail: () => {uni.showToast({title: '上传失败,请重试',icon: 'none'})}});}});})
}

相关文章:

uniapp在H5端实现PDF和视频的上传、预览、下载

上传 上传页面 <u-form-item :label"(form.ququ3 1 ? 参培 : form.ququ3 2 ? 授课 : ) 证明材料" prop"ququ6" required><u-button click"upload" slot"right" type"primary" icon"arrow-upward" t…...

Kafka报错under-replicated partitions

1 under-replicated partitions异常原因 Kafka报错under replicated partitions意味着某些分区的副本数量未达到预期的复制因子。 主要有两种原因&#xff0c; Broker故障 如果某个Kafka Broker发生故障&#xff0c;导致其中一些分区的副本不再可用&#xff0c;那么这些分区就…...

【Python基础】字符集与字符编码

先行了解的知识&#xff1a; 1. 编码和解码 计算机内存储的信息都是二进制表示。 我们看到的英文&#xff0c;数字&#xff0c;汉字等在计算机内如何表示&#xff0c;那就需要编码 计算机内存储的信息需要解析出来&#xff0c;那就是解码 2.字符集与分类 什么是字符集&#xf…...

C# AES-128-CBC 加密

一、加密 /// <summary>/// 加密/// </summary>public static string AesEncrypt(string toEncrypt){byte[] toEncryptArray UTF8Encoding.UTF8.GetBytes(toEncrypt);byte[] keyArray UTF8Encoding.UTF8.GetBytes(Key);//注意编码格式(utf8编码 UTF8Encoding)byt…...

【惊喜福利】Docker容器化部署nextcloud网盘,享受高速稳定的文件共享体验!

Docker搭建nextcloud网盘 NextCloud是一款开源网络硬盘系统&#xff0c;它是一个私有、安全且功能完整的文件同步与共享解决方案&#xff0c;可以搭建一套属于自己或团队的云同步网盘。NextCloud的客户端覆盖了各种平台&#xff0c;包括Windows、Mac、Android、iOS、Linux等&am…...

WPF实战项目十九(客户端):修改RestSharp的引用

修改HttpRestClient&#xff0c;更新RestSharp到110.2.0&#xff0c;因为106版本和110版本的代码不一样&#xff0c;所以需要修改下代码 using Newtonsoft.Json; using RestSharp; using System; using System.Threading.Tasks; using WPFProjectShared;namespace WPFProject.S…...

kobs-ng 烧写nand中的uboot

如何获取kobs-ng 我是使用buildroot自动编译的imx-kobs&#xff0c;生成了kobs-ng可执行文件。 使用 kobs-ng 烧写 u-boot 1. flash_erase /dev/mtd0 0 0 //擦除uboot所在分区 2. 挂载 debugfs mount -t debugfs debugfs /sys/kernel/debug 如果不挂载为报以下错误&#x…...

【Java】扫描指定目录,并找到名称中包含指定字符的所有普通文件(不包含目录),并且后续询问该用户是否要删除该文件

题目如下 扫描指定目录&#xff0c;并找到名称中包含指定字符的所有普通文件(不包含目录)&#xff0c;并且后续询问该用户是否要删除该文件 本题是关于文件I/O知识中对文件系统操作的应用&#xff0c;解答的完整代码如下&#xff08;需要的uu自取&#xff09;⬇️ 在完整…...

PyQt基础_008_ 按钮类控件QSpinbox

基本操作 import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import *class spindemo(QWidget):def __init__(self, parentNone):super(spindemo, self).__init__(parent)self.setWindowTitle("SpinBox 例子")self.resize(300,…...

3D点云目标检测:VoxelNex解读

VoxelNext 通用检测器 vs VoxelNext一、3D稀疏卷积模块1.1、额外的两次下采样消融实验结果代码 1.2、稀疏体素删减消融实验&#xff1a;代码 二、稀疏体素高度压缩代码 三、稀疏预测head 通用检测器 vs VoxelNext 一、3D稀疏卷积模块 1.1、额外的两次下采样 使用通用的3D spa…...

opencv-利用DeepLabV3+模型进行图像分割去除输入图像的背景

分离图像中的人物和背景通常需要一些先进的图像分割技术。GrabCut是一种常见的方法&#xff0c;但是对于更复杂的场景&#xff0c;可能需要使用深度学习模型。以下是使用深度学习模型&#xff08;如人像分割模型&#xff09;的示例代码&#xff1a; #导入相关的库 import cv2 …...

中国版的 GPTs:InsCode AI 生成应用

前言 在上一篇文章 《InsCode&#xff1a;这可能是下一代应用开发平台&#xff1f;》中&#xff0c;我们介绍了一个新的应用开发平台 InsCode&#xff0c;它是基于云原生开发环境 云 IDE AI 辅助编程的一站式在线开发平台。 最近&#xff0c;InsCode 又推出了另一种全新的开…...

MySQL 学习笔记(刷题篇)

SQL进阶挑战 聚合分组查询 SQL123 select tag, difficulty, round((sum(score) - max(score) - min(score) ) / (count(score) - 2) ,1) as clip_avg_score from examination_info as ei, exam_record as er where ei.exam_id er.exam_id and ei.tag SQL and ei.diffi…...

windows系统如何配置yarn环境变量

启动前端项目&#xff0c;突然遇到报错&#xff1a; 原因在于没有安装yarn&#xff0c;或没有配置环境变量。 全局安装 yarn 可在vsCode中输入&#xff0c;也可在命令行输入&#xff08;winR&#xff0c;输入cmd&#xff09; npm install -g yarn添加环境变量 找到yarn的安…...

视频中的文字水印怎么去除?这三招学会轻松去视频水印

短视频与我们生活&#xff0c;工作息息相关&#xff0c;日常在在刷短视频时&#xff0c;下载保存后发现带有文字logo水印&#xff0c;如果直接拿来进行二次创作&#xff0c;不仅影响观看效果&#xff0c;平台流量还会受限制。怎么去除视频中的文字水印就成为了当下热门话题之一…...

Java项目学生管理系统二查询所有

学生管理 近年来&#xff0c;Java作为一门广泛应用于后端开发的编程语言&#xff0c;具备了广泛的应用领域和丰富的开发资源。在前几天的博客中&#xff0c;我们探讨了如何搭建前后端环境&#xff0c;为接下来的开发工作打下了坚实的基础。今天&#xff0c;我们将进一步扩展我…...

27.Spring如何避免在并发下获取不完整的Bean?

Spring如何避免在并发下获取不完整的Bean? 1、为什么获取不到完整的Bean? 我们知道, 如果spring容器已经加载完了, 那么肯定所有bean都是完整的了, 但如果, spring没有加载完, 在加载的过程中, 构建bean就有可能出现不完整bean的情况 2、如何解决读取到不完整bean的问题. …...

浅析SD-WAN企业组网部署中简化网络运维的关键技术

网络已经成为现代企业不可或缺的基础设施&#xff0c;它为企业提供了连接全球的桥梁。随着全球化和数字化转型的加速推进&#xff0c;企业面临着越来越多的网络挑战和压力。传统的网络组网方式往往无法满足企业规模扩大、分支机构增多、上云服务等需求&#xff0c;导致网络性能…...

【Rust】快速教程——自定义类型、数字转枚举、Cargo运行

前言 超过一定的年龄之后&#xff0c;所谓人生&#xff0c;无非是一个不断丧失的过程而已。宝贵的东西&#xff0c;会像梳子豁了齿一样从手中滑落下去。你所爱的人会一个接着一个&#xff0c;从身旁悄然消逝。——《1Q84》 \;\\\;\\\; 目录 前言自定义类型数字转枚举Cargo.tom…...

python 实现 AIGC 大语言模型中的概率论:生日相同问题的代码场景模拟

对深度学习本质而言&#xff0c;它实际上就是应用复杂的数学模型对输入数据进行建模&#xff0c;最后使用训练好的模型来预测或生成新的数据&#xff0c;因此深度学习的技术本质其实就是数学。随着大语言模型的发展&#xff0c;人工智能的数学本质被进一步封装&#xff0c;从业…...

DeepSeek 赋能智慧能源:微电网优化调度的智能革新路径

目录 一、智慧能源微电网优化调度概述1.1 智慧能源微电网概念1.2 优化调度的重要性1.3 目前面临的挑战 二、DeepSeek 技术探秘2.1 DeepSeek 技术原理2.2 DeepSeek 独特优势2.3 DeepSeek 在 AI 领域地位 三、DeepSeek 在微电网优化调度中的应用剖析3.1 数据处理与分析3.2 预测与…...

React Native 开发环境搭建(全平台详解)

React Native 开发环境搭建&#xff08;全平台详解&#xff09; 在开始使用 React Native 开发移动应用之前&#xff0c;正确设置开发环境是至关重要的一步。本文将为你提供一份全面的指南&#xff0c;涵盖 macOS 和 Windows 平台的配置步骤&#xff0c;如何在 Android 和 iOS…...

服务器硬防的应用场景都有哪些?

服务器硬防是指一种通过硬件设备层面的安全措施来防御服务器系统受到网络攻击的方式&#xff0c;避免服务器受到各种恶意攻击和网络威胁&#xff0c;那么&#xff0c;服务器硬防通常都会应用在哪些场景当中呢&#xff1f; 硬防服务器中一般会配备入侵检测系统和预防系统&#x…...

LLM基础1_语言模型如何处理文本

基于GitHub项目&#xff1a;https://github.com/datawhalechina/llms-from-scratch-cn 工具介绍 tiktoken&#xff1a;OpenAI开发的专业"分词器" torch&#xff1a;Facebook开发的强力计算引擎&#xff0c;相当于超级计算器 理解词嵌入&#xff1a;给词语画"…...

【RockeMQ】第2节|RocketMQ快速实战以及核⼼概念详解(二)

升级Dledger高可用集群 一、主从架构的不足与Dledger的定位 主从架构缺陷 数据备份依赖Slave节点&#xff0c;但无自动故障转移能力&#xff0c;Master宕机后需人工切换&#xff0c;期间消息可能无法读取。Slave仅存储数据&#xff0c;无法主动升级为Master响应请求&#xff…...

多模态大语言模型arxiv论文略读(108)

CROME: Cross-Modal Adapters for Efficient Multimodal LLM ➡️ 论文标题&#xff1a;CROME: Cross-Modal Adapters for Efficient Multimodal LLM ➡️ 论文作者&#xff1a;Sayna Ebrahimi, Sercan O. Arik, Tejas Nama, Tomas Pfister ➡️ 研究机构: Google Cloud AI Re…...

网站指纹识别

网站指纹识别 网站的最基本组成&#xff1a;服务器&#xff08;操作系统&#xff09;、中间件&#xff08;web容器&#xff09;、脚本语言、数据厍 为什么要了解这些&#xff1f;举个例子&#xff1a;发现了一个文件读取漏洞&#xff0c;我们需要读/etc/passwd&#xff0c;如…...

保姆级教程:在无网络无显卡的Windows电脑的vscode本地部署deepseek

文章目录 1 前言2 部署流程2.1 准备工作2.2 Ollama2.2.1 使用有网络的电脑下载Ollama2.2.2 安装Ollama&#xff08;有网络的电脑&#xff09;2.2.3 安装Ollama&#xff08;无网络的电脑&#xff09;2.2.4 安装验证2.2.5 修改大模型安装位置2.2.6 下载Deepseek模型 2.3 将deepse…...

GruntJS-前端自动化任务运行器从入门到实战

Grunt 完全指南&#xff1a;从入门到实战 一、Grunt 是什么&#xff1f; Grunt是一个基于 Node.js 的前端自动化任务运行器&#xff0c;主要用于自动化执行项目开发中重复性高的任务&#xff0c;例如文件压缩、代码编译、语法检查、单元测试、文件合并等。通过配置简洁的任务…...

LangChain知识库管理后端接口:数据库操作详解—— 构建本地知识库系统的基础《二》

这段 Python 代码是一个完整的 知识库数据库操作模块&#xff0c;用于对本地知识库系统中的知识库进行增删改查&#xff08;CRUD&#xff09;操作。它基于 SQLAlchemy ORM 框架 和一个自定义的装饰器 with_session 实现数据库会话管理。 &#x1f4d8; 一、整体功能概述 该模块…...