45 lines
825 B
Vue
45 lines
825 B
Vue
<script>
|
|
import {
|
|
mapMutations
|
|
} from "vuex";
|
|
import {
|
|
createMobileToken
|
|
} from '@/api/pages/login/index.js'
|
|
export default {
|
|
onLaunch: function() {
|
|
createMobileToken().then(res => {
|
|
uni.setStorageSync("token", res.data.token)
|
|
})
|
|
},
|
|
methods: {
|
|
...mapMutations(['socketOpenfalse']),
|
|
...mapMutations(['scoket']),
|
|
},
|
|
onShow: function() {
|
|
if (uni.getStorageSync('patientId') && !this.$store.state.socketOpen) {
|
|
this.scoket();
|
|
}
|
|
},
|
|
onHide: function() {
|
|
this.socketOpenfalse();
|
|
uni.closeSocket();
|
|
clearInterval(this.$store.state.timeoutObj);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import "uview-ui/index.scss";
|
|
|
|
/*每个页面公共css */
|
|
page {
|
|
background-color: #F4F5F7;
|
|
}
|
|
|
|
.app {
|
|
width: 100%;
|
|
height: 100%;
|
|
text-align: justify;
|
|
color: #000000;
|
|
}
|
|
</style> |