mainlist.js 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. import constant1 from '../../utils/constant';
  4. const app = getApp();
  5. var intervalRefresh = 0;
  6. var isCollecting = false;
  7. var canPress = true; //按钮按下有反应
  8. var arrOrder=constant1.arrListOrder;
  9. Page({
  10. data: {
  11. ImagePath: app.globalData.uploadImageUrl,
  12. IsShowCardShowDetail: false, //显示题卡显示细节
  13. IsShowSelectContainer:false,//显示多选其它菜单
  14. SelectContainerStyle:0,//多选按钮的样式模版
  15. IsFolderListContainer:0,//卡单列表选择页面
  16. IsHelp: false,
  17. IsFilter:false,
  18. ShowMultiple:0,//显示多选,0为不显示,2为卡单,3为星标,4为归档,5为日常,6为紧急,8为搜索,-1为全部
  19. HasPage: false, //有没有分页
  20. HasPageDelete:false,//有没有回收站的分页
  21. CardTypeStr: "全部",
  22. IsShowSelectCardType: false, //是否显示选择题卡模式
  23. ArrOrder: arrOrder, //可选择的排序数组
  24. OrderType: 2, //选择的排序类型
  25. CardType: 2, //练习模式类型,缺省为日常+紧急
  26. PrintID: 0, //打印ID
  27. CardShowDetail: 0, //0 创建时间 1 修改时间 2到期时间 3练习时间 4练习次数
  28. FolderListCss:"",//卡单时列表样式
  29. HasNullImage:0,//有没有未上传成功的空图
  30. SelectedCount:0,//多选的题卡数
  31. IsIPhoneX: app.globalData.IsIPhoneX,
  32. CanScroll:true,
  33. },
  34. onLoad: function (options) {
  35. var that = this;
  36. var Search = "",
  37. IsToday = 0,
  38. IsCollect = 0;
  39. var count = 0; //列表数
  40. if (options.Count)
  41. count = options.Count;
  42. if (options.source=="health"){
  43. that.setData({
  44. Source:options.source,
  45. });
  46. wx.setNavigationBarTitle({
  47. title: options.dataType
  48. });
  49. if (options.dataType == "最近练完") {
  50. that.gotoList({currentTarget:{dataset:{type:"today"}}});
  51. IsToday = 2;
  52. }
  53. else if (options.dataType == "已到期") {
  54. that.gotoList({currentTarget:{dataset:{type:"limit0"}}});
  55. IsToday = 4;
  56. that.setData({
  57. CardShowDetail: 2,
  58. });
  59. }
  60. else if (options.dataType == "答题时间极短") {
  61. that.gotoList({currentTarget:{dataset:{type:"TimeShort7"}}});
  62. IsToday = 5;
  63. that.setData({
  64. CardShowDetail: 3,
  65. });
  66. }
  67. else if (options.dataType == "多次点蓝") {
  68. that.gotoList({currentTarget:{dataset:{type:"ClickBlue7"}}});
  69. IsToday = 6;
  70. that.setData({
  71. CardShowDetail: 3,
  72. });
  73. }
  74. else if (options.dataType == "多次搁置") {
  75. that.gotoList({currentTarget:{dataset:{type:"ClickShelve7"}}});
  76. IsToday = 7;
  77. that.setData({
  78. CardShowDetail: 3,
  79. });
  80. }
  81. }
  82. //如果是搜索
  83. else if (options.search) {
  84. Search = options.search;
  85. wx.setNavigationBarTitle({
  86. title: "搜索结果"
  87. });
  88. that.setData({
  89. ShowMultiple:8,
  90. });
  91. } else if (options.type == 1) { //未练完的情况
  92. IsToday = 1;
  93. that.setOrderSelect(5);
  94. that.setData({
  95. CardShowDetail: 2,
  96. });
  97. wx.setNavigationBarTitle({
  98. title: "未练完的题卡"
  99. });
  100. } else if (options.type == 2) { //练完的情况
  101. IsToday = 2;
  102. that.setOrderSelect(1);
  103. that.setData({
  104. CardShowDetail: 3,
  105. });
  106. wx.setNavigationBarTitle({
  107. title: "练完的题卡"
  108. });
  109. } else if (options.IsCollect == 1) { //星标的情况(也就是原来的收藏夹)
  110. wx.setNavigationBarTitle({
  111. title: "星标"
  112. });
  113. IsCollect = 1;
  114. that.setData({
  115. IsCollect: IsCollect, //是否是星标
  116. ShowMultiple:3,
  117. });
  118. } else if (options.PrintID) { //打印题卡情况
  119. wx.setNavigationBarTitle({
  120. title: "打印卷题卡清单"
  121. });
  122. that.setData({
  123. PrintID: options.PrintID,
  124. });
  125. //console.log("options.PrintUserID:"+options.PrintUserID);
  126. //console.log("app.globalData.userInfo.UserID:"+app.globalData.userInfo.UserID);
  127. if (options.PrintUserID!=app.globalData.userInfo.UserID){
  128. wx.showModal({
  129. title: '提醒',
  130. showCancel: false,
  131. content: '此打印卷非您微信号生成,请扫描您生成的打印卷查看答案!',
  132. confirmText: '知道了',
  133. success(res) {
  134. if (res.confirm) {
  135. wx.navigateBack({
  136. delta: 1,
  137. });
  138. }
  139. }
  140. });
  141. }
  142. else{
  143. that.getPrintList();
  144. }
  145. } else if (options.FolderID) { //卡单题卡情况
  146. wx.setNavigationBarTitle({
  147. title: "卡单"
  148. });
  149. that.setData({
  150. FolderID: options.FolderID,
  151. FolderName:options.Name,
  152. IconName:options.IconName,
  153. ColorName:options.ColorName,
  154. FolderListCss:"CellHide00",
  155. ShowMultiple:options.FolderID,
  156. });
  157. } else if (options.CardType != 2) { //如果不是日常+紧急
  158. var title = "";
  159. if (options.CardType==0){
  160. title = "日常题卡";
  161. that.setData({
  162. ShowMultiple:5,
  163. });
  164. } else if (options.CardType == 1) {
  165. title = "紧急题卡";
  166. that.setData({
  167. ShowMultiple:6,
  168. });
  169. } else if (options.CardType == -1) {
  170. title = "归档";
  171. that.setData({
  172. ShowMultiple:4,
  173. });
  174. that.setOrderSelect(10);
  175. that.setData({
  176. CardShowDetail: 2,
  177. });
  178. } else if (options.CardType == -2) {
  179. title = "回收";
  180. that.setOrderSelect(10);
  181. var haspage=false;
  182. if (count>app.globalData.CardList.length)
  183. haspage=true;
  184. that.setData({
  185. CardShowDetail: 2,
  186. HasPageDelete:haspage,
  187. });
  188. //debugger;
  189. }
  190. wx.setNavigationBarTitle({
  191. title: title,
  192. });
  193. that.setData({
  194. CardType: options.CardType,
  195. });
  196. }
  197. else if (options.CardType == 2){
  198. that.setData({
  199. CardType: options.CardType,
  200. ShowMultiple:-1,
  201. });
  202. }
  203. that.setData({
  204. Search: Search, //搜索关键词
  205. IsToday: IsToday, //是否是今天任务
  206. Count: count, //列表数
  207. Containnerheight: main.getWindowHeight(),
  208. PageType: options.type, //列表类型,1 今天未练完 2 今天已经练完
  209. IsNew: options.IsNew, //
  210. });
  211. canPress = true;
  212. },
  213. onShow: function () {
  214. var that = this;
  215. if (!that.data.PrintID) {
  216. if (that.data.IsNew) //目前用于年度报告
  217. that.onOrder({
  218. currentTarget: {
  219. dataset: {
  220. value: 4
  221. }
  222. }
  223. });
  224. else
  225. that.getList();
  226. }
  227. //题卡主题色
  228. var arrColorIndex = wx.getStorageSync("ColorIndexArr");
  229. if (!arrColorIndex) {
  230. app.globalData.ColorIndex = common.random(1, 4);
  231. } else {
  232. app.globalData.ColorIndex = arrColorIndex[common.random(0, arrColorIndex.length - 1)];
  233. }
  234. that.getFilter();
  235. if (that.data.FolderID && app.globalData.TempStr){
  236. that.setData({
  237. FolderName:app.globalData.TempStr.Name,
  238. IconName:app.globalData.TempStr.IconName,
  239. ColorName:app.globalData.TempStr.ColorName,
  240. FolderListCss:"CellHide00",
  241. });
  242. app.globalData.TempStr="";
  243. }
  244. if (wx.getStorageSync("TempCardNoSaved")) {
  245. wx.navigateTo({
  246. url: '../other/recover',
  247. });
  248. }
  249. },
  250. getList: function () {
  251. var that = this;
  252. var list = app.globalData.CardList;
  253. var len = 100;
  254. for (var i = 0; i < list.length; i++) {
  255. var item = list[i];
  256. item.ScrollLeft = 0;
  257. item.DeleteType = 0;
  258. item.Content[1].ContentStr = main.replaceCardInfoString(item.Content[1].Content);
  259. if (item.Content[1].ContentStr.length > len)
  260. item.Content[1].ContentStr = main.replaceCardInfoString(item.Content[1].ContentStr.substr(0, len)) + "...";
  261. if (item.Content[1].ContentStr){
  262. item.Content[1].ContentStr=item.Content[1].ContentStr.replace("[特]","");
  263. item.Content[1].ContentStr=item.Content[1].ContentStr.replace("[/特]","");
  264. }
  265. item.Content[2].ContentStr = main.replaceCardInfoString(item.Content[2].Content);
  266. if (item.Content[2].ContentStr.length > len)
  267. item.Content[2].ContentStr = main.replaceCardInfoString(item.Content[2].ContentStr.substr(0, len)) + "...";
  268. if (item.Content[2].ContentStr){
  269. item.Content[2].ContentStr=item.Content[2].ContentStr.replace("[特]","");
  270. item.Content[2].ContentStr=item.Content[2].ContentStr.replace("[/特]","");
  271. }
  272. var imageUrl = getImage(item.Content[1].Content);
  273. if (imageUrl.length == 0 && item.Content[2].Content)
  274. imageUrl = getImage(item.Content[2].Content);
  275. if (imageUrl.length == 0 && item.Content[3].Content)
  276. imageUrl = getImage(item.Content[3].Content);
  277. item.Width="650";
  278. if (imageUrl.length > 0) {
  279. item.ImageUrlTemp = main.getTempImage(imageUrl);
  280. item.ImageUrlServer = imageUrl;
  281. item.Width="540";
  282. }
  283. if (item.FirstTime < "1900-01-02")
  284. item.CardCategory = "新题卡";
  285. else
  286. item.CardCategory = "旧题卡";
  287. if (that.data.PrintID){
  288. item.CardShowDetailStr2=item.Number;
  289. }
  290. else if (that.data.CardType == "-2") {
  291. item.CardShowDetailStr2 = common.formatDateCHS(item.DeleteTime);
  292. } else {
  293. switch (Number(that.data.CardShowDetail)) {
  294. case 0:
  295. item.CardShowDetailStr2 = common.formatDateCHS(item.CreateTime);
  296. break;
  297. case 1:
  298. item.CardShowDetailStr2 = common.formatDateCHS(item.UpdateTime);
  299. break;
  300. case 2:
  301. if (that.data.CardType==2 && item.CardType == -1){
  302. item.CardShowDetailStr2 = "不适用";
  303. }
  304. else if (item.CardType == -1)
  305. item.CardShowDetailStr2 = common.formatDateCHS(item.PigeonholeTime);
  306. else
  307. item.CardShowDetailStr2 = common.formatDateCHS(item.LimitTime);
  308. break;
  309. case 3:
  310. if (item.LastTime < "1900-01-02")
  311. item.CardShowDetailStr2 = "不适用";
  312. else
  313. item.CardShowDetailStr2 = common.formatDateCHS(item.LastTime);
  314. break;
  315. case 4:
  316. item.CardShowDetailStr2 = item.LearnNumber + "次";
  317. break;
  318. }
  319. }
  320. item.CardTypeStr = constant1.arrStudyPattern[item.CardType];
  321. }
  322. if (!that.data.IsToday && !that.data.PrintID && !that.data.Search && that.data.CardType != "-2" && !that.data.FolderID && !that.data.Source) {
  323. main.getData("GetUserCardCount?UserID=" + app.globalData.userInfo.UserID + "&CardType=" + that.data.CardType + "&IsCollect=" + that.data.IsCollect+"&OrderType="+that.data.OrderType, function (data) {
  324. if (data) {
  325. that.setData({
  326. Count: data.CardNumber,
  327. });
  328. var hasPage = false;
  329. if (list.length < that.data.Count && list.length >= 20 && that.data.IsToday == 0)
  330. hasPage = true;
  331. that.setData({
  332. List: list,
  333. HasPage: hasPage,
  334. });
  335. if (that.data.PageType === "3") {
  336. wx.redirectTo({
  337. url: './preview?type=show&id=' + list[0].MiaoguoCardID,
  338. })
  339. }
  340. }
  341. });
  342. } else if (that.data.Search || that.data.FolderID > 0 || that.data.Source) {
  343. var hasPage = false;
  344. if (list.length < that.data.Count)
  345. hasPage = true;
  346. that.setData({
  347. List: list,
  348. HasPage: hasPage,
  349. });
  350. } else if (that.data.CardType != -2 && !that.data.Source) {
  351. that.setData({
  352. Count: list.length,
  353. });
  354. var hasPage = false;
  355. if (list.length < that.data.Count && that.data.IsToday == 0)
  356. hasPage = true;
  357. that.setData({
  358. List: list,
  359. HasPage: hasPage,
  360. });
  361. } else {
  362. that.setData({
  363. List: list,
  364. HasNullImage:0,
  365. });
  366. }
  367. var strCardShowDetail = constant1.arrCardShowDetail[that.data.CardShowDetail];
  368. if (that.data.CardShowDetail == 2 && that.data.CardType == -1)
  369. strCardShowDetail = "归档";
  370. else if (that.data.CardType == -2)
  371. strCardShowDetail = "删除";
  372. else if (that.data.PrintID)
  373. strCardShowDetail = "打印卷序号";
  374. that.setData({
  375. CardShowDetailStr: strCardShowDetail,
  376. });
  377. wx.hideLoading();
  378. function getImage(str) {
  379. var result = "";
  380. if (str.indexOf("[图") >= 0) {
  381. result = str.substring(str.indexOf("[图") + 3, str.indexOf("[/图]"));
  382. result = result.substring(result.indexOf("]") + 1);
  383. }
  384. //console.log(result);
  385. return result;
  386. }
  387. },
  388. getNullImageList:function(){
  389. var that=this;
  390. var list=that.data.List;
  391. var arr=[];
  392. var count=0;
  393. for(var i=0;i<list.length;i++){
  394. if (list[i].IsNullImage){
  395. arr.push(list[i]);
  396. count++;
  397. }
  398. }
  399. app.globalData.CardList=arr;
  400. that.setData({
  401. List:arr,
  402. Count:count,
  403. HasPage:false,
  404. HasNullImage:2,
  405. });
  406. wx.setNavigationBarTitle({
  407. title: "遗失图片的题卡"
  408. });
  409. },
  410. onPreview: function (e) {
  411. var id = e.currentTarget.dataset.id;
  412. var url='./preview?type=show&id=' + id;
  413. if (this.data.PrintID)
  414. url+="&PrintID="+this.data.PrintID;
  415. wx.navigateTo({
  416. url: url,
  417. })
  418. },
  419. onBindError: function (e) {
  420. var that = this;
  421. var id = e.currentTarget.dataset.id;
  422. var serverUrl = e.currentTarget.dataset.serverurl;
  423. wx.downloadFile({
  424. url: serverUrl,
  425. success(res) {
  426. if (res.statusCode === 200) {
  427. main.saveTempImage(serverUrl, res.tempFilePath);
  428. }
  429. else{
  430. var list=that.data.List;
  431. for(var i=0;i<list.length;i++){
  432. if (list[i].MiaoguoCardID==id){
  433. list[i].IsNullImage=true;
  434. }
  435. }
  436. that.setData({
  437. HasNullImage:1,
  438. List:list,
  439. });
  440. wx.pageScrollTo({
  441. scrollTop: 0,
  442. });
  443. }
  444. }
  445. });
  446. },
  447. gotoNextPage: function (e) {
  448. wx.showLoading({
  449. title: '请稍候',
  450. });
  451. setTimeout(function () {
  452. wx.hideLoading();
  453. }, 5000);
  454. var that = this;
  455. var url = 'GetMiaoguoCardList2?UserID=' + app.globalData.userInfo.UserID;
  456. var id = e.currentTarget.dataset.id;
  457. if (id && id > 0)
  458. url += "&PageID=" + id;
  459. if (e.currentTarget.dataset.IsToday)
  460. url += "&IsToday="+e.currentTarget.dataset.IsToday;
  461. var cardtype = e.currentTarget.dataset.cardtype;
  462. if (cardtype || cardtype == "0") {
  463. url += "&CardType=" + cardtype;
  464. var str = constant1.arrStudyPattern[cardtype];
  465. if (cardtype == "2")
  466. str = "全部";
  467. that.setData({
  468. CardType: Number(cardtype),
  469. CardTypeStr: str,
  470. })
  471. } else {
  472. if (that.data.CardType || that.data.CardType==0)
  473. url += "&CardType=" + that.data.CardType;
  474. }
  475. if (that.data.Search)
  476. url += "&Key=" + that.data.Search;
  477. var orderType = that.data.OrderType;
  478. if (orderType)
  479. url += "&OrderType=" + arrOrder[orderType].Value;
  480. if (e.currentTarget.dataset.iscollect == 1)
  481. url += "&IsCollect=1";
  482. if (e.currentTarget.dataset.folderid)
  483. url += "&FolderID="+e.currentTarget.dataset.folderid;
  484. if (e.currentTarget.dataset.dayNumber)
  485. url += "&DayNumber="+e.currentTarget.dataset.dayNumber;
  486. main.getData(url, function (data) {
  487. if (data) {
  488. var list = app.globalData.CardList;
  489. if (id == 0) {
  490. list = [];
  491. that.setData({
  492. Count: data.Count,
  493. });
  494. }
  495. for (var i = 0; i < data.List.length; i++) {
  496. data.List[i].LastTimeStr = common.formatDateCHS(data.List[i].LastTime);
  497. list.push(data.List[i]);
  498. }
  499. app.globalData.CardList = list;
  500. that.getList();
  501. if (data.List.length < 20) {
  502. that.setData({
  503. HasPage: false,
  504. });
  505. }
  506. that.getFilter();
  507. if (that.data.Source=="health"){
  508. setTimeout(function(){
  509. that.setBtnInfo(e.currentTarget.dataset.datatype,data.Count);
  510. },500);
  511. }
  512. }
  513. });
  514. that.setData({
  515. IsOrder: false,
  516. IsHelp: false,
  517. IsShowSelectCardType: false,
  518. });
  519. },
  520. //回收站的下一页
  521. gotoNextPageDelete: function (e) {
  522. wx.showLoading({
  523. title: '请稍候',
  524. });
  525. setTimeout(function () {
  526. wx.hideLoading();
  527. }, 5000);
  528. var that = this;
  529. var url = 'GetMiaoguoCardDeleteList2?UserID=' + app.globalData.userInfo.UserID;
  530. var param={};
  531. var id=e.currentTarget.dataset.id;
  532. param.PageID=id;
  533. param.PageCount=20;
  534. param.Type="app";
  535. main.postData(url,param, function (data) {
  536. if (data) {
  537. var list = app.globalData.CardList;
  538. if (id == 0) {
  539. list = [];
  540. that.setData({
  541. Count: data.Count,
  542. });
  543. }
  544. for (var i = 0; i < data.List.length; i++) {
  545. data.List[i].LastTimeStr = common.formatDateCHS(data.List[i].LastTime);
  546. list.push(data.List[i]);
  547. }
  548. app.globalData.CardList = list;
  549. that.getList();
  550. if (data.List.length < 20) {
  551. that.setData({
  552. HasPageDelete: false,
  553. });
  554. }
  555. that.getFilter();
  556. }
  557. });
  558. that.setData({
  559. IsOrder: false,
  560. IsHelp: false,
  561. IsShowSelectCardType: false,
  562. });
  563. },
  564. getPrintList: function (e) {
  565. wx.showLoading({
  566. title: '请稍候',
  567. });
  568. setTimeout(function () {
  569. wx.hideLoading();
  570. }, 5000);
  571. var that = this;
  572. var url = 'GetMiaoguoCardList2?UserID=' + app.globalData.userInfo.UserID + '&PrintID=' + that.data.PrintID;
  573. main.getData(url, function (data) {
  574. if (data) {
  575. if (data.List.length > 0) {
  576. var list = [];
  577. for (var i = 0; i < data.List.length; i++) {
  578. data.List[i].Number = i + 1;
  579. list.push(data.List[i]);
  580. }
  581. app.globalData.CardList = list;
  582. that.getList();
  583. wx.setNavigationBarColor({
  584. frontColor: "#000000",
  585. backgroundColor: "#ffffff",
  586. });
  587. } else {
  588. that.onSearch();
  589. }
  590. }
  591. });
  592. },
  593. getFilter:function(){
  594. var that = this;
  595. if (app.globalData.TempStr2){
  596. if (that.data.Count<=1)
  597. isFilter=false;
  598. else{
  599. var arr=[["全部",0,"",2,0],["",0,"",0,0]];
  600. var isFilter=false;
  601. var str=app.globalData.TempStr2;
  602. if (str.indexOf("IsCollect=1")>=0){
  603. arr[1][0]="星标";
  604. arr[1][3]=0;
  605. arr[1][4]=1;
  606. isFilter=true;
  607. }
  608. else if (str.indexOf("CardType=0")>=0){
  609. arr[1][0]="日常";
  610. arr[1][3]=0;
  611. arr[1][4]=0;
  612. isFilter=true;
  613. }
  614. else if (str.indexOf("CardType=1")>=0){
  615. arr[1][0]="紧急";
  616. arr[1][3]=1;
  617. arr[1][4]=0;
  618. isFilter=true;
  619. }
  620. else if (str.indexOf("CardType=-1")>=0){
  621. arr[1][0]="归档";
  622. arr[1][3]=-1;
  623. arr[1][4]=0;
  624. isFilter=true;
  625. }
  626. if (that.data.CardType==2){
  627. arr[0][1]=that.data.Count;
  628. arr[0][2]="panelTop40";
  629. }
  630. else{
  631. arr[1][1]=that.data.Count;
  632. arr[1][2]="panelTop40";
  633. arr[0][2]="";
  634. }
  635. //console.log("CardType:"+that.data.CardType);
  636. that.setData({
  637. FilterArr:arr,
  638. });
  639. }
  640. that.setData({
  641. IsFilter:isFilter,
  642. });
  643. }
  644. },
  645. addCard: function () {
  646. //console.log("canPress:"+canPress);
  647. if (canPress) {
  648. var url='./add?type=add&id=0';
  649. if (this.data.FolderID){
  650. url+="&FolderID="+this.data.FolderID+"&FolderName="+this.data.FolderName;
  651. }
  652. else{
  653. var cardtype=this.data.CardType;
  654. if (cardtype==1 || cardtype==-1){
  655. url+="&CardType="+cardtype;
  656. }
  657. }
  658. wx.redirectTo({
  659. url: url,
  660. });
  661. canPress = false;
  662. //console.log("canPress:"+canPress);
  663. setTimeout(function () {
  664. canPress = true;
  665. //console.log("canPress:"+canPress);
  666. }, 2000);
  667. }
  668. },
  669. onSearch: function (e) {
  670. var id=1;
  671. if (e.currentTarget.dataset.id)
  672. id=Number(e.currentTarget.dataset.id);
  673. wx.navigateBack({
  674. delta: id,
  675. });
  676. },
  677. onOrder: function (e) {
  678. var that = this;
  679. var value = e.currentTarget.dataset.value;
  680. switch (Number(value)) {
  681. case 1:
  682. that.data.CardShowDetail = 3;
  683. break;
  684. case 2:
  685. that.data.CardShowDetail = 1;
  686. break;
  687. case 3:
  688. case 4:
  689. that.data.CardShowDetail = 0;
  690. break;
  691. case 5:
  692. case 6:
  693. that.data.CardShowDetail = 2;
  694. break;
  695. case 7:
  696. case 8:
  697. that.data.CardShowDetail = 4;
  698. break;
  699. case 9:
  700. case 10:
  701. that.data.CardShowDetail = 2;
  702. break;
  703. }
  704. for (var i = 0; i < that.data.ArrOrder.length; i++) {
  705. if (i == value) {
  706. that.data.ArrOrder[i].CSS = "PanelBtnSelect2";
  707. } else
  708. that.data.ArrOrder[i].CSS = "";
  709. }
  710. that.setData({
  711. IsOrder: false,
  712. ArrOrder: that.data.ArrOrder,
  713. OrderType: value,
  714. CardShowDetail: that.data.CardShowDetail,
  715. });
  716. if (that.data.IsToday!=1) {
  717. app.globalData.CardList = [];
  718. that.gotoNextPage({
  719. currentTarget: {
  720. dataset: {
  721. id: 0,
  722. IsToday:that.data.IsToday,
  723. OrderType: value,
  724. cardtype: that.data.CardType,
  725. iscollect: that.data.IsCollect,
  726. folderid: that.data.FolderID,
  727. }
  728. }
  729. });
  730. }
  731. },
  732. gotoList:function(e){
  733. var that=this;
  734. var datatype=e.currentTarget.dataset.type;
  735. var isToday=0,cardType=2,isCollect=0,folderID=0,dayNumber=7;
  736. if (datatype=="today"){
  737. isToday=2;
  738. }
  739. else if (datatype=="yesterday"){
  740. isToday=3;
  741. }
  742. else if (datatype=="limit0"){
  743. cardType=0;
  744. isToday=4;
  745. that.setData({
  746. OrderType:5,
  747. });
  748. }
  749. else if (datatype=="limit1"){
  750. cardType=1;
  751. isToday=4;
  752. that.setData({
  753. OrderType:5,
  754. });
  755. }
  756. else{
  757. if (datatype && datatype.indexOf("7")>0)
  758. dayNumber=7;
  759. else if (datatype && datatype.indexOf("30")>0)
  760. dayNumber=30;
  761. if (datatype.indexOf("TimeShort")>=0)
  762. isToday=5;
  763. else if (datatype.indexOf("ClickBlue")>=0)
  764. isToday=6;
  765. else if (datatype.indexOf("ClickShelve")>=0)
  766. isToday=7;
  767. cardType=2;
  768. that.setData({
  769. OrderType:0,
  770. });
  771. }
  772. app.globalData.CardList = [];
  773. that.gotoNextPage({
  774. currentTarget: {
  775. dataset: {
  776. id: 0,
  777. IsToday:isToday,
  778. cardtype: cardType,
  779. iscollect: isCollect,
  780. folderid: folderID,
  781. datatype:datatype,
  782. dayNumber:dayNumber,
  783. }
  784. }
  785. });
  786. },
  787. setBtnInfo:function(datatype,count){
  788. var that=this;
  789. if (datatype=="today"){
  790. that.setData({
  791. Btn1Name:"今日",
  792. Btn1Type:"today",
  793. Btn2Name:"上次",
  794. Btn2Type:"yesterday",
  795. Btn1Count: count,
  796. Btn2Count: "",
  797. Btn1Class: "btn2",
  798. Btn2Class: "",
  799. CardShowDetail: 3,
  800. HasPage: false,
  801. });
  802. }
  803. else if (datatype=="yesterday"){
  804. that.setData({
  805. Btn1Name:"今日",
  806. Btn1Type:"today",
  807. Btn2Name:"上次",
  808. Btn2Type:"yesterday",
  809. Btn1Count: "",
  810. Btn2Count: count,
  811. Btn1Class: "",
  812. Btn2Class: "btn2",
  813. CardShowDetail: 3,
  814. HasPage: false,
  815. });
  816. }
  817. else if (datatype=="limit0"){
  818. that.setData({
  819. Btn1Name:"日常",
  820. Btn1Type:"limit0",
  821. Btn2Name:"紧急",
  822. Btn2Type:"limit1",
  823. Btn1Count: count,
  824. Btn2Count: "",
  825. Btn1Class: "btn2",
  826. Btn2Class: "",
  827. CardShowDetail: 2,
  828. });
  829. }
  830. else if (datatype=="limit1"){
  831. that.setData({
  832. Btn1Name:"日常",
  833. Btn1Type:"limit0",
  834. Btn2Name:"紧急",
  835. Btn2Type:"limit1",
  836. Btn1Count: "",
  837. Btn2Count: count,
  838. Btn1Class: "",
  839. Btn2Class: "btn2",
  840. CardShowDetail: 2,
  841. });
  842. }
  843. else if (datatype=="TimeShort7"){
  844. that.setData({
  845. Btn1Name:"近7天",
  846. Btn1Type:"TimeShort7",
  847. Btn2Name:"近30天",
  848. Btn2Type:"TimeShort30",
  849. Btn1Count: count,
  850. Btn2Count: "",
  851. Btn1Class: "btn2",
  852. Btn2Class: "",
  853. CardShowDetail: 3,
  854. });
  855. }
  856. else if (datatype=="TimeShort30"){
  857. that.setData({
  858. Btn1Name:"近7天",
  859. Btn1Type:"TimeShort7",
  860. Btn2Name:"近30天",
  861. Btn2Type:"TimeShort30",
  862. Btn1Count: "",
  863. Btn2Count: count,
  864. Btn1Class: "",
  865. Btn2Class: "btn2",
  866. CardShowDetail: 3,
  867. });
  868. }
  869. else if (datatype=="ClickBlue7"){
  870. that.setData({
  871. Btn1Name:"近7天",
  872. Btn1Type:"ClickBlue7",
  873. Btn2Name:"近30天",
  874. Btn2Type:"ClickBlue30",
  875. Btn1Count: count,
  876. Btn2Count: "",
  877. Btn1Class: "btn2",
  878. Btn2Class: "",
  879. CardShowDetail: 3,
  880. });
  881. }
  882. else if (datatype=="ClickBlue30"){
  883. that.setData({
  884. Btn1Name:"近7天",
  885. Btn1Type:"ClickBlue7",
  886. Btn2Name:"近30天",
  887. Btn2Type:"ClickBlue30",
  888. Btn1Count: "",
  889. Btn2Count: count,
  890. Btn1Class: "",
  891. Btn2Class: "btn2",
  892. CardShowDetail: 3,
  893. });
  894. }
  895. else if (datatype=="ClickShelve7"){
  896. that.setData({
  897. Btn1Name:"近7天",
  898. Btn1Type:"ClickShelve7",
  899. Btn2Name:"近30天",
  900. Btn2Type:"ClickShelve30",
  901. Btn1Count: count,
  902. Btn2Count: "",
  903. Btn1Class: "btn2",
  904. Btn2Class: "",
  905. CardShowDetail: 3,
  906. });
  907. }
  908. else if (datatype=="ClickShelve30"){
  909. that.setData({
  910. Btn1Name:"近7天",
  911. Btn1Type:"ClickShelve7",
  912. Btn2Name:"近30天",
  913. Btn2Type:"ClickShelve30",
  914. Btn1Count: "",
  915. Btn2Count: count,
  916. Btn1Class: "",
  917. Btn2Class: "btn2",
  918. CardShowDetail: 3,
  919. });
  920. }
  921. },
  922. showOrder: function () {
  923. this.setData({
  924. IsOrder: true,
  925. });
  926. },
  927. closeHelp: function () {
  928. this.setData({
  929. IsOrder: false,
  930. IsHelp: false,
  931. IsShowSelectCardType: false,
  932. });
  933. },
  934. DeleteItem: function (e) {
  935. var that = this;
  936. var id = e.currentTarget.dataset.id;
  937. var list = this.data.List;
  938. var b = true;
  939. for (var i = 0; i < list.length; i++) {
  940. var item = list[i];
  941. if (id == item.MiaoguoCardID) {
  942. if (item.DeleteType == 0) {
  943. item.ScrollLeft = 440;
  944. item.DeleteType = 1;
  945. } else if (item.DeleteType == 1) {
  946. b = false;
  947. item.DeleteType = 0;
  948. item.ScrollLeft = 0;
  949. var url = 'DeleteMiaoguoCard?UserID=' + app.globalData.userInfo.UserID;
  950. url += "&ID=" + id;
  951. main.getData(url, function (data) {
  952. var list = app.globalData.CardList;
  953. for (var i = 0; i < list.length; i++) {
  954. if (id == list[i].MiaoguoCardID) {
  955. list.splice(i, 1);
  956. break;
  957. }
  958. }
  959. app.globalData.CardList = list;
  960. that.setData({
  961. List: list,
  962. Count: --that.data.Count,
  963. });
  964. });
  965. }
  966. } else {
  967. item.DeleteType = 0;
  968. item.ScrollLeft = 0;
  969. }
  970. }
  971. if (b) {
  972. that.setData({
  973. List: list,
  974. });
  975. }
  976. },
  977. showSelectCardShowDetail: function () {
  978. var that = this;
  979. var arr = [];
  980. for (var i = 0; i < 5; i++) {
  981. var obj = {};
  982. obj.Name = constant1.arrCardShowDetail[i];
  983. if (that.data.CardType == -1 && i == 2)
  984. obj.Name = "归档";
  985. if (i < 4)
  986. obj.Name += "时间";
  987. if (i == that.data.CardShowDetail)
  988. obj.IsSelected = "PanelBtnSelect";
  989. else
  990. obj.IsSelected = "";
  991. arr.push(obj);
  992. }
  993. that.setData({
  994. IsShowCardShowDetail: true,
  995. CardShowDetailArr: arr,
  996. });
  997. },
  998. hideSelectCardShowDetail: function () {
  999. var that = this;
  1000. that.setData({
  1001. IsShowCardShowDetail: false,
  1002. });
  1003. },
  1004. selectCardShowDetail: function (e) {
  1005. var that = this;
  1006. that.data.CardShowDetail = e.currentTarget.dataset.id;
  1007. that.setData({
  1008. IsShowCardShowDetail: false,
  1009. CardShowDetail: that.data.CardShowDetail,
  1010. });
  1011. that.getList();
  1012. that.hideSelectCardShowDetail();
  1013. },
  1014. showHelp: function () {
  1015. var that = this;
  1016. that.setData({
  1017. IsHelp: true,
  1018. });
  1019. },
  1020. showSelectCardType: function () {
  1021. var that = this;
  1022. var arr = [
  1023. ["全部", "", 2],
  1024. ["日常", "", 0],
  1025. ["紧急", "", 1],
  1026. ["归档", "", -1]
  1027. ];
  1028. switch (that.data.CardType) {
  1029. case 2:
  1030. arr[0][1] = "PanelBtnSelect";
  1031. break;
  1032. case 0:
  1033. arr[1][1] = "PanelBtnSelect";
  1034. break;
  1035. case 1:
  1036. arr[2][1] = "PanelBtnSelect";
  1037. break;
  1038. case -1:
  1039. arr[3][1] = "PanelBtnSelect";
  1040. break;
  1041. }
  1042. that.setData({
  1043. IsShowSelectCardType: true,
  1044. CardTypeArr: arr,
  1045. });
  1046. },
  1047. recoverItem: function (e) {
  1048. var that = this;
  1049. var id = e.currentTarget.dataset.id;
  1050. var url = "DeleteMiaoguoCardWeb?UserID=" + app.globalData.userInfo.UserID;
  1051. var param = {};
  1052. param.IsRecover = "true";
  1053. param.VisitType = "vtqOSthN7vSwYmhc1gCjfw==";
  1054. param.ID = common.Encrypt(id);
  1055. main.postData(url, param, function () {
  1056. var list = app.globalData.CardList;
  1057. for (var i = 0; i < list.length; i++) {
  1058. if (id == list[i].MiaoguoCardID) {
  1059. list.splice(i, 1);
  1060. break;
  1061. }
  1062. }
  1063. app.globalData.CardList = list;
  1064. that.setData({
  1065. List: list,
  1066. Count: --that.data.Count,
  1067. });
  1068. });
  1069. },
  1070. setCollect: function (e) {
  1071. var that = this;
  1072. if (!isCollecting) {
  1073. isCollecting = true;
  1074. setTimeout(function () {
  1075. isCollecting = false;
  1076. }, 3000);
  1077. var id=e.currentTarget.dataset.id;
  1078. var collect=e.currentTarget.dataset.collect;
  1079. if (collect==0) {
  1080. collect = 1;
  1081. }
  1082. else {
  1083. collect = 0;
  1084. }
  1085. main.setCollect(id, collect, function () {
  1086. var list = app.globalData.CardList;
  1087. for (var i = 0; i < list.length; i++) {
  1088. if (id == list[i].MiaoguoCardID) {
  1089. if (collect==0)
  1090. list.splice(i, 1);
  1091. else
  1092. list[i].IsCollect = collect;
  1093. break;
  1094. }
  1095. }
  1096. app.globalData.CardList = list;
  1097. that.setData({
  1098. List: list,
  1099. });
  1100. });
  1101. }
  1102. },
  1103. editField: function (e) {
  1104. var id=e.currentTarget.dataset.id;
  1105. var that = this;
  1106. wx.navigateTo({
  1107. url: './add?type=edit&id=' + id,
  1108. });
  1109. },
  1110. removeFolder:function(e){
  1111. var that = this;
  1112. var id=e.currentTarget.dataset.id;
  1113. var url = 'RemoveFolder?UserID=' + app.globalData.userInfo.UserID;
  1114. url += "&ID=" + id;
  1115. url += "&FolderID=" + that.data.FolderID;
  1116. main.getData(url, function (data) {
  1117. var list = app.globalData.CardList;
  1118. for (var i = 0; i < list.length; i++) {
  1119. if (id == list[i].MiaoguoCardID) {
  1120. list.splice(i, 1);
  1121. break;
  1122. }
  1123. }
  1124. app.globalData.CardList = list;
  1125. that.setData({
  1126. List: list,
  1127. Count: --that.data.Count,
  1128. });
  1129. });
  1130. },
  1131. setOrderSelect:function(od){
  1132. var that=this;
  1133. for(var k=0;k<arrOrder.length;k++){
  1134. if (k==od)
  1135. arrOrder[k].CSS = "PanelBtnSelect2";
  1136. else
  1137. arrOrder[k].CSS = "";
  1138. }
  1139. that.setData({
  1140. ArrOrder: arrOrder,
  1141. OrderType:od,
  1142. });
  1143. },
  1144. //设置多选状态
  1145. setMultipleOptions:function(event){
  1146. var that=this;
  1147. //debugger;
  1148. var IsMultipleOptions=event.currentTarget.dataset.index==1?true:false;
  1149. that.setData({
  1150. IsMultipleOptions:IsMultipleOptions,
  1151. });
  1152. if (!IsMultipleOptions){
  1153. var list=that.data.List;
  1154. for(var i=0;i<list.length;i++){
  1155. list[i].Selected=false;
  1156. }
  1157. that.setData({
  1158. List:list,
  1159. SelectedCount:0,
  1160. CanScroll:true,
  1161. });
  1162. }
  1163. else{
  1164. that.setData({
  1165. CanScroll:false,
  1166. });
  1167. }
  1168. },
  1169. //选择或反选项
  1170. selectedItem:function(event){
  1171. var that=this;
  1172. var isAll=event.currentTarget.dataset.isall;
  1173. var id=event.currentTarget.dataset.id;
  1174. var list=that.data.List;
  1175. var selectedCount=0;
  1176. //debugger;
  1177. for(var i=0;i<list.length;i++){
  1178. if (isAll){
  1179. list[i].Selected=true;
  1180. }
  1181. else{
  1182. if (id==list[i].MiaoguoCardID){
  1183. if(!list[i].Selected)
  1184. list[i].Selected=true;
  1185. else
  1186. list[i].Selected=false;
  1187. }
  1188. }
  1189. if (list[i].Selected)
  1190. selectedCount++;
  1191. }
  1192. that.setData({
  1193. List:list,
  1194. SelectedCount:selectedCount,
  1195. });
  1196. },
  1197. showMultipleOther: function (event) {
  1198. var that = this;
  1199. var index=event.currentTarget.dataset.index;
  1200. var b=false;
  1201. if (index==1)
  1202. b=true;
  1203. if (b && that.data.SelectedCount==0){
  1204. wx.showToast({
  1205. title: '请先选择题卡',
  1206. });
  1207. }
  1208. else{
  1209. that.setData({
  1210. IsShowSelectContainer: b,
  1211. SelectContainerStyle:0,
  1212. });
  1213. }
  1214. },
  1215. //显示多选提醒
  1216. showMultipleNotice:function(event){
  1217. var that = this;
  1218. var index=event.currentTarget.dataset.index;
  1219. var mData = constant1.arrMultipleSaveData[index];
  1220. if (index==1 || index>=4){
  1221. var content=mData.Content.replace("[SelectedCount]",that.data.SelectedCount);
  1222. wx.showModal({
  1223. title: '提醒',
  1224. content: content,
  1225. confirmText:mData.ConfirmText,
  1226. complete: (res) => {
  1227. if (res.confirm) {
  1228. that.saveMultipleData(mData,that.data.List);
  1229. }
  1230. }
  1231. });
  1232. }
  1233. else if (index==2 || index==3){
  1234. //debugger;
  1235. var menu=event.currentTarget.dataset.menu;
  1236. if (menu==1){
  1237. that.setData({
  1238. SelectContainerStyle: index,
  1239. });
  1240. } else if (menu==2) {
  1241. var id=event.currentTarget.dataset.id;
  1242. that.showFolderListSelect({currentTarget:{dataset:{index:1,readfolder:id}}});
  1243. } else {
  1244. var id=event.currentTarget.dataset.id;
  1245. if (index==3){
  1246. mData.Param.IsCollect=id;
  1247. mData.FinishedText=mData.FinishedTextArr[id];
  1248. that.saveMultipleData(mData,that.data.List);
  1249. }
  1250. else{
  1251. if (id==0){
  1252. mData.Param.FolderID=0;
  1253. }
  1254. else{
  1255. var list=that.data.FolderList;
  1256. for(var i=0;i<list.length;i++){
  1257. if (list[i].Selected==1){
  1258. mData.Param.FolderID=list[i].ID;
  1259. mData.Param.FolderName=list[i].Name;
  1260. break;
  1261. }
  1262. }
  1263. }
  1264. mData.FinishedText=mData.FinishedTextArr[id];
  1265. that.saveMultipleData(mData,that.data.List);
  1266. }
  1267. }
  1268. }
  1269. },
  1270. //保存多选数据
  1271. saveMultipleData:function(mData,list){
  1272. var that=this;
  1273. var arr=[];
  1274. for(var i=0;i<list.length;i++){
  1275. if (list[i].Selected){
  1276. var id=list[i].MiaoguoCardID;
  1277. id=common.Encrypt(id);
  1278. arr.push(id);
  1279. }
  1280. }
  1281. if (arr.length>0){
  1282. var sql=mData.SaveFun+"?UserID="+app.globalData.userInfo.UserID;
  1283. var param=mData.Param;
  1284. param[param.ListStr]=arr;
  1285. //console.log(JSON.stringify(param));
  1286. //debugger;
  1287. main.postData(sql, param, function (data) {
  1288. list=that.updateSavedList(that.data.ShowMultiple,mData,list);
  1289. app.globalData.CardList=list;
  1290. that.setData({
  1291. List:list,
  1292. SelectedCount:0,
  1293. IsShowSelectContainer:false,
  1294. IsMultipleOptions:false,
  1295. IsFolderListContainer:0,
  1296. FolderList:null,
  1297. });
  1298. wx.showToast({
  1299. title: mData.FinishedText,
  1300. duration: 2000,
  1301. });
  1302. });
  1303. }
  1304. },
  1305. //更新保存的列表状态
  1306. updateSavedList:function(source,mData,list){
  1307. var that=this;
  1308. var index=mData.ID;
  1309. //debugger;
  1310. for(var i=list.length-1;i>=0;i--){
  1311. if (list[i].Selected){
  1312. list[i].Selected=0;
  1313. if (index==1){//删除
  1314. list.splice(i,1);
  1315. that.data.Count--;
  1316. }
  1317. else if (index==2){
  1318. list[i].FolderID=mData.Param.FolderID;
  1319. if (list[i].FolderID>0)
  1320. list[i].FolderName=mData.Param.FolderName;
  1321. if (source>0 && index!=source && mData.Param.FolderID!=source){ //不同类型列表删除
  1322. list.splice(i,1);
  1323. that.data.Count--;
  1324. }
  1325. app.globalData.FolderList=[];
  1326. }
  1327. else if (index==3){
  1328. list[i].IsCollect=Number(mData.Param.IsCollect);
  1329. if (source>0 && source<8 && index==source && mData.Param.IsCollect==0) {//不同类型列表删除
  1330. list.splice(i,1);
  1331. that.data.Count--;
  1332. }
  1333. }
  1334. else if (index==4){
  1335. list[i].CardType=-1;
  1336. list[i].CardTypeStr="归档";
  1337. if (source>0 && source<8 && index!=source){ //不同类型列表删除
  1338. list.splice(i,1);
  1339. that.data.Count--;
  1340. }
  1341. }
  1342. else if (index==5){
  1343. list[i].CardType=0;
  1344. list[i].CardTypeStr="日常";
  1345. if (source>0 && source<8 && index!=source){ //不同类型列表删除
  1346. list.splice(i,1);
  1347. that.data.Count--;
  1348. }
  1349. }
  1350. else if (index==6){
  1351. list[i].CardType=1;
  1352. list[i].CardTypeStr="紧急";
  1353. if (source>0 && source<8 && index!=source){ //不同类型列表删除
  1354. list.splice(i,1);
  1355. that.data.Count--;
  1356. }
  1357. }
  1358. else if (index==7){
  1359. list[i].CardType=0;
  1360. list[i].CardTypeStr="日常";
  1361. list[i].FirstTime='1900-01-01 00:00:00';
  1362. list[i].FirstTimeStr='1900-01-01';
  1363. list[i].LastTime='1900-01-01 00:00:00';
  1364. list[i].LastTimeStr='1900-01-01';
  1365. list[i].LimitTime=common.formatTime(new Date(),"-");
  1366. list[i].LimitTimeStr=common.formatTime(new Date(),"-",true);
  1367. list[i].IntervalDay=0;
  1368. list[i].RepetitionCoefficient=2.0;
  1369. list[i].UpdateTime=list[i].LimitTime;
  1370. list[i].UpdateTimeStr="今天";
  1371. list[i].CardCategory="新题卡";
  1372. }
  1373. }
  1374. }
  1375. that.setData({
  1376. Count:that.data.Count,
  1377. });
  1378. return list;
  1379. },
  1380. showFolderListSelect:function(e){
  1381. var that=this;
  1382. var index=Number(e.currentTarget.dataset.index);
  1383. that.setData({
  1384. IsFolderListContainer:index,
  1385. });
  1386. if (index==1){
  1387. var url = 'GetUserFolderList?UserID=' + app.globalData.userInfo.UserID;
  1388. main.getData(url, function (data) {
  1389. that.setData({
  1390. FolderList: data,
  1391. });
  1392. });
  1393. }
  1394. else{
  1395. that.setData({
  1396. FolderList: null,
  1397. });
  1398. }
  1399. },
  1400. selectFolderItem:function(e){
  1401. var that=this;
  1402. var index=Number(e.currentTarget.dataset.index);
  1403. var list=that.data.FolderList;
  1404. for(var i=0;i<list.length;i++){
  1405. list[i].Selected=0;
  1406. if (index==i){
  1407. list[i].Selected=1;
  1408. }
  1409. }
  1410. that.setData({
  1411. FolderList:list,
  1412. });
  1413. },
  1414. goto: function (e) {
  1415. var url = e.currentTarget.dataset.url;
  1416. wx.navigateTo({
  1417. url: './' + url,
  1418. })
  1419. },
  1420. redirect: function (e) {
  1421. var that=this;
  1422. var url = e.currentTarget.dataset.url;
  1423. app.globalData.TempStr2="CardType="+that.data.CardType+"&IsCollect="+that.data.IsCollect;
  1424. wx.redirectTo({
  1425. url: './' + url,
  1426. })
  1427. },
  1428. showHelpImage:function(){
  1429. var url=app.globalData.uploadImageUrl+"web/update_image_mathod.png";
  1430. wx.previewImage({
  1431. current: url, // 当前显示图片的http链接
  1432. urls: [url] // 需要预览的图片http链接列表
  1433. });
  1434. },
  1435. onShareAppMessage: function () {
  1436. return {
  1437. title: app.globalData.ShareTitle,
  1438. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  1439. imageUrl: app.globalData.ShareImage,
  1440. }
  1441. },
  1442. })