help.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view>
  3. <!--mine/help/help.wxml-->
  4. <view class="tit">常见问题</view>
  5. <view class="list">
  6. <block v-for="(item, index) in pageList" :key="index">
  7. <navigator :url="'/mine/page/page?id=' + item.id + '&title=' + item.title" hover-class="none" class="li">{{item.title}}<image src="/static/pages/images/more.png" class="rico"></image></navigator>
  8. </block>
  9. </view>
  10. <!-- <button class="zixun" open-type="contact">咨询客服</button> -->
  11. <contact-button class-name="zixun" button-text="咨询客服"></contact-button>
  12. </view>
  13. </template>
  14. <script>
  15. // mine/help/help.js
  16. const app = getApp();
  17. const req = require("../../utils/request.js");
  18. export default {
  19. data() {
  20. return {
  21. form: {
  22. page: 1,
  23. limit: 15
  24. },
  25. pageList: [],
  26. isLoad: true
  27. };
  28. },
  29. components: {},
  30. props: {},
  31. onLoad: async function(options) {
  32. this.getData();
  33. // console.log(options);
  34. if (options.scene) {
  35. this.scene = options.scene;
  36. }
  37. await this.loadCodeParams();
  38. },
  39. onReachBottom() {
  40. this.form.page++;
  41. this.getData();
  42. },
  43. methods: {
  44. loadCodeParams() {
  45. let _ts = this;
  46. return new Promise((resolve, reject) => {
  47. if (!_ts.scene) {
  48. resolve();
  49. return false;
  50. }
  51. req.getRequest('/api/code/params', {
  52. scene: _ts.scene
  53. }, data => {
  54. req.setStorage('pidCode', data.userId);
  55. resolve();
  56. });
  57. });
  58. },
  59. getData() {
  60. // req.getRequest('/api/help/center', {}, data => {
  61. // if (data) {
  62. // this.setData({
  63. // pageList: data
  64. // });
  65. // }
  66. // });
  67. if (!this.isLoad) return false;
  68. this.isLoad = false;
  69. let form = this.form;
  70. form.code = 'help';
  71. req.getRequest('/api/content/list',form,res => {
  72. if (res && res.length >= 10) this.isLoad = true;
  73. if (this.form.page > 1) res = this.pageList.concat(res);
  74. this.pageList = res;
  75. });
  76. }
  77. }
  78. };
  79. </script>
  80. <style>
  81. @import "./help.css";
  82. </style>