ci(custom): add docker

This commit is contained in:
2023-11-20 20:35:36 +08:00
parent 6ce72fdfd6
commit 8d164fe9a8
22 changed files with 136 additions and 415 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
node_modules

6
.env
View File

@@ -1,5 +1,3 @@
VITE_TITLE = '捷兑通 - 平台端'
VITE_TITLE='捷兑通 - 平台端'
VITE_PORT = 4000
VITE_GAME_API = 'https://www.jdt168.com'
VITE_PORT=4000

View File

@@ -1,17 +1,19 @@
# 资源公共路径,需要以 /开头和结尾
VITE_PUBLIC_PATH = '/'
VITE_PUBLIC_PATH='/'
# 是否启用MOCK
VITE_USE_MOCK = false
VITE_USE_MOCK=false
# 是否启用代理
VITE_USE_PROXY = true
VITE_USE_PROXY=true
# base api
VITE_BASE_API = 'https://test.wanzhuanyongcheng.cn/admin'
VITE_BASE_API='https://test.wanzhuanyongcheng.cn/admin'
VITE_WS1_URL='game.wanzhuanyongcheng.cn/dice/home'
VITE_WS1_URL = 'game.wanzhuanyongcheng.cn/dice/home'
VITE_WS_URL = 'test.wanzhuanyongcheng.cn/admin/data'
VITE_WS_URL='test.wanzhuanyongcheng.cn/admin/data'
VITE_MER_LOGIN_URL = '//localhost:3100/#/login'
VITE_MER_LOGIN_URL='//localhost:3100/#/login'
VITE_GAME_API='https://www.jdt168.com'

View File

@@ -1,13 +0,0 @@
# 自定义域名CNAME
# VITE_CNAME = 'template.qszone.com'
# 资源公共路径,需要以 /开头和结尾
VITE_PUBLIC_PATH = '/vue-naive-admin/'
VITE_USE_HASH = true
# 是否启用MOCK
VITE_USE_MOCK = true
# base api
VITE_BASE_API = '/api'

View File

@@ -1,23 +1,21 @@
# 资源公共路径,需要以 /开头和结尾
VITE_PUBLIC_PATH = '/static/admin'
VITE_PUBLIC_PATH='/'
# 是否启用MOCK
VITE_USE_MOCK = false
VITE_USE_MOCK=false
# base api
VITE_BASE_API = 'https://www.wanzhuanyongcheng.cn/admin'
# VITE_GAME_API = 'http://www.wanzhuanyongcheng.cn/admin'
VITE_BASE_API='https://www.wanzhuanyongcheng.cn/admin'
# 是否启用压缩
VITE_USE_COMPRESS = true
VITE_USE_COMPRESS=true
# 压缩类型
VITE_COMPRESS_TYPE = gzip
VITE_COMPRESS_TYPE=gzip
VITE_WS1_URL = 'www.jdt168.com/dice/home'
VITE_WS1_URL='www.jdt168.com/dice/home'
VITE_WS_URL = 'www.wanzhuanyongcheng.cn/admin/data'
VITE_WS_URL='www.wanzhuanyongcheng.cn/admin/data'
VITE_MER_LOGIN_URL = '//www.wanzhuanyongcheng.cn/static/mer/#/login'
VITE_MER_LOGIN_URL='//www.wanzhuanyongcheng.cn/static/mer/#/login'

View File

@@ -1,5 +0,0 @@
# DO NOT commit this file to your repository!
# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.
# It's used for authentication when uploading source maps.
# You can also set this env variable in your own `.env` files and remove this file.
SENTRY_AUTH_TOKEN="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"

View File

@@ -1,18 +1,20 @@
# 资源公共路径,需要以 /开头和结尾
VITE_PUBLIC_PATH = '/static/admin'
VITE_PUBLIC_PATH='/'
# 是否启用MOCK
VITE_USE_MOCK = false
VITE_USE_MOCK=false
# 是否启用代理
VITE_USE_PROXY = false
VITE_USE_PROXY=false
# base api
VITE_BASE_API = '/admin'
VITE_BASE_API='/admin'
VITE_WS1_URL = 'game.wanzhuanyongcheng.cn/dice/home'
VITE_WS_URL = 'test.wanzhuanyongcheng.cn/admin/data'
VITE_GAME_API = 'https://game.wanzhuanyongcheng.cn'
VITE_WS1_URL='game.wanzhuanyongcheng.cn/dice/home'
VITE_MER_LOGIN_URL = '//test.wanzhuanyongcheng.cn/static/mer/#/login'
VITE_WS_URL='test.wanzhuanyongcheng.cn/admin/data'
VITE_GAME_API='https://game.wanzhuanyongcheng.cn'
VITE_MER_LOGIN_URL='//test.wanzhuanyongcheng.cn/static/mer/#/login'

6
.idea/jsLibraryMappings.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<includedPredefinedLibrary name="Node.js Core" />
</component>
</project>

5
Dockerfile Normal file
View File

@@ -0,0 +1,5 @@
FROM nginx:latest AS builder
COPY dist/ /usr/share/nginx/html
COPY default.conf /etc/nginx/conf.d/default.conf

21
LICENSE
View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2022 Ronnie Zhang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,203 +0,0 @@
<p align="center">
<a href="https://github.com/zclzone/vue-naive-admin">
<img alt="Vue Naive Admin Logo" width="200" src="./src/assets/images/logo.png">
</a>
</p>
<p align="center">
<a href="https://github.com/zclzone/vue-naive-admin"><img alt="stars" src="https://badgen.net/github/stars/zclzone/vue-naive-admin"/></a>
<a href="https://github.com/zclzone/vue-naive-admin"><img alt="forks" src="https://badgen.net/github/forks/zclzone/vue-naive-admin"/></a>
<a href="./LICENSE"><img allt="MIT License" src="https://badgen.net/github/license/zclzone/vue-naive-admin"/></a>
</p>
<p align='center'>
<b>英文</b> |
<a href="https://github.com/zclzone/vue-naive-admin/blob/main/README.md">中文</a>
</p>
### Introduction
[Vue Naive Admin](https://github.com/zclzone/vue-naive-admin) is a **completely open source free and commercially allowed ** admin templateBased on the latest technology stack of front-end such as `Vue3、Vite3、Pinia、Unocss and Naive UI`. Compared with other more popular backend management templates, this project is more concise, lightweight, fresh style, very low learning costs, ideal for small and medium-sized projects or personal projects.
### Features
- 🍒 Integrated [Naive UI](https://www.naiveui.com)recommended by Evan You.
- 🍑 Integrated login, logout and permission verification.
- 🍐 Integrated multi-environment configuration, dev, test, production and github pages environments.
- 🍎 Integrated `eslint + prettier`.
- 🍌 Integrated `husky + commitlint`.
- 🍉 Integrated `Mock`.
- 🍍 Integrated `pinia`lightweight, simple and easy to use alternative to vuex.
- 📦 Integrated `unplugin` auto import.
- 🤹 Integrated `iconify` iconsupport custom svg icons.
- 🍇 Integrated `unocss`.
### Preview
[https://template.qszone.com](https://template.qszone.com)
[https://base.isme.top](https://base.isme.top)
### Docs
[Vue Naive Admin Docs](https://zclzone.github.io/vue-naive-admin-docs)
### Getting Started
```shell
# Recommended setup git autocrlf 为 false
git config --global core.autocrlf false
# Clone Project
git clone https://github.com/zclzone/vue-naive-admin.git
cd vue-naive-admin
# Install dependencies(Recommended use pnpm: https://pnpm.io/zh/installation)
npm i -g pnpm # Installed and can be ignored
pnpm i # or npm i
# Start
pnpm dev
```
### Build and Release
```shell
# Test Environment
pnpm build:test
# Github Environment
pnpm build:github
# Prod Environment
pnpm build
```
### Other
```shell
# eslint check
pnpm lint
# eslint check and fix
pnpm lint:fix
# PreviewNeed to build first
pnpm preview
# Commithusky+commitlint
pnpm cz
```
### Directory description
```
Vue Naive Admin
|-- .github // github相关如推送github仓库后自动部署gh pages
|-- .husky // git commit钩子
|-- .vscode // vscode编辑器相关
| |-- extensions.json // 插件推荐
| |-- settings.json // 项目级别的vscode配置优先级大于全局vscode配置
|-- build // 构建相关配置
| |-- constant.js // 构建相关的常量
| |-- utils.js // 构建相关的工具方法
| |-- config
| | |-- define.js // 注入全局常量启动或打包后将添加到window中
| | |-- proxy.js // 代理配置
| |-- plugin
| | |-- html.js // vite-plugin-html插件用于注入变量或者html标签
| | |-- mock.js // vite-plugin-mock插件处理mock
| | |-- unplugin.js // unplugin相关插件包含DefineOptions和自动导入
| |-- script // 打包完成后执行的一些node脚本不重要
| |-- build-cname.js // 自动生成cname
|-- mock // mock
| |-- utils.js // mock请求需要用到的工具方法
| |-- api // mock接口
|-- public // 公共资源文件夹下的文件会在打包后会直接加到dist根目录下
|-- settings // 项目配置
| |-- proxy-config.js // 代理配置文件
| |-- theme.json // 主题配置项,主题色等
|-- src
| |-- api // 公共api
| |-- assets // 静态资源
| | |-- images // 图片
| | |-- svg // svg图标
| |-- components // 全局组件
| | |-- common // 公共组件
| | |-- icon // icon相关组件
| | |-- page // 页面组件
| | |-- query-bar // 查询选项
| | |-- table // 封装的表格组件
| |-- composables // 封装的组合式函数
| |-- layout // 布局相关组件
| | |-- components
| | |-- AppMain.vue // 主体内容
| | |-- header // 头部
| | |-- sidebar // 侧边菜单栏
| | |-- tags // 多页签栏
| |-- router // 路由
| | |-- guard // 路由守卫
| | |-- routes // 路由列表
| |-- store // 状态管理pinia
| | |-- modules // 模块
| | |-- app // 管理页面重新加载、折叠菜单栏和keepAlive等
| | |-- permission // 权限相关,管理权限菜单
| | |-- tags // 管理多页签
| | |-- user // 用户模块,管理用户信息、登录登出
| |-- styles // 样式
| |-- utils // 封装的工具方法
| | |-- auth // 权限相关如token、跳转登录页等
| | |-- common // 通用
| | |-- http // 封装axios
| | |-- storage // 封装localStorage和sessionStorage
| |-- views // 页面
| | |-- demo // 示例
| | |-- error-page // 错误页
| | |-- login // 登录页
| | |-- workbench // 首页
| |-- App.vue
| |-- main.js
|-- .cz-config.js // git提交配置
|-- .editorconfig // 编辑器配置
|-- .env // 环境文件,所有环境都会载入
|-- .env.development // 开发环境文件
|-- .env.production // 生产环境文件
|-- .env.test // 测试环境文件
|-- .eslintignore // eslint忽略
|-- .eslintrc.js // eslint配置
|-- .gitignore // git忽略
|-- .prettierignore // prettier格式化忽略
|-- commitlint.config.js // commitlint规范配置
|-- index.html
|-- jsconfig.json // js配置
|-- LICENSE // 协议
|-- package.json // 依赖描述文件
|-- pnpm-lock.yaml // 依赖锁定文件
|-- prettier.config.js // prettier格式化配置
|-- README.md // 项目描述文档(英文)
|-- README.zh-CN.md // 项目描述文档(中文)
|-- unocss.config.js // unocss配置
|-- vite.config.js // vite配置
```
### TS version: Qs Admin
#### source code
- github: [https://github.com/zclzone/qs-admin](https://github.com/zclzone/qs-admin)
- gitee: [https://gitee.com/zclzone/qs-admin-ts](https://gitee.com/zclzone/qs-admin-ts)
#### preview
- [https://admin.qszone.com](https://admin.qszone.com)
- [https://zclzone.github.io/qs-admin](https://zclzone.github.io/qs-admin)
### Open source projects that use this project:
- [gin-vue-blog](https://github.com/szluyu99/gin-vue-blog): A full-stack blog project in Golang, the frontend of the blog backend is based on vue-naive-admin and integrates with a real backend service, implementing features such as backend-controlled routing.
### Communication group & About the author
<a href="https://blog.qszone.com/about/">
<img src="https://assets.qszone.com/images/about.png" style="max-width: 400px" />
</a>

View File

@@ -14,6 +14,7 @@ import viteCompression from 'vite-plugin-compression'
import { configHtmlPlugin } from './html'
import { configMockPlugin } from './mock'
import unplugin from './unplugin'
import { sentryVitePlugin } from '@sentry/vite-plugin'
export function createVitePlugins(viteEnv, isBuild) {
const plugins = [vue(), ...unplugin, configHtmlPlugin(viteEnv, isBuild), Unocss()]
@@ -32,6 +33,13 @@ export function createVitePlugins(viteEnv, isBuild) {
open: false,
gzipSize: true,
brotliSize: true,
}),
sentryVitePlugin({
authToken:
'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',
org: 'sentry',
project: 'jdt-admin',
url: 'https://w.huakk.top',
})
)
}

View File

@@ -4,7 +4,6 @@ import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
import IconsResolver from 'unplugin-icons/resolver'
// import { sentryVitePlugin } from '@sentry/vite-plugin'
/**
* * unplugin-icons插件自动引入iconify图标
@@ -44,10 +43,4 @@ export default [
inject: 'body-last',
customDomId: '__CUSTOM_SVG_ICON__',
}),
// sentryVitePlugin({
// authToken: process.env.SENTRY_AUTH_TOKEN,
// org: 'sentry',
// project: 'jdt-admin',
// url: 'https://w.huakk.top',
// }),
]

18
default.conf Normal file
View File

@@ -0,0 +1,18 @@
server {
# 监听ipv4
listen 80;
# 监听ipv6
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View File

@@ -1,3 +0,0 @@
推荐阅读作者在掘金的文章:
[保熟的 UnoCSS 使用指北,优雅使用 antfu 大佬的原子化 CSS](https://juejin.cn/post/7142466784971456548)

View File

@@ -1,40 +0,0 @@
## 使用 iconify 图标
首先去图标库地址:[icones](https://icones.js.org/) 找合适的图标
### 1. 结合 unocss 使用
```html
<i i-carbon-sun />
<i class="i-carbon-sun" />
```
### 2. 结合插件 unplugin-icons 自定义标签使用
`<icon-[iconify图标名称]`
```html
<icon-ant-design:fullscreen-exit-outlined />
<icon-ant-design:fullscreen-outlined />
```
这种方式还支持自定义 svg 图标,本项目自定义 svg 图标固定放在 src/assets/svg 下
`<icon-custom-[svg图标文件名]`
```
<icon-custom-logo />
```
具体配置参看 build/plugin/unplugin.js
### 3. 结合 Naive UI 的 NIcon 组件封装使用
```html
<!-- iconify图标 -->
<TheIcon icon="material-symbols:delete-outline" />
<!-- 自定义svg图标 -->
<TheIcon icon="logo" type="custom" />
```
封装组件参看 src/components/icon

View File

@@ -1,34 +0,0 @@
## 安装 pnpm
### 使用 Corepack 安装(推荐)
从 v16.13 开始Node.js 发布了 Corepack 来管理包管理器。 这是一项实验性功能,需要通过运行如下脚本来启用它:
```
npx corepack enable // 可能需要管理员权限
```
这将自动在您的系统上安装 pnpm。 但是,它可能不是最新版本的 pnpm。 若要升级,请检查[最新的 pnpm 版本](https://github.com/pnpm/pnpm/releases/latest) 并运行,如 7.14.0
```
corepack prepare pnpm@7.14.0 --activate
```
如果是 Node.js v16.17 或者更新的版本,可以直接安装最新版本的 pnpm
```
corepack prepare pnpm@latest --activate
```
### 使用 npm 安装
```
npm i -g pnpm
```
更新,卸了重新装
```
npm uninstall -g pnpm
npm i -g pnpm
```

View File

@@ -3,7 +3,6 @@
"version": "1.0.0",
"scripts": {
"build": "vite build",
"build:github": "vite build --mode github && esno ./build/script",
"build:test": "vite build --mode test",
"cz": "cz",
"dev": "vite",

View File

@@ -5,7 +5,7 @@ import { getToken, isNullOrWhitespace } from '@/utils'
import { usePermissionStore } from '@/store'
import * as Sentry from '@sentry/vue'
const isHash = true
const isHash = false
export const router = createRouter({
history: isHash ? createWebHashHistory('/') : createWebHistory('/'),
routes: basicRoutes,
@@ -17,20 +17,17 @@ export async function setupRouter(app) {
setupRouterGuard(router)
Sentry.init({
app,
dsn: 'https://589c2c58683b4e8fa87a87609fd95e3b@w.huakk.top/2',
dsn: 'https://adad4faa9b08aa08438ef33cba7962ab@w.huakk.top/6',
integrations: [
new Sentry.BrowserTracing({
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
tracePropagationTargets: ['localhost'],
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
}),
new Sentry.Replay(),
],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
})
app.use(router)
}

View File

@@ -33,6 +33,28 @@
</n-radio-group>
</div>
</n-col>
<n-col :span="24" mt-10>
<div>
<span>支付方式</span>
<n-radio-group v-model:value="queryData.pay_type">
<n-radio-button
v-for="song in [
{
label: '微信',
value: 1,
},
{
label: '积分',
value: 2,
},
]"
:key="song.value"
:value="song.value"
:label="song.label"
/>
</n-radio-group>
</div>
</n-col>
<n-col :span="24">
<div mt-10 flex items-center>
<div w-100>关键字搜索:</div>
@@ -88,6 +110,7 @@ const queryData = ref({
time: null,
word: '',
selectKey: null,
pay_type: null,
})
const cardData = ref({
@@ -293,7 +316,8 @@ const getList = async () => {
loading.value = true
try {
const query_data = {
Status: queryData.value.status || '',
Status: queryData.value.status,
PayType: queryData.value.pay_type || '',
StartTime: queryData.value.time === null ? '' : queryData.value.time[0] || '',
EndTime: queryData.value.time === null ? '' : queryData.value.time[1] || '',
}

View File

@@ -238,7 +238,7 @@
<script setup>
import { h } from 'vue'
import api from './api'
import { NDropdown, NButton, NEllipsis } from 'naive-ui'
import { NDropdown, NButton } from 'naive-ui'
import TheIcon from '@/components/icon/TheIcon.vue'
const loading = ref(false)
@@ -532,40 +532,52 @@ const tabsChange = async (e = '1') => {
align: 'center',
key: 'oid',
},
{
title: '商品封面',
align: 'center',
slot: 'cover',
render: (row) => {
return h('img', {
src: row.cover,
style: {
width: '50px',
height: '50px',
},
})
},
},
// {
// title: '商品封面',
// align: 'center',
// slot: 'cover',
// render: (row) => {
// return h('img', {
// src: row.cover,
// style: {
// width: '50px',
// height: '50px',
// },
// })
// },
// },
{
title: '商品名称',
align: 'center',
slot: 'goods_name',
render: (row) => {
return h(
NEllipsis,
{
style: 'max-width: 240px',
},
{
default: () => row.goods_name,
}
)
const el = []
row.OrderGoods.forEach((item) => {
el.push(
h(
'div',
{},
{
default: () =>
`${item.Goods.name}|${item.pay_price}元或${item.pay_integral}积分|X${item.number}`,
}
)
)
})
return el
},
},
{
title: '商品价格',
title: '订单总价',
align: 'center',
key: 'number',
slot: 'number',
render: (row) => h('span', row.pay_type === 1 ? `${row.price}` : `${row.exchange}积分`),
},
{
title: '支付方式',
align: 'center',
slot: 'pay_type',
render: (row) => h('span', row.pay_type === 1 ? '微信' : '积分'),
},
{
title: '订单状态',
@@ -608,11 +620,6 @@ const tabsChange = async (e = '1') => {
align: 'center',
key: 'oid',
},
{
title: '商品名称',
align: 'center',
key: 'goods_name',
},
{
title: '消费金额',
align: 'center',
@@ -631,11 +638,6 @@ const tabsChange = async (e = '1') => {
align: 'center',
key: 'oid',
},
{
title: '商品名称',
align: 'center',
key: 'goods_name',
},
{
title: '积分',
align: 'center',
@@ -659,11 +661,6 @@ const tabsChange = async (e = '1') => {
align: 'center',
key: 'nick_name',
},
{
title: '商品名称',
align: 'center',
key: 'goods_name',
},
{
title: '获得积分',
align: 'center',

View File

@@ -1,8 +0,0 @@
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
]
}