help.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="container">
  3. <!-- <view class="common-problem">
  4. <view class="item" wx:for="{{issueList}}" wx:key="id">
  5. <view class="question-box">
  6. <text class="spot"></text>
  7. <text class="question">{{item.question}}</text>
  8. </view>
  9. <view class="answer">
  10. <text> {{item.answer}}</text>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="page" wx:if="{{showPage}}">
  15. <view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view>
  16. <view class="next {{ (count / limit) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
  17. </view> -->
  18. <image src="https://mall.zhaijieshi.cc/file/wx-dy/info-dy.jpg" mode="widthFix" style="width: 100%" />
  19. </view>
  20. </template>
  21. <script>
  22. var util = require('../../../utils/util.js');
  23. var api = require('../../../config/api.js');
  24. var app = getApp();
  25. export default {
  26. data() {
  27. return {
  28. issueList: [],
  29. page: 1,
  30. limit: 10,
  31. count: 0,
  32. showPage: false
  33. };
  34. }
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */,
  38. onLoad: function (options) {
  39. //this.getIssue();
  40. },
  41. /**
  42. * 生命周期函数--监听页面初次渲染完成
  43. */
  44. onReady: function () {},
  45. /**
  46. * 生命周期函数--监听页面显示
  47. */
  48. onShow: function () {},
  49. /**
  50. * 生命周期函数--监听页面隐藏
  51. */
  52. onHide: function () {},
  53. /**
  54. * 生命周期函数--监听页面卸载
  55. */
  56. onUnload: function () {},
  57. /**
  58. * 页面相关事件处理函数--监听用户下拉动作
  59. */
  60. onPullDownRefresh: function () {},
  61. /**
  62. * 页面上拉触底事件的处理函数
  63. */
  64. onReachBottom: function () {},
  65. /**
  66. * 用户点击右上角分享
  67. */
  68. onShareAppMessage: function () {},
  69. methods: {
  70. nextPage: function (event) {
  71. var that = this;
  72. if (this.page > that.count / that.limit) {
  73. return true;
  74. }
  75. that.setData({
  76. page: that.page + 1
  77. });
  78. this.getIssue();
  79. },
  80. getIssue: function () {
  81. let that = this;
  82. that.setData({
  83. showPage: false,
  84. issueList: []
  85. });
  86. util.request(api.IssueList, {
  87. page: that.page,
  88. limit: that.limit
  89. }).then(function (res) {
  90. if (res.errno === 0) {
  91. that.setData({
  92. issueList: res.data.list,
  93. showPage: true,
  94. count: res.data.total
  95. });
  96. }
  97. });
  98. },
  99. prevPage: function (event) {
  100. if (this.page <= 1) {
  101. return false;
  102. }
  103. var that = this;
  104. that.setData({
  105. page: that.page - 1
  106. });
  107. this.getIssue();
  108. }
  109. }
  110. };
  111. </script>
  112. <style>
  113. .common-problem {
  114. width: 750rpx;
  115. height: auto;
  116. overflow: hidden;
  117. padding: 0rpx 30rpx;
  118. background: #fff;
  119. }
  120. .item {
  121. height: auto;
  122. overflow: hidden;
  123. padding-bottom: 25rpx;
  124. }
  125. .question-box .spot {
  126. float: left;
  127. display: block;
  128. height: 10rpx;
  129. width: 10rpx;
  130. background: #b4282d;
  131. border-radius: 50%;
  132. margin-top: 11rpx;
  133. }
  134. .question-box .question {
  135. float: left;
  136. line-height: 30rpx;
  137. padding-left: 8rpx;
  138. display: block;
  139. font-size: 26rpx;
  140. padding-bottom: 15rpx;
  141. color: #303030;
  142. width: 680rpx;
  143. }
  144. .answer {
  145. line-height: 36rpx;
  146. padding-left: 16rpx;
  147. font-size: 26rpx;
  148. color: #787878;
  149. display: block;
  150. }
  151. .page {
  152. width: 750rpx;
  153. height: 108rpx;
  154. background: #fff;
  155. margin-bottom: 20rpx;
  156. }
  157. .page view {
  158. height: 108rpx;
  159. width: 50%;
  160. float: left;
  161. font-size: 29rpx;
  162. color: #333;
  163. text-align: center;
  164. line-height: 108rpx;
  165. }
  166. .page .prev {
  167. border-right: 1px solid #d9d9d9;
  168. }
  169. .page .disabled {
  170. color: #ccc;
  171. }
  172. </style>