emis-sapp/components/buns-api/subscribe-message/index.vue

47 lines
859 B
Vue
Raw Permalink Normal View History

2024-09-24 15:01:05 +00:00
<template>
</template>
<script>
import { promiseTimeout, showToast, uniPromiseApi } from "@/common/untool"
import { sysEventNames } from "@/common/enum"
import * as apiService from "@/common/api"
export default {
components: { },
data() {
return {
tmplIds: [],
}
},
computed: {
},
created() {
this.initData()
uni.$on(sysEventNames.subMessage, this.triggerCallApi)
},
mounted(){
},
unmounted(){
uni.$off(sysEventNames.subMessage, this.triggerCallApi)
},
methods: {
async initData(){
let res = await apiService.querySappNotifyTplList()
let tmplIds = res?.data?.map?.(t=> t.tplId) || []
this.tmplIds = tmplIds
},
async triggerCallApi(){
await uniPromiseApi('requestSubscribeMessage', {
tmplIds: this.tmplIds
})
}
}
}
</script>
<style scoped lang="scss">
</style>