diff --git a/src/composables/useHandleScreen.ts b/src/composables/useHandleScreen.ts index 92a9aec..e67d21b 100644 --- a/src/composables/useHandleScreen.ts +++ b/src/composables/useHandleScreen.ts @@ -53,7 +53,10 @@ export const useHandleScreen = (callback: () => void) => { } //跳转屏保挂载到全局 供app使用 - window.sleepToWallpaper = sleepToWallpaper + window.sleepToWallpaper = async () => { + await sleepToWallpaper() + nativeMethods.value?.goScreenSave() + } async function checkHandleScreen() { toIndexTime.value = totalTime.value[0] diff --git a/src/composables/useSearchShop.ts b/src/composables/useSearchShop.ts index 914a71b..576965f 100644 --- a/src/composables/useSearchShop.ts +++ b/src/composables/useSearchShop.ts @@ -4,13 +4,13 @@ import type { Ref, ShallowRef } from 'vue' /** * @param {*} watchName * @param {Ref>} [searchType=0] 0:键盘搜索 1:手写搜索 - * @return {*} [searchShopListRef] + * @return {*} [searchShopList] */ -export const useSearchShop = (watchName: Ref, searchType: Ref<0 | 1>): { searchShopListRef: ShallowRef } => { +export const useSearchShop = (watchName: Ref, searchType: Ref<0 | 1>): { searchShopList: ShallowRef } => { const store = useRootStore() - const searchShopListRef = shallowRef([]) - const cacheFirstSearchListRef = shallowRef([]) //缓存第一次检索首字母后的列表结果 - const shopListRef = computed(() => store.shopList) + const searchShopList = shallowRef([]) + const cacheFirstSearchList = shallowRef([]) //缓存第一次检索首字母后的列表结果 + const shopList = computed(() => store.shopList) watch(watchName, val => { if (val.length) { @@ -18,29 +18,31 @@ export const useSearchShop = (watchName: Ref, searchType: Ref<0 | 1>): { let _shopList: Shop[] = [] if (val.length === 1) { //缓存第一次搜索结果 - cacheFirstSearchListRef.value = shopListRef.value.filter( + cacheFirstSearchList.value = shopList.value.filter( item => item.initials?.toUpperCase()?.startsWith(val) || item.shopNameEn?.toUpperCase()?.startsWith(val) || - item.shopName?.toUpperCase()?.startsWith(val) + item.shopName?.toUpperCase()?.startsWith(val) || + item.spelling?.toUpperCase()?.startsWith(val) ) } else { const searchName = val.slice(1) - _shopList = cacheFirstSearchListRef.value.filter( + _shopList = cacheFirstSearchList.value.filter( item => item.initials?.toUpperCase()?.includes(searchName) || item.shopNameEn?.toUpperCase()?.includes(searchName) || - item.shopName?.toUpperCase()?.includes(searchName) + item.shopName?.toUpperCase()?.includes(searchName) || + item.spelling?.toUpperCase()?.includes(searchName) ) } - searchShopListRef.value = val.length === 1 ? cacheFirstSearchListRef.value : _shopList + searchShopList.value = val.length === 1 ? cacheFirstSearchList.value : _shopList } else { - searchShopListRef.value = val.length ? shopListRef.value.filter(item => item.shopName.includes(val)) : [] + searchShopList.value = val.length ? shopList.value.filter(item => item.shopName.includes(val)) : [] } } else { - searchShopListRef.value = [] - cacheFirstSearchListRef.value = [] + searchShopList.value = [] + cacheFirstSearchList.value = [] } }) - return { searchShopListRef } + return { searchShopList } } diff --git a/src/types/native.d.ts b/src/types/native.d.ts index 6172c08..29a782b 100644 --- a/src/types/native.d.ts +++ b/src/types/native.d.ts @@ -42,7 +42,7 @@ export declare global { hasProgram(): boolean //是否有节目列表 用于前端导视是否弹起屏保弹框 } interface Window { - sleepToWallpaper(): Promise + sleepToWallpaper(): void android: NativeMethods chrome: { webview: {