弹框.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <link rel="stylesheet" href="../../layui/css/layui.css">
  7. <link rel="stylesheet" href="../../c_style/css.css">
  8. <link rel="stylesheet" href="../../c_style/shop.css">
  9. </head>
  10. <body>
  11. <div class="dialog">
  12. <div class="dialog-form">
  13. <div class="dialog-form-item">
  14. <div class="dialog-form-item-title">总体评价</div>
  15. <div class="dialog-form-item-title-main">
  16. <div class="form-evaluate">
  17. <div class="good checked">好评</div>
  18. <div class="middle">中评</div>
  19. <div class="bad">差评</div>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="dialog-form-item">
  24. <div class="dialog-form-item-title">配送服务</div>
  25. <div class="dialog-form-item-title-main">
  26. <div id="score-1" class="form-rate"></div>
  27. </div>
  28. </div>
  29. <div class="dialog-form-item">
  30. <div class="dialog-form-item-title">服务态度</div>
  31. <div class="dialog-form-item-title-main">
  32. <div id="score-2" class="form-rate"></div>
  33. </div>
  34. </div>
  35. <div class="dialog-form-item">
  36. <div class="dialog-form-item-title">评价内容</div>
  37. <div class="dialog-form-item-title-main">
  38. <textarea name="desc" placeholder="请输入内容" class="layui-textarea"
  39. style="width: 470px"></textarea>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </body>
  45. </html>
  46. <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  47. <script src="../../layui/layui.all.js"></script>
  48. <script type="text/javascript">
  49. $(function () {
  50. $('.form-evaluate div').on('click', function (e) {
  51. $(e.target).parent().children('div').removeClass('checked')
  52. $(e.target).addClass('checked')
  53. })
  54. })
  55. layui.use(['rate', 'form'], function () {
  56. var rate = layui.rate
  57. //基础效果
  58. rate.render({
  59. elem: '#score-1'
  60. , value: 5
  61. , text: true
  62. , theme: '#F03B3B' //自定义主题色
  63. , setText: function (value) { //自定义文本的回调
  64. var arrs = {
  65. '1': '非常差'
  66. , '2': '差'
  67. , '3': '一般'
  68. , '4': '好'
  69. , '5': '非常好',
  70. }
  71. this.span.text(arrs[value] || (value + '星'))
  72. },
  73. })
  74. rate.render({
  75. elem: '#score-2'
  76. , value: 3
  77. , text: true
  78. , theme: '#F03B3B' //自定义主题色
  79. , setText: function (value) { //自定义文本的回调
  80. var arrs = {
  81. '1': '非常差'
  82. , '2': '差'
  83. , '3': '一般'
  84. , '4': '好'
  85. , '5': '非常好',
  86. }
  87. this.span.text(arrs[value] || (value + '星'))
  88. },
  89. })
  90. })
  91. </script>