Skip to content

Commit

Permalink
Merge pull request #24 from biaov/release/v1.3.0
Browse files Browse the repository at this point in the history
Release/v1.3.0
  • Loading branch information
biaov authored Jan 31, 2024
2 parents a0ed62b + 5808218 commit 7531cb9
Show file tree
Hide file tree
Showing 85 changed files with 2,986 additions and 1,418 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
一个简单的生态系统,包含 APP,H5,微信小程序,控制台,服务端 😄

<h2 align="center">
<a href="https://github.com/biaov/ecosystem"><img src="https://img.shields.io/badge/version-v1.2.1-blue" /></a>
<a href="https://github.com/biaov/ecosystem/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" /></a>
<a href="https://github.com/biaov/ecosystem"><img src="https://img.shields.io/badge/version-v1.3.0-blue" alt="version" /></a>
<a href="https://github.com/biaov/ecosystem/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="LICENSE" /></a>
</h2>

## 技术栈
Expand Down Expand Up @@ -42,7 +42,7 @@ git clone https://github.com/biaov/ecosystem.git --depth=1
- 浏览器浏览请开启:`Toogle device toolbar`
- 手机浏览请扫描下方二维码

<img src="https://ecosystem.biaov.cn/uploads/h5-qrcode.png" width="200px" height="200px" />
<img src="https://ecosystem.biaov.cn/uploads/h5-qrcode.png" width="200px" height="200px" alt="qrcode" />

## 贡献者们

Expand Down
2 changes: 2 additions & 0 deletions admin/.env.development
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
VITE_API_BASE_URL=/api
VITE_PROXY_BASE_URL=http://127.0.0.1:3600
VITE_API_SITE_URL=http://192.168.10.75:8888/
1 change: 1 addition & 0 deletions admin/.env.production
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_API_BASE_URL=/api
VITE_API_SITE_URL=https://ecosystem.biaov.cn/
3 changes: 2 additions & 1 deletion admin/.eslintrc.js → admin/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const config = {
'@typescript-eslint/no-explicit-any': 'off', // display-name 属性
'@typescript-eslint/no-unused-vars': developmentOff,
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': developmentOff
'@typescript-eslint/no-empty-function': developmentOff,
'@typescript-eslint/no-namespace': 'off'
// 'prettier/prettier': 'error',
// 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
// 'react/jsx-props-no-spreading': 'off',
Expand Down
2 changes: 1 addition & 1 deletion admin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/node_modules
/dist
/.git
/.git
1,607 changes: 714 additions & 893 deletions admin/package-lock.json

Large diffs are not rendered by default.

37 changes: 19 additions & 18 deletions admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"url": "https://biaov.cn/"
},
"description": "生态系统的控制台",
"type": "module",
"scripts": {
"start": "npm run dev",
"dev": "vite",
Expand All @@ -17,7 +18,7 @@
"ncu": "ncu --configFileName .ncurc.json && npm i"
},
"engines": {
"node": ">=16"
"node": ">=20"
},
"keywords": [
"控制台",
Expand All @@ -43,34 +44,34 @@
"dependencies": {
"@ant-design/icons": "^5.2.6",
"@antv/g2": "^4.2.10",
"@reduxjs/toolkit": "^1.9.7",
"antd": "^5.11.1",
"axios": "^1.6.2",
"@reduxjs/toolkit": "^2.0.1",
"antd": "^5.12.8",
"axios": "^1.6.5",
"dayjs": "^1.11.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-quill": "^2.0.0",
"react-redux": "^8.1.3",
"react-router-dom": "^6.18.0"
"react-redux": "^9.0.4",
"react-router-dom": "^6.21.1"
},
"devDependencies": {
"@types/node": "^20.9.0",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"@vitejs/plugin-react": "^4.1.1",
"eslint": "^8.53.0",
"@types/node": "^20.11.0",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"less": "^4.2.0",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"typescript": "5.0.4",
"vite": "^4.5.0",
"vite": "^5.0.11",
"vite-plugin-eslint": "^1.8.1"
}
}
11 changes: 11 additions & 0 deletions admin/src/api/activity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { restful } from './factory'

/**
* 活动列表
*/
export const activityDrawPrizeApi = restful('/activity/draw-prize')

/**
* 活动记录列表
*/
export const activityDrawPrizeRecordApi = restful('/activity/draw-prize-record')
3 changes: 1 addition & 2 deletions admin/src/api/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ export const restful = (path: string) => ({
get: <T>(id: number): Promise<T> => service.get(`${path}/${id}`),
create: (data = {}) => service.post(path, data),
delete: (id: number) => service.delete(`${path}/${id}`),
update: (id: number, data = {}) => service.patch(`${path}/${id}`, data),
replace: (id: number, data = {}) => service.put(`${path}/${id}`, data)
update: (id: number, data = {}) => service.put(`${path}/${id}`, data)
})

export const command = (path: string) => ({
Expand Down
34 changes: 34 additions & 0 deletions admin/src/components/modal-qrcode/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { useEffect, useState } from 'react'
import { Modal, QRCode, Row } from 'antd'
import { Props, FormState } from './types'

/**
* 二维码模态框组件
*/
export default function modalQrcodeComponent(props: Props) {
const { visible, text, onChange } = props

const [formState, setFormState] = useState<FormState>({
visible: false
})

useEffect(() => {
setFormState({ visible })
}, [visible])

const onCancel = () => {
onChange && onChange(false)
}

return (
<>
<Modal {...{ onCancel, footer: null, open: formState.visible, title: '投放二维码' }}>
<div className="p-tb-40">
<Row justify="center">
<QRCode type="svg" value={text || '-'} color="#409eff" />
</Row>
</div>
</Modal>
</>
)
}
15 changes: 15 additions & 0 deletions admin/src/components/modal-qrcode/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* 表单
*/
export interface FormState {
visible: boolean
}

/**
* 参数
*/
export interface Props {
visible: boolean
text: string
onChange(value: boolean): void
}
6 changes: 2 additions & 4 deletions admin/src/components/rich-text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import type { Props } from './types'
export default function richTextComponent(props: Partial<Props> = {}) {
const { value = '', onChange } = props
const [richTextValue, setRichTextValue] = useState('')

useEffect(() => {
setRichTextValue(value)
}, [])
}, [value])

const modules = {
toolbar: [
Expand Down Expand Up @@ -37,6 +36,5 @@ export default function richTextComponent(props: Partial<Props> = {}) {
setRichTextValue(val)
onChange && onChange(val)
}

return <ReactQuill placeholder="请输入内容" theme="snow" {...{ richTextValue, modules }} style={{ height: '300px', marginBottom: '43px' }} onChange={onChangeRichText} />
return <ReactQuill placeholder="请输入内容" theme="snow" value={richTextValue} modules={modules} style={{ height: '300px', marginBottom: '43px' }} onChange={onChangeRichText} />
}
41 changes: 39 additions & 2 deletions admin/src/config/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DashboardOutlined, SettingOutlined, AppstoreOutlined, HeatMapOutlined } from '@ant-design/icons'
import { DashboardOutlined, SettingOutlined, AppstoreOutlined, HeatMapOutlined, GiftOutlined } from '@ant-design/icons'
import { randomColors } from '@/utils/function'

const colors = randomColors(4)
const colors = randomColors(5)

export const items = () => [
{
Expand Down Expand Up @@ -238,6 +238,43 @@ export const items = () => [
]
}
]
},
{
label: '活动',
icon: <GiftOutlined style={{ color: colors[4] }} />,
key: '/activity',
children: [
{
label: '抽奖活动',
key: '/activity/draw-prize',
permissions: [
{
label: '查看活动',
value: '/activity/draw-prize/list'
},
{
label: '新增活动',
value: '/activity/draw-prize/add'
},
{
label: '编辑活动',
value: '/activity/draw-prize/edit'
},
{
label: '删除活动',
value: '/activity/draw-prize/delete'
},
{
label: '生成二维码',
value: '/activity/draw-prize/qrcode'
},
{
label: '活动数据',
value: '/activity/draw-prize/data'
}
]
}
]
}
]

Expand Down
33 changes: 33 additions & 0 deletions admin/src/enums/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ActivityStatus } from './types'

/**
* 性别列表
*/
Expand Down Expand Up @@ -68,3 +70,34 @@ export const showStatus = {
return this.options().find(item => item.value === value)
}
}

/**
* 活动状态
*/
export const activityStatus = {
/**
* 未开始
*/
noStart: 'noStart',

/**
* 进行中
*/
normal: 'normal',

/**
* 已结束
*/
ended: 'ended',

options(): ActivityStatus.Option[] {
return [
{ label: '未开始', value: this.noStart, status: 'processing' },
{ label: '进行中', value: this.normal, status: 'success' },
{ label: '已结束', value: this.ended, status: 'default' }
]
},
filter(value: string) {
return this.options().find(item => item.value === value)!
}
}
12 changes: 12 additions & 0 deletions admin/src/enums/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* 活动状态
*/
export namespace ActivityStatus {
export interface Option {
label: string
value: string
status?: 'success' | 'processing' | 'error' | 'default' | 'warning'
}

export type Status = 'noStart' | 'normal' | 'ended'
}
12 changes: 12 additions & 0 deletions admin/src/router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import Recommend from '@/views/manage/recommend'
import RecommendDetail from '@/views/manage/recommend/detail'
import Feature from '@/views/manage/feature'
import CaseMore from '@/views/case/more'
import DrawPrize from '@/views/activity/draw-prize'
import DrawPrizeDetail from '@/views/activity/draw-prize/detail'
import DrawPrizeData from '@/views/activity/draw-prize/data'
import { CheckLogin, CheckPermission } from './guard'

/**
Expand Down Expand Up @@ -65,6 +68,15 @@ const router = () => (
<Route path="" element={<Navigate to="more" replace />}></Route>
<Route path="more" element={<CaseMore />}></Route>
</Route>
<Route path="activity">
<Route path="" element={<Navigate to="draw-prize" replace />}></Route>
<Route path="draw-prize">
<Route path="" element={<DrawPrize />}></Route>
<Route path="add" element={<DrawPrizeDetail />}></Route>
<Route path="edit/:id" element={<DrawPrizeDetail />}></Route>
<Route path="data/:id" element={<DrawPrizeData />}></Route>
</Route>
</Route>
</Route>
<Route path="403" element={<Forbidden />} />
</Route>
Expand Down
18 changes: 18 additions & 0 deletions admin/src/styles/custom-class.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
60: 60px;
120: 120px;
140: 140px;
200: 200px;
};
each(@widths, {
.w-@{key} {
Expand Down Expand Up @@ -52,11 +53,20 @@ each(@heights, {
0: 0px;
15: 15px;
20: 20px;
40: 40px;
};
each(@gaps,{
.p-@{key}{
padding: @value !important;
}
.p-tb-@{key}{
padding-top: @value !important;
padding-bottom: @value !important;
}
.p-lr-@{key}{
padding-left: @value !important;
padding-right: @value !important;
}
.p-t-@{key}{
padding-top: @value !important;
}
Expand All @@ -69,6 +79,14 @@ each(@gaps,{
.p-l-@{key}{
padding-left: @value !important;
}
.m-tb-@{key}{
margin-top: @value !important;
margin-bottom: @value !important;
}
.m-lr-@{key}{
margin-left: @value !important;
margin-right: @value !important;
}
.m-@{key}{
margin: @value !important;
}
Expand Down
Loading

0 comments on commit 7531cb9

Please sign in to comment.