|
@@ -15,7 +15,7 @@ import { mapState } from "vuex";
|
|
|
export default {
|
|
|
name: "APP",
|
|
|
computed: {
|
|
|
- ...mapState(["QECSConfig"]),
|
|
|
+ ...mapState(["user", "QECSConfig"]),
|
|
|
},
|
|
|
watch: {
|
|
|
QECSConfig() {
|
|
@@ -87,6 +87,32 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
+ async created() {
|
|
|
+ this.interval = setInterval(() => {
|
|
|
+ this.sendOnlineSignal();
|
|
|
+ }, 3 * 60 * 1000);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ clearInterval(this.interval);
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async sendOnlineSignal() {
|
|
|
+ if (!window.sessionStorage.getItem("token")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ await this.$http.get(
|
|
|
+ "/api/ecs_core/student/online_signal/" + this.user.id
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ this.logger({
|
|
|
+ page: window.location.pathname,
|
|
|
+ action: "发送在线信号",
|
|
|
+ userId: this.user.id,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|