zoukankan      html  css  js  c++  java
  • 简单的信誉算法 js处理

    $(document).ready(function(){
        // 初始化
        var credit = "{sh:$info.credit}";
        var res = getCreditStar(credit);
        $("#show_result").text(res);
    
        // 触发事件
        $("#credit").change(function(){
            // 计算信誉值
            var credit = parseInt($(this).val());
            var res = getCreditStar(credit);
            $("#show_result").text(res);
            
        });
    
    });
    
    // 计算荣誉标记
    function getCreditStar(credit) {
        credit = parseInt(credit);
        var res;
        if (credit <= 25) {
            num = Math.floor(credit/5);
            res = num+"星";
        }
    
        if (credit > 25 && credit <= 125) {
            num = Math.floor(credit/25);
            res = num+"钻";
        }
    
        if (credit > 125 && credit <= 625) {
            num = Math.floor(credit/125);
            res = num+"冠";
        }
    
        if (credit > 625 && credit <= 3125) {
            num = Math.floor(credit/625);
            res = num+"皇冠";
        }
    
        if (credit > 3125) {
            res = 5+"皇冠";
        }
        return res;
    }
    

    5分一心,5心一钻,5钻一冠,5冠一皇。最高五皇。

    这个是简单的处理,估计真正复杂的,到后面升级所需积分肯定越来越多。要不然升级太容易。

  • 相关阅读:
    第二阶段团队绩效评分
    团队冲刺2.9
    团队冲刺2.8
    团队冲刺2.7
    团队冲刺2.6
    团队冲刺2.5
    项目总结以及事后诸葛亮会议
    做什么都队第二阶段绩效评估
    第二阶段冲刺第十天
    第二阶段冲刺第九天
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/5591704.html
Copyright © 2011-2022 走看看