mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-08 13:28:13 -05:00
✨ Feature(custom): remove some dev output
This commit is contained in:
parent
dfbbadea46
commit
a046b4047e
@ -80,13 +80,13 @@ import { saveConfig } from '@/utils/dataSender'
|
|||||||
import { T as $T } from '@/i18n/index'
|
import { T as $T } from '@/i18n/index'
|
||||||
import { useStore } from '@/hooks/useStore'
|
import { useStore } from '@/hooks/useStore'
|
||||||
import { PICBEDS_PAGE, UPLOADER_CONFIG_PAGE } from '@/router/config'
|
import { PICBEDS_PAGE, UPLOADER_CONFIG_PAGE } from '@/router/config'
|
||||||
|
import { sendRPC, triggerRPC } from '@/utils/common'
|
||||||
|
|
||||||
import { IRPCActionType } from '#/types/enum'
|
import { IRPCActionType } from '#/types/enum'
|
||||||
import { configPaths } from '#/utils/configPaths'
|
import { configPaths } from '#/utils/configPaths'
|
||||||
import { sendRPC, triggerRPC } from '@/utils/common'
|
|
||||||
|
|
||||||
const $router = useRouter()
|
const router = useRouter()
|
||||||
const $route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const type = ref('')
|
const type = ref('')
|
||||||
const curConfigList = ref<IStringKeyMap[]>([])
|
const curConfigList = ref<IStringKeyMap[]>([])
|
||||||
@ -113,7 +113,7 @@ onBeforeRouteUpdate((to, _, next) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
type.value = $route.params.type as string
|
type.value = route.params.type as string
|
||||||
getCurrentConfigList()
|
getCurrentConfigList()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ async function getCurrentConfigList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openEditPage(configId: string) {
|
function openEditPage(configId: string) {
|
||||||
$router.push({
|
router.push({
|
||||||
name: PICBEDS_PAGE,
|
name: PICBEDS_PAGE,
|
||||||
params: {
|
params: {
|
||||||
type: type.value,
|
type: type.value,
|
||||||
@ -137,7 +137,7 @@ function openEditPage(configId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatTime(time: number): string {
|
function formatTime(time: number): string {
|
||||||
return dayjs(time).format('YY/MM/DD HH:mm')
|
return dayjs(time).format('YY-MM-DD HH:mm')
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteConfig(id: string) {
|
async function deleteConfig(id: string) {
|
||||||
@ -148,7 +148,7 @@ async function deleteConfig(id: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addNewConfig() {
|
function addNewConfig() {
|
||||||
$router.push({
|
router.push({
|
||||||
name: PICBEDS_PAGE,
|
name: PICBEDS_PAGE,
|
||||||
params: {
|
params: {
|
||||||
type: type.value,
|
type: type.value,
|
||||||
|
@ -4,19 +4,14 @@ import { isReactive, isRef, toRaw, unref } from 'vue'
|
|||||||
import { RPC_ACTIONS, RPC_ACTIONS_INVOKE } from '#/events/constants'
|
import { RPC_ACTIONS, RPC_ACTIONS_INVOKE } from '#/events/constants'
|
||||||
import { IRPCActionType } from '#/types/enum'
|
import { IRPCActionType } from '#/types/enum'
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
|
||||||
|
|
||||||
export const handleTalkingDataEvent = (data: ITalkingDataOptions) => {
|
export const handleTalkingDataEvent = (data: ITalkingDataOptions) => {
|
||||||
const { EventId, Label = '', MapKv = {} } = data
|
|
||||||
MapKv.from = window.location.href
|
|
||||||
try {
|
try {
|
||||||
|
const { EventId, Label = '', MapKv = {} } = data
|
||||||
|
MapKv.from = window.location.href
|
||||||
window.TDAPP.onEvent(EventId, Label, MapKv)
|
window.TDAPP.onEvent(EventId, Label, MapKv)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
if (isDevelopment) {
|
|
||||||
console.log('talkingData', data)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,26 +36,14 @@ export function sendToMain(channel: string, ...args: any[]) {
|
|||||||
ipcRenderer.send(channel, ...data)
|
ipcRenderer.send(channel, ...data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* send a rpc request & do not need to wait for the response
|
|
||||||
*
|
|
||||||
* or the response will be handled by other listener
|
|
||||||
*/
|
|
||||||
export function sendRPC(action: IRPCActionType, ...args: any[]): void {
|
export function sendRPC(action: IRPCActionType, ...args: any[]): void {
|
||||||
const data = getRawData(args)
|
ipcRenderer.send(RPC_ACTIONS, action, getRawData(args))
|
||||||
ipcRenderer.send(RPC_ACTIONS, action, data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendRpcSync(action: IRPCActionType, ...args: any[]) {
|
export function sendRpcSync(action: IRPCActionType, ...args: any[]) {
|
||||||
const data = getRawData(args)
|
return ipcRenderer.sendSync(RPC_ACTIONS, action, getRawData(args))
|
||||||
return ipcRenderer.sendSync(RPC_ACTIONS, action, data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* trigger RPC action
|
|
||||||
* TODO: create an isolate rpc handler
|
|
||||||
*/
|
|
||||||
export async function triggerRPC<T>(action: IRPCActionType, ...args: any[]): Promise<T | undefined> {
|
export async function triggerRPC<T>(action: IRPCActionType, ...args: any[]): Promise<T | undefined> {
|
||||||
const data = getRawData(args)
|
return await ipcRenderer.invoke(RPC_ACTIONS_INVOKE, action, getRawData(args))
|
||||||
return await ipcRenderer.invoke(RPC_ACTIONS_INVOKE, action, data)
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user