create-jnrs-vue 1.2.21 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jnrs-vue/.env.development +1 -1
- package/jnrs-vue/README.md +1 -1
- package/jnrs-vue/package.json +3 -3
- package/jnrs-vue/src/api/common/index.ts +2 -2
- package/jnrs-vue/src/api/demos/index.ts +73 -32
- package/jnrs-vue/src/api/request.ts +10 -11
- package/jnrs-vue/src/api/system/index.ts +27 -26
- package/jnrs-vue/src/components/common/CardTable.vue +3 -3
- package/jnrs-vue/src/components/common/DictTag.vue +1 -1
- package/jnrs-vue/src/components/common/ImageView.vue +4 -4
- package/jnrs-vue/src/components/common/PdfView.vue +4 -4
- package/jnrs-vue/src/components/select/SelectManager.vue +2 -2
- package/jnrs-vue/src/composables/useCrud.ts +29 -10
- package/jnrs-vue/src/layout/RouterTabs.vue +6 -6
- package/jnrs-vue/src/layout/SideMenuItem.vue +2 -2
- package/jnrs-vue/src/layout/TopHeader.vue +2 -1
- package/jnrs-vue/src/layout/index.vue +2 -1
- package/jnrs-vue/src/locales/en.ts +1 -1
- package/jnrs-vue/src/main.ts +2 -7
- package/jnrs-vue/src/router/index.ts +5 -4
- package/jnrs-vue/src/stores/index.ts +8 -0
- package/jnrs-vue/src/stores/system/auth.ts +67 -0
- package/jnrs-vue/src/types/index.ts +2 -81
- package/jnrs-vue/src/types/system.d.ts +115 -0
- package/jnrs-vue/src/types/system.js +1 -0
- package/jnrs-vue/src/types/system.ts +124 -0
- package/jnrs-vue/src/types/webSocket.ts +4 -4
- package/jnrs-vue/src/utils/dict.ts +59 -0
- package/jnrs-vue/src/utils/file.ts +1 -1
- package/jnrs-vue/src/utils/index.ts +4 -0
- package/jnrs-vue/src/utils/packages.ts +6 -65
- package/jnrs-vue/src/utils/permissions.ts +1 -1
- package/jnrs-vue/src/views/demos/crud/index.vue +29 -17
- package/jnrs-vue/src/views/demos/simpleTable/index.vue +2 -2
- package/jnrs-vue/src/views/demos/unitTest/RequestPage.vue +30 -7
- package/jnrs-vue/src/views/demos/unitTest/index.vue +2 -2
- package/jnrs-vue/src/views/home/index.vue +1 -1
- package/jnrs-vue/src/views/login/index.vue +2 -2
- package/jnrs-vue/src/views/system/dict/index.vue +4 -4
- package/jnrs-vue/src/views/system/mine/baseInfo.vue +2 -2
- package/jnrs-vue/src/views/system/mine/securitySettings.vue +1 -1
- package/jnrs-vue/src/views/visual/index.vue +3 -4
- package/jnrs-vue/vite.config.ts +2 -2
- package/jnrs-vue/viteMockServe/fail.ts +3 -3
- package/jnrs-vue/viteMockServe/file.ts +1 -1
- package/jnrs-vue/viteMockServe/index.ts +7 -16
- package/jnrs-vue/viteMockServe/json/loginRes_user.json +1 -1
- package/jnrs-vue/viteMockServe/success.ts +5 -5
- package/package.json +1 -1
- package/jnrs-vue/src/api/user/index.ts +0 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { IAttachment, IPagination } from '@/types'
|
|
4
|
+
import type { Project, EditProject } from '@/api/demos/index'
|
|
5
5
|
import { ref, onActivated, nextTick } from 'vue'
|
|
6
6
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
7
7
|
import { Plus } from '@element-plus/icons-vue'
|
|
@@ -9,31 +9,38 @@ import { useRoute } from '@jnrs/vue-core/router'
|
|
|
9
9
|
import { objectMatchAssign, dateFormatsToObject } from '@jnrs/shared'
|
|
10
10
|
import { debounce } from '@jnrs/shared/lodash'
|
|
11
11
|
import { isNumberGtZero } from '@jnrs/shared/validator'
|
|
12
|
-
import { getDictList, downloadFile } from '@/utils
|
|
12
|
+
import { getDictList, downloadFile, extractFieldId } from '@/utils'
|
|
13
13
|
import { useI18n } from '@/locales'
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
ProjectListApi,
|
|
16
|
+
EditProjectApi,
|
|
17
|
+
DeleteProjectApi,
|
|
18
|
+
DownloadTemplateApi,
|
|
19
|
+
ImportDataApi,
|
|
20
|
+
ExportApi
|
|
21
|
+
} from '@/api/demos/index'
|
|
15
22
|
import { JnDialog, JnDatetime, JnPagination, JnFileUpload, JnTable, JnImportAndExport } from '@jnrs/vue-core/components'
|
|
16
23
|
import ImageView from '@/components/common/ImageView.vue'
|
|
17
24
|
import PdfView from '@/components/common/PdfView.vue'
|
|
18
25
|
import DictTag from '@/components/common/DictTag.vue'
|
|
19
26
|
import SelectManager from '@/components/select/SelectManager.vue'
|
|
20
27
|
|
|
21
|
-
interface ProcessedProjectItem extends
|
|
22
|
-
newImageFiles?:
|
|
23
|
-
newAttachmentFile?:
|
|
28
|
+
interface ProcessedProjectItem extends Project {
|
|
29
|
+
newImageFiles?: IAttachment[]
|
|
30
|
+
newAttachmentFile?: IAttachment[]
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
const { t: $t } = useI18n()
|
|
27
34
|
const loading = ref(false)
|
|
28
35
|
const tableData = ref<ProcessedProjectItem[]>([])
|
|
29
36
|
const total = ref(0)
|
|
30
|
-
const pagination = ref<
|
|
37
|
+
const pagination = ref<IPagination>({ pageNo: 1, pageSize: 20 })
|
|
31
38
|
const route = useRoute()
|
|
32
39
|
|
|
33
40
|
// 编辑
|
|
34
41
|
const editDialogRef = ref()
|
|
35
42
|
const ruleFormRef = ref<FormInstance>()
|
|
36
|
-
const ruleForm = ref<
|
|
43
|
+
const ruleForm = ref<EditProject>({
|
|
37
44
|
id: '',
|
|
38
45
|
name: '',
|
|
39
46
|
projectType: undefined,
|
|
@@ -67,14 +74,14 @@ const queryForm = ref({
|
|
|
67
74
|
plannedStartDate: ''
|
|
68
75
|
})
|
|
69
76
|
|
|
70
|
-
const handleSelectionChange = (row:
|
|
77
|
+
const handleSelectionChange = (row: Project[]) => {
|
|
71
78
|
console.log(row)
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
const getTable = debounce(async () => {
|
|
75
82
|
loading.value = true
|
|
76
83
|
try {
|
|
77
|
-
const res = await
|
|
84
|
+
const res = await ProjectListApi({
|
|
78
85
|
...pagination.value,
|
|
79
86
|
...queryForm.value
|
|
80
87
|
})
|
|
@@ -92,7 +99,7 @@ const getTable = debounce(async () => {
|
|
|
92
99
|
}, 300)
|
|
93
100
|
|
|
94
101
|
// 新增和修改
|
|
95
|
-
const handleEdit = (row?:
|
|
102
|
+
const handleEdit = (row?: Project) => {
|
|
96
103
|
editDialogRef.value.open()
|
|
97
104
|
nextTick(() => {
|
|
98
105
|
ruleFormRef.value?.resetFields()
|
|
@@ -108,7 +115,7 @@ const handleEdit = (row?: ProjectItem) => {
|
|
|
108
115
|
})
|
|
109
116
|
}
|
|
110
117
|
|
|
111
|
-
const handleDelete = (row:
|
|
118
|
+
const handleDelete = (row: Project) => {
|
|
112
119
|
ElMessageBox.confirm('<p style="color: #f30">请注意,您尚未保存的数据将会丢失。</p>', '确定要删除吗?', {
|
|
113
120
|
dangerouslyUseHTMLString: true,
|
|
114
121
|
confirmButtonType: 'danger',
|
|
@@ -118,9 +125,9 @@ const handleDelete = (row: ProjectItem) => {
|
|
|
118
125
|
.then(async () => {
|
|
119
126
|
loading.value = true
|
|
120
127
|
try {
|
|
121
|
-
await
|
|
128
|
+
await DeleteProjectApi(row.id)
|
|
122
129
|
ElMessage({
|
|
123
|
-
message: '',
|
|
130
|
+
message: '删除成功',
|
|
124
131
|
grouping: true,
|
|
125
132
|
showClose: true,
|
|
126
133
|
type: 'success'
|
|
@@ -142,7 +149,11 @@ const submitForm = () => {
|
|
|
142
149
|
if (valid) {
|
|
143
150
|
loading.value = true
|
|
144
151
|
try {
|
|
145
|
-
await
|
|
152
|
+
await EditProjectApi({
|
|
153
|
+
...ruleForm.value,
|
|
154
|
+
// 将 managerId 的值从 Record<string, unknown> 转换为 number
|
|
155
|
+
managerId: extractFieldId(ruleForm.value.managerId, 'managerId') as number
|
|
156
|
+
})
|
|
146
157
|
ElMessage({
|
|
147
158
|
message: '数据已保存',
|
|
148
159
|
grouping: true,
|
|
@@ -195,6 +206,7 @@ onActivated(() => {
|
|
|
195
206
|
v-model="ruleForm.managerId"
|
|
196
207
|
:formRef="ruleFormRef"
|
|
197
208
|
validateFieldName="managerId"
|
|
209
|
+
:limit="1"
|
|
198
210
|
:simpleValue="false"
|
|
199
211
|
></SelectManager>
|
|
200
212
|
</el-form-item>
|
|
@@ -254,7 +266,7 @@ onActivated(() => {
|
|
|
254
266
|
<span>项目管理</span>
|
|
255
267
|
<div style="display: flex; justify-content: space-between; align-items: center">
|
|
256
268
|
<JnImportAndExport
|
|
257
|
-
:importTemplateApi="
|
|
269
|
+
:importTemplateApi="DownloadTemplateApi"
|
|
258
270
|
importBtnName="导入项目"
|
|
259
271
|
:importApi="ImportDataApi"
|
|
260
272
|
exportBtnName="导出项目"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { ProjectListApi } from '@/api/demos/index'
|
|
3
3
|
import { JnDatetime } from '@jnrs/vue-core/components'
|
|
4
4
|
import CardTable from '@/components/common/CardTable.vue'
|
|
5
5
|
import ImageView from '@/components/common/ImageView.vue'
|
|
@@ -8,7 +8,7 @@ import DictTag from '@/components/common/DictTag.vue'
|
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<template>
|
|
11
|
-
<CardTable :getTableDataApi="
|
|
11
|
+
<CardTable :getTableDataApi="ProjectListApi">
|
|
12
12
|
<template #header>项目列表</template>
|
|
13
13
|
<template #table>
|
|
14
14
|
<el-table-column prop="name" label="项目名称" min-width="200" sortable show-overflow-tooltip />
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import { ElMessage } from 'element-plus'
|
|
4
|
-
import { objectToFormData } from '@/utils
|
|
5
|
-
import { LoginApi
|
|
6
|
-
import { NotFoundApi, NoAuthApi, DetailsApi } from '@/api/demos'
|
|
4
|
+
import { objectToFormData, downloadFile } from '@/utils'
|
|
5
|
+
import { LoginApi } from '@/api/system'
|
|
6
|
+
import { DataApiTest, FullDataApiTest, NotFoundApi, NoAuthApi, DetailsApi } from '@/api/demos'
|
|
7
7
|
import { getFileUrl } from '@/utils/file'
|
|
8
|
-
import { downloadFile } from '@/utils/packages'
|
|
9
8
|
|
|
10
9
|
import ImageView from '@/components/common/ImageView.vue'
|
|
11
10
|
|
|
@@ -16,10 +15,33 @@ const loginParams = ref({
|
|
|
16
15
|
password: '123456'
|
|
17
16
|
})
|
|
18
17
|
|
|
19
|
-
const
|
|
18
|
+
const handleDataApi = async () => {
|
|
20
19
|
try {
|
|
21
|
-
const res = await
|
|
20
|
+
const res = await DataApiTest('123')
|
|
22
21
|
console.log(res)
|
|
22
|
+
console.log(res.name)
|
|
23
|
+
ElMessage({
|
|
24
|
+
message: '获取数据成功',
|
|
25
|
+
grouping: true,
|
|
26
|
+
showClose: true,
|
|
27
|
+
type: 'success'
|
|
28
|
+
})
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.log(error)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const handleFullDataApi = async () => {
|
|
35
|
+
try {
|
|
36
|
+
const res = await FullDataApiTest('123')
|
|
37
|
+
console.log(res)
|
|
38
|
+
console.log(res.data?.name)
|
|
39
|
+
ElMessage({
|
|
40
|
+
message: res.msg,
|
|
41
|
+
grouping: true,
|
|
42
|
+
showClose: true,
|
|
43
|
+
type: 'success'
|
|
44
|
+
})
|
|
23
45
|
} catch (error) {
|
|
24
46
|
console.log(error)
|
|
25
47
|
}
|
|
@@ -93,7 +115,8 @@ const handleFileView = async () => {
|
|
|
93
115
|
<template>
|
|
94
116
|
<p>网络请求测试</p>
|
|
95
117
|
<el-button-group>
|
|
96
|
-
<el-button type="success" size="small" @click="
|
|
118
|
+
<el-button type="success" size="small" @click="handleDataApi">获取data数据</el-button>
|
|
119
|
+
<el-button type="success" size="small" @click="handleFullDataApi">获取全量数据</el-button>
|
|
97
120
|
<el-button type="primary" size="small" @click="handleNotFoundApi">接口返回404</el-button>
|
|
98
121
|
<el-button type="primary" size="small" @click="handleNoAuth()">接口返回暂无权限</el-button>
|
|
99
122
|
<el-button type="primary" size="small" @click="handleNoAuth(false)">接口返回暂无权限(不显示 Message)</el-button>
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import RequestPage from './RequestPage.vue'
|
|
3
3
|
import { ref, onMounted } from 'vue'
|
|
4
4
|
import { handleRouter } from '@jnrs/vue-core/router'
|
|
5
|
-
import type {
|
|
5
|
+
import type { IMenuItem } from '@jnrs/vue-core'
|
|
6
6
|
import { hasPermission } from '@/utils/permissions'
|
|
7
7
|
import { MenuApi } from '@/api/system'
|
|
8
8
|
import { formatDateTime, formatWeekday } from '@jnrs/shared'
|
|
9
9
|
import { isFloatGtZero } from '@jnrs/shared/validator'
|
|
10
10
|
import { testI18n } from '@jnrs/shared/request'
|
|
11
11
|
|
|
12
|
-
const routeOptions = ref<
|
|
12
|
+
const routeOptions = ref<IMenuItem[]>([])
|
|
13
13
|
const currentRoute = ref('')
|
|
14
14
|
const datePicker = ref(new Date())
|
|
15
15
|
const datetime = ref(formatDateTime() + ' ' + formatWeekday())
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, computed, onActivated, onDeactivated } from 'vue'
|
|
3
3
|
import { formatDateTime, formatWeekday, formatGreeting } from '@jnrs/shared'
|
|
4
|
-
import { useAuthStore } from '@jnrs/vue-core/pinia'
|
|
5
4
|
import { handleRouter } from '@jnrs/vue-core/router'
|
|
5
|
+
import { useAuthStore } from '@/stores'
|
|
6
6
|
import ImageView from '@/components/common/ImageView.vue'
|
|
7
7
|
|
|
8
8
|
const { userInfo } = useAuthStore()
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
3
3
|
import { ref } from 'vue'
|
|
4
4
|
import { RoleApi, LoginApi } from '@/api/system'
|
|
5
|
-
import { useAuthStore } from '
|
|
5
|
+
import { useAuthStore } from '@/stores'
|
|
6
6
|
import { handleRouter, useRoute } from '@jnrs/vue-core/router'
|
|
7
7
|
import { isWeakPwd } from '@jnrs/shared/validator'
|
|
8
8
|
import { formatDateTime, formatWeekday } from '@jnrs/shared'
|
|
@@ -111,7 +111,7 @@ const submitForm = async () => {
|
|
|
111
111
|
<el-input
|
|
112
112
|
v-model="ruleForm.account"
|
|
113
113
|
:placeholder="$t('login.formAccount')"
|
|
114
|
-
prefix-icon="
|
|
114
|
+
prefix-icon="IUser"
|
|
115
115
|
clearable
|
|
116
116
|
/>
|
|
117
117
|
</el-form-item>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { IDictItem } from '@/types'
|
|
3
3
|
import { ElMessage } from 'element-plus'
|
|
4
4
|
import { ref, onActivated } from 'vue'
|
|
5
5
|
import { DictApi, DictDetailApi, DictChangeApi } from '@/api/system'
|
|
@@ -8,7 +8,7 @@ import { JnTable } from '@jnrs/vue-core/components'
|
|
|
8
8
|
|
|
9
9
|
const PERMISSION_EDIT = ['dict:edit']
|
|
10
10
|
const loading = ref(false)
|
|
11
|
-
const tableData = ref<
|
|
11
|
+
const tableData = ref<IDictItem[]>()
|
|
12
12
|
const predefineColors = ref([
|
|
13
13
|
'#000000',
|
|
14
14
|
'#999999',
|
|
@@ -36,7 +36,7 @@ const getList = () => {
|
|
|
36
36
|
})
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
const handleExpandChange = (row:
|
|
39
|
+
const handleExpandChange = (row: IDictItem) => {
|
|
40
40
|
loading.value = true
|
|
41
41
|
DictDetailApi(String(row.id))
|
|
42
42
|
.then((res) => {
|
|
@@ -48,7 +48,7 @@ const handleExpandChange = (row: DictItem) => {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// 保存键值对
|
|
51
|
-
const editKeyValue = (row:
|
|
51
|
+
const editKeyValue = (row: IDictItem) => {
|
|
52
52
|
if (!row.label) {
|
|
53
53
|
ElMessage({
|
|
54
54
|
type: 'warning',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { FormInstance } from 'element-plus'
|
|
3
3
|
import { ref, onMounted } from 'vue'
|
|
4
|
-
import { useAuthStore } from '
|
|
5
|
-
import { getDictList } from '@/utils
|
|
4
|
+
import { useAuthStore } from '@/stores'
|
|
5
|
+
import { getDictList } from '@/utils'
|
|
6
6
|
import { JnFileUpload } from '@jnrs/vue-core/components'
|
|
7
7
|
import { AvatarChangeApi } from '@/api/system'
|
|
8
8
|
import { objectMatchAssign } from '@jnrs/shared'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { reactive, ref } from 'vue'
|
|
3
3
|
import { PasswordChangeApi } from '@/api/system'
|
|
4
|
-
import { useAuthStore } from '
|
|
4
|
+
import { useAuthStore } from '@/stores'
|
|
5
5
|
import { handleRouter } from '@jnrs/vue-core/router'
|
|
6
6
|
import { isWeakPwd } from '@jnrs/shared/validator'
|
|
7
7
|
import type { FormInstance, FormItemRule } from 'element-plus'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type
|
|
3
|
-
import { isMsgIdMessage, isTypeDataMessage } from '@/types/webSocket'
|
|
2
|
+
import { type IMsgIdMessage, type ITypeDataMessage, isMsgIdMessage, isTypeDataMessage } from '@/types'
|
|
4
3
|
import { storeToRefs } from 'pinia'
|
|
5
4
|
import { useWebSocket } from '@jnrs/vue-core/composables'
|
|
6
5
|
import { useRouter } from '@jnrs/vue-core/router'
|
|
@@ -16,12 +15,12 @@ const { isLoading, wsStateInfo } = useWebSocket({
|
|
|
16
15
|
connectionTimeoutDuration: 3_000, // 修改仅为测试
|
|
17
16
|
onMessage: (rawMessage: unknown) => {
|
|
18
17
|
if (isMsgIdMessage(rawMessage)) {
|
|
19
|
-
const msg = rawMessage as
|
|
18
|
+
const msg = rawMessage as IMsgIdMessage
|
|
20
19
|
if (msg.msgId && msg.d && typeof msg.d === 'object') {
|
|
21
20
|
// console.log('接收 msgId 数据:', msg)
|
|
22
21
|
}
|
|
23
22
|
} else if (isTypeDataMessage(rawMessage)) {
|
|
24
|
-
const msg = rawMessage as
|
|
23
|
+
const msg = rawMessage as ITypeDataMessage
|
|
25
24
|
if (msg.type && msg.data && typeof msg.data === 'object') {
|
|
26
25
|
// console.log('接收 type 数据:', msg)
|
|
27
26
|
}
|
package/jnrs-vue/vite.config.ts
CHANGED
|
@@ -10,7 +10,7 @@ import vueDevTools from 'vite-plugin-vue-devtools'
|
|
|
10
10
|
|
|
11
11
|
const path = (url: string) => fileURLToPath(new URL(url, import.meta.url))
|
|
12
12
|
const config = loadEnv('development', './')
|
|
13
|
-
const
|
|
13
|
+
const useMockServe = config.VITE_USE_MOCK === 'true'
|
|
14
14
|
|
|
15
15
|
export default defineConfig({
|
|
16
16
|
plugins: [
|
|
@@ -32,9 +32,9 @@ export default defineConfig({
|
|
|
32
32
|
deleteOriginFile: false
|
|
33
33
|
}),
|
|
34
34
|
viteMockServe({
|
|
35
|
+
enable: useMockServe, // 是否开启 mock 服务器
|
|
35
36
|
mockPath: 'viteMockServe', // mock 文件目录
|
|
36
37
|
watchFiles: true, // mock 文件热更新
|
|
37
|
-
enable: isMock, // 是否开启
|
|
38
38
|
logger: false // 是否在终端显示请求日志
|
|
39
39
|
})
|
|
40
40
|
],
|
|
@@ -8,7 +8,7 @@ const res_fail = {
|
|
|
8
8
|
export default [
|
|
9
9
|
// 404
|
|
10
10
|
{
|
|
11
|
-
url: '/mock/notFound',
|
|
11
|
+
url: '/api/mock/notFound',
|
|
12
12
|
method: 'get',
|
|
13
13
|
rawResponse: async (req: IncomingMessage, res: ServerResponse) => {
|
|
14
14
|
res.statusCode = 404
|
|
@@ -18,7 +18,7 @@ export default [
|
|
|
18
18
|
},
|
|
19
19
|
// 权限不足
|
|
20
20
|
{
|
|
21
|
-
url: '/mock/auth/no',
|
|
21
|
+
url: '/api/mock/auth/no',
|
|
22
22
|
method: 'post',
|
|
23
23
|
response: () => {
|
|
24
24
|
return {
|
|
@@ -29,7 +29,7 @@ export default [
|
|
|
29
29
|
},
|
|
30
30
|
// 操作失败
|
|
31
31
|
{
|
|
32
|
-
url: '/mock/auth/fail',
|
|
32
|
+
url: '/api/mock/auth/fail',
|
|
33
33
|
method: 'post',
|
|
34
34
|
response: () => {
|
|
35
35
|
return res_fail
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import successMock from './success'
|
|
2
2
|
import failMock from './fail'
|
|
3
3
|
import fileMock from './file'
|
|
4
|
-
import menuRes from '../public/system/menu.json'
|
|
5
4
|
import loginRes_admin from './json/loginRes_admin.json'
|
|
6
5
|
import loginRes_user from './json/loginRes_user.json'
|
|
7
6
|
import dictRes from './json/dictRes.json'
|
|
@@ -14,17 +13,9 @@ export default [
|
|
|
14
13
|
...successMock,
|
|
15
14
|
...failMock,
|
|
16
15
|
...fileMock,
|
|
17
|
-
// 获取菜单
|
|
18
|
-
{
|
|
19
|
-
url: '/mock/menu',
|
|
20
|
-
method: 'get',
|
|
21
|
-
response: () => {
|
|
22
|
-
return menuRes
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
16
|
// 登录
|
|
26
17
|
{
|
|
27
|
-
url: '/mock/
|
|
18
|
+
url: '/api/mock/auth/login',
|
|
28
19
|
method: 'post',
|
|
29
20
|
response: ({ body }) => {
|
|
30
21
|
if (body.account === 'admin') {
|
|
@@ -35,7 +26,7 @@ export default [
|
|
|
35
26
|
},
|
|
36
27
|
// 获取个人信息
|
|
37
28
|
{
|
|
38
|
-
url: '/mock/
|
|
29
|
+
url: '/api/mock/auth/user-info',
|
|
39
30
|
method: 'get',
|
|
40
31
|
response: ({ headers }) => {
|
|
41
32
|
if (headers.authorization.includes('admin')) {
|
|
@@ -46,7 +37,7 @@ export default [
|
|
|
46
37
|
},
|
|
47
38
|
// 获取字典
|
|
48
39
|
{
|
|
49
|
-
url: '/mock/
|
|
40
|
+
url: '/api/mock/dict-manager',
|
|
50
41
|
method: 'get',
|
|
51
42
|
response: () => {
|
|
52
43
|
return dictRes
|
|
@@ -54,7 +45,7 @@ export default [
|
|
|
54
45
|
},
|
|
55
46
|
// 获取单个字典
|
|
56
47
|
{
|
|
57
|
-
url: /\/mock\/
|
|
48
|
+
url: /\/api\/mock\/dict-manager\/detail\/\d+/,
|
|
58
49
|
method: 'get',
|
|
59
50
|
response: () => {
|
|
60
51
|
return dictItemRes
|
|
@@ -62,7 +53,7 @@ export default [
|
|
|
62
53
|
},
|
|
63
54
|
// 获取角色
|
|
64
55
|
{
|
|
65
|
-
url: '/mock/
|
|
56
|
+
url: '/api/mock/role-manager',
|
|
66
57
|
method: 'get',
|
|
67
58
|
response: () => {
|
|
68
59
|
return roleRes
|
|
@@ -70,7 +61,7 @@ export default [
|
|
|
70
61
|
},
|
|
71
62
|
// 获取数据详情
|
|
72
63
|
{
|
|
73
|
-
url: '/mock/details',
|
|
64
|
+
url: '/api/mock/details',
|
|
74
65
|
method: 'get',
|
|
75
66
|
response: () => {
|
|
76
67
|
return detailsRes
|
|
@@ -78,7 +69,7 @@ export default [
|
|
|
78
69
|
},
|
|
79
70
|
// 获取表格数据
|
|
80
71
|
{
|
|
81
|
-
url: '/mock/demos/table',
|
|
72
|
+
url: '/api/mock/demos/table',
|
|
82
73
|
method: 'get',
|
|
83
74
|
response: () => {
|
|
84
75
|
return tableRes
|
|
@@ -6,7 +6,7 @@ const res_success = {
|
|
|
6
6
|
export default [
|
|
7
7
|
// 退出登录
|
|
8
8
|
{
|
|
9
|
-
url: '/mock/
|
|
9
|
+
url: '/api/mock/auth/logout',
|
|
10
10
|
method: 'get',
|
|
11
11
|
response: () => {
|
|
12
12
|
return res_success
|
|
@@ -14,7 +14,7 @@ export default [
|
|
|
14
14
|
},
|
|
15
15
|
// 修改密码
|
|
16
16
|
{
|
|
17
|
-
url: '/mock/
|
|
17
|
+
url: '/api/mock/auth/change-password',
|
|
18
18
|
method: 'post',
|
|
19
19
|
response: () => {
|
|
20
20
|
return res_success
|
|
@@ -22,7 +22,7 @@ export default [
|
|
|
22
22
|
},
|
|
23
23
|
// 修改单个字典
|
|
24
24
|
{
|
|
25
|
-
url: '/mock/
|
|
25
|
+
url: '/api/mock/dict-manager/detail',
|
|
26
26
|
method: 'post',
|
|
27
27
|
response: () => {
|
|
28
28
|
return res_success
|
|
@@ -30,7 +30,7 @@ export default [
|
|
|
30
30
|
},
|
|
31
31
|
// 表单新增
|
|
32
32
|
{
|
|
33
|
-
url: '/mock/demos/save',
|
|
33
|
+
url: '/api/mock/demos/save',
|
|
34
34
|
method: 'post',
|
|
35
35
|
response: () => {
|
|
36
36
|
return res_success
|
|
@@ -38,7 +38,7 @@ export default [
|
|
|
38
38
|
},
|
|
39
39
|
// 数据删除
|
|
40
40
|
{
|
|
41
|
-
url: /^\/mock\/demos\/delete\/[a-zA-Z0-9-]+$/,
|
|
41
|
+
url: /^\/api\/mock\/demos\/delete\/[a-zA-Z0-9-]+$/,
|
|
42
42
|
method: 'delete',
|
|
43
43
|
response: () => {
|
|
44
44
|
return res_success
|
package/package.json
CHANGED