EA&UML日拱一卒-微信小程序实战:位置闹铃 (7)-在画面之间共享数据

序列图


为了理顺用户的操作逻辑,我们将监控点的设定分到选择监控点和编辑监控条件两个画面进行;


为了新建监控点和编辑监控点流程的共通化,创建监控点对象的工作被分配到了主画面。


序列图如下:

index.js


newButtonTaped: function () {

   console.log("index.js::newButtonTaped")   

   this.mapCtx.getCenterLocation({

     success: function (res) {

       app.globalData.currentAlarm = {

         longitude: res.longitude,

         latitude: res.latitude

       }

       wx.navigateTo({

         url: '../setpoint/setpoint'

       })

     }

   })

 },


创建监控点画面的同时,设定坐标的初值。


setpoint.js


getPoisInformation:function(){

   var that = this

   var mapCtx = wx.createMapContext('alarmMap')

   mapCtx.getCenterLocation({

     success: function (res) {

       util.getPoisByLocation(res.longitude, res.latitude, function (data) {

         console.log(data)

         that.setData({

           pois: data.pois,

           location: res.latitude.toFixed(4) + ',' + res.longitude.toFixed(4),

         });

         app.globalData.currentAlarm = {

           longitude: res.longitude,

           latitude: res.latitude,

           title: data.pois[0].title

         };

       })

     }

   })

 },


设定坐标和监控点标题。其画面如下:




画面上选择了大连会议中心。上面就是著名的音乐喷泉广场。


editaction.js


编辑监控条件画面的功能正在编写中。先给大家看画面。



画面只是一个雏形,目前可以显示选择监控点画面指定的地点和铃声。选择其他铃声后,可以播放该铃声。


小程序代码


最新代码已经将代码上传到GitHub上了。这样大家就可以随时看到小程序的进步。欢迎参观,拍砖。


https://github.com/xueweiguo/alarmmap


写在文章的最后


既然已经读到这里了,拜托大家再用一分钟时间,将文章转发到各位的朋友圈,微信群中。本公众号的成长需要您的支持!
阅读更多更新文章,请扫描下面二维码,关注微信公众号【面向对象思考】


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值