Commit 849ed028 by yangming

reset

1 parent 03bf77e9
NODE_ENV='development'
# must start with VUE_APP_
VUE_APP_ENV = 'development'
VUE_APP_PORT = 6651
NODE_ENV='production'
# must start with VUE_APP_
VUE_APP_ENV = 'production'
\ No newline at end of file
module.exports = {
root: true,
env: {
node: true
},
extends: ['plugin:vue/essential', '@vue/prettier'],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
"no-unused-vars":"off",
"prettier.endOfLine": "crlf",
"endOfLine":"auto"
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
"printWidth": 800,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"semi": false,
"wrap_line_length": 820,
"wrap_attributes": "auto",
"proseWrap": "always",
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "ignore",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"jsxBracketSameLine": true,
"files.insertFinalNewline": true,
"useTabs": false,
"eslintIntegration": true,
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
],
"endOfLine": "auto"
}
# subapp-blog
微前端博客子应用
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"]
};
\ No newline at end of file
This diff could not be displayed because it is too large.
{
"name": "settings",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.4.4",
"el-tree-transfer": "^2.2.6",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"@vue/eslint-config-prettier": "^5.0.0",
"babel-eslint": "^10.0.3",
"babel-plugin-component": "^1.1.1",
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0",
"glsx-common": "^1.4.6",
"glsx-components": "^1.0.8",
"node-sass": "^4.14.1",
"prettier": "^1.19.1",
"sass-loader": "^8.0.0",
"vue-cli-plugin-element": "^1.0.1",
"vue-template-compiler": "^2.6.10"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- 使用CDN的CSS文件 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
<% } %>
<!-- 使用CDN的JS文件 预加载 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %>
<title>微前端子应用:博客</title>
</head>
<body>
<noscript>
<strong>We're sorry but module-report doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
</html>
\ No newline at end of file
var express = require('express')
// var history = require('connect-history-api-fallback')
var cors = require('cors')
var app = express()
// app.use(history())
app.use(cors())
app.use(express.static('./dist'))
app.get('/', function(req, res) {
res.send('Hello jq')
})
const port = 6652
app.listen(port)
console.log(`服务已运行:\r\n http://127.0.0.1:${port}`)
<template>
<div id="app">
<!-- <h2>
报表子应用
<span class="right">{{ gs }}</span>
</h2>
<div id="nav">
<span>切换路由:</span>
<el-button-group class="right">
<el-button type="primary" size="medium" @click="routerChange('/')">报表</el-button>
<el-button type="primary" size="medium" @click="routerChange('/about')">穿梭框</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-1')">表格</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-2')">日历</el-button>
<el-button type="primary" size="medium" @click="toAppReport('3-1')">aaaa</el-button>
</el-button-group>
</div>
<div class="parent-child-communication">
<h3>父子应用通信:</h3>
<div style="margin-bottom: 20px;">
<span>rxjs通信方案:{{ myMsg }}</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('rxjs')">通知父应用变天了</el-button>
</div>
<div>
<span>官方通信方案:{{ myMessage }}</span>
<el-button class="right" type="primary" size="medium" @click="callParentChange('default')">通知父应用收到</el-button>
</div>
<img src="./assets/logo.png" alt="" srcset="" />
</div> -->
<router-view />
</div>
</template>
<script>
export default {
name: 'report-app',
props: {
msg: String,
message: String
},
data() {
return {
myMsg: '',
gs: ''
}
},
created() {
this.myMsg = this.msg
this.myMessage = this.message
}
}
</script>
<style lang="scss">
.parent-child-communication {
padding: 20px 0;
line-height: 36px;
}
</style>
>
/*
所有模块都定义在 modules
|-modules
|----demo.js
|----demo1.js
|----...
|-index.js ---动态对外暴露所有模块 无须手动添加
参考demo.js 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
*/
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
modules[moduleName] = value.default
return modules
}, {})
export default modules
/**
* 新增参数sign 判断接口是否需要sign签名
*/
/**
* 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
* @param {*} params
* @returns
*/
import { http } from '@/main'
//商户
export function getMerchantTree(params = {}) {
params.method = 'entmicro.api.common.findMerchantTreeByMerchantNo.list'
return http({
data: params,
method: 'POST',
})
}
//部门
export function getDepartment(params = {}) {
params.method = 'entmicro.api.department.listDepartmentTree'
return http({
data: params,
method: 'POST',
})
}
//关联企微
export function toGL(params = {}) {
params.method = 'entmicro.api.common.relevanceEntmicro.list'
return http({
data: params,
})
}
// merchants.api.merchant.findMerchantBaseInfo
// 查询商户基本信息
export function merchantInfo(params = {}) {
params.method = 'entmicro.api.common.findMerchantInfoByMerchantNo.list'
return http({
data: params,
})
}
// const GETLISTDEVICEFILEUNSTOCK1 = params => {
// return http({
// url: '/router',
// method: 'POST',
// data: params,
// sign: true
// })
// }
export default {
// getMerchantTree,
// GETLISTDEVICEFILEUNSTOCK1
}
\ No newline at end of file
/**
* 新增参数sign 判断接口是否需要sign签名
*/
/**
* 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
* @param {*} params
* @returns
*/
import { http } from '@/main'
const GETLISTDEVICEFILEUNSTOCK = params => {
return http({
url: 'base/apps',
method: 'GET',
data: params,
sign: true
})
}
const GETLISTDEVICEFILEUNSTOCK1 = params => {
return http({
url: 'base/apps',
method: 'POST',
data: params,
sign: true
})
}
export default {
GETLISTDEVICEFILEUNSTOCK,
GETLISTDEVICEFILEUNSTOCK1
}
.left {
float: left;
}
.right {
float: right;
}
.align-right {
text-align: right;
}
.left{float:left}.right{float:right}.align-right{text-align:right}
.left {
float: left;
}
.right {
float: right;
}
.align-right {
text-align: right;
}
/**
* 根据路由匹配地址
* @param {*} data 路由数据
* @param {*} base 路由前缀
* @param {*} options 粗略的配置项
*/
function routeMatch(data, base, options = { url: 'url', name: 'name', id: 'id', permissions: 'permissions' }) {
if (!Array.isArray(data)) return []
// 主视图路由 正式项目需要区分登陆注册等
/* let userRouter = {
path: "/layout",
name: "layout",
component: () => import('@/views/layout/index.vue'),
redirect: '/index',
children: []
}; */
// 创建路由盒子
let routerBox = []
// 将菜单数据处理为一维函数 如果有多级菜单
// let menu = flattenDeep(data, 'children');
let menu = data
// 遍历处理路由
menu.forEach(item => {
if (!item[options.url]) return
let _url = item[options.url].replace(base, '')
try {
let routerItem = {
path: _url, // 路由路径名
name: item[options.name] || item[options.id], // 命名路由 用于配合菜单简洁跳转
meta: {
purview: item[options.permissions]
}, // 路由元信息 定义路由时即可携带的参数,可用来管理每个路由的按钮操作权限
component: () => import(`@/views${_url}/index.vue`) // 路由映射真实视图路径
}
routerBox.push(routerItem)
} catch (err) {
item[options.url] = '/err-404'
}
})
// 推入需要授权后等异步加载的,非服务端获取的功能性页面
// routerBox.push(...nextRouter);
let errorBox = {
path: '*',
redirect: '/err-404'
}
routerBox.push(errorBox)
return routerBox
}
export default routeMatch
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-08 16:55:43
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
const environment = process.env.NODE_ENV || 'production'
let config = require('./env.' + environment)
module.exports = config
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-09-18 11:51:29
*/
// 本地环境配置
module.exports = {
title: 'scrm-sub-blog',
response: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: '0',
code_message_map: {}
},
request: {
// baseURL: 'http://192.168.3.191:8064/rop-scrm-entmicro/router',
baseURL: 'https://scrm.test.glsx.com.cn/rop-scrm-entmicro/router',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
sign: {
appKey: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
source: 'scrm-micro-settings',
},
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
cdn: 'https://www.xxx.cn/static'
}
\ No newline at end of file
module.exports = {
title: 'scrm-sub-blog',
response: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: '0',
code_message_map: {}
},
request: {
baseURL: 'http://192.168.3.171:7300/mock/6136bea6ceeb5a5c2bec6950/',
// 设置超时时间
timeout: 180000,
// 携带凭证
withCredentials: true,
// 返回数据类型
responseType: 'json'
},
sign: {
app_key: '48e5e13229b82c1b4e6e8c96151f0637',
v: '1.0.0',
format: 'json',
source: ''
},
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
cdn: 'https://www.xxx.cn/static'
}
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-09-07 14:38:52
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
// let request = require('@/http/request.js')
let cfg = require('./conf.js')
import { Http } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function(isEnv = true) {
if (isEnv) {
let { request } = cfg
Object.assign(request, { timeout })
return Promise.resolve(cfg)
}
return new Http().get('https://oss-config.test.glsx.com.cn/mock/616d443d1072f92988f05a04/setting/config')
}
export const config = {
install(vue, cfg) {
vue.prototype.$config = cfg
}
}
\ No newline at end of file
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-08-13 14:12:11
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:31
* @FilePath: \scrm\scrm-sub-blog\src\main.js
*/
import Vue from 'vue'
import apis from './api'
import './public-path'
import 'glsx-components/dist/glsx-components.css'
import { start } from '@/setup'
Vue.config.productionTip = false
Vue.prototype.$apis = apis
start()
export { bootstrap, mount, unmount } from '@/setup'
export const http = params => Vue.prototype.$http(params)
import Vue from 'vue'
import { Message, Button, ButtonGroup, Form, FormItem, Input, Radio, RadioGroup, Checkbox, CheckboxGroup, Switch, Select, Option, TimePicker, Col, DatePicker, Tree, Cascader, Table, TableColumn, } from 'element-ui'
Vue.use(Button)
Vue.use(ButtonGroup)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Input)
Vue.use(Radio)
Vue.use(RadioGroup)
Vue.use(Checkbox)
Vue.use(CheckboxGroup)
Vue.use(Switch)
Vue.use(Select)
Vue.use(Option)
Vue.use(TimePicker)
Vue.use(Col)
Vue.use(DatePicker)
Vue.use(Tree)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Cascader)
export const message = Message
\ No newline at end of file
if (window.__POWERED_BY_QIANKUN__) {
// eslint-disable-next-line no-undef
__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__
}
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
Vue.use(VueRouter)
// 处理重复点击同一个路由报错的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
// function getRoutes({ name, id, routesData }) {
// const routes = []
// if (routesData && name && id) {
// for (let i = 0, length = routesData.length; i < length; i += 1) {
// const element = routesData[i]
// if (element && element.path && element.path.includes(name) && element.meta && element.meta.id && element.meta.id.startsWith(id)) {
// const path = element.path.slice(name.length + 1)
// element.path = path
// element.component = () => import('@/views' + path + '.vue')
// routes.push(element)
// }
// }
// }
// return routes
// }
function getRoutes(routesData) {
return routesData.reduce((routes, route) => {
routes.push({ ...route, component: () => import('@/views' + route.path + '.vue') })
return routes
}, [])
}
export { VueRouter, routes, getRoutes }
const staticRoutes = Object.freeze([{
name: 'Home',
path: '/',
meta: {},
component: resolve => require([`@/views/home/index.vue`], resolve)
},
{
name: 'About',
path: '/about',
component: resolve => require([`@/views/about/index.vue`], resolve),
meta: {}
},
{
name: 'Hidden',
path: '/about/hidden',
component: resolve => require([`@/views/about/hidden.vue`], resolve),
meta: {}
},
{
name: 'BaseInfo',
path: '/baseInfo/index',
component: resolve => require([`@/views/baseInfo/index.vue`], resolve),
meta: {}
},
{
name: 'Relevance',
path: '/baseInfo/relevance',
component: resolve => require([`@/views/baseInfo/relevance.vue`], resolve),
meta: {}
},
{
name: 'Account',
path: '/account/index',
component: resolve => require([`@/views/account/index.vue`], resolve),
meta: {
url: 'http://192.168.1.68:5501/html/merchant/index.html'
}
},
{
name: 'Employee',
path: '/employee/index',
component: resolve => require([`@/views/employee/index.vue`], resolve),
meta: {
url: 'http://192.168.1.68:5501/html/employee/index.html'
}
},
{
name: 'Role',
path: '/role/index',
component: resolve => require([`@/views/role/index.vue`], resolve),
meta: {
url: 'http://192.168.1.68:5501/html/role/index.html'
}
},
{
name: 'Role',
path: '/role/add',
component: resolve => require([`@/views/role/add.vue`], resolve),
meta: {
url: 'http://192.168.1.68:5501/html/role/add.html'
}
}
])
export default staticRoutes
\ No newline at end of file
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:31:52
* @LastEditors: limin
* @LastEditTime: 2021-09-24 10:41:09
* @FilePath: \scrm\scrm-sub-blog\src\setup\index.js
*/
import { bootstrap, mount, unmount } from './qiankun'
import { start } from './single'
export { bootstrap, mount, unmount, start }
import Vue from 'vue'
import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config'
import { GLButton, GLTable, GLExternal } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router'
import render from './render'
import 'glsx-components/src/theme/theme.scss'
import ElementUI from 'element-ui'
let routes = []
let router = null
let instance = null
Vue.use(GLTable)
Vue.use(ElementUI)
Vue.use(GLExternal)
export async function bootstrap({ name, id, history, common, messenger, globalState }) {
const { response, request, sign, secret } = await fetchConfig(false)
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
// routes = getRoutes({ name, id, routesData })
routes = getRoutes(routesData)
subscribe({ messenger })
}
export async function mount(props) {
const insts = render(props.routerBase, routes)
router = insts.router
instance = insts.vm
}
export async function unmount() {
instance.$destroy()
instance.$el.innerHTML = ''
instance = null
router = null
}
function subscribe({ messenger }) {
messenger.subscribe(v => {
console.log(`监听到子应用${v.from}发来消息:`, v)
})
}
\ No newline at end of file
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-23 19:04:32
* @LastEditors: limin
* @LastEditTime: 2021-09-23 20:34:32
* @FilePath: \scrm\scrm-sub-blog\src\qiankun\render.js
*/
import App from '../App.vue'
import Vue from 'vue'
import store from '@/store'
import { VueRouter } from '@/router'
const render = (base, routes) => {
const router = new VueRouter({
base,
routes,
mode: 'history'
})
const vm = new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
return { router, vm }
}
export default render
/*
* @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(false)
Vue.prototype.$http = new Http({ response, request, sign, secret, alert: message.error, headers: { token: '1112223333444' } })
Vue.use(GLButton, { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
render('/', routes)
}
\ No newline at end of file
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-08-13 14:12:11
* @LastEditors: limin
* @LastEditTime: 2021-08-25 14:14:44
* @FilePath: \scrm\scrm-base\src\store\index.js
*/
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce(
(result, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
result.getters[moduleName] = state => state[moduleName]
result.modules[moduleName] = value.default
return result
},
{ modules: {}, getters: {} }
)
const store = new Vuex.Store(modules)
export default store
export default {
namespaced: true,
state: {
size: 10, // 分页 页大小
token: ''
},
mutations: {
// 设置分页大小
SET_PAGE_SIZE(state, data) {
state.size = data
},
// 设置token
SET_TOKEN(state, data) {
state.token = data
}
},
actions: {
// 设置分页大小
setPageSize({ commit }, data) {
commit('SET_PAGE_SIZE', data)
},
// 设置token
setToken({ commit }, data) {
commit('SET_TOKEN', data)
}
}
}
export default {
namespaced: true,
state: {},
mutations: {},
actions: {}
}
<template>
<div class="report-home">
HOME
<GLButton type="danger" @click="test()" class="test555" id="1-1-1-1" mode="link">权限按钮测试</GLButton>
<GLButton type="success" size="small" @click="test()" id="1-1-1-1" class="test">权限按钮测试2</GLButton>
<el-button class="test" @click="test()">东方网分</el-button>
</div>
</template>
<script>
export default {
name: 'home',
methods: {
test() {
console.log('点击了按钮')
this.$messenger.send({ from: 'blog', message: { from: 11, message: '11111' } })
}
}
}
</script>
<template>
<div class="report-about">
<h4>穿梭框1</h4>
<h4 class="align-center">
<label>请打开f12查看移动数据</label>
<el-button size="medium" type="info" @click="changeMode">当前模式:{{ mode }}</el-button>
<el-button size="medium" @click="clearChecked()">清除选中</el-button>
<el-button size="medium" @click="toHidden()">去=隐藏的路由</el-button>
</h4>
<div class="box">
<!-- lazy -->
<!-- :lazyFn="lazyFn" -->
<tree-transfer ref="wl-tree-transfer" filter high-light default-transfer :mode="mode" :title="title" :to_data="toData" :from_data="fromData" :filterNode="filterNode" :defaultProps="defaultProps" :defaultCheckedKeys="defaultCheckedKeys" :defaultExpandedKeys="[2, 3]" @right-check-change="rightCheckChange" @left-check-change="leftCheckChange" @removeBtn="remove" @addBtn="add" height="540px" node_key="id">
<span slot="title-right" class="my-title-right" @click="handleTitleRight">自定义内容</span>
</tree-transfer>
</div>
</div>
</template>
<script>
import treeTransfer from 'el-tree-transfer'
export default {
name: 'App',
components: { treeTransfer },
data() {
return {
mode: 'transfer', // transfer addressList
defaultProps: { label: 'name', children: 'children' },
fromData: [
{
id: 1,
pid: 0,
name: '测试左侧',
children: [
{
id: 2,
pid: 1,
name: '水电费是打发斯蒂芬斯蒂芬gas噶水电费噶地方死光光',
disabled: true,
children: []
},
{
id: 3,
pid: 1,
name: '11-3',
children: []
},
{
id: 4,
pid: 1,
name: '11-4',
children: [
{
id: 5,
pid: 4,
name: '11-5',
children: [
{
id: 111,
pid: 5,
name: '11-111'
}
]
},
{
id: 6,
pid: 4,
name: '11-6',
children: []
}
]
}
]
},
{
id: 7127,
pid: 0,
name: 'debug',
children: [
{
id: 71272,
pid: 7127,
name: 'debug22',
// disabled: true,
children: []
},
{
id: 71273,
pid: 7127,
name: 'debug11',
children: []
}
]
}
], // 穿梭框 - 源数据 - 树形
toData: [],
fromArray: [
{
id: '1',
name: '1',
pid: '0'
},
{
id: '2',
name: '2',
pid: '0'
},
{
id: '1-1',
name: '1-1',
pid: '1'
},
{
id: '1-2',
name: '1-2',
pid: '1'
},
{
id: '1-1-1',
name: '1-1-1',
pid: '1-1'
},
{
id: '1-1-1-1',
name: '1-1-1-1',
pid: '1-1-1'
},
{
id: '2-1',
name: '2-1',
pid: '2'
},
{
id: '2-2',
name: '2-2',
pid: '2'
}
],
toArray: [],
defaultCheckedKeys: [] // 左侧默认选中数据
}
},
created() {},
mounted() {
this.$apis.demo.GETLISTDEVICEFILEUNSTOCK({ k: 2, kdj: 5 }).then(res => {})
// 测试延迟默认选中
setTimeout(() => {
this.defaultCheckedKeys = [1]
}, 1000)
},
methods: {
toHidden() {
this.$router.push('/about/hidden')
},
// 清除选中
clearChecked() {
this.$refs['wl-tree-transfer'].clearChecked()
},
// 自定义筛选函数
filterNode(value, data, where) {
console.log(value, data, where)
if (!value) return true
return data[this.defaultProps.label].indexOf(value) !== -1
},
// 懒加载回调
lazyFn(node, resolve) {
setTimeout(() => {
resolve([
{
id: 71272,
pid: 7127,
name: 'debug22',
// disabled: true,
children: []
},
{
id: 71273,
pid: 7127,
name: 'debug11',
children: []
}
])
}, 500)
},
// 切换模式 现有树形穿梭框模式transfer 和通讯录模式addressList
changeMode() {
if (this.mode == 'transfer') {
this.mode = 'addressList'
} else {
this.mode = 'transfer'
}
},
// 添加按钮
add(fromData, toData, obj) {
// 树形穿梭框模式transfer时,返回参数为左侧树移动后数据、右侧树移动后数据、移动的{keys,nodes,halfKeys,halfNodes}对象
// 通讯录模式addressList时,返回参数为右侧收件人列表、右侧抄送人列表、右侧密送人列表
console.log('fromData:', fromData)
console.log('toData:', toData)
console.log('obj:', obj)
},
// 移除按钮
remove(fromData, toData, obj) {
// 树形穿梭框模式transfer时,返回参数为左侧树移动后数据、右侧树移动后数据、移动的{keys,nodes,halfKeys,halfNodes}对象
// 通讯录模式addressList时,返回参数为右侧收件人列表、右侧抄送人列表、右侧密送人列表
console.log('fromData:', fromData)
console.log('toData:', toData)
console.log('obj:', obj)
},
// 左侧源数据选中事件
leftCheckChange(nodeObj, treeObj, checkAll) {
console.log(nodeObj)
console.log(treeObj)
console.log(checkAll)
},
// 右侧目标数据选中事件
rightCheckChange(nodeObj, treeObj, checkAll) {
console.log(nodeObj)
console.log(treeObj)
console.log(checkAll)
},
// 自定义节点 仅树形结构支持
renderContent(h, { node, data }) {
return (
<span class="custom-tree-node">
<span>{node.label}</span>
<span>
<el-button size="mini" type="text" on-click={() => this.append(data)}>
Append
</el-button>
<el-button size="mini" type="text" on-click={() => this.remove(node, data)}>
Delete
</el-button>
</span>
</span>
)
},
// 标题自定义区点击事件
handleTitleRight() {
alert('标题自定义区点击事件')
}
},
computed: {
title() {
if (this.mode == 'transfer') {
return ['源列表', '目标列表']
} else {
return ['通讯录', '收件人', '抄送人', '密送人']
}
}
}
}
</script>
<style>
.align-center {
text-align: center;
}
.box {
width: 600px;
margin: 0 auto;
text-align: left;
}
.btn {
border: 1px solid #ebeef5;
padding: 5px 10px;
background-color: #f5f7fa;
outline: none;
}
.my-title-right {
float: right;
font-size: 12px;
cursor: pointer;
}
</style>
<template>
<div>
<GLExternal v-if="url" :url="url" :subscribe="subscribe"></GLExternal>
</div>
</template>
<script>
export default {
name: 'account',
data() {
return {
url: ''
}
},
mounted() {
const {session, session: {accountLevel, merchantModel, merchantId, sessionId}} = this.$globalState
const params = {
accountLevel,
merchantModel,
merchantId,
sessionId
}
console.log(params)
let url = this.$router.currentRoute.meta.url
this.url = window.location.protocol + '//' + url.split('://')[1] + '?' + this.$common.utils.genUrlParams(params)
console.log(this.url)
},
methods: {
subscribe(child) {
child.on('route-to', params => {
this.$history.push(params.path)
})
}
}
}
</script>
<style></style>
<template>
<div class="bloc-info-module">
<div class="wrapper">
<div class="wrap_left">
<div class="out_box_wrap">
<div class="fixed_widget">
<div class="label_text">版本:{{ bloc.merchantModelName || '--'}}</div>
<div class="label_text dr_top">
开通门店数:
<span v-if="bloc.numberStores" class="num_text">{{ bloc.numberStores }}家</span>
<span v-else class="num_text">--</span>
</div>
<div class="label_text dr_top">门店详情</div>
</div>
<div :class="isOpen ? 'table_wrapper_open' : 'table_wrapper_close'">
<!-- <GLTable v-if="isOpen" :hasPage="false" :tableParams="tableParams" :tableData="list" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }"></GLTable> -->
<template v-if="isOpen">
<div class="line_wrapper wrap_header">
<div class="tittle text_w">序号</div>
<div class="tittle1 text_w">门店名称</div>
<div class="tittle2 text_w">有效期</div>
</div>
<div class="line_body">
<template v-if="list.length">
<div v-for="(item, index) in list" :key="index" class="line_wrapper">
<div class="tittle">{{ index + 1 }}</div>
<div class="tittle1">{{ item.merchantName }}</div>
<div class="tittle2">{{ item.date }}</div>
</div>
</template>
<template v-if="!list.length">
<div class="line_wrapper">暂无数据</div>
</template>
</div>
</template>
</div>
<div class="fixed_footer" @click="changeRightOpenStatus(isOpen)">
<i :class="isOpen ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
<span class="dr_left">{{ isOpen ? '隐藏门店详情' : '展开门店详情' }}</span>
</div>
</div>
</div>
<!-- <div class="wrap_right">
<div v-for="(item, index) in rightData" :key="index" class="out_box_wrap">
<div class="fixed_widget">
<div class="label_text">版本:{{ item.name }}</div>
<div class="label_text dr_top">
开通门店数:
<span class="num_text">{{ item.num }}家</span>
</div>
<div class="label_text dr_top">门店详情</div>
</div>
<div :class="item.open ? 'table_wrapper_open' : 'table_wrapper_close'">
<glsx-table v-if="item.open" :hasPage="false" :tableParams="tableParams" :tableData="item.list" :headerStyle="{ background: '#F4F6FC', color: '#333333', fontSize: '14px' }"></glsx-table>
</div>
<div class="fixed_footer" @click="changeRightOpenStatus(item, index)">
<i :class="item.open ? 'el-icon-caret-top' : 'el-icon-caret-bottom'"></i>
<span class="dr_left">{{ item.open ? '隐藏门店详情' : '展开门店详情' }}</span>
</div>
</div>
</div> -->
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
curOpenIndex: 0,
dataList: [],
leftData: [],
rightData: [],
tableParams: {
listName: 'list',
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '有效期',
prop: 'date'
}
]
},
isOpen: false
}
},
props: {
list: Array,
bloc: null
},
methods: {
// changeLeftOpenStatus(item, index) {
// this.leftData[index].open = !item.open
// },
changeRightOpenStatus(isOpen) {
this.isOpen = !isOpen
},
// handlerData() {
// let arr = this.dataList
// let left = []
// let right = []
// arr.forEach((item, index) => {
// if (index % 2 == 0) {
// left.push(item)
// } else {
// right.push(item)
// }
// })
// this.leftData = left
// this.rightData = right
// console.log(left)
// console.log(right)
// }
},
mounted() {}
}
</script>
<style lang="scss" scoped>
.bloc-info-module {
box-sizing: border-box;
padding: 20px 0 0 40px;
}
.wrapper {
display: flex;
flex-wrap: wrap;
.wrap_left,
.wrap_right {
// min-width: 44.8%;
min-width: 520px;
min-height: 176px;
}
.wrap_left {
margin-right: 40px;
}
}
.out_box_wrap {
width: 100%;
min-height: 176px;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
border-radius: 10px;
border: 1px solid #e5e4ff;
margin: 0 40px 40px 0;
.fixed_widget {
width: 100%;
height: 140px;
box-sizing: border-box;
padding: 20px 0 0 20px;
.label_text {
color: #333333;
font-size: 14px;
font-weight: 400;
}
.num_text {
font-size: 14px;
font-weight: 400;
color: #5850ff;
}
.dr_top {
margin-top: 20px;
}
}
.table_wrapper_close {
height: 0;
// transition: height 0.1s ease-in-out;
}
.table_wrapper_open {
height: 378px;
// transition: height 0.1s ease-in-out;
}
.line_wrapper {
width: 100%;
min-height: 54px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
font-size: 14px;
border-bottom: 1px solid #dcdfe6;
.tittle {
width: 20%;
text-align: center;
color: #333333;
font-size: 14px;
}
.tittle1 {
width: 40%;
text-align: center;
color: #333333;
font-size: 14px;
word-wrap: break-word;
word-break: break-all;
overflow: hidden;
}
.tittle2 {
width: 40%;
text-align: center;
color: #333333;
font-size: 14px;
}
}
.wrap_header {
background: #f4f6fc;
}
.text_w {
font-weight: bold;
}
.line_body {
width: 100%;
height: 324px;
overflow-y: auto;
overflow-x: hidden;
}
.line_body::-webkit-scrollbar {
height: 1px;
width: 8px;
}
.line_body::-webkit-scrollbar-thumb {
background: #e9e8ff;
border-radius: 7px;
}
.fixed_footer {
width: 100%;
height: 36px;
background: #f4f6fc;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 400;
color: #b9b8c7;
border-radius: 0px 0px 10px 10px;
cursor: pointer;
.dr_left {
margin-left: 12px;
}
}
}
// .bloc-info-module /deep/ .el-table__body-wrapper {
// height: 352px;
// overflow-y: auto;
// overflow-x: hidden;
// }
// .bloc-info-module /deep/ .el-table__body-wrapper::-webkit-scrollbar {
// height: 1px;
// width: 8px;
// }
// .bloc-info-module /deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb {
// background: #e9e8ff;
// border-radius: 7px;
// }
</style>
\ No newline at end of file
<template>
<div class="out_main">
<!-- <div class="base-info-index"> -->
<div class="top_widget">
<img class="sign_icon" src="../../assets/scrm_base_info_icon_one.png" />
<div class="info_widget">
<div class="title_text">
{{ blocInfo.merchantName }}
<span class="min_text">(商户号:{{ blocInfo.merchantNo }})</span>
</div>
<div class="sec_title_text dr_top_1">
<span>关联企微:{{ blocInfo.entmicroName || '--' }}</span>
<div v-if="blocInfo.entmicroName" class="auth_btn" :class="accountLevel != 4 ? 'auth_btn_cp' : ''">已授权</div>
</div>
<div v-if="accountLevel==1" class="min_text dr_top_1">所属企业:--</div>
<div v-if="accountLevel!=1" class="min_text dr_top_1">所属企业:{{ blocInfo.parentName }}</div>
<div v-if="accountLevel==4" class="min_text">企微员工:{{ blocInfo.entMicroEmployeeCount }}人</div>
</div>
</div>
<blocModule :bloc="blocInfo" :list.sync="storesList" v-if="accountLevel != 4"></blocModule>
<shopModule v-if="accountLevel == 4"></shopModule>
<!-- </div> -->
</div>
</template>
<script>
import shopModule from './shop.vue'
import blocModule from './bloc.vue'
import { merchantInfo } from '../../api/modules/baseinfoApi'
export default {
name: 'index',
components: {
shopModule,
blocModule
},
data() {
return {
platform: 1, //1 集团 2 门店
accountLevel:1,//1-工厂;2-省代;3-市代;4-门店
blocInfo: {
merchantName: ''
},
storesList: []
}
},
created() {
//this.$globalState.accountLevel
const { session } = this.$globalState
this.platform = session.merchantModel
this.loginInfo = session
this.accountLevel = session.accountLevel
this.getBlocData()
},
methods: {
getBlocData() {
let para = {
merchantId: this.loginInfo.merchantId,
sessionId: this.loginInfo.sessionId
}
// let res = {
// merchantName: '冒烟商户AB熬时间的冒烟商户AB熬时间的冒烟商户AB熬时间的冒烟商户AB熬时间的冒烟商户AB熬时间的冒烟商户AB熬时间的',
// entmicroName: '54455445',
// parentName: '冒烟商户AB',
// entMicroEmployeeCount: 0,
// merchantModelName: '门店版',
// numberStores: 1,
// stores: [
// {
// merchantName: '冒烟商户AB熬时间的冒烟商户冒烟商户AB熬时间的冒烟商户冒烟商户AB熬时间的冒烟商户冒烟商户AB熬时间的冒烟商户冒烟商户AB熬时间的冒烟商户冒烟商户AB熬时间的冒烟商户冒烟商户AB熬时间的冒烟商户冒烟商户AB熬时间的冒烟商户',
// starttime: 1629712248000,
// endtime: 1664208000000
// }
// ]
// }
merchantInfo(para).then(res => {
this.blocInfo = res
this.storesList = res.stores.map(item => {
item.date = `${this.dateFormat(item.starttime, 'YYYY.MM.DD')}--${this.dateFormat(item.endtime, 'YYYY.MM.DD')}`
return item
})
// for(let i = 0;i<30;i++){
// this.storesList.push(this.storesList[0])
// }
})
},
dateFormat: function (dateTime, format = 'yyyy-MM-dd') {
const date = new Date(dateTime)
const config = {
YYYY: date.getFullYear(),
MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
DD: date.getDate(),
HH: date.getHours(),
mm: date.getMinutes(),
ss: date.getSeconds()
}
for (const key in config) {
format = format.replace(key, config[key])
}
return format
}
}
}
</script>
<style lang="scss" scoped>
.out_main {
box-sizing: border-box;
margin: 0 20px 64px 40px;
background: #fff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
min-height: calc(100vh - 144px);
}
.base-info-index {
width: 100%;
height: calc(100vh - 144px);
background: #fff;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
overflow: hidden;
overflow-y: scroll;
}
.out_main::-webkit-scrollbar {
height: 1px;
width: 8px;
}
.out_main::-webkit-scrollbar-thumb {
background: #e9e8ff;
border-radius: 7px;
}
.top_widget {
width: 100%;
box-sizing: border-box;
padding: 40px 0 0 40px;
display: flex;
.sign_icon {
width: 64px;
height: 64px;
border-radius: 50%;
}
.info_widget {
margin-left: 15px;
.title_text {
color: #333333;
font-size: 16px;
font-weight: 500;
}
.min_text {
color: #999999;
font-size: 12px;
line-height: 20px;
}
.sec_title_text {
color: #333333;
font-size: 14px;
font-weight: 400;
.auth_btn {
width: 48px;
height: 20px;
text-align: center;
line-height: 20px;
border-radius: 1px;
border: 1px solid #ff6d00;
font-size: 12px;
font-weight: 400;
color: #ff6d00;
display: inline-block;
margin-left: 16px;
}
.auth_btn_cp {
border: 1px solid #5850ff;
color: #5850ff;
}
}
.dr_top_1 {
margin-top: 8px;
}
}
}
</style>
\ No newline at end of file
<template>
<div class="shop-info-module">
<div class="wrapper">
<div class="out_wrap dr_right">
<div class="elment_widget">
<div class="top_bg_wrap">
<div class="title_text">已购产品信息</div>
<div class="desc_text">
<span>标准版有效期:</span>
<span class="spc_text">2021年1月1日-2022年1月1日</span>
</div>
</div>
<div class="bottom_wrap">
<div class="info_text">已购版本:嘀加智慧门店SCRM标准版</div>
<div class="info_text dr_top">短信总条数:--</div>
<div class="info_text dr_top">外呼电话总数:--</div>
</div>
</div>
<div class="element_btn dr_top disableBtn">续费</div>
</div>
<!-- <div class="out_wrap dr_right">
<div class="elment_widget dr_right">
<div class="top_bg_wrap">
<div class="title_text">智能语音电话套餐信息</div>
<div class="desc_text">
<span>剩余外呼电话数:</span>
<span class="spc_text max_text">3000</span>
<span class="unit_text">个</span>
</div>
</div>
<div class="bottom_wrap">
<div class="info_text">已呼电话个数:2000个</div>
<div class="info_text dr_top">已购版本:嘀加智慧门店SCRM标准版-智能语音…</div>
<div class="info_text dr_top">外呼电话总数:5000个</div>
</div>
</div>
<div class="element_btn dr_top disableBtn">续费</div>
</div> -->
<!-- <div class="out_wrap">
<div class="elment_widget">
<div class="top_bg_wrap">
<div class="title_text">短信套餐信息</div>
<div class="desc_text">
<span>剩余短信条数:</span>
<span class="spc_text max_text">8000</span>
<span class="unit_text">条</span>
</div>
</div>
<div class="bottom_wrap">
<div class="info_text">剩余短信条数:2000条</div>
<div class="dr_top min_text">
<span>营销短信:1000条</span>
<span class="dr_left">通知:1000条</span>
</div>
<div class="info_text dr_top">已购版本:嘀加智慧门店SCRM标准版-短信套餐</div>
<div class="info_text dr_top">短信总条数:10000条-短信套餐</div>
</div>
</div>
<div class="element_btn dr_top disableBtn">续费</div>
</div> -->
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped>
.shop-info-module {
box-sizing: border-box;
padding: 60px 0 0 40px;
}
.wrapper {
display: flex;
.dr_right {
margin-right: 30px;
}
.out_wrap {
width: 29%;
height: 298px;
.elment_widget {
width: 100%;
height: 250px;
border: 1px solid #e5e4ff;
border-radius: 10px;
.top_bg_wrap {
width: 100%;
height: 108px;
background-image: url('../../assets/scrm_base_info_icon_two.png');
background-size: 100% 108px;
box-sizing: border-box;
padding: 20px 0 0 20px;
.title_text {
color: #333;
font-size: 18px;
font-weight: 600;
}
.desc_text {
font-size: 14px;
font-weight: 400;
color: #333333;
margin-top: 28px;
.spc_text {
font-weight: 600;
color: #5850ff;
}
.max_text {
font-size: 22px;
}
.unit_text {
margin-left: 4px;
}
}
}
.bottom_wrap {
width: 100%;
height: 142px;
box-sizing: border-box;
padding: 20px 0 0 20px;
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
.info_text {
font-size: 14px;
font-weight: 400;
color: #666666;
}
.min_text {
font-size: 12px;
color: #666666;
}
.dr_left {
margin-left: 30px;
}
}
}
.element_btn {
width: 72px;
height: 36px;
text-align: center;
line-height: 36px;
background: #5850ff;
border-radius: 4px;
color: #fff;
font-size: 16px;
font-weight: 600;
margin: 0 auto;
cursor: pointer;
}
.disableBtn {
background: #CCC;
}
}
}
.dr_top {
margin-top: 10px !important;
}
</style>
\ No newline at end of file
<template>
<div>
<GLExternal v-if="url" :url="url" :subscribe="subscribe"></GLExternal>
</div>
</template>
<script>
export default {
name: 'adapter',
data() {
return {
url: ''
}
},
mounted() {
console.log(window.location.protocol)
const {session, session: {accountLevel, merchantModel, merchantId, sessionId}} = this.$globalState
const params = {
accountLevel,
merchantModel,
merchantId,
sessionId
}
console.log(params)
let url = this.$router.currentRoute.meta.url
this.url = window.location.protocol + '//' + url.split('://')[1] + '?' + this.$common.utils.genUrlParams(params)
console.log(this.url)
},
methods: {
subscribe(child) {
child.on('route-to', params => {
this.$history.push(params.path)
})
}
}
}
</script>
<style></style>
<template>
<div class="report-home">
HOME
<GLButton type="danger" @click="test()" class="test555" id="1-1-1-1" mode="link">权限按钮测试</GLButton>
<GLButton type="success" size="small" @click="test()" id="1-1-1-1" class="test">权限按钮测试2</GLButton>
<el-button class="test" @click="test()">东方网分</el-button>
</div>
</template>
<script>
export default {
name: 'home',
methods: {
test() {
console.log('点击了按钮')
this.$messenger.send({ message: { from: 11, message: '11111' } })
}
}
}
</script>
<template>
<div class="report-home">
<h2>
子应用2
</h2>
<div id="nav">
<el-button-group class="right">
<el-button type="primary" size="medium" @click="routerChange('/about/index')">应用内跳转</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-1-1')">子应用1-ui测试-组件测试</el-button>
<el-button type="primary" size="medium" @click="toAppReport('1-2')">子应用1-关于子应用</el-button>
<el-button type="primary" size="medium" @click="toAppReport({ path: 'sub01/changeData' })">不存在的路由</el-button>
</el-button-group>
</div>
<div class="parent-child-communication">
<h3>父子应用通信:</h3>
<div style="margin-bottom: 20px;">
<el-button class="right" type="primary" size="medium" @click="callParentChange()">给登录用户改个名</el-button>
</div>
<img src="../assets/logo.png" alt="" srcset="" />
</div>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
<div>17</div>
<div>18</div>
<div>19</div>
<div>20</div>
<div>21</div>
<div>22</div>
<div>23</div>
<div>24</div>
<div>25</div>
<div>26</div>
<div>27</div>
<div>28</div>
<div>29</div>
<div>30</div>
<div>31</div>
<div>32</div>
<div>33</div>
<div>34</div>
<div>35</div>
<div>36</div>
<div>37</div>
<div>38</div>
<div>39</div>
<div>40</div>
<div>41</div>
<div>42</div>
<div>43</div>
<div>44</div>
<div>45</div>
<div>46</div>
<div>47</div>
<div>48</div>
<div>49</div>
<div>50</div>
<div>51</div>
<div>52</div>
<div>53</div>
<div>54</div>
<div>55</div>
<div>56</div>
<div>57</div>
<div>58</div>
<div>59</div>
<div>60</div>
<div>61</div>
<div>62</div>
<div>63</div>
<div>64</div>
<div>65</div>
<div>66</div>
<div>67</div>
<div>68</div>
<div>69</div>
<div>70</div>
<div>71</div>
<div>72</div>
<div>73</div>
<div>74</div>
<div>75</div>
<div>76</div>
<div>77</div>
<div>78</div>
<div>79</div>
<div>80</div>
<div>81</div>
<div>82</div>
<div>83</div>
<div>84</div>
<div>85</div>
<div>86</div>
<div>87</div>
<div>88</div>
<div>89</div>
<div>90</div>
<div>91</div>
<div>92</div>
<div>93</div>
<div>94</div>
<div>95</div>
<div>96</div>
<div>97</div>
<div>98</div>
<div>99</div>
<div>100</div>
</div>
</template>
<script>
export default {
name: 'report-home',
data() {
return {}
},
methods: {
/**
* 路由切换
* url 路由地址
*/
routerChange(url) {
this.$router.push(url).catch(err => {
console.log(err)
})
},
/**
* 外部路由跳转
* this.$history.push(menu)
* menu 支持:1.string 视为id (每一个路由都有一个唯一id)
* 2.对象 {path:'sub1/home',id:'1-1-1'} 以id为准 跳转对应模块
* 3.对象 {path:'sub1/home'} 以path为准 跳转对应模块
* 以上三种情况都跳转到对应的模块
*/
toAppReport(menu) {
this.$history.push(menu)
},
callParentChange() {
this.$messenger.send({
userInfo: { name: '张三,来自子系统2' }
})
}
}
}
</script>
<style lang="scss">
.parent-child-communication {
padding: 20px 0;
line-height: 36px;
}
</style>
<template>
<div>
<GLExternal :url="url" :subscribe="subscribe"></GLExternal>
</div>
</template>
<script>
export default {
name: 'adapter',
data() {
return {
url: this.$router.currentRoute.meta.url
}
},
methods: {
subscribe(child) {
child.on('route-to', params => {
this.$history.push(params)
})
}
}
}
</script>
<style></style>
<template>
<div>
<GLExternal v-if="url" :url="url" :subscribe="subscribe"></GLExternal>
</div>
</template>
<script>
export default {
name: 'adapter',
data() {
return {
url: ''
}
},
mounted() {
const {session, session: {accountLevel, merchantModel, merchantId, sessionId}} = this.$globalState
const params = {
accountLevel,
merchantModel,
merchantId,
sessionId
}
console.log(params)
let url = this.$router.currentRoute.meta.url
this.url = window.location.protocol + '//' + url.split('://')[1] + '?' + this.$common.utils.genUrlParams(params)
console.log(this.url)
},
methods: {
subscribe(child) {
child.on('route-to', params => {
this.$history.push(params)
})
}
}
}
</script>
<style></style>
const path = require('path')
const packageName = require('./package.json').name
const node_env = process.env.NODE_ENV === 'production'
const publicPath = node_env ? `/child/${packageName}/` : '/'
const resolve = dir => path.join(__dirname, dir)
const CDN_DOMAIN = 'https://cdn.bootcdn.net/'
const cdn = {
css: [
`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`
],
js: [
`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`,
`${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`,
`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`,
`${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`,
`${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`
]
}
module.exports = {
outputDir: `../dist/${packageName}`,
publicPath,
assetsDir: 'static',
productionSourceMap: false,
configureWebpack: {
resolve: {
alias: {
'@': resolve('src'),
assets: resolve('src/assets'),
views: resolve('src/views'),
components: resolve('src/components')
}
},
output: {
library: `${packageName}-[name]`,
libraryTarget: 'umd', // 把微应用打包成 umd 库格式
jsonpFunction: `webpackJsonp_${packageName}`
},
externals: {
'vue': 'Vue',
'element-ui': 'ELEMENT',
'vue-router': 'VueRouter',
'vuex': 'Vuex',
'axios': 'axios',
'echarts': 'echarts'
}
},
devServer: {
hot: true,
disableHostCheck: true,
host: process.env.VUE_APP_HOST,
port: process.env.VUE_APP_PORT,
headers: {
'Access-Control-Allow-Origin': '*' // 主应用获取子应用时跨域响应头
}
},
chainWebpack: config => {
config.plugin('html')
.tap(args => {
// args[0].minify.removeComments = false;
args[0].cdn = cdn
return args
})
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
config.module
.rule('fonts')
.test(/.(ttf|otf|eot|woff|woff2)$/)
.use('url-loader')
.loader('url-loader')
.tap(options => {
options = {
// limit: 10000,
name: '/static/fonts/[name].[ext]'
}
return options
})
.end()
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!