diff --git a/CHANGELOG.md b/CHANGELOG.md
index 73cb7a8..a322b4f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-# 1.0.0 (2022-02-17)
+# 1.0.0 (2022-02-18)
### 🌟 新功能
范围|描述|commitId
@@ -40,6 +40,7 @@
- | 审核插件的通过与驳回功能 | [03a7c35](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/03a7c35)
- | 时间轴调整 | [81d2500](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/81d2500)
- | 时间轴接口 | [a95d005](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/a95d005)
+ - | 时间轴新策略 | [e736d05](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e736d05)
- | 时间轴新策略 | [e25218b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e25218b)
- | 时间轴页面 | [e926b75](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/e926b75)
- | 时间轴优化 | [77a137e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/77a137e)
diff --git a/components/Plugin/Plugin.vue b/components/Plugin/Plugin.vue
index 25c6e8a..a2734eb 100644
--- a/components/Plugin/Plugin.vue
+++ b/components/Plugin/Plugin.vue
@@ -28,7 +28,7 @@
-
+ />
diff --git a/components/Render/Render.vue b/components/Render/Render.vue
index f9450ce..61fd2ec 100644
--- a/components/Render/Render.vue
+++ b/components/Render/Render.vue
@@ -17,8 +17,7 @@
:data-uid="userId"
:pluginInfo="pluginInfo"
:change:pluginInfo="project.renderDom"
- :pluginTaskId="pluginTaskId"
- :change:pluginTaskId="project.initPluginTaskId"
+
>
@@ -39,18 +38,25 @@ export default {
data() {
return {
pluginInfo: null,
+ configInfo: null
};
},
computed: {
- ...mapState(['allPlugin']),
+ ...mapState(['allPlugin', 'businessPlugin']),
...mapState('role', ['roleId']),
...mapState('user', ['token']),
...mapGetters('project', ['projectId']),
...mapGetters('user', ['userId']),
},
- mounted() {
- this.getPlugin();
+ async mounted() {
+ await this.getPlugin();
+ if (this.param && this.pluginInfo) {
+ let configParam = JSON.parse(this.param);
+ this.pluginInfo.config = `var p${this.pluginId}_config = ${this.param}`;
+ } else {
+ await this.getConfig();
+ }
},
methods: {
getPlugin() {
@@ -59,8 +65,9 @@ export default {
// 有本地数据
try {
const pluginLists = JSON.parse(allPlugin);
- // pluginLists 肯能没有find方法,交给catch处理
+ // pluginLists 可能没有find方法,交给catch处理
const pluginTarget = pluginLists.find(item => item.id === this.pluginId);
+ pluginTarget.pluginTaskId = this.pluginTaskId;
this.pluginInfo = pluginTarget || null;
} catch (error) {
console.error('error: ', error);
@@ -74,11 +81,39 @@ export default {
console.error('err: ', err);
this.pluginInfo = null;
} else {
+ res.pluginTaskId = this.pluginTaskId;
this.pluginInfo = res || null;
}
});
}
},
+
+ getConfig() {
+ const businessPlugin = this.businessPlugin || uni.$storage.getStorageSync('businessPlugin');
+ if (businessPlugin && JSON.parse(businessPlugin)) {
+ // 有本地数据
+ const businessPluginLists = JSON.parse(businessPlugin);
+ businessPluginLists.forEach(item => {
+ if (item.pluginConfigs) {
+ const pluginConfig = item.pluginConfigs.find(plugin => plugin.businessPluginId === this.businessPluginId);
+ if (pluginConfig && pluginConfig.config && this.pluginInfo) {
+ this.pluginInfo.config = pluginConfig.config;
+ }
+ }
+ })
+ } else {
+ // 没有本地数据 API 查询
+ // const params = { businessPluginId: this.businessPluginId };
+ // uni.$catchReq.getOtherPlugin(params, (err, res) => {
+ // if (err) {
+ // console.error('err: ', err);
+ // this.pluginInfo = null;
+ // } else {
+ // this.pluginInfo = res || null;
+ // }
+ // });
+ }
+ }
},
};
@@ -99,10 +134,16 @@ export default {
if (res.html) {
// 注意: 截止目前版本2022年1月30日 直接this.pluginTaskId在APP端是不能行的
// 已向官方提交bug 后期等待修复后 再做调整
- const content = window.document.getElementById(`render-${pluginTaskId}`);
+ const content = window.document.getElementById(`render-${res.pluginTaskId}`);
content.innerHTML = res.html;
}
+ if (res.config) {
+ const script = window.document.createElement('script');
+ script.innerHTML = res.config;
+ window.document.body.appendChild(script);
+ }
+
if (res.js) {
const script = window.document.createElement('script');
script.innerHTML = res.js;
@@ -116,9 +157,9 @@ export default {
* 因为目前这里没办法通过this拿到prop data下的数据
* @param {string} propsPluginTaskId
*/
- initPluginTaskId(propsPluginTaskId) {
- pluginTaskId = propsPluginTaskId;
- }
+ // initPluginTaskId(propsPluginTaskId) {
+ // pluginTaskId = propsPluginTaskId;
+ // }
},
};