Browse Source

refactor: APP注释了Render Component; render.vue换成vue2语法

test2
wally 4 years ago
parent
commit
3a89de19fd
  1. 3
      CHANGELOG.md
  2. 2
      components/Plugin/Plugin.vue
  3. 58
      components/Render/Render.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 1.0.0 (2022-01-29) # 1.0.0 (2022-01-30)
### 🌟 新功能 ### 🌟 新功能
范围|描述|commitId 范围|描述|commitId
@ -185,6 +185,7 @@
- | 原有功能提交别的分支 | [eb02b72](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/eb02b72) - | 原有功能提交别的分支 | [eb02b72](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/eb02b72)
- | 重构财务条组件;添加财务mock | [03a1cdb](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/03a1cdb) - | 重构财务条组件;添加财务mock | [03a1cdb](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/03a1cdb)
- | 重构project init 部分 | [c7bf2df](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/c7bf2df) - | 重构project init 部分 | [c7bf2df](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/c7bf2df)
- | 重构render.vue | [fdd668f](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/fdd668f)
api | 调整mock api放入mock.js下;main中加入环境变量的判断 | [053ac31](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/053ac31) api | 调整mock api放入mock.js下;main中加入环境变量的判断 | [053ac31](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/053ac31)
- | deliver检查人重构;更新真实数据的检查人 | [ce808c4](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ce808c4) - | deliver检查人重构;更新真实数据的检查人 | [ce808c4](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ce808c4)
- | project init 重构 | [2457a87](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/2457a87) - | project init 重构 | [2457a87](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/2457a87)

2
components/Plugin/Plugin.vue

@ -28,6 +28,7 @@
<p-domain-source-manage v-else-if="pluginId === '20'" class="p-2" /> <p-domain-source-manage v-else-if="pluginId === '20'" class="p-2" />
<p-project-version-management v-else-if="pluginId === '21'" class="p-2" /> <p-project-version-management v-else-if="pluginId === '21'" class="p-2" />
<!-- #ifdef H5 -->
<Render <Render
v-else v-else
:task="task" :task="task"
@ -37,7 +38,6 @@
:businessPluginId="businessPluginId" :businessPluginId="businessPluginId"
:param="param" :param="param"
/> />
<!-- #ifdef H5 -->
<!-- #endif --> <!-- #endif -->
</view> </view>
</template> </template>

58
components/Render/Render.vue

@ -20,56 +20,64 @@
</view> </view>
</template> </template>
<script setup> <script>
import { computed, ref, onMounted } from 'vue'; import { mapState, mapGetters } from 'vuex';
import { useStore } from 'vuex';
const props = defineProps({ export default {
name: 'RenderHtmlFragment',
props: {
task: { default: () => {}, type: Object }, task: { default: () => {}, type: Object },
pluginId: { default: '1', type: String }, pluginId: { default: '1', type: String },
styleType: { default: 0, type: Number }, styleType: { default: 0, type: Number },
pluginTaskId: { default: '', type: String }, pluginTaskId: { default: '', type: String },
businessPluginId: { default: '', type: String }, businessPluginId: { default: '', type: String },
param: { type: String, default: '' }, param: { type: String, default: '' },
}); },
data() {
const store = useStore(); return {
const roleId = computed(() => store.state.role.roleId); pluginInfo: null,
const token = computed(() => store.state.user.token); };
const userId = computed(() => store.getters['user/userId']); },
const projectId = computed(() => store.getters['project/projectId']); computed: {
const pluginInfo = ref(null); // ...mapState(['allPlugin']),
...mapState('role', ['roleId']),
...mapState('user', ['token']),
...mapGetters('project', ['projectId']),
...mapGetters('user', ['userId']),
},
onMounted(() => { mounted() {
getPlugin(); this.getPlugin();
}); },
// methods: {
async function getPlugin() { getPlugin() {
const allPlugin = uni.$storage.getStorageSync('allPlugin'); const allPlugin = this.allPlugin || uni.$storage.getStorageSync('allPlugin');
if (allPlugin && JSON.parse(allPlugin)) { if (allPlugin && JSON.parse(allPlugin)) {
// //
try { try {
const pluginLists = JSON.parse(allPlugin); const pluginLists = JSON.parse(allPlugin);
// pluginLists find,catch // pluginLists find,catch
const pluginTarget = pluginLists.find(item => item.id === props.pluginId); const pluginTarget = pluginLists.find(item => item.id === this.pluginId);
pluginInfo.value = pluginTarget || null; this.pluginInfo = pluginTarget || null;
} catch (error) { } catch (error) {
console.error('error: ', error); console.error('error: ', error);
pluginInfo.value = null; this.pluginInfo = null;
} }
} else { } else {
// API // API
const params = { businessPluginId: props.businessPluginId }; const params = { businessPluginId: this.businessPluginId };
uni.$catchReq.getOtherPlugin(params, (err, res) => { uni.$catchReq.getOtherPlugin(params, (err, res) => {
if (err) { if (err) {
console.error('err: ', err); console.error('err: ', err);
pluginInfo.value = null; this.pluginInfo = null;
} else { } else {
pluginInfo.value = res || null; this.pluginInfo = res || null;
} }
}); });
} }
} },
},
};
</script> </script>
<script module="project" lang="renderjs"> <script module="project" lang="renderjs">

Loading…
Cancel
Save