about.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. const util = require('../../utils/util.js');
  2. const api = require('../../config/api.js');
  3. //获取应用实例
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. name: 'litemall',
  11. address: 'https://github.com/linlinjava/litemall',
  12. latitude: '31.201900',
  13. longitude: '121.587839',
  14. phone: '021-xxxx-xxxx',
  15. qq: '705144434'
  16. },
  17. /**
  18. * 生命周期函数--监听页面加载
  19. */
  20. onLoad: function (options) {
  21. this.getAbout()
  22. },
  23. getAbout: function () {
  24. let that = this;
  25. util.request(api.AboutUrl).then(function (res) {
  26. if (res.errno === 0) {
  27. that.setData({
  28. name: res.data.name,
  29. address: res.data.address,
  30. phone: res.data.phone,
  31. qq: res.data.qq,
  32. latitude: res.data.latitude,
  33. longitude: res.data.longitude
  34. });
  35. }
  36. });
  37. },
  38. showLocation: function (e) {
  39. var that = this
  40. wx.openLocation({
  41. latitude: parseFloat(that.data.latitude),
  42. longitude: parseFloat(that.data.longitude),
  43. name: that.data.name,
  44. address: that.data.address,
  45. })
  46. },
  47. callPhone: function (e) {
  48. var that = this
  49. wx.makePhoneCall({
  50. phoneNumber: that.data.phone,
  51. })
  52. }
  53. })