fix: view.main (added geolocation) | upd: vue.emergency|vue.event (added geolocation use)
This commit is contained in:
parent
a906da7266
commit
66d8eb39eb
|
@ -60,4 +60,6 @@ delete window._router_;
|
|||
|
||||
/* (4) Get geolocation
|
||||
---------------------------------------------------------*/
|
||||
navigator.geolocation && navigator.geolocation.getCurrentPosition(function(a, b){ console.log(this, a, b); }, null);
|
||||
navigator.geolocation && navigator.geolocation.getCurrentPosition(function(loc){
|
||||
gstore.data.loc = [ loc.coords.latitude, loc.coords.longitude ];
|
||||
}, null);
|
||||
|
|
|
@ -55,7 +55,7 @@ export default {
|
|||
/* (2) Prepare request */
|
||||
var rq = {
|
||||
message: this.gstore.new_msg.emergency,
|
||||
location: [1.1, 2.2],
|
||||
location: this.gstore.loc,
|
||||
username: this.gstore.server.session.name
|
||||
};
|
||||
|
||||
|
|
|
@ -49,14 +49,27 @@ export default {
|
|||
if( msg.trim().length == 0 )
|
||||
return;
|
||||
|
||||
/* (2) Send message to WebSocket */
|
||||
wsc_event.send(JSON.stringify({message: msg, location: [1.1, 2.2]}));
|
||||
/* (2) Prepare request */
|
||||
var rq = {
|
||||
message: this.gstore.new_msg.event,
|
||||
location: this.gstore.loc,
|
||||
username: this.gstore.server.session.name
|
||||
};
|
||||
|
||||
/* (3) Add loader */
|
||||
gstore.data.msg_pending.event = true;
|
||||
|
||||
/* (4) Empty input */
|
||||
this.gstore.new_msg.event = '';
|
||||
/* (4) Send request */
|
||||
api.call("POST message/event/"+this.dep, rq, function(rs){
|
||||
|
||||
// {1} If error -> exit //
|
||||
if( rs.error != 0 )
|
||||
return;
|
||||
|
||||
// {2} Empty input //
|
||||
gstore.data.new_msg.event = '';
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
bbcode: function(msg){
|
||||
|
|
Loading…
Reference in New Issue