addListCtrl.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. angular.module('push')
  2. .controller('addListCtrl', function ($scope, $ionicHistory, $ionicActionSheet, $ionicModal, $ionicPopup, $timeout, ConfigService,
  3. UserService, UtilService, DockingService, ModelService, $ionicScrollDelegate, HandleService, SqliteStorageService, $ionicSlideBoxDelegate) {
  4. if($scope.app){
  5. $scope.setStatusBar(0);
  6. }
  7. $scope.folderlist = ModelService.getLocalFolderList();//分类列表
  8. $scope.checkdefolder = ModelService.getCheckdeFolder();//选中的分类
  9. $scope.search = {searchkey: ""};
  10. var handleFolderData = function (tempfolderlist, tempconninfolist) {
  11. HandleService.handleFolderData(tempfolderlist, tempconninfolist).then(function (response) {
  12. $scope.folderlist = response.folderlist;
  13. angular.forEach($scope.folderlist, function (value, index) {
  14. if (value.localid == $scope.checkdefolder.localid) {
  15. $scope.checkdefolder = angular.copy(value);
  16. ModelService.setCheckdeFolder($scope.checkdefolder);
  17. }
  18. });
  19. ModelService.setLocalFolderList($scope.folderlist);
  20. }, function () {
  21. })
  22. };
  23. var getFolderList = function () {
  24. var sql = "select * from conninfofolder where userid = " + UserService.id + " and isCloud = 0";
  25. SqliteStorageService.queryData(sql).then(function (response) {
  26. var sql = "select * from conninfo where creator = " + UserService.id + " order by conntime desc";
  27. SqliteStorageService.queryData(sql).then(function (response2) {
  28. handleFolderData(response, response2);
  29. }, function () {
  30. });
  31. }, function () {
  32. });
  33. };
  34. // getFolderList();
  35. //新增或已有数据
  36. if (angular.isDefined(ModelService.getConninfo().date)) {
  37. $scope.record = ModelService.getConninfo();
  38. } else {
  39. $scope.record = {
  40. date: UtilService.formatDate().formattime3,
  41. title: "",
  42. flag: 0,
  43. content: ""
  44. };
  45. }
  46. $scope.imagelist = ModelService.getImageList();//图片
  47. $scope.cardlist = ModelService.getCardList();
  48. $ionicModal.fromTemplateUrl('templates/modal.html', {
  49. scope: $scope,
  50. animation: 'slide-in-up'
  51. }).then(function (modal) {
  52. $scope.modal = modal;
  53. });
  54. // 自定义新建分类弹窗
  55. $scope.showPopup = function () {
  56. $ionicPopup.show({
  57. template: "<div style='height: 70px;'>" +
  58. "<input type='text' maxlength='20' ng-model='folder.name' style='border-radius:4px;border:1px solid #e9e9ea;text-indent: 11px;'>" +
  59. "<span class='pop_subtitle'>20个字以内,支持中英文,数字。</span>" +
  60. "</div>",
  61. title: '新建文件夹',
  62. scope: $scope,
  63. buttons: [
  64. {
  65. text: '取消',
  66. type: 'button-default',
  67. onTap: function () {
  68. $scope.folder.name = "";
  69. }
  70. },
  71. {
  72. text: '<span class="pop_right_button">创建</span>',
  73. type: 'button-positive',
  74. onTap: function (e) {
  75. if (!UtilService.isDefined($scope.folder.name)) {
  76. UtilService.showMess("文件夹名称不能为空");
  77. e.preventDefault();
  78. return;
  79. }
  80. if ($scope.folder.name == "默认文件夹") {
  81. UtilService.showMess("默认文件夹已存在");
  82. e.preventDefault();
  83. return;
  84. }
  85. createFolder();
  86. }
  87. }
  88. ]
  89. });
  90. };
  91. $scope.folder = {name: ""};
  92. //新建分类
  93. var crfoflg = 0;
  94. var createFolder = function () {
  95. if (crfoflg != 0) {
  96. return;
  97. }
  98. crfoflg = 1;
  99. var tempdate = UtilService.formatDate();
  100. var folder = {
  101. localid: tempdate.timestamp + "",//本地id
  102. id: 0,
  103. userid: UserService.id,
  104. usercomefrom: ConfigService.comefrom,
  105. name: $scope.folder.name,
  106. createtime: tempdate.formattime,
  107. status: 0,
  108. isCloud: 0,
  109. synchrotype: 1,// 0:已同步,1:新增,2:修改,3:逻辑删除,4:物理删除
  110. updatetime: tempdate.formattime,//修改时间
  111. counts: 0
  112. };
  113. SqliteStorageService.insertSingleData("conninfofolder", folder).then(function (response) {
  114. $scope.folderlist.push(folder);
  115. $scope.checkdefolder = folder;
  116. $scope.folder.name = "";
  117. $scope.modal.hide();
  118. ModelService.setLocalFolderList($scope.folderlist);
  119. ModelService.setCheckdeFolder(folder);
  120. SqliteStorageService.updateEditFlg(1);
  121. $timeout(function () {
  122. crfoflg = 0;
  123. }, 1000);
  124. }, function () {
  125. crfoflg = 0;
  126. });
  127. };
  128. //选择分类
  129. $scope.chooseNewUndid = function (folder, index) {
  130. ModelService.setCheckdeFolder(folder);
  131. $scope.checkdefolder = folder;
  132. $scope.modal.hide();
  133. };
  134. var tempimages = [];
  135. var uploadImages = function (temprecord) {
  136. tempimages = [];
  137. var upimages = [];
  138. angular.forEach($scope.imagelist, function (data) {
  139. upimages.push(data.photo_name);
  140. });
  141. UtilService.uploadFile(upimages, 0, "image/jpeg").then(function (response) {
  142. angular.forEach(response, function (value, index) {
  143. if (value.status) {
  144. tempimages.push({id: 0, photo_name: value.userPhoto, original_name: value.originalPhoto});
  145. } else {
  146. tempimages.push({
  147. id: 0,
  148. photo_name: $scope.imagelist[index].photo_name,
  149. original_name: $scope.imagelist[index].original_name
  150. });
  151. }
  152. });
  153. $timeout(function () {
  154. saveInformation(temprecord);
  155. }, 100);
  156. }, function () {
  157. saveInformation(temprecord);
  158. $scope.hideLoadingToast();
  159. UtilService.showMess("网络不给力,请重试");
  160. })
  161. };
  162. var checknum = 1;
  163. $scope.addisover = 0;
  164. var uptemprecord = {};
  165. var imagelist = [];
  166. var saveInformation = function (temprecord) {
  167. try {
  168. var conninfodate = UtilService.formatDate();
  169. var conninfodatelocalid = conninfodate.timestamp;
  170. //对接信息数据生成
  171. temprecord.localid = conninfodatelocalid + "";
  172. temprecord.localclaid = $scope.checkdefolder.localid;
  173. temprecord.id = 0;
  174. temprecord.claid = $scope.checkdefolder.id;
  175. temprecord.creator = UserService.id;
  176. temprecord.synchrotype = 1;
  177. temprecord.createtime = conninfodate.formattime;
  178. temprecord.updatetime = conninfodate.formattime;
  179. temprecord.creatorcomefrom = ConfigService.comefrom;
  180. temprecord.status = 2;
  181. temprecord.defaultFlag = 0;
  182. uptemprecord = temprecord;
  183. //图片列表数据生成
  184. imagelist = tempimages.length > 0 ? tempimages : $scope.imagelist;
  185. if (imagelist.length > 0) {
  186. checknum++;
  187. }
  188. angular.forEach(imagelist, function (value, index) {
  189. imagelist[index].localid = conninfodatelocalid + index + "";
  190. imagelist[index].localinfoid = conninfodatelocalid + "";
  191. imagelist[index].id = 0;
  192. imagelist[index].infoid = temprecord.id;
  193. });
  194. if ($scope.cardlist.length > 0) {
  195. checknum++;
  196. }
  197. //名片(单位、人员、主题)数据生成
  198. var personlist = [];
  199. var themelist = [];
  200. var date = new Date();
  201. angular.forEach($scope.cardlist, function (value, index) {
  202. var tempcardlocalid = conninfodatelocalid + index;
  203. date.setSeconds(date.getSeconds() + index);
  204. $scope.cardlist[index].localid = tempcardlocalid + "";
  205. $scope.cardlist[index].localinfoid = conninfodatelocalid + "";
  206. $scope.cardlist[index].id = 0;
  207. $scope.cardlist[index].infoid = temprecord.id;
  208. $scope.cardlist[index].creator = UserService.id;
  209. $scope.cardlist[index].synchrotype = 1;
  210. $scope.cardlist[index].creatorcomefrom = ConfigService.comefrom;
  211. $scope.cardlist[index].createtime = date.Format("yyyy-MM-dd hh:mm:ss");
  212. $scope.cardlist[index].updatetime = date.Format("yyyy-MM-dd hh:mm:ss");
  213. angular.forEach(value.personlist, function (value, ind) {
  214. var tempperson = value;
  215. tempperson.localid = tempcardlocalid + ind + "";
  216. tempperson.localuid = tempcardlocalid + "";
  217. tempperson.id = 0;
  218. tempperson.uid = 0;
  219. personlist.push(tempperson);
  220. });
  221. angular.forEach(value.themelist, function (value, ind) {
  222. var temtheme = value;
  223. temtheme.localid = tempcardlocalid + ind + "";
  224. temtheme.localuid = tempcardlocalid + "";
  225. temtheme.id = 0;
  226. temtheme.uid = 0;
  227. themelist.push(temtheme);
  228. });
  229. });
  230. if (personlist.length > 0) {
  231. checknum++;
  232. }
  233. if (themelist.length > 0) {
  234. checknum++;
  235. }
  236. } catch (e) {
  237. $scope.hideLoadingToast();
  238. }
  239. SqliteStorageService.insertSingleData("conninfo", temprecord).then(function () {
  240. $scope.addisover++;
  241. }, function () {
  242. $scope.hideLoadingToast();
  243. });
  244. if (imagelist.length > 0) {
  245. SqliteStorageService.insertBatchData("conninfopicture", imagelist).then(function () {
  246. $scope.addisover++;
  247. }, function () {
  248. $scope.hideLoadingToast();
  249. });
  250. }
  251. if ($scope.cardlist.length > 0) {
  252. SqliteStorageService.insertBatchData("conninfounit", $scope.cardlist).then(function () {
  253. $scope.addisover++;
  254. }, function () {
  255. $scope.hideLoadingToast();
  256. });
  257. }
  258. if (personlist.length > 0) {
  259. SqliteStorageService.insertBatchData("conninfoperson", personlist).then(function () {
  260. $scope.addisover++;
  261. }, function () {
  262. $scope.hideLoadingToast();
  263. });
  264. }
  265. if (themelist.length > 0) {
  266. SqliteStorageService.insertBatchData("conninfotheme", themelist).then(function () {
  267. $scope.addisover++;
  268. }, function () {
  269. $scope.hideLoadingToast();
  270. });
  271. }
  272. };
  273. //公共批量更新
  274. var updateBatchData = function (tablename, datalist) {
  275. SqliteStorageService.updateBatchData(tablename, datalist).then(function () {
  276. }, function () {
  277. });
  278. };
  279. //共享对接记录至云文件夹
  280. var shareConninfoToCloudFolder = function (claid) {
  281. //同步记录
  282. uptemprecord.claid = claid;
  283. if (ModelService.sharecloudflg) {
  284. uptemprecord.cloudfolder = ModelService.getShareCloudIdList().join(",");
  285. } else {
  286. uptemprecord.cloudfolder = "";
  287. }
  288. uptemprecord.picture = imagelist;
  289. DockingService.singleSync(2, [uptemprecord]).then(function (res) {
  290. if (angular.isDefined(res.recordReturnList) && res.recordReturnList.length > 0) {
  291. var tconninfo = {};
  292. tconninfo.localid = res.recordReturnList[0].localid;
  293. tconninfo.id = res.recordReturnList[0].id;
  294. tconninfo.claid = res.recordReturnList[0].claid;
  295. tconninfo.synchrotype = 0;
  296. //同步名片
  297. if ($scope.cardlist.length > 0) {
  298. angular.forEach($scope.cardlist, function (value, index) {
  299. $scope.cardlist[index].infoid = res.recordReturnList[0].id;
  300. });
  301. DockingService.singleSync(3, $scope.cardlist).then(function (res) {
  302. // console.log("新建记录--名片同步成功");
  303. // console.log(res);
  304. if (angular.isDefined(res.cardReturnList) && res.cardReturnList.length > 0) {
  305. var tempunitlist = [];
  306. angular.forEach(res.cardReturnList, function (value, index) {
  307. var tunit = {};
  308. tunit.localid = value.localid;
  309. tunit.id = value.id;
  310. tunit.infoid = value.infoid;
  311. tunit.synchrotype = 0;
  312. tempunitlist.push(tunit);
  313. });
  314. updateBatchData("conninfounit", tempunitlist);
  315. }
  316. }, function () {
  317. showSuccess();
  318. });
  319. }
  320. updateBatchData("conninfo", [tconninfo]);
  321. }
  322. }, function () {
  323. showSuccess();
  324. });
  325. $timeout(function () {
  326. ModelService.resetTempData();
  327. ModelService.sharecloudflg = false;
  328. showSuccess();
  329. }, 2000);
  330. };
  331. //显示创建记录成功
  332. var showSuccess = function () {
  333. UtilService.showMess("新建记录成功");
  334. $scope.hideLoadingToast();
  335. $timeout(function () {
  336. $scope.goback();
  337. }, 1000);
  338. ModelService.resetTempData();
  339. SqliteStorageService.updateEditFlg(1);
  340. overwatch();
  341. };
  342. //监听是否结束
  343. var overwatch = $scope.$watch("addisover", function (newValue, oldValue, scope) {
  344. if (newValue == checknum) {
  345. HandleService.changeflg = true;
  346. if (UtilService.checkNetWork() != "None") {
  347. if (uptemprecord.claid == 0) {
  348. // console.log($scope.checkdefolder);
  349. DockingService.createFolder($scope.checkdefolder).then(function (resc) {
  350. // console.log(resc);
  351. // console.log("分类上传至Server成功");
  352. var folder = {};
  353. folder.localid = $scope.checkdefolder.localid;
  354. folder.id = resc.conn.id;
  355. folder.synchrotype = 0;
  356. SqliteStorageService.updateSingleData("conninfofolder", folder).then(function () {
  357. // console.log("更新本地分类id成功");
  358. }, function () {
  359. });
  360. shareConninfoToCloudFolder(resc.conn.id);
  361. }, function () {
  362. showSuccess();
  363. })
  364. } else {
  365. shareConninfoToCloudFolder(uptemprecord.claid);
  366. }
  367. } else {
  368. showSuccess();
  369. }
  370. }
  371. });
  372. $scope.immediateRelease = function () {
  373. if (!UtilService.isDefined($scope.record.title)) {
  374. UtilService.showMess("标题不能为空");
  375. return;
  376. }
  377. var temprecord = angular.copy($scope.record);
  378. var tempstr = $("#appDateTime").val();
  379. if (UtilService.isDefined(tempstr)) {
  380. temprecord.conntime = UtilService.formatTime(tempstr);
  381. } else {
  382. temprecord.conntime = UtilService.formatTime($scope.record.date);
  383. }
  384. if (UtilService.isDefined(temprecord.content)) {
  385. temprecord.content = UtilService.replaceEnterTag(temprecord.content);
  386. }
  387. $scope.showLoadingToast();
  388. if (UtilService.checkNetWork() != "None") {
  389. uploadImages(temprecord);
  390. } else {
  391. saveInformation(temprecord);
  392. }
  393. };
  394. var saveTempDate = function () {
  395. ModelService.setConninfo($scope.record);
  396. ModelService.setImageList($scope.imagelist);
  397. ModelService.setCardList($scope.cardlist);
  398. };
  399. //是否标志
  400. $scope.checkFlag = function () {
  401. $scope.record.flag = $scope.record.flag == 1 ? 0 : 1;
  402. };
  403. $scope.show = function () {
  404. $ionicActionSheet.show({
  405. buttons: [
  406. {text: '<a class="action-sheet-push act_f">添加照片</a>'},
  407. {text: '<a class="action-sheet-push act_m">添加名片</a>'}
  408. /*{text: '<a class="action-sheet-push act_s">添加对接主题</a>'},
  409. {text: '<a class="action-sheet-push act_t">添加参加单位</a>'},
  410. {text: '<a class="action-sheet-push act_fo">添加人员信息</a>'}*/
  411. ],
  412. cancelText: '取消',
  413. buttonClicked: function (index) {
  414. if (index == 0) {
  415. getPictures();
  416. } else if (index == 1) {
  417. saveTempDate();
  418. $scope.go('addListCard');
  419. }
  420. /* else if (index == 2) {
  421. saveTempDate();
  422. $scope.go('DockingTheme');
  423. } else if (index == 3) {
  424. saveTempDate();
  425. $scope.go('ParticipatingUnits');
  426. } else if (index == 4) {
  427. $ionicActionSheet.show({
  428. buttons: [
  429. {text: '<a class="action-sheet-push">从通讯录中添加</a>'},
  430. {text: '<a class="action-sheet-push">自由编辑</a>'}
  431. ],
  432. cancelText: '取消',
  433. buttonClicked: function (index) {
  434. if (index == 0) {
  435. getContact();
  436. } else if (index == 1) {
  437. var tempdate = UtilService.formatDate();
  438. $scope.members.push({localid: tempdate.timestamp, contact: "", type: 0, phone: ""});
  439. }
  440. return true;
  441. }
  442. });
  443. }*/
  444. return true;
  445. }
  446. });
  447. };
  448. $scope.openCamera = function () {
  449. if ($scope.imagelist.length >= 18) {
  450. UtilService.showMess("最多选取18张图片");
  451. return;
  452. }
  453. UtilService.getPicture(1).then(function (results) {
  454. // console.log(results);
  455. $scope.imagelist.push({photo_name: results, original_name: results});
  456. $scope.totalImglength = 600 * $scope.imagelist.length;
  457. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  458. }, function (err) {
  459. });
  460. };
  461. var verifyStorage = function () {
  462. window.imagePicker.verifyStorage(
  463. function (results) {
  464. if (results == "1") {
  465. getPic();
  466. }
  467. }, function (error) {
  468. }
  469. );
  470. };
  471. var getPic = function () {
  472. if ($scope.imagelist.length >= 18) {
  473. UtilService.showMess("最多选取18张图片");
  474. return;
  475. }
  476. UtilService.getPictureList(18 - $scope.imagelist.length).then(function (results) {
  477. // console.log(results);
  478. angular.forEach(results, function (value, index) {
  479. $scope.imagelist.push({photo_name: value, original_name: value})
  480. });
  481. $scope.totalImglength = 600 * $scope.imagelist.length;
  482. $ionicScrollDelegate.$getByHandle("scrollimage").resize();
  483. }, function (err) {
  484. });
  485. };
  486. var getPictures = function () {
  487. if (device.platform == "Android") {
  488. verifyStorage();
  489. } else {
  490. getPic();
  491. }
  492. };
  493. //删除图片
  494. $scope.deletePhoto = function (index) {
  495. $scope.imagelist.splice(index, 1);
  496. };
  497. //时间选择器
  498. $(function () {
  499. var currYear = (new Date()).getFullYear();
  500. var opt = {};
  501. opt.date = {preset: 'date'};
  502. opt.datetime = {preset: 'datetime'};
  503. opt.time = {preset: 'time'};
  504. opt.default = {
  505. theme: 'android-ics light', //皮肤样式
  506. display: 'modal', //显示方式
  507. mode: 'scroller', //日期选择模式
  508. dateFormat: 'yyyy年mm月dd日',
  509. lang: 'zh',
  510. showNow: true,
  511. nowText: "今天",
  512. startYear: currYear - 50, //开始年份
  513. endYear: currYear + 10 //结束年份
  514. };
  515. /*$("#appDateTime").mobiscroll($.extend(opt['date'], opt['default']));*/
  516. var optDateTime = $.extend(opt['datetime'], opt['default']);
  517. $("#appDateTime").mobiscroll(optDateTime).datetime(optDateTime);
  518. });
  519. $scope.addListBack = function () {
  520. ModelService.resetTempData();
  521. ModelService.sharecloudflg = false;
  522. $scope.goback();
  523. };
  524. //重新编辑参与主题结果
  525. $scope.editThemeContent = function (theme, listindex) {
  526. $ionicActionSheet.show({
  527. buttons: [
  528. {text: '<a class="action-sheet-push">同步到高校库</a>'},
  529. {text: '<a class="action-sheet-push">编辑内容</a>'}
  530. ],
  531. cancelText: '取消',
  532. buttonClicked: function (index) {
  533. if (index == 0) {
  534. $scope.go("buildResourceInit");
  535. }
  536. if (index == 1) {
  537. $scope.go("DockingTheme", {theme: theme, index: listindex});
  538. }
  539. }
  540. });
  541. };
  542. //重新编辑参与单位结果
  543. $scope.editUnitContent = function (company, listindex) {
  544. $ionicActionSheet.show({
  545. buttons: [
  546. {text: '<a class="action-sheet-push">同步到高校库</a>'},
  547. {text: '<a class="action-sheet-push">编辑内容</a>'}
  548. ],
  549. cancelText: '取消',
  550. buttonClicked: function (index) {
  551. if (index == 0) {
  552. $scope.go("buildResourceInit");
  553. }
  554. if (index == 1) {
  555. $scope.go("ParticipatingUnits", {company: company, index: listindex});
  556. }
  557. }
  558. });
  559. };
  560. //点击图片放大
  561. $scope.bigImage = false; //初始默认大图是隐藏的
  562. $scope.hideBigImage = function () {
  563. $timeout(function (){
  564. $scope.bigImage = false;
  565. },400);
  566. };
  567. $scope.shouBigImage = function (index) { //传递一个参数(图片的URl)
  568. $scope.bigImage = true;//显示大图
  569. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  570. //图片总数量
  571. setTimeout(function () {
  572. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, -10);
  573. //获取图片
  574. var imgObj = document.getElementsByClassName('bigimage');
  575. var n;
  576. for (n = 0; n < imgObj.length; n++) {
  577. // 获取图片的原始高度和宽度
  578. var oldWid = imgObj[n].naturalWidth;
  579. var oldHei = imgObj[n].naturalHeight;
  580. var screen = document.body.offsetWidth;
  581. var screenH =window.innerHeight;
  582. // console.log(oldWid / oldHei);
  583. // console.log(screen);
  584. var cc = screen / (oldWid / oldHei);
  585. imgObj[n].style.height = cc + 'px';
  586. if(cc<screenH){
  587. imgObj[n].style.marginTop = (screenH-cc)/2 +'px';
  588. // console.log("e:"+imgObj[n].style.marginTop);
  589. }else{
  590. imgObj[n].style.marginTop = 0+'px';
  591. // console.log((cc-screenH) +'px')
  592. }
  593. }
  594. }, 10);
  595. };
  596. //显示更多名片部分
  597. $scope.showMoreCard = function (index) {
  598. $(".parentWrapCard").eq(index).toggle();
  599. $(".showCardWrap").eq(index).toggle();
  600. $(".changeArrowButton").eq(index).toggleClass("upArrow");
  601. /* var cardText = $(".downArrow").eq(index).text();
  602. if (cardText == '展开') {
  603. $(".downArrow").eq(index).text("收起");
  604. } else {
  605. $(".downArrow").eq(index).text("展开");
  606. }*/
  607. };
  608. var cardDelect = function (cardindex) {
  609. $scope.cardlist.splice(cardindex, 1);
  610. };
  611. //重新编辑名片
  612. $scope.editCardContent = function (cardindex) {
  613. $ionicActionSheet.show({
  614. buttons: [
  615. /* {text: '<a class="action-sheet-push">同步到高校库</a>'},*/
  616. {text: '<a class="action-sheet-push">编辑名片</a>'},
  617. {text: '<a class="action-sheet-push">删除名片</a>'}
  618. ],
  619. cancelText: '取消',
  620. buttonClicked: function (index) {
  621. /*if (index == 0) {
  622. $scope.go("buildResourceInit");
  623. }*/
  624. if (index == 0) {
  625. saveTempDate();
  626. $scope.go("addListCard", {index: cardindex});
  627. } else {
  628. cardDelect(cardDelect);
  629. }
  630. return true;
  631. }
  632. });
  633. };
  634. //对接记录设置
  635. $scope.editCloudSare = function () {
  636. $ionicActionSheet.show({
  637. buttons: [
  638. {text: '<a class="action-sheet-push">云共享设置</a>'}
  639. ],
  640. cancelText: '取消',
  641. buttonClicked: function (index) {
  642. if (index == 0) {
  643. if (UtilService.checkNetWork() == "None") {
  644. UtilService.showMess("当前网络已关闭,请打开网络后操作此功能");
  645. return true;
  646. }
  647. saveTempDate();
  648. $scope.go("CloudShareSet");
  649. }
  650. return true;
  651. }
  652. });
  653. };
  654. //键盘操作
  655. /* $scope.closeKeyboard=function () {
  656. $(".addList_bottom_first").toggleClass("keyBoardHide");
  657. $scope.isOpen =true;
  658. }*/
  659. });