|
|
|
//
|
|
|
|
// MoreFunctionsViewController.m
|
|
|
|
// watch
|
|
|
|
//
|
|
|
|
// Created by weichao on 2018/6/20.
|
|
|
|
// Copyright © 2018年 weichao. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "MoreFunctionsViewController.h"
|
|
|
|
|
|
|
|
#import "messageHearderCell.h"
|
|
|
|
#import "SwitchDeviceView.h"
|
|
|
|
#import "MyMQTT.h"
|
|
|
|
#import "MoreCollectionTableViewCell.h"
|
|
|
|
#import "WatchFunctionCell.h"
|
|
|
|
#import "QueryCallRatesRoFlowVC.h"
|
|
|
|
#import "RedFlowerSetVC.h"
|
|
|
|
#import "NewWSettingTableViewCell.h"
|
|
|
|
#import "FamilyViewController.h"
|
|
|
|
#import "WXPPickerView.h"
|
|
|
|
#import "WhiteContactViewController.h"
|
|
|
|
#import "jjcdViewController.h"
|
|
|
|
#import "DeviceLoseViewController.h"
|
|
|
|
#import "VIPViewController.h"
|
|
|
|
#import "WatchDialViewController.h"
|
|
|
|
|
|
|
|
@interface MoreFunctionsViewController ()<UICollectionViewDelegateFlowLayout>
|
|
|
|
{
|
|
|
|
UITapGestureRecognizer *titleViewTap;
|
|
|
|
UIButton *downBtn;
|
|
|
|
UILabel *titleLabel;
|
|
|
|
NSMutableArray *funcTitlesImage;
|
|
|
|
NSMutableArray *funcTitles;
|
|
|
|
|
|
|
|
NSMutableArray *settingTitles;
|
|
|
|
NSMutableArray *settingTitlesImage;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
微聊的cell
|
|
|
|
*/
|
|
|
|
@property (nonatomic ,weak) WatchFunctionCell * chatCell;
|
|
|
|
/**
|
|
|
|
切换设备的View
|
|
|
|
*/
|
|
|
|
@property (nonatomic, strong) SwitchDeviceView * switchDeviceView;
|
|
|
|
@property (nonatomic, strong) NSMutableArray * myDataTitleArr;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation MoreFunctionsViewController
|
|
|
|
|
|
|
|
@synthesize myDataSource = _myDataSource;
|
|
|
|
|
|
|
|
- (NSMutableArray *)myDataSource{
|
|
|
|
if (!_myDataSource) {
|
|
|
|
settingTitles = [NSMutableArray arrayWithObjects:@"定位模式",@"拒接陌生来电",nil];
|
|
|
|
_myDataSource = [[NSMutableArray alloc] initWithArray:@[@[@"常见功能"],settingTitles]];
|
|
|
|
}
|
|
|
|
return _myDataSource;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSMutableArray *)myDataTitleArr{
|
|
|
|
if (!_myDataTitleArr) {
|
|
|
|
settingTitlesImage = [NSMutableArray arrayWithObjects: @"icon_positioning",@"icon_off", nil];
|
|
|
|
_myDataTitleArr = [[NSMutableArray alloc] initWithArray:@[@[@""],settingTitlesImage]];
|
|
|
|
}
|
|
|
|
return _myDataTitleArr;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)viewWillAppear:(BOOL)animated{
|
|
|
|
[super viewWillAppear:animated];
|
|
|
|
[self loadData];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
[super viewDidLoad];
|
|
|
|
self.title = @"更多服务";
|
|
|
|
self.view.backgroundColor = RGB(248, 248, 254);
|
|
|
|
self.myTableView.backgroundColor = RGB(248, 248, 254);
|
|
|
|
WEAKSELF
|
|
|
|
//MARK: 灭屏后亮屏会 通知
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
|
|
|
|
[weakSelf loadData];
|
|
|
|
}];
|
|
|
|
|
|
|
|
// 初始化3个按钮
|
|
|
|
[self.remoteShutdownBtn setTitle:@"远程关机" forState:UIControlStateNormal];
|
|
|
|
[self.remoteShutdownBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
|
[self.remoteShutdownBtn setBackgroundColor:mainColor];
|
|
|
|
[self.remoteShutdownBtn.titleLabel setFont:[UIFont systemFontOfSize:15]];
|
|
|
|
[self.remoteShutdownBtn addTarget:self action:@selector(RemotePowerOffAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
self.remoteShutdownBtn.layer.cornerRadius = 4;
|
|
|
|
self.remoteShutdownBtn.layer.masksToBounds = YES;
|
|
|
|
|
|
|
|
[self.recoverBtn setTitle:@"解除与设备的绑定" forState:UIControlStateNormal];
|
|
|
|
[self.recoverBtn setTitleColor:mainColor forState:UIControlStateNormal];
|
|
|
|
[self.recoverBtn setBackgroundColor:[UIColor whiteColor]];
|
|
|
|
[self.recoverBtn.titleLabel setFont:[UIFont systemFontOfSize:15]];
|
|
|
|
[self.recoverBtn addTarget:self action:@selector(unbundlingBtn:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
self.recoverBtn.layer.cornerRadius = 4;
|
|
|
|
self.recoverBtn.layer.masksToBounds = YES;
|
|
|
|
|
|
|
|
// // 三个底部约束
|
|
|
|
// if(ScreenHeight < 667){
|
|
|
|
// self.remoteBottomNSLC.constant = ScreenHeight * (8/667.0);
|
|
|
|
// self.recoverBottomNSLC.constant = ScreenHeight * (8/667.0);
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
[self.myTableView registerNib:[UINib nibWithNibName:@"MoreCollectionTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"MoreCollectionTableViewCellID"];
|
|
|
|
[self.myTableView registerNib:[UINib nibWithNibName:@"NewWSettingTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"NewWSettingTableViewCellID"];
|
|
|
|
self.myTableView.bounces = NO; //禁止弹跳
|
|
|
|
self.myTableView.showsHorizontalScrollIndicator = NO;
|
|
|
|
self.myTableView.showsVerticalScrollIndicator = NO;
|
|
|
|
self.scrollView.showsHorizontalScrollIndicator = NO;
|
|
|
|
self.scrollView.showsVerticalScrollIndicator = NO;
|
|
|
|
self.scrollView.bounces = NO;
|
|
|
|
//去线
|
|
|
|
self.myTableView.separatorStyle = UITableViewCellSelectionStyleNone;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)loadData{
|
|
|
|
|
|
|
|
NSLog(@"%@",cUser.cDevice);
|
|
|
|
if (cUser.cDevice.support_whiteList && cUser.cDevice.support_whiteList.intValue !=0) {
|
|
|
|
funcTitles = [NSMutableArray arrayWithArray:@[@"管理员"]];
|
|
|
|
} else {
|
|
|
|
funcTitles = [NSMutableArray arrayWithArray:@[@"电话本"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
funcTitlesImage = [NSMutableArray arrayWithArray:@[@"icon_phonebook"]];
|
|
|
|
|
|
|
|
/*
|
|
|
|
@"监听设备",@"icon_monitor",
|
|
|
|
@"设备闹钟", @"icon_alarm",
|
|
|
|
@"上课禁用" @"icon_disabled"
|
|
|
|
*/
|
|
|
|
|
|
|
|
if(cUser.cDevice.support_video && cUser.cDevice.support_video.intValue != 0){
|
|
|
|
[funcTitles addObject:@"视频通话"];
|
|
|
|
[funcTitlesImage addObject:@"icon_home_video_call"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cUser.cDevice.support_photo && cUser.cDevice.support_photo.intValue == 1){
|
|
|
|
[funcTitles addObject:@"远程拍照"];
|
|
|
|
[funcTitlesImage addObject:@"icon_photography"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cUser.cDevice.support_monitor && cUser.cDevice.support_monitor.intValue == 1) {
|
|
|
|
[funcTitles addObject:@"监听设备"];
|
|
|
|
[funcTitlesImage addObject:@"icon_monitor"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cUser.cDevice.support_alarm && cUser.cDevice.support_alarm.intValue == 1) {
|
|
|
|
[funcTitles addObject:@"设备闹钟"];
|
|
|
|
[funcTitlesImage addObject:@"icon_alarm"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cUser.cDevice.support_disturb && cUser.cDevice.support_disturb.intValue == 1) {
|
|
|
|
[funcTitles addObject:@"上课禁用"];
|
|
|
|
[funcTitlesImage addObject:@"icon_disabled"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cUser.cDevice.support_sos && cUser.cDevice.support_sos.intValue == 1) {
|
|
|
|
[funcTitles addObject:@"SOS号码"];
|
|
|
|
[funcTitlesImage addObject:@"icon_sosnumber"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cUser.cDevice.support_wifi && cUser.cDevice.support_wifi.intValue == 1){
|
|
|
|
[funcTitles addObject:@"设备WIFI"];
|
|
|
|
[funcTitlesImage addObject:@"icon_wifi"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cUser.cDevice.support_timingSwitch && cUser.cDevice.support_timingSwitch.intValue == 1){
|
|
|
|
[funcTitles addObject:@"定时开关机"];
|
|
|
|
[funcTitlesImage addObject:@"icon_off"];
|
|
|
|
}
|
|
|
|
if(cUser.cDevice.support_find && cUser.cDevice.support_find.intValue == 1){
|
|
|
|
[funcTitles addObject:@"查找设备"];
|
|
|
|
[funcTitlesImage addObject:@"icon_looking_for_equipment"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cUser.cDevice.support_step && cUser.cDevice.support_step.intValue == 1){
|
|
|
|
[funcTitles addObject:@"计步"];
|
|
|
|
[funcTitlesImage addObject:@"icon_Pedometer"];
|
|
|
|
}
|
|
|
|
|
|
|
|
// 学生卡
|
|
|
|
if(cUser.cDevice.deviceType && cUser.cDevice.deviceType.intValue == 2) {
|
|
|
|
[funcTitles addObject:@"亲情号"];
|
|
|
|
[funcTitlesImage addObject:@"icon_phonebook"];
|
|
|
|
}
|
|
|
|
|
|
|
|
// 学生资料
|
|
|
|
if(cUser.cDevice.deviceType && cUser.cDevice.deviceType.intValue == 2) {
|
|
|
|
[funcTitles addObject:@"学生资料"];
|
|
|
|
[funcTitlesImage addObject:@"icon_more_watch_data"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cUser.cDevice.support_whiteList && cUser.cDevice.support_whiteList.intValue != 0) {
|
|
|
|
[funcTitles addObject:@"通讯录"];
|
|
|
|
[funcTitlesImage addObject:@"icon_phonebook"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cUser.cDevice.support_callPhone && cUser.cDevice.support_callPhone.intValue == 1) {
|
|
|
|
if (![settingTitles containsObject:@"拨号盘开关"]) {
|
|
|
|
[settingTitles addObject:@"拨号盘开关"];
|
|
|
|
}
|
|
|
|
if (![settingTitlesImage containsObject:@"icon_off"]) {
|
|
|
|
[settingTitlesImage addObject:@"icon_off"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cUser.cDevice.support_family && cUser.cDevice.support_family.intValue == 1)
|
|
|
|
{
|
|
|
|
[funcTitles addObject:@"亲情号"];
|
|
|
|
[funcTitlesImage addObject:@"icon_new_contact_book"];
|
|
|
|
}
|
|
|
|
if(cUser.cDevice.support_healthCode && cUser.cDevice.support_healthCode.intValue == 1)
|
|
|
|
{
|
|
|
|
[funcTitles addObject:@"分享图片"];
|
|
|
|
[funcTitlesImage addObject:@"icon_ttcode_qrcode"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cUser.cDevice.support_hht && cUser.cDevice.support_hht.intValue == 1)
|
|
|
|
{
|
|
|
|
[funcTitles addObject:@"VIP客服"];
|
|
|
|
[funcTitlesImage addObject:@"icon_ttcode_VIP"];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark lsz
|
|
|
|
//[funcTitles addObject:@"课程表"];
|
|
|
|
//[funcTitlesImage addObject:@"icon_more_watch_data"];
|
|
|
|
|
|
|
|
[funcTitles addObject:@"设备资料"];
|
|
|
|
[funcTitlesImage addObject:@"icon_more_watch_data"];
|
|
|
|
|
|
|
|
int number = funcTitles.count % 4;
|
|
|
|
if(number != 0){
|
|
|
|
for (int i = 0; i < 4 - number; i++) {
|
|
|
|
[funcTitles addObject:@""];
|
|
|
|
[funcTitlesImage addObject:@""];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CGFloat commonHeight = ((SWIDTH-3)/ 4)*2+2;
|
|
|
|
if(funcTitles.count > 8 ){
|
|
|
|
commonHeight = ((SWIDTH-3)/ 4)*3+3;
|
|
|
|
}else{
|
|
|
|
commonHeight = ((SWIDTH-3)/ 4)*2+2;
|
|
|
|
}
|
|
|
|
// 头部的总高度 + 常用功能的高度 + 剩下cell 的高度 = tableView要占用的高度
|
|
|
|
CGFloat tableViewHeight = 40*self.myDataSource.count+commonHeight+[self.myDataSource[1] count]*49;
|
|
|
|
//除导航栏外的高度
|
|
|
|
CGFloat smallScreenHeight = ScreenHeight - getRectNavAndStatusHight;
|
|
|
|
//130 是解绑和关机按钮2个按钮 + 间隔的 高度
|
|
|
|
CGFloat tempHeight = 130;
|
|
|
|
if(ScreenHeight >= 812){
|
|
|
|
tempHeight = 150;
|
|
|
|
}
|
|
|
|
if(tableViewHeight+tempHeight >= smallScreenHeight){
|
|
|
|
self.tableViewHeight.constant = tableViewHeight;
|
|
|
|
}else{
|
|
|
|
self.tableViewHeight.constant = smallScreenHeight-tempHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
WEAKSELF
|
|
|
|
[cUser getRelatedDeviceSuccess:^(id responseObject) {
|
|
|
|
[cUser getUserInfoSuccess:nil failure:nil];
|
|
|
|
[weakSelf.myTableView reloadData];
|
|
|
|
|
|
|
|
if (cUser.myDevices.count > 0) {
|
|
|
|
[cUser getRelatedChatGroupSuccess:nil failure:nil];
|
|
|
|
}else{
|
|
|
|
[weakSelf.navigationController popToRootViewControllerAnimated:YES];
|
|
|
|
}
|
|
|
|
} failure:^(id faiObject) {
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
|
|
|
return [self.myDataSource[section] count];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
|
|
|
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 40)];
|
|
|
|
view.backgroundColor = RGB(248, 248, 254);
|
|
|
|
UIView *lineView = [[UILabel alloc] initWithFrame:CGRectMake(14, (40-15)/2.0, 3, 15)];
|
|
|
|
lineView.backgroundColor = mainColor;
|
|
|
|
|
|
|
|
[view addSubview:lineView];
|
|
|
|
|
|
|
|
UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(27, 0, ScreenWidth, 40)];
|
|
|
|
titleLabel.font = [UIFont systemFontOfSize:15];
|
|
|
|
[view addSubview:titleLabel];
|
|
|
|
|
|
|
|
if(section == 0){
|
|
|
|
titleLabel.text = @"常见功能";
|
|
|
|
}else if (section == 1){
|
|
|
|
titleLabel.text = @"设备设置";
|
|
|
|
}
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
|
|
|
return 40;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
if(indexPath.section == 0 && indexPath.row == 0){
|
|
|
|
if(funcTitles.count > 8 ){
|
|
|
|
return ((SWIDTH-3)/ 4)*3+3;
|
|
|
|
}else{
|
|
|
|
return ((SWIDTH-3)/ 4)*2+2;
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
return 49;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
WEAKSELF
|
|
|
|
xLog(@"indexPath.section :%zd indexPath.row: %zd",indexPath.section,indexPath.row);
|
|
|
|
NSString *title = self.myDataSource[indexPath.section][indexPath.row];
|
|
|
|
if(indexPath.section == 0){
|
|
|
|
//常见功能
|
|
|
|
MoreCollectionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MoreCollectionTableViewCellID" forIndexPath:indexPath];
|
|
|
|
|
|
|
|
|
|
|
|
[cell setFuncArrTitles:[funcTitles copy] TitleImage:[funcTitlesImage copy]];
|
|
|
|
|
|
|
|
return cell;
|
|
|
|
}
|
|
|
|
|
|
|
|
NewWSettingTableViewCell *NewWSetCell = [tableView dequeueReusableCellWithIdentifier:@"NewWSettingTableViewCellID" forIndexPath:indexPath];
|
|
|
|
if ([title isEqualToString:@"音量设置"]) {
|
|
|
|
[NewWSetCell setTitle:title AndDetail:[NSString stringWithFormat:@"%@",cUser.cDevice.opSettingVolume] RoShowSwitch:NO];
|
|
|
|
}else if ([title isEqualToString:@"定位模式"]){
|
|
|
|
NSString *tempStr = @"";
|
|
|
|
if ([cUser.cDevice.opLocationMode integerValue] == [cUser.cDevice.location_interval1 integerValue]) {
|
|
|
|
tempStr = cUser.cDevice.location_model1; //@"省电模式";
|
|
|
|
}else if ([cUser.cDevice.opLocationMode integerValue] == [cUser.cDevice.location_interval2 integerValue]){
|
|
|
|
tempStr = cUser.cDevice.location_model2; //@"正常模式";
|
|
|
|
}else if ([cUser.cDevice.opLocationMode integerValue] == [cUser.cDevice.location_interval3 integerValue]){
|
|
|
|
tempStr = cUser.cDevice.location_model3;//@"高频模式";
|
|
|
|
} else {
|
|
|
|
tempStr = cUser.cDevice.location_model2;
|
|
|
|
}
|
|
|
|
[NewWSetCell setTitle:title AndDetail:tempStr RoShowSwitch:NO];
|
|
|
|
}else if ([title isEqualToString:@"拒接陌生来电"]){
|
|
|
|
[NewWSetCell setTitle:title AndDetail:@"" RoShowSwitch:YES];
|
|
|
|
UISwitch *uiSwitch = NewWSetCell.switchBtn;
|
|
|
|
uiSwitch.on = [cUser.cDevice.opRejectStrangeCall boolValue];
|
|
|
|
NewWSetCell.cellBack = ^(UISwitch *uiSwitch, NewWSettingTableViewCell *blockCell) {
|
|
|
|
|
|
|
|
// add by lsz 2021-06-10
|
|
|
|
UIAlertController *alert = nil;
|
|
|
|
NSString *tmp = title;
|
|
|
|
alert = [myHelper getAlertWithTitle:tmp
|
|
|
|
message:@"\n开启时,只有通讯录的联系人才能双向通话,防止陌生人骚扰"
|
|
|
|
actionTitles:@[@"确定"]
|
|
|
|
style:UIAlertControllerStyleAlert
|
|
|
|
block:^(UIAlertAction *action)
|
|
|
|
{
|
|
|
|
NSLog(@"%@ -- %d", action.title, uiSwitch.on);
|
|
|
|
if ([action.title isEqualToString:@"确定"]) {
|
|
|
|
[cUser.cDevice editOperationDeviceInfoWithParameters:@{@"opRejectStrangeCall":@(uiSwitch.on)}
|
|
|
|
success:^(id responseObject) {
|
|
|
|
cUser.cDevice.opRejectStrangeCall = @(uiSwitch.on);
|
|
|
|
} failure:^(id faiObject) {
|
|
|
|
uiSwitch.on = !uiSwitch.on;
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
if([action.title isEqualToString:@"取消"]) {
|
|
|
|
uiSwitch.on = !uiSwitch.on;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
];
|
|
|
|
[self presentViewController:alert animated:YES completion:nil];
|
|
|
|
|
|
|
|
};
|
|
|
|
} else if ([title isEqualToString:@"拨号盘开关"]) {
|
|
|
|
[NewWSetCell setTitle:title AndDetail:@"" RoShowSwitch:YES];
|
|
|
|
UISwitch *uiSwitch = NewWSetCell.switchBtn;
|
|
|
|
uiSwitch.on = [cUser.cDevice.opDialSwitch boolValue];
|
|
|
|
NewWSetCell.cellBack = ^(UISwitch *uiSwitch, NewWSettingTableViewCell *blockCell) {
|
|
|
|
[cUser.cDevice editOperationDeviceInfoWithParameters:@{@"opCallPhone":@(uiSwitch.on)}
|
|
|
|
success:^(id responseObject) {
|
|
|
|
cUser.cDevice.opDialSwitch = @(uiSwitch.on);
|
|
|
|
} failure:^(id faiObject) {
|
|
|
|
uiSwitch.on = !uiSwitch.on;
|
|
|
|
}];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
int type = 0;
|
|
|
|
if(([self.myDataSource[indexPath.section] count] -1) == indexPath.row){
|
|
|
|
//这个区间的最后一个
|
|
|
|
type = 2;
|
|
|
|
}else if (indexPath.row == 0){
|
|
|
|
//这个区间的第一个
|
|
|
|
type = 1;
|
|
|
|
}
|
|
|
|
[NewWSetCell setBackViewCornerWithType:type];
|
|
|
|
|
|
|
|
return NewWSetCell;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
NSString *title = self.myDataSource[indexPath.section][indexPath.row];
|
|
|
|
if ([title hasPrefix:@"cell"]) {
|
|
|
|
if ([title hasSuffix:@"设备信息"]) {
|
|
|
|
[self performSegueWithIdentifier:@"goEditDeviceVC" sender:nil];
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if ([title isEqualToString:@"SOS号码"]) {
|
|
|
|
[self performSegueWithIdentifier:@"goSOSVC" sender:nil];
|
|
|
|
}else if ([title isEqualToString:@"监听设备"]){
|
|
|
|
[self performSegueWithIdentifier:@"goMonitorVC" sender:nil];
|
|
|
|
}else if ([title isEqualToString:@"远程拍照"]){
|
|
|
|
[self performSegueWithIdentifier:@"goRemoteCameraVC" sender:nil];
|
|
|
|
}else if ([title isEqualToString:@"二维码"]){
|
|
|
|
[self performSegueWithIdentifier:@"goQRcodeVC" sender:nil];
|
|
|
|
}else if ([title isEqualToString:@"音量设置"]){
|
|
|
|
[self performSegueWithIdentifier:@"goVolumeVC" sender:nil];
|
|
|
|
}else if ([title isEqualToString:@"定位模式"]){
|
|
|
|
[self performSegueWithIdentifier:@"goLocationModeVC" sender:nil];
|
|
|
|
}else if ([title isEqualToString:@"远程关机"]){
|
|
|
|
UIAlertController *alert = nil;
|
|
|
|
NSString *tmp = title;
|
|
|
|
alert = [myHelper getAlertWithTitle:tmp
|
|
|
|
message:@"\n设备将会远程关机,“是否”确认"
|
|
|
|
actionTitles:@[@"确定"]
|
|
|
|
style:UIAlertControllerStyleAlert
|
|
|
|
block:^(UIAlertAction *action)
|
|
|
|
{
|
|
|
|
if ([action.title isEqualToString:@"确定"]) {
|
|
|
|
[self performOperationWithName:title];
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
[self presentViewController:alert animated:YES completion:nil];
|
|
|
|
|
|
|
|
}else if([title isEqualToString:@"视频通话"]){
|
|
|
|
//在 MoreCollectionCell.m 里面
|
|
|
|
}else if([title isEqualToString:@"亲情号"]) {
|
|
|
|
FamilyViewController *vc = [[FamilyViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}else if([title isEqualToString:@"通讯录"]){
|
|
|
|
WhiteContactViewController *vc = [[WhiteContactViewController alloc] init];
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}
|
|
|
|
// else if([title isEqualToString:@"亲情号"])
|
|
|
|
// {
|
|
|
|
// FamilyViewController *vc = [[FamilyViewController alloc] init];
|
|
|
|
// [self.navigationController pushViewController:vc animated:YES];
|
|
|
|
// }
|
|
|
|
else if([title isEqualToString:@"分享图片"])
|
|
|
|
{
|
|
|
|
jjcdViewController *vc = [jjcdViewController new];
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}
|
|
|
|
else if([title isEqualToString:@"设备防丢"])
|
|
|
|
{
|
|
|
|
DeviceLoseViewController *vc = [DeviceLoseViewController new];
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}
|
|
|
|
else if ([title isEqualToString:@"VIP客服"])
|
|
|
|
{
|
|
|
|
VIPViewController *vc = [VIPViewController new];
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}
|
|
|
|
else if ([title isEqualToString:@"表盘中心"])
|
|
|
|
{
|
|
|
|
WatchDialViewController *vc = [WatchDialViewController new];
|
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
解除绑定 方法
|
|
|
|
*/
|
|
|
|
- (void)unbundlingBtn:(id)sender {
|
|
|
|
// 管理员显示--- 您是设备的管理员,如果您进行解绑,其他绑定该设备的用户,将自动解绑,确认解除绑定吗? F
|
|
|
|
NSString *title = @"解绑设备";
|
|
|
|
NSString *msg = @"\n解除绑定后,将无法对设备进行监护,设备将重启,其他绑定该设备的用户,将自动解绑";
|
|
|
|
if([cUser.cDevice.identity isEqualToString:@"admin"]){
|
|
|
|
msg = @"\n您是设备的管理员,如果您进行解绑,其他绑定该设备的用户,将自动解绑,确认解除绑定吗?";
|
|
|
|
}
|
|
|
|
|
|
|
|
//如果是 imei号登陆
|
|
|
|
int type = [myHelper getNowAccoutType:cUser];
|
|
|
|
if(type == 3){
|
|
|
|
msg = @"\n解除绑定后,设备将被恢复出厂设置,确认解除绑定吗?";
|
|
|
|
}
|
|
|
|
UIAlertController *sheet = [myHelper getAlertWithTitle:title
|
|
|
|
message:msg
|
|
|
|
actionTitles:@[@"确定"]
|
|
|
|
style:UIAlertControllerStyleAlert
|
|
|
|
block:^(UIAlertAction *action)
|
|
|
|
{
|
|
|
|
if ([action.title isEqualToString:@"确定"]) {
|
|
|
|
NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
|
|
|
|
[parameters setObject:cUser.cDevice.imei forKey:@"imei"];
|
|
|
|
[cUser deleteDeviceSuccess:^(id responseObject) {
|
|
|
|
int type = [myHelper getNowAccoutType:cUser];
|
|
|
|
if(type == 3){
|
|
|
|
//如果是 imei 号 直接 退出登录
|
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"outLogin" object:nil];
|
|
|
|
}else{
|
|
|
|
//回到首页
|
|
|
|
[self.navigationController popToRootViewControllerAnimated:YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
} failure:^(id faiObject) {
|
|
|
|
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
[self presentViewController:sheet animated:YES completion:nil];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)RemotePowerOffAction:(UIButton*)sender{
|
|
|
|
NSString *title = sender.titleLabel.text;
|
|
|
|
UIAlertController *alert = nil;
|
|
|
|
NSString *tmp = title;
|
|
|
|
alert = [myHelper getAlertWithTitle:tmp
|
|
|
|
message:@"\n设备将会远程关机,“是否”确认"
|
|
|
|
actionTitles:@[@"确定"]
|
|
|
|
style:UIAlertControllerStyleAlert
|
|
|
|
block:^(UIAlertAction *action)
|
|
|
|
{
|
|
|
|
if ([action.title isEqualToString:@"确定"]) {
|
|
|
|
[self performOperationWithName:title];
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
[self presentViewController:alert animated:YES completion:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)performOperationWithName:(NSString *)title{
|
|
|
|
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
|
|
|
|
if ([title isEqualToString:@"远程关机"] ){
|
|
|
|
if ([title isEqualToString:@"远程关机"]) {
|
|
|
|
[parameters setObject:@(YES) forKey:@"opPowerOff"];
|
|
|
|
}
|
|
|
|
|
|
|
|
[cUser.cDevice editOperationDeviceInfoWithParameters:parameters success:^(id responseObject) {
|
|
|
|
if ([title isEqualToString:@"远程关机"]){
|
|
|
|
[UICommon MessageSuccessText:@"远程关机成功" isImg:YES];
|
|
|
|
}
|
|
|
|
} failure:^(id faiObject) {
|
|
|
|
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didReceiveMemoryWarning {
|
|
|
|
[super didReceiveMemoryWarning];
|
|
|
|
// Dispose of any resources that can be recreated.
|
|
|
|
}
|
|
|
|
@end
|