mainlist.js 40 KB

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