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

vue3开发打年兽功能

1.效果

WeChat_20250217192041

2.代码

2.1 index.vue

<template><div class="pages"><TopNavigationYleftTitle="打年兽"ruleIconColor="#fff"backgroundImage=""svgIpcn="backIcon4"gradientBackgroundColor="rgba(128, 76, 104, 0.6)"topNavHeight="56px"howToPlay="newYearEvent":backdropFilter="true"ruleIcon="ruleFFF"><template v-slot:top_l_right><SvgIconclass="custimage"width="34px"height="34px"name="customerIconBW"@click="openService()"/></template></TopNavigationY><div class="nianBeastBox"><transition-group name="fade"><animationv-for="item in JSONanimations":key="item.id":JSONanimations="item.anim"v-show="item.id == animationId && animationId != -1"class="nianBeastImg"></animation><imgv-show="animationId == -1"class="death":src="useImageUrl('newYearEvent', `criticalStrike`, 'develop')"alt=""/></transition-group><shellref="shellRef"class="shell"/><div class="nianBeast"><!-- 动态渲染伤害值 --><divv-for="item in data.elementsHtml":key="item.id"class="damageValueNum"v-show="data.elementsHtml"><divclass="tex"v-show="!item.status"><div class="text1">-</div><div class="text2">-</div><div class="text3">-</div></div><imgv-show="item.status"class="img":src="useImageUrl('newYearEvent', `criticalStrike`, 'develop')"alt=""/><div class="num"><div class="text1">{{ item.num }}</div><div class="text2">{{ item.num }}</div><div class="text3">{{ item.num }}</div></div></div><imgv-show="data.lastStrikesImgShow"class="lastStrike":src="useImageUrl('newYearEvent', `lastStrikes`, 'develop')"alt=""/><div class="Progress"><van-progress:percentage="data.progressNum":show-pivot="false"/><divclass="progress_pivot":style="{ left: data.progressNum + '%' }"></div></div><div class="countdown">剩余时间:<van-count-down:time="data.countdown"@finish="finishCountdown"/></div></div><div class="cannon"><imgclass="cannonLeft":src="useImageUrl('newYearEvent', `barrel1`, 'develop')"alt=""/><imgclass="view":src="useImageUrl('newYearEvent', `view`, 'develop')"alt=""@click="viewYearBeast()"/><imgclass="cannonRight":src="useImageUrl('newYearEvent', `barrel2`, 'develop')"alt=""/></div><div class="shellBox"><div class="shellList"><divv-for="item in 4":key="item"@click="selectProjectile(item)":style="{ opacity: data.shellFrameIndex === item ? '1' : '0.6' }"><div class="shellItem"><img:src="useImageUrl('newYearEvent', `shell${item}`, 'develop')"alt=""/></div><div class="num">x 111</div></div></div><van-stepperv-model="data.shellNum":integer="true"/></div><div class="strikeYearBeast"><imgclass="ranking"@click="goToRanking":src="useImageUrl('newYearEvent', `ranking`, 'develop')"alt=""/><divclass="strikeYearBeastBtn"@click="clickYearBeastBtn"></div><div class="accumulate">{{ convertToWan(data.accumulatedDamage) }}</div></div></div></div><!-- 年兽弹窗 --><van-overlay:show="data.nianBeastPop"z-index="1000"><div class="popCentent"><div class="cententBox"><divclass="cententItem"v-for="item in data.nianBeastList":key="item.id"><div class="time">开始时间:{{ item.startTime }}</div><div class="time">结束时间:{{ item.endTime }}</div><imgclass="img"src="@/assets/image/newYearEvent/nianBeast.png"alt=""/><imgclass="btn":src="useImageUrl('newYearEvent', `btn${item.status}`, 'develop')"alt=""/></div></div><divclass="cancelPop"@click="cancelYearBeast"></div></div></van-overlay><!-- 最后一击弹窗  --><van-overlay:show="data.lastStrikeShow"z-index="1000"><div class="lastStrikeCentent"><div class="box"><text-show:direction="'center'":text="data.jewelry.name"text-id="444"><div class="text textEllipsis">{{ data.jewelry.name }}</div></text-show><imgclass="img"src="https://img.zbt.com/e/steam/item/730/UDkwIHwgQXNpaW1vdiAoRmFjdG9yeSBOZXcp.png"alt=""/><div class="price"><imgclass="coinImg":src="useImageUrl('base', 'conch')"alt=""/>{{ data.jewelry.price }}</div></div><divclass="cancelPop"@click="cancelYearBeast"></div></div></van-overlay>
</template>
<script setup lang="ts">
import { onMounted, onUnmounted, reactive, ref, watch } from "vue"
import { getTextByCode, viewTextByCode } from "@/api/base"
import { showIntroduce } from "@/utils/Introduce"
import { navigateTo } from "@/utils/route"
// import { useImageUrl,joinImgPrefix } from "@/utils/index"
import { useImageUrl, convertToWan } from "@/utils/index"
import animation from "@/components/animation/index.vue"
import nianBeast1 from "@/assets/json/nianBeast1.json"
import nianBeast2 from "@/assets/json/nianBeast2.json"
import shell from "./animation/shell.vue"
import { openService } from "@/utils/userStore"
import config from "@/config"const data = reactive({countdown: 5000000, // 年兽倒计时shellNum: 1, // 炮弹数量progressNum: 50, // 进度条elementsHtml: [],shellFrameIndex: 1,nianBeastPop: false, // 年兽弹窗nianBeastList: [{id: 1,startTime: "2025.12.26 12:52:24",endTime: "2025.12.26 12:52:24",status: 2},{id: 2,startTime: "2025.12.26 12:52:24",endTime: "2025.12.26 12:52:24",status: 1},{id: 3,startTime: "2025.12.26 12:52:24",endTime: "2025.12.26 12:52:24",status: 3},{id: 1,startTime: "2025.12.26 12:52:24",endTime: "2025.12.26 12:52:24",status: 2}],lastStrikeShow: false, // 最后一击弹窗lastStrikesImgShow: false, // 最后一击图片jewelry: {price: 11111,name: "额温额温额温额温额温额温额温额温额温额温"},accumulatedDamage: "2222222" // 累计伤害
})
// 查看年兽弹窗
const viewYearBeast = () => {data.nianBeastPop = trueconsole.log(`output-11111`, 11111)
}
// 关闭查看年兽弹窗
const cancelYearBeast = () => {data.nianBeastPop = falsedata.lastStrikeShow = false
}
// 选择炮弹
const selectProjectile = val => {data.shellFrameIndex = valdata.shellNum = 1
}
// 去排名
const goToRanking = () => {navigateTo({name: "newYearRanking"})
}
// 打年兽
const shellRef = ref(null)
const clickYearBeastBtn = () => {shellRef.value.createAnimation()barrelAnimation()shellDamageValue()
}
// 炮弹动画
const barrelAnimation = () => {const animateElement = (element, scale, origin, duration) => {// 设置动画样式element.style.transform = `scaleX(${scale})`element.style.transition = `transform ${duration}ms ease`element.style.transformOrigin = origin// 动画复原setTimeout(() => {element.style.transform = "scaleX(1)"}, duration)}// 获取左侧炮管并执行动画const left = document.querySelector(".cannonLeft")animateElement(left, 0.8, "left center", 200)// 获取右侧炮管并执行动画const right = document.querySelector(".cannonRight")animateElement(right, 0.8, "right center", 200)config.cannonAudio.currentTime = 0.2 // 设置从第 1 秒开始播放config.cannonAudio.play() // 播放音效
}
// 炮弹伤害值
const shellDamageValue = () => {const obj = {num: Math.floor(Math.random() * 10),status: true}data.elementsHtml.push(obj)
}
// 玩法规则是否第一次弹出
const showRule = async () => {const res = await getTextByCode("newYearEvent")if (res.data.show) {showIntroduce("newYearEvent")await viewTextByCode("newYearEvent")}
}
// 音效播放函数
const playSound = () => {config.newYearAudio.volume = 0.2 // 设置音量config.newYearAudio.loop = true // 设置循环播放// 播放音效config.newYearAudio.play().then(() => {console.log("音效播放成功")}).catch(error => {console.error("音效播放失败:", error)})
}
// 音效停止函数
const stopSound = () => {if (config.newYearAudio) {config.newYearAudio.pause() // 暂停播放config.newYearAudio.currentTime = 0 // 重置播放时间}
}
// 获取年兽动画
const JSONanimations = ref<any>([{id: 1,anim: nianBeast1},{id: 2,anim: nianBeast2},{id: 3,anim: nianBeast2},{id: 4,anim: nianBeast2}
])
const animationId = ref(1)
const finishCountdown = () => {if (data.progressNum <= 0) returndata.nianBeastList.map(item => {if (item.status == 1) {animationId.value = item.id}})
}
watch(() => data.progressNum,val => {if (val <= 0) {animationId.value = -1data.lastStrikesImgShow = true}},{ immediate: true }
)
onMounted(async () => {await playSound()await showRule()
})
onUnmounted(() => {stopSound()
})
</script>
<style lang="scss" scoped>
:deep(.top_navigation) {position: fixed;.top_l {top: 56px !important;transform: translateY(-50%);margin-left: 8px;display: flex;align-items: center;.custimage {transform: translateY(1px);margin-left: 23px;}}
}
.pages {width: 750px;min-height: 1624px;background: #490205;overflow: hidden;.nianBeastBox {width: 750px;height: 1624px;background: url($yjnewYearEventBg) no-repeat bottom;background-size: 100%;position: relative;.fade-enter-active,.fade-leave-active {transition: opacity 0.5s ease;}.fade-enter,.fade-leave-to {opacity: 0;}.nianBeastImg {position: absolute;top: 10px;}.death {position: absolute;left: 50%;transform: translateX(-50%);top: 570px;width: 400px;height: 400px;}.nianBeast {width: 750px;height: 1050px;display: grid;place-items: center;position: absolute;@keyframes float {0% {transform: translateY(0);opacity: 1;}100% {transform: translateY(-30px);opacity: 0;}}.damageValueNum {font-size: 56px;font-weight: bold;display: flex;justify-content: center;align-items: center;position: absolute;font-family: YouSheBiaoTiHei;animation: float 1.7s ease forwards;top: 500px;left: 50%;transform: translateY(-50%);.tex {position: absolute;left: -50px;}.img {width: 222px;height: 107px;margin-top: 60px;margin-right: 10px;margin-left: -150px;}.text1 {font-size: 56px;text-shadow:-2px -2px 0 #ffd700,2px -2px 0 #ffd700,-2px 2px 0 #ffd700,2px 2px 0 #ffd700;position: absolute;top: 80px;-webkit-text-stroke: 20px #ffd700;letter-spacing: 6px;}.text2 {font-size: 56px;text-shadow:-2px -2px 0 #8b0000,2px -2px 0 #8b0000,-2px 2px 0 #8b0000,2px 2px 0 #8b0000;-webkit-text-stroke: 16px #8b0000;position: absolute;top: 80px;letter-spacing: 5px;}.text3 {color: #fff;position: absolute;top: 80px;letter-spacing: 5px;}}.lastStrike {width: 600px;height: 216.846px;background: url($yjprogressHead) no-repeat center;background-size: 100%;position: absolute;top: 700px;animation: float 2.5s ease forwards;}.Progress {position: absolute;top: 820px;left: -40px;width: 312px;transform: rotate(270deg);.progress_pivot {width: 100px;height: 56px;transform: rotate(90deg) !important;background: url($yjprogressHead) no-repeat bottom;background-size: 100%;position: absolute;top: -16px;opacity: 1 !important;margin-left: -46px;filter: brightness(2);}:deep(.van-progress) {height: 32px;border-radius: 4px;opacity: 0.9;background: rgba(0, 0, 0, 0.5);box-shadow: 0px 4px 2px 0px rgba(0, 0, 0, 0.25) inset;display: flex;align-items: center;}:deep(.van-progress__portion) {border-radius: 2px;height: 24px;border-top: 4px solid #ffa45a;border-right: 4px solid #ffa45a;border-bottom: 4px solid #ffa45a;background: linear-gradient(180deg, #ffa45a 0%, #e24129 100%);margin-left: 3px;}}.countdown {position: absolute;bottom: 0;left: 50%;transform: translateX(-50%);width: 320px;height: 60px;background: rgba(73, 2, 4, 0.8);display: flex;justify-content: center;align-items: center;color: #fff;font-family: "AP700";font-size: 32px;.van-count-down {color: #fff;font-family: "AP700";font-size: 32px;}}}}.cannon {width: 750px;height: 170px;margin-top: 50px;display: flex;justify-content: space-between;align-items: center;position: absolute;top: 1045px;z-index: 1;.view {width: 300px;height: 80px;}.cannonLeft {width: 148px;height: 170px;}.cannonRight {@extend .cannonLeft;}}.shellBox {position: absolute;top: 1255px;left: 50%;transform: translateX(-50%);text-align: center;.shellList {width: 460px;margin: 0 auto;display: grid;grid-template-columns: repeat(4, 1fr);gap: 20px;margin-bottom: 20px;.shellItem {width: 100px;height: 100px;background: url($yjnewYearlastshellFrame) no-repeat bottom;background-size: 100%;img {width: 73px;height: 67px;margin-left: 13px;margin-top: 15px;}}.num {color: #f5b142;text-align: center;font-family: "AP500";font-size: 20px;margin-top: 4px;}}}.strikeYearBeast {display: flex;justify-content: center;position: absolute;top: 1485px;left: 50%;transform: translateX(-50%);.ranking {width: 102px;height: 102px;}.strikeYearBeastBtn {width: 360px;height: 106px;margin: 0 26px;background: url($yjnewYearstrikeYearBeastBtn) no-repeat bottom;background-size: 100%;&:active {background: url($yjnewYearstrikeYearBeastBtnA) no-repeat bottom;background-size: 100%;}}.accumulate {width: 142px;height: 102px;background: url($yjnewYearaccumulate) no-repeat bottom;background-size: 100%;color: #ffc337;text-align: center;font-family: "AP700";font-size: 36px;}}
}
.popCentent {width: 688px;height: 903px;background: url($yjnewYearviewPop) no-repeat bottom;background-size: 100%;position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);.cententBox {display: grid; /* 外层容器 */grid-template-columns: repeat(2, 1fr);gap: 20px;padding: 0 74px;margin-top: 200px;.cententItem {color: #fff7c4;font-family: "AP500";font-size: 14px;width: 254px;height: 254px;text-align: center;padding: 12px;.time {line-height: 20px;}.img {width: 139px;height: 139px;}.btn {width: 156px;height: 48px;}}}
}
.cancelPop {width: 50px;height: 50px;position: absolute;bottom: 0;left: 50%;transform: translateX(-50%);
}
.lastStrikeCentent {width: 688px;height: 898px;background: url($yjnewYearlastStrike) no-repeat bottom;background-size: 100%;position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);.box {position: absolute;left: 50%;top: 270px;transform: translateX(-50%);}.text {width: 240px;color: #fad16c;font-family: "AP600";font-size: 22px;text-align: center;padding: 0 10px;}.img {width: 241px;height: 159px;transform: rotate(20deg);margin-top: 40px;margin-left: -8px;}.price {@extend .text;display: flex;justify-content: center;margin-top: 33px;img {width: 26px;height: 26px;transform: translateY(-2px);}}
}
:deep(.van-stepper__minus) {background: rgba(0, 0, 0, 0);color: #fff;font-family: "AP700";font-size: 32px;
}
:deep(.van-stepper__minus--disabled) {color: #ccc; /* 设置为变暗的颜色 */cursor: not-allowed; /* 修改鼠标样式 */opacity: 0.5; /* 设置透明度 */
}
/* 覆盖减号图标 */
:deep(.van-stepper__minus:before) {width: 0px;height: 0px;content: "-";transform: translateY(-15px);
}
:deep(.van-stepper__input) {width: 64px;height: 40px;border-radius: 2px;color: #fff;font-family: "AP700";font-size: 28px;background: rgba(0, 0, 0, 0);border: 2px solid #fcc651;
}
:deep(.van-stepper__plus) {background: rgba(0, 0, 0, 0);color: #fff;font-family: "AP700";font-size: 32px;transform: translate(-15px, -15px);
}
// /* 覆盖加号图标 */
:deep(.van-stepper__plus:before) {width: 0px;height: 0px;content: "+";
}
:deep(.van-stepper__plus:after) {width: 0px;height: 0px;
}
</style>

2.2 newYearRanking.vue

<template><div class="allPages"><TopNavigationY title="排行榜" /><imgclass="title":src="useImageUrl('newYearEvent', `rankingTitle`, 'develop')"alt=""/><swiperclass="mySwiper":slides-per-view="3":space-between="10"><swiper-slide:class="['titleItem', { active: item == activeIndex }]"v-for="item in 4":key="item"@click="handleToggle(item)">年兽{{ item }}号</swiper-slide></swiper><div class="list"><divv-for="item in rankingInfo":key="item.id"class="rankingInfo"><imgv-if="item.id <= 3"class="img":src="useImageUrl('newYearEvent', `rank${item.id}`, 'develop')"alt=""/><divv-if="item.id > 3"class="imgs">{{ item.id }}</div><imgclass="profilePicture":src="useImageUrl('newYearEvent', `rank3`, 'develop')"alt=""/><text-show:direction="'center'":text="ProhibitedWords(item.name)":text-id="item.id"><div class="name textEllipsis">{{ ProhibitedWords(item.name) }}</div></text-show><div class="damageValue">伤害值:<imgclass="shellIcon":src="useImageUrl('newYearEvent', `shellIcon`, 'develop')"alt=""/>x{{ convertToWan(item.damageValue) }}</div></div><touchGroundclass="touchGround":total="pageData.total":size="pageData.size":currentpage="pageData.current"@touchGroundFun="touchGroundFun"></touchGround></div><div class="personalInfo"><div class="userName"><imgclass="userIcon":src="useImageUrl('newYearEvent', `shellIcon`, 'develop')"alt=""/><text-show:direction="'center'":text="myInfo.name":text-id="3 + myInfo.ranking"><div class="name textEllipsis">{{ myInfo.name }}</div></text-show></div><div class="ranking">排名: {{ myInfo.ranking }}</div><div class="damageValueC">伤害值:<imgclass="shellIcon":src="useImageUrl('newYearEvent', `shellIcon`, 'develop')"alt=""/>{{ convertToWan(myInfo.damageValue) }}</div></div></div>
</template>
<script setup lang="ts">
import { ref } from "vue"
import { useImageUrl,ProhibitedWords,convertToWan } from "@/utils/index"
import "swiper/css"
import { Swiper, SwiperSlide } from "swiper/vue"
const rankingInfo = ref([{id: 1,name: "111111",damageValue: "222"},{id: 2,name: "小仙女",damageValue: "222"},{id: 3,name: "111111",damageValue: "222"},{id: 4,name: "111111",damageValue: "222"},{id: 5,name: "11111wwwwwwwww1",damageValue: "222"},{id: 6,name: "111111",damageValue: "222"},{id: 1,name: "111111",damageValue: "222"},{id: 2,name: "111111",damageValue: "222"},{id: 3,name: "111111",damageValue: "222"},{id: 4,name: "111111",damageValue: "222"},{id: 5,name: "11111wwwwwwwww1",damageValue: "222"},{id: 6,name: "111111",damageValue: "222"}
])
const pageData = ref({current: 1,size: 15,total: 1
})
const myInfo = ref({name: "eee",ranking: 111111,damageValue: "331133"
})
const activeIndex = ref(1)
// 选择年兽
const handleToggle = val => {activeIndex.value = val
}
const getlistData = async () => {}
// 触底加载
const touchGroundFun = () => {pageData.value.size += 15getlistData()
}
</script><style lang="scss" scoped>
.allPages {width: 750px;height: 1624px;background: url($yjnewYeartheChartsBg) no-repeat center;background-size: 100% 100%;.title {width: 570px;height: 137px;margin: 30px 90px 20px;}.mySwiper {height: 64px;margin: 0 26px 50px;.titleItem {width: 186px;height: 64px;background: url($yjnewYearcheckedState) no-repeat center;background-size: 100% 100%;color: #bc2811;text-align: center;font-family: "AP600";font-size: 32px;line-height: 64px;&.active {background-image: url($yjnewYearcheckedStates);background-size: 100% 100%;color: #ffe7bb;}}}.list {height: 1100px;overflow: auto;padding-bottom: 50px;.rankingInfo {width: 694px;height: 120px;background: url($yjnewYearrankingBg) no-repeat center;background-size: 100% 100%;margin: 0 auto 24px;display: flex;align-items: center;.img {width: 64px;height: 64px;margin-left: 42px;}.imgs {@extend .img;background: url($yjnewYearrank4) no-repeat center;background-size: 100% 100%;color: #f1bc7a;text-align: center;font-family: "AP600";font-size: 34px;line-height: 66px;}.profilePicture {width: 50px;height: 48px;border-radius: 50%;background: lightgray 50% / cover no-repeat;flex-shrink: 0;margin-left: 32px;}.text {color: #ffe7bb;font-family: "AP500";font-size: 28px;}.name {@extend .text;width: 200px;margin: 0 18px;}.damageValue {@extend .text;float: right;margin-top: -10px;.shellIcon {width: 38px;height: 38px;transform: translateY(5px);}}}}.personalInfo {width: 750px;height: 108px;background: url($yjnewYearpersonalInfoBg) no-repeat center;background-size: 100% 100%;position: fixed;bottom: 0px;display: flex;align-items: center;.text {color: #fff7c4;font-family: "AP400";font-size: 28px;}.userName {width: 210px;display: flex;align-items: center;justify-content: center;.userIcon {width: 50px;height: 48px;flex-shrink: 0;margin-right: 10px;}.name {max-width: 130px;transform: translateY(3px);}}.ranking {@extend .text;width: 180px;margin-left: 54px;transform: translateY(4px);}.damageValueC {@extend .text;transform: translateY(-4px);position: absolute;right: 30px;.shellIcon {width: 38px;height: 38px;transform: translateY(4px);}}}
}
</style>

2.3 animation/shell.vue 设置炮弹

<template><div><divv-for="(animationData, index) in animations":key="index"class="animation-container"></div></div>
</template><script setup lang="ts">
import { ref, onBeforeUnmount } from "vue"
import lottie from "lottie-web"
import JSONanimations from "@/assets/json/shell.json"// 响应式数据,用于跟踪动画实例
const animations = ref<{ id: number; container: HTMLElement }[]>([])
const animationInstances = ref<any>([]) // 存储 Lottie 动画实例// 创建动画实例
const createAnimation = () => {const container = document.createElement("div")container.className = "animation-container"document.body.appendChild(container)const animation = lottie.loadAnimation({container,renderer: "svg",loop: true,autoplay: true,animationData: JSONanimations})animationInstances.value.push(animation)animations.value.push({ id: animationInstances.value.length - 1, container })// 设置定时器,3秒后删除动画setTimeout(() => {removeAnimation(animation, container)}, 500)
}// 移除动画实例和 DOM 元素
const removeAnimation = (animationToRemove, container) => {const index = animationInstances.value.indexOf(animationToRemove)if (index > -1) {animationToRemove.destroy() // 销毁动画实例animationInstances.value.splice(index, 1) // 从数组中移除动画实例animations.value.splice(index, 1) // 从响应式数据中移除container.remove() // 从 DOM 中移除容器元素}
}// 在组件销毁前清理动画和 DOM 元素
onBeforeUnmount(() => {animationInstances.value.forEach((animation, index) => {animation.destroy() // 销毁动画实例animations.value[index]?.container.remove() // 从 DOM 中移除容器元素})animationInstances.value.length = 0 // 清空实例数组animations.value = [] // 清空响应式数据
})
// 暴露方法给父组件
defineExpose({createAnimation
})
</script><style>
.animation-container {width: 750px;height: 1435px;position: absolute;top: 0;
}
</style>

相关文章:

vue3开发打年兽功能

1.效果 WeChat_20250217192041 2.代码 2.1 index.vue <template><div class"pages"><TopNavigationYleftTitle"打年兽"ruleIconColor"#fff"backgroundImage""svgIpcn"backIcon4"gradientBackgroundColor&q…...

动手学Agent——Day2

文章目录 一、用 Llama-index 创建 Agent1. 测试模型2. 自定义一个接口类3. 使用 ReActAgent & FunctionTool 构建 Agent 二、数据库对话 Agent1. SQLite 数据库1.1 创建数据库 & 连接1.2 创建、插入、查询、更新、删除数据1.3 关闭连接建立数据库 2. ollama3. 配置对话…...

如何在 GitHub 中创建一个空目录 ?

GitHub 是开发人员必不可少的工具&#xff0c;它提供了存储、共享和协作代码的平台。一个常见的问题是如何在 GitHub 存储库中创建一个空目录或文件夹。GitHub 不支持直接创建空目录。但是&#xff0c;有一种解决方法是使用一个虚拟文件&#xff0c;通常是一个 .gitkeep 文件。…...

3. 导入官方dashboard

官方dashboard&#xff1a;https://grafana.com/grafana/dashboards 1. 点击仪表板 - 新建 - 导入 注&#xff1a;有网络的情况想可以使用ID&#xff0c;无网络情况下使用仪表板josn文件 2. 在官方dashboard网页上选择符合你现在数据源的dashboard - 点击进入 3. 下拉网页选…...

前端知识速记--HTML篇:HTML5的新特性

前端知识速记–HTML篇&#xff1a;HTML5的新特性 一、语义化标签 HTML5引入了许多新的语义化标签&#xff0c;如 <header>、<footer>、<article>、<section> 等。这些标签不仅提高了网页的可读性和结构性&#xff0c;还有助于SEO&#xff08;搜索引擎…...

【数据分享】1929-2024年全球站点的逐年降雪深度数据(Shp\Excel\免费获取)

气象数据是在各项研究中都经常使用的数据&#xff0c;气象指标包括气温、风速、降水、能见度等指标&#xff0c;说到气象数据&#xff0c;最详细的气象数据是具体到气象监测站点的数据&#xff01; 有关气象指标的监测站点数据&#xff0c;之前我们分享过1929-2024年全球气象站…...

鸿蒙面试题

1.0penHarmony的系统架构是怎样的? 2.电话服务的框架? 3.OpenHarmony与HarmonyOS有啥区别?...

pdf-extract-kit paddle paddleocr pdf2markdown.py(效果不佳)

GitHub - opendatalab/PDF-Extract-Kit: A Comprehensive Toolkit for High-Quality PDF Content Extraction https://github.com/opendatalab/PDF-Extract-Kit pdf2markdown.py 运行遇到的问题&#xff1a; 错误&#xff1a; -------------------------------------- C Tra…...

基于STM32、HAL库、RX8025T(I2C接口)驱动程序设计

一、简介: RX8025T 是一款低功耗、高精度的实时时钟芯片,具有以下特性: I2C 接口通信 内置 32.768 kHz 晶振 提供秒、分、时、日、月、年等时间信息 支持温度补偿,提高时间精度 低功耗设计,适合电池供电的应用 二、I2C初始化: #include "stm32l4xx_hal.h&…...

基于Ubuntu+vLLM+NVIDIA T4高效部署DeepSeek大模型实战指南

一、 前言&#xff1a;拥抱vLLM与T4显卡的强强联合 在探索人工智能的道路上&#xff0c;如何高效地部署和运行大型语言模型&#xff08;LLMs&#xff09;一直是一个核心挑战。尤其是当我们面对资源有限的环境时&#xff0c;这个问题变得更加突出。原始的DeepSeek-R1-32B模型虽…...

【Go语言快速上手】第二部分:Go语言进阶之并发编程

文章目录 一、并发编程1. goroutine&#xff1a;创建和调度 goroutine2. channel&#xff1a;无缓冲 channel、有缓冲 channel、select 语句2.1 无缓冲 channel2.2 有缓冲 channel2.3 select 语句 3. sync 包&#xff1a;Mutex、RWMutex、WaitGroup 等同步原语3.1 Mutex&#x…...

《机器学习数学基础》补充资料:四元数、点积和叉积

《机器学习数学基础》第1章1.4节介绍了内积、点积的有关概念&#xff0c;特别辨析了内积空间、欧几里得空间&#xff1b;第4章4.1.1节介绍了叉积的有关概念&#xff1b;4.1.2节介绍了张量积&#xff08;也称外积&#xff09;的概念。 以上这些内容&#xff0c;在不同资料中&…...

蓝桥杯篇---IAP15F2K61S2矩阵键盘

文章目录 前言简介矩阵键盘的工作原理1.行扫描2.检测列状态3.按键识别 硬件连接1.行线2.列线 矩阵键盘使用步骤1.初始化IO口2.扫描键盘3.消抖处理4.按键识别 示例代码&#xff1a;4x4矩阵键盘扫描示例代码&#xff1a;优化后的矩阵键盘扫描注意事项1.消抖处理2.扫描频率3.IO口配…...

通过小型语言模型尽可能简单地解释 Transformer

介绍 在过去的几年里&#xff0c;我阅读了无数关于 Transformer 网络的文章&#xff0c;观看了许多视频。其中大部分都非常好&#xff0c;但我很难理解 Transformer 架构&#xff0c;而其背后的主要直觉&#xff08;上下文敏感嵌入&#xff09;则更容易掌握。在做演讲时&#…...

GcExcel

GcExcel 简述:GcExcel Java 是一款基于 Java 平台,支持批量创建、编辑、打印、导入/导出Excel文件的服务端表格组件,能够高性能处理和高度兼容 Excel。功能特性(图1)文档查询(图2)...

封装红黑树实现map和set

" 喜欢了你十年&#xff0c;却用整个四月&#xff0c;编织了一个不爱你的谎言。 " 目录 1 源码及其框架分析 2 模拟实现map和set 2.1 实现出复用红黑树的框架 2.2 支持iterator迭代器的实现 2.2.1 代码实现和--这两个运算符 2.3 map支持[ ] Hello&#xff0c;大家…...

Redis进阶使用

在日常工作中&#xff0c;使用Redis有什么需要注意的&#xff1f; 设置合适的过期时间。尽量避免大key问题&#xff0c;避免用字符串存储过大的数据&#xff1b;避免集合的数据量太大&#xff0c;要定期清除。 常用的数据结构有哪些&#xff1f;用在什么地方&#xff1f; 按…...

【ISO 14229-1:2023 UDS诊断全量测试用例清单系列:第四节】

ISO 14229-1:2023 UDS诊断服务测试用例全解析&#xff08;Read DTC Information0x19服务&#xff09; 作者&#xff1a;车端域控测试工程师 更新日期&#xff1a;2025年2月13日 关键词&#xff1a;UDS诊断协议、0x19服务、DTC信息读取、ISO 14229-1:2023、ECU测试 一、服务功能…...

使用Node.js进行串口通信

目录 一、 安装 serialport 库二.、实现方法1.打开串口并配置参数2. 向串口传递信息3. 接收串口信息4. 处理错误5. 关闭串口6. 使用解析器7. 获取串口列表 三、 完整示例代码 一、 安装 serialport 库 首先&#xff0c;需要安装 serialport 库。可以通过 npm 安装&#xff1a;…...

vue3+elementplus新建项目

更新node.js和npm node.js官网更新指南 可以根据自己的操作系统进行选择 我的电脑操作系统是mac os所以我的步骤如下 # Download and install nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash# in lieu of restarting the shell \. &…...

【网络安全 | 漏洞挖掘】跨子域账户合并导致的账户劫持与删除

未经许可,不得转载。 文章目录 概述正文漏洞成因概述 在对目标系统进行安全测试时,发现其运行着两个独立的域名——一个用于司机用户,一个用于开发者/企业用户。表面上看,这两个域名各自独立管理账户,但测试表明它们在处理电子邮件变更时存在严重的逻辑漏洞。该漏洞允许攻…...

VLSM基础知识

VLSM&#xff08;Variable Length Subnet Mask&#xff0c;变长子网掩码&#xff09;是一种更灵活的子网划分技术&#xff0c;允许在同一网络中使用不同长度的子网掩码&#xff0c;以满足不同子网对主机数量的需求&#xff0c;最大化IP地址利用率。 一、基础概念 传统子网划分…...

小小小病毒(3)(~_~|)

一分耕耘一分收获 声明&#xff1a; 仅供损害电脑&#xff0c;不得用于非法。损坏电脑&#xff0c;作者一律不负责。此作为作者原创&#xff0c;转载请经过同意。 欢迎来到小小小病毒&#xff08;3&#xff09; 感谢大家的支持 还是那句话&#xff1a;上代码&#xff01; …...

WebRTC与EasyRTC:开启智能硬件音视频通讯的全新旅程

在当今数字化时代&#xff0c;音视频通讯技术正以前所未有的速度革新着我们的生活与工作方式。WebRTC与EasyRTC作为这一领域的佼佼者&#xff0c;正携手为智能硬件的音视频通讯注入强大动力&#xff0c;开启全新的篇章。 一、WebRTC与智能硬件融合的崭新趋势 WebRTC技术&…...

Lua 数据库访问

Lua 数据库访问 引言 Lua 是一种轻量级的编程语言,因其简洁性和高效性,常被用于游戏开发、嵌入系统和应用程序开发。在许多情况下,数据库访问是应用程序的核心功能之一。本文将深入探讨在 Lua 中如何进行数据库访问,包括连接数据库、执行查询、处理结果以及异常处理等。 …...

rtsp rtmp 跟 http 区别

SDP 一SDP介绍 1. SDP的核心功能 会话描述&#xff1a;定义会话的名称、创建者、时间范围、连接地址等全局信息。媒体协商&#xff1a;明确媒体流的类型&#xff08;如音频、视频&#xff09;、传输协议&#xff08;如RTP/UDP&#xff09;、编码格式&#xff08;如H.264、Op…...

蓝桥杯篇---IAP15F2K61S2串口

文章目录 前言简介串口通信的基本参数1.波特率2.数据位3.停止位4.校验位 串口相关寄存器1.SCON2.SBUF3.PCON4.TMOD5.TH1/TL1 串口使用步骤1.配置波特率2.配置串口模式3.使能串口中断4.发送数据5.接收数据6.处理中断 示例代码&#xff1a;串口发送与接收示例代码&#xff1a;串口…...

Linux 远程文件复制传输-----scp/rsync/sftp

scp&#xff08;Secure Copy Protocol&#xff09;是基于 SSH 的安全文件传输工具&#xff0c;可用于在本地和远程计算机之间复制文件或目录。 1. scp&#xff08;基于 SSH 复制文件&#xff09; a. 复制文件到远程 从本地复制到远程 scp localfile.txt userremote_host:/remo…...

企业文件安全:零信任架构下的文件访问控制

在企业数字化转型的进程中&#xff0c;传统的文件访问控制模型已难以满足日益复杂的网络安全需求。零信任架构作为一种新兴的安全理念&#xff0c;为企业的文件安全访问提供了全新的解决方案。 一、传统文件访问控制的局限性 传统的文件访问控制主要基于网络边界&#xff0c;…...

用deepseek学大模型05-线性回归

deepseek.com:多元线性回归的目标函数&#xff0c;损失函数&#xff0c;梯度下降 标量和矩阵形式的数学推导&#xff0c;pytorch真实能跑的代码案例以及模型,数据&#xff0c;预测结果的可视化展示&#xff0c; 模型应用场景和优缺点&#xff0c;及如何改进解决及改进方法数据推…...

2009年下半年软件设计师上午真题的知识点整理(附真题及答案解析)

以下是2009年下半年软件设计师上午真题的知识点分类整理&#xff0c;涉及定义的详细解释&#xff0c;供背诵记忆。 1. 计算机组成原理 CPU与存储器的访问。 Cache的作用: 提高CPU访问主存数据的速度&#xff0c;减少访问延迟。存储器的层次结构: 包括寄存器、Cache、主存和辅存…...

Element Plus table 去除行hover效果

需求&#xff1a; 给table的指定行设置高亮背景色且去除掉这些行的hover效果 思路&#xff1a; 给指定行设置css类名选择需要设置高亮的行的单元格&#xff0c;设置鼠标禁用属性让高亮行继承父元素的背景色 考虑到表格的第一列是勾选框&#xff0c;因此仅选择 tr 下除了第一…...

2010年下半年软件设计师考试上午真题的知识点整理(附真题及答案解析)

以下是2010年下半年软件设计师考试上午真题的知识点分类整理&#xff0c;涉及定义的详细解释&#xff0c;供背诵记忆。 1. 计算机组成原理 CPU与存储器的访问。 Cache的作用: 提高CPU访问主存数据的速度&#xff0c;减少访问延迟。存储器的层次结构: 包括寄存器、Cache、主存和…...

Mac Golang 开发环境配置

Mac Golang 开发环境配置 Golang 介绍 Go&#xff08;又称Golang&#xff09;是Google开发的一种静态强类型、编译型、并发型&#xff0c;并具有垃圾回收功能的编程语言。 由罗伯特格瑞史莫&#xff0c;罗勃派克&#xff08;Rob Pike&#xff09;及肯汤普逊于2007年9月开始设计…...

计算机视觉中图像的基础认知

第一章&#xff1a;计算机视觉中图像的基础认知 第二章&#xff1a;计算机视觉&#xff1a;卷积神经网络(CNN)基本概念(一) 第三章&#xff1a;计算机视觉&#xff1a;卷积神经网络(CNN)基本概念(二) 第四章&#xff1a;搭建一个经典的LeNet5神经网络 一、图像/视频的基本属性…...

理解 WebGPU 中的 navigator.gpu 和 adapter:从浏览器到显卡的旅程

WebGPU 是一种现代图形 API&#xff0c;旨在为 Web 应用程序提供高性能的图形和计算功能。作为 WebGL 的继任者&#xff0c;WebGPU 提供了更底层的硬件访问和更高效的性能。在 WebGPU 开发中&#xff0c;navigator.gpu 是访问 WebGPU API 的入口点&#xff0c;而 adapter 则是浏…...

【ESP32 IDF】ESP32 linux 环境搭建

ESP32 linux 环境搭建 1. 开发环境2. linux指令 1. 开发环境 liunx镜像 liunx镜像地址 &#xff1a; https://mirrors.xjtu.edu.cn/ubuntu-releases/20.04.6/ubuntu-20.04.6-live-server-amd64.iso 有提示你装openssl&#xff0c;务必装上 2. linux指令 工具 sudo apt-get …...

react传递函数与回调函数原理

为什么 React 允许直接传递函数&#xff1f; 回调函数核心逻辑 例子&#xff1a;父组件控制 Modal 的显示与隐藏 // 父组件 (ParentComponent.tsx) import React, { useState } from react; import { Modal, Button } from antd; import ModalContent from ./ModalContent;co…...

目标检测IoU阈值全解析:YOLO/DETR模型中的精度-召回率博弈与工程实践指南

一、技术原理与数学本质 IoU计算公式&#xff1a; IoU \frac{Area\ of\ Overlap}{Area\ of\ Union} \frac{A ∩ B}{A ∪ B}阈值选择悖论&#xff1a; 高阈值&#xff08;0.6-0.75&#xff09;&#xff1a;减少误检&#xff08;FP↓&#xff09;但增加漏检&#xff08;FN↑…...

使用grafana v11 建立k线(蜡烛图)仪表板

先看实现的结果 沪铜主力合约 2025-02-12 的1分钟k线图 功能介绍: 左上角支持切换主力合约,日期,实现动态加载数据. 项目背景: 我想通过前端展示期货指定品种某1天的1分钟k线,类似tqsdk 的web_gui 生成图形化界面— TianQin Python SDK 3.7.8 文档 项目架构: 后端: fastap…...

Ubuntu下载安装Docker-Desktop

下载 Ubuntu | Docker Docs 预备工作 Ubuntu增加docker apt库-CSDN博客 安装 sudo apt-get updatesudo apt install gnome-terminal# sudo apt install -y docker-composesudo apt-get install ./docker-desktop-amd64.deb 测试 sudo docker run hello-worldHello from D…...

【大模型】DeepSeek 高级提示词技巧使用详解

目录 一、前言 二、DeepSeek 通用提示词技巧 2.1 DeepSeek 通用提示词技巧总结 三、DeepSeek 进阶使用技巧 3.1 DeepSeek一个特定角色的人设 3.1.1 为DeepSeek设置角色操作案例一 3.1.2 为DeepSeek设置角色操作案例二 3.2 DeepSeek开放人设升级 3.2.1 特殊的人设&#…...

23. AI-大语言模型

文章目录 前言一、LLM1. 简介2. 工作原理和结构3. 应用场景4. 最新研究进展5. 比较 二、Transformer架构1. 简介2. 基本原理和结构3. 应用场景4. 最新进展 三、开源1. 开源概念2. 开源模式3. 模型权重 四、再谈DeepSeek 前言 AI‌ 一、LLM LLM&#xff08;Large Language Mod…...

STM32的启动流程

启动模式 我们知道的复位方式有三种&#xff1a;上电复位&#xff0c;硬件复位和软件复位。当产生复位&#xff0c;并且离开复位状态后&#xff0c; CM33 内核做的第一件事就是读取下列两个 32 位整数的值&#xff1a; &#xff08;1&#xff09; 从地址 0x0000 0000 处取出堆…...

C++ Primer 函数匹配

欢迎阅读我的 【CPrimer】专栏 专栏简介&#xff1a;本专栏主要面向C初学者&#xff0c;解释C的一些基本概念和基础语言特性&#xff0c;涉及C标准库的用法&#xff0c;面向对象特性&#xff0c;泛型特性高级用法。通过使用标准库中定义的抽象设施&#xff0c;使你更加适应高级…...

Httprint 指纹识别技术:网络安全的关键洞察

引言 Http指纹识别现在已经成为应用程序安全中一个新兴的话题&#xff0c;Http服务器和Http应用程序安全也已经成为网络安全中的重要一部分。从网络管理的立场来看&#xff0c;保持对各种web服务器的监视和追踪使得Http指纹识别变的唾手可得&#xff0c;Http指纹识别可以使得信…...

STM32的HAL库开发---ADC

一、ADC简介 1、ADC&#xff0c;全称&#xff1a;Analog-to-Digital Converter&#xff0c;指模拟/数字转换器 把一些传感器的物理量转换成电压&#xff0c;使用ADC采集电压&#xff0c;然后转换成数字量&#xff0c;经过单片机处理&#xff0c;进行控制和显示。 2、常见的AD…...

PostgreSQL有undo表空间吗?

PostgreSQL有undo表空间吗 PostgreSQL 没有单独的 Undo 表空间&#xff0c;其事务回滚和多版本并发控制&#xff08;MVCC&#xff09;机制与 Oracle 等数据库有显著差异。 一 PostgreSQL 的 MVCC 实现 PostgreSQL 通过 多版本并发控制&#xff08;MVCC&#xff09; 管理事务…...

Huatuo热更新--安装HybridCLR

1.自行安装unity编辑器 支持2019.4.x、2020.3.x、2021.3.x、2022.3.x 中任一版本。推荐安装2019.4.40、2020.3.26、2021.3.x、2022.3.x版本。 根据你打包的目标平台&#xff0c;安装过程中选择必要模块。如果打包Android或iOS&#xff0c;直接选择相应模块即可。如果你想打包…...

Windows环境安装部署minimind步骤

Windows环境安装部署minimind步骤 必要的软件环境 git git&#xff0c;可下载安装版&#xff0c;本机中下载绿色版&#xff0c;解压到本地目录下&#xff08;如&#xff1a;c:\soft\git.win64&#xff09;&#xff0c;可将此路径添加到PATH环境变量中&#xff0c;供其他程序…...