king
2022-09-06 bdfec44c9f3a37dbbe05bf14a252ffec04132a86
src/views/design/index.jsx
@@ -3,7 +3,6 @@
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'
@@ -17,38 +16,6 @@
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 || ''
        // 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 () {