Browse Source

完善功能

old
wangqing 5 years ago
parent
commit
abe5d6fa8c
  1. BIN
      src/assets/images/mobile_theme_active.png
  2. 19
      src/views/form/PreView.vue
  3. 21
      src/views/form/ProjectForm.vue
  4. 55
      src/views/form/theme.vue

BIN
src/assets/images/mobile_theme_active.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

19
src/views/form/PreView.vue

@ -19,7 +19,7 @@
<span slot="label"><i class="el-icon-monitor"></i> <span slot="label"><i class="el-icon-monitor"></i>
电脑 电脑
</span> </span>
<project-form :projectConfig="projectConfig" /> <project-form :projectConfig="projectConfig"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
@ -32,19 +32,20 @@ import ProjectForm from './ProjectForm'
export default { export default {
name: 'PreView', name: 'PreView',
props: { props: {
projectConfig: { projectKey: ''
projectKey: '',
headImgUrl: '',
color: ''
}
}, },
data() { data() {
return {} return {
projectConfig: {
projectKey: '',
showBtns: false
}
}
}, },
mounted() { mounted() {
this.projectConfig = { this.projectConfig = {
headImgUrl: 'http://cdn1.wenjuan.com/appear-PC-防疫13.png', projectKey: 'afd5c3562c924d20b7da67b1f192ce25',
projectKey: 'afd5c3562c924d20b7da67b1f192ce25' showBtns: false
} }
}, },
components: { components: {

21
src/views/form/ProjectForm.vue

@ -2,7 +2,8 @@
<div class="project-form"> <div class="project-form">
<div class=""> <div class="">
<el-image <el-image
:src="projectConfig.headImgUrl" v-if="projectTheme.headImgUrl"
:src="projectTheme.headImgUrl"
fit="scale-down"></el-image> fit="scale-down"></el-image>
<el-row type="flex" justify="center" align="middle"> <el-row type="flex" justify="center" align="middle">
<el-col :sm="{span:20}" :xs="{span:24,offset:0}" style="text-align: center"> <el-col :sm="{span:20}" :xs="{span:24,offset:0}" style="text-align: center">
@ -44,8 +45,6 @@ export default {
}, },
props: { props: {
projectConfig: { projectConfig: {
headImgUrl: '',
color: '',
projectKey: '', projectKey: '',
showBtn: false showBtn: false
} }
@ -54,6 +53,9 @@ export default {
return { return {
key2: +new Date(), key2: +new Date(),
projectKey: '', projectKey: '',
projectTheme: {
headImgUrl:''
},
formConf: { formConf: {
fields: [], fields: [],
__methods__: {}, __methods__: {},
@ -76,20 +78,12 @@ export default {
watch: {}, watch: {},
created() { created() {
// //
if (!this.projectConfig) {
this.projectConfig = {
headImgUrl: '',
color: '',
projectKey: '',
showBtn: false
}
}
if (this.projectConfig && this.projectConfig.projectKey) { if (this.projectConfig && this.projectConfig.projectKey) {
this.projectKey = this.projectConfig.projectKey this.projectKey = this.projectConfig.projectKey
} else if (this.$route.query.key) { } else if (this.$route.query.key) {
this.projectKey = this.$route.query.key this.projectKey = this.$route.query.key
} }
this.formConf.formBtns = this.projectConfig.showBtn this.formConf.formBtns = this.projectConfig.showBtns
this.formConf.size = window.innerWidth < 480 ? 'medium' : 'small' this.formConf.size = window.innerWidth < 480 ? 'medium' : 'small'
}, },
mounted() { mounted() {
@ -100,6 +94,9 @@ export default {
}) })
this.formConf.fields = fields this.formConf.fields = fields
this.formConf.title = res.data.project.name this.formConf.title = res.data.project.name
if(res.data.userProjectTheme){
this.projectTheme = res.data.userProjectTheme
}
this.formConf.description = res.data.project.describe this.formConf.description = res.data.project.describe
} }
}) })

55
src/views/form/theme.vue

@ -32,20 +32,26 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="8" v-for="t in themeList"> <el-col
<el-image class="theme-img-view"
class="head-list-img" :span="8" v-for="t in themeList"
style="width: 100px; height: 100px" @click.native="activeThemeHandler(t)">
:src="t.headImgUrl" <p :class="{'head-list-view-select':activeTheme.id==t.id}">
fit="cover" <el-image
></el-image> :class="{'head-list-img-active':activeTheme.id==t.id}"
class="head-list-img"
style="width: 100px; height: 100px"
:src="t.headImgUrl"
fit="cover"
></el-image>
</p>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</el-scrollbar> </el-scrollbar>
</el-col> </el-col>
<el-col :offset="0" :span="12"> <el-col :offset="0" :span="12">
<pre-view :projectKey="projectKey"/> <pre-view :project-key="projectKey"/>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<div class="right-container"></div> <div class="right-container"></div>
@ -64,6 +70,7 @@ export default {
}, },
data() { data() {
return { return {
projectKey: '',
styleList: [ styleList: [
{'label': '全部', 'key': ''}, {'label': '全部', 'key': ''},
{'label': '节日', 'key': 'festival'}, {'label': '节日', 'key': 'festival'},
@ -88,12 +95,12 @@ export default {
], ],
activeColor: '', activeColor: '',
activeStyle: '', activeStyle: '',
projectKey: '', activeTheme: '',
themeList: [] themeList: []
} }
}, },
mounted() { mounted() {
this.projectKey = this.$route.query.key this.projectConfig.projectKey = this.$route.query.key
this.queryProjectTheme() this.queryProjectTheme()
}, },
methods: { methods: {
@ -101,6 +108,19 @@ export default {
this.activeStyle = item.key this.activeStyle = item.key
this.queryProjectTheme() this.queryProjectTheme()
}, },
activeThemeHandler(item) {
if (item) {
this.$confirm('切换主题,系统将不会保存您在上一主题所做的修改,请知悉。', '切换主题提醒', {
confirmButtonText: '确定',
cancelButtonText: '取消操作',
type: 'info'
}).then(() => {
this.activeTheme = item
}).catch(() => {
})
}
},
activeColorHandler(item) { activeColorHandler(item) {
this.activeColor = item this.activeColor = item
this.queryProjectTheme() this.queryProjectTheme()
@ -199,6 +219,21 @@ export default {
border: 2px solid rgba(11, 141, 213, 100); border: 2px solid rgba(11, 141, 213, 100);
} }
.head-list-img-active {
border: 2px solid rgba(11, 141, 213, 100);
}
.theme-img-view .head-list-view-select ::after {
content: "";
background: url('~@/assets/images/mobile_theme_active.png');
background-size: 18px;
width: 18px;
height: 18px;
position: absolute;
top: 4px;
right: 4px;
}
.right-container { .right-container {
width: 456px; width: 456px;
height: 600px; height: 600px;

Loading…
Cancel
Save