This commit is contained in:
aihe 2024-09-24 23:01:05 +08:00
parent b77a01cc28
commit 7253d40032
10 changed files with 68 additions and 4 deletions

View File

@ -91,3 +91,8 @@ export const addComplaints = (data = {})=> {
export const getComplainInfo = (data = {})=> {
return coreRequest(url.getComplainInfo, data, {}, 'get')
}
// 小程序订阅消息模板列表
export const querySappNotifyTplList = (data = {})=> {
return coreRequest(url.querySappNotifyTplList, data, {}, 'get')
}

View File

@ -62,5 +62,7 @@ export default {
getWarehouseInList: `/oms2c/emisWarehouseIn/listSimple`, // 进仓单列表
getWarehouseInInfo: `/oms2c/emisWarehouseIn/getWarehouseInDetail`, // 获取进仓单详情
cusConfirmWsIn: `/oms2c/emisWarehouseIn/cusConfirmWsIn`, // 确认进仓单
querySappNotifyTplList: `/oms2c/common/querySappNotifyTplList`, // 小程序订阅消息模板列表
}

View File

@ -3,6 +3,7 @@ import { goto } from "./untool"
import { getCurrentInstance } from "vue"
import { sysEventNames } from "@/common/enum"
// 唤起登录
export const goLogin = ()=> {
// #ifdef MP
uni.$emit(sysEventNames.login, { })
@ -11,4 +12,9 @@ export const goLogin = ()=> {
// #ifndef MP
goto("login/login", 2)
// #endif
}
// 唤起消息订阅
export const triggerSubscribeMessage = ()=> {
uni.$emit(sysEventNames.subMessage, { })
}

View File

@ -30,6 +30,7 @@ const pageEventNames = {
const sysEventNames = {
login: "login", // 触发登录
subMessage: "subMessage", // 触发订阅模板消息
}
const addressNameCodeMap = [

View File

@ -2,7 +2,7 @@ import { goto, getImageTempFilePath } from "./untool";
import { showToast, showLoading, hideLoading, downloadFile } from "./untool"
import { setSessionXToken, getSessionXToken } from "@/session"
import { textEncoder, textDecoder } from "./util"
import { goLogin } from "@/common/loginHandle"
import { goLogin } from "@/common/componentEventHandle"
const getCommonReqData = ()=> {
const xToken = getSessionXToken()

View File

@ -0,0 +1,46 @@
<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>

View File

@ -3,14 +3,16 @@
<slot></slot>
</view>
<LoginComponent ref="loginRef"></LoginComponent>
<SubscribeMessage ref="subMessageRef"></SubscribeMessage>
</template>
<script>
import { pageEventNames } from "@/common/enum"
import LoginComponent from "@/components/buns-api/login/index"
import SubscribeMessage from "@/components/buns-api/subscribe-message/index"
export default {
components: { LoginComponent },
components: { LoginComponent, SubscribeMessage },
props: {
},

View File

@ -218,6 +218,7 @@
import BpeCheckagreeTmp from "@/components/buns-post-edit-templates/bpe-checkagree-tmp"
import dayjs from "dayjs"
import { debounce } from "@/common/util"
import { triggerSubscribeMessage } from "@/common/componentEventHandle"
import * as apiService from "@/common/api"
import { getOrderModels, initDefaultModel, setBindTsm, getBindTsm } from "./model"
@ -386,6 +387,7 @@
curModal.show = true
},
async handleSave(type) {
triggerSubscribeMessage() // 唤起消息订阅
let errMsg = ''
let saveServerHand = apiService.submitOrder
if(this.isEdit) { }

View File

@ -65,7 +65,7 @@
import { dealBtnMap } from "@/common/enum"
import { USERKEY } from "@/store/actionKey"
import * as apiService from "@/common/api"
import { goLogin } from "@/common/loginHandle"
import { goLogin } from "@/common/componentEventHandle"
export default {
computed: {

View File

@ -7,7 +7,7 @@ import {
} from "@/session"
import * as apiService from "@/common/api"
import { goto } from "@/common/untool"
import { goLogin } from "@/common/loginHandle"
import { goLogin } from "@/common/componentEventHandle"
export default {
state: {