Skip to content

Commit

Permalink
Merge pull request #31 from haitang000/DEV
Browse files Browse the repository at this point in the history
👌 优化Icon随机逻辑
  • Loading branch information
haitang000 authored Aug 27, 2024
2 parents 5c40c5a + 6b4f726 commit e6cda9e
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 5 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Container image that runs your code
FROM alpine:3.10

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]
16 changes: 16 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# action.yml
name: 'XiaYanISeeYou'
description: 'A '
inputs:
who-to-greet: # id of input
description: 'Who to greet'
required: true
default: 'World'
outputs:
time: # id of output
description: 'The time we greeted you'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.who-to-greet }}
49 changes: 49 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/json;

sendfile on;

keepalive_timeout 65;

server {
listen 18080;
# 指定前端项目所在的位置(容器内的位置)
location / {
root /usr/share/static;
}

error_page 404 /404.html;
location = /404.html {
root static;
}
location /api {
rewrite /api/(.*) /$1 break;
# 容器在同一个网络,可以使用容器名访问,hamll就代表了其IP
proxy_pass http://hmall:8080;
}
}
server {
listen 18081;
# 指定前端项目所在的位置(容器内的位置)
location / {
root /usr/share/static;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /api {
rewrite /api/(.*) /$1 break;
# 容器在同一个网络,可以使用容器名访问,hamll就代表了其IP
proxy_pass http://hmall:8080;
}
}
}
Binary file added static/image/icon/Cry2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/image/icon/PlayWithPhone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/image/icon/Study.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions static/maintenance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="Keywords" content="夏彦,夏彦照片墙,夏彦美图,夏彦卡面,夏彦I see you,xyicu">
<meta name="description" content="夏彦I see you❤ - 一个整理夏彦美图的网站">

<title>夏彦 I see you ❤</title>
<link rel="stylesheet" href="styles/index-style.css">
<link rel="shortcut icon" href="image/icon/logo.jpg">
</head>

<body>
<div class="title">
<img src="image/icon/Study.png" id="maintenance-icon">
<h1 id="title-h1">当前服务正在进行维护</h1>
<p id="title-p">您目前访问的网站正在维护,这可能需要较长时间,很抱歉为您带来不便</p>
</div>
<footer>
<div class="footer-links-contianer">
<a class="footer-links" href="https://status.haitang000.top">网站运行状态</a>
<a class="footer-links" href="https://afdian.com/a/haitang_HTUI">赞助作者</a>
<a class="footer-links" href="https://github.com/haitang000/XiaYan-I-see-you">网站 GitHub 仓库</a>
</div>
</footer>
</body>

</html>

<script src="script/cursor.js"></script>
<script src="script/icon_random.js"></script>
39 changes: 34 additions & 5 deletions static/script/icon_random.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
window.onload = randomErrorIcon;
/*window.onload = randomIcon;
function randomErrorIcon (){
var ErrorIcon = new Array('image/icon/Thinking.png','image/icon/Cry.png','image/icon/Alone.png')
var randomNum = Math.floor((Math.random() * ErrorIcon.length));
document.getElementById("error-icon").src = ErrorIcon[randomNum];
function randomIcon (){
//图片路径
var ErrorIcon = new Array('image/icon/Thinking.png','image/icon/Cry.png','image/icon/Cry2.png','image/icon/Alone.png')
var MaintenanceIcon = new Array('image/icon/Study.png','image/icon/Thinking.png','image/icon/PlayWithPhone.png')
//随机数生成
var randomNumError = Math.floor((Math.random() * ErrorIcon.length));
var randomNumMaintenance = Math.floor((Math.random() * MaintenanceIcon.length));
//替换图片
document.getElementById("error-icon").src = ErrorIcon[randomNumError];
document.getElementById("maintenance-icon").src = MaintenanceIcon[randomNumMaintenance];
}*/

window.onload = function() {
randomIcon('error-icon', [
'image/icon/Thinking.png',
'image/icon/Cry.png',
'image/icon/Cry2.png',
'image/icon/Alone.png'
]);

randomIcon('maintenance-icon', [
'image/icon/Study.png',
'image/icon/Thinking.png',
'image/icon/PlayWithPhone.png'
]);
};

function randomIcon(elementId, iconArray) {
const element = document.getElementById(elementId);
if (element) {
const randomIndex = Math.floor(Math.random() * iconArray.length);
element.src = iconArray[randomIndex];
}
}

0 comments on commit e6cda9e

Please sign in to comment.