commentinfo.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // pages/commentinfo/commentinfo.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. shopStars:0,
  8. productStars:0,
  9. textWidth:0,
  10. wordsNum:0,
  11. limitNum:100,
  12. outLimit:false,
  13. commentText:"w d "
  14. },
  15. changeShopStars:function (e) {
  16. this.setData({
  17. shopStars:e.currentTarget.dataset.i
  18. })
  19. },
  20. changeProductStars:function (e) {
  21. this.setData({
  22. productStars:e.currentTarget.dataset.i
  23. })
  24. },
  25. changeComment:function (e) {
  26. // console.log(e.detail)
  27. // console.log(e.detail.value.length)
  28. var length = e.detail.value.length;
  29. if(length>this.data.limitNum){
  30. this.setData({
  31. outLimit:true
  32. })
  33. }
  34. this.setData({
  35. wordsNum:e.detail.value.length
  36. })
  37. },
  38. setCommenText:function (e) {
  39. console.log("调用了")
  40. console.log(e.detail)
  41. this.setData({
  42. commentText:e.detail.value
  43. })
  44. },
  45. /**
  46. * 生命周期函数--监听页面加载
  47. */
  48. onLoad: function (options) {
  49. var textWidth =wx.getSystemInfoSync().windowWidth * (750 / wx.getSystemInfoSync().windowWidth)*0.9;
  50. this.setData({
  51. textWidth
  52. })
  53. },
  54. /**
  55. * 生命周期函数--监听页面初次渲染完成
  56. */
  57. onReady: function () {
  58. },
  59. /**
  60. * 生命周期函数--监听页面显示
  61. */
  62. onShow: function () {
  63. },
  64. /**
  65. * 生命周期函数--监听页面隐藏
  66. */
  67. onHide: function () {
  68. },
  69. /**
  70. * 生命周期函数--监听页面卸载
  71. */
  72. onUnload: function () {
  73. },
  74. /**
  75. * 页面相关事件处理函数--监听用户下拉动作
  76. */
  77. onPullDownRefresh: function () {
  78. },
  79. /**
  80. * 页面上拉触底事件的处理函数
  81. */
  82. onReachBottom: function () {
  83. },
  84. /**
  85. * 用户点击右上角分享
  86. */
  87. onShareAppMessage: function () {
  88. }
  89. })