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
|
/* (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 */
|
/* (2) Prepare request */
|
||||||
var rq = {
|
var rq = {
|
||||||
message: this.gstore.new_msg.emergency,
|
message: this.gstore.new_msg.emergency,
|
||||||
location: [1.1, 2.2],
|
location: this.gstore.loc,
|
||||||
username: this.gstore.server.session.name
|
username: this.gstore.server.session.name
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,14 +49,27 @@ export default {
|
||||||
if( msg.trim().length == 0 )
|
if( msg.trim().length == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* (2) Send message to WebSocket */
|
/* (2) Prepare request */
|
||||||
wsc_event.send(JSON.stringify({message: msg, location: [1.1, 2.2]}));
|
var rq = {
|
||||||
|
message: this.gstore.new_msg.event,
|
||||||
|
location: this.gstore.loc,
|
||||||
|
username: this.gstore.server.session.name
|
||||||
|
};
|
||||||
|
|
||||||
/* (3) Add loader */
|
/* (3) Add loader */
|
||||||
gstore.data.msg_pending.event = true;
|
gstore.data.msg_pending.event = true;
|
||||||
|
|
||||||
/* (4) Empty input */
|
/* (4) Send request */
|
||||||
this.gstore.new_msg.event = '';
|
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){
|
bbcode: function(msg){
|
||||||
|
|
Loading…
Reference in New Issue