index.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // pages/expert/index.js
  2. import {
  3. ajax
  4. } from "../../utils/util";
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. list: [
  11. {
  12. works: "https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/R-C.jfif",
  13. name: "张云翔",
  14. birthday: "2015-03-03",
  15. teacher: "李勇利",
  16. school: "清华",
  17. articleGroup: "书法",
  18. articleName: "兰亭序",
  19. articleDescribe: "展现了中国传统艺术的魅力。墨色浓淡相间,笔触流畅而有力,每一字之间形成和谐的整体。作品中融入了经典诗句,传递出深邃的哲理和人生感悟。每一个字都经过精心构思和书写,字体大小和间距恰到好处,整个作品看起来平衡而舒适。",
  20. },
  21. {
  22. works: "https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/R-C.jfif",
  23. name: "张云翔",
  24. birthday: "2015-03-03",
  25. teacher: "李勇利",
  26. school: "清华",
  27. articleGroup: "书法",
  28. articleName: "兰亭序",
  29. articleDescribe: "展现了中国传统艺术的魅力。墨色浓淡相间,笔触流畅而有力,每一字之间形成和谐的整体。作品中融入了经典诗句,传递出深邃的哲理和人生感悟。每一个字都经过精心构思和书写,字体大小和间距恰到好处,整个作品看起来平衡而舒适。",
  30. }
  31. ]
  32. },
  33. page: 1,
  34. size: 10,
  35. total: 0,
  36. showimge(e){
  37. wx.previewImage({
  38. urls: [e.currentTarget.dataset.url],
  39. })
  40. },
  41. getData() {
  42. ajax({
  43. urlType: "apiurl",
  44. api: "/article/list-audit",
  45. method: "post",
  46. data: {
  47. page: this.page,
  48. size: this.size
  49. }
  50. }).then(res => {
  51. if (res.code !== 0) return wx.showToast({
  52. title: '请求失败',
  53. icon: "none"
  54. })
  55. const data = res.data || {};
  56. data.data.length && (this.page += 1);
  57. this.total = data.total;
  58. this.setData({
  59. list: [...this.data.list, ...data.data]
  60. })
  61. })
  62. },
  63. scrollbottom(){
  64. this.getData();
  65. },
  66. /**
  67. * 生命周期函数--监听页面加载
  68. */
  69. onLoad(options) {
  70. this.getData();
  71. },
  72. /**
  73. * 生命周期函数--监听页面初次渲染完成
  74. */
  75. onReady() {
  76. },
  77. /**
  78. * 生命周期函数--监听页面显示
  79. */
  80. onShow() {
  81. },
  82. /**
  83. * 生命周期函数--监听页面隐藏
  84. */
  85. onHide() {
  86. },
  87. /**
  88. * 生命周期函数--监听页面卸载
  89. */
  90. onUnload() {
  91. },
  92. /**
  93. * 页面相关事件处理函数--监听用户下拉动作
  94. */
  95. onPullDownRefresh() {
  96. },
  97. /**
  98. * 页面上拉触底事件的处理函数
  99. */
  100. onReachBottom() {
  101. },
  102. /**
  103. * 用户点击右上角分享
  104. */
  105. onShareAppMessage() {
  106. return {
  107. title: __wxConfig.accountInfo.nickname,
  108. path: "/pages/index/index"
  109. }
  110. }
  111. })