@sugarat/easypicker2-client 2.4.1 → 2.4.3

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/docs/plan/log.md CHANGED
@@ -29,6 +29,19 @@ q ep server --deploy 2.3.4
29
29
  ```
30
30
  :::
31
31
 
32
+ ## v2.4.3 (2023/03/07)
33
+ ### Bugfix
34
+ * fix: 后台修改mysql端口和地址不生效的问题
35
+
36
+ ### Chore
37
+ * 加强接口鉴权逻辑
38
+ * 清理历史TODO
39
+ * 补全系统操作文档的引导
40
+
41
+ ## v2.4.2 (2023/03/06)
42
+ ### Bugfix
43
+ * fix: 登录后台提示无权限,反复跳转到登录
44
+
32
45
  ## v2.4.1 (2023/03/05)
33
46
  ### Chore
34
47
  * 用户列表支持按文件数量排序
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/easypicker2-client",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "dev:test": "VITE_APP_AXIOS_BASE_URL=/api-test/ vite --mode test",
package/src/apis/ajax.ts CHANGED
@@ -11,9 +11,11 @@ const instance = axios.create({
11
11
  */
12
12
  instance.interceptors.request.use((config) => {
13
13
  const { method, params } = config
14
+ const token = localStorage.getItem('token')
14
15
  // 附带鉴权的token
15
- const headers: any = {
16
- token: localStorage.getItem('token')
16
+ const headers: any = {}
17
+ if (token) {
18
+ headers.token = token
17
19
  }
18
20
  // 不缓存get请求
19
21
  if (method === 'get') {
@@ -1,6 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { Bell } from '@element-plus/icons-vue'
3
3
  import { computed, reactive, onMounted, ref } from 'vue'
4
+ import { useRoute } from 'vue-router'
4
5
  import { SuperUserApi } from '@/apis'
5
6
  import MessageList from '@/components/MessageList/index.vue'
6
7
 
@@ -8,10 +9,13 @@ const activeTab = ref<'all' | 'no'>('all')
8
9
  const messageData = reactive<SuperUserApiTypes.MessageItem[]>([])
9
10
 
10
11
  const noReadMessage = computed(() => messageData.filter((v) => !v.read))
12
+ const route = useRoute()
11
13
  onMounted(() => {
12
- SuperUserApi.getMessageList().then((v) => {
13
- messageData.push(...v.data)
14
- })
14
+ if (route.name !== 'config') {
15
+ SuperUserApi.getMessageList().then((v) => {
16
+ messageData.push(...v.data)
17
+ })
18
+ }
15
19
  })
16
20
  </script>
17
21
  <template>
@@ -5,23 +5,43 @@
5
5
  <div>
6
6
  <h1>
7
7
  <span>服务概况</span>
8
- <el-icon :class="{
9
- loading,
10
- }" @click="refreshStatus" style="cursor:pointer;margin-left: 10px;">
8
+ <el-icon
9
+ :class="{
10
+ loading
11
+ }"
12
+ @click="refreshStatus"
13
+ style="cursor: pointer; margin-left: 10px"
14
+ >
11
15
  <Refresh />
12
16
  </el-icon>
13
17
  <span v-show="loading">数据加载中...</span>
14
18
  </h1>
15
19
  <Tip>查看各个服务的运行情况</Tip>
16
20
  <div class="service-list">
17
- <div v-for="service in serviceList" :key="service.key" class="service-item">
18
- <img :src="service.logo" :alt="service.name">
21
+ <div
22
+ v-for="service in serviceList"
23
+ :key="service.key"
24
+ class="service-item"
25
+ >
26
+ <img :src="service.logo" :alt="service.name" />
19
27
  <!-- <p>{{ service.name }}</p> -->
20
28
  <p>
21
29
  <Tip>{{ service.des }}</Tip>
22
30
  </p>
23
- <el-button v-if="service.status" type="success" size="small" :icon="Select" circle />
24
- <el-button v-else type="danger" size="small" :icon="CloseBold" circle />
31
+ <el-button
32
+ v-if="service.status"
33
+ type="success"
34
+ size="small"
35
+ :icon="Select"
36
+ circle
37
+ />
38
+ <el-button
39
+ v-else
40
+ type="danger"
41
+ size="small"
42
+ :icon="CloseBold"
43
+ circle
44
+ />
25
45
  <p v-if="!service.status && service.error">
26
46
  <Tip>{{ service.error }}</Tip>
27
47
  </p>
@@ -30,32 +50,61 @@
30
50
  </div>
31
51
  <div v-show="showErrorList.length" class="error-panel">
32
52
  <h1>错误信息</h1>
33
- <p v-for="err in showErrorList" :key="err.key"><strong>{{ err.name }}:</strong> <span class="error">{{
34
- err.errMsg
35
- }}</span></p>
53
+ <p v-for="err in showErrorList" :key="err.key">
54
+ <strong>{{ err.name }}:</strong>
55
+ <span class="error">{{ err.errMsg }}</span>
56
+ </p>
36
57
  </div>
37
58
  <div>
38
- <h1>
39
- 服务相关配置
40
- </h1>
59
+ <h1>服务相关配置</h1>
41
60
  <Tip>
42
61
  在此面板,配置服务器运行相关参数
43
- <!-- TODO:待补齐地址 -->
44
- <el-button type="primary" link="">配置手册?</el-button>
62
+ <a
63
+ href="https://docs.ep.sugarat.top/deploy/online-new.html#_5-%E6%9C%80%E5%90%8E%E6%9B%B4%E6%96%B0%E9%85%8D%E7%BD%AE"
64
+ >
65
+ <el-button type="primary" link>配置手册?</el-button></a
66
+ >
45
67
  </Tip>
46
68
  </div>
47
69
  <div class="config-container">
48
- <div class="config-panel" v-for="serverItem in serverConfig" :key="serverItem.title">
70
+ <div
71
+ class="config-panel"
72
+ v-for="serverItem in serverConfig"
73
+ :key="serverItem.title"
74
+ >
49
75
  <h2>
50
76
  {{ serverItem.title }}
51
77
  </h2>
52
- <el-form :label-position="'right'" label-width="100px" style="max-width: 400px;margin: 0 auto;;">
53
- <el-form-item :label-width="'auto'" v-for="cfgItem in serverItem.data" :label="cfgItem.label || cfgItem.key"
54
- :key="cfgItem.key">
55
- <div class="flex" style="flex:1">
56
- <el-input :disabled="cfgItem.disabled" v-model="cfgItem.value" />
57
- <el-button v-if="cfgItem.disabled" @click="cfgItem.disabled = false" type="primary" text>更新</el-button>
58
- <el-button v-else @click="updateCfg(cfgItem)" type="success" text>完成</el-button>
78
+ <el-form
79
+ :label-position="'right'"
80
+ label-width="100px"
81
+ style="max-width: 400px; margin: 0 auto"
82
+ >
83
+ <el-form-item
84
+ :label-width="'auto'"
85
+ v-for="cfgItem in serverItem.data"
86
+ :label="cfgItem.label || cfgItem.key"
87
+ :key="cfgItem.key"
88
+ >
89
+ <div class="flex" style="flex: 1">
90
+ <el-input
91
+ :disabled="cfgItem.disabled"
92
+ v-model="cfgItem.value"
93
+ />
94
+ <el-button
95
+ v-if="cfgItem.disabled"
96
+ @click="cfgItem.disabled = false"
97
+ type="primary"
98
+ text
99
+ >更新</el-button
100
+ >
101
+ <el-button
102
+ v-else
103
+ @click="updateCfg(cfgItem)"
104
+ type="success"
105
+ text
106
+ >完成</el-button
107
+ >
59
108
  </div>
60
109
  </el-form-item>
61
110
  </el-form>
@@ -66,9 +115,7 @@
66
115
  </template>
67
116
  <script lang="ts" setup>
68
117
  import { ElMessage } from 'element-plus'
69
- import {
70
- computed, onMounted, reactive, ref,
71
- } from 'vue'
118
+ import { computed, onMounted, reactive, ref } from 'vue'
72
119
  import { useStore } from 'vuex'
73
120
  import { Select, CloseBold, Refresh } from '@element-plus/icons-vue'
74
121
  import { ConfigServiceAPI } from '@/apis'
@@ -81,21 +128,21 @@ const serviceList = reactive([
81
128
  logo: 'https://img.cdn.sugarat.top/mdImg/MTY1NzM1OTAyMjIwNA==657359022204',
82
129
  status: false,
83
130
  des: '存储用户数据',
84
- errMsg: '',
131
+ errMsg: ''
85
132
  },
86
133
  {
87
134
  name: '七牛云',
88
135
  key: 'qiniu',
89
136
  logo: 'https://img.cdn.sugarat.top/mdImg/MTY1NzM1ODcyODM0Mg==657358728342',
90
137
  status: false,
91
- des: '文件存储',
138
+ des: '文件存储'
92
139
  },
93
140
  {
94
141
  name: 'MongoDB',
95
142
  key: 'mongodb',
96
143
  logo: 'https://img.cdn.sugarat.top/mdImg/MTY1NzM1OTA4OTc3Nw==657359089777',
97
144
  status: false,
98
- des: '用户数据与日志',
145
+ des: '用户数据与日志'
99
146
  },
100
147
  {
101
148
  name: 'Redis',
@@ -103,15 +150,15 @@ const serviceList = reactive([
103
150
  logo: 'https://img.cdn.sugarat.top/mdImg/MTY1NzM1ODgyNzM1MA==657358827350',
104
151
  status: false,
105
152
  des: '持久化缓存数据',
106
- error: '确保安装redis,且监听端口6379',
153
+ error: '确保安装redis,且监听端口6379'
107
154
  },
108
155
  {
109
156
  name: '腾讯云',
110
157
  key: 'tx',
111
158
  logo: 'https://img.cdn.sugarat.top/mdImg/MTY1NzM1OTE1MzQzOQ==657359153439',
112
159
  status: false,
113
- des: '短信服务',
114
- },
160
+ des: '短信服务'
161
+ }
115
162
  ])
116
163
  const $store = useStore()
117
164
  const loading = ref(false)
@@ -119,49 +166,42 @@ const showErrorList = computed(() => serviceList.filter((item) => item.errMsg))
119
166
  const refreshStatus = () => {
120
167
  if (loading.value) return
121
168
  loading.value = true
122
- ConfigServiceAPI
123
- .getServiceOverview()
124
- .then((v) => {
125
- const { data } = v
126
- serviceList.forEach((item) => {
127
- const { status, errMsg } = data[item.key]
128
- item.status = status
129
- item.errMsg = errMsg
130
- })
131
- ElMessage.success('服务状态刷新完成')
132
- loading.value = false
169
+ ConfigServiceAPI.getServiceOverview().then((v) => {
170
+ const { data } = v
171
+ serviceList.forEach((item) => {
172
+ const { status, errMsg } = data[item.key]
173
+ item.status = status
174
+ item.errMsg = errMsg
133
175
  })
176
+ ElMessage.success('服务状态刷新完成')
177
+ loading.value = false
178
+ })
134
179
  }
135
180
 
136
181
  const serverConfig = ref([])
137
182
  const getServiceConfig = () => {
138
- ConfigServiceAPI
139
- .getServiceConfig()
140
- .then((v) => {
141
- // console.log(v.data)
183
+ ConfigServiceAPI.getServiceConfig().then((v) => {
184
+ // console.log(v.data)
185
+ v.data.forEach((v) => {
142
186
  v.data.forEach((v) => {
143
- v.data.forEach((v) => {
144
- v.disabled = true
145
- })
187
+ v.disabled = true
146
188
  })
147
- serverConfig.value = v.data
148
189
  })
190
+ serverConfig.value = v.data
191
+ })
149
192
  }
150
193
  const updateCfg = (item: ConfigServiceAPITypes.ServiceConfigItem) => {
151
- ConfigServiceAPI
152
- .updateCfg(item)
153
- .then(() => {
154
- item.disabled = true
155
- ElMessage.success('更新成功')
156
- refreshStatus()
157
- })
194
+ ConfigServiceAPI.updateCfg(item).then(() => {
195
+ item.disabled = true
196
+ ElMessage.success('更新成功')
197
+ refreshStatus()
198
+ })
158
199
  }
159
200
  onMounted(() => {
160
201
  refreshStatus()
161
202
  getServiceConfig()
162
203
  })
163
204
  const isMobile = computed(() => $store.getters['public/isMobile'])
164
-
165
205
  </script>
166
206
 
167
207
  <style scoped lang="scss">
@@ -133,8 +133,6 @@
133
133
  center
134
134
  :fullscreen="isMobile"
135
135
  >
136
- <!-- TODO: 展示优化 -->
137
- <!-- <pre style="overflow: hidden;">{{ showData }}</pre> -->
138
136
  <json-viewer
139
137
  :value="jsonData"
140
138
  :expand-depth="5"
@@ -517,7 +517,6 @@ const getCode = () => {
517
517
  })
518
518
  })
519
519
  .catch((err) => {
520
- // TODO:编写通用方法处理失败信息弹窗回掉
521
520
  const { code: c } = err
522
521
  const msg = '注册失败,未知错误'
523
522
  const options: any = {
@@ -455,16 +455,6 @@ watchEffect(() => {
455
455
  font-size: 12px;
456
456
  width: 48px;
457
457
  text-align: left;
458
- // TODO:待定颜色
459
- // &.input{
460
- // color: black;
461
- // }
462
- // &.text{
463
- // color: #000000;
464
- // }
465
- // &.radio{
466
- // color: #999;
467
- // }
468
458
  }
469
459
 
470
460
  .radio-list {
@@ -299,7 +299,6 @@ const handAddName = () => {
299
299
  if (!userInputName.value) {
300
300
  return
301
301
  }
302
- // TODO:掉接口导入
303
302
  importStatus.value = true
304
303
  PeopleApi.addPeopleByUser(userInputName.value, props.k)
305
304
  .then((v) => {
@@ -21,8 +21,6 @@
21
21
  >
22
22
  {{ n.title }}
23
23
  </div>
24
- <!-- TODO:重新加导航内容 -->
25
- <!-- 底部导航栏 -->
26
24
  </nav>
27
25
  </div>
28
26
  </div>
@@ -25,8 +25,7 @@ export function copyRes(text: string, msg = '结果已成功复制到剪贴板')
25
25
  }
26
26
  })
27
27
  .catch((err) => {
28
- // TODO:错误上报API接入
29
- console.error(err)
28
+ ElMessage.error(err?.message || '无粘贴板权限')
30
29
  ElMessage.warning('不支持自动复制,请手动选择复制')
31
30
  })
32
31
  }