376
376
<v-card-title >
377
377
<h3 class =" text-xs-left" >{{ $t('message.settings_network_title') }}</h3 >
378
378
</v-card-title >
379
+ <div >
380
+ <v-chip v-if =" wifi_status.wifi" prepend-icon =" mdi-wifi" >Wifi</v-chip >
381
+ <v-chip v-if =" wifi_status.internet" prepend-icon =" mdi-web" >Internet</v-chip >
382
+ </div >
379
383
<div class =" cardContent" >
380
384
<v-radio-group v-model =" settings.wifiMode" column
381
385
@change =" v$.settings.wifiMode.$touch"
382
386
>
387
+ <v-radio v-bind:label =" $t('message.settings_network_mode_ap')" value =" ap" ></v-radio >
383
388
<v-radio v-bind:label =" $t('message.settings_network_mode_client')" value =" client" ></v-radio >
384
- <v-radio v-bind:label =" $t('message.settings_network_mode_ap')" value =" ap" >
385
- </v-radio >
389
+
386
390
</v-radio-group >
387
391
<div v-if =" settings.wifiMode=='client'" >
388
392
<v-select
389
393
:disabled =" settings.wifiMode!='client'"
390
394
v-model =" settings.wifiSSID"
395
+ @change =" v$.settings.wifiSSID.$touch"
391
396
:items =" networks"
392
397
item-title =" ssid"
393
398
item-value =" ssid"
396
401
>
397
402
</v-select >
398
403
<v-text-field
399
- v-if =" network_require_user() "
404
+ v-if =" network_require_user"
400
405
:disabled =" settings.wifiMode!='client'"
401
406
v-model =" settings.wifiUser"
402
- :type = " text "
403
- v-bind:label =" $t('message.settings_network_user ')" ></v-text-field >
407
+ @change = " v$.settings.wifiUser.$touch "
408
+ v-bind:label =" $t('message.settings_network_username ')" ></v-text-field >
404
409
<v-text-field
405
410
:disabled =" settings.wifiMode!='client'"
406
411
v-model =" settings.wifiPsw"
412
+ @change =" v$.settings.wifiPsw.$touch"
407
413
:append-icon =" wifi_pwd_show ? 'mdi-eye' : 'mdi-eye-off'"
408
414
:type =" wifi_pwd_show ? 'text' : 'password'"
409
415
@click:append =" wifi_pwd_show = !wifi_pwd_show"
410
- v-bind:label =" $t('message.settings_network_password')" ></v-text-field >
416
+ v-bind:label =" $t('message.settings_network_password')" ></v-text-field >
411
417
</div >
412
418
<!-- v-card-actions>
413
419
<v-btn color="primary" @click.stop="dialog = true" block>Salva</v-btn>
432
438
</v-dialog>
433
439
</v-card-actions-->
434
440
</div >
441
+ <template >
442
+ <div class =" text-center" >
443
+ <v-dialog
444
+ v-model =" wifi_overlay"
445
+ persistent
446
+ >
447
+ <v-card >
448
+ <v-card-text >
449
+ <div class =" text-center" >
450
+ {{ $t('message.settings_network_wait') }}
451
+ </div >
452
+ </v-card-text >
453
+ </v-card >
454
+ </v-dialog >
455
+ </div >
456
+ </template >
435
457
</v-card >
436
458
</v-col >
437
459
</v-layout >
@@ -760,7 +782,7 @@ export default {
760
782
this .cb .status = this .$store .getters .status ;
761
783
this .adminPassword_dialog = this .settings .adminPassword != null && this .settings .adminPassword != ' ' ;
762
784
this .$wifi_connect .networks ().then ((result ) => {
763
- this .networks = result .data ;
785
+ this .networks = result .data . ssids ;
764
786
});
765
787
},
766
788
beforeRouteLeave (to , from , next ) {
@@ -773,8 +795,8 @@ export default {
773
795
},
774
796
computed: {
775
797
network_require_user () {
776
- const network = this .networks .find (item => { return item .ssid == this .v$ . settings .wifiSSID });
777
- return network .conn_type == " ENTERPRISE" ;
798
+ const network = this .networks .find (item => { return item .ssid == this .settings .wifiSSID });
799
+ return network && network .conn_type == " ENTERPRISE" ;
778
800
}
779
801
},
780
802
methods: {
@@ -914,6 +936,9 @@ export default {
914
936
}
915
937
this .status = 0 ;
916
938
});
939
+ this .$wifi_connect .status ().then ((result ) => {
940
+ this .wifi_status = result .data ;
941
+ });
917
942
},
918
943
deletePkg (pkgNameID ) {
919
944
this .$coderbot .deleteMusicPackage (pkgNameID).then (() => {
@@ -949,21 +974,31 @@ export default {
949
974
});
950
975
if (this .v$ .settings .wifiMode .$dirty || this .v$ .settings .wifiSSID .$dirty || this .v$ .settings .wifiPsw .$dirty ) {
951
976
if (this .settings .wifiMode == " client" ) {
952
- const network = this .networks .find (item => { return item .ssid == this .v$ .settings .wifiSSID });
953
- this .$wifi_connect .connect (network .ssid , network .conn_type , this .settings .wifiUser , this .settings .wifiPsw )
954
- .then (() => {
955
- console .log (' connect Sent' );
956
- this .snackText = this .$i18n .t (' message.settings_network_updated' );
957
- this .snackbar = true ;
958
- });
959
- } else {
960
- this .$wifi_connect .disconnect ()
961
- .then (() => {
962
- console .log (' disconnect Sent' );
963
- this .snackText = this .$i18n .t (' message.settings_network_updated' );
964
- this .snackbar = true ;
977
+ const network = this .networks .find (item => { return item .ssid == this .settings .wifiSSID });
978
+ if (network != null ) {
979
+ this .wifi_overlay = true ;
980
+ this .$wifi_connect .disconnect ().then ((result ) => {
981
+ setTimeout (() => {
982
+ this .$wifi_connect .connect (network .ssid , network .conn_type , this .settings .wifiUser , this .settings .wifiPsw )
983
+ .then ((result ) => {
984
+ this .snackText = this .$i18n .t (' message.settings_network_updated' );
985
+ this .snackbar = true ;
986
+ this .wifi_overlay = false ;
987
+ })
988
+ .catch ((error ) => {
989
+ console .error (error);
990
+ this .wifi_overlay = false ;
991
+ });
992
+ }, 10000 );
993
+ })
994
+ .catch ((error ) => {
995
+ console .error (error);
996
+ this .wifi_overlay = false ;
965
997
});
998
+ }
966
999
}
1000
+ } else {
1001
+ this .$wifi_connect .disconnect ().then ((result ) => {});
967
1002
}
968
1003
}
969
1004
},
@@ -1095,7 +1130,9 @@ export default {
1095
1130
this .$i18n .t (' message.settings_tabs_music_packages' )
1096
1131
],
1097
1132
networks: [],
1133
+ wifi_status: null ,
1098
1134
wifi_pwd_show: false ,
1135
+ wifi_overlay: false ,
1099
1136
};
1100
1137
},
1101
1138
validations () {
@@ -1156,6 +1193,8 @@ export default {
1156
1193
wifiSSID: {
1157
1194
required,
1158
1195
},
1196
+ wifiUser: {
1197
+ },
1159
1198
wifiPsw: {
1160
1199
required,
1161
1200
},
0 commit comments