xs-common-plugins 1.3.6 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="cn.fjdmy.uniapp.UniappProjectDataService">
4
+ <option name="generalBasePath" value="$PROJECT_DIR$" />
5
+ <option name="manifestPath" value="$PROJECT_DIR$/manifest.json" />
6
+ <option name="pagesPath" value="$PROJECT_DIR$/pages.json" />
7
+ <option name="scanNum" value="1" />
8
+ <option name="type" value="store" />
9
+ </component>
10
+ </project>
@@ -0,0 +1,60 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <code_scheme name="Project" version="173">
3
+ <option name="RIGHT_MARGIN" value="300" />
4
+ <HTMLCodeStyleSettings>
5
+ <option name="HTML_ATTRIBUTE_WRAP" value="0" />
6
+ <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
7
+ </HTMLCodeStyleSettings>
8
+ <JSCodeStyleSettings version="0">
9
+ <option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
10
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
11
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
12
+ <option name="USE_DOUBLE_QUOTES" value="false" />
13
+ <option name="FORCE_QUOTE_STYlE" value="true" />
14
+ <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
15
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
16
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
17
+ </JSCodeStyleSettings>
18
+ <TypeScriptCodeStyleSettings version="0">
19
+ <option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
20
+ <option name="FORCE_SEMICOLON_STYLE" value="true" />
21
+ <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
22
+ <option name="USE_DOUBLE_QUOTES" value="false" />
23
+ <option name="FORCE_QUOTE_STYlE" value="true" />
24
+ <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
25
+ <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
26
+ <option name="SPACES_WITHIN_IMPORTS" value="true" />
27
+ </TypeScriptCodeStyleSettings>
28
+ <VueCodeStyleSettings>
29
+ <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
30
+ <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
31
+ </VueCodeStyleSettings>
32
+ <codeStyleSettings language="HTML">
33
+ <option name="SOFT_MARGINS" value="400" />
34
+ <indentOptions>
35
+ <option name="CONTINUATION_INDENT_SIZE" value="4" />
36
+ <option name="USE_TAB_CHARACTER" value="true" />
37
+ </indentOptions>
38
+ </codeStyleSettings>
39
+ <codeStyleSettings language="JavaScript">
40
+ <option name="SOFT_MARGINS" value="400" />
41
+ <indentOptions>
42
+ <option name="USE_TAB_CHARACTER" value="true" />
43
+ </indentOptions>
44
+ </codeStyleSettings>
45
+ <codeStyleSettings language="TypeScript">
46
+ <option name="SOFT_MARGINS" value="400" />
47
+ <indentOptions>
48
+ <option name="USE_TAB_CHARACTER" value="true" />
49
+ </indentOptions>
50
+ </codeStyleSettings>
51
+ <codeStyleSettings language="Vue">
52
+ <option name="SOFT_MARGINS" value="400" />
53
+ <indentOptions>
54
+ <option name="INDENT_SIZE" value="4" />
55
+ <option name="TAB_SIZE" value="4" />
56
+ <option name="USE_TAB_CHARACTER" value="true" />
57
+ </indentOptions>
58
+ </codeStyleSettings>
59
+ </code_scheme>
60
+ </component>
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
+ </state>
5
+ </component>
package/.prettierrc ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "useTabs": true,
3
+ "tabWidth": 4,
4
+ "printWidth": 400,
5
+ "singleQuote": true,
6
+ "jsxSingleQuote": true,
7
+ "trailingComma": "none",
8
+ "semi": false,
9
+ "arrowParens": "avoid",
10
+ "bracketSameLine": true,
11
+ "vueIndentScriptAndStyle": false,
12
+ "embeddedLanguageFormatting": "auto",
13
+ "htmlWhitespaceSensitivity": "css"
14
+ }
package/README.md CHANGED
@@ -317,3 +317,14 @@
317
317
  1.3.0
318
318
  1.调整fullScreenDirective.js
319
319
  ```
320
+
321
+ ```
322
+ 1.3.7
323
+ 1.新增 tracker.js 用于埋点数据发送
324
+ 2.新增 ca.js 用于埋点统计
325
+ 3.修改 permission.js 页面路由beforeEach方法,增加埋点数据发送
326
+ ```
327
+ ```
328
+ 1.3.8
329
+ 1. Navbar 新增 ChangeLog 组件
330
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xs-common-plugins",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "private": false,
5
5
  "description": "向上公共代码部分",
6
6
  "author": "祝玲云 <1902733517@qq.com>",
@@ -0,0 +1,23 @@
1
+ import tracker from "./tracker";
2
+ import moment from "moment";
3
+ export default function trackerSend({userName, router = {}, clientId}) {
4
+ tracker.send({
5
+ title: "页面访问",
6
+ action: "后台页面路由跳转",
7
+ url: location.href,
8
+ qt: {
9
+ clientId,
10
+ userName,
11
+ date: moment(Date.now()).format("YYYY-MM-DD HH:mm:ss"),
12
+ fullPath: router.fullPath,
13
+ title: getRouterBreadcrumbs(router)
14
+ }
15
+ });
16
+ }
17
+
18
+ function getRouterBreadcrumbs(router) {
19
+ return router.matched
20
+ .map((item) => (item.meta && item.meta.title) || item.name)
21
+ .filter((item) => item && item !== "首页")
22
+ .join(" > ");
23
+ }
@@ -10,6 +10,7 @@ import "nprogress/nprogress.css"; // progress bar style
10
10
  import Oidc from "oidc-client";
11
11
  import { requestApi as HTTP } from "xs-request";
12
12
  import router from "./index";
13
+ import trackerSend from "./ca";
13
14
 
14
15
  NProgress.configure({
15
16
  showSpinner: false,
@@ -70,6 +71,12 @@ router.beforeEach((to, from, next) => {
70
71
  toLoginPage(to, next);
71
72
 
72
73
  } // 没登录 & 没在登录页 => 跳转到登录页
74
+
75
+ trackerSend({
76
+ clientId: id4config.client_id,
77
+ userName: getToken("LoginUserName"),
78
+ router: to
79
+ })
73
80
  });
74
81
 
75
82
  router.afterEach(() => {
@@ -0,0 +1,19 @@
1
+ import SlsTracker from '@aliyun-sls/web-track-browser'
2
+
3
+ const opts = {
4
+ host: 'cn-hangzhou.log.aliyuncs.com', // 所在地域的服务入口。例如cn-hangzhou.log.aliyuncs.com
5
+ project: 'xsmddata', // Project名称。
6
+ logstore: 'mddata', // Logstore名称。
7
+ time: 1, // 发送日志的时间间隔,默认是10秒。
8
+ count: 10, // 发送日志的数量大小,默认是10条。
9
+ topic: 'msg', // 自定义日志主题。
10
+ source: '后台管理系统',
11
+ tags: {
12
+ 'version': '1.0.0'
13
+ }
14
+ }
15
+
16
+ const tracker = new SlsTracker(opts)
17
+
18
+
19
+ export default tracker
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <div v-if="list.length > 0">
3
+ <el-dropdown :hide-on-click="false" @command="handleCommand">
4
+ <el-badge is-dot class="item">
5
+ <i class="el-icon-bell"></i>
6
+ </el-badge>
7
+ <el-dropdown-menu slot="dropdown">
8
+ <el-dropdown-item v-for="(item, index) in list" :key="index" :command="index">{{ item.title }}</el-dropdown-item>
9
+ </el-dropdown-menu>
10
+ </el-dropdown>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import {defineComponent, h} from "vue";
16
+ import { getConfig } from "@/utils/global-config";
17
+ export default {
18
+ name: 'changeLog',
19
+ data () {
20
+ return {
21
+ list: []
22
+ }
23
+ },
24
+ methods: {
25
+ handleCommand (command) {
26
+ this.$common.popup({
27
+ title: this.list[command].remark,
28
+ component: defineComponent({
29
+ template: `<div>
30
+ <div style="font-size: 14px;color: #606266;line-height: 20px;padding: 10px 20px">${this.list[command].remark}</div>
31
+ <div style="text-align: center"><el-button type="primary" @click="$emit('close')">关闭</el-button></div>
32
+ </div>`
33
+ })
34
+ });
35
+ },
36
+ getChangeLog () {
37
+ this.$ask.commng.api.commmng.Banner.Query.post({pageInfo: {
38
+ page: 1,
39
+ pageSize: 3
40
+ },
41
+ codeLike: `changelog#${getConfig('CLIENT_ID')}`
42
+ }).then((result) => {
43
+ if (result.code === 0 && result.data.data.length > 0) {
44
+ this.list = result.data.data;
45
+ }
46
+ }).catch((err) => {
47
+
48
+ }).finally(() => {
49
+ setTimeout(() => {
50
+ this.getChangeLog();
51
+ }, 1000 * 60 * 60 * 12);
52
+ })
53
+ }
54
+ },
55
+ mounted () {
56
+ this.getChangeLog();
57
+ }
58
+ }
59
+ </script>
@@ -45,6 +45,9 @@
45
45
  />
46
46
  </el-badge>
47
47
  </div>
48
+ <div class="changelog">
49
+ <ChangeLog />
50
+ </div>
48
51
  <div>
49
52
  <el-tag style="margin: 0 3px;">{{
50
53
  userProfile &&
@@ -116,6 +119,7 @@ import { mapGetters } from "vuex";
116
119
  import Breadcrumb from "@/components/Breadcrumb";
117
120
  import Hamburger from "@/components/Hamburger";
118
121
  import AllSearch from "./AllSearch";
122
+ import ChangeLog from "./ChangeLog";
119
123
  import { getConfig } from "@/utils/global-config";
120
124
  import { getToken, removeToken, removeLocalToken } from "@/utils/auth"; // get token from cookie
121
125
  import ImCom from "@/components/im";
@@ -129,6 +133,7 @@ export default {
129
133
  Hamburger,
130
134
  AllSearch,
131
135
  ImCom,
136
+ ChangeLog,
132
137
  },
133
138
  data() {
134
139
  return {
@@ -393,4 +398,15 @@ export default {
393
398
  }
394
399
  }
395
400
  }
401
+ .changelog {
402
+ display: flex;
403
+ flex-direction: row;
404
+ justify-content: center;
405
+ align-items: center;
406
+ line-height: 16px;
407
+ margin: 0 8px;
408
+ &:empty {
409
+ display: none;
410
+ }
411
+ }
396
412
  </style>