發(fā)表日期:2018-06 文章編輯:小燈 瀏覽次數(shù):3132
評分組標(biāo)簽:[@cms_score_group id=’1’]
參數(shù)詳解
id:評分組id,非必選,沒有則取默認(rèn)組
具體例子:
[@cms_score_group]
<!-- 系統(tǒng)默認(rèn)的2號分組是星級評分 -->
<!-- 平均評分有二級緩存,評分后不會立即顯示新的平均評分 -->
[#if tag_bean??]
[#if tag_bean.id==2]
<div>
<div>
<div id="function-score"></div>
<div id="function-hint"></div>
</div>
</div>
<script type="text/javascript" src="${resSys}/raty/jquery.raty.min.js"></script>
<script type="text/javascript">
$(function() {
var scored=$.cookie("_cms_score_" +${content.id});
var readOnly=false;
if(scored==1)readOnly=true;//已經(jīng)投票設(shè)置只讀
$.fn.raty.defaults.path = '${resSys}/raty/img';
var scores=new Array();
[#list tag_bean.orderItems as item]
scores.push(${item.id!});
[/#list]
$('#function-score').raty({
number: ${tag_bean.items?size},//多少個星星設(shè)置
[#if content.scoreAvg!=0]score: ${content.scoreAvg},[/#if]//之前有評分,初始值是設(shè)置
targetType: 'hint',//類型選擇,number是數(shù)字值,hint,是設(shè)置的數(shù)組值
path : '${resSys}/raty/img',
hints : [
[#list tag_bean.orderItems as item]
'${item.name!}'[#if item_has_next],[/#if]
[/#list]
],
cancelOff : 'cancel-off-big.png',
cancelOn : 'cancel-on-big.png',
size : 24,
starHalf : 'star-half-big.png',
starOff : 'star-off-big.png',
starOn : 'star-on-big.png',
target : '#function-hint',
cancel : false,
targetKeep: true,
targetText: '請選擇評分',
readOnly:readOnly,
click: function(score, evt) {
var succ=Cms.score('${base}',${content.id},scores[score-1]);
if(!succ){
alert("您已經(jīng)評分過了!");
$('#function-score').raty('score', ${content.scoreAvg});
}else{
alert("評分成功!");
$('#function-score').raty('readOnly', true);
}
}
});
});
</script>
[#else]
<!-- 其他 -->
<ul>
[#list tag_bean.orderItems as item]
<li style="float:left;cursor: pointer;" onclick="Cms.score('${base}',${content.id},${item.id});">
<p style="text-align:center;"> <span id="score-item-${item.id}">0</span>票</p>
[#if item.imagePath??]<p><img src="${item.imagePath}"/></p>[/#if]
<p style="text-align:center;">${item.name!}</p>
</li>
[/#list]
</ul>
<script type="text/javascript">
$(function() {
Cms.scoreCount("${base}","${content.id}");
});
</script>
[/#if]
[/#if]
[/@cms_score_group]
如果新增了其他評分組設(shè)定了默認(rèn)評分組,需要實現(xiàn)效果
日期:2018-06 瀏覽次數(shù):3564
日期:2018-06 瀏覽次數(shù):3141
日期:2018-06 瀏覽次數(shù):3270
日期:2018-06 瀏覽次數(shù):3044
日期:2018-06 瀏覽次數(shù):3396
日期:2018-06 瀏覽次數(shù):3229
日期:2018-06 瀏覽次數(shù):3041
日期:2018-06 瀏覽次數(shù):3350
日期:2018-06 瀏覽次數(shù):3181
日期:2018-06 瀏覽次數(shù):3823
日期:2018-06 瀏覽次數(shù):2828
日期:2018-06 瀏覽次數(shù):2857
日期:2018-06 瀏覽次數(shù):3131
日期:2018-06 瀏覽次數(shù):2872
日期:2018-06 瀏覽次數(shù):2595
日期:2018-06 瀏覽次數(shù):2776
日期:2018-06 瀏覽次數(shù):3057
日期:2018-06 瀏覽次數(shù):2776
日期:2018-06 瀏覽次數(shù):2654
日期:2018-06 瀏覽次數(shù):2727
日期:2018-06 瀏覽次數(shù):2641
日期:2018-06 瀏覽次數(shù):2602
日期:2018-06 瀏覽次數(shù):2713
日期:2018-06 瀏覽次數(shù):2860
日期:2018-06 瀏覽次數(shù):2988
日期:2018-06 瀏覽次數(shù):2723
日期:2018-06 瀏覽次數(shù):2836
日期:2018-06 瀏覽次數(shù):2947
日期:2018-06 瀏覽次數(shù):2792
日期:2018-06 瀏覽次數(shù):2741
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.