single.js 1.23 KB
/*
 * @Descripttion:
 * @version: 1.0.0
 * @Author: limin
 * @Date: 2021-09-23 19:02:23
 * @LastEditors: limin
 * @LastEditTime: 2021-09-24 10:41:17
 * @FilePath: \scrm\scrm-sub-blog\src\setup\single.js
 */
import Vue from 'vue'
import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { Http, utils } from 'glsx-common'
import render from './render'
import { routes } from '@/router'
export async function start() {
  if (window.__POWERED_BY_QIANKUN__) return
  const { response, request, sign, secret } = await fetchConfig()
  var urlParams = {}
  window.location.href.split('?').length > 1
    ? window.location.href
        .split('?')[1]
        .split('&')
        .forEach(item => {
          urlParams[item.split('=')[0]] = item.split('=')[1]
        })
    : ''
  var token = Object.keys(urlParams).includes('sessionId') ? urlParams.sessionId : '1112223333444'
  Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: token } })
  Vue.prototype.$common = {
    utils: utils
  }
  Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
  render('/', routes)
}