diff --git a/.vscode/settings.json b/.vscode/settings.json index d684138..050519a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,7 +7,7 @@ "editor.tabSize": 2, "editor.formatOnPaste": true, "editor.guides.bracketPairs": "active", - "files.autoSave": "onFocusChange", + "files.autoSave": "onWindowChange", "git.confirmSync": false, "workbench.startupEditor": "newUntitledFile", "editor.suggestSelection": "first", diff --git a/src/api/basic.ts b/src/api/basic.ts index 199b6e9..d6f5470 100644 --- a/src/api/basic.ts +++ b/src/api/basic.ts @@ -44,6 +44,7 @@ interface IHistoricalData { export type HistoricalData = { count: number data: { + count: number list: Array } } @@ -73,118 +74,60 @@ export const getHistoricalData = (data?: object) => { /** 搜索用户 */ export const getUserData = (data?: object) => { + console.log('getUserData:', data) return http.request('post', baseUrlApi('/cms/user/list'), { data }) } -// export type IGameInfo = { -// uid?: string -// play: string //总玩牌局数 -// totalhands: string //总手数 -// r_in: string //入池率 -// r_win: string //入池胜率 -// r_fc: string //翻牌前 -// r_ds: string //3bet率 -// r_jin: string //激进度 -// r_sd: string //摊牌率 -// r_100hands: string //百手盈利 -// totalwin: string //总盈利 -// } -export interface IGameInfo { - uid: number - cb: string - rDs: string - rD3b: string - rFbt: number - rFc: string - rRuwin: string - rSd: string - rSf: string - r100hands: number - rSdw: string - rRuTimes: number - '3b': string - play: number - rCh: string - rJin: string - totalwin: string - rRu: string - totalbuyin: number - utime: string - bmaxlose: number - hmaxwin: number - rWin: string - maxcard: string - bmaxwin: number - totalhands: number - rIn: string -} - -export interface GameInfo { - ploFive: IGameInfo - ploSix: IGameInfo - omaha: IGameInfo - texas: IGameInfo -} - -export type IUserInfo = { - data: { - base_info: {} - game_info: GameInfo - join_club_list?: any[] - create_club_list?: any[] - } -} -export interface BaseInfo { - lastName: string - uid: number - registerChannel: string - user_phone: string - street: string - postalCode: string - enterCount: number - gbgCheck: string - isHideFlag: number - city: string - firstName: string - houseNumber: string - enterTime: number - playTime: number - user_name: string - channel: string - scrapAmount: number - diamond: number - regTime: number - birthday: number - remarks: string - nationality: string - usersig: string - nickname: string - createGroupLimit: number - icon: string - regIp: string - identityCard: string - country: string - gender: number - userCategory: number - user_email: string -} - -type Result = { - code: number - data?: { - /** 列表数据 */ - base_info: BaseInfo - create_club_list: Array - join_club_list: Array - game_info: GameInfo - } -} /** 搜索用户 基本信息 */ export const getUserInfo = (data?: object) => { - console.log('_', data) - return http.request('post', baseUrlApi('/cms/user/info'), { + console.log('getUserInfo_', data) + return http.request('post', baseUrlApi('/cms/user/info'), { + data + }) +} + +/** 搜索用户 - 游戏记录>牌局记录 */ +export const getGameRecord = (data?: object) => { + console.log('getGameRecord', data) + return http.request('post', baseUrlApi('/cms/user/game_history'), { + data + }) +} + +/** 搜索用户 - 游戏记录>手牌历史 */ +export const getGameHandsRecord = (data?: object) => { + console.log('getGameHandsRecord', data) + + return http.request('post', baseUrlApi('/cms/user/hands_history'), { + data + }) +} + +/** 搜索用户 - 游戏记录>钻石记录 */ +export const getDiamondLog = (data?: object) => { + console.log('getGameHandsRecord', data) + + return http.request('post', baseUrlApi('/cms/user/diamond_logs'), { + data + }) +} + +/** 搜索用户 - 游戏记录>登录记录 */ +export const getLoginLog = (data?: object) => { + console.log('getGameHandsRecord', data) + + return http.request('post', baseUrlApi('/cms/user/login_logs'), { + data + }) +} + +/** 搜索用户 - 游戏记录>聊天记录 */ +export const getChatLog = (data?: object) => { + console.log('getGameHandsRecord', data) + + return http.request('post', baseUrlApi('/cms/user/chat_logs'), { data }) } diff --git a/src/api/tableData.ts b/src/api/tableData.ts new file mode 100644 index 0000000..6206b5d --- /dev/null +++ b/src/api/tableData.ts @@ -0,0 +1,13 @@ +/** module: 牌局数据 */ + +import { http } from '@/utils/http' +import { baseUrlApi } from './utils' + +/** 搜索用户 - 游戏记录>聊天记录 */ +export const getTableData = (data?: object) => { + console.log('getTableData', data) + + return http.request('post', baseUrlApi('/cms/poker/dataset'), { + data + }) +} diff --git a/src/router/modules/basicData.ts b/src/router/modules/basicData.ts index 86932bf..6a03c8d 100644 --- a/src/router/modules/basicData.ts +++ b/src/router/modules/basicData.ts @@ -64,16 +64,16 @@ export default { title: '用户信息p', showLink: false } - }, - { - path: '/basic/queryUser/users/:id/basicInfo', - name: 'UserBasicInfo', - component: () => import('@/views/basic/queryUser/user/basicInfo.vue'), - meta: { - title: '基础信息', - showLink: false - } } + // { + // path: '/basic/queryUser/users/:id/basicInfo', + // name: 'UserBasicInfo', + // component: () => import('@/views/basic/queryUser/user/basicInfo.vue'), + // meta: { + // title: '基础信息', + // showLink: false + // } + // } ] }, // { @@ -88,7 +88,7 @@ export default { // { // path: '/basic/queryUser/users/:id/basicInfo', // name: 'UserBasicInfo', - // component: () => import('@/views/basic/queryUser/user/basicInfo.vue'), + // component: () => import('@/views/basic/queryUser/user/BasicInfo.vue'), // meta: { // title: '基础信息', // showLink: false @@ -97,7 +97,7 @@ export default { { path: '/basic/gameData', name: 'GameData', - component: () => import('@/views/basic/GameData.vue'), + component: () => import('@/views/basic/gameData.vue'), meta: { title: $t('menus.gameData') } diff --git a/src/views/basic/GameData.vue b/src/views/basic/GameData.vue index badfa82..e63abd8 100644 --- a/src/views/basic/GameData.vue +++ b/src/views/basic/GameData.vue @@ -1,10 +1,154 @@ diff --git a/src/views/basic/queryUser/infoHook.ts b/src/views/basic/queryUser/infoHook.ts index 2b3f20d..4d9486d 100644 --- a/src/views/basic/queryUser/infoHook.ts +++ b/src/views/basic/queryUser/infoHook.ts @@ -19,8 +19,8 @@ export function useDetail() { query: { id: String(index) }, meta: { title: { - zh: `No.${index} - 详情信息`, - en: `No.${index} - DetailInfo` + zh: `${index} - 详情信息`, + en: `${index} - DetailInfo` }, // 最大打开标签数 dynamicLevel: 3 diff --git a/src/views/basic/queryUser/queryUser.vue b/src/views/basic/queryUser/queryUser.vue index 26e62f3..538340d 100644 --- a/src/views/basic/queryUser/queryUser.vue +++ b/src/views/basic/queryUser/queryUser.vue @@ -15,8 +15,17 @@ const { toDetail, router } = useDetail() console.log('router:', router) const formRef = ref() -const { form, historicalData, historicalColumns, loading, onSearchUser } = - useUser() +const { + form, + historicalData, + historicalColumns, + loading, + pagination_pure, + onSearchUser, + handleSizeChange, + handleCurrentChange + // handleClick +} = useUser() diff --git a/src/views/basic/queryUser/queryUserHook.ts b/src/views/basic/queryUser/queryUserHook.ts index 513e932..428fe7a 100644 --- a/src/views/basic/queryUser/queryUserHook.ts +++ b/src/views/basic/queryUser/queryUserHook.ts @@ -1,9 +1,15 @@ -import { ref, reactive, onMounted } from 'vue' +import { ref, reactive, computed, nextTick, onMounted } from 'vue' +import dayjs from 'dayjs' import { getUserData } from '@/api/basic' export function useUser() { const historicalColumns: TableColumnList = [ + { + label: 'UID', + prop: 'uid', + slot: 'operation' + }, { label: '用户名', prop: 'user_name' @@ -26,7 +32,9 @@ export function useUser() { }, { label: '最后登录', - prop: 'enter_time' + prop: 'enter_time', + formatter: ({ enter_time }) => + dayjs(enter_time * 1000).format('YYYY-MM-DD HH:MM:ss') }, { label: '最后登录IP及归属地', @@ -35,28 +43,75 @@ export function useUser() { ] const form = reactive({ - username: '', - mobile: '', - email: '', + user_name: '', + user_phone: '', + user_email: '', dateRange: '' }) const historicalData = ref([]) const loading = ref(true) + const pagination_pure = reactive({ + currentPage: 1, + pageSize: 10, + total: 0, + background: true + }) + + const pagination = computed(() => { + return { + page: pagination_pure.currentPage, + per_page: pagination_pure.pageSize + } + }) + function onSearchUser() { - console.log(form.dateRange) - console.log(form.dateRange[0]) - getUserData({ date: form }) + loading.value = true + console.log('form.dateRange:', form.dateRange) + console.log('pagination', pagination) + const start_time = form.dateRange ? Number(form?.dateRange[0]) / 1000 : '' + const end_time = form.dateRange ? Number(form?.dateRange[1]) / 1000 : '' + getUserData({ + ...form, + per_page: pagination_pure.pageSize, + page: pagination_pure.currentPage, + start_time, + end_time + }) .then(res => { historicalData.value = res.data.list loading.value = false + pagination_pure.total = res.data.count }) .catch(() => { loading.value = false }) } + function handleSizeChange(val: number) { + console.log(`${val} items per page`) + nextTick(() => { + onSearchUser() + }) + } + + function handleCurrentChange(val: number) { + console.log(`current page: ${val}`) + console.log({ val }) + nextTick(() => { + onSearchUser() + }) + } + + // function handleClick(row) { + // console.log( + // '%crow===>>>: ', + // 'color: MidnightBlue; background: Aquamarine; font-size: 20px;', + // row + // ) + // } + // const resetHistoryForm = formEl => { // if (!formEl) return // formEl.resetFields() @@ -72,7 +127,11 @@ export function useUser() { historicalData, historicalColumns, loading, - onSearchUser + pagination_pure, + onSearchUser, + handleSizeChange, + handleCurrentChange + // handleClick // resetHistoryForm } } diff --git a/src/views/basic/queryUser/user/BasicInfo.vue b/src/views/basic/queryUser/user/BasicInfo.vue index 630d870..a331d08 100644 --- a/src/views/basic/queryUser/user/BasicInfo.vue +++ b/src/views/basic/queryUser/user/BasicInfo.vue @@ -1,27 +1,27 @@ diff --git a/src/views/basic/queryUser/user/basicInfoHook.ts b/src/views/basic/queryUser/user/basicInfoHook.ts new file mode 100644 index 0000000..940d97d --- /dev/null +++ b/src/views/basic/queryUser/user/basicInfoHook.ts @@ -0,0 +1,69 @@ +import { toRefs, reactive } from 'vue' +/** 俱乐部信息-创建 表格column */ +export const created_club_columns: TableColumnList = [ + { label: '俱乐部名称(创建)', prop: 'name' }, + { label: '创建时间', prop: 'date' }, + { label: '俱乐部分积分', prop: 'jifen' } +] + +/** 俱乐部信息-加入 表格column */ +export const joined_club_columns: TableColumnList = [ + { label: '俱乐部名称(创建)', prop: 'name' }, + { label: '创建时间', prop: 'date' }, + { label: '俱乐部分积分', prop: 'jifen' } +] + +/** 基本信息 - 登录相关 */ +export const loginInfoMap = [ + { label: '登录渠道', prop: 'channel' }, + { label: '登录版本', prop: 'last_login_version' }, + { label: '最近登录IP', prop: 'last_login_ip' }, + { label: '最近登录IP位置', prop: 'last_login_country' }, + { label: '最近登录时间', prop: 'enter_time' }, + { label: '最近登录IP设备', prop: 'last_login_device' } +] + +/** 基本信息 - 注册相关 */ +export const registerInfoMap = [ + { label: '注册渠道', prop: 'register_channel' }, + { label: '注册版本', prop: '' }, // 先空着 + { label: '注册时间', prop: 'reg_time' }, + { label: '注册IP', prop: 'reg_ip' }, + { label: '注册设备', prop: '' } // 先空着 +] + +/** 数据信息 - 游戏维度 */ +export const gameMap = [ + { label: '总玩牌手数', prop: 'totalhands' }, + { label: '总玩牌局数', prop: 'play' }, + { label: '入池率', prop: 'r_in' }, + { label: '入池胜率', prop: 'r_win' }, + { label: '翻牌前入池率', prop: 'r_fc' }, + { label: '3bet率', prop: 'r_ds' }, + { label: '激进度', prop: 'r_jin' }, + { label: '摊牌度', prop: 'r_sd' }, + { label: '百手盈利', prop: 'r_100hands' }, + { label: '盈利', prop: 'totalwin' } +] +export function useBasic() { + const pageData = reactive({ + base_info: { + diamond: '', + country: '', + user_phone: '', + user_email: '' + }, + create_club_list: [], + game_info: { + omaha: {}, + texas: {}, + plo_five: {}, + plo_six: {} + }, + join_club_list: [] + }) + + return { + ...toRefs(pageData) + } +} diff --git a/src/views/basic/queryUser/user/chatRecord.vue b/src/views/basic/queryUser/user/chatRecord.vue index d1fed7a..876d3ab 100644 --- a/src/views/basic/queryUser/user/chatRecord.vue +++ b/src/views/basic/queryUser/user/chatRecord.vue @@ -22,7 +22,7 @@ type="primary" :icon="useRenderIcon(Search)" :loading="loading" - @click="onSearchUser" + @click="onSearch" > 搜索 @@ -32,25 +32,23 @@ type="primary" :icon="useRenderIcon(Search)" :loading="loading" - @click="onSearchUser" + @click="onSearch" > 导出 - - - - - + diff --git a/src/views/basic/queryUser/user/gameData.ts b/src/views/basic/queryUser/user/data.ts similarity index 83% rename from src/views/basic/queryUser/user/gameData.ts rename to src/views/basic/queryUser/user/data.ts index 6ce1d2c..5ec6711 100644 --- a/src/views/basic/queryUser/user/gameData.ts +++ b/src/views/basic/queryUser/user/data.ts @@ -1,4 +1,52 @@ -export default [ +export const loginTableData = [ + { + login_time: '1680576415096', + channel: 'H5', + ip_address: 'No. 189, Grove St, Los Angeles', + login_ip: '192.168.0.1', + device_code: 'Huawei P10' + }, + { + login_time: '1680576415096', + channel: 'H5', + ip_address: 'No. 189, Grove St, Los Angeles', + login_ip: '192.168.0.1', + device_code: 'Huawei P10' + }, + { + login_time: '1680576415096', + channel: 'H5', + ip_address: 'No. 189, Grove St, Los Angeles', + login_ip: '192.168.0.1', + device_code: 'Huawei P10' + } +] + +export const diamondTableData = [ + { + date: '1680576415096', + type: '看剩余牌', + count: 33, + remains: '189' + }, + { + date: '1680576415096', + type: '官方赠送', + count: 33, + remains: '189' + } +] + +export const chatTableData = [ + { + creator: '俱乐部名称', + table_name: 'asd ads table', + send_time: '1680576415096', + content: 'lorem as world' + } +] + +export const handsData = [ { date: '2016-05-03', name: 'Tom', diff --git a/src/views/basic/queryUser/user/diamondRecord.vue b/src/views/basic/queryUser/user/diamondRecord.vue index 0f6a278..a85bc55 100644 --- a/src/views/basic/queryUser/user/diamondRecord.vue +++ b/src/views/basic/queryUser/user/diamondRecord.vue @@ -14,7 +14,7 @@ start-placeholder="Start date" end-placeholder="End date" format="YYYY/MM/DD" - value-format="YYYY-MM-DD" + value-format="x" /> @@ -22,77 +22,34 @@ type="primary" :icon="useRenderIcon(Search)" :loading="loading" - @click="onSearchUser" + @click="onSearch" > 搜索 - - - - - - + diff --git a/src/views/basic/queryUser/user/index.vue b/src/views/basic/queryUser/user/index.vue index ccdae2a..946a4de 100644 --- a/src/views/basic/queryUser/user/index.vue +++ b/src/views/basic/queryUser/user/index.vue @@ -1,7 +1,5 @@ diff --git a/src/views/basic/queryUser/user/userHook.ts b/src/views/basic/queryUser/user/userHook.ts new file mode 100644 index 0000000..235c27f --- /dev/null +++ b/src/views/basic/queryUser/user/userHook.ts @@ -0,0 +1,184 @@ +import { ref, reactive, toRaw, onMounted } from 'vue' +// import { type PaginationProps } from '@pureadmin/table' +// import { useRoute } from 'vue-router' + +import { + // getGameRecord, + // getGameHandsRecord, + getDiamondLog, + getLoginLog, + getChatLog +} from '@/api/basic' + +/** router query 参数 */ +// const route = useRoute() +// const router = useRouter() +// const id = route.query?.id ? route.query?.id : route.params?.id + +/** 筛选日期区间 */ +const form = reactive({ + dateRange: '' +}) + +/** 分页信息 */ +const paginationParams = reactive({ + per_page: 20, + page: 1, + total: 10 +}) +// const pagination = reactive({ +// total: 0, +// per_page: 10, +// page: 1, +// background: true +// }) + +/** loading */ +const loading = ref(true) + +/** 游戏记录 */ +export function useGameLog() { + function onSearch() {} + + return { + form, + paginationParams, + onSearch + } +} + +/** 钻石记录 */ +export function useDiamondLog() { + const columns = [ + { label: '类型', prop: 'source' }, + { label: '日期', prop: 'ctime' }, + { label: '数量', prop: 'amount' }, + { label: '余额', prop: 'remain' } + ] + + const diamondTableData = ref([]) + + function onSearch() { + /** 查询参数 */ + const start_time = form.dateRange ? form?.dateRange[0] : undefined + const end_time = form.dateRange ? form?.dateRange[1] : undefined + const queryParams = { + uid: '20473', + start_time, + end_time, + ...toRaw(paginationParams) + } + console.log('queryParams:', queryParams) + + getDiamondLog(queryParams).then(res => { + const { data } = res + console.log('getDiamondLog=>', res) + diamondTableData.value = data.list + paginationParams.total = data.count + loading.value = false + }) + } + + onMounted(() => { + onSearch() + }) + + return { + columns, + form, + loading, + paginationParams, + diamondTableData, + onSearch + } +} + +/** 登录记录 */ +export function useLoginLog() { + const columns = [ + { label: '登录时间', prop: 'utime' }, + { label: '登录渠道', prop: 'channel' }, + { label: '登录IP', prop: 'ip' }, + { label: 'IP位置', prop: 'country' }, + { label: '设备码', prop: 'device' } + ] + + const loginTableData = ref([]) + + function onSearch() { + /** 查询参数 */ + const start_time = form.dateRange ? form?.dateRange[0] : undefined + const end_time = form.dateRange ? form?.dateRange[1] : undefined + const queryParams = { + uid: '20095', + start_time, + end_time, + ...toRaw(paginationParams) + } + console.log('queryParams:', queryParams) + + getLoginLog(queryParams).then(res => { + const { data } = res + console.log('getLoginLog=>', res) + loginTableData.value = data.list + paginationParams.total = data.count + loading.value = false + }) + } + + onMounted(() => { + onSearch() + }) + + return { + columns, + form, + loading, + loginTableData, + paginationParams, + onSearch + } +} + +/** 聊天记录 */ +export function useChatLog() { + const columns = [ + { label: '创建者', prop: 'creator' }, + { label: '牌局名称', prop: 'table_name' }, + { label: '发送时间', prop: 'send_time' }, + { label: '内容', prop: 'content' } + ] + + const chatTableData = ref([]) + + function onSearch() { + /** 查询参数 */ + const start_time = form.dateRange ? form?.dateRange[0] : undefined + const end_time = form.dateRange ? form?.dateRange[1] : undefined + const queryParams = { + uid: '20475', + start_time, + end_time, + ...toRaw(paginationParams) + } + console.log('queryParams:', queryParams) + + getChatLog(queryParams).then(res => { + console.log('getChatLog=>', res) + loading.value = false + }) + } + + onMounted(() => { + onSearch() + }) + + return { + columns, + form, + loading, + paginationParams, + chatTableData, + onSearch + } +} diff --git a/vite.config.ts b/vite.config.ts index 3dc2924..782182d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -46,7 +46,7 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => { proxy: { '^/dev-api/.*': { // 这里填写后端地址 - target: 'http://192.168.100.71:8000', + target: 'http://192.168.100.98:8000', changeOrigin: true, rewrite: path => path.replace(/^\/dev-api/, '') }