editXnb.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. const app = getApp()
  2. const util = require("../../../utils/util");
  3. const api = require('../../../api/api.js');
  4. const user = require('../../../utils/user.js');
  5. import moment from 'moment'
  6. Page({
  7. data: {
  8. xnbList:[
  9. ],
  10. imgs:['https://jzmall.lifejingzhi.com/file/wx-servant/badge-star.png','https://jzmall.lifejingzhi.com/file/wx-servant/learn-bg.png']
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. // this.getDetail();
  17. },
  18. getDetail(){
  19. util.request(api.getNewFarmerInfo, {
  20. }, 'GET').then(res=> {
  21. if (res.errno === 0) {
  22. let list=res.data;
  23. list.forEach(item=>{
  24. if(item.files==''){
  25. item.imgs=[];
  26. }else{
  27. item.imgs=item.files.split(',');
  28. }
  29. })
  30. this.setData({
  31. xnbList:list
  32. });
  33. }
  34. }).catch(err=>{
  35. });
  36. },
  37. imgPre (event) {
  38. var src = event.currentTarget.dataset.src;//获取data-src
  39. var imgList = event.currentTarget.dataset.imgs;//获取data-list
  40. //图片预览
  41. wx.previewImage({
  42. current: src, // 当前显示图片的http链接
  43. urls: imgList // 需要预览的图片http链接列表
  44. })
  45. },
  46. goDetail() {
  47. wx.navigateTo({
  48. url: '/pages/upgrade/xnbInfo/xnbInfo',
  49. })
  50. },
  51. goUpload(){
  52. wx.navigateTo({
  53. url: '/pages/upgrade/addXnb/addXnb',
  54. });
  55. },
  56. onReachBottom() {
  57. },
  58. /**
  59. * 生命周期函数--监听页面初次渲染完成
  60. */
  61. onReady: function () {
  62. },
  63. /**
  64. * 生命周期函数--监听页面显示
  65. */
  66. onShow: function () {
  67. this.getDetail();
  68. },
  69. onHide: function () {
  70. },
  71. onUnload: function () {
  72. },
  73. /**
  74. * 页面相关事件处理函数--监听用户下拉动作
  75. */
  76. onPullDownRefresh: function () {
  77. },
  78. /**
  79. * 页面上拉触底事件的处理函数
  80. */
  81. onReachBottom: function () {
  82. },
  83. /**
  84. * 用户点击右上角分享
  85. */
  86. onShareAppMessage: function () {
  87. },
  88. })