Skip to content

Commit

Permalink
新增文档
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackWhite2000 committed Nov 7, 2023
1 parent 14b48e6 commit bc00739
Show file tree
Hide file tree
Showing 27 changed files with 14,251 additions and 570 deletions.
4 changes: 4 additions & 0 deletions docs/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
node_modules
.output
.nuxt
8 changes: 8 additions & 0 deletions docs/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
root: true,
extends: '@nuxt/eslint-config',
rules: {
'vue/max-attributes-per-line': 'off',
'vue/multi-word-component-names': 'off'
}
}
11 changes: 11 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
*.iml
.idea
*.log*
.nuxt
.DS_Store
coverage
dist
sw.*
.env
.output
1 change: 1 addition & 0 deletions docs/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
24 changes: 24 additions & 0 deletions docs/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"prettier.enable": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.associations": {
"*.css": "postcss"
},
"editor.formatOnSave": false,
"i18n-ally.localesPaths": [
"locales"
],
"cSpell.words": [
"axios",
"composables",
"docus",
"gamecreator",
"nuxi",
"nuxt",
"nuxtjs",
"pinia",
"unocss"
]
}
57 changes: 57 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Docus Starter

Starter template for [Docus](https://docus.dev).

## Clone

Clone the repository (using `nuxi`):

```bash
npx nuxi init -t themes/docus
```

## Setup

Install dependencies:

```bash
yarn install
```

## Development

```bash
yarn dev
```

## Edge Side Rendering

Can be deployed to Vercel Functions, Netlify Functions, AWS, and most Node-compatible environments.

Look at all the available presets [here](https://v3.nuxtjs.org/guide/deploy/presets).

```bash
yarn build
```

## Static Generation

Use the `generate` command to build your application.

The HTML files will be generated in the .output/public directory and ready to be deployed to any static compatible hosting.

```bash
yarn generate
```

## Preview build

You might want to preview the result of your build locally, to do so, run the following command:

```bash
yarn preview
```

---

For a detailed explanation of how things work, check out [Docus](https://docus.dev).
40 changes: 40 additions & 0 deletions docs/apis/axios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import axios from 'axios'
import { serverApiUrl } from '../constants/apis'

const apiUrl = serverApiUrl

async function get(url: string, headers?: object) {
try {
const response = await axios.get(url, {
withCredentials: true, // 启用跨域请求携带凭证
headers,
})
return { code: 200, message: '请求成功', data: response.data }
}
catch (error: any) {
console.error(error.message)
const customError = { code: 500, message: '请求失败', data: null }
throw customError
}
}
async function post(url: string, json: object, headers?: object) {
try {
const response = await axios.post(url, json, {
withCredentials: true, // 启用跨域请求携带凭证
headers,
})

return { code: 200, message: '请求成功', data: response.data }
}
catch (error: any) {
console.error(error.message)
const customError = { code: 500, message: '请求失败', data: null }
throw customError
}
}

export {
apiUrl,
get,
post,
}
15 changes: 15 additions & 0 deletions docs/apis/type.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export interface DataType {
data: {
name: string
versions: number
url: string
feedback: string
updated_at: string
type: {
id: number
name: string
}
}
message: string
code: number
}
23 changes: 23 additions & 0 deletions docs/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { appDescription, appName } from './constants/index'

export default defineAppConfig({
docus: {
title: appName,
description: appDescription,
aside: {
level: 1,
collapsed: false,
exclude: [],
},
main: {
padded: true,
fluid: true,
},
header: {
logo: true,
showLinkIcon: true,
exclude: [],
fluid: true,
},
},
})
22 changes: 22 additions & 0 deletions docs/components/Logo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<svg width="94" height="32" viewBox="0 0 94 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M42.0287 7.70001H45.5327V24.5H42.0287V7.70001ZM47.7407 24.5H44.2367V21.38H47.6207C48.3567 21.38 49.0527 21.284 49.7087 21.092C50.3647 20.884 50.9407 20.564 51.4367 20.132C51.9327 19.7 52.3167 19.156 52.5887 18.5C52.8767 17.828 53.0207 17.028 53.0207 16.1C53.0207 15.172 52.8767 14.38 52.5887 13.724C52.3167 13.052 51.9327 12.5 51.4367 12.068C50.9407 11.636 50.3647 11.324 49.7087 11.132C49.0527 10.924 48.3567 10.82 47.6207 10.82H44.2367V7.70001H47.7407C49.5007 7.70001 51.0367 8.04401 52.3487 8.73201C53.6767 9.42001 54.7087 10.396 55.4447 11.66C56.1807 12.908 56.5487 14.388 56.5487 16.1C56.5487 17.812 56.1807 19.3 55.4447 20.564C54.7087 21.812 53.6767 22.78 52.3487 23.468C51.0367 24.156 49.5007 24.5 47.7407 24.5Z" fill="#19DD96" />
<path d="M58.1764 18.98C58.1764 17.828 58.4404 16.82 58.9684 15.956C59.5124 15.092 60.2404 14.42 61.1524 13.94C62.0804 13.46 63.1284 13.22 64.2964 13.22C65.4644 13.22 66.5044 13.46 67.4164 13.94C68.3444 14.42 69.0724 15.092 69.6004 15.956C70.1444 16.82 70.4164 17.828 70.4164 18.98C70.4164 20.116 70.1444 21.124 69.6004 22.004C69.0724 22.868 68.3444 23.54 67.4164 24.02C66.5044 24.5 65.4644 24.74 64.2964 24.74C63.1284 24.74 62.0804 24.5 61.1524 24.02C60.2404 23.54 59.5124 22.868 58.9684 22.004C58.4404 21.124 58.1764 20.116 58.1764 18.98ZM61.3444 18.98C61.3444 19.604 61.4724 20.156 61.7284 20.636C62.0004 21.1 62.3604 21.468 62.8084 21.74C63.2564 21.996 63.7524 22.124 64.2964 22.124C64.8404 22.124 65.3364 21.996 65.7844 21.74C66.2324 21.468 66.5844 21.1 66.8404 20.636C67.1124 20.156 67.2484 19.604 67.2484 18.98C67.2484 18.356 67.1124 17.804 66.8404 17.324C66.5844 16.844 66.2324 16.476 65.7844 16.22C65.3364 15.964 64.8404 15.836 64.2964 15.836C63.7524 15.836 63.2564 15.964 62.8084 16.22C62.3604 16.476 62.0004 16.844 61.7284 17.324C61.4724 17.804 61.3444 18.356 61.3444 18.98Z" fill="#19DD96" />
<path d="M75.1006 18.98C75.1006 19.62 75.2446 20.18 75.5326 20.66C75.8206 21.14 76.2046 21.516 76.6846 21.788C77.1806 22.06 77.7246 22.196 78.3166 22.196C78.7966 22.196 79.2606 22.124 79.7086 21.98C80.1566 21.82 80.5566 21.612 80.9086 21.356C81.2766 21.084 81.5566 20.772 81.7486 20.42V23.612C81.3646 23.964 80.8606 24.244 80.2366 24.452C79.6286 24.644 78.9166 24.74 78.1006 24.74C76.9326 24.74 75.8766 24.5 74.9326 24.02C74.0046 23.54 73.2686 22.868 72.7246 22.004C72.1966 21.124 71.9326 20.116 71.9326 18.98C71.9326 17.828 72.1966 16.82 72.7246 15.956C73.2686 15.092 74.0046 14.42 74.9326 13.94C75.8766 13.46 76.9326 13.22 78.1006 13.22C78.9166 13.22 79.6286 13.324 80.2366 13.532C80.8606 13.724 81.3646 13.988 81.7486 14.324V17.516C81.5566 17.164 81.2686 16.86 80.8846 16.604C80.5166 16.332 80.1086 16.124 79.6606 15.98C79.2126 15.836 78.7646 15.764 78.3166 15.764C77.7246 15.764 77.1806 15.908 76.6846 16.196C76.2046 16.468 75.8206 16.844 75.5326 17.324C75.2446 17.804 75.1006 18.356 75.1006 18.98Z" fill="#19DD96" />
<path d="M85.0427 20.684C85.5067 21.116 85.9387 21.468 86.3387 21.74C86.7387 21.996 87.1147 22.188 87.4667 22.316C87.8347 22.444 88.1787 22.508 88.4987 22.508C88.9147 22.508 89.2347 22.42 89.4587 22.244C89.6827 22.052 89.7947 21.796 89.7947 21.476C89.7947 21.188 89.6987 20.948 89.5067 20.756C89.3307 20.548 89.0667 20.364 88.7147 20.204C88.3627 20.044 87.9147 19.876 87.3707 19.7C86.8587 19.508 86.3627 19.284 85.8827 19.028C85.4027 18.756 85.0027 18.404 84.6827 17.972C84.3787 17.524 84.2267 16.956 84.2267 16.268C84.2267 15.612 84.4027 15.06 84.7547 14.612C85.1067 14.148 85.5787 13.804 86.1707 13.58C86.7787 13.34 87.4507 13.22 88.1867 13.22C88.8107 13.22 89.3947 13.3 89.9387 13.46C90.4827 13.62 90.9867 13.836 91.4507 14.108C91.9147 14.364 92.3227 14.668 92.6747 15.02L91.3067 16.94C90.9067 16.508 90.4267 16.156 89.8667 15.884C89.3227 15.612 88.7867 15.476 88.2587 15.476C87.9067 15.476 87.6267 15.548 87.4187 15.692C87.2267 15.82 87.1307 16.02 87.1307 16.292C87.1307 16.532 87.2267 16.748 87.4187 16.94C87.6267 17.116 87.9147 17.276 88.2827 17.42C88.6667 17.564 89.0987 17.74 89.5787 17.948C90.1707 18.172 90.7147 18.428 91.2107 18.716C91.7227 18.988 92.1307 19.332 92.4347 19.748C92.7387 20.164 92.8907 20.708 92.8907 21.38C92.8907 22.484 92.5307 23.348 91.8107 23.972C91.0907 24.58 90.0987 24.884 88.8347 24.884C88.0507 24.884 87.3307 24.78 86.6747 24.572C86.0347 24.364 85.4507 24.092 84.9227 23.756C84.4107 23.404 83.9467 23.028 83.5307 22.628L85.0427 20.684Z" fill="#19DD96" />
<path d="M19.56 7.99999V14C19.56 14.7333 18.96 15.3333 18.2267 15.3333H13.7867C13.0533 15.3333 12.4533 14.7333 12.4533 14V7.99999C12.4533 7.26666 13.0533 6.66666 13.7867 6.66666H18.2267C18.96 6.66666 19.56 7.26666 19.56 7.99999ZM9.77333 16.6667H5.33333C4.6 16.6667 4 17.2667 4 18V24C4 24.7333 4.6 25.3333 5.33333 25.3333H9.77333C10.5067 25.3333 11.1067 24.7333 11.1067 24V18C11.1067 17.2667 10.52 16.6667 9.77333 16.6667ZM11.1067 14V7.99999C11.1067 7.26666 10.5067 6.66666 9.77333 6.66666H5.33333C4.6 6.66666 4 7.26666 4 7.99999V14C4 14.7333 4.6 15.3333 5.33333 15.3333H9.77333C10.52 15.3333 11.1067 14.7333 11.1067 14Z" fill="#19DD96" />
<path d="M22.2266 15.3333H26.6666C27.4 15.3333 28 14.7333 28 14V7.99999C28 7.26666 27.4 6.66666 26.6666 6.66666H22.2266C21.4933 6.66666 20.8933 7.26666 20.8933 7.99999V14C20.8933 14.7333 21.48 15.3333 22.2266 15.3333ZM19.56 24V18C19.56 17.2667 18.96 16.6667 18.2266 16.6667H13.7866C13.0533 16.6667 12.4533 17.2667 12.4533 18V24C12.4533 24.7333 13.0533 25.3333 13.7866 25.3333H18.2266C18.96 25.3333 19.56 24.7333 19.56 24ZM20.8933 18V24C20.8933 24.7333 21.4933 25.3333 22.2266 25.3333H26.6666C27.4 25.3333 28 24.7333 28 24V18C28 17.2667 27.4 16.6667 26.6666 16.6667H22.2266C21.48 16.6667 20.8933 17.2667 20.8933 18Z" fill="currentColor" />
</svg>
</template>

<style scoped lang="ts">
css({
svg: {
color: '#18181B',
width: 'auto',
'@dark': {
color: '{color.white}'
}
}
})
</style>
9 changes: 9 additions & 0 deletions docs/components/content/TitleName.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script setup lang="ts">
import { appName } from '../../constants/index'
</script>

<template>
<div>
{{ appName }}
</div>
</template>
55 changes: 55 additions & 0 deletions docs/components/content/Versions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<script setup lang="ts">
import { get, apiUrl } from "../../apis/axios";
import type { DataType } from '../../apis/type'
import { appType, appTypeId } from '../../constants/index'
import { serverApiParam } from '../../constants/apis'
import { useData } from '../../composables/composable'
const data = ref<DataType['data']>()
try {
const response = await get(`${apiUrl}${serverApiParam}${appTypeId}`)
data.value = response.data.data
if (data.value) useData().response = data.value
} catch (error) {
console.error(error)
}
</script>

<template>
<div class="leading-8 lt-lg:text-center">
<div class="mb-15px">
<p class="text-xl font-bold">
{{ appType }}最新版本号
</p>
<p>
{{ data?.versions ? `v${data.versions}` : '获取失败' }}
</p>
</div>
<div class="mb-15px">
<p class="text-xl font-bold">
{{ appType }}最新更新日期
</p>
<p>
{{ data?.updated_at ? `${data.updated_at}` : '获取失败' }}
</p>
</div>
<div class="mb-15px">
<p class="text-xl font-bold">
{{ appType }}下载地址
</p>
<p>
{{ data?.url ? `${data.url}` : '请联系作者' }}
</p>
</div>
<div>
<p class="text-xl font-bold">
{{ appType }}问题建议反馈
</p>
<p>
{{ data?.feedback ? `${data.feedback}` : '请联系作者' }}
</p>
</div>
</div>
</template>
15 changes: 15 additions & 0 deletions docs/composables/composable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineStore } from 'pinia'

export const useData = defineStore('user', () => {
const response = ref({
name: '',
versions: 0,
url: '',
feedback: '',
updated_at: '',
})

return {
response,
}
})
7 changes: 7 additions & 0 deletions docs/constants/apis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const serverApiUrl = 'https://my.api.com'
const serverApiParam = '/api/gamecreator/modules?id='

export {
serverApiUrl,
serverApiParam
}
13 changes: 13 additions & 0 deletions docs/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const app = '名称'
const appType = '类型'
const appTypeId = 0
const appName = `${app}${appType}文档`
const appDescription = `${app}${appType}文档`

export {
app,
appName,
appType,
appTypeId,
appDescription,
}
48 changes: 48 additions & 0 deletions docs/content/0.index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: 首页
navigation: false
layout: page
main:
fluid: false
---

:ellipsis{right=0px width=75% blur=150px}

::block-hero
---
cta:
- 查看文档
- /introduction/getting_started
---

#title
::title-name
::

#description
可在 constants 中修改文档信息

#extra
::list
- 功能说明
::

#support
右侧描述
::

::card-grid
#title
关于...

#root
:ellipsis{left=0px width=40rem top=10rem blur=140px}

#default
::card{icon=vscode-icons:folder-type-interfaces}
#title
标签
#description
标签描述
::
::
9 changes: 9 additions & 0 deletions docs/content/1.introduction/1.getting_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "开始"
main:
fluid: false
---

## 开始

开始描写文档
3 changes: 3 additions & 0 deletions docs/content/1.introduction/_dir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
icon: ph:star-duotone
navigation.redirect: /introduction/getting_started
title: "使用方式"
Loading

0 comments on commit bc00739

Please sign in to comment.