起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2418|回复: 9

[处理中4] 类似淘宝评分取值问题

[复制链接]

10

主题

46

帖子

88

积分

初级会员

Rank: 2

积分
88
QQ
发表于 2016-12-15 16:00:16 | 显示全部楼层 |阅读模式
js代码define(function(require) {        var $ = require("jquery");
        var justep = require("$UI/system/lib/justep");
        var baas = require("$UI/ptop/common/js/baas");

        var Model = function() {
                this.callParent();
                this.descStar = 0;
                this.serviceStar = 0;
        };

        Model.prototype.modelLoad = function(event) {

        };

        // 获取描述data某行的状态
        Model.prototype.getDescDataRowState = function(index) {
                if (this.comp("descData").getCount() > 0) {
                        var row = this.comp("descData").datas.get()[index];
                        return row.val("state");
                }
                return "N";
        };
        // 获取服务data某行的状态
        Model.prototype.getServiceDataRowState = function(index) {
                if (this.comp("serviceData").getCount() > 0) {
                        var row = this.comp("serviceData").datas.get()[index];
                        return row.val("state");
                }
                return "N";
        };
        // 获取服务data某行的状态
        Model.prototype.getSendDataRowState = function(index) {
                if (this.comp("sendData").getCount() > 0) {
                        var row = this.comp("sendData").datas.get()[index];
                        return row.val("state");
                }
                return "N";
        };
        // 点击描述星
        Model.prototype.descStarOnClick = function(event) {
                var value = event.currentTarget.getAttribute('value');
                for (var i = 0; i < 5; i++) {
                        var row = this.comp("descData").datas.get()[i];
                        row.val("state", "N");
                }
                for (var n = 0; n < parseInt(value); n++) {
                        var row = this.comp("descData").datas.get()[n];
                        row.val("state", "Y");
                }

                this.descStar = parseInt(value);

                this.comp("stateData").setValue("descNum", 1);
        };
        // 点击服务星
        Model.prototype.serviceStarOnClick = function(event) {
                var value = event.currentTarget.getAttribute('value');
                for (var i = 0; i < 5; i++) {
                        var row = this.comp("serviceData").datas.get()[i];
                        row.val("state", "N");
                }
                for (var n = 0; n < parseInt(value); n++) {
                        var row = this.comp("serviceData").datas.get()[n];
                        row.val("state", "Y");
                }

                this.sendStar = parseInt(value);
                this.comp("stateData").setValue("serviceNum", 1);
        };

        // 发货服务星
        Model.prototype.sendStarOnClick = function(event) {
                var value = event.currentTarget.getAttribute('value');
                for (var i = 0; i < 5; i++) {
                        var row = this.comp("sendData").datas.get()[i];
                        row.val("state", "N");
                }
                for (var n = 0; n < parseInt(value); n++) {
                        var row = this.comp("sendData").datas.get()[n];
                        row.val("state", "Y");
                }

                this.serviceStar = parseInt(value);
                this.comp("stateData").setValue("sendNum", 1);
        };

        Model.prototype.goodsDataCustomRefresh = function(event) {
                var dataModel = event.source;
                dataModel.clear();
                var data = this.comp("orderData");
                data.each(function(param) {
                        var json = eval('(' + param.row.val('items_json') + ')');
                        dataModel.loadData(json, true);
                });
        };
        debugger;

        // 提交评论
        Model.prototype.submitBtnClick = function(event) {
                var row = event.bindingContext.$object;
                var dataModel = event.source;
                baas.mallRequestAjax({
                        "type" : "post",
                        "url" : baas.MALL_URL.appraise,
                        "async" : true,
                        "params" : {
                                commenttype : 1,
                                goods_id : 340,
                                content : this.comp("content").val(),
                                grade : 2,
                                store_deliverycredit : row.val("store_deliverycredit"),
                                store_desccredit : row.val("store_desccredit"),
                                store_servicecredit : row.val("store_servicecredit")
       
                        },
                        "success" : function(data) {
                                  alert("ok")
                        }
                });

        };
       
        Model.prototype.radioClick = function(event) {

        };

        return Model;
});


6953.tmp.jpg

10

主题

46

帖子

88

积分

初级会员

Rank: 2

积分
88
QQ
 楼主| 发表于 2016-12-15 16:00:33 | 显示全部楼层
<?xml version="1.0" encoding="utf-8"?>

<div xmlns="http://www.w3.org/1999/xhtml" component="$UI/system/components/justep/window/window" design="device:m;"
  xid="window" class="window">  
  <div component="$UI/system/components/justep/model/model" xid="model" style="height:auto;top:453px;left:469px;"
    onLoad="modelLoad">
    <div component="$UI/system/components/justep/data/data" autoLoad="true"
      xid="descData" idColumn="state">
      <column name="state" type="String" xid="xid1"/>  
      <data xid="default13">[{"state":"N","value":1},{"state":"N","value":2},{"state":"N","value":3},{"state":"N","value":4},{"state":"N","value":5}]</data>
    </div>  
    <div component="$UI/system/components/justep/data/data" autoLoad="true"
      xid="serviceData" idColumn="state">
      <column name="state" type="String" xid="xid3"/>  
      <data xid="default14">[{"state":"N","value":1},{"state":"N","value":2},{"state":"N","value":3},{"state":"N","value":4},{"state":"N","value":5}]</data>
    </div>  
    <div component="$UI/system/components/justep/data/data" autoLoad="true"
      xid="sendData" idColumn="state">
      <column name="state" type="String" xid="xid4"/>  
      <data xid="default16">[{"state":"N","value":1},{"state":"N","value":2},{"state":"N","value":3},{"state":"N","value":4},{"state":"N","value":5}]</data>
    </div>  
    <div component="$UI/system/components/justep/data/data" autoLoad="true"
      xid="stateData" idColumn="descNum">
      <column name="descNum" type="Integer" xid="xid5"/>  
      <column name="serviceNum" type="Integer" xid="xid6"/>  
      <column name="sendNum" type="Integer" xid="xid7"/>  
      <data xid="default15">[{"descNum":0,"serviceNum":0,"sendNum":0}]</data>
    </div>  
    <div component="$UI/system/components/justep/data/baasData" autoLoad="false"
      xid="contentData" queryAction="queryProductcontent" url="/qb/localgroup" tableName="productcontent"
      idColumn="id" autoNew="false">
      <column label="id" name="id" type="Integer" xid="default16"/>  
      <column label="商品ID" name="productId" type="Integer" xid="default17"/>  
      <column label="用户ID" name="userId" type="Integer" xid="default18"/>  
      <column label="描述评分" name="descScore" type="Float" xid="default19"/>  
      <column label="服务评分" name="serviceScore" type="Float" xid="default20"/>  
      <column label="评论内容" name="contentText" type="String" xid="default21"/>  
      <column label="评论日期" name="contentDate" type="Date" xid="default22"/>
    </div>
  </div>  
  <div component="$UI/system/components/justep/panel/panel" class="x-panel x-full bg"
    xid="panel1">
    <div class="x-panel-top" xid="top1">
      <div component="$UI/system/components/justep/titleBar/titleBar" title="评价"
        class="x-titlebar  mall-top-bj">
        <div class="x-titlebar-left">
          <a component="$UI/system/components/justep/button/button" label=""
            class="btn btn-link btn-only-icon" icon="icon-chevron-left" onClick="{operation:'window.close'}"
            xid="backBtn">
            <i class="icon-chevron-left"/>  
            <span/>
          </a>
        </div>  
        <div class="x-titlebar-title">评价</div>  
        <div class="x-titlebar-right reverse"/>
      </div>
    </div>  
    <div class="x-panel-content" xid="content1">
      <div xid="div1" style="padding:0px;">
        <div xid="div1" style="background-color:white;border-bottom:solid 1px #e1e1e1;">
          <div component="$UI/system/components/justep/row/row" class="x-row"
            xid="row1">
            <div class="x-col x-col-fixed tb-nopadding" xid="col3">
              <textarea component="$UI/system/components/justep/textarea/textarea"
                placeholder="请在这里发表您的评价!!!" class="form-control" xid="content" style="border: none;height:80px;"/>
            </div>
          </div>
        </div>  
        <div xid="div4" style="background-color:white;padding: 8px 10px;">
          <h4 xid="h43" style="display:inline;color:#000;font-size:16px;"><![CDATA[评分 : ]]></h4>  
          <div xid="div" style="font-size:18px;display:inline;margin-left:10px;width:249px;"
            bind-click="radioClick">
            <input type="radio" value="1" name="grade" id="grade1" style="position: relative;"
              xid="grade"/>  
            <img src="$UI/ptop/common/img/hao.png" alt="" xid="image1" style="margin-right: 15px;"/>  
            <input type="radio" value="2" name="grade" id="grade2" style="position: relative;top:3px;"
              xid="grade2"/>  
            <img src="$UI/ptop/common/img/zhong(1).png" alt="" xid="image1"
              style="margin-right: 15px;"/>  
            <input type="radio" value="3" name="grade" id="grade3" style="position: relative;top:3px;"
              xid="grade1"/>  
            <img src="$UI/ptop/common/img/cha.png" alt="" xid="image1"/>
          </div>
        </div>  
        <div xid="div3" style="background-color:white;padding: 8px 10px;">
          <h4 xid="h41" style="display:inline;color:#000;font-size:16px;"><![CDATA[描述相符]]></h4>  
          <div xid=" store_desccredit" style="font-size:18px;display:inline;margin-left:10px;">
            <i xid="i1" class="glyphicon glyphicon-star star" bind-css="{&quot;currentStar&quot;:   $model.getDescDataRowState(0) ==&quot;Y&quot;}"
              value="1" bind-click="descStarOnClick"/>  
            <i xid="i2" class="glyphicon glyphicon-star star" bind-value="2"
              bind-css="{&quot;currentStar&quot;:   $model.getDescDataRowState(1) ==&quot;Y&quot;}" value="2"
              bind-click="descStarOnClick"/>  
            <i xid="i3" class="glyphicon glyphicon-star star" bind-value="3"
              bind-css="{&quot;currentStar&quot;:   $model.getDescDataRowState(2) ==&quot;Y&quot;}" value="3"
              bind-click="descStarOnClick"/>  
            <i xid="i4" class="glyphicon glyphicon-star star" bind-value="4"
              bind-css="{&quot;currentStar&quot;:   $model.getDescDataRowState(3) ==&quot;Y&quot;}" value="4"
              bind-click="descStarOnClick"/>  
            <i xid="i5" class="glyphicon glyphicon-star star" bind-value="5"
              bind-css="{&quot;currentStar&quot;:   $model.getDescDataRowState(4) ==&quot;Y&quot;}" value="5"
              bind-click="descStarOnClick"/>
          </div>
        </div>  
        <div xid="div14" style="margin:10px 0 0 0;padding: 8px 10px;background-color:white;">
          <h4 xid="h42" style="display:inline;color:#000;font-size:16px;"><![CDATA[服务态度]]></h4>  
          <div xid="store_servicecredit" style="font-size:18px;display:inline;margin-left:10px;">
            <i xid="i6" class="glyphicon glyphicon-star star" bind-css="{&quot;currentStar&quot;:   $model.getServiceDataRowState(0) ==&quot;Y&quot;}"
              bind-click="serviceStarOnClick" value="1"/>  
            <i xid="i7" class="glyphicon glyphicon-star star" bind-css="{&quot;currentStar&quot;:   $model.getServiceDataRowState(1) ==&quot;Y&quot;}"
              bind-click="serviceStarOnClick" value="2"/>  
            <i xid="i8" class="glyphicon glyphicon-star star" bind-css="{&quot;currentStar&quot;:   $model.getServiceDataRowState(2) ==&quot;Y&quot;}"
              bind-click="serviceStarOnClick" value="3"/>  
            <i xid="i9" class="glyphicon glyphicon-star star" bind-css="{&quot;currentStar&quot;:   $model.getServiceDataRowState(3) ==&quot;Y&quot;}"
              bind-click="serviceStarOnClick" value="4"/>  
            <i xid="i10" class="glyphicon glyphicon-star star" bind-css="{&quot;currentStar&quot;:   $model.getServiceDataRowState(4) ==&quot;Y&quot;}"
              bind-click="serviceStarOnClick" value="5"/>
          </div>
        </div>  
        <div xid="div15" style="padding: 8px 10px;background-color:white;">
          <h4 xid="h45" style="display:inline;color:#000;font-size:16px;"><![CDATA[发货速度]]></h4>  
          <div xid="store_deliverycredit" style="font-size:18px;display:inline;margin-left:10px;">
            <i xid="i1" class="glyphicon glyphicon-star star" bind-css="{&quot;currentStar&quot;:   $model.getSendDataRowState(0) ==&quot;Y&quot;}"
              value="1" bind-click="sendStarOnClick"/>  
            <i xid="i2" class="glyphicon glyphicon-star star" bind-value="2"
              bind-css="{&quot;currentStar&quot;:   $model.getSendDataRowState(1) ==&quot;Y&quot;}" value="2"
              bind-click="sendStarOnClick"/>  
            <i xid="i3" class="glyphicon glyphicon-star star" bind-value="3"
              bind-css="{&quot;currentStar&quot;:   $model.getSendDataRowState(2) ==&quot;Y&quot;}" value="3"
              bind-click="sendStarOnClick"/>  
            <i xid="i4" class="glyphicon glyphicon-star star" bind-value="4"
              bind-css="{&quot;currentStar&quot;:   $model.getSendDataRowState(3) ==&quot;Y&quot;}" value="4"
              bind-click="sendStarOnClick"/>  
            <i xid="i5" class="glyphicon glyphicon-star star" bind-value="5"
              bind-css="{&quot;currentStar&quot;:   $model.getSendDataRowState(4) ==&quot;Y&quot;}" value="5"
              bind-click="sendStarOnClick"/>
          </div>
        </div>
      </div>
    </div>  
    <div class="x-panel-bottom" xid="bottom1">
      <a component="$UI/system/components/justep/button/button" class="btn btn-default"
        label="发表评价" xid="button1" style="height:100%;width:100%;border-radius:0;background-color:#ff4400;border:none;line-height:34px;font-size:18px;"
        onClick="submitBtnClick">
        <i xid="i2"/>  
        <span xid="span5">发表评价</span>
      </a>
    </div>
  </div>
</div>
回复 支持 反对

使用道具 举报

10

主题

46

帖子

88

积分

初级会员

Rank: 2

积分
88
QQ
 楼主| 发表于 2016-12-15 16:01:38 | 显示全部楼层
js代码params该怎么写,传固定值是可以的
回复 支持 反对

使用道具 举报

10

主题

46

帖子

88

积分

初级会员

Rank: 2

积分
88
QQ
 楼主| 发表于 2016-12-15 16:11:10 | 显示全部楼层
求大神指导啊
回复 支持 反对

使用道具 举报

1

主题

6163

帖子

2095

积分

金牌会员

Rank: 6Rank: 6

积分
2095
QQ
发表于 2016-12-15 16:20:22 | 显示全部楼层

星级评分插件平台没有提供弄  建议上网收索相关案例

关于params传固定值的  具体要看你的是什么方法   固定值只需写死就可以了
回复 支持 反对

使用道具 举报

10

主题

46

帖子

88

积分

初级会员

Rank: 2

积分
88
QQ
 楼主| 发表于 2016-12-15 16:27:49 | 显示全部楼层
半导体 发表于 2016-12-15 16:20
星级评分插件平台没有提供弄  建议上网收索相关案例

关于params传固定值的  具体要看你的是什么方法    ...

关键是那个评分的"好""中""差"不知道怎么取
回复 支持 反对

使用道具 举报

10

主题

46

帖子

88

积分

初级会员

Rank: 2

积分
88
QQ
 楼主| 发表于 2016-12-15 16:28:11 | 显示全部楼层
mosquito93 发表于 2016-12-15 16:27
关键是那个评分的"好""中""差"不知道怎么取

下边星星的取到了
回复 支持 反对

使用道具 举报

1

主题

6163

帖子

2095

积分

金牌会员

Rank: 6Rank: 6

积分
2095
QQ
发表于 2016-12-15 16:33:18 | 显示全部楼层
mosquito93 发表于 2016-12-15 16:27
关键是那个评分的"好""中""差"不知道怎么取

取不到value吗?   
回复 支持 反对

使用道具 举报

10

主题

46

帖子

88

积分

初级会员

Rank: 2

积分
88
QQ
 楼主| 发表于 2016-12-15 16:59:30 | 显示全部楼层

不知道怎么取
回复 支持 反对

使用道具 举报

1

主题

6163

帖子

2095

积分

金牌会员

Rank: 6Rank: 6

积分
2095
QQ
发表于 2016-12-15 17:29:15 | 显示全部楼层

楼主  你能直接发压缩包吗   你的这个我粘过来不能运行   

以后可不可以尽量都发压缩包?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-4-27 22:34 , Processed in 0.116635 second(s), 26 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表