feat: 晚上公共链接

This commit is contained in:
fit2cloud-chenyw 2021-04-20 11:21:53 +08:00
parent 5327d5170b
commit 46ff744b65
5 changed files with 52 additions and 7 deletions

View File

@ -48,3 +48,10 @@ export function loadGenerate(resourceId) {
method: 'post'
})
}
export function loadResource(resourceId) {
return request({
url: 'panel/group/findOne/' + resourceId,
method: 'get'
})
}

View File

@ -1,5 +1,5 @@
<template>
<div id="link"><router-view />
<div id="link" style="height:100%;"><router-view />
</div>
</template>
<script>

View File

@ -5,6 +5,9 @@ import store from '../store'
import '@/styles/index.scss' // global css
import i18n from '../lang' // internationalization
import ElementUI from 'element-ui'
import '@/components/canvas/custom-component' // 注册自定义组件
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts
Vue.config.productionTip = false
Vue.use(ElementUI, {

View File

@ -1,5 +1,5 @@
<template>
<div>
<div style="height: 100%;">
<link-error v-if="showIndex===0" :resource-id="resourceId" />
<link-pwd v-if="showIndex===1" :resource-id="resourceId" />
<link-view v-if="showIndex===2" :resource-id="resourceId" />

View File

@ -1,19 +1,54 @@
<template>
<div>
我是视图页面
<div style="width: 100%;height: 100%;background-color: #f7f8fa">
<Preview v-if="show" />
</div>
</template>
<script>
import { loadResource } from '@/api/link'
import { uuid } from 'vue-uuid'
import Preview from '@/components/canvas/components/Editor/Preview'
export default {
name: 'LinkView',
data() {
return {
components: { Preview },
props: {
resourceId: {
type: String,
default: null
}
},
data() {
return {
show: false
}
},
created() {
this.show = false
this.setPanelInfo()
},
methods: {
setPanelInfo() {
loadResource(this.resourceId).then(res => {
this.$store.commit('setComponentData', this.resetID(JSON.parse(res.data.panelData)))
// this.$store.commit('setComponentData', JSON.parse(res.data.panelData))
this.$store.commit('setCanvasStyle', JSON.parse(res.data.panelStyle))
this.show = true
})
},
resetID(data) {
data.forEach(item => {
item.id = uuid.v1()
})
return data
}
}
}
</script>
<style scoped>
*{
margin: 0;
padding: 0;
}
</style>