uniapp实现多文件下载,保存到本地

概览

uniapp实现多文件下载,保存到本地,因为使用的是uni.downloadFile 实现文件的下载,每次只能下载一个,需要下载多个文件,并保存到本地,并把保存的地址存储到对应的数据组中,并实现进度条显示。

需求分析

1、文件下载并保存到本地 直接使用uni.downloadFile 和uni.saveFile 两个方法既可以实现。

2、如有多个文件下载,需要异步一个一个去下载,并把保存到本地的路径赋值给传过来的数据。

3、如果使用for循环,会存存储数据混乱的情况,或者说直接保存的路径只保存到了最后一个数组对象中,无法实现保存对应的存储路径到数组。

4、进度条显示,根据下载的方法,进行监听进度返回到页面进行显示进度条的变化。

具体实现

download.js 代码

// +----------------------------------------------------------------------
// | 下载工具类
// +----------------------------------------------------------------------
import {HTTP_REQUEST_URL
} from '@/config/app';
export const hostUrlUpLoad = HTTP_REQUEST_URL + '/upload/';
export const hostUrl = HTTP_REQUEST_URL;
import {getStudyData,getTestData
} from '@/api/api.js';/*** 下载分类相关数据* 图片加载到本地* @returns boolean*/
export async function downloadClass(data, inta) {if (data.length > 0 && inta < data.length) {try {const downloadTask = await uni.downloadFile({url: data[inta].icon_path.includes('upload') ? hostUrl + data[inta].icon_path :hostUrlUpLoad + data[inta].icon_path,success: res => {if (res.statusCode === 200) {uni.saveFile({tempFilePath: res.tempFilePath, // 下载文件的临时路径success: saveRes => {data[inta].icon_path = saveRes.savedFilePathif (inta < data.length - 1) {inta = inta + 1downloadClass(data, inta)} else {uni.setStorageSync('classData', data)}},fail: err => {if (inta < data.length - 1) {inta = inta + 1downloadClass(data, inta)} else {uni.setStorageSync('classData', data)}}});} else {if (inta < data.length - 1) {inta = inta + 1downloadClass(data, inta)} else {uni.setStorageSync('classData', data)}}},fail: err => {if (inta < data.length - 1) {inta = inta + 1downloadClass(data, inta)} else {uni.setStorageSync('classData', data)}}});downloadTask.onProgressUpdate(resda => {})} catch (e) {if (inta < data.length - 1) {inta = inta + 1downloadClass(data, inta)} else {uni.setStorageSync('classData', data)}//TODO handle the exception}}
}/*** 下载科目数据* 图片加载到本地* @returns boolean*/
export async function downloadSubject(data, inta, callBack) {var callBackFun = callBack;if (data.length > 0 && inta < data.length) {try {const downloadTask = await uni.downloadFile({url: data[inta].icon_path.includes('upload') ? hostUrl + data[inta].icon_path :hostUrlUpLoad + data[inta].icon_path,success: res => {if (res.statusCode === 200) {uni.saveFile({tempFilePath: res.tempFilePath, // 下载文件的临时路径success: saveRes => {data[inta].icon_path = saveRes.savedFilePathif (inta < data.length - 1) {inta = inta + 1downloadSubject(data, inta, callBackFun)} else {uni.setStorageSync('SubjectData', data, callBackFun)requestSubjectClass(data, 0, callBackFun)}},fail: err => {if (inta < data.length - 1) {inta = inta + 1downloadSubject(data, inta, callBackFun)} else {uni.setStorageSync('SubjectData', data)requestSubjectClass(data, 0, callBackFun)}}});} else {if (inta < data.length - 1) {inta = inta + 1downloadSubject(data, inta, callBackFun)} else {uni.setStorageSync('SubjectData', data)requestSubjectClass(data, 0, callBackFun)}}},fail: err => {if (inta < data.length - 1) {inta = inta + 1downloadSubject(data, inta, callBackFun)} else {uni.setStorageSync('SubjectData', data)requestSubjectClass(data, 0, callBackFun)}}});downloadTask.onProgressUpdate(resda => {callBackFun(resda.progress, false)})} catch (e) {//TODO handle the exceptionif (inta < data.length - 1) {inta = inta + 1downloadSubject(data, inta, callBackFun)} else {uni.setStorageSync('SubjectData', data)requestSubjectClass(data, 0, callBackFun)}}}
}/*** 根据科目列表赋值分类数据* @param {Object} data* @param {Object} inta*/
export async function requestSubjectClass(data, inta, callBack) {const callBackFun = callBack;if (data.length > 0 && inta < data.length) {try {await getStudyData(data[inta].id).then(res => {if (res.data.code == 200 && res.data.status == 'success' && res.data.data.count > 0) {data[inta].categoryData = res.data.data.listif (inta < data.length - 1) {inta = inta + 1requestSubjectClass(data, inta, callBackFun)} else {uni.setStorageSync('SubjectData', data)downloadSubjectFile(data, 0, 0, callBackFun)}} else {if (inta < data.length - 1) {inta = inta + 1requestSubjectClass(data, inta, callBackFun)} else {uni.setStorageSync('SubjectData', data)downloadSubjectFile(data, 0, 0, callBackFun)}}})} catch (e) {//TODO handle the exceptionif (inta < data.length - 1) {inta = inta + 1requestSubjectClass(data, inta, callBackFun)} else {uni.setStorageSync('SubjectData', data)downloadSubjectFile(data, 0, 0, callBackFun)}}}
}/*** 下载文件到本地* @returns boolean*/
export async function downloadSubjectFile(data, inta, intaClass, callBack) {const callBackFun = callBack;if (data.length > 0 && inta < data.length) {if (data[inta].categoryData.length > 0 && intaClass < data[inta].categoryData.length) {try {var filePath = ''if (data[inta].categoryData[intaClass].file_path.includes('upload')) {if (data[inta].categoryData[intaClass].file_path.charAt(0) == '/') {filePath = hostUrl + data[inta].categoryData[intaClass].file_path} else {filePath = "http://" + data[inta].categoryData[intaClass].file_path}} else {filePath = hostUrlUpLoad + data[inta].categoryData[intaClass].file_path}const downloadTask = await uni.downloadFile({url: filePath,success: res => {if (res.statusCode === 200) {uni.saveFile({tempFilePath: res.tempFilePath, // 下载文件的临时路径success: saveRes => {data[inta].categoryData[intaClass].file_path = saveRes.savedFilePathif (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1downloadSubjectFile(data, inta, intaClass,callBackFun)} else {if (inta < data.length - 1) {inta = inta + 1downloadSubjectFile(data, inta, 0, callBackFun)} else {uni.setStorageSync('SubjectData', data)callBackFun(100, true)}}},fail: err => {console.log("保存文件失败  ")if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1downloadSubjectFile(data, inta, intaClass,callBackFun)} else {if (inta < data.length - 1) {inta = inta + 1downloadSubjectFile(data, inta, 0, callBackFun)} else {uni.setStorageSync('SubjectData', data)callBackFun(100, true)}}}});} else {if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1downloadSubjectFile(data, inta, intaClass, callBackFun)} else {if (inta < data.length - 1) {inta = inta + 1downloadSubjectFile(data, inta, 0, callBackFun)} else {uni.setStorageSync('SubjectData', data)callBackFun(100, true)}}}},fail: err => {console.log("下载失败  fail  ")if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1downloadSubjectFile(data, inta, intaClass, callBackFun)} else {if (inta < data.length - 1) {inta = inta + 1downloadSubjectFile(data, inta, 0, callBackFun)} else {uni.setStorageSync('SubjectData', data)callBackFun(100, true)}}}});downloadTask.onProgressUpdate(resda => {callBackFun(resda.progress, false)})} catch (e) {//TODO handle the exceptionconsole.log("downloadSubjectFile  catch  " + JSON.stringify(e))if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1downloadSubjectFile(data, inta, intaClass, callBackFun)} else {if (inta < data.length - 1) {inta = inta + 1downloadSubjectFile(data, inta, 0, callBackFun)} else {console.log("打印保存的科目数据  downloadSubjectFile    " + JSON.stringify(data))uni.setStorageSync('SubjectData', data)callBackFun(100, true)}}}} else {if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1downloadSubjectFile(data, inta, intaClass, callBackFun)} else {if (inta < data.length - 1) {inta = inta + 1downloadSubjectFile(data, inta, 0, callBackFun)} else {console.log("打印保存的科目数据  downloadSubjectFile    " + JSON.stringify(data))uni.setStorageSync('SubjectData', data)callBackFun(100, true)}}}}
}/*** 根据科目列表获取题库* @param {Object} subjectData*/
export async function requestSubjectTestData(subjectData) {try {await getTestData(subjectData.id).then(res => {if (res.data.code == 200 && res.data.status == 'success') {uni.removeStorageSync('CNLLIST' + subjectData.id)uni.removeStorageSync('CNLLISTCOUNT' + subjectData.id)uni.removeStorageSync('ENLLIST' + subjectData.id)uni.removeStorageSync('ENLLISTCOUNT' + subjectData.id)uni.setStorageSync('CNLLIST' + subjectData.id, res.data.data.list)uni.setStorageSync('CNLLISTCOUNT' + subjectData.id, res.data.data.count)uni.setStorageSync('ENLLIST' + subjectData.id, res.data.data.english_list)uni.setStorageSync('ENLLISTCOUNT' + subjectData.id, res.data.data.english_count)} else {uni.removeStorageSync('CNLLIST' + subjectData.id)uni.removeStorageSync('CNLLISTCOUNT' + subjectData.id)uni.removeStorageSync('ENLLIST' + subjectData.id)uni.removeStorageSync('ENLLISTCOUNT' + subjectData.id)}})} catch (e) {console.log('报错信息  ' + JSON.stringify(subjectData.id))//TODO handle the exception}
}/*** 根据科目列表赋值分类数据* @param {Object} data* @param {Object} inta*/
export async function requestSubjectClassSize(data, inta, callBack) {if (data.length > 0 && inta < data.length) {try {await getStudyData(data[inta].id).then(res => {if (res.data.code == 200 && res.data.status == 'success' && res.data.data.count > 0) {data[inta].categoryData = res.data.data.listif (inta < data.length - 1) {inta = inta + 1requestSubjectClassSize(data, inta, callBack)} else {requestDownloadFileSize(data, 0, 0,0, callBack)}} else {if (inta < data.length - 1) {inta = inta + 1requestSubjectClassSize(data, inta, callBack)} else {requestDownloadFileSize(data, 0, 0,0, callBack)}}})} catch (e) {//TODO handle the exceptionif (inta < data.length - 1) {inta = inta + 1requestSubjectClassSize(data, inta, callBack)} else {requestDownloadFileSize(data, 0, 0,0, callBack)}}}
}/*** 下载文件总大小* @returns boolean*/
export async function requestDownloadFileSize(data, inta, intaClass, contentLength, callBack) {if (data.length > 0 && inta < data.length) {if (data[inta].categoryData.length > 0 && intaClass < data[inta].categoryData.length) {try {var filePath = ''if (data[inta].categoryData[intaClass].file_path.includes('upload')) {if (data[inta].categoryData[intaClass].file_path.charAt(0) == '/') {filePath = hostUrl + data[inta].categoryData[intaClass].file_path} else {filePath = "http://" + data[inta].categoryData[intaClass].file_path}} else {filePath = hostUrlUpLoad + data[inta].categoryData[intaClass].file_path}await uni.request({url:  filePath,method: 'head',// responseType: 'arraybuffer', // 或者其他如'text'、'blob'等,取决于你需要的内容类型// header: {// 	'Accept-Encoding': 'gzip, deflate'// },success(res) {if (res.statusCode === 200) {if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1if(res.header['Content-Length'] || res.header['content-length']){console.log("filePath  " + filePath + '      ' + JSON.stringify(res.header['Content-Length']))contentLength = contentLength + parseInt(res.header['Content-Length']?res.header['Content-Length']:res.header['content-length'],10); // 获取Content-Length字段的值}requestDownloadFileSize(data, inta, intaClass,contentLength,callBack)} else {if (inta < data.length - 1) {inta = inta + 1if(res.header['Content-Length'] || res.header['content-length']){contentLength = contentLength + parseInt(res.header['Content-Length']?res.header['Content-Length']:res.header['content-length'],10); // 获取Content-Length字段的值}requestDownloadFileSize(data, inta, 0,contentLength, callBack)} else {callBack(contentLength)}}} else {if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1requestDownloadFileSize(data, inta, intaClass,contentLength, callBack)} else {if (inta < data.length - 1) {inta = inta + 1requestDownloadFileSize(data, inta, 0,contentLength, callBack)} else {callBack(contentLength)}}}},error(err) {console.error('请求错误:', err);if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1requestDownloadFileSize(data, inta, intaClass,contentLength, callBack)} else {if (inta < data.length - 1) {inta = inta + 1requestDownloadFileSize(data, inta, 0,contentLength, callBack)} else {callBack(contentLength)}}},networkTimeout: 5000, // 设置超时时间timeout: 5000 // 设置整体请求超时时间})} catch (e) {//TODO handle the exceptionconsole.log("requestDownloadFileSize  catch  " + JSON.stringify(e))if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1requestDownloadFileSize(data, inta, intaClass,contentLength, callBack)} else {if (inta < data.length - 1) {inta = inta + 1requestDownloadFileSize(data, inta, 0,contentLength, callBack)} else {callBack(contentLength)}}}} else {if (intaClass < data[inta].categoryData.length - 1) {intaClass = intaClass + 1requestDownloadFileSize(data, inta, intaClass,contentLength, callBack)} else {if (inta < data.length - 1) {inta = inta + 1requestDownloadFileSize(data, inta, 0,contentLength, callBack)} else {callBack(contentLength)}}}}
}/*** @param {Object} data* @param {Object} inta* @param {Object} contentLength* @param {Object} callBack*/
export async function requestFileSize(data, inta, contentLength, callBack) {if (data.length > 0 && inta < data.length) {try {uni.request({url: downloadUrl,method: 'GET',responseType: 'arraybuffer', // 或者其他如'text'、'blob'等,取决于你需要的内容类型header: {'Accept-Encoding': 'gzip, deflate'},success(res) {if (res.statusCode === 200 && res.data) {if (inta < data.length - 1) {inta = inta + 1if(res.header['Content-Length'] || res.header['content-length']){contentLength = contentLength + parseInt(res.header['Content-Length']?res.header['Content-Length']:res.header['content-length'],10); // 获取Content-Length字段的值}console.log(contentLength + '   字节');requestFileSize(data, inta, contentLength, callBack)} else {callBack(contentLength)}} else {if (inta < data.length - 1) {inta = inta + 1requestFileSize(data, inta, contentLength, callBack)} else {callBack(contentLength)}}},error(err) {console.error('请求错误:', err);if (inta < data.length - 1) {inta = inta + 1requestFileSize(data, inta, contentLength, callBack)} else {callBack(contentLength)}},networkTimeout: 5000, // 设置超时时间timeout: 5000 // 设置整体请求超时时间});} catch (e) {//TODO handle the exceptionif (inta < data.length - 1) {inta = inta + 1requestFileSize(data, inta, contentLength, callBack)} else {callBack(contentLength)}}}
}export default {downloadClass,downloadSubject,requestSubjectTestData,requestDownloadFileSize,requestSubjectClassSize
};

实现的逻辑是,下载完成一个文件,然后把保存到本地的路径存储到传过来对应的数据中,把原来线上的文件地址替换为本地路径,然后在进行下一个。

进度条显示

<template><view style="width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;position: relative;"><view style="position: absolute;top: 80rpx;display: flex;flex-direction: column;align-items: center;justify-content: center;"><image src="../../static/kaoshilogo.png" style="width: 80rpx;" mode="widthFix"></image><view style="margin-top: 20rpx;font-family: Source Han Sans-Bold;font-size: 18rpx;">{{language.AppName}}</view></view><view style="position: absolute;bottom: 30rpx;width: 100%;display: flex;align-items: center;justify-content: center;flex-direction: column;"><view style="width: 60%;font-size: 8rpx;text-align: center;margin-bottom: 3rpx;">{{language.zhengzaigengxinziliao}}</view><view class="progress-bar"><view class="progress-bar__fill" :style="{width: progress}"></view></view></view></view>
</template><script>import {getSubjectData,getClassData,getList,uploadStudyTime,uploadTestData,uploadOpen} from '@/api/api.js'export default {data() {return {fileManager: null,openData: [],progress: '',language: getApp().globalData.language,}},onLoad() {this.uploadOpen()//获取总分类数据if (!uni.getStorageSync("classData")) {this.getClassDataPage()}//获取科目数据if (!uni.getStorageSync("SubjectData")) {this.getSubjectDataPage()}else{if(uni.getStorageSync('userInfo')){uni.switchTab({url: '/pages/home/home'})}else{uni.navigateTo({url: '/pages/login/login'})}}if(uni.getStorageSync('userInfo') && uni.getStorageSync('userInfo').userName != 'Guest'){if(uni.getStorageSync('uploadTime')){this.uploadSyudyTime()}if(uni.getStorageSync('uploadTestTime')){this.uploadTestTime()}}},methods: {async getClassDataPage(){var that = thisawait getClassData().then(res => {if (res.data.code == 200 && res.data.status == 'success') {that.$download.downloadClass(res.data.data.list, 0)} else if (res.statusCode == '404' || res.status == 1) {console.log("网路请求失败")} else {console.log(res)}})},async getSubjectDataPage(){var that = thisawait getSubjectData().then(res => {if (res.data.code == 200 && res.data.status == 'success') {if(res.data && res.data.data && res.data.data.list && res.data.data.list.length > 0){for (var i = 0; i < res.data.data.list.length; i++) {this.$download.requestSubjectTestData(res.data.data.list[i]);}this.$download.downloadSubject(res.data.data.list, 0,function(progress,boobleTo){that.progress = progress + "%"if(boobleTo){getApp().globalData.version = '1.0.' + that.$utils.formatDateTime()if(uni.getStorageSync('userInfo')){uni.switchTab({url: '/pages/home/home'})}else{uni.navigateTo({url: '/pages/login/login'})}}});}else{if(uni.getStorageSync('userInfo')){uni.switchTab({url: '/pages/home/home'})}else{uni.navigateTo({url: '/pages/login/login'})}}} else if (res.statusCode == '404' || res.status == 1) {console.log("网路请求失败")uni.showToast({title: that.language.startToastnetworkMsg,icon: 'none',duration: 1500})if(uni.getStorageSync('userInfo')){uni.switchTab({url: '/pages/home/home'})}else{uni.navigateTo({url: '/pages/login/login'})}} else {uni.showToast({title: that.language.startToastnetworkMsg,icon: 'none',duration: 1500})if(uni.getStorageSync('userInfo')){uni.switchTab({url: '/pages/home/home'})}else{uni.navigateTo({url: '/pages/login/login'})}}})},async uploadSyudyTime(){await uploadStudyTime({"data": uni.getStorageSync('uploadTime')}).then(res=>{if(res.data.code == 200 && res.data.status == 'success'){uni.removeStorageSync('uploadTime')}})},async uploadTestTime(){await uploadTestData({"data": uni.getStorageSync('uploadTestTime')}).then(res=>{if(res.data.code == 200 && res.data.status == 'success'){uni.removeStorageSync('uploadTestTime')}})},async uploadOpen(){this.openData = [];if(uni.getStorageSync('uploadOpen')){this.openData = uni.getStorageSync('uploadOpen')this.openData.push({"date": this.$utils.formatDateTime()})}else{this.openData[0] = {"date": this.$utils.formatDateTime()}}await uploadOpen({"data": this.openData}).then(res=>{if(res.data.code == 200 && res.data.status == 'success'){uni.removeStorageSync('uploadOpen')}else{uni.setStorageSync('uploadOpen',this.openData)}})}}}
</script><style>page{width: 100%;height: 100vh;}.progress-bar {background-color: #cccccc; /* 进度条背景颜色 */height: 10rpx;width: 60%;border-radius: 5rpx;}.progress-bar__fill {height: 100%;background-color: green; /* 完成部分的颜色 */transition: width 0.1s ease-in-out; /* 平滑过渡效果 */border-radius: 5rpx;}
</style>

有部分不需要的代码,可以自己删除掉即可。

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

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

相关文章

crc, md5 和 sha的区别

效率不同: 直接看代码 import zlib import hashlib import timewith open(rD:\data., rb) as f:x f.read()s time.time() for i in range(100000):d zlib.crc32(x) print(time.time() - s)s time.time() for i in range(100000):m hashlib.md5()m.update(x)d m.hexdige…

学习webservice的心得

一.首先确定数据库中字段&#xff0c;编写相应的实体类&#xff0c;如果使用的是若依框架&#xff0c;则选择代码生成。 二.将生成的或者自己编写的实体类&#xff0c;mapper&#xff0c;service&#xff0c;serviceImpl,controller,(如果是xml文件写的sql&#xff0c;还需要编…

【CSS】纯CSS Loading动画组件

<template><div class"ai-loader-box"><!-- AI loader --><div class"ai-loader"><div class"text"><p>AI智能分析中....</p></div><div class"horizontal"><div class&quo…

idea项目搭建的四种方式: 一(以idea2017为例)

目录 1. 普通java项目 2. 普通JavaWEB项目 3. maven的JavaWEB项目 4. maven的java项目 1. 普通java项目 ①点击“Create New Project”&#xff1b; ②选择“Java”&#xff0c;选择自己安装的jdk&#xff0c;点击“Next”&#xff1b; ③填好项目名称和路径&#xff1b;…

记录一个docker volume映射目录创建文件报错问题

最近用docker-compse做中间件部署。 发现使用volume映射目录后&#xff0c;初始化时创建文件报错导致容器启动失败问题。 提示是没有访问权限。 如下&#xff1a; mariadb 10:07:26.86 INFO > mariadb 10:07:26.86 INFO > Welcome to the Bitnami mariadb contain…

CORS预检请求配置流程图 srpingboot和uniapp

首先要会判断预检请求 还是简单请求 简单请求 预检请求 #mermaid-svg-1R9nYRa7P9Pll4AK {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-1R9nYRa7P9Pll4AK .error-icon{fill:#552222;}#mermaid-svg-1R9nYRa7P9Pll4…

关于测试用例的写法

最近公司有个新项目&#xff0c;需要写测试用例&#xff0c;表单项有点多&#xff0c;一个表单都有40个字段左右&#xff0c;若写用例得400条左右&#xff0c;大部分都是重复的项&#xff0c;在此写个小程序&#xff0c;批量生成测试用例 需要注意的是本程序只使用于表单内容 模…

基于ssm+vue的购物商场的设计与实现

博主介绍&#xff1a;专注于Java&#xff08;springboot ssm 等开发框架&#xff09; vue .net php phython node.js uniapp 微信小程序 等诸多技术领域和毕业项目实战、企业信息化系统建设&#xff0c;从业十五余年开发设计教学工作 ☆☆☆ 精彩专栏推荐订阅☆☆☆☆☆不…

JavaScript 的 axios 实现文件下载功能

用 JavaScript 的 axios 实现文件下载功能&#xff0c;咱们要分几个步骤来搞定它&#xff01;最主要的部分是处理 二进制数据&#xff0c;可以生成一个进度检测&#xff0c;然后把它保存为文件。 文件名的获取二进制数据获取创建下载链接 const axios require(axios);const g…

【视频生成大模型】 视频生成大模型 THUDM/CogVideoX-2b

【视频生成大模型】 视频生成大模型 THUDM/CogVideoX-2b CogVideoX-2b 模型介绍发布时间模型测试生成的demo视频生成视频限制 运行环境安装运行模型下载开源协议参考 CogVideoX-2b 模型介绍 CogVideoX是 清影 同源的开源版本视频生成模型。 基础信息&#xff1a; 发布时间 2…

【【自动驾驶】车辆运动学模型】

【自动驾驶】车辆运动学模型 1. 引言2. 以车辆重心为中心的单车模型2.1 模型介绍2.2 滑移角 β \beta β 的推导2.2 航向角 ψ \psi ψ推导过程&#xff1a;2.3 滑移角 β \beta β2.3 Python代码实现2.4 C代码实现 3. 前轮驱动的单车模型3.1 模型介绍3.3 Python代码实现3.4 …

【功能安全】 独立于环境的安全要素SEooC

目录 01 SEooC定义 02 SEooC开发步骤 03 SEooC开发示例 04 SEooC问答 01 SEooC定义 缩写: SEooC:Safety Element out of Context独立于环境的安全要素 SEooC出处:GB/T34590.10—2022,第9章节 SEooC与相关项什么关系? SEooC可以是系统、系统组合、子系统、软件组件、…

【软件设计】常用设计模式--代理模式

文章目录 代理模式&#xff08;Proxy Pattern&#xff09;1. 概念2. 模式结构3. UML 类图4.实现方式C# 示例步骤1&#xff1a;定义主题接口步骤2&#xff1a;实现真实主题步骤3&#xff1a;实现代理类步骤4&#xff1a;客户端使用代理模式输出结果&#xff1a; Java 示例步骤1&…

EXCELL中如何两条线画入一张图中,标记坐标轴标题?

1&#xff0c;打开excel&#xff0c;左击选中两列&#xff0c; 2&#xff0c;菜单栏>“插入”>”二维折线图”选中一个 3&#xff0c;选中出现的两条线中的一条右击>最下一行&#xff0c;“设置数据系列格式” 4&#xff0c;右测“系列选项中”>点击“次坐标轴” 5…

龙蟠科技业绩压力显著:资产负债率持续攀升,产能利用率也不乐观

《港湾商业观察》施子夫 黄懿 去年十月至今两度递表后&#xff0c;10月17日&#xff0c;江苏龙蟠科技股份有限公司(以下简称&#xff0c;龙蟠科技&#xff1b;603906.SH&#xff0c;02465.HK)通过港交所主板上市聆讯。 很快&#xff0c;龙蟠科技发布公告称&#xff0c;公司全…

低代码开发详解与行业应用指南

低代码开发简化软件开发&#xff0c;助力企业数字化转型。ZohoCreator应用于零售、制造、教育、IT、医疗、房地产等行业&#xff0c;提升效率、降低成本。灵活定价&#xff0c;支持免费试用&#xff0c;助力企业快速实现数字化。 一、低代码开发是什么&#xff1f; 低代码开发…

青少年编程能力等级测评CPA C++五级试卷(1)

青少年编程能力等级测评CPA C五级试卷&#xff08;1&#xff09; 一、单项选择题&#xff08;共15题&#xff0c;每题3分&#xff0c;共45分&#xff09; CP5_1_1.下列有关类的重用意义的叙述中&#xff0c;不正确的是&#xff08; &#xff09;。 A&#x…

栈(数据结构)——C语言

1 概念与结构 栈&#xff1a;⼀种特殊的线性表&#xff0c;其只允许在固定的⼀端进⾏插⼊和删除元素操作。进⾏数据插⼊和删除操作 的⼀端称为栈顶&#xff0c;另⼀端称为栈底。栈中的数据元素遵守后进先出LIFO&#xff08;Last In First Out&#xff09;的原则。 压栈&#…

如何动态改变本地的ip

在当今数字化时代&#xff0c;网络连接已成为我们日常生活和工作中不可或缺的一部分。无论是出于隐私保护、突破地域限制&#xff0c;还是为了测试和优化网络应用&#xff0c;动态改变本地IP地址的需求日益增多。本文将详细介绍如何安全、有效地实现这一目标&#xff0c;旨在帮…

Linux巡检利器xsos的安装和使用

一、 一般项目基本完成的时候&#xff0c;后期运维工作的重点就是及时的&#xff0c;合理的频率巡检了&#xff0c;巡检的目的主要是及时发现各种各样的问题 那么&#xff0c;自己编写shell脚本是大部分人的第一选择&#xff0c;这里有个比较麻烦的地方&#xff0c;shell脚本…