//璇勫垎鏄剧ず function scoreshow(obj,opt){ let scorenum = opt.scorenum, bgsize = ''+opt.imgwidth+'px '+opt.imgheight+'px'; obj.attr('score-num',scorenum); if(opt.type == 10) scorenum = opt.num/2; obj.css({ 'width': opt.imgwidth * opt.num, 'height': opt.imgheight, 'backgroundImage': 'url('+opt.imgsrc+')', 'backgroundSize': bgsize, 'position': 'relative' }); obj.append('

'); obj.find('p').css({ 'width': scorenum*opt.imgwidth, 'height': opt.imgheight, 'backgroundImage': 'url('+opt.curimgsrc+')', 'background-size': bgsize, 'position': 'absolute', 'left':'0' }); } //鎿嶄綔璇勫垎 function startscore(obj,opt){ if(opt == undefined){ opt = { Fraction: 5, //鎬诲垎 startnum: 5, //涓暟 color: '#e4e7ed', //榛樿棰滆壊 higcolor: '#f57f17', //楂樹寒棰滆壊 width: '32px', //鍗曚釜鐨勫 height: '32px', //鍗曚釜鐨勯珮 decimal: true, //鏄惁鏄剧ず灏忔暟鐐 Rating: 0, //榛樿楂樹寒涓暟锛屽拰涓嬮潰鐨勯厤鍚堜娇鐢 readOnly: false //鍙妯″紡, } } obj.html(''); let _rating; state = { rating: (Math.round(opt.Rating * 2 ) / 2).toFixed(1) } let _uid = Math.floor( Math.random() * 999 ), num = opt.Fraction / opt.startnum; function getIndex(e){ let $target = $(e.currentTarget); let width = $target.width(); let side = ( e.offsetX < (width / 2) && !false) ? 'left' : 'right'; if(opt.decimal){ let index = ($target.index() - ((side === 'left') ? 0.5 : 0)); index = ( index < 0 && (e.offsetX < width / 10) ) ? -1 : index; return index; }else{ let index = $target.index(); index = ( index < 0 && (e.offsetX < width / 10) ) ? -1 : index; return index; } } function getLinearGradient(id, startColor, endColor){ return ''; } let strhtml; for(let i=0;i'; star += ''; star += ''; star += getLinearGradient(_uid + '_SVGID_1_', opt.color, opt.color); // star += getLinearGradient(_uid + '_SVGID_2_', 'red', 'red') + //杩欎釜鍙互鐢ㄤ綔榧犳爣婊戣繃鐨勯鑹层€ star += getLinearGradient(_uid + '_SVGID_3_', opt.higcolor, opt.higcolor); star += ''; star += ''; star += '' star += ''; obj.append(star); } obj.addClass('flexBoxWrap'); if(opt.Rating != 0){ obj.attr('score', opt.Rating); } obj.find('.score-star').on('click', function (e) { let index = getIndex(e); let rating = index + 1; paintStars(index, 'active'); // executeCallback(rating,$(this).$el); state.rating = rating * num; obj.attr('score', state.rating); }); function paintStars(endIndex, stateClass){ let $polygonLeft; let $polygonRight; let leftClass; let rightClass; $.each(obj.find('.score-star'), function(index, star){ $polygonLeft = $(star).find('polygon[data-side="left"]'); $polygonRight = $(star).find('polygon[data-side="right"]'); leftClass = rightClass = (index <= endIndex) ? stateClass : 'empty'; leftClass = ( index - endIndex === 0.5 ) ? stateClass : leftClass; $polygonLeft.attr('class', 'svg-' + leftClass + '-' + _uid); $polygonRight.attr('class', 'svg-' + rightClass + '-' + _uid); }.bind(this)) if (opt.readOnly) { obj.find('.score-star').off(); } } paintStars(state.rating-1, 'active'); } //涓冪墰鍥剧墖涓婁紶 function qiniu(obj,Sizeprompt){ var filepath = obj.val(); var extStart = filepath.lastIndexOf("."); var ext = filepath.substring(extStart+1, filepath.length).toLowerCase(); if(filepath.length >0 && ext != "png" && ext != "gif" && ext != "jpg" && ext != "jpeg"){ obj.val(""); _alert('璇蜂笂浼犲悗缂€鍚嶄负锛歡if锛宩pg锛宲ng'); // _alert(finyi[10]) return false; } var file = obj[0].files[0]; if(file.size/1024 > 500){ Sizeprompt.show(); return false; } var type = file.type; if(!file.type){ type = 'application/octet-stream'; } var token = ''; $.ajax({ url: '/member/token', type: 'post', dataType: 'json', async: false, data: { file_type: type, ext: ext, id: file.id }, success: function (res) { token = res.token; }, error: function (res) { console.log(res); } }); let imgurl; var formData = new FormData(); formData.append('token', token); formData.append('file', file); $.ajax({ type: 'POST', url: 'http://upload.qiniup.com', data: formData, processData: false, contentType: false, success: function (res) { imgurl = res.url; obj.closest('[aIcomment-img]').append('
'); obj.attr('type', 'text').val(''); }, error: function (res) { console.log(res); } }); } //鍚嶅瓧鑴辨晱淇濆瘑* function formatName(name){ let newStr; if(name.length > 2){ let char = ''; for(let i = 0,len=name.length - 2;i opt.gtpage){ html += '
  • 1
  • '; if (curpage <= 2){ html += '
  • 2
  • '; html += '
  • 3
  • '; html += '
  • ...
  • '; }else if(curpage > 2 && curpage <= opt.pagesize - 2){ html += '
  • ...
  • '; html += '
  • ' + (curpage - 1) + '
  • '; html += '
  • ' + curpage + '
  • '; html += '
  • ' + (curpage + 1) + '
  • '; html += '
  • ...
  • '; }else{ html += '
  • ...
  • '; for (var i = opt.pagesize-2;i' + i + ''; } } html += '
  • '+opt.pagesize+'
  • '; }else{ for(var i=1;i<= opt.pagesize;i++){ html += '
  • ' + i + '
  • '; } } html += '
  • '; html += ''; if(opt.showinput == true){ html += '
      ' + obj.attr('page-go') + '    ' + obj.attr('page-page') + '
    '; } html += ''; obj.html(html); obj.find('.compage[aicomment-page='+curpage+']').attr('compage',"active"); obj.find('[compage="active"]').css({ 'background-color': opt.bgcolor, 'border-color': opt.bdcolor, 'color': opt.color, }); } html(opt.curpage); }