HTML5¼¼Êõ

MVCαһ¸ö12306ͼƬÑéÖ¤Âë - ÉñÅ£²½ÐÐ3(2)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2017-01-18 12:03 ÎÒÒªÆÀÂÛ( )

³õʼ»¯Í¼Æ¬Ô´ ListMoImgCode listCode 5 { { 8 var list = new ListMoImgCode (); ); 10 var info = new DirectoryInfo(path); 11 foreach ( var item in info.GetFiles()) 12 { 13 list.Add( new MoImgCode 14 { 1

³õʼ»¯Í¼Æ¬Ô´ List<MoImgCode> listCode 5 { { 8 var list = new List<MoImgCode>(); ); 10 var info = new DirectoryInfo(path); 11 foreach (var item in info.GetFiles()) 12 { 13 list.Add(new MoImgCode 14 { 15 Index = item.Name, )[0], 17 ImgUrl = item.FullName 18 }); 19 } 20 return list; 21 } 22 }

»ñÈ¡Ëæ»úСͼƬÑéÖ¤Âë·½·¨£º

»ñȡСͼƬÑéÖ¤Âë List<MoImgCode> CreateImgCode(string indexType, int strLen = 8) 8 { 9 var choiceCodeList = new List<MoImgCode>(); { compareList = new List<MoImgCode>(); 14 var imgCodeLen = listCode.Count; maxChoiceNum = 5; 18 var minChoiceNum = 2; 19 var rdChoiceNum = rm.Next(minChoiceNum, maxChoiceNum); choiceList = listCode.Where(b => b.IndexType == indexType).Take(rdChoiceNum); 22 foreach (var item in choiceList) 23 { 24 compareList.Add(new MoImgCode 25 { 26 Index = item.Index, 27 ImgUrl = item.ImgUrl, 28 IndexType = item.IndexType, 29 IsChoice = true 30 }); 31 } lessNum = strLen - choiceList.Count(); (int i = 0; i < lessNum; i++) 37 { 38 var lessCode = listCode.Where(b => !compareList.Any(bb => bb.IndexType == b.IndexType)).ToList(); 39 var val = rm.Next(0, lessCode.Count); 40 var otherItem = lessCode.Skip(val).Take(1).SingleOrDefault(); 41 compareList.Add(new MoImgCode 42 { 43 Index = otherItem.Index, 44 ImgUrl = otherItem.ImgUrl, 45 IndexType = otherItem.IndexType, 46 IsChoice = false 47 }); 48 } (var item in compareList) 52 { 53 var lessCode = compareList.Where(b => !choiceCodeList.Any(bb => bb.Index == b.Index)).ToList(); comparIndex = rm.Next(0, lessCode.Count); 56 choiceCodeList.Add(lessCode[comparIndex]); 57 } 58 } 59 catch (Exception ex) 60 { 61 } 62 return choiceCodeList; 63 }

 

» MVCÈçºÎʹÓÃͼƬÑéÖ¤Âë

ÓÉÓÚÎÒÃÇÐèÒªÔÚÒ³ÃæÉÏÌáʾÓû§Ñ¡Ôñ“xxx”ÀàÐ͵ÄͼƬ£¬ËùÒÔÐèҪͨ¹ýºǫ́·µ»ØÑéÖ¤ÂëµÄͼƬºÍͼƬÀàÐÍÃû³ÆÈ磺

ÏÔȻһ¸öaction·½·¨²»ÄÜͬʱ·µ»ØͼƬÁ÷ºÍÎÄ×Ö£¬ËùÒÔÎÒÕâÀï·Ö¿ªÁ½¸ö·½·¨·Ö±ð·µ»Ø“Æó¶ì”ºÍͼƬ£¬·½·¨´úÂëÈ磺

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • ÀûÓÃKaptcha.jarÉú³ÉͼƬÑéÖ¤Â루ÒÔÏÂÔ´Âë¿ÉÒÔÖ±½Ó¸´ÖƲ¢×Ô¶¨ÒåÐ޸ģ© - ÍòÔª»§jhg

    ÀûÓÃKaptcha.jarÉú³ÉͼƬÑéÖ¤Â루ÒÔÏÂÔ´Âë¿ÉÒÔÖ±½Ó¸´ÖƲ¢×Ô¶¨ÒåÐÞ¸Ä

    2017-01-18 10:00

  • Ò»¸öÏë·¨£º³ÉÁ¢²Ý¸ù¼¼ÊõÁªÃ˶Կª·¢ÈËÔ±½øÐм¼Êõ¶¨¼¶½â¾öÆóÒµÔ±¹¤ÕÐƸÄÑÎÊÌ⣡ - ·¹ýÇïÌì

    Ò»¸öÏë·¨£º³ÉÁ¢²Ý¸ù¼¼ÊõÁªÃ˶Կª·¢ÈËÔ±½øÐм¼Êõ¶¨¼¶½â¾öÆóÒµÔ±¹¤ÕÐƸ

    2017-01-08 10:00

  • Ò»¸ö¼òµ¥´Ö±©µÄÈËÁ³ÈÏÖ¤±ê×¢¹¤¾ßµÄʵÏÖ - ß÷¶ú¶ä

    Ò»¸ö¼òµ¥´Ö±©µÄÈËÁ³ÈÏÖ¤±ê×¢¹¤¾ßµÄʵÏÖ - ß÷¶ú¶ä

    2017-01-05 11:01

  • iosselect£ºÒ»¸öjs pickerÏîÄ¿£¬ÔÚH5ÖÐʵÏÖIOSµÄselectÏÂÀ­¿òЧ¹û - mufc-go

    iosselect£ºÒ»¸öjs pickerÏîÄ¿£¬ÔÚH5ÖÐʵÏÖIOSµÄselectÏÂÀ­¿òЧ¹û -

    2017-01-01 10:02

ÍøÓѵãÆÀ
±