From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 02 八月 2022 11:42:43 +0800 Subject: [PATCH] Merge branch 'develop' --- src/views/design/index.jsx | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/src/views/design/index.jsx b/src/views/design/index.jsx index 8942896..d596e2f 100644 --- a/src/views/design/index.jsx +++ b/src/views/design/index.jsx @@ -3,6 +3,7 @@ import enUS from 'antd/es/locale/en_US' import zhCN from 'antd/es/locale/zh_CN' +import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' import Header from './header' import { setGLOBFuncs } from '@/utils/utils.js' @@ -16,6 +17,39 @@ class Design extends Component { componentDidMount() { setGLOBFuncs() + + // 鑾峰彇寰俊鍏紬鍙峰強灏忕▼搴忔秷鎭ā鏉� + if (window.GLOB.systemType !== 'production' && window.GLOB.WXAppID && !sessionStorage.getItem('wxTemplates')) { + Api.wxAccessToken().then(res => { + let wxtoken = res.oa_access_token || '' + wxtoken = '59_DH0hrAp0B8jtdJvU-7BV_-nG01qh2rUU1L8ihj-2pMWlUFLE2eEtVv4zZYAUIKcxCit4SgOTwxvUGdYHltaha3RmgnZqkQSgkxXRm9hz18kGbGhMc5r11W5Iv9Xr50Pz-Sz7FUVHCM-6GZLXJPIjAIAVBU' + let minitoken = res.mini_access_token || '' + + if (wxtoken) { + Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${wxtoken}`, 'get').then(res => { + if (res.template_list) { + let temps = res.template_list.filter(item => item.primary_industry) + sessionStorage.setItem('wxTemplates', JSON.stringify(temps)) + } else if (res.errcode === 0) { + sessionStorage.setItem('wxTemplates', JSON.stringify([])) + } + }) + } else { + sessionStorage.setItem('wxTemplates', JSON.stringify([])) + } + if (minitoken) { + Api.wxNginxRequest(`wxaapi/newtmpl/gettemplate?access_token=${minitoken}`, 'get').then(res => { + if (res.errmsg === 'ok' && res.data) { + sessionStorage.setItem('wxMiniTemplates', JSON.stringify(res.data)) + } else { + sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) + } + }) + } else { + sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) + } + }) + } } render () { -- Gitblit v1.8.0