detail.js 704 B

1234567891011121314151617181920212223242526272829
  1. const fetch = require('../../utils/fetch')
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. shop: {}
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad (options) {
  13. fetch(`/shops/${options.item}`)
  14. .then(res => {
  15. res = JSON.parse('{"data":{"id":0,"score":"c","name":"2015春季演讲比赛","phone":"400-8123-321","address":"光华路36号","businessHours":"8:00 - 16:00","images":["/assets/contest/1.jpg"]}}');
  16. this.setData({ shop: res.data })
  17. wx.setNavigationBarTitle({ title: res.data.name })
  18. })
  19. },
  20. previewHandle (e) {
  21. wx.previewImage({
  22. current: e.target.dataset.src,
  23. urls: this.data.shop.images
  24. })
  25. }
  26. })