UNPKG

minix-template

Version:

minix template

144 lines (142 loc) 3.08 kB
/* * @Description: * @Autor: tangsj * @Date: 2022-05-11 14:17:33 * @LastEditTime: 2022-05-23 16:38:59 */ import router from '@system.router' import prompt from '@system.prompt' export default { data: { siriList:[ { name:'canUseSiriShortcut', // url:'pages/base/canlUse/index', describe:'获取ios设备,是否支持SiriShortcut' }, { name:'addSceneToSiriShortcut', // url:'pages/base/log/index', describe:'添加场景到Siri Shortcut' }, { name:'getAllSiriShortcuts', // url:'pages/base/canlUse/index', describe:'获取场景里的所有Siri Shortcut 列表' }, { name:'editSiriShortcut', // url:'pages/base/log/index', describe:'编辑场景Siri Shortcut' } ] }, goRouter(url){ router.push({ uri: url, }) }, /** * @description: 获取ios设备,是否支持SiriShortcut * @param {*} * @return {*} */ canUseSiriShortcut(){ this.$app.$def.bridge.canUseSiriShortcut() .then((res)=>{ prompt.showToast({ message: res, duration: 200, }) }).catch((err)=>{ prompt.showToast({ message: '接口调用失败', duration: 200, }) }) }, /** * @description: 添加场景到Siri Shortcut * @param {*} * @return {*} */ addSceneToSiriShortcut(){ const params = { homegroupId: '1', sceneId: '1', sceneName: '1', } this.$app.$def.bridge.addSceneToSiriShortcut(params) .then((res)=>{ prompt.showToast({ message: res, duration: 200, }) }).catch((err)=>{ prompt.showToast({ message: '接口调用失败', duration: 200, }) }) }, /** * @description: 获取场景里的所有Siri Shortcut 列表 * @param {*} * @return {*} */ getAllSiriShortcuts(){ this.$app.$def.bridge.getAllSiriShortcuts() .then((res)=>{ prompt.showToast({ message: res, duration: 200, }) }).catch((err)=>{ prompt.showToast({ message: '接口调用失败', duration: 200, }) }) }, /** * @description: 编辑场景Siri Shortcut * @param {*} * @return {*} */ editSiriShortcut(){ const params = { homegroupId: '1', sceneId: '1', } this.$app.$def.bridge.editSiriShortcut(params) .then((res)=>{ prompt.showToast({ message: res, duration: 200, }) }).catch((err)=>{ prompt.showToast({ message: '接口调用失败', duration: 200, }) }) }, testBridge(name){ switch(name){ case 'canUseSiriShortcut': this.canUseSiriShortcut() break; case 'addSceneToSiriShortcut': this.addSceneToSiriShortcut() break; case 'getAllSiriShortcuts': this.getAllSiriShortcuts() break; case 'editSiriShortcut': this.editSiriShortcut() break; default: break; } } }