Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
fix: camelcase Fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei committed May 30, 2021
1 parent 2d63053 commit 2f4900f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
12 changes: 6 additions & 6 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#VUE_APP_BASE_API=https://api.innei.ren/v1/
#VUE_APP_WEB_URL=https://innei.ren
#VUE_APP_GATEWAY=https://api.innei.ren
VUE_APP_BASE_API=https://api.innei.ren/v1/
VUE_APP_WEB_URL=https://innei.ren
VUE_APP_GATEWAY=https://api.innei.ren

VUE_APP_BASE_API=http://localhost:2333
VUE_APP_WEB_URL=http://localhost:2323
VUE_APP_GATEWAY=http://localhost:2333
#VUE_APP_BASE_API=http://localhost:2333
#VUE_APP_WEB_URL=http://localhost:2323
#VUE_APP_GATEWAY=http://localhost:2333
2 changes: 1 addition & 1 deletion src/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const routes: MenuRouteConfig[] = [
{
path: 'optimize',
name: 'optimize',
meta: { title: '优化', icon: ['fas', 'wrench'] },
meta: { title: '开发测试', icon: ['fas', 'wrench'] },
component: () => import('@/views/Optimize/index.vue'),
},
],
Expand Down
11 changes: 9 additions & 2 deletions src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ service.interceptors.request.use(
if (store.getters.token) {
config.headers['Authorization'] = 'bearer ' + getToken()
}
config.url += '?timestamp=' + new Date().getTime()
config.url += '?t=' + new Date().getTime().toString(16).slice(2, 8)
return config
},
(error) => {
Expand All @@ -37,7 +37,14 @@ service.interceptors.request.use(

service.interceptors.response.use(
(response) => {
const res = camelcaseKeys(response.data, { deep: true })
let res = response.data

if (
typeof response.data == 'object' &&
Object.prototype.toString.call(response.data) == '[object Object]'
) {
res = camelcaseKeys(res, { deep: true })
}

return res
},
Expand Down
14 changes: 7 additions & 7 deletions src/views/Analyze/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<small> 总请求量中: PV {{ total.callTime }} UV {{ total.uv }} </small>
</section>

<section>
<section v-if="todayIps">
<small> 今天 - 所有请求的 IP {{ todayIps.length }} 个 </small>
<div class="tags">
<el-tag v-for="ip in todayIps" :key="ip" effect="plain">
Expand Down Expand Up @@ -151,9 +151,8 @@ export default class AnalyzeView extends Vue {
chartDataDay = [{}]
chartDataMonth = [{}]
chartDataWeek = [{}]
fragment:
| {}
| Record<'today' | 'weeks' | 'months', Record<string, number>> = {}
fragment: {} | Record<'today' | 'weeks' | 'months', Record<string, number>> =
{}
topPaths: { count: number; path: string }[] = []
chartDay: null | Chart = null
chartMonth: null | Chart = null
Expand Down Expand Up @@ -183,13 +182,14 @@ export default class AnalyzeView extends Vue {
total: {
[key: string]: number
}
today_ips: string[]
todayIps: string[]
page: PagerDto
}
const { data, total, today_ips } = resp
const { data, total, todayIps } = resp
this.raw = [...data]
this.total = { ...total } as any
this.todayIps = today_ips
this.todayIps = todayIps
this.tableData = this.parseUATableData(data)
this.pager = { ...resp.page }
Expand Down

0 comments on commit 2f4900f

Please sign in to comment.