mainlist.js 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530
  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 = 16;
  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. if (imageUrl.length > 0) {
  278. item.ImageUrlTemp = main.getTempImage(imageUrl);
  279. item.ImageUrlServer = imageUrl;
  280. }
  281. if (item.FirstTime < "1900-01-02")
  282. item.CardCategory = "新题卡";
  283. else
  284. item.CardCategory = "旧题卡";
  285. if (that.data.PrintID){
  286. item.CardShowDetailStr2=item.Number;
  287. }
  288. else if (that.data.CardType == "-2") {
  289. item.CardShowDetailStr2 = common.formatDateCHS(item.DeleteTime);
  290. } else {
  291. switch (Number(that.data.CardShowDetail)) {
  292. case 0:
  293. item.CardShowDetailStr2 = common.formatDateCHS(item.CreateTime);
  294. break;
  295. case 1:
  296. item.CardShowDetailStr2 = common.formatDateCHS(item.UpdateTime);
  297. break;
  298. case 2:
  299. if (that.data.CardType==2 && item.CardType == -1){
  300. item.CardShowDetailStr2 = "不适用";
  301. }
  302. else if (item.CardType == -1)
  303. item.CardShowDetailStr2 = common.formatDateCHS(item.PigeonholeTime);
  304. else
  305. item.CardShowDetailStr2 = common.formatDateCHS(item.LimitTime);
  306. break;
  307. case 3:
  308. if (item.LastTime < "1900-01-02")
  309. item.CardShowDetailStr2 = "不适用";
  310. else
  311. item.CardShowDetailStr2 = common.formatDateCHS(item.LastTime);
  312. break;
  313. case 4:
  314. item.CardShowDetailStr2 = item.LearnNumber + "次";
  315. break;
  316. }
  317. }
  318. item.CardTypeStr = constant1.arrStudyPattern[item.CardType];
  319. }
  320. if (!that.data.IsToday && !that.data.PrintID && !that.data.Search && that.data.CardType != "-2" && !that.data.FolderID && !that.data.Source) {
  321. main.getData("GetUserCardCount?UserID=" + app.globalData.userInfo.UserID + "&CardType=" + that.data.CardType + "&IsCollect=" + that.data.IsCollect+"&OrderType="+that.data.OrderType, function (data) {
  322. if (data) {
  323. that.setData({
  324. Count: data.CardNumber,
  325. });
  326. var hasPage = false;
  327. if (list.length < that.data.Count && list.length >= 20 && that.data.IsToday == 0)
  328. hasPage = true;
  329. that.setData({
  330. List: list,
  331. HasPage: hasPage,
  332. });
  333. if (that.data.PageType === "3") {
  334. wx.redirectTo({
  335. url: './preview?type=show&id=' + list[0].MiaoguoCardID,
  336. })
  337. }
  338. }
  339. });
  340. } else if (that.data.Search || that.data.FolderID > 0 || that.data.Source) {
  341. var hasPage = false;
  342. if (list.length < that.data.Count)
  343. hasPage = true;
  344. that.setData({
  345. List: list,
  346. HasPage: hasPage,
  347. });
  348. } else if (that.data.CardType != -2 && !that.data.Source) {
  349. that.setData({
  350. Count: list.length,
  351. });
  352. var hasPage = false;
  353. if (list.length < that.data.Count && that.data.IsToday == 0)
  354. hasPage = true;
  355. that.setData({
  356. List: list,
  357. HasPage: hasPage,
  358. });
  359. } else {
  360. that.setData({
  361. List: list,
  362. HasNullImage:0,
  363. });
  364. }
  365. var strCardShowDetail = constant1.arrCardShowDetail[that.data.CardShowDetail];
  366. if (that.data.CardShowDetail == 2 && that.data.CardType == -1)
  367. strCardShowDetail = "归档";
  368. else if (that.data.CardType == -2)
  369. strCardShowDetail = "删除";
  370. else if (that.data.PrintID)
  371. strCardShowDetail = "打印卷序号";
  372. that.setData({
  373. CardShowDetailStr: strCardShowDetail,
  374. });
  375. wx.hideLoading();
  376. function getImage(str) {
  377. var result = "";
  378. if (str.indexOf("[图") >= 0) {
  379. result = str.substring(str.indexOf("[图") + 3, str.indexOf("[/图]"));
  380. result = result.substring(result.indexOf("]") + 1);
  381. }
  382. //console.log(result);
  383. return result;
  384. }
  385. },
  386. getNullImageList:function(){
  387. var that=this;
  388. var list=that.data.List;
  389. var arr=[];
  390. var count=0;
  391. for(var i=0;i<list.length;i++){
  392. if (list[i].IsNullImage){
  393. arr.push(list[i]);
  394. count++;
  395. }
  396. }
  397. app.globalData.CardList=arr;
  398. that.setData({
  399. List:arr,
  400. Count:count,
  401. HasPage:false,
  402. HasNullImage:2,
  403. });
  404. wx.setNavigationBarTitle({
  405. title: "遗失图片的题卡"
  406. });
  407. },
  408. onPreview: function (e) {
  409. var id = e.currentTarget.dataset.id;
  410. var url='./preview?type=show&id=' + id;
  411. if (this.data.PrintID)
  412. url+="&PrintID="+this.data.PrintID;
  413. wx.navigateTo({
  414. url: url,
  415. })
  416. },
  417. onBindError: function (e) {
  418. var that = this;
  419. var id = e.currentTarget.dataset.id;
  420. var serverUrl = e.currentTarget.dataset.serverurl;
  421. wx.downloadFile({
  422. url: serverUrl,
  423. success(res) {
  424. if (res.statusCode === 200) {
  425. main.saveTempImage(serverUrl, res.tempFilePath);
  426. }
  427. else{
  428. var list=that.data.List;
  429. for(var i=0;i<list.length;i++){
  430. if (list[i].MiaoguoCardID==id)
  431. list[i].IsNullImage=true;
  432. }
  433. that.setData({
  434. HasNullImage:1,
  435. List:list,
  436. });
  437. wx.pageScrollTo({
  438. scrollTop: 0,
  439. });
  440. }
  441. }
  442. });
  443. },
  444. gotoNextPage: function (e) {
  445. wx.showLoading({
  446. title: '请稍候',
  447. });
  448. setTimeout(function () {
  449. wx.hideLoading();
  450. }, 5000);
  451. var that = this;
  452. var url = 'GetMiaoguoCardList2?UserID=' + app.globalData.userInfo.UserID;
  453. var id = e.currentTarget.dataset.id;
  454. if (id && id > 0)
  455. url += "&PageID=" + id;
  456. if (e.currentTarget.dataset.IsToday)
  457. url += "&IsToday="+e.currentTarget.dataset.IsToday;
  458. var cardtype = e.currentTarget.dataset.cardtype;
  459. if (cardtype || cardtype == "0") {
  460. url += "&CardType=" + cardtype;
  461. var str = constant1.arrStudyPattern[cardtype];
  462. if (cardtype == "2")
  463. str = "全部";
  464. that.setData({
  465. CardType: Number(cardtype),
  466. CardTypeStr: str,
  467. })
  468. } else {
  469. if (that.data.CardType || that.data.CardType==0)
  470. url += "&CardType=" + that.data.CardType;
  471. }
  472. if (that.data.Search)
  473. url += "&Key=" + that.data.Search;
  474. var orderType = that.data.OrderType;
  475. if (orderType)
  476. url += "&OrderType=" + arrOrder[orderType].Value;
  477. if (e.currentTarget.dataset.iscollect == 1)
  478. url += "&IsCollect=1";
  479. if (e.currentTarget.dataset.folderid)
  480. url += "&FolderID="+e.currentTarget.dataset.folderid;
  481. if (e.currentTarget.dataset.dayNumber)
  482. url += "&DayNumber="+e.currentTarget.dataset.dayNumber;
  483. main.getData(url, function (data) {
  484. if (data) {
  485. var list = app.globalData.CardList;
  486. if (id == 0) {
  487. list = [];
  488. that.setData({
  489. Count: data.Count,
  490. });
  491. }
  492. for (var i = 0; i < data.List.length; i++) {
  493. data.List[i].LastTimeStr = common.formatDateCHS(data.List[i].LastTime);
  494. list.push(data.List[i]);
  495. }
  496. app.globalData.CardList = list;
  497. that.getList();
  498. if (data.List.length < 20) {
  499. that.setData({
  500. HasPage: false,
  501. });
  502. }
  503. that.getFilter();
  504. if (that.data.Source=="health"){
  505. setTimeout(function(){
  506. that.setBtnInfo(e.currentTarget.dataset.datatype,data.Count);
  507. },500);
  508. }
  509. }
  510. });
  511. that.setData({
  512. IsOrder: false,
  513. IsHelp: false,
  514. IsShowSelectCardType: false,
  515. });
  516. },
  517. //回收站的下一页
  518. gotoNextPageDelete: function (e) {
  519. wx.showLoading({
  520. title: '请稍候',
  521. });
  522. setTimeout(function () {
  523. wx.hideLoading();
  524. }, 5000);
  525. var that = this;
  526. var url = 'GetMiaoguoCardDeleteList2?UserID=' + app.globalData.userInfo.UserID;
  527. var param={};
  528. var id=e.currentTarget.dataset.id;
  529. param.PageID=id;
  530. param.PageCount=20;
  531. param.Type="app";
  532. main.postData(url,param, function (data) {
  533. if (data) {
  534. var list = app.globalData.CardList;
  535. if (id == 0) {
  536. list = [];
  537. that.setData({
  538. Count: data.Count,
  539. });
  540. }
  541. for (var i = 0; i < data.List.length; i++) {
  542. data.List[i].LastTimeStr = common.formatDateCHS(data.List[i].LastTime);
  543. list.push(data.List[i]);
  544. }
  545. app.globalData.CardList = list;
  546. that.getList();
  547. if (data.List.length < 20) {
  548. that.setData({
  549. HasPageDelete: false,
  550. });
  551. }
  552. that.getFilter();
  553. }
  554. });
  555. that.setData({
  556. IsOrder: false,
  557. IsHelp: false,
  558. IsShowSelectCardType: false,
  559. });
  560. },
  561. getPrintList: function (e) {
  562. wx.showLoading({
  563. title: '请稍候',
  564. });
  565. setTimeout(function () {
  566. wx.hideLoading();
  567. }, 5000);
  568. var that = this;
  569. var url = 'GetMiaoguoCardList2?UserID=' + app.globalData.userInfo.UserID + '&PrintID=' + that.data.PrintID;
  570. main.getData(url, function (data) {
  571. if (data) {
  572. if (data.List.length > 0) {
  573. var list = [];
  574. for (var i = 0; i < data.List.length; i++) {
  575. data.List[i].Number = i + 1;
  576. list.push(data.List[i]);
  577. }
  578. app.globalData.CardList = list;
  579. that.getList();
  580. wx.setNavigationBarColor({
  581. frontColor: "#000000",
  582. backgroundColor: "#ffffff",
  583. });
  584. } else {
  585. that.onSearch();
  586. }
  587. }
  588. });
  589. },
  590. getFilter:function(){
  591. var that = this;
  592. if (app.globalData.TempStr2){
  593. if (that.data.Count<=1)
  594. isFilter=false;
  595. else{
  596. var arr=[["全部",0,"",2,0],["",0,"",0,0]];
  597. var isFilter=false;
  598. var str=app.globalData.TempStr2;
  599. if (str.indexOf("IsCollect=1")>=0){
  600. arr[1][0]="星标";
  601. arr[1][3]=0;
  602. arr[1][4]=1;
  603. isFilter=true;
  604. }
  605. else if (str.indexOf("CardType=0")>=0){
  606. arr[1][0]="日常";
  607. arr[1][3]=0;
  608. arr[1][4]=0;
  609. isFilter=true;
  610. }
  611. else if (str.indexOf("CardType=1")>=0){
  612. arr[1][0]="紧急";
  613. arr[1][3]=1;
  614. arr[1][4]=0;
  615. isFilter=true;
  616. }
  617. else if (str.indexOf("CardType=-1")>=0){
  618. arr[1][0]="归档";
  619. arr[1][3]=-1;
  620. arr[1][4]=0;
  621. isFilter=true;
  622. }
  623. if (that.data.CardType==2){
  624. arr[0][1]=that.data.Count;
  625. arr[0][2]="panelTop40";
  626. }
  627. else{
  628. arr[1][1]=that.data.Count;
  629. arr[1][2]="panelTop40";
  630. arr[0][2]="";
  631. }
  632. //console.log("CardType:"+that.data.CardType);
  633. that.setData({
  634. FilterArr:arr,
  635. });
  636. }
  637. that.setData({
  638. IsFilter:isFilter,
  639. });
  640. }
  641. },
  642. addCard: function () {
  643. //console.log("canPress:"+canPress);
  644. if (canPress) {
  645. var url='./add?type=add&id=0';
  646. if (this.data.FolderID){
  647. url+="&FolderID="+this.data.FolderID+"&FolderName="+this.data.FolderName;
  648. }
  649. else{
  650. var cardtype=this.data.CardType;
  651. if (cardtype==1 || cardtype==-1){
  652. url+="&CardType="+cardtype;
  653. }
  654. }
  655. wx.redirectTo({
  656. url: url,
  657. });
  658. canPress = false;
  659. //console.log("canPress:"+canPress);
  660. setTimeout(function () {
  661. canPress = true;
  662. //console.log("canPress:"+canPress);
  663. }, 2000);
  664. }
  665. },
  666. onSearch: function (e) {
  667. var id=1;
  668. if (e.currentTarget.dataset.id)
  669. id=Number(e.currentTarget.dataset.id);
  670. wx.navigateBack({
  671. delta: id,
  672. });
  673. },
  674. onOrder: function (e) {
  675. var that = this;
  676. var value = e.currentTarget.dataset.value;
  677. switch (Number(value)) {
  678. case 1:
  679. that.data.CardShowDetail = 3;
  680. break;
  681. case 2:
  682. that.data.CardShowDetail = 1;
  683. break;
  684. case 3:
  685. case 4:
  686. that.data.CardShowDetail = 0;
  687. break;
  688. case 5:
  689. case 6:
  690. that.data.CardShowDetail = 2;
  691. break;
  692. case 7:
  693. case 8:
  694. that.data.CardShowDetail = 4;
  695. break;
  696. case 9:
  697. case 10:
  698. that.data.CardShowDetail = 2;
  699. break;
  700. }
  701. for (var i = 0; i < that.data.ArrOrder.length; i++) {
  702. if (i == value) {
  703. that.data.ArrOrder[i].CSS = "PanelBtnSelect2";
  704. } else
  705. that.data.ArrOrder[i].CSS = "";
  706. }
  707. that.setData({
  708. IsOrder: false,
  709. ArrOrder: that.data.ArrOrder,
  710. OrderType: value,
  711. CardShowDetail: that.data.CardShowDetail,
  712. });
  713. if (that.data.IsToday!=1) {
  714. app.globalData.CardList = [];
  715. that.gotoNextPage({
  716. currentTarget: {
  717. dataset: {
  718. id: 0,
  719. IsToday:that.data.IsToday,
  720. OrderType: value,
  721. cardtype: that.data.CardType,
  722. iscollect: that.data.IsCollect,
  723. folderid: that.data.FolderID,
  724. }
  725. }
  726. });
  727. }
  728. },
  729. gotoList:function(e){
  730. var that=this;
  731. var datatype=e.currentTarget.dataset.type;
  732. var isToday=0,cardType=2,isCollect=0,folderID=0,dayNumber=7;
  733. if (datatype=="today"){
  734. isToday=2;
  735. }
  736. else if (datatype=="yesterday"){
  737. isToday=3;
  738. }
  739. else if (datatype=="limit0"){
  740. cardType=0;
  741. isToday=4;
  742. that.setData({
  743. OrderType:5,
  744. });
  745. }
  746. else if (datatype=="limit1"){
  747. cardType=1;
  748. isToday=4;
  749. that.setData({
  750. OrderType:5,
  751. });
  752. }
  753. else{
  754. if (datatype && datatype.indexOf("7")>0)
  755. dayNumber=7;
  756. else if (datatype && datatype.indexOf("30")>0)
  757. dayNumber=30;
  758. if (datatype.indexOf("TimeShort")>=0)
  759. isToday=5;
  760. else if (datatype.indexOf("ClickBlue")>=0)
  761. isToday=6;
  762. else if (datatype.indexOf("ClickShelve")>=0)
  763. isToday=7;
  764. cardType=2;
  765. that.setData({
  766. OrderType:0,
  767. });
  768. }
  769. app.globalData.CardList = [];
  770. that.gotoNextPage({
  771. currentTarget: {
  772. dataset: {
  773. id: 0,
  774. IsToday:isToday,
  775. cardtype: cardType,
  776. iscollect: isCollect,
  777. folderid: folderID,
  778. datatype:datatype,
  779. dayNumber:dayNumber,
  780. }
  781. }
  782. });
  783. },
  784. setBtnInfo:function(datatype,count){
  785. var that=this;
  786. if (datatype=="today"){
  787. that.setData({
  788. Btn1Name:"今日",
  789. Btn1Type:"today",
  790. Btn2Name:"上次",
  791. Btn2Type:"yesterday",
  792. Btn1Count: count,
  793. Btn2Count: "",
  794. Btn1Class: "btn2",
  795. Btn2Class: "",
  796. CardShowDetail: 3,
  797. HasPage: false,
  798. });
  799. }
  800. else if (datatype=="yesterday"){
  801. that.setData({
  802. Btn1Name:"今日",
  803. Btn1Type:"today",
  804. Btn2Name:"上次",
  805. Btn2Type:"yesterday",
  806. Btn1Count: "",
  807. Btn2Count: count,
  808. Btn1Class: "",
  809. Btn2Class: "btn2",
  810. CardShowDetail: 3,
  811. HasPage: false,
  812. });
  813. }
  814. else if (datatype=="limit0"){
  815. that.setData({
  816. Btn1Name:"日常",
  817. Btn1Type:"limit0",
  818. Btn2Name:"紧急",
  819. Btn2Type:"limit1",
  820. Btn1Count: count,
  821. Btn2Count: "",
  822. Btn1Class: "btn2",
  823. Btn2Class: "",
  824. CardShowDetail: 2,
  825. });
  826. }
  827. else if (datatype=="limit1"){
  828. that.setData({
  829. Btn1Name:"日常",
  830. Btn1Type:"limit0",
  831. Btn2Name:"紧急",
  832. Btn2Type:"limit1",
  833. Btn1Count: "",
  834. Btn2Count: count,
  835. Btn1Class: "",
  836. Btn2Class: "btn2",
  837. CardShowDetail: 2,
  838. });
  839. }
  840. else if (datatype=="TimeShort7"){
  841. that.setData({
  842. Btn1Name:"近7天",
  843. Btn1Type:"TimeShort7",
  844. Btn2Name:"近30天",
  845. Btn2Type:"TimeShort30",
  846. Btn1Count: count,
  847. Btn2Count: "",
  848. Btn1Class: "btn2",
  849. Btn2Class: "",
  850. CardShowDetail: 3,
  851. });
  852. }
  853. else if (datatype=="TimeShort30"){
  854. that.setData({
  855. Btn1Name:"近7天",
  856. Btn1Type:"TimeShort7",
  857. Btn2Name:"近30天",
  858. Btn2Type:"TimeShort30",
  859. Btn1Count: "",
  860. Btn2Count: count,
  861. Btn1Class: "",
  862. Btn2Class: "btn2",
  863. CardShowDetail: 3,
  864. });
  865. }
  866. else if (datatype=="ClickBlue7"){
  867. that.setData({
  868. Btn1Name:"近7天",
  869. Btn1Type:"ClickBlue7",
  870. Btn2Name:"近30天",
  871. Btn2Type:"ClickBlue30",
  872. Btn1Count: count,
  873. Btn2Count: "",
  874. Btn1Class: "btn2",
  875. Btn2Class: "",
  876. CardShowDetail: 3,
  877. });
  878. }
  879. else if (datatype=="ClickBlue30"){
  880. that.setData({
  881. Btn1Name:"近7天",
  882. Btn1Type:"ClickBlue7",
  883. Btn2Name:"近30天",
  884. Btn2Type:"ClickBlue30",
  885. Btn1Count: "",
  886. Btn2Count: count,
  887. Btn1Class: "",
  888. Btn2Class: "btn2",
  889. CardShowDetail: 3,
  890. });
  891. }
  892. else if (datatype=="ClickShelve7"){
  893. that.setData({
  894. Btn1Name:"近7天",
  895. Btn1Type:"ClickShelve7",
  896. Btn2Name:"近30天",
  897. Btn2Type:"ClickShelve30",
  898. Btn1Count: count,
  899. Btn2Count: "",
  900. Btn1Class: "btn2",
  901. Btn2Class: "",
  902. CardShowDetail: 3,
  903. });
  904. }
  905. else if (datatype=="ClickShelve30"){
  906. that.setData({
  907. Btn1Name:"近7天",
  908. Btn1Type:"ClickShelve7",
  909. Btn2Name:"近30天",
  910. Btn2Type:"ClickShelve30",
  911. Btn1Count: "",
  912. Btn2Count: count,
  913. Btn1Class: "",
  914. Btn2Class: "btn2",
  915. CardShowDetail: 3,
  916. });
  917. }
  918. },
  919. showOrder: function () {
  920. this.setData({
  921. IsOrder: true,
  922. });
  923. },
  924. closeHelp: function () {
  925. this.setData({
  926. IsOrder: false,
  927. IsHelp: false,
  928. IsShowSelectCardType: false,
  929. });
  930. },
  931. DeleteItem: function (e) {
  932. var that = this;
  933. var id = e.currentTarget.dataset.id;
  934. var list = this.data.List;
  935. var b = true;
  936. for (var i = 0; i < list.length; i++) {
  937. var item = list[i];
  938. if (id == item.MiaoguoCardID) {
  939. if (item.DeleteType == 0) {
  940. item.ScrollLeft = 440;
  941. item.DeleteType = 1;
  942. } else if (item.DeleteType == 1) {
  943. b = false;
  944. item.DeleteType = 0;
  945. item.ScrollLeft = 0;
  946. var url = 'DeleteMiaoguoCard?UserID=' + app.globalData.userInfo.UserID;
  947. url += "&ID=" + id;
  948. main.getData(url, function (data) {
  949. var list = app.globalData.CardList;
  950. for (var i = 0; i < list.length; i++) {
  951. if (id == list[i].MiaoguoCardID) {
  952. list.splice(i, 1);
  953. break;
  954. }
  955. }
  956. app.globalData.CardList = list;
  957. that.setData({
  958. List: list,
  959. Count: --that.data.Count,
  960. });
  961. });
  962. }
  963. } else {
  964. item.DeleteType = 0;
  965. item.ScrollLeft = 0;
  966. }
  967. }
  968. if (b) {
  969. that.setData({
  970. List: list,
  971. });
  972. }
  973. },
  974. showSelectCardShowDetail: function () {
  975. var that = this;
  976. var arr = [];
  977. for (var i = 0; i < 5; i++) {
  978. var obj = {};
  979. obj.Name = constant1.arrCardShowDetail[i];
  980. if (that.data.CardType == -1 && i == 2)
  981. obj.Name = "归档";
  982. if (i < 4)
  983. obj.Name += "时间";
  984. if (i == that.data.CardShowDetail)
  985. obj.IsSelected = "PanelBtnSelect";
  986. else
  987. obj.IsSelected = "";
  988. arr.push(obj);
  989. }
  990. that.setData({
  991. IsShowCardShowDetail: true,
  992. CardShowDetailArr: arr,
  993. });
  994. },
  995. hideSelectCardShowDetail: function () {
  996. var that = this;
  997. that.setData({
  998. IsShowCardShowDetail: false,
  999. });
  1000. },
  1001. selectCardShowDetail: function (e) {
  1002. var that = this;
  1003. that.data.CardShowDetail = e.currentTarget.dataset.id;
  1004. that.setData({
  1005. IsShowCardShowDetail: false,
  1006. CardShowDetail: that.data.CardShowDetail,
  1007. });
  1008. that.getList();
  1009. that.hideSelectCardShowDetail();
  1010. },
  1011. showHelp: function () {
  1012. var that = this;
  1013. that.setData({
  1014. IsHelp: true,
  1015. });
  1016. },
  1017. showSelectCardType: function () {
  1018. var that = this;
  1019. var arr = [
  1020. ["全部", "", 2],
  1021. ["日常", "", 0],
  1022. ["紧急", "", 1],
  1023. ["归档", "", -1]
  1024. ];
  1025. switch (that.data.CardType) {
  1026. case 2:
  1027. arr[0][1] = "PanelBtnSelect";
  1028. break;
  1029. case 0:
  1030. arr[1][1] = "PanelBtnSelect";
  1031. break;
  1032. case 1:
  1033. arr[2][1] = "PanelBtnSelect";
  1034. break;
  1035. case -1:
  1036. arr[3][1] = "PanelBtnSelect";
  1037. break;
  1038. }
  1039. that.setData({
  1040. IsShowSelectCardType: true,
  1041. CardTypeArr: arr,
  1042. });
  1043. },
  1044. recoverItem: function (e) {
  1045. var that = this;
  1046. var id = e.currentTarget.dataset.id;
  1047. var url = "DeleteMiaoguoCardWeb?UserID=" + app.globalData.userInfo.UserID;
  1048. var param = {};
  1049. param.IsRecover = "true";
  1050. param.VisitType = "vtqOSthN7vSwYmhc1gCjfw==";
  1051. param.ID = common.Encrypt(id);
  1052. main.postData(url, param, function () {
  1053. var list = app.globalData.CardList;
  1054. for (var i = 0; i < list.length; i++) {
  1055. if (id == list[i].MiaoguoCardID) {
  1056. list.splice(i, 1);
  1057. break;
  1058. }
  1059. }
  1060. app.globalData.CardList = list;
  1061. that.setData({
  1062. List: list,
  1063. Count: --that.data.Count,
  1064. });
  1065. });
  1066. },
  1067. setCollect: function (e) {
  1068. var that = this;
  1069. if (!isCollecting) {
  1070. isCollecting = true;
  1071. setTimeout(function () {
  1072. isCollecting = false;
  1073. }, 3000);
  1074. var id=e.currentTarget.dataset.id;
  1075. var collect=e.currentTarget.dataset.collect;
  1076. if (collect==0) {
  1077. collect = 1;
  1078. }
  1079. else {
  1080. collect = 0;
  1081. }
  1082. main.setCollect(id, collect, function () {
  1083. var list = app.globalData.CardList;
  1084. for (var i = 0; i < list.length; i++) {
  1085. if (id == list[i].MiaoguoCardID) {
  1086. if (collect==0)
  1087. list.splice(i, 1);
  1088. else
  1089. list[i].IsCollect = collect;
  1090. break;
  1091. }
  1092. }
  1093. app.globalData.CardList = list;
  1094. that.setData({
  1095. List: list,
  1096. });
  1097. });
  1098. }
  1099. },
  1100. editField: function (e) {
  1101. var id=e.currentTarget.dataset.id;
  1102. var that = this;
  1103. wx.navigateTo({
  1104. url: './add?type=edit&id=' + id,
  1105. });
  1106. },
  1107. removeFolder:function(e){
  1108. var that = this;
  1109. var id=e.currentTarget.dataset.id;
  1110. var url = 'RemoveFolder?UserID=' + app.globalData.userInfo.UserID;
  1111. url += "&ID=" + id;
  1112. url += "&FolderID=" + that.data.FolderID;
  1113. main.getData(url, function (data) {
  1114. var list = app.globalData.CardList;
  1115. for (var i = 0; i < list.length; i++) {
  1116. if (id == list[i].MiaoguoCardID) {
  1117. list.splice(i, 1);
  1118. break;
  1119. }
  1120. }
  1121. app.globalData.CardList = list;
  1122. that.setData({
  1123. List: list,
  1124. Count: --that.data.Count,
  1125. });
  1126. });
  1127. },
  1128. setOrderSelect:function(od){
  1129. var that=this;
  1130. for(var k=0;k<arrOrder.length;k++){
  1131. if (k==od)
  1132. arrOrder[k].CSS = "PanelBtnSelect2";
  1133. else
  1134. arrOrder[k].CSS = "";
  1135. }
  1136. that.setData({
  1137. ArrOrder: arrOrder,
  1138. OrderType:od,
  1139. });
  1140. },
  1141. //设置多选状态
  1142. setMultipleOptions:function(event){
  1143. var that=this;
  1144. //debugger;
  1145. var IsMultipleOptions=event.currentTarget.dataset.index==1?true:false;
  1146. that.setData({
  1147. IsMultipleOptions:IsMultipleOptions,
  1148. });
  1149. if (!IsMultipleOptions){
  1150. var list=that.data.List;
  1151. for(var i=0;i<list.length;i++){
  1152. list[i].Selected=false;
  1153. }
  1154. that.setData({
  1155. List:list,
  1156. SelectedCount:0,
  1157. CanScroll:true,
  1158. });
  1159. }
  1160. else{
  1161. that.setData({
  1162. CanScroll:false,
  1163. });
  1164. }
  1165. },
  1166. //选择或反选项
  1167. selectedItem:function(event){
  1168. var that=this;
  1169. var isAll=event.currentTarget.dataset.isall;
  1170. var id=event.currentTarget.dataset.id;
  1171. var list=that.data.List;
  1172. var selectedCount=0;
  1173. //debugger;
  1174. for(var i=0;i<list.length;i++){
  1175. if (isAll){
  1176. list[i].Selected=true;
  1177. }
  1178. else{
  1179. if (id==list[i].MiaoguoCardID){
  1180. if(!list[i].Selected)
  1181. list[i].Selected=true;
  1182. else
  1183. list[i].Selected=false;
  1184. }
  1185. }
  1186. if (list[i].Selected)
  1187. selectedCount++;
  1188. }
  1189. that.setData({
  1190. List:list,
  1191. SelectedCount:selectedCount,
  1192. });
  1193. },
  1194. showMultipleOther: function (event) {
  1195. var that = this;
  1196. var index=event.currentTarget.dataset.index;
  1197. var b=false;
  1198. if (index==1)
  1199. b=true;
  1200. if (b && that.data.SelectedCount==0){
  1201. wx.showToast({
  1202. title: '请先选择题卡',
  1203. });
  1204. }
  1205. else{
  1206. that.setData({
  1207. IsShowSelectContainer: b,
  1208. SelectContainerStyle:0,
  1209. });
  1210. }
  1211. },
  1212. //显示多选提醒
  1213. showMultipleNotice:function(event){
  1214. var that = this;
  1215. var index=event.currentTarget.dataset.index;
  1216. var mData = constant1.arrMultipleSaveData[index];
  1217. if (index==1 || index>=4){
  1218. var content=mData.Content.replace("[SelectedCount]",that.data.SelectedCount);
  1219. wx.showModal({
  1220. title: '提醒',
  1221. content: content,
  1222. confirmText:mData.ConfirmText,
  1223. complete: (res) => {
  1224. if (res.confirm) {
  1225. that.saveMultipleData(mData,that.data.List);
  1226. }
  1227. }
  1228. });
  1229. }
  1230. else if (index==2 || index==3){
  1231. //debugger;
  1232. var menu=event.currentTarget.dataset.menu;
  1233. if (menu==1){
  1234. that.setData({
  1235. SelectContainerStyle: index,
  1236. });
  1237. } else if (menu==2) {
  1238. var id=event.currentTarget.dataset.id;
  1239. that.showFolderListSelect({currentTarget:{dataset:{index:1,readfolder:id}}});
  1240. } else {
  1241. var id=event.currentTarget.dataset.id;
  1242. if (index==3){
  1243. mData.Param.IsCollect=id;
  1244. mData.FinishedText=mData.FinishedTextArr[id];
  1245. that.saveMultipleData(mData,that.data.List);
  1246. }
  1247. else{
  1248. if (id==0)
  1249. mData.Param.FolderID=0;
  1250. else{
  1251. var list=that.data.FolderList;
  1252. for(var i=0;i<list.length;i++){
  1253. if (list[i].Selected==1){
  1254. mData.Param.FolderID=list[i].ID;
  1255. mData.Param.FolderName=list[i].Name;
  1256. break;
  1257. }
  1258. }
  1259. }
  1260. mData.FinishedText=mData.FinishedTextArr[id];
  1261. that.saveMultipleData(mData,that.data.List);
  1262. }
  1263. }
  1264. }
  1265. },
  1266. //保存多选数据
  1267. saveMultipleData:function(mData,list){
  1268. var that=this;
  1269. var arr=[];
  1270. for(var i=0;i<list.length;i++){
  1271. if (list[i].Selected){
  1272. var id=list[i].MiaoguoCardID;
  1273. id=common.Encrypt(id);
  1274. arr.push(id);
  1275. }
  1276. }
  1277. if (arr.length>0){
  1278. var sql=mData.SaveFun+"?UserID="+app.globalData.userInfo.UserID;
  1279. var param=mData.Param;
  1280. param[param.ListStr]=arr;
  1281. //console.log(JSON.stringify(param));
  1282. main.postData(sql, param, function (data) {
  1283. list=that.updateSavedList(that.data.ShowMultiple,mData,list);
  1284. app.globalData.CardList=list;
  1285. that.setData({
  1286. List:list,
  1287. SelectedCount:0,
  1288. IsShowSelectContainer:false,
  1289. IsMultipleOptions:false,
  1290. IsFolderListContainer:0,
  1291. FolderList:null,
  1292. });
  1293. wx.showToast({
  1294. title: mData.FinishedText,
  1295. duration: 2000,
  1296. });
  1297. });
  1298. }
  1299. },
  1300. //更新保存的列表状态
  1301. updateSavedList:function(source,mData,list){
  1302. var that=this;
  1303. var index=mData.ID;
  1304. //debugger;
  1305. for(var i=list.length-1;i>=0;i--){
  1306. if (list[i].Selected){
  1307. list[i].Selected=0;
  1308. if (index==1){//删除
  1309. list.splice(i,1);
  1310. that.data.Count--;
  1311. }
  1312. else if (index==2){
  1313. list[i].FolderID=mData.Param.FolderID;
  1314. if (list[i].FolderID>0)
  1315. list[i].FolderName=mData.Param.FolderName;
  1316. if (source>0 && index!=source && mData.Param.FolderID!=source){ //不同类型列表删除
  1317. list.splice(i,1);
  1318. that.data.Count--;
  1319. }
  1320. app.globalData.FolderList=[];
  1321. }
  1322. else if (index==3){
  1323. list[i].IsCollect=Number(mData.Param.IsCollect);
  1324. if (source>0 && source<8 && index==source && mData.Param.IsCollect==0) {//不同类型列表删除
  1325. list.splice(i,1);
  1326. that.data.Count--;
  1327. }
  1328. }
  1329. else if (index==4){
  1330. list[i].CardType=-1;
  1331. list[i].CardTypeStr="归档";
  1332. if (source>0 && source<8 && index!=source){ //不同类型列表删除
  1333. list.splice(i,1);
  1334. that.data.Count--;
  1335. }
  1336. }
  1337. else if (index==5){
  1338. list[i].CardType=0;
  1339. list[i].CardTypeStr="日常";
  1340. if (source>0 && source<8 && index!=source){ //不同类型列表删除
  1341. list.splice(i,1);
  1342. that.data.Count--;
  1343. }
  1344. }
  1345. else if (index==6){
  1346. list[i].CardType=1;
  1347. list[i].CardTypeStr="紧急";
  1348. if (source>0 && source<8 && index!=source){ //不同类型列表删除
  1349. list.splice(i,1);
  1350. that.data.Count--;
  1351. }
  1352. }
  1353. else if (index==7){
  1354. list[i].CardType=0;
  1355. list[i].CardTypeStr="日常";
  1356. list[i].FirstTime='1900-01-01 00:00:00';
  1357. list[i].FirstTimeStr='1900-01-01';
  1358. list[i].LastTime='1900-01-01 00:00:00';
  1359. list[i].LastTimeStr='1900-01-01';
  1360. list[i].LimitTime=common.formatTime(new Date(),"-");
  1361. list[i].LimitTimeStr=common.formatTime(new Date(),"-",true);
  1362. list[i].IntervalDay=0;
  1363. list[i].RepetitionCoefficient=2.0;
  1364. list[i].UpdateTime=list[i].LimitTime;
  1365. list[i].UpdateTimeStr="今天";
  1366. list[i].CardCategory="新题卡";
  1367. }
  1368. }
  1369. }
  1370. that.setData({
  1371. Count:that.data.Count,
  1372. });
  1373. return list;
  1374. },
  1375. showFolderListSelect:function(e){
  1376. var that=this;
  1377. var index=Number(e.currentTarget.dataset.index);
  1378. that.setData({
  1379. IsFolderListContainer:index,
  1380. });
  1381. if (index==1){
  1382. var url = 'GetUserFolderList?UserID=' + app.globalData.userInfo.UserID;
  1383. main.getData(url, function (data) {
  1384. that.setData({
  1385. FolderList: data,
  1386. });
  1387. });
  1388. }
  1389. else{
  1390. that.setData({
  1391. FolderList: null,
  1392. });
  1393. }
  1394. },
  1395. selectFolderItem:function(e){
  1396. var that=this;
  1397. var index=Number(e.currentTarget.dataset.index);
  1398. var list=that.data.FolderList;
  1399. for(var i=0;i<list.length;i++){
  1400. list[i].Selected=0;
  1401. if (index==i){
  1402. list[i].Selected=1;
  1403. }
  1404. }
  1405. that.setData({
  1406. FolderList:list,
  1407. });
  1408. },
  1409. goto: function (e) {
  1410. var url = e.currentTarget.dataset.url;
  1411. wx.navigateTo({
  1412. url: './' + url,
  1413. })
  1414. },
  1415. redirect: function (e) {
  1416. var that=this;
  1417. var url = e.currentTarget.dataset.url;
  1418. app.globalData.TempStr2="CardType="+that.data.CardType+"&IsCollect="+that.data.IsCollect;
  1419. wx.redirectTo({
  1420. url: './' + url,
  1421. })
  1422. },
  1423. showHelpImage:function(){
  1424. var url=app.globalData.uploadImageUrl+"web/update_image_mathod.png";
  1425. wx.previewImage({
  1426. current: url, // 当前显示图片的http链接
  1427. urls: [url] // 需要预览的图片http链接列表
  1428. });
  1429. },
  1430. onShareAppMessage: function () {
  1431. return {
  1432. title: app.globalData.ShareTitle,
  1433. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  1434. imageUrl: app.globalData.ShareImage,
  1435. }
  1436. },
  1437. })