From 00a6b272b7361b419cc055d9e62e47332d56fc4a Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 19:00:02 +0800 Subject: [PATCH 01/12] Add CI/CD config --- .drone.yml | 37 +++++++++++++++++++++++++++++++++++++ Dockerfile | 11 +++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..310abcf --- /dev/null +++ b/.drone.yml @@ -0,0 +1,37 @@ +kind: pipeline +type: docker +name: martial-mini + +trigger: + branch: + - main + - master + +steps: + - name: build + image: plugins/docker + settings: + repo: martial/mini + tags: latest + dockerfile: Dockerfile + daemon_off: true + volumes: + - name: docker + path: /var/run/docker.sock + + - name: deploy + image: appleboy/drone-ssh + settings: + host: 154.30.6.21 + username: root + key: + from_secret: ssh_key + script: + - docker stop martial-mini || true + - docker rm martial-mini || true + - docker run -d --name martial-mini -p 8081:80 martial/mini:latest + +volumes: + - name: docker + host: + path: /var/run/docker.sock diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eede4a8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:16-alpine as builder +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build:h5 + +FROM nginx:alpine +COPY --from=builder /app/dist/build/h5 /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] From 518d4f4f5a167986b2d53a93ccdeffa24c5c89c7 Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 19:05:56 +0800 Subject: [PATCH 02/12] Trigger CI/CD From 0b520cd41abbfe6d58b5e824d0e528c280e7a124 Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 19:07:08 +0800 Subject: [PATCH 03/12] Retrigger CI/CD From 7f80134daa6c7a37ed0c2c8934fe7b9ce90beded Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 19:12:29 +0800 Subject: [PATCH 04/12] Fix: use scp instead of docker build --- .drone.yml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.drone.yml b/.drone.yml index 310abcf..45119d3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,17 +9,23 @@ trigger: steps: - name: build - image: plugins/docker - settings: - repo: martial/mini - tags: latest - dockerfile: Dockerfile - daemon_off: true - volumes: - - name: docker - path: /var/run/docker.sock + image: node:16-alpine + commands: + - npm install + - npm run build:h5 - name: deploy + image: appleboy/drone-scp + settings: + host: 154.30.6.21 + username: root + key: + from_secret: ssh_key + source: dist/build/h5/* + target: /var/www/martial-mini + strip_components: 3 + + - name: restart image: appleboy/drone-ssh settings: host: 154.30.6.21 @@ -29,9 +35,4 @@ steps: script: - docker stop martial-mini || true - docker rm martial-mini || true - - docker run -d --name martial-mini -p 8081:80 martial/mini:latest - -volumes: - - name: docker - host: - path: /var/run/docker.sock + - docker run -d --name martial-mini -p 8081:80 -v /var/www/martial-mini:/usr/share/nginx/html:ro nginx:alpine From 703282abcfaf3a6ab56b50d9de25a4d8c06635bd Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 19:32:55 +0800 Subject: [PATCH 05/12] Trigger build From f9b474e639d73907f1c40a0d6c3fe6c6382907ec Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 19:36:29 +0800 Subject: [PATCH 06/12] Fix: use npx uni build --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 45119d3..bc99414 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,7 +12,7 @@ steps: image: node:16-alpine commands: - npm install - - npm run build:h5 + - npx uni build - name: deploy image: appleboy/drone-scp From b63602e6f7721ec89c616d77db76fe4bcba27eaf Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 19:40:10 +0800 Subject: [PATCH 07/12] Fix: use local uni cli --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index bc99414..0ccbe94 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,7 +12,7 @@ steps: image: node:16-alpine commands: - npm install - - npx uni build + - ./node_modules/.bin/uni build - name: deploy image: appleboy/drone-scp From 59f7591c548dabe540837e51168dcb8bad993c1d Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 19:45:26 +0800 Subject: [PATCH 08/12] Fix: use uniapp-cli --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 0ccbe94..466fe74 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,7 +12,7 @@ steps: image: node:16-alpine commands: - npm install - - ./node_modules/.bin/uni build + - ./node_modules/.bin/uniapp-cli build - name: deploy image: appleboy/drone-scp From 4b72a6985d2651d740f61bc81e37a4a37477b6df Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 19:58:24 +0800 Subject: [PATCH 09/12] Fix: use specific dcloudio versions and vue-cli-service --- .drone.yml | 2 +- package.json | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.drone.yml b/.drone.yml index 466fe74..946ed21 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,7 +12,7 @@ steps: image: node:16-alpine commands: - npm install - - ./node_modules/.bin/uniapp-cli build + - ./node_modules/.bin/cross-env NODE_ENV=production UNI_PLATFORM=h5 ./node_modules/.bin/vue-cli-service build - name: deploy image: appleboy/drone-scp diff --git a/package.json b/package.json index ec5c71c..0a83200 100644 --- a/package.json +++ b/package.json @@ -4,25 +4,26 @@ "description": "武术赛事报名系统", "main": "main.js", "scripts": { - "dev:h5": "uni", - "build:h5": "uni build", - "dev:mp-weixin": "uni -p mp-weixin", - "build:mp-weixin": "uni build -p mp-weixin" + "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service serve", + "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service build", + "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch", + "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build" }, "dependencies": { "vue": "^2.6.14" }, "devDependencies": { - "@dcloudio/uni-cli-shared": "latest", - "@dcloudio/uni-template-compiler": "latest", - "@dcloudio/vue-cli-plugin-hbuilderx": "latest", - "@dcloudio/vue-cli-plugin-uni": "latest", - "@dcloudio/vue-cli-plugin-uni-optimize": "latest", - "@dcloudio/webpack-uni-mp-loader": "latest", - "@dcloudio/webpack-uni-pages-loader": "latest", - "@vue/cli-plugin-babel": "~4.5.0", - "@vue/cli-service": "~4.5.0", + "@dcloudio/uni-cli-shared": "^2.0.2-3081220230817001", + "@dcloudio/uni-template-compiler": "^2.0.2-3081220230817001", + "@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.2-3081220230817001", + "@dcloudio/vue-cli-plugin-uni": "^2.0.2-3081220230817001", + "@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.2-3081220230817001", + "@dcloudio/webpack-uni-mp-loader": "^2.0.2-3081220230817001", + "@dcloudio/webpack-uni-pages-loader": "^2.0.2-3081220230817001", + "@vue/cli-plugin-babel": "~4.5.19", + "@vue/cli-service": "~4.5.19", "babel-plugin-import": "^1.13.3", + "cross-env": "^7.0.3", "mini-types": "*", "miniprogram-api-typings": "*", "postcss-comment": "^2.0.0", From e90cef72ce4aa1418fea9745637b575858202d2f Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 23:08:45 +0800 Subject: [PATCH 10/12] Add missing dcloudio dependencies --- package.json | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 0a83200..e40dbea 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,11 @@ "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build" }, "dependencies": { + "@dcloudio/uni-app": "^2.0.2-3081220230817001", + "@dcloudio/uni-cli-i18n": "^2.0.2-3081220230817001", + "@dcloudio/uni-h5": "^2.0.2-3081220230817001", + "@dcloudio/uni-i18n": "^2.0.2-3081220230817001", + "@dcloudio/uni-migration": "^2.0.2-3081220230817001", "vue": "^2.6.14" }, "devDependencies": { @@ -34,12 +39,5 @@ "browserslist": [ "Android >= 4.4", "ios >= 9" - ], - "keywords": [ - "uniapp", - "martial-arts", - "registration" - ], - "author": "", - "license": "MIT" + ] } From bc91efe368c15e87b600b284c69aa2af1931e395 Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 23:44:07 +0800 Subject: [PATCH 11/12] Add src directory for uni-app build --- src/App.vue | 37 ++++++++ src/main.js | 21 +++++ src/manifest.json | 60 +++++++++++++ src/pages.json | 220 ++++++++++++++++++++++++++++++++++++++++++++++ src/uni.scss | 80 +++++++++++++++++ 5 files changed, 418 insertions(+) create mode 100644 src/App.vue create mode 100644 src/main.js create mode 100644 src/manifest.json create mode 100644 src/pages.json create mode 100644 src/uni.scss diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..65d9e74 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,37 @@ + + + diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..c993206 --- /dev/null +++ b/src/main.js @@ -0,0 +1,21 @@ +import App from './App' + +// #ifndef VUE3 +import Vue from 'vue' +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +app.$mount() +// #endif + +// #ifdef VUE3 +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +// #endif diff --git a/src/manifest.json b/src/manifest.json new file mode 100644 index 0000000..e3b1b81 --- /dev/null +++ b/src/manifest.json @@ -0,0 +1,60 @@ +{ + "name": "martial-mini", + "appid": "", + "description": "武术赛事报名系统", + "versionName": "2.0", + "versionCode": "200", + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "modules": {}, + "distribute": { + "android": { + "permissions": [] + }, + "ios": {}, + "sdkConfigs": {} + } + }, + "quickapp": {}, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false, + "es6": true, + "postcss": true, + "minified": true + }, + "usingComponents": true + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "h5": { + "title": "武术赛事报名系统", + "template": "index.html", + "router": { + "mode": "hash", + "base": "./" + }, + "optimization": { + "treeShaking": { + "enable": true + } + } + } +} diff --git a/src/pages.json b/src/pages.json new file mode 100644 index 0000000..2ef98ea --- /dev/null +++ b/src/pages.json @@ -0,0 +1,220 @@ +{ + "pages": [ + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "登录", + "navigationStyle": "custom" + } + }, + { + "path": "pages/register/register", + "style": { + "navigationBarTitleText": "注册", + "navigationStyle": "custom" + } + }, + { + "path": "pages/home/home", + "style": { + "navigationBarTitleText": "武术赛事通", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/profile/profile", + "style": { + "navigationBarTitleText": "个人中心", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/change-password/change-password", + "style": { + "navigationBarTitleText": "修改密码", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/common-info/common-info", + "style": { + "navigationBarTitleText": "常用信息", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/add-player/add-player", + "style": { + "navigationBarTitleText": "新增选手", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/edit-player/edit-player", + "style": { + "navigationBarTitleText": "编辑选手", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/add-contact/add-contact", + "style": { + "navigationBarTitleText": "新增联系人", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/my-registration/my-registration", + "style": { + "navigationBarTitleText": "我的报名", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-list/event-list", + "style": { + "navigationBarTitleText": "全部赛事列表", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-detail/event-detail", + "style": { + "navigationBarTitleText": "赛事详情", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/select-event/select-event", + "style": { + "navigationBarTitleText": "选择报名项目", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-register/event-register", + "style": { + "navigationBarTitleText": "赛事报名", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/register-type/register-type", + "style": { + "navigationBarTitleText": "选择报名", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-info/event-info", + "style": { + "navigationBarTitleText": "信息发布", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-info-detail/event-info-detail", + "style": { + "navigationBarTitleText": "信息详情", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-rules/event-rules", + "style": { + "navigationBarTitleText": "赛事规程", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-schedule/event-schedule", + "style": { + "navigationBarTitleText": "活动日程", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-players/event-players", + "style": { + "navigationBarTitleText": "参赛选手", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-live/event-live", + "style": { + "navigationBarTitleText": "比赛实况", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-lineup/event-lineup", + "style": { + "navigationBarTitleText": "出场顺序", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-score/event-score", + "style": { + "navigationBarTitleText": "成绩", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/event-medals/event-medals", + "style": { + "navigationBarTitleText": "奖牌榜", + "navigationBarBackgroundColor": "#C93639", + "navigationBarTextStyle": "white" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "white", + "navigationBarTitleText": "武术赛事", + "navigationBarBackgroundColor": "#C93639", + "backgroundColor": "#F8F8F8" + }, + "tabBar": { + "color": "#999999", + "selectedColor": "#C93639", + "backgroundColor": "#ffffff", + "borderStyle": "black", + "list": [ + { + "pagePath": "pages/home/home", + "text": "首页", + "iconPath": "static/images/首页灰@3x.png", + "selectedIconPath": "static/images/首页亮@3x.png" + }, + { + "pagePath": "pages/profile/profile", + "text": "个人中心", + "iconPath": "static/images/个人中心灰@3x.png", + "selectedIconPath": "static/images/个人中心亮@3x.png" + } + ] + } +} diff --git a/src/uni.scss b/src/uni.scss new file mode 100644 index 0000000..9a2d32f --- /dev/null +++ b/src/uni.scss @@ -0,0 +1,80 @@ +/* 全局颜色变量 */ +$primary-color: #C93639; +$primary-red: #C93639; +$text-color: #333333; +$text-gray: #666666; +$text-light: #999999; +$border-color: #eeeeee; +$bg-gray: #f5f5f5; +$white: #ffffff; + +/* 常用尺寸 */ +$page-padding: 30rpx; +$border-radius: 16rpx; +$border-radius-lg: 24rpx; + +/* 公共样式 */ +.container { + min-height: 100vh; + background-color: $bg-gray; +} + +.page-padding { + padding: $page-padding; +} + +.card { + background-color: $white; + border-radius: $border-radius; + padding: 30rpx; + margin-bottom: 20rpx; +} + +.flex { + display: flex; +} + +.flex-center { + display: flex; + align-items: center; + justify-content: center; +} + +.flex-between { + display: flex; + align-items: center; + justify-content: space-between; +} + +.flex-column { + display: flex; + flex-direction: column; +} + +.text-center { + text-align: center; +} + +.text-right { + text-align: right; +} + +.primary-btn { + background-color: $primary-color; + color: $white; + border-radius: 12rpx; + font-size: 32rpx; + padding: 28rpx; + text-align: center; + font-weight: bold; +} + +.disabled-btn { + background-color: rgba(201, 54, 57, 0.5); + color: $white; + border-radius: 12rpx; + font-size: 32rpx; + padding: 28rpx; + text-align: center; + font-weight: bold; +} From 73396182f9c8c772c5b2f1f6803204877dcd73f6 Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 12 Dec 2025 23:48:30 +0800 Subject: [PATCH 12/12] Add webpack and loader dependencies --- package.json | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index e40dbea..057133e 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,7 @@ "main": "main.js", "scripts": { "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service serve", - "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service build", - "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch", - "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build" + "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service build" }, "dependencies": { "@dcloudio/uni-app": "^2.0.2-3081220230817001", @@ -15,7 +13,18 @@ "@dcloudio/uni-h5": "^2.0.2-3081220230817001", "@dcloudio/uni-i18n": "^2.0.2-3081220230817001", "@dcloudio/uni-migration": "^2.0.2-3081220230817001", - "vue": "^2.6.14" + "autoprefixer": "^9.8.8", + "cache-loader": "^4.1.0", + "copy-webpack-plugin": "^6.4.1", + "css-loader": "^3.6.0", + "file-loader": "^6.2.0", + "html-webpack-plugin": "^4.5.2", + "postcss-loader": "^3.0.0", + "thread-loader": "^2.1.3", + "url-loader": "^4.1.1", + "vue": "^2.6.14", + "vue-loader": "^15.11.1", + "webpack": "^4.47.0" }, "devDependencies": { "@dcloudio/uni-cli-shared": "^2.0.2-3081220230817001", @@ -27,10 +36,9 @@ "@dcloudio/webpack-uni-pages-loader": "^2.0.2-3081220230817001", "@vue/cli-plugin-babel": "~4.5.19", "@vue/cli-service": "~4.5.19", - "babel-plugin-import": "^1.13.3", + "babel-plugin-import": "^1.13.5", "cross-env": "^7.0.3", "mini-types": "*", - "miniprogram-api-typings": "*", "postcss-comment": "^2.0.0", "sass": "^1.49.0", "sass-loader": "^10.1.1",