|
@@ -22,6 +22,7 @@ class AccountAuth {
|
|
|
this._socket.on('disconnect', this.onDisconnect);
|
|
|
|
|
|
this.authed = false;
|
|
|
+ this.sqlauthed = false;
|
|
|
}
|
|
|
|
|
|
onConnect = () => {
|
|
@@ -37,9 +38,17 @@ class AccountAuth {
|
|
|
}, (data) => {
|
|
|
// console.log("OK, got into login-callback");
|
|
|
// console.log(JSON.stringify(data));
|
|
|
+ this.sqlauthed = true;
|
|
|
}
|
|
|
);
|
|
|
|
|
|
+ setTimeout(() => {
|
|
|
+ console.log("检查获取数据上传权限 ", this.sqlauthed);
|
|
|
+ if(!this.sqlauthed){
|
|
|
+ alert("获取数据上传权限失败!")
|
|
|
+ }
|
|
|
+ }, 5000);
|
|
|
+
|
|
|
setTimeout(() => {
|
|
|
let token = localStorage.getItem("user_token");
|
|
|
if(token){
|
|
@@ -223,6 +232,10 @@ class AccountAuth {
|
|
|
}
|
|
|
|
|
|
cteateMapData(user_id, map_name = 'map'){
|
|
|
+ if(!this.sqlauthed){
|
|
|
+ console.log("未获取数据上传权限!");
|
|
|
+ alert("未获取数据上传权限!");
|
|
|
+ }
|
|
|
var sql = `INSERT INTO
|
|
|
medba.dat_map
|
|
|
(map_name, map_data, user_id, update_time, create_time, map_uuid)
|
|
@@ -247,6 +260,10 @@ class AccountAuth {
|
|
|
}
|
|
|
|
|
|
updateMapData(data){
|
|
|
+ if(!this.sqlauthed){
|
|
|
+ console.log("未获取数据上传权限!");
|
|
|
+ alert("未获取数据上传权限!");
|
|
|
+ }
|
|
|
var sql = `UPDATE medba.dat_map
|
|
|
SET
|
|
|
map_data = '${data.map_data}',
|
|
@@ -292,6 +309,10 @@ class AccountAuth {
|
|
|
}
|
|
|
|
|
|
deleteMapData(map_id){
|
|
|
+ if(!this.sqlauthed){
|
|
|
+ console.log("未获取数据上传权限!");
|
|
|
+ alert("未获取数据上传权限!");
|
|
|
+ }
|
|
|
var sql = `DELETE FROM medba.dat_map
|
|
|
WHERE
|
|
|
map_id = ${map_id}`;
|