Merge branch 'main' of http://git.siriusliang.site/Gods/go_fish_web
This commit is contained in:
+1
-19
@@ -1,25 +1,7 @@
|
|||||||
# 构建阶段
|
|
||||||
FROM node:18-alpine as builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# 复制项目文件
|
|
||||||
COPY package*.json ./
|
|
||||||
|
|
||||||
# 安装依赖
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
# 复制源代码
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# 构建项目
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# 生产阶段
|
|
||||||
FROM nginx:1.25.3-alpine
|
FROM nginx:1.25.3-alpine
|
||||||
|
|
||||||
# 从构建阶段复制构建结果到nginx目录
|
# 从构建阶段复制构建结果到nginx目录
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
ADD go_fish_web.tar.gz /usr/share/nginx/html
|
||||||
|
|
||||||
# 复制nginx配置
|
# 复制nginx配置
|
||||||
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|||||||
Vendored
+64
@@ -0,0 +1,64 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('📄文件信息') {
|
||||||
|
steps {
|
||||||
|
sh 'pwd'
|
||||||
|
sh 'ls -al'
|
||||||
|
echo '🚀开始推送文件到坤爷服务器'
|
||||||
|
sh 'scp Dockerfile root@47.109.22.188:~/go_fish_web'
|
||||||
|
sh 'scp nginx.conf root@47.109.22.188:~/go_fish_web'
|
||||||
|
echo '✨推送完成'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('🛠️构建项目') {
|
||||||
|
steps {
|
||||||
|
withDockerContainer('node:18-alpine') {
|
||||||
|
sh 'npm -v'
|
||||||
|
sh 'npm config set registry https://registry.npmmirror.com'
|
||||||
|
sh 'npm install'
|
||||||
|
sh 'npm run build'
|
||||||
|
sh 'ls -al'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('🎁打包制品'){
|
||||||
|
steps {
|
||||||
|
dir('dist') {
|
||||||
|
sh 'ls -al'
|
||||||
|
sh 'tar -zcvf go_fish_web.tar.gz *'
|
||||||
|
archiveArtifacts artifacts: 'go_fish_web.tar.gz',
|
||||||
|
allowEmptyArchive: true,
|
||||||
|
fingerprint: true,
|
||||||
|
onlyIfSuccessful: true
|
||||||
|
sh 'ls -al'
|
||||||
|
echo '🚀开始推送制品到坤爷服务器'
|
||||||
|
sh 'scp go_fish_web.tar.gz root@47.109.22.188:~/go_fish_web'
|
||||||
|
echo '✨推送完成'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('🏓远程部署') {
|
||||||
|
steps {
|
||||||
|
echo '🚀开始远程部署'
|
||||||
|
sh 'ssh root@47.109.22.188 "docker stop go_fish_web && docker rm go_fish_web && docker rmi go_fish_web && docker build -t go_fish_web ~/go_fish_web"'
|
||||||
|
sh 'ssh root@47.109.22.188 "docker run --restart=always --name go_fish_web -d -p 30030:80 -v /etc/localtime:/etc/localtime:ro go_fish_web"'
|
||||||
|
sh 'ssh root@47.109.22.188 "docker ps -a"'
|
||||||
|
echo '✨远程部署完成'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo 'Deployment successful!'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo 'Deployment failed.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -156,19 +156,26 @@ const handleProcessFish = async () => {
|
|||||||
|
|
||||||
// 手动处理鱼
|
// 手动处理鱼
|
||||||
const handleFish = async (fishId) => {
|
const handleFish = async (fishId) => {
|
||||||
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
loading.value = true;
|
const res = await handleFishById(fishId)
|
||||||
const res = await handleFishById(fishId);
|
if (res.success) {
|
||||||
if (res) {
|
ElMessage.success(res.message + ' 🎉')
|
||||||
ElMessage.success(res + " 🎉");
|
fetchFishList()
|
||||||
await fetchFishList();
|
}
|
||||||
|
else{
|
||||||
|
ElMessage.error(res.message + ' 😢')
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ElMessage.warning("处理失败,请稍后再试 ⏳");
|
console.log('====================================');
|
||||||
} finally {
|
console.log(err);
|
||||||
loading.value = false;
|
console.log('====================================');
|
||||||
|
ElMessage.warning('处理失败,请稍后再试 ⏳')
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// 处理出售操作
|
// 处理出售操作
|
||||||
const handleSell = async (fish) => {
|
const handleSell = async (fish) => {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<<<<<<< HEAD
|
||||||
<div class="fishing-page">
|
<div class="fishing-page">
|
||||||
<div class="fishing-container">
|
<div class="fishing-container">
|
||||||
<div class="fishing-area">
|
<div class="fishing-area">
|
||||||
@@ -11,36 +12,27 @@
|
|||||||
>
|
>
|
||||||
<div class="fishing-scene" @click="handleFish"></div>
|
<div class="fishing-scene" @click="handleFish"></div>
|
||||||
<div class="ripple"></div>
|
<div class="ripple"></div>
|
||||||
|
=======
|
||||||
|
<div class="fishing-page">
|
||||||
|
<div class="fishing-container">
|
||||||
|
<div class="fishing-area">
|
||||||
|
<div class="fishing-animation" :class="{ 'fishing-active': isFishing }">
|
||||||
|
<div class="fishing-scene" @click="handleFish"></div>
|
||||||
|
<div class="ripple"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="result" v-if="resultMessage || nextPullTime">
|
<div class="result" v-if="resultMessage || nextPullTime">
|
||||||
<el-alert
|
<el-alert v-if="resultMessage" :title="resultMessage" :type="currentCatch.length>0 ? 'success' : 'info'"
|
||||||
v-if="resultMessage"
|
:closable="false" show-icon />
|
||||||
:title="resultMessage"
|
<el-alert v-if="nextPullTime" :title="`下次可钓鱼时间:${nextPullTime}`" type="warning" :closable="false" show-icon />
|
||||||
:type="currentCatch ? 'success' : 'info'"
|
|
||||||
:closable="false"
|
|
||||||
show-icon
|
|
||||||
/>
|
|
||||||
<el-alert
|
|
||||||
v-if="nextPullTime"
|
|
||||||
:title="`下次可钓鱼时间:${nextPullTime}`"
|
|
||||||
type="warning"
|
|
||||||
:closable="false"
|
|
||||||
show-icon
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="log-area">
|
<div class="log-area">
|
||||||
<FishingLog :logs="fishingLogs" />
|
<FishingLog :logs="fishingLogs" />
|
||||||
<div class="back-button">
|
<div class="back-button">
|
||||||
<el-button
|
<el-button @click="goHome" size="small" type="default" icon="ArrowLeft">返回</el-button>
|
||||||
@click="goHome"
|
|
||||||
size="small"
|
|
||||||
type="default"
|
|
||||||
icon="ArrowLeft"
|
|
||||||
>返回</el-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
>>>>>>> 4a4857fa8239db297faeeaf348f16654927c8bb7
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -56,7 +48,7 @@ const router = useRouter();
|
|||||||
const resultMessage = ref("");
|
const resultMessage = ref("");
|
||||||
const nextPullTime = ref("");
|
const nextPullTime = ref("");
|
||||||
const isFishing = ref(false);
|
const isFishing = ref(false);
|
||||||
const currentCatch = ref(null);
|
const currentCatch = ref([]); // 改为数组
|
||||||
const fishingLogs = ref([]);
|
const fishingLogs = ref([]);
|
||||||
const clickCount = ref(0);
|
const clickCount = ref(0);
|
||||||
const targetClicks = ref(0);
|
const targetClicks = ref(0);
|
||||||
@@ -77,6 +69,7 @@ const saveLogs = () => {
|
|||||||
localStorage.setItem("fishingLogs", JSON.stringify(fishingLogs.value));
|
localStorage.setItem("fishingLogs", JSON.stringify(fishingLogs.value));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// 生成随机点击阈值(1-5秒内的随机次数)
|
// 生成随机点击阈值(1-5秒内的随机次数)
|
||||||
const generateRandomTarget = () => {
|
const generateRandomTarget = () => {
|
||||||
return Math.floor(Math.random() * 15) + 5; // 5-20次随机点击
|
return Math.floor(Math.random() * 15) + 5; // 5-20次随机点击
|
||||||
@@ -98,10 +91,13 @@ const willReelFail = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 组件挂载时加载缓存的日志
|
// 组件挂载时加载缓存的日志
|
||||||
|
=======
|
||||||
|
>>>>>>> 4a4857fa8239db297faeeaf348f16654927c8bb7
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadCachedLogs();
|
loadCachedLogs();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// 组件卸载时清除定时器
|
// 组件卸载时清除定时器
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
if (fishEscapeTimer.value) {
|
if (fishEscapeTimer.value) {
|
||||||
@@ -179,6 +175,18 @@ const handleFish = async () => {
|
|||||||
// 调用钓鱼接口
|
// 调用钓鱼接口
|
||||||
currentCatch.value = null;
|
currentCatch.value = null;
|
||||||
resultMessage.value = "正在钓鱼中...";
|
resultMessage.value = "正在钓鱼中...";
|
||||||
|
=======
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
localStorage.removeItem("fishingLogs");
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleFish = async () => {
|
||||||
|
if (isFishing.value) return;
|
||||||
|
|
||||||
|
isFishing.value = true;
|
||||||
|
currentCatch.value = [];
|
||||||
|
resultMessage.value = "正在钓鱼中...";
|
||||||
|
>>>>>>> 4a4857fa8239db297faeeaf348f16654927c8bb7
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fishingClick();
|
const res = await fishingClick();
|
||||||
@@ -189,20 +197,23 @@ const handleFish = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (items.length > 0) {
|
if (items.length > 0) {
|
||||||
const fish = items[0];
|
currentCatch.value = items;
|
||||||
currentCatch.value = fish;
|
|
||||||
resultMessage.value = `你钓到了一条${fish.isRare ? "稀有的" : ""}「${
|
// 构建展示信息
|
||||||
fish.fishName
|
const messageList = items.map(fish =>
|
||||||
}」,重量 ${fish.weight}`;
|
`「${fish.isRare ? "稀有的" : ""}${fish.fishName}」,重量 ${fish.weight}`
|
||||||
|
);
|
||||||
|
resultMessage.value = `你钓到了:\n${messageList.join("\n")}`;
|
||||||
ElMessage.success("钓鱼成功!🎣");
|
ElMessage.success("钓鱼成功!🎣");
|
||||||
|
|
||||||
// 添加到日志并保存到localStorage
|
// 添加所有钓到的鱼到日志
|
||||||
fishingLogs.value.unshift({
|
const newLogs = items.map(fish => ({
|
||||||
time: new Date(),
|
time: new Date(),
|
||||||
fishName: fish.fishName,
|
fishName: fish.fishName,
|
||||||
weight: fish.weight,
|
weight: fish.weight,
|
||||||
isRare: fish.isRare,
|
isRare: fish.isRare,
|
||||||
});
|
}));
|
||||||
|
fishingLogs.value.unshift(...newLogs);
|
||||||
saveLogs();
|
saveLogs();
|
||||||
} else {
|
} else {
|
||||||
resultMessage.value = "什么也没钓到,下次好运 🍀";
|
resultMessage.value = "什么也没钓到,下次好运 🍀";
|
||||||
@@ -227,6 +238,7 @@ const handleFish = async () => {
|
|||||||
const goHome = () => {
|
const goHome = () => {
|
||||||
router.push("/");
|
router.push("/");
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -276,6 +288,7 @@ const goHome = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.fishing-animation {
|
.fishing-animation {
|
||||||
|
<<<<<<< HEAD
|
||||||
height: 500px;
|
height: 500px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
@@ -296,6 +309,25 @@ const goHome = () => {
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease;
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
|
=======
|
||||||
|
height: 500px;
|
||||||
|
position: relative;
|
||||||
|
margin: 20px 0;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fishing-scene {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
background: url("@/assets/fishing-scene.svg") no-repeat center;
|
||||||
|
background-size: cover;
|
||||||
|
>>>>>>> 4a4857fa8239db297faeeaf348f16654927c8bb7
|
||||||
}
|
}
|
||||||
|
|
||||||
.fishing-active .fishing-scene {
|
.fishing-active .fishing-scene {
|
||||||
@@ -322,6 +354,13 @@ const goHome = () => {
|
|||||||
animation: ripple 2s infinite;
|
animation: ripple 2s infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
.fishing-controls {
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
>>>>>>> 4a4857fa8239db297faeeaf348f16654927c8bb7
|
||||||
.result {
|
.result {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user