Bladeren bron

feat: 数据统计

jcq 3 weken geleden
bovenliggende
commit
f6409dbc73

+ 9 - 0
src/api/marketing/statistics.ts

@@ -0,0 +1,9 @@
+import request from '/@/utils/request';
+
+export function pageList(query: object) {
+    return request({
+        url: 'https://m1.apifoxmock.com/m1/6687089-6396408-default/marketing/statistics/page',
+        method: 'get',
+        data: query,
+    });
+}

+ 14 - 0
src/views/marketing/statistics/i18n/en.ts

@@ -0,0 +1,14 @@
+export default {
+	systoken: {
+		index: '#',
+		userId: 'userId',
+		username: 'username',
+		clientId: 'clientId',
+		accessToken: 'accessToken',
+		expiresAt: 'expiresAt',
+		inputUsernameTip: 'input Username',
+		offlineBtn: 'offline',
+		offlineConfirmText: 'offline confirm',
+		offlineSuccessText: 'offline success',
+	},
+};

+ 13 - 0
src/views/marketing/statistics/i18n/zh-cn.ts

@@ -0,0 +1,13 @@
+export default {
+	systoken: {
+		ip: 'IP',
+		domain: '域名',
+		content: '访问量',
+		active: '日活',
+		source: '来源',
+		inputIpTip: '请输入IP地址',
+		inputDomainTip: '请输入域名',
+		queryBtn: '查询',
+		resetBtn: '重置',
+	},
+};

+ 68 - 0
src/views/marketing/statistics/index.vue

@@ -0,0 +1,68 @@
+<template>
+	<div class="layout-padding">
+		<div class="layout-padding-auto layout-padding-view">
+			<el-row class="ml10" v-show="showSearch">
+				<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
+					<el-form-item :label="$t('systoken.ip')" prop="ip">
+						<el-input :placeholder="$t('systoken.inputIpTip')" v-model="state.queryForm.ip"></el-input>
+					</el-form-item>
+                    <el-form-item :label="$t('systoken.domain')" prop="domain">
+						<el-input :placeholder="$t('systoken.inputDomainTip')" v-model="state.queryForm.domain"></el-input>
+					</el-form-item>
+					<el-form-item>
+						<el-button @click="getDataList" icon="Search" type="primary">{{ $t('common.queryBtn') }} </el-button>
+						<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
+					</el-form-item>
+				</el-form>
+			</el-row>
+			<el-table
+				:data="state.dataList"
+				@sort-change="sortChangeHandle"
+				style="width: 100%"
+				v-loading="state.loading"
+				border
+				:cell-style="tableStyle.cellStyle"
+				:header-cell-style="tableStyle.headerCellStyle"
+			>
+				<!-- <el-table-column align="center" type="selection" width="40" /> -->
+				<el-table-column :label="$t('systoken.ip')" prop="ip" show-overflow-tooltip></el-table-column>
+				<el-table-column :label="$t('systoken.domain')" prop="domain" show-overflow-tooltip ></el-table-column>
+				<el-table-column :label="$t('systoken.content')" prop="content" show-overflow-tooltip></el-table-column>
+				<el-table-column :label="$t('systoken.active')" prop="active" show-overflow-tooltip></el-table-column>
+			</el-table>
+
+			<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination"> </pagination>
+		</div>
+	</div>
+</template>
+
+<script lang="ts" setup>
+import { BasicTableProps, useTable } from '/@/hooks/table';
+import { pageList } from '/@/api/marketing/statistics';
+
+import { useI18n } from 'vue-i18n';
+import { useMessage, useMessageBox } from '/@/hooks/message';
+import { Session } from '/@/utils/storage';
+
+const { t } = useI18n();
+// 定义变量内容
+const queryRef = ref();
+const showSearch = ref(true);
+
+//  table hook
+const state: BasicTableProps = reactive<BasicTableProps>({
+	queryForm: {
+		ip: '',
+        domain:''
+	},
+	pageList: pageList,
+});
+const { getDataList, currentChangeHandle, sortChangeHandle, sizeChangeHandle, tableStyle } = useTable(state);
+
+// 清空搜索条件
+const resetQuery = () => {
+	queryRef.value?.resetFields();
+	getDataList();
+};
+
+</script>

+ 1 - 1
tsconfig.json

@@ -69,6 +69,6 @@
 		"skipLibCheck": true /* Skip type checking of declaration files. */,
 		"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
 	},
-	"include": ["src/**/*.ts", "src/**/*.vue", "src/**/*.tsx", "src/**/*.d.ts", "auto-imports.d.ts"], // **Represents any directory, and * represents any file. Indicates that all files in the src directory will be compiled
+	"include": ["src/**/*.ts", "src/**/*.vue", "src/**/*.tsx", "src/**/*.d.ts", "auto-imports.d.ts", "src/api/marketing/statistics.ts"], // **Represents any directory, and * represents any file. Indicates that all files in the src directory will be compiled
 	"exclude": ["node_modules", "dist"] // Indicates the file directory that does not need to be compiled
 }