Skip to content

Commit

Permalink
style: 代码风格优化
Browse files Browse the repository at this point in the history
  • Loading branch information
oljc committed Feb 24, 2025
1 parent 356e916 commit 693fdda
Show file tree
Hide file tree
Showing 27 changed files with 142 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# *************************

# 线上环境打包路径
VITE_BASE = ./
VITE_BASE = /

# 网络请求基础路径
VITE_API_BASE_URL = ""
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
// 行尾需要有分号
semi: true,
// 一行最多几个字符
printWidth: 110,
printWidth: 100,
// 使用单引号
singleQuote: true,
// 对象的 key 是否有引号格式保持一致
Expand Down
8 changes: 4 additions & 4 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export default {
'enhance',
'workflow',
'types',
'release',
],
],
},
'release'
]
]
}
};
5 changes: 1 addition & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ export default defineFlatConfig([
{ disallowTypeAnnotations: false, fixStyle: 'inline-type-imports' }
],
// 建议优先使用字面量枚举成员
'@typescript-eslint/prefer-literal-enum-member': [
'error',
{ allowBitwiseExpressions: true }
],
'@typescript-eslint/prefer-literal-enum-member': ['error', { allowBitwiseExpressions: true }],
'@typescript-eslint/no-unused-vars': [
'error',
{
Expand Down
8 changes: 4 additions & 4 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
plugins: {
autoprefixer: {},
},
};
plugins: {
autoprefixer: {}
}
};
4 changes: 2 additions & 2 deletions src/components/GlobalSetting/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<a-drawer :width="410" unmount-on-close :visible="visible" @ok="copySettings" @cancel="cancel">
<template #title>应用配置</template>
<a-alert type="warning">
配置之后仅是临时生效,要想真正作用于项目,点击下方的 "复制配置" 按钮,将配置替换到 settings.json
中即可。
配置之后仅是临时生效,要想真正作用于项目,点击下方的 "复制配置" 按钮,将配置替换到
settings.json 中即可。
</a-alert>
<Block :options="contentOpts" title="内容区域" />
<Block :options="othersOpts" title="其他设置" />
Expand Down
4 changes: 3 additions & 1 deletion src/components/LogoBar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<div class="logo-bar">
<LogoSvg class="logo-bar-logo" />
<transition name="fade">
<a-typography-title v-if="!hideName" class="logo-bar-name" :heading="5">Arco Admin</a-typography-title>
<a-typography-title v-if="!hideName" class="logo-bar-name" :heading="5">
Arco Admin
</a-typography-title>
</transition>
<a-tag color="orange" style="margin-left: 6px">
<template #icon>
Expand Down
7 changes: 6 additions & 1 deletion src/components/TabBar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
<div class="tab-bar-box">
<div class="tab-bar-scroll">
<div class="tags-wrap">
<tab-item v-for="(tag, index) in tagList" :key="tag.fullPath" :index="index" :item-data="tag" />
<tab-item
v-for="(tag, index) in tagList"
:key="tag.fullPath"
:index="index"
:item-data="tag"
/>
</div>
</div>
<div class="tag-bar-operation"></div>
Expand Down
6 changes: 4 additions & 2 deletions src/mock/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ const theServiceList: ServiceRecord[] = [
id: 1,
icon: 'code',
title: '漏斗分析',
description: '用户行为分析之漏斗分析模型是企业实现精细化运营、进行用户行为分析的重要数据分析模型。',
description:
'用户行为分析之漏斗分析模型是企业实现精细化运营、进行用户行为分析的重要数据分析模型。',
enable: true,
actionType: 'button'
},
{
id: 2,
icon: 'edit',
title: '用户分布',
description: '快速诊断用户人群,地域细分情况,了解数据分布的集中度,以及主要的数据分布的区间段是什么。',
description:
'快速诊断用户人群,地域细分情况,了解数据分布的集中度,以及主要的数据分布的区间段是什么。',
enable: true,
actionType: 'button',
expires: true
Expand Down
6 changes: 4 additions & 2 deletions src/mock/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ setupMock({
const role = window.localStorage.getItem('userRole') || 'admin';
return successResponseWrap({
name: '王立群',
avatar: '//lf1-xgcdn-tos.pstatp.com/obj/vcloud/vadmin/start.8e0e4855ee346a46ccff8ff3e24db27b.png',
avatar:
'//lf1-xgcdn-tos.pstatp.com/obj/vcloud/vadmin/start.8e0e4855ee346a46ccff8ff3e24db27b.png',
email: '[email protected]',
job: 'frontend',
jobName: '前端艺术家',
Expand Down Expand Up @@ -178,7 +179,8 @@ setupMock({
id: index,
title: '发布了项目 Arco Design System',
description: '企业级产品设计系统',
avatar: '//lf1-xgcdn-tos.pstatp.com/obj/vcloud/vadmin/start.8e0e4855ee346a46ccff8ff3e24db27b.png'
avatar:
'//lf1-xgcdn-tos.pstatp.com/obj/vcloud/vadmin/start.8e0e4855ee346a46ccff8ff3e24db27b.png'
}))
);
});
Expand Down
3 changes: 2 additions & 1 deletion src/router/guard/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export default function setupPermissionGuard(router: Router) {
const permissionsAllow = Permission.accessRouter(to);
if (permissionsAllow) next();
else {
const destination = Permission.findFirstPermissionRoute(appRoutes, userStore.role) || NOT_FOUND;
const destination =
Permission.findFirstPermissionRoute(appRoutes, userStore.role) || NOT_FOUND;
next(destination);
}
NProgress.done();
Expand Down
3 changes: 2 additions & 1 deletion src/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,5 @@ export const post = <T = unknown>(url: string, data?: unknown, config?: AxiosReq
export const put = <T = unknown>(url: string, data?: object, config?: AxiosRequestConfig) =>
http.put<T>(url, data, config);

export const del = <T = unknown>(url: string, config?: AxiosRequestConfig) => http.delete<T>(url, config);
export const del = <T = unknown>(url: string, config?: AxiosRequestConfig) =>
http.delete<T>(url, config);
5 changes: 4 additions & 1 deletion src/utils/route-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export function setRouteEmitter(to: RouteLocationNormalized) {
latestRoute = to;
}

export function listenerRouteChange(handler: (route: RouteLocationNormalized) => void, immediate = true) {
export function listenerRouteChange(
handler: (route: RouteLocationNormalized) => void,
immediate = true
) {
emitter.on(key, handler as Handler);
if (immediate && latestRoute) {
handler(latestRoute);
Expand Down
8 changes: 7 additions & 1 deletion src/views/dashboard/workplace/components/data-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/77d74c9a245adeae1ec7fb5d4539738d.svg~tplv-49unhts6dw-image.image"
/>
</a-avatar>
<a-statistic title="日新增评论" :value="8874" :value-from="0" animation show-group-separator>
<a-statistic
title="日新增评论"
:value="8874"
:value-from="0"
animation
show-group-separator
>
<template #suffix>
<span class="unit">个</span>
</template>
Expand Down
12 changes: 10 additions & 2 deletions src/views/dashboard/workplace/components/popular-content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
<a-radio value="image">图片</a-radio>
<a-radio value="video">视频</a-radio>
</a-radio-group>
<a-table :data="renderList" :pagination="false" :bordered="false" :scroll="{ x: '100%', y: '264px' }">
<a-table
:data="renderList"
:pagination="false"
:bordered="false"
:scroll="{ x: '100%', y: '264px' }"
>
<template #columns>
<a-table-column title="排名" data-index="key"></a-table-column>
<a-table-column title="内容标题" data-index="title">
Expand All @@ -40,7 +45,10 @@
<template #cell="{ record }">
<div class="increases-cell">
<span>{{ record.increases }}%</span>
<icon-caret-up v-if="record.increases !== 0" style="font-size: 8px; color: #f53f3f" />
<icon-caret-up
v-if="record.increases !== 0"
style="font-size: 8px; color: #f53f3f"
/>
</div>
</template>
</a-table-column>
Expand Down
5 changes: 4 additions & 1 deletion src/views/form/step/components/base-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
}
]"
>
<a-input v-model="formData.activityName" placeholder="输入汉字、字母或者数字,不超过20个字符" />
<a-input
v-model="formData.activityName"
placeholder="输入汉字、字母或者数字,不超过20个字符"
/>
</a-form-item>
<a-form-item
field="channelType"
Expand Down
11 changes: 9 additions & 2 deletions src/views/form/step/components/channel-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
>
<a-input v-model="formData.advertisingMedia" placeholder="营销媒介:cpc、banner、edm" />
</a-form-item>
<a-form-item field="keyword" label="关键词" :rules="[{ required: true, message: '请选择关键词' }]">
<a-form-item
field="keyword"
label="关键词"
:rules="[{ required: true, message: '请选择关键词' }]"
>
<a-select v-model="formData.keyword" placeholder="请选择关键词" multiple>
<a-option>今日头条</a-option>
<a-option>火山</a-option>
Expand All @@ -54,7 +58,10 @@
]"
row-class="keep-margin"
>
<a-textarea v-model="formData.advertisingContent" placeholder="请输入广告内容介绍,最多不超过200字。" />
<a-textarea
v-model="formData.advertisingContent"
placeholder="请输入广告内容介绍,最多不超过200字。"
/>
</a-form-item>
<a-form-item>
<a-space>
Expand Down
12 changes: 10 additions & 2 deletions src/views/list/card/components/quality-inspection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
close-txt="删除"
:show-tag="false"
>
<a-descriptions style="margin-top: 16px" :data="item.data" layout="inline-horizontal" :column="2" />
<a-descriptions
style="margin-top: 16px"
:data="item.data"
layout="inline-horizontal"
:column="2"
/>
<template #skeleton>
<a-skeleton :animation="true">
<a-skeleton-line :widths="['50%', '50%', '100%', '40%']" :rows="4" />
Expand All @@ -54,7 +59,10 @@ import useRequest from '@/hooks/useRequest';
import CardWrap from './card-wrap.vue';
const defaultValue: ServiceRecord[] = new Array(3).fill({});
const { loading, response: renderData } = useRequest<ServiceRecord[]>(queryInspectionList, defaultValue);
const { loading, response: renderData } = useRequest<ServiceRecord[]>(
queryInspectionList,
defaultValue
);
</script>

<style scoped lang="less">
Expand Down
5 changes: 4 additions & 1 deletion src/views/list/card/components/rules-preset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ import useRequest from '@/hooks/useRequest';
import CardWrap from './card-wrap.vue';
const defaultValue: ServiceRecord[] = new Array(6).fill({});
const { loading, response: renderData } = useRequest<ServiceRecord[]>(queryRulesPresetList, defaultValue);
const { loading, response: renderData } = useRequest<ServiceRecord[]>(
queryRulesPresetList,
defaultValue
);
</script>

<style scoped lang="less"></style>
5 changes: 4 additions & 1 deletion src/views/list/card/components/the-service.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ import useRequest from '@/hooks/useRequest';
import CardWrap from './card-wrap.vue';
const defaultValue: ServiceRecord[] = new Array(4).fill({});
const { loading, response: renderData } = useRequest<ServiceRecord[]>(queryTheServiceList, defaultValue);
const { loading, response: renderData } = useRequest<ServiceRecord[]>(
queryTheServiceList,
defaultValue
);
</script>

<style scoped lang="less"></style>
18 changes: 15 additions & 3 deletions src/views/list/search-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
</a-col>
<a-col :span="8">
<a-form-item field="status" label="状态">
<a-select v-model="formModel.status" :options="statusOptions" placeholder="请选择状态" />
<a-select
v-model="formModel.status"
:options="statusOptions"
placeholder="请选择状态"
/>
</a-form-item>
</a-col>
</a-row>
Expand Down Expand Up @@ -160,7 +164,11 @@
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/581b17753093199839f2e327e726b157.svg~tplv-49unhts6dw-image.image"
/>
</a-avatar>
<a-avatar v-else-if="record.contentType === 'horizontalVideo'" :size="16" shape="square">
<a-avatar
v-else-if="record.contentType === 'horizontalVideo'"
:size="16"
shape="square"
>
<img
alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/77721e365eb2ab786c889682cbc721c1.svg~tplv-49unhts6dw-image.image"
Expand Down Expand Up @@ -359,7 +367,11 @@ const handleSelectDensity = (val: string | number | Record<string, any> | undefi
size.value = val as SizeProps;
};
const handleChange = (checked: boolean | (string | boolean | number)[], column: Column, index: number) => {
const handleChange = (
checked: boolean | (string | boolean | number)[],
column: Column,
index: number
) => {
if (!checked) {
cloneColumns.value = showColumns.value.filter(item => item.dataIndex !== column.dataIndex);
} else {
Expand Down
8 changes: 7 additions & 1 deletion src/views/login/components/login-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@
</a-form-item>
</a-tab-pane>
</a-tabs>
<a-button type="primary" style="margin: 32px 0 6px" long :loading="loading" @click="handleSubmit">
<a-button
type="primary"
style="margin: 32px 0 6px"
long
:loading="loading"
@click="handleSubmit"
>
登录
</a-button>
<a-button type="text" long class="login-form-register-btn">注册</a-button>
Expand Down
5 changes: 4 additions & 1 deletion src/views/user/info/components/my-project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ import { queryMyProjectList, MyProjectRecord } from '@/api/user-center';
import useRequest from '@/hooks/useRequest';
const defaultValue = Array(6).fill({} as MyProjectRecord);
const { loading, response: projectList } = useRequest<MyProjectRecord[]>(queryMyProjectList, defaultValue);
const { loading, response: projectList } = useRequest<MyProjectRecord[]>(
queryMyProjectList,
defaultValue
);
</script>

<style scoped lang="less">
Expand Down
6 changes: 5 additions & 1 deletion src/views/user/setting/components/certification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

<script lang="ts" setup>
import { ref } from 'vue';
import { queryCertification, UnitCertification, EnterpriseCertificationModel } from '@/api/user-center';
import {
queryCertification,
UnitCertification,
EnterpriseCertificationModel
} from '@/api/user-center';
import useLoading from '@/hooks/useLoading';
import EnterpriseCertification from './enterprise-certification.vue';
import CertificationRecords from './certification-records.vue';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<a-card class="general-card" title="企业实名认证" :header-style="{ padding: '0px 20px 16px 20px' }">
<a-card
class="general-card"
title="企业实名认证"
:header-style="{ padding: '0px 20px 16px 20px' }"
>
<template #extra>
<a-link>修改认证主体</a-link>
</template>
Expand Down
Loading

0 comments on commit 693fdda

Please sign in to comment.