提交 0a3980d5 authored 作者: pengxiaohui's avatar pengxiaohui

fix: 修复进入首页未弹出角色确认框的问题;修复用户研究页报错的问题

上级 d0876984
<template> <template>
<div class="btn" :style="{ left: attrs.left, top: attrs.top }"> <div class="btn" :style="{ left: attrs.left, top: attrs.top }">
<button>{{attrs.title || ''}}</button> <button :class="{ disabled: disabled }">{{attrs.title || ''}}</button>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
disabled: {
type: Boolean,
default: false
},
attrs: { attrs: {
type: Object, type: Object,
default() { default() {
...@@ -20,6 +24,22 @@ export default { ...@@ -20,6 +24,22 @@ export default {
position:absolute; position:absolute;
left:0; left:0;
top:0; top:0;
background:#fff;
border-radius: 16px;
}
.btn::before, .btn::after{
content: '';
display:block;
width:3px;
height:15px;
background:#333;
position:absolute;
left:35%;
top:-15px;
border-radius:1px;
}
.btn::after{
left:65%;
} }
button{ button{
display: inline-block; display: inline-block;
...@@ -48,4 +68,9 @@ button{ ...@@ -48,4 +68,9 @@ button{
button:hover{ button:hover{
background:rgba(96,167,151, .8); background:rgba(96,167,151, .8);
} }
button.disabled{
background:#b4dcd2;
border-color:#c3c3c3;
cursor: not-allowed;
}
</style> </style>
...@@ -55,7 +55,11 @@ export default { ...@@ -55,7 +55,11 @@ export default {
}, },
methods: { methods: {
handleSelect() { handleSelect() {
if (this.roleSelected) {
this.$emit('roleSelect', this.roleSelected) this.$emit('roleSelect', this.roleSelected)
} else {
this.$message.error('请选择角色')
}
} }
} }
} }
......
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
<div class="logo">金融</div> <div class="logo">金融</div>
<app-menu /> <app-menu />
</div> </div>
<el-button type="primary" disabled>1111</el-button>
<!-- <btn :attrs="{ title: '用户分析', left: '360px', top: '134px' }" @click.native="handleClick('/user-study')" disabled/> -->
<btn v-for="(item, index) in btnList" :key="index" :attrs="{ title: item.label, left: item.left, top: item.top }" @click.native="handleClick(item)" :disabled="item.disabled.includes(role)"/>
</div> </div>
<!-- <btn :attrs="{ title: '用户研究', left: '240px', top: '120px' }" @click.native="handleClick('/user-study')" /> -->
<role-select :visible="visible" @roleSelect="fetchSelectRole" /> <role-select :visible="visible" @roleSelect="fetchSelectRole" />
</div> </div>
</template> </template>
...@@ -17,18 +19,18 @@ ...@@ -17,18 +19,18 @@
<script> <script>
import AppMenu from '@/components/base/AppMenu.vue' import AppMenu from '@/components/base/AppMenu.vue'
import RoleSelect from '../components/RoleSelect.vue' import RoleSelect from '../components/RoleSelect.vue'
import Btn from '../components/Btn.vue'
import { selectRole } from '../api' import { selectRole } from '../api'
export default { export default {
components: { AppMenu, RoleSelect }, components: { AppMenu, RoleSelect, Btn },
data() { data() {
return { return {
visible: false, visible: false,
menuList: [ btnList: [
{ label: '首页', path: '/home' }, { label: '产品分析', path: '/product-analysis', disabled: [0, 2, 3], left: '960px', top: '134px' },
{ label: '产品分析', path: '/product-analysis' }, { label: '用户分析', path: '/user-study', disabled: [0, 1, 3], left: '340px', top: '134px' },
{ label: '用户研究', path: '/user-study' }, { label: '营销工具使用', path: '/market-tools', disabled: [0, 1, 2], left: '650px', top: '344px' },
{ label: '营销工具使用', path: '/market-tools' }, { label: '作品展示', path: '/works-show', disabled: [], left: '320px', top: '344px' }
{ label: '作品展示', path: '/works-show' }
], ],
menuMap: {} menuMap: {}
} }
...@@ -39,11 +41,21 @@ export default { ...@@ -39,11 +41,21 @@ export default {
}, },
case() { case() {
return this.$store.state.case return this.$store.state.case
},
role() {
return this.$store.state.role
}
},
created() {
if (!this.role) {
this.visible = true
} }
}, },
methods: { methods: {
handleClick(path) { handleClick(item) {
this.$router.push(path) if (!item.disabled.includes(this.role)) {
this.$router.push(item.path)
}
}, },
menuSelect(item) { menuSelect(item) {
this.$router.push(item.path) this.$router.push(item.path)
......
...@@ -98,35 +98,36 @@ export default { ...@@ -98,35 +98,36 @@ export default {
} }
}, },
created() { created() {
console.log(this.$store.state.case)
this.init() this.init()
this.status = this.$route.query.type || '0' this.status = this.$route.query.type || '0'
}, },
methods: { methods: {
init() { init() {
if (!(this.$store.state.case && this.$store.state.case.id)) {
this.$alert('请先选择完成产品分析案例选择,再进行用户分析', {
confirmButtonText: '重新开始',
showClose: false,
callback: action => {
this.$route.push('/home')
}
})
} else {
Promise.all([this.fetchQuestions(), this.fetchGetReport()]).then(res => { Promise.all([this.fetchQuestions(), this.fetchGetReport()]).then(res => {
// 组装数据 // 组装数据
const questions = res[0] const questions = res[0]
const selection = res[1].answer.options console.log(res[0], res[1])
let selection = []
if (res[1].answer && Array.isArray(res[1].answer.options)) {
selection = res[1].answer.options
this.score = res[1].answer.score
}
if (selection.length > 0 && this.status !== '3') { if (selection.length > 0 && this.status !== '3') {
this.status = '1' this.status = '1'
} }
this.initQuestions(questions, selection) this.initQuestions(questions, selection)
this.score = res[1].answer.score
this.handleChoiceSelect() this.handleChoiceSelect()
}).catch(err => { }).catch(err => {
console.log(err) if (!(this.$store.state.case && this.$store.state.case.id)) {
this.$alert('请先选择完成产品分析案例选择,再进行用户分析', {
confirmButtonText: '回到首页',
showClose: false,
callback: action => {
this.$route.push('/home')
}
}) })
} }
})
}, },
handlePrev() { handlePrev() {
this.current.index-- this.current.index--
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<div class="btn-bar" v-if="marketing_status"> <div class="btn-bar" v-if="marketing_status">
<el-button type="primary" size="medium" plain round :disabled="[0, 1, 2].includes(role)" @click="handleGo(4)">编辑</el-button> <el-button type="primary" size="medium" plain round :disabled="[0, 1, 2].includes(role)" @click="handleGo(4)">编辑</el-button>
</div> </div>
<p class="tips" v-else>您还未完成产品分析报告<br>请先去完成吧!</p> <p class="tips" v-else>您还未完成营销工具使用<br>请先去完成吧!</p>
</div> </div>
</div> </div>
</div> </div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论