UNPKG

minix-template

Version:

minix template

275 lines (260 loc) 7.56 kB
// const module = miniXs.requireModule('bridgeModule') // import bridgeModule from '@minix-iot/jsbridge-sdk' import ability from '@system.ability' import prompt from '@system.prompt' export default { data: { testTitle: 'requestDataTransmit接口', abilityText: 'ability.getBundlePath测试', }, launch100: function () { const _this = this const param = { type: '0xAC', // 可不传,该字段对应 云端proType字段 queryStrings: { // 对应云端请求头param字段in handleType: 'GetWasherCost', applianceId: '2199023350873', resultType: 0, expendType: 3, time: '20180803', }, transmitData: { // 对应云端请求头data字段 --ps:云端的data字段是string 类型,js里的transmitData是json对象,由APP端转字符串并且加密后传给云端 // (注意key值不能是data字段) handleType: 'GetWasherCost', applianceId: '2199023350873', resultType: 0, expendType: 3, time: '20180803', }, } // aceConsole.info('[JS Framework] (debug) %s', 'bridge test click success') // prompt.showToast({ // message: module.requestDataTransmit, // duration: 200, // // }) // bridgeModule.getBatteryInfo() // .then(res => { // prompt.showToast({ // message: '成功', // duration: 200, // }) // _this.testTitle=JSON.stringify(res) // }) // .catch(err => { // prompt.showToast({ // message: '测试接口失败', // duration: 200, // }) // }) this.$app.$def.module.requestDataTransmit(param, (data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) _this.testTitle = JSON.stringify(data) prompt.showToast({ message: '测试接口成功', duration: 200, }) },(err)=>{ _this.testTitle = JSON.stringify(err) prompt.showToast({ message: '测试接口失败', duration: 200, }) }) }, // launch00: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // const _this = this // module.getSystemInfo((data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch01: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // const _this = this // module.vibrateShort((data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch02: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // const _this = this // module.getAllConnectedDeviceInfo((data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch03: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // let params = { // ssid: 'Smart-HK', // password: 'hktest2020', // } // const _this = this // module.getAllConnectedDeviceInfo(params, (data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch04: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // const _this = this // module.getAllHomeInfoList((data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch05: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // const params = { // homeId: '1', // roomId: '1', // hasDeviceInfo: '1', // } // const _this = this // module.getAllHomeInfoList(params, (data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch06: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // const params = { count: 9 } // const _this = this // module.chooseImage(params, (data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch07: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // const _this = this // module.getLocation((data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch08: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // let params = { // type: 'md5', // data: 'testdata', // } // const _this = this // module.encrypt(params, (data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch09: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // let params = { // type: 'md5', // data: 'testdata', // } // const _this = this // module.encrypt(params, (data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, // launch10: function () { // prompt.showToast({ // message: '开始测试接口', // duration: 200, // }) // let params = { // isNeedRefresh: true, // } // const _this = this // module.getAppWeatherInfo(params, (data) => { // aceConsole.info('回调数据:' + JSON.stringify(data)) // _this.apiData = JSON.stringify(data) // prompt.showToast({ // message: '测试接口成功', // duration: 200, // }) // }) // }, launch11: function () { prompt.showToast({ message: '开始测试ability接口', duration: 200, }) const path = ability.getBundlePath() this.abilityText = JSON.stringify(path) }, }