4.0.1 • Published 2 years ago

cnr-common-web v4.0.1

Weekly downloads
6
License
ISC
Repository
github
Last release
2 years ago

vue-frame-cnr

vue component for crm system 示例

Install

npm install vue-frame-crm --save || npm install vue-frame-crm@xxx --save

编译和发布

  1. npm run build 进行编译和打包
  2. 切换到当前项目目录
  3. 切换npm源到npm源(https://registry.npmjs.org/): 只针对有自身源的情况
  4. npm login
  5. 修改package.json的版本号
  6. npm publish

Useage

  • frame component install
/**
 * 需要将frame组件注册到Vue中
 */
/* 全局注册 */
import Vue from 'vue'
import { TFrame } from 'vue-frame-crm'
Vue.use(TFame)

/* 局部注册, */
import { TFrame } from 'vue-frame-crm'
export default {
    ...
    components: {
        TFrame
    },
    ...
}

/**
 * 在模版中使用
 */
<t-frame
    :img="img"
    :imgMin="imgMin"
    :logo-router="logoRouter"
    :authorization="authorization"
    :tag="tag"
    :count="count"
    :navs="navs"
    :instance="$cmi">
</t-frame>

export default {
    data () {
        return {
            logoRouter: { name: 'portal'},
            img: img,
            imgMin: imgMin,
            authorization: authorization,
            tag: 'CRM',
            menuList: [],
            navs: [
              {
                type: 'icon',
                icon: 'bell'
              },
              {
                type: 'dropdown',
                icon: 'account-circle',
                children: [
                  {
                    name: 'icon1'
                  },
                  {
                    name: 'icon2'
                  },
                  {
                    name: 'icon3'
                  }
                ]
              },
              {
                type: 'icon',
                icon: 'arrow-right-bold-box-outline',
                handleType: 'logout'
              }
            ],
            count: 6
        }
    }
}
  • frame 组件的提供的参数

    • img string 左上角的logo图标

    • imgMin string 左上角的logo缩小图标

    • logoRouter object 左上角的logo图标的路由

    • authorization object 配置文件设置

    • tag string 当前系统的类型,用于判断是否在本系统中跳转

    • count number 右上角未读消息的个数

    • menuList 渲染menu菜单 { iconType, 一级菜单的右侧icon的type,对应的是aidesign的图标库 menuName, 当前菜单的名称 menuUrl, 路由url systemUrl, 非本系统host路由 (根据rightTag 与 tag),非本项目的链接 systemUrl + menuUrl }

    • activeMenu String, Number 当前展开的menu

    • navs array 渲染头部menu { type, 'icon'| 'dropdown' | 'avatar' icon, 图标icon的type,对应的是aidesign的图标库 children, 如果是dropdown时需要提供dropdownitem }

    navs: [
      {
        type: 'icon',
        icon: 'bell'
      },
      {
        type: 'dropdown',
        icon: 'account-circle',
        children: [
          {
            name: 'icon1'
          },
          {
            name: 'icon2'
          },
          {
            name: 'icon3'
          }
        ]
      },
      {
        type: 'icon',
        icon: 'arrow-right-bold-box-outline',
        handleType: 'logout'
      }
    ]
  • instance 服务调用实例

http 请求注入

以auth2的方式,将存在sessionStorage中token注册入请求头中(传入的是axios的实例)

  • 用法
/**
 * httpHandle 有两个函数
 * requestInterceptor (config, authorization, tokenUri)
 * handleResponseError (error, authorization)
 * http.js 最写入
 */
import { httpHandle } from 'vue-frame-crm'
import authorization from './authorization.js'

function requestInterceptor (config) {
    ...
    let conf = httpHandle.requestInterceptor(config, authorization, authorization.tokenUri)
    return merge(config, conf)
}

route 路由注入

在进入路由之前判断注册

/**
 * beforeEach(to, from, next, authorization, requestInstance, cb)
 * 在router.js 中写入
 */
import { route } from 'vue-frame-crm'
import authorization from './authorization.js'

router.beforeEach((to, from, next) => {
    route.beforeEach(to, from, next, authorization, http.$cmi)
})
4.0.1

2 years ago

4.0.0

3 years ago

0.3.6

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.9

3 years ago

0.3.0

3 years ago

0.3.5

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.3

3 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.57

4 years ago

0.1.58

4 years ago

0.1.56

4 years ago

0.1.55

4 years ago

0.1.54

4 years ago

0.1.53

4 years ago

0.1.52

4 years ago

0.1.51

4 years ago

0.1.49

4 years ago

0.1.48

4 years ago

0.1.52-zb

4 years ago

0.1.51-zb

4 years ago

0.1.50-zb

4 years ago

1.0.1-huanan

4 years ago

0.1.49-zb

4 years ago

0.1.48-zb

4 years ago

0.1.47-zb

4 years ago

1.0.0-huanan

4 years ago

0.1.47

5 years ago

0.1.46

5 years ago

0.1.45

5 years ago

0.1.44

5 years ago

0.1.43

5 years ago

0.1.46-zb

5 years ago

0.1.45-zb

5 years ago

0.1.43-zb

5 years ago

0.1.42-zb

5 years ago

0.1.41-zb

5 years ago

0.1.42

5 years ago

0.1.41

5 years ago

0.1.40

5 years ago

0.1.39

5 years ago

0.1.38

5 years ago

0.1.37

5 years ago

0.1.36

5 years ago

0.1.35

5 years ago

0.1.34

5 years ago

0.1.33

5 years ago

0.1.32

5 years ago

0.1.31

5 years ago

0.1.30

5 years ago

0.1.29

5 years ago

0.1.28

5 years ago

0.1.27

5 years ago

0.1.26

5 years ago

0.1.25

5 years ago

0.1.24

5 years ago

0.1.23

5 years ago

0.1.22

5 years ago

0.1.21

5 years ago

0.1.20

5 years ago

0.1.19

5 years ago

0.1.18

5 years ago

0.1.16

5 years ago

0.1.15

5 years ago

0.1.14

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago