Skip to content

Commit

Permalink
Develop (#16)
Browse files Browse the repository at this point in the history
* ci(deps): fix README / fix mock MenuIcon / fix axios status 401

* feat(components): http / sessionTimeout Page

* 1.0.0
  • Loading branch information
zane0904 authored Sep 19, 2022
1 parent 56f8c14 commit 41d07a3
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 45 deletions.
15 changes: 0 additions & 15 deletions CHANGELOG.md

This file was deleted.

23 changes: 23 additions & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## v 1.0.0 (2022-9.19)

### 升级说明

- v1.0.0 版本发布正式版

<!--
## 1.0.0(2022-9.19)
### 升级说明
- v1.0.0 版本
### ✨ Features
- **其它**
- xxx
### 🐛 Bug Fixes
- **xx**
- xxx
-->
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div align="center"> <a href="https://github.com/zane0904/v-naive-admin"> <img alt="VNaive" style="height:240px;" src="./src/assets/svg/logo.svg"> </a> <br> <br>

[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE)

<p align="center">
<a href="https://github.com/vuejs/core">
<img src="https://img.shields.io/badge/Vue3.2.31-brightgreen.svg">
Expand Down Expand Up @@ -125,11 +123,17 @@ Open the project in Gitpod (a free online development environment for GitHub) an
git clone https://github.com/zane0904/v-naive-admin.git
```

- Installation Dependencies
- Initialize git commitizen

```bash
cd v-naive-admin
cd ./v-naive-admin

pnpm install -g commitizen
```

- Installation Dependencies

```bash
pnpm install

```
Expand Down Expand Up @@ -170,6 +174,7 @@ You are very welcome to join [Mention one Issue](https://github.com/zane0904/v-n

- reference resources [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) standard ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular))

- Using git cz instead of git commit, the project has built-in husky, which will check the code specification when submitting the code
- `feat` Add new functions
- `fix` Fix the problem / BUG
- `refactor` restructure
Expand Down
14 changes: 9 additions & 5 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div align="center"> <a href="https://github.com/zane0904/v-naive-admin"> <img alt="VNaive" style="height:240px;" src="./src/assets/svg/logo.svg"> </a> <br> <br>

[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE)

<p align="center">
<a href="https://github.com/vuejs/core">
<img src="https://img.shields.io/badge/Vue3.2.31-brightgreen.svg">
Expand Down Expand Up @@ -125,13 +123,18 @@ V-Naive-Admin 是一个免费开源的中后台模版,使用了最新的`vue3 vi
git clone https://github.com/zane0904/v-naive-admin.git
```

- 安装依赖
- 初始化 git commitizen

```bash
cd v-naive-admin
cd ./v-naive-admin

pnpm install
pnpm install -g commitizen
```

- 安装依赖

```bash
pnpm run bootstrap
```

- 运行
Expand Down Expand Up @@ -170,6 +173,7 @@ pnpm build

- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular))

- 使用 Git cz 代替 git commit 项目内置了 husky 在提交代码时会进行代码规范检查
- `feat` 增加新功能
- `fix` 修复问题/BUG
- `refactor` 重构
Expand Down
8 changes: 4 additions & 4 deletions mock/config/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export enum MenuIcon {
function = 'chuangjian1',
functionHttp = 'http',
functionSessionTimeout = 'tuichudenglu',
functionCopy = 'full',
functionCopy = 'copy-full',
functionMsg = 'tixing',
functionFullScreen = 'quanping_o',
iframe = 'waibulianjie',
Expand All @@ -23,8 +23,8 @@ export enum MenuIcon {
systemDept = 'bumenguanli1',
systemChangePassword = '',
errPage = 'cuowuyemian',
errPage403 = 'test1',
errPage404 = 'test2',
errPage500 = 'test3',
errPage403 = 'icon-test1',
errPage404 = 'icon-test2',
errPage500 = 'icon-test3',
about = 'wode-woshituanchang',
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v-naive-admin",
"version": "0.1.0",
"version": "1.0.0",
"author": {
"name": "naive-admin",
"email": "zane0904@88.com",
Expand Down
4 changes: 3 additions & 1 deletion src/api/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { http } from '@/http'
import { baseUrl } from '.'
import { Api } from './Api'
export const get401 = () => http.get(`${baseUrl}/${Api.permissions401}`)
export const get401 = () => http.get(`${baseUrl}${Api.permissions401}`)
export const getErr = (status: 200 | 206 | 402 | 403 | 404 | 500 | 501 | 503) =>
http.get(`${baseUrl}/err/${status}`)
12 changes: 6 additions & 6 deletions src/http/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ export class VAxios {
content: '登录过期,即将重新登陆',
type: 'error',
})
const routerS = routeStore()
routerS.reset()
const go = useGo()
go('/login')
const router = routeStore()
await router.reset(() => {
const go = useGo()
go('/login')
})
return Promise.reject(error)
}
if (axios.isCancel(error)) {
} else if (axios.isCancel(error)) {
const err: ErrorInfo = {
status: 4004,
statusText: error.message || 'error',
Expand Down
5 changes: 3 additions & 2 deletions src/pinia/modules/routeStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ export const routeStore = defineStore({
role: ['admin', 'int'],
}),
actions: {
reset() {
reset(callBack: () => void = () => {}) {
return new Promise((resolve) => {
const user = useProfileStore()
removeRoute()
setTimeout(() => {
user.$reset()
this.$reset()
resolve(true)
callBack()
this.$reset()
}, 100)
})
},
Expand Down
25 changes: 21 additions & 4 deletions src/views/function/http/index.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<template>
<Content> <NButton @click="errClick401">get 401 </NButton></Content>
<Content>
<NButton
type="primary"
v-for="item of list"
:key="item.name"
@click="item.fn()"
class="mr-10px"
>{{ item.name }}</NButton
>
</Content>
</template>
<script lang="ts" setup>
import { get401 } from '@/api/test'
const errClick401 = () => get401()
import { getErr } from '@/api/test'
const list = [
{ name: '200', fn: () => getErr(200) },
{ name: '206', fn: () => getErr(206) },
{ name: '402', fn: () => getErr(402) },
{ name: '403', fn: () => getErr(403) },
{ name: '404', fn: () => getErr(404) },
{ name: '500', fn: () => getErr(500) },
{ name: '501', fn: () => getErr(501) },
{ name: '503', fn: () => getErr(503) },
]
</script>
<style scoped></style>
15 changes: 12 additions & 3 deletions src/views/function/sessionTimeout/index.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<template><Content> 登录过期 </Content></template>
<script lang="ts" setup></script>
<style scoped></style>
<template>
<Content>
<NButton @click="errClick401" type="primary"
>http status 401 退出登录</NButton
>
</Content>
</template>
<script lang="ts" setup>
import { get401 } from '@/api/test'
const errClick401 = () => get401()
</script>

0 comments on commit 41d07a3

Please sign in to comment.