From aeb02928a8e9664221d2e4c92837e5384f08510c Mon Sep 17 00:00:00 2001
From: wally <18603454788@163.com>
Date: Mon, 2 Aug 2021 11:24:00 +0800
Subject: [PATCH 1/3] =?UTF-8?q?feat(plugin):=20=E6=8F=92=E4=BB=B6=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E4=BA=86token=E5=8F=8Aparam=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CHANGELOG.md | 3 +-
package.json | 34 ++++++++++---------
src/components/Plugin/Plugin.vue | 12 ++++---
src/components/TimeLine/component/TimeBox.vue | 5 +--
src/utils/time.js | 1 +
vue.config.js | 27 ++++++++++++---
6 files changed, 55 insertions(+), 27 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f5523e..8b661e5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-# 0.1.0 (2021-07-30)
+# 0.1.0 (2021-08-02)
### 🌟 新功能
范围|描述|commitId
@@ -56,6 +56,7 @@
ID1000343 | 解决向下预加载查询参数时间没+1颗粒度;以及滚动加载颗粒度写死的问题 | 940603a, closes #ID1000343
plugin | 插件解析机制完善 | 0f5a27d
project title | 项目标题修改; 切换角色移除script | 5c20017
+ roles | 修复默认显示不是我的角色的问题 | b69f94f
role | 切换角色的逻辑修正完善 | 4ae534f
task任务逻辑完善 | 减少初始global及regular的不必要请求 | bd4bd38
- | 上下滑动加载定期任务 | 4090d89
diff --git a/package.json b/package.json
index 6d80665..432ebdd 100644
--- a/package.json
+++ b/package.json
@@ -63,36 +63,38 @@
"@dcloudio/webpack-uni-pages-loader": "^2.0.0-31920210709003",
"@tailwindcss/postcss7-compat": "^2.2.7",
"@vue/cli-plugin-babel": "~4.5.0",
- "@vue/cli-service": "~4.5.0",
- "autoprefixer": "^9.8.6",
- "babel-plugin-import": "^1.11.0",
- "core-js": "^3.15.2",
- "cross-env": "^7.0.2",
- "jest": "^25.4.0",
- "mini-types": "*",
- "miniprogram-api-typings": "*",
- "sass-loader": "^8.0.2",
- "node-sass": "^4.14.1",
- "postcss": "^7.0.36",
- "postcss-comment": "^2.0.0",
- "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.7",
- "vue-template-compiler": "^2.6.11",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
+ "@vue/cli-service": "~4.5.0",
"@vue/eslint-config-prettier": "^6.0.0",
+ "autoprefixer": "^9.8.6",
"babel-eslint": "^10.1.0",
+ "babel-plugin-import": "^1.11.0",
"commitizen": "^4.0.3",
"commitlint": "^8.2.0",
+ "compression-webpack-plugin": "^5.0.1",
"conventional-changelog-cli": "^2.0.28",
+ "core-js": "^3.15.2",
+ "cross-env": "^7.0.2",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^6.2.2",
"husky": "^3.0.9",
+ "jest": "^25.4.0",
"lint-staged": "^11.0.0",
- "right-pad": "^1.0.1",
+ "mini-types": "*",
+ "miniprogram-api-typings": "*",
+ "node-sass": "^4.14.1",
+ "postcss": "^7.0.36",
"postcss-class-rename": "^1.0.1",
+ "postcss-comment": "^2.0.0",
"prettier": "^2.2.1",
- "vue-cli-plugin-commitlint": "~1.0.12"
+ "right-pad": "^1.0.1",
+ "sass-loader": "^8.0.2",
+ "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.7",
+ "vue-cli-plugin-commitlint": "~1.0.12",
+ "vue-cli-plugin-eruda": "^1.3.0",
+ "vue-template-compiler": "^2.6.11"
},
"browserslist": [
"Android >= 4",
diff --git a/src/components/Plugin/Plugin.vue b/src/components/Plugin/Plugin.vue
index 328cb98..2ab39ca 100644
--- a/src/components/Plugin/Plugin.vue
+++ b/src/components/Plugin/Plugin.vue
@@ -4,6 +4,7 @@
@@ -41,6 +43,7 @@ export default {
pluginId: { default: '1', type: String },
styleType: { default: 0, type: Number },
pluginTaskId: { default: '', type: String },
+ param: { type: String, default: '' },
},
data() {
@@ -48,9 +51,10 @@ export default {
},
computed: {
+ ...mapState('role', ['roleId']),
+ ...mapState('user', ['token']),
...mapGetters('user', ['userId']),
...mapGetters('project', ['projectId']),
- ...mapState('role', ['roleId']),
},
created() {
@@ -77,13 +81,13 @@ export default {
uuid = RegExp.$1;
// console.log('uuid: ', uuid, `p${this.pluginTaskId}`);
- const str = data.html.replaceAll(uuid, `p${this.pluginTaskId}`);
+ const str = data.html.replace(new RegExp(uuid, 'g'), `p${this.pluginTaskId}`);
this.pluginContent = str;
} else {
this.pluginContent = data.html;
}
- const str = data.js.replaceAll(uuid, `p${this.pluginTaskId}`);
+ const str = data.js.replace(new RegExp(uuid, 'g'), `p${this.pluginTaskId}`);
this.handleDom(str);
}
// console.log(this.pluginContent);
@@ -91,7 +95,7 @@ export default {
// if (data.js) {
// if (reg.test(data.js)) {
// const uuid = RegExp.$1;
- // const str = data.js.replaceAll(uuid, `p${this.pluginTaskId}`);
+ // const str = data.js.replace(new RegExp(uuid, 'g'), `p${this.pluginTaskId}`);
// this.handleDom(str);
// } else {
// this.handleDom(data.js);
diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue
index 47b27eb..97d266a 100644
--- a/src/components/TimeLine/component/TimeBox.vue
+++ b/src/components/TimeLine/component/TimeBox.vue
@@ -39,8 +39,9 @@
:task="task"
:key="plugin.pluginTaskId"
:plugin-task-id="plugin.pluginTaskId"
- :pluginId="plugin.pluginId"
- :styleType="styleType || 0"
+ :plugin-id="plugin.pluginId"
+ :param="plugin.param"
+ :style-type="styleType || 0"
v-for="plugin in row"
/>
diff --git a/src/utils/time.js b/src/utils/time.js
index eb7e9c4..00b8567 100644
--- a/src/utils/time.js
+++ b/src/utils/time.js
@@ -1,4 +1,5 @@
import dayjs from 'dayjs';
+
const advancedFormat = require('dayjs/plugin/advancedFormat');
const weekOfYear = require('dayjs/plugin/weekOfYear');
diff --git a/vue.config.js b/vue.config.js
index eeab753..982e9f1 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -1,20 +1,39 @@
const path = require('path');
-const CopyWebpackPlugin = require('copy-webpack-plugin'); // 最新版本copy-webpack-plugin插件暂不兼容,推荐v5.0.0
+// const CopyWebpackPlugin = require('copy-webpack-plugin'); // 最新版本copy-webpack-plugin插件暂不兼容,推荐v5.0.0
+const CompressionWebpackPlugin = require('compression-webpack-plugin');
+const productionGzipExtensions = /\.(js|css|json|txt|html|ico|svg|ttf|woff|woff2)(\?.*)?$/i;
const publicPath = process.env.VUE_APP_PUBLIC_PATH;
+const isPro = process.env.NODE_ENV === 'production';
module.exports = {
lintOnSave: process.env.NODE_ENV !== 'production',
productionSourceMap: false,
- publicPath: process.env.NODE_ENV === 'production' ? publicPath : '/',
+ publicPath: isPro ? publicPath : '/',
devServer: {
// open: true,
// host: '127.0.0.1',
overlay: { warnings: false, errors: true },
// proxy: {}
},
- configureWebpack: { plugins: [] },
- // , disable: true
+ configureWebpack: {
+ plugins: isPro
+ ? [
+ new CompressionWebpackPlugin({
+ filename: '[path].gz[query]',
+ algorithm: 'gzip',
+ test: productionGzipExtensions,
+ threshold: 10240,
+ minRatio: 0.8,
+ deleteOriginalAssets: false,
+ }),
+ ]
+ : [],
+ },
pluginOptions: {
// mock: { entry: './src/mock/mock.js', debug: true, disable: true },
+ eruda: {},
+ webpackBundleAnalyzer: {
+ openAnalyzer: isPro,
+ },
},
};
From 469365582aea34fc03bcfce030b084c78c7887c9 Mon Sep 17 00:00:00 2001
From: wally <18603454788@163.com>
Date: Mon, 2 Aug 2021 17:04:22 +0800
Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20=E4=BB=BB=E5=8A=A1=E7=8A=B6?=
=?UTF-8?q?=E6=80=81=E9=87=8D=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.eslintrc.js | 7 +++
CHANGELOG.md | 1 +
src/components/Plugin/Plugin.vue | 2 +-
src/components/TimeLine/component/TimeBox.vue | 4 +-
.../TimeLine/component/TimeStatus.vue | 52 ++++++++++++++++---
5 files changed, 56 insertions(+), 10 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 2824b10..067c1dd 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -19,6 +19,13 @@ module.exports = {
'vue/max-attributes-per-line': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/html-indent': 'off',
+ 'vue/html-closing-bracket-newline': [
+ 'error',
+ {
+ singleline: 'never',
+ multiline: 'always',
+ },
+ ],
},
parserOptions: { parser: 'babel-eslint' },
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8b661e5..7227544 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
- | db store | 6414c4f
- | indexedDB | 687394e
pinch | alloy finger实现图片的pinch放大缩小 | de01343
+ plugin | 插件添加了token及param参数 | aeb0292
- | post 封装 | da52e94
- | tall插件封装 | 1bcb920
- | ws storage | 21b3a06
diff --git a/src/components/Plugin/Plugin.vue b/src/components/Plugin/Plugin.vue
index 2ab39ca..a1fa2d1 100644
--- a/src/components/Plugin/Plugin.vue
+++ b/src/components/Plugin/Plugin.vue
@@ -73,7 +73,7 @@ export default {
const reg = /data-root=["|']?(\w+)["|']?/gi;
// console.log(data.html);
let uuid = '';
- // FIXME: 没有兼容只有js 没有html的情况
+ // FIXME: 没有兼容 只有js, 没有html的情况
if (data.html) {
// 查有没有data-root=“xxx” 有的话 将xxx替换为 pluginTaskId
diff --git a/src/components/TimeLine/component/TimeBox.vue b/src/components/TimeLine/component/TimeBox.vue
index 97d266a..a08f17e 100644
--- a/src/components/TimeLine/component/TimeBox.vue
+++ b/src/components/TimeLine/component/TimeBox.vue
@@ -5,9 +5,7 @@
-
- {{ $moment(+task.planStart).format(startTimeFormat) }}
-
+ {{ $moment(+task.planStart).format(startTimeFormat) }}
diff --git a/src/components/TimeLine/component/TimeStatus.vue b/src/components/TimeLine/component/TimeStatus.vue
index 70c0ed8..24ac35c 100644
--- a/src/components/TimeLine/component/TimeStatus.vue
+++ b/src/components/TimeLine/component/TimeStatus.vue
@@ -1,11 +1,13 @@
+
-
+
@@ -15,20 +17,23 @@
+
-
+
{{ time }}
+
+
-
+
@@ -37,12 +42,14 @@
+
+
-
+
@@ -53,18 +60,26 @@
+