rule.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="u-content">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <u-navbar title-color="#000000" :is-back="true" title="活动规则"></u-navbar>
  5. <!-- #endif -->
  6. <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
  7. <u-parse :html="content" ></u-parse>
  8. </mescroll-body>
  9. </view>
  10. </template>
  11. <script>
  12. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  13. export default {
  14. mixins: [MescrollMixin],
  15. data() {
  16. return {
  17. downOption:{
  18. use:false,
  19. auto:false
  20. },
  21. content:'',
  22. list: [] // 数据列表
  23. }
  24. },
  25. methods: {
  26. downCallback(){
  27. setTimeout(()=>{
  28. this.mescroll.resetUpScroll();
  29. },1000)
  30. },
  31. upCallback(mescroll) {
  32. try {
  33. let params={
  34. title:'活动规则',
  35. activeId:this.vuex_active_setting.defaultActiveId,
  36. current:mescroll.num,
  37. size:mescroll.size,
  38. }
  39. this.$api.notice.list(params).then(res => {
  40. let data = res.data.data.records
  41. let total = res.data.data.total
  42. mescroll.endBySize(data.length, total);
  43. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  44. this.list = this.list.concat(data); //追加新数据
  45. this.content = decodeURIComponent(this.list[0].content)
  46. }).catch(err=>{
  47. console.log(err);
  48. })
  49. } catch (e) {
  50. console.error(e);
  51. this.mescroll.endErr()
  52. }
  53. }
  54. }
  55. }
  56. </script>
  57. <style >
  58. page{
  59. background-color: #FFFFFF;
  60. }
  61. .u-content {
  62. padding: 30rpx;
  63. line-height: 50rpx;
  64. color: #505050;
  65. }
  66. </style>