//璇勫垎鏄剧ず 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 '