@yyp92-cli/template-vue-pc 1.2.0

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +15 -0
  3. package/template/.env.development +2 -0
  4. package/template/.env.production +2 -0
  5. package/template/.env.test +2 -0
  6. package/template/README.md +30 -0
  7. package/template/auto-imports.d.ts +11 -0
  8. package/template/components.d.ts +67 -0
  9. package/template/index.html +16 -0
  10. package/template/package.json +43 -0
  11. package/template/pnpm-lock.yaml +2830 -0
  12. package/template/public/vite.svg +1 -0
  13. package/template/src/App.vue +26 -0
  14. package/template/src/assets/img/login-bg.jpg +0 -0
  15. package/template/src/assets/img/logo.svg +15 -0
  16. package/template/src/components/layout/header-crumb/index.vue +38 -0
  17. package/template/src/components/layout/header-info/index.vue +181 -0
  18. package/template/src/components/layout/index.vue +83 -0
  19. package/template/src/components/layout/main-header/index.vue +85 -0
  20. package/template/src/components/layout/main-menu/index.vue +166 -0
  21. package/template/src/components/layout-horizontal/header-crumb/index.vue +38 -0
  22. package/template/src/components/layout-horizontal/header-info/index.vue +185 -0
  23. package/template/src/components/layout-horizontal/index.vue +55 -0
  24. package/template/src/components/layout-horizontal/main-header/index.vue +86 -0
  25. package/template/src/components/layout-horizontal/main-menu/index.vue +135 -0
  26. package/template/src/global/constants.ts +4 -0
  27. package/template/src/global/register-icons.ts +10 -0
  28. package/template/src/main.ts +16 -0
  29. package/template/src/mock/index.ts +8 -0
  30. package/template/src/mock/login.ts +5 -0
  31. package/template/src/mock/userDepartmentList.ts +85 -0
  32. package/template/src/mock/userInfoMock.ts +24 -0
  33. package/template/src/mock/userList.ts +115 -0
  34. package/template/src/mock/userListDelete.ts +1 -0
  35. package/template/src/mock/userMenuList.ts +466 -0
  36. package/template/src/mock/userMenus.ts +374 -0
  37. package/template/src/mock/userRoleList.ts +1846 -0
  38. package/template/src/router/index.ts +41 -0
  39. package/template/src/router/routes.ts +189 -0
  40. package/template/src/service/api/index.ts +90 -0
  41. package/template/src/service/request/index.ts +268 -0
  42. package/template/src/service/request/type.ts +5 -0
  43. package/template/src/store/counter.ts +19 -0
  44. package/template/src/store/index.ts +14 -0
  45. package/template/src/store/login/index.ts +142 -0
  46. package/template/src/store/main/index.ts +54 -0
  47. package/template/src/store/main/system/index.ts +88 -0
  48. package/template/src/store/main/system/type.ts +19 -0
  49. package/template/src/styles/global.scss +33 -0
  50. package/template/src/styles/index.scss +4 -0
  51. package/template/src/styles/reset.scss +17 -0
  52. package/template/src/theme/darkTheme.scss +51 -0
  53. package/template/src/theme/lightTheme.scss +53 -0
  54. package/template/src/types/index.ts +1 -0
  55. package/template/src/types/login.ts +4 -0
  56. package/template/src/utils/cache.ts +44 -0
  57. package/template/src/utils/download.ts +27 -0
  58. package/template/src/utils/format.ts +10 -0
  59. package/template/src/utils/index.ts +14 -0
  60. package/template/src/utils/map-menus.ts +174 -0
  61. package/template/src/views/403/index.vue +22 -0
  62. package/template/src/views/login/component/login-panel.vue +138 -0
  63. package/template/src/views/login/component/panel-account.vue +138 -0
  64. package/template/src/views/login/component/panel-phone.vue +56 -0
  65. package/template/src/views/login/index.vue +28 -0
  66. package/template/src/views/main/analysis/dashboard/index.vue +19 -0
  67. package/template/src/views/main/analysis/overview/index.vue +25 -0
  68. package/template/src/views/main/detail/index.vue +19 -0
  69. package/template/src/views/main/fullScreen/images/bg.png +0 -0
  70. package/template/src/views/main/fullScreen/images/contrast-bg.png +0 -0
  71. package/template/src/views/main/fullScreen/images/dataScreen-alarm.png +0 -0
  72. package/template/src/views/main/fullScreen/images/dataScreen-header-btn-bg-l.png +0 -0
  73. package/template/src/views/main/fullScreen/images/dataScreen-header-btn-bg-r.png +0 -0
  74. package/template/src/views/main/fullScreen/images/dataScreen-header-center-bg.png +0 -0
  75. package/template/src/views/main/fullScreen/images/dataScreen-header-left-bg.png +0 -0
  76. package/template/src/views/main/fullScreen/images/dataScreen-header-right-bg.png +0 -0
  77. package/template/src/views/main/fullScreen/images/dataScreen-header-warn-bg.png +0 -0
  78. package/template/src/views/main/fullScreen/images/dataScreen-main-cb.png +0 -0
  79. package/template/src/views/main/fullScreen/images/dataScreen-main-lb.png +0 -0
  80. package/template/src/views/main/fullScreen/images/dataScreen-main-lc.png +0 -0
  81. package/template/src/views/main/fullScreen/images/dataScreen-main-lt.png +0 -0
  82. package/template/src/views/main/fullScreen/images/dataScreen-main-rb.png +0 -0
  83. package/template/src/views/main/fullScreen/images/dataScreen-main-rc.png +0 -0
  84. package/template/src/views/main/fullScreen/images/dataScreen-main-rt.png +0 -0
  85. package/template/src/views/main/fullScreen/images/dataScreen-title.png +0 -0
  86. package/template/src/views/main/fullScreen/images/dataScreen-warn-bg.png +0 -0
  87. package/template/src/views/main/fullScreen/images/line-bg.png +0 -0
  88. package/template/src/views/main/fullScreen/images/man-bg.png +0 -0
  89. package/template/src/views/main/fullScreen/images/man.png +0 -0
  90. package/template/src/views/main/fullScreen/images/map-title-bg.png +0 -0
  91. package/template/src/views/main/fullScreen/images/rankingChart-bg.png +0 -0
  92. package/template/src/views/main/fullScreen/images/total.png +0 -0
  93. package/template/src/views/main/fullScreen/images/woman-bg.png +0 -0
  94. package/template/src/views/main/fullScreen/images/woman.png +0 -0
  95. package/template/src/views/main/fullScreen/index.vue +33 -0
  96. package/template/src/views/main/index.vue +24 -0
  97. package/template/src/views/main/product/category/index.vue +19 -0
  98. package/template/src/views/main/product/goods/index.vue +19 -0
  99. package/template/src/views/main/story/chat/index.vue +70 -0
  100. package/template/src/views/main/story/list/index.vue +19 -0
  101. package/template/src/views/main/system/department/index.vue +20 -0
  102. package/template/src/views/main/system/menu/index.vue +19 -0
  103. package/template/src/views/main/system/role/index.vue +20 -0
  104. package/template/src/views/main/system/user/index.vue +141 -0
  105. package/template/src/views/main/system/user/user-comp/UserContent.vue +211 -0
  106. package/template/src/views/main/system/user/user-comp/UserModal.vue +225 -0
  107. package/template/src/views/main/system/user/user-comp/UserSearch.vue +147 -0
  108. package/template/src/views/not-found/index.vue +22 -0
  109. package/template/src/vite-env.d.ts +9 -0
  110. package/template/tsconfig.app.json +26 -0
  111. package/template/tsconfig.json +7 -0
  112. package/template/tsconfig.node.json +25 -0
  113. package/template/vite.config.ts +66 -0
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div class="fullScreen">
3
+ 待完善
4
+ </div>
5
+ </template>
6
+
7
+ <script
8
+ setup
9
+ lang="ts"
10
+ name="FullScreen"
11
+ >
12
+ </script>
13
+
14
+ <style
15
+ scoped
16
+ lang="scss"
17
+ >
18
+ .fullScreen {
19
+ width: 100vw;
20
+ height: 100vh;
21
+ background: url(./images/bg.png) no-repeat;
22
+ background-size: cover;
23
+ color: var(--primary-text-color);
24
+
25
+ .screen {
26
+ width: 100%;
27
+ height: 100%;
28
+ min-width: 1200px;
29
+ display: flex;
30
+ flex-direction: column;
31
+ }
32
+ }
33
+ </style>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <div class="mian-wraper">
3
+ <Layout />
4
+ </div>
5
+ </template>
6
+
7
+ <script
8
+ setup
9
+ lang="ts"
10
+ name="Main"
11
+ >
12
+ import Layout from '@/components/layout/index.vue'
13
+ // import Layout from '@/components/layout-horizontal/index.vue'
14
+ </script>
15
+
16
+ <style
17
+ scoped
18
+ lang="scss"
19
+ >
20
+ .mian-wraper {
21
+ width: 100%;
22
+ height: 100%;
23
+ }
24
+ </style>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div class="category">
3
+ <h2>category</h2>
4
+ </div>
5
+ </template>
6
+
7
+ <script
8
+ setup
9
+ lang="ts"
10
+ name="Category"
11
+ >
12
+ </script>
13
+
14
+ <style
15
+ scoped
16
+ lang="scss"
17
+ >
18
+ .category {}
19
+ </style>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div class="goods">
3
+ <h2>goods</h2>
4
+ </div>
5
+ </template>
6
+
7
+ <script
8
+ setup
9
+ lang="ts"
10
+ name="Goods"
11
+ >
12
+ </script>
13
+
14
+ <style
15
+ scoped
16
+ lang="scss"
17
+ >
18
+ .goods {}
19
+ </style>
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div class="chat">
3
+ <Toolbar
4
+ style="border-bottom: 1px solid #ccc"
5
+ :editor="editorRef"
6
+ :defaultConfig="toolbarConfig"
7
+ :mode="mode"
8
+ />
9
+
10
+ <Editor
11
+ style="height: 500px; overflow-y: hidden;"
12
+ v-model="valueHtml"
13
+ :defaultConfig="editorConfig"
14
+ :mode="mode"
15
+ @onCreated="handleCreated"
16
+ />
17
+ </div>
18
+ </template>
19
+
20
+ <script
21
+ setup
22
+ lang="ts"
23
+ name="Chat"
24
+ >
25
+ import { onBeforeUnmount, ref, shallowRef, onMounted } from 'vue'
26
+ // @ts-ignore
27
+ import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
28
+ import '@wangeditor/editor/dist/css/style.css'
29
+
30
+ const mode = 'default'
31
+
32
+ // 编辑器实例,必须用 shallowRef
33
+ const editorRef = shallowRef()
34
+
35
+ // 内容 HTML
36
+ const valueHtml = ref('<p>hello</p>')
37
+
38
+ // 模拟 ajax 异步获取内容
39
+ onMounted(() => {
40
+ setTimeout(() => {
41
+ valueHtml.value = '<p>模拟 Ajax 异步设置内容</p>'
42
+ }, 1500)
43
+ })
44
+
45
+ const toolbarConfig = {}
46
+ const editorConfig = { placeholder: '请输入内容...' }
47
+
48
+ // 组件销毁时,也及时销毁编辑器
49
+ onBeforeUnmount(() => {
50
+ const editor = editorRef.value
51
+
52
+ if (editor == null) return
53
+
54
+ editor.destroy()
55
+ })
56
+
57
+ const handleCreated = (editor: any) => {
58
+ // 记录 editor 实例,重要!
59
+ editorRef.value = editor
60
+ }
61
+ </script>
62
+
63
+ <style
64
+ scoped
65
+ lang="scss"
66
+ >
67
+ .chat {
68
+ border: 1px solid var(--border-color-base);
69
+ }
70
+ </style>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div class="list">
3
+ <h2>list</h2>
4
+ </div>
5
+ </template>
6
+
7
+ <script
8
+ setup
9
+ lang="ts"
10
+ name="List"
11
+ >
12
+ </script>
13
+
14
+ <style
15
+ scoped
16
+ lang="scss"
17
+ >
18
+ .list {}
19
+ </style>
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <div class="department">
3
+ department
4
+ </div>
5
+ </template>
6
+
7
+ <script
8
+ setup
9
+ lang="ts"
10
+ name="Department"
11
+ >
12
+
13
+ </script>
14
+
15
+ <style
16
+ scoped
17
+ lang="scss"
18
+ >
19
+ .department {}
20
+ </style>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div class="menu">
3
+ <h2>menu</h2>
4
+ </div>
5
+ </template>
6
+
7
+ <script
8
+ setup
9
+ lang="ts"
10
+ name="Menu"
11
+ >
12
+ </script>
13
+
14
+ <style
15
+ scoped
16
+ lang="scss"
17
+ >
18
+ .menu {}
19
+ </style>
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <div class="role">
3
+ role
4
+ </div>
5
+ </template>
6
+
7
+ <script
8
+ setup
9
+ lang="ts"
10
+ name="Role"
11
+ >
12
+
13
+ </script>
14
+
15
+ <style
16
+ scoped
17
+ lang="scss"
18
+ >
19
+ .role {}
20
+ </style>
@@ -0,0 +1,141 @@
1
+ <template>
2
+ <div class="user">
3
+ <UserSearch
4
+ ref="searchRef"
5
+ :searchForm="searchForm"
6
+ @query-click="handleQueryClick"
7
+ @reset-click="handleResetClick"
8
+ />
9
+
10
+ <UserContent
11
+ ref="contentRef"
12
+ :currentPage="currentPage"
13
+ :pageSize="pageSize"
14
+ :usersList="usersList"
15
+ :usersTotalCount="usersTotalCount"
16
+ :loading="loading"
17
+ @new-click="handleNewClick"
18
+ @edit-click="handleEditClick"
19
+ @delete-click="handleDeleteClick"
20
+ @query-list="fetchUserListData"
21
+ />
22
+
23
+ <UserModal
24
+ ref="modalRef"
25
+ :defaultModalData="defaultModalData"
26
+ @close-modal="handleClose"
27
+ @confirm-click="handleConfirmClick"
28
+ />
29
+ </div>
30
+ </template>
31
+
32
+ <script
33
+ setup
34
+ lang="ts"
35
+ name="User"
36
+ >
37
+ import {ref, reactive, onMounted} from 'vue'
38
+ import {storeToRefs} from 'pinia'
39
+ import useSystemStore from '@/store/main/system'
40
+ import UserSearch from './user-comp/UserSearch.vue'
41
+ import UserContent from './user-comp/UserContent.vue'
42
+ import UserModal from './user-comp/UserModal.vue'
43
+
44
+ const systemStore = useSystemStore()
45
+
46
+ const searchRef = ref<InstanceType<typeof UserSearch>>()
47
+ const contentRef = ref<InstanceType<typeof UserContent>>()
48
+ const modalRef = ref<InstanceType<typeof UserModal>>()
49
+
50
+ // storeToRefs 转为响应式的
51
+ const {usersList, usersTotalCount} = storeToRefs(systemStore)
52
+ const searchForm = reactive({
53
+ name: '',
54
+ realname: '',
55
+ cellphone: '',
56
+ enable: 1,
57
+ createAt: ''
58
+ })
59
+ const currentPage = ref(1)
60
+ const pageSize = ref(10)
61
+ const loading = ref(false)
62
+ const defaultModalData = ref()
63
+
64
+
65
+ async function fetchUserListData(pageNum?: number, newPageSize?: number) {
66
+ if (pageNum) {
67
+ currentPage.value = pageNum
68
+ }
69
+
70
+ if (newPageSize) {
71
+ pageSize.value = newPageSize
72
+ }
73
+
74
+ const size = pageSize.value
75
+ const offset = (currentPage.value - 1) * size
76
+ const info = {
77
+ size,
78
+ offset,
79
+ ...searchForm
80
+ }
81
+
82
+ loading.value = true
83
+ systemStore.postUsersListAction(info).then((res) => {
84
+ if (res === 'finally') {
85
+ loading.value = false
86
+ }
87
+ })
88
+ }
89
+
90
+ function handleQueryClick() {
91
+ fetchUserListData()
92
+ }
93
+
94
+ function handleResetClick() {
95
+ fetchUserListData(1)
96
+ }
97
+
98
+ function handleDeleteClick(id: number) {
99
+ systemStore.deleteUserByIdAction(id).then((res) => {
100
+ if (res === 'ok') {
101
+ searchRef.value?.handleFormReset()
102
+ fetchUserListData(1)
103
+ }
104
+ })
105
+ }
106
+
107
+ function handleNewClick() {
108
+ modalRef.value?.closeModal(true)
109
+ defaultModalData.value = {}
110
+ }
111
+
112
+ function handleEditClick(data: any = {}) {
113
+ modalRef.value?.closeModal(true)
114
+ defaultModalData.value = data
115
+ }
116
+
117
+ function handleClose() {
118
+ modalRef.value?.closeModal(false)
119
+ defaultModalData.value = {}
120
+ }
121
+
122
+ function handleConfirmClick() {
123
+ searchRef.value?.handleFormReset()
124
+ fetchUserListData(1)
125
+ }
126
+
127
+ // 初始化调用
128
+ onMounted(() => {
129
+ fetchUserListData(1)
130
+ })
131
+ </script>
132
+
133
+ <style
134
+ scoped
135
+ lang="scss"
136
+ >
137
+ .user {
138
+ border-radius: 8px;
139
+ overflow: hidden;
140
+ }
141
+ </style>
@@ -0,0 +1,211 @@
1
+ <template>
2
+ <div class="content">
3
+ <div class="header">
4
+ <div class="title">用户列表</div>
5
+
6
+ <el-button
7
+ type="primary"
8
+ @click="handleNewUserClick"
9
+ >新建用户</el-button>
10
+ </div>
11
+
12
+ <div class="table">
13
+ <el-table
14
+ :data="usersList"
15
+ style="width: 100%"
16
+ border
17
+ v-loading="loading"
18
+ >
19
+ <el-table-column
20
+ type="selection"
21
+ width="50"
22
+ align="center"
23
+ />
24
+
25
+ <el-table-column
26
+ label="序号"
27
+ prop="order"
28
+ width="60"
29
+ align="center"
30
+ />
31
+
32
+ <el-table-column
33
+ prop="name"
34
+ label="用户名"
35
+ width="120"
36
+ align="center"
37
+ />
38
+
39
+
40
+ <el-table-column
41
+ prop="realname"
42
+ label="真实姓名"
43
+ width="120"
44
+ align="center"
45
+ />
46
+
47
+ <el-table-column
48
+ prop="cellphone"
49
+ label="手机号码"
50
+ width="150"
51
+ align="center"
52
+ />
53
+
54
+ <el-table-column
55
+ prop="enable"
56
+ label="状态"
57
+ width="80"
58
+ align="center"
59
+ >
60
+ <!-- 作用域插槽 -->
61
+ <template #default="scope">
62
+ <el-tag
63
+ :type="scope.row.enable ? 'primary' : 'danger'"
64
+ >{{ scope.row.enable ? '启用' : '禁用' }}</el-tag>
65
+ </template>
66
+ </el-table-column>
67
+
68
+ <el-table-column
69
+ prop="createAt"
70
+ label="创建时间"
71
+ align="center"
72
+ >
73
+ <template #default="scope">
74
+ {{ formatUTC(scope.row.createAt) }}
75
+ </template>
76
+ </el-table-column>
77
+
78
+ <el-table-column
79
+ prop="updateAt"
80
+ label="更新时间"
81
+ align="center"
82
+ >
83
+ <template #default="scope">
84
+ {{ formatUTC(scope.row.updateAt) }}
85
+ </template>
86
+ </el-table-column>
87
+
88
+ <el-table-column
89
+ label="操作"
90
+ width="130"
91
+ align="center"
92
+ >
93
+ <template #default="scope">
94
+ <el-button
95
+ size="small"
96
+ text
97
+ type="primary"
98
+ icon="Edit"
99
+ @click="handleEditBtnClick(scope.row)"
100
+ >编辑</el-button>
101
+
102
+ <el-button
103
+ size="small"
104
+ text
105
+ type="danger"
106
+ icon="Delete"
107
+ @click="handleDeleteBtnClick(scope.row.id)"
108
+ >删除</el-button>
109
+ </template>
110
+ </el-table-column>
111
+ </el-table>
112
+ </div>
113
+
114
+ <div class="pagination">
115
+ <el-pagination
116
+ :current-page="currentPage"
117
+ :page-size="pageSize"
118
+ :page-sizes="[10, 20, 30]"
119
+ background
120
+ layout="total, prev, pager, next, sizes, jumper"
121
+ :total="usersTotalCount"
122
+ @size-change="handleSizeChange"
123
+ @current-change="handleCurrentChange"
124
+ />
125
+ </div>
126
+ </div>
127
+ </template>
128
+
129
+ <script
130
+ setup
131
+ lang="ts"
132
+ name="UserContent"
133
+ >
134
+ import {formatUTC} from '@/utils/format'
135
+
136
+ defineProps([
137
+ 'loading',
138
+ 'currentPage',
139
+ 'pageSize',
140
+ 'usersList',
141
+ 'usersTotalCount'
142
+ ])
143
+ const emit = defineEmits([
144
+ 'newClick',
145
+ 'editClick',
146
+ 'deleteClick',
147
+ 'queryList'
148
+ ])
149
+
150
+ function handleSizeChange(size: number) {
151
+ emit('queryList', 1, size)
152
+ }
153
+
154
+ function handleCurrentChange (page: number) {
155
+ emit('queryList', page)
156
+ }
157
+
158
+ function handleDeleteBtnClick(id: number) {
159
+ emit('deleteClick', id)
160
+ }
161
+
162
+ function handleNewUserClick() {
163
+ emit('newClick')
164
+ }
165
+
166
+ function handleEditBtnClick(data: any) {
167
+ emit('editClick', data)
168
+ }
169
+ </script>
170
+
171
+ <style
172
+ scoped
173
+ lang="scss"
174
+ >
175
+ .content {
176
+ background: var(--bg-white-color);
177
+ margin-top: 20px;
178
+ padding: 20px;
179
+
180
+ .header {
181
+ display: flex;
182
+ justify-content: space-between;
183
+ align-items: center;
184
+ margin-bottom: 12px;
185
+
186
+ .title {
187
+ font-size: 18px;
188
+ font-weight: 600;
189
+ color: var(--text-color);
190
+ }
191
+ }
192
+
193
+ .table {
194
+ :deep(.el-table__cell) {
195
+ padding: 12px 0 !important;
196
+ }
197
+
198
+ .el-button {
199
+ margin-left: 0;
200
+ padding: 0 4px;
201
+ }
202
+ }
203
+
204
+ .pagination {
205
+ margin-top: 12px;
206
+ display: flex;
207
+ justify-content: flex-end;
208
+ align-items: center;
209
+ }
210
+ }
211
+ </style>