Merge remote-tracking branch 'origin/main'

2.0/email-builder
Lei OT 10 months ago
commit de7133f7cd

@ -1,9 +1,8 @@
import { create } from 'zustand'
import { devtools } from 'zustand/middleware'
import { fetchJSON, postForm } from '@/utils/request'
import { fetchJSON } from '@/utils/request'
import { isEmpty, isNotEmpty } from '@/utils/commons'
import { API_HOST } from '@/config'
import { API_HOST, BUILD_VERSION } from '@/config'
export const PERM_MERGE_CONVERSATION = 'merge-conversation'
export const PERM_ASSIGN_NEW_CONVERSATION = 'assign-new-conversation'
@ -194,6 +193,26 @@ const useAuthStore = create(devtools((set, get) => ({
}
})
},
sendNotify: async () => {
const { loginUser } = get()
const notifyUrl = 'https://p9axztuwd7x8a7.mycht.cn/dingtalk/dingtalkwork/SendMDMsgByDingRobotToGroup'
const params = {
groupid: 'cidFtzcIzNwNoiaGU9Q795CIg==',
msgTitle: '有人求助',
msgText: loginUser.username + '上传了销售平台' + BUILD_VERSION + '的日志'
};
return fetchJSON(notifyUrl, params)
.then(json => {
if (json.errcode === 0) {
console.info('发送通知成功')
} else {
throw new Error(json?.errmsg + ': ' + json.errcode)
}
})
},
}), { name: 'authStore' }))
export default useAuthStore

@ -1,5 +1,5 @@
import { loadScript } from '@/utils/commons';
import { BUILD_VERSION, BUILD_DATE } from '@/config'
import { BUILD_VERSION } from '@/config'
export const loadPageSpy = (title) => {
@ -14,6 +14,6 @@ export const loadPageSpy = (title) => {
// 注册插件
PageSpy.registerPlugin(new DataHarborPlugin({ maximum: 2 * 1024 * 1024 }));
// 实例化 PageSpy
window.$pageSpy = new PageSpy({ api: 'page-spy.mycht.cn', project: 'Sales CRM v' + BUILD_VERSION, title: title, autoRender: false });
window.$pageSpy = new PageSpy({ api: 'page-spy.mycht.cn', project: 'Sales CRM' + BUILD_VERSION, title: title + '(v' + BUILD_VERSION + ')', autoRender: false });
});
};

@ -31,7 +31,7 @@ function AuthApp() {
const [messageApi, contextHolder] = message.useMessage()
const { colorPrimary, borderRadius } = useThemeContext()
const loginUser = useAuthStore((state) => state.loginUser)
const [loginUser, sendNotify] = useAuthStore((state) => [state.loginUser, state.sendNotify])
const href = useHref()
@ -67,6 +67,7 @@ function AuthApp() {
}
const uploadLog = () => {
sendNotify()
if (window.$pageSpy) {
window.$pageSpy.triggerPlugins('onOfflineLog', 'upload')
messageApi.info('Success')

Loading…
Cancel
Save