minix-template
Version:
minix template
183 lines (181 loc) • 3.74 kB
JavaScript
/*
* @Description:
* @Autor: tangsj
* @Date: 2022-05-12 19:08:11
* @LastEditTime: 2022-05-23 16:37:09
*/
import router from '@system.router'
import prompt from '@system.prompt'
export default {
data: {
roomList:[
{
name:'getRoomInfo',
// url:'pages/base/canlUse/index',
describe:'获取房间信息'
},
{
name:'getAllRoomInfoList',
// url:'pages/base/log/index',
describe:'获取房间列表'
},
{
name:'createRoom',
// url:'pages/base/canlUse/index',
describe:'创建房间'
},
{
name:'deleteRoom',
// url:'pages/base/log/index',
describe:'删除房间'
},
{
name:'updateRoomInfo',
// url:'pages/base/log/index',
describe:'更新房间信息'
}
]
},
goRouter(url){
router.push({
uri: url,
})
},
/**
* @description: 获取房间信息
* @param {*}
* @return {*}
*/
getRoomInfo(){
const params = {
homeId: "家庭id 必填",
roomId: "房间id 必填",
hasDeviceInfo: "0:不包含设备列表数据,1:包含房间下设备列表数据"
}
this.$app.$def.bridge.getRoomInfo(params).then((res)=>{
prompt.showToast({
message: res,
duration: 200,
})
}).catch((err)=>{
prompt.showToast({
message: '接口调用失败',
duration: 200,
})
})
},
/**
* @description: 获取房间列表
* @param {*}
* @return {*}
*/
getAllRoomInfoList(){
const params = {
homeId: '111',
hasDeviceInfo:'0'
}
this.$app.$def.bridge.getAllRoomInfoList(params).then((res)=>{
prompt.showToast({
message: res,
duration: 200,
})
}).catch((err)=>{
prompt.showToast({
message: '接口调用失败',
duration: 200,
})
})
},
/**
* @description: 创建房间
* @param {*}
* @return {*}
*/
createRoom(){
const params = {
homeId: "123",
name: "xxx",
des: "dfff",
icon: "2"
}
this.$app.$def.bridge.createRoom(params).then((res)=>{
prompt.showToast({
message: res,
duration: 200,
})
}).catch((err)=>{
prompt.showToast({
message: '接口调用失败',
duration: 200,
})
})
},
/**
* @description: 删除房间
* @param {*}
* @return {*}
*/
deleteRoom(){
const params = {
homeId:'123',
roomId:'12'
}
this.$app.$def.bridge.deleteRoom(params).then((res)=>{
prompt.showToast({
message: res,
duration: 200,
})
}).catch((err)=>{
prompt.showToast({
message: '接口调用失败',
duration: 200,
})
})
},
/**
* @description:更新房间信息
* @param {*}
* @return {*}
*/
updateRoomInfo(){
const params = {
homeId: "123",
roomId:'12',
name: "xxx",
des: "dfff",
icon: "2"
}
this.$app.$def.bridge.updateRoomInfo(params).then((res)=>{
prompt.showToast({
message: res,
duration: 200,
})
}).catch((err)=>{
prompt.showToast({
message: '接口调用失败',
duration: 200,
})
})
},
testBridge(name){
switch(name){
case 'getRoomInfo':
this.getRoomInfo()
break;
case 'getAllRoomInfoList':
this.getAllRoomInfoList()
break;
case 'createRoom':
this.createRoom()
break;
case 'deleteRoom':
this.deleteRoom()
break;
case 'updateRoomInfo':
this.updateRoomInfo()
break;
default:
break;
}
}
}