藏茗山學院
安全可靠、性能穩定、追求極致的用戶體驗
JEECMSv9.x常用功能標簽大全
評分組 [@cms_score_group]
評分組標簽:[@cms_score_group id=’1’]
參數詳解
id:評分組id,非必選,沒有則取默認組
具體例子:
[@cms_score_group]
<!-- 系統默認的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;//已經投票設置只讀
$.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},//多少個星星設置
[#if content.scoreAvg!=0]score: ${content.scoreAvg},[/#if]//之前有評分,初始值是設置
targetType: 'hint',//類型選擇,number是數字值,hint,是設置的數組值
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("您已經評分過了!");
$('#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]
如果新增了其他評分組設定了默認評分組,需要實現效果