Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:Tencent/tdesign-vue-next-starter…
Browse files Browse the repository at this point in the history
… into main
  • Loading branch information
uyarn committed Jul 12, 2022
2 parents a7e228b + 2675463 commit 1138652
Show file tree
Hide file tree
Showing 23 changed files with 181 additions and 136 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tdesign-vue-next-starter",
"version": "0.3.0",
"version": "0.3.5",
"scripts": {
"dev:mock": "vite --open --mode mock",
"dev": "vite --open --mode development",
Expand All @@ -27,7 +27,7 @@
"qrcode.vue": "^3.2.2",
"qs": "^6.10.5",
"tdesign-icons-vue-next": "^0.1.1",
"tdesign-vue-next": "0.17.3",
"tdesign-vue-next": "0.17.4",
"tvision-color": "^1.3.1",
"vue": "^3.2.31",
"vue-clipboard3": "^2.0.0",
Expand Down
19 changes: 19 additions & 0 deletions src/api/detail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { request } from '@/utils/request';
import type { ProjectListResult, PurchaseListResult } from '@/api/model/detailModel';

const Api = {
PurchaseList: '/get-purchase-list',
ProjectList: '/get-project-list',
};

export function getPurchaseList() {
return request.get<PurchaseListResult>({
url: Api.PurchaseList,
});
}

export function getProjectList() {
return request.get<ProjectListResult>({
url: Api.ProjectList,
});
}
19 changes: 19 additions & 0 deletions src/api/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { request } from '@/utils/request';
import type { CardListResult, ListResult } from '@/api/model/listModel';

const Api = {
BaseList: '/get-list',
CardList: '/get-card-list',
};

export function getList() {
return request.get<ListResult>({
url: Api.BaseList,
});
}

export function getCardList() {
return request.get<CardListResult>({
url: Api.CardList,
});
}
23 changes: 23 additions & 0 deletions src/api/model/detailModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export interface PurchaseListResult {
list: Array<PurchaseInfo>;
}
export interface PurchaseInfo {
adminName: string;
index: string;
pdName: string;
pdNum: string;
pdType: string;
purchaseNum: number;
updateTime: Date;
}

export interface ProjectListResult {
list: Array<ProjectInfo>;
}
export interface ProjectInfo {
adminName: string;
adminPhone: string;
index: number;
name: string;
updateTime: Date;
}
26 changes: 26 additions & 0 deletions src/api/model/listModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export interface ListResult {
list: Array<ListModel>;
}
export interface ListModel {
adminName: string;
amount: string;
contractType: number;
index: number;
name: string;
no: string;
paymentType: number;
status: number;
updateTime: Date;
}

export interface CardListResult {
list: Array<CardList>;
}
export interface CardList {
banner: string;
description: string;
index: number;
isSetup: boolean;
name: string;
type: number;
}
5 changes: 5 additions & 0 deletions src/layouts/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ const crumbs = computed(() => {
pathArray.shift();
const breadcrumbs = pathArray.reduce((breadcrumbArray, path, idx) => {
// 如果路由下有hiddenBreadcrumb或当前遍历到参数则隐藏
if (route.matched[idx]?.meta?.hiddenBreadcrumb || Object.values(route.params).includes(path)) {
return breadcrumbArray;
}
breadcrumbArray.push({
path,
to: breadcrumbArray[idx - 1] ? `/${breadcrumbArray[idx - 1].path}/${path}` : `/${path}`,
Expand Down
4 changes: 4 additions & 0 deletions src/layouts/components/MenuContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const getMenuList = (list: MenuRoute[], basePath?: string): MenuRoute[] => {
if (!list) {
return [];
}
// 如果meta中有orderNo则按照从小到大排序
list.sort((a, b) => {
return (a.meta?.orderNo || 0) - (b.meta?.orderNo || 0);
});
return list
.map((item) => {
const path = basePath ? `${basePath}/${item.path}` : item.path;
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/components/Notice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</div>
</div>
</template>
<t-badge :count="unreadMsg.length" :offset="[15, 21]">
<t-badge :count="unreadMsg.length" :offset="[12, 8]">
<t-button theme="default" shape="square" variant="text">
<t-icon name="mail" />
</t-button>
Expand Down
26 changes: 8 additions & 18 deletions src/pages/dashboard/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,8 @@ export function constructInitDashboardDataset(type: string) {
{ type: 'min', name: '最小值' },
],
},
itemStyle: {
normal: {
lineStyle: {
width: 2,
},
},
lineStyle: {
width: 2,
},
},
],
Expand Down Expand Up @@ -278,15 +274,11 @@ export function getLineChartDataSet({
symbol: 'circle',
symbolSize: 8,
itemStyle: {
normal: {
borderColor,
borderWidth: 1,
},
borderColor,
borderWidth: 1,
},
areaStyle: {
normal: {
opacity: 0.1,
},
opacity: 0.1,
},
},
{
Expand All @@ -298,10 +290,8 @@ export function getLineChartDataSet({
symbol: 'circle',
symbolSize: 8,
itemStyle: {
normal: {
borderColor,
borderWidth: 1,
},
borderColor,
borderWidth: 1,
},
},
],
Expand Down Expand Up @@ -352,7 +342,6 @@ export function getPieChartDataSet({
radius: ['48%', '60%'],
avoidLabelOverlap: true,
selectedMode: true,
hoverAnimation: true,
silent: true,
itemStyle: {
borderColor: containerColor,
Expand All @@ -377,6 +366,7 @@ export function getPieChartDataSet({
},
},
emphasis: {
scale: true,
label: {
show: true,
formatter: ['{value|{d}%}', '{name|{b}渠道占比}'].join('\n'),
Expand Down
24 changes: 8 additions & 16 deletions src/pages/dashboard/detail/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,8 @@ export function getFolderLineDataSet({
],
type: 'line',
itemStyle: {
normal: {
borderColor,
borderWidth: 1,
},
borderColor,
borderWidth: 1,
},
},
{
Expand All @@ -211,10 +209,8 @@ export function getFolderLineDataSet({
],
type: 'line',
itemStyle: {
normal: {
borderColor,
borderWidth: 1,
},
borderColor,
borderWidth: 1,
},
},
{
Expand All @@ -234,10 +230,8 @@ export function getFolderLineDataSet({
],
type: 'line',
itemStyle: {
normal: {
borderColor,
borderWidth: 1,
},
borderColor,
borderWidth: 1,
},
},
{
Expand All @@ -257,10 +251,8 @@ export function getFolderLineDataSet({
],
type: 'line',
itemStyle: {
normal: {
borderColor,
borderWidth: 1,
},
borderColor,
borderWidth: 1,
},
},
],
Expand Down
18 changes: 7 additions & 11 deletions src/pages/detail/advanced/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ export default {
import { ref, onMounted } from 'vue';
import { prefix } from '@/config/global';
import { BASE_INFO_DATA, TABLE_COLUMNS_DATA as columns, PRODUCT_LIST } from './constants';
import { request } from '@/utils/request';
import { ResDataType } from '@/types/interface';
import { getPurchaseList } from '@/api/detail';
import Product from './components/Product.vue';
Expand All @@ -145,15 +144,12 @@ const stepUpdate = () => {
const fetchData = async () => {
try {
const res: ResDataType = await request.get({ url: '/api/get-purchase-list' });
if (res.code === 0) {
const { list = [] } = res.data;
data.value = list;
pagination.value = {
...pagination.value,
total: list.length,
};
}
const { list } = await getPurchaseList();
data.value = list;
pagination.value = {
...pagination.value,
total: list.length,
};
} catch (e) {
console.log(e);
}
Expand Down
4 changes: 1 addition & 3 deletions src/pages/detail/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ export function getSmoothLineDataSet({
symbol: 'circle',
symbolSize: 8,
areaStyle: {
normal: {
opacity: 0.1,
},
opacity: 0.1,
},
},
{
Expand Down
18 changes: 7 additions & 11 deletions src/pages/detail/deploy/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ import { BASE_INFO_DATA, TABLE_COLUMNS as columns } from './constants';
import { changeChartsTheme } from '@/utils/color';
import { prefix } from '@/config/global';
import { ResDataType } from '@/types/interface';
import { request } from '@/utils/request';
import { getProjectList } from '@/api/detail';
echarts.use([
TitleComponent,
Expand All @@ -115,15 +114,12 @@ const pagination = ref({
const fetchData = async () => {
try {
const res: ResDataType = await request.get({ url: '/api/get-project-list' });
if (res.code === 0) {
const { list = [] } = res.data;
data.value = list;
pagination.value = {
...pagination.value,
total: list.length,
};
}
const { list } = await getProjectList();
data.value = list;
pagination.value = {
...pagination.value,
total: list.length,
};
} catch (e) {
console.log(e);
}
Expand Down
18 changes: 7 additions & 11 deletions src/pages/list/base/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ import { MessagePlugin } from 'tdesign-vue-next';
import { CONTRACT_STATUS, CONTRACT_TYPES, CONTRACT_PAYMENT_TYPES } from '@/constants';
import Trend from '@/components/trend/index.vue';
import { ResDataType } from '@/types/interface';
import { request } from '@/utils/request';
import { getList } from '@/api/list';
import { useSettingStore } from '@/store';
import { COLUMNS } from './constants';
Expand All @@ -102,15 +101,12 @@ const dataLoading = ref(false);
const fetchData = async () => {
dataLoading.value = true;
try {
const res: ResDataType = await request.get({ url: '/api/get-list' });
if (res.code === 0) {
const { list = [] } = res.data;
data.value = list;
pagination.value = {
...pagination.value,
total: list.length,
};
}
const { list } = await getList();
data.value = list;
pagination.value = {
...pagination.value,
total: list.length,
};
} catch (e) {
console.log(e);
} finally {
Expand Down
18 changes: 7 additions & 11 deletions src/pages/list/card/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ import { SearchIcon } from 'tdesign-icons-vue-next';
import { MessagePlugin } from 'tdesign-vue-next';
import ProductCard from '@/components/product-card/index.vue';
import DialogForm from './components/DialogForm.vue';
import { request } from '@/utils/request';
import { ResDataType } from '@/types/interface';
import { getCardList } from '@/api/list';
const INITIAL_DATA = {
name: '',
Expand All @@ -93,15 +92,12 @@ const dataLoading = ref(true);
const fetchData = async () => {
try {
const res: ResDataType = await request.get({ url: '/api/get-card-list' });
if (res.code === 0) {
const { list = [] } = res.data;
productList.value = list;
pagination.value = {
...pagination.value,
total: list.length,
};
}
const { list } = await getCardList();
productList.value = list;
pagination.value = {
...pagination.value,
total: list.length,
};
} catch (e) {
console.log(e);
} finally {
Expand Down
Loading

0 comments on commit 1138652

Please sign in to comment.