| | |
| | | <template> |
| | | <el-container> |
| | | <el-header height="60" class="student-header header" :style="{'background-color': productType==='API_Fan'?'#fff':'#409eff'}"> |
| | | <el-header height="60" class="student-header header" :style="{'background-color': logo!='none'?'#fff':'#409eff'}"> |
| | | <div class="head-language" v-if="langFlag"> |
| | | <!--<lang-select class="right-menu-item" />--> |
| | | <!--国际化的语言选择--> |
| | | <!--<component :is="langSelect"></component>--> |
| | | </div> |
| | | <div class="head-user" style="float:left;"> |
| | | <span></span> |
| | | <el-dropdown trigger="click" placement="bottom"> |
| | | <el-image v-if="productType==='API_Fan'" :style="{'height': isMobile?'50px':'60px','margin-top':'5px'}" :src="require('@/assets/logo-apifan.png')" fit="fill"></el-image> |
| | | <el-badge v-else style="height: 50px;"> |
| | | <el-image v-if="productType=='API_Fan'" :style="{'max-height': isMobile?'50px':'50px','margin-top':'5px','height':logoHeight+'px'}" :src="require('@/assets/logo-apifan.png')" fit="fill"></el-image> |
| | | <el-image @load="imageLoad" @error="imageError" v-else-if="logo!='none'" :style="{'max-height': isMobile?'50px':'50px','margin-top':'5px','height':logoHeight+'px'}" :src="logo" fit="fill"></el-image> |
| | | <el-badge v-else-if="logo=='none'" style="height: 50px;"> |
| | | <el-avatar class="el-dropdown-avatar" size="medium" :src="userInfo.imagePath === null ? require('@/assets/logo-t.jpg') : userInfo.imagePath"></el-avatar> |
| | | </el-badge> |
| | | <el-dropdown-menu slot="dropdown"> |
| | |
| | | |
| | | <script> |
| | | import LangSelect from '@/components/LangSelect' |
| | | import { mapState } from 'vuex' |
| | | import { mapMutations, mapState } from 'vuex' |
| | | export default { |
| | | name: 'Layout', |
| | | data () { |
| | | return { |
| | | defaultUrl: '/index', |
| | | logoHeight: 50, |
| | | logoUrl: null, |
| | | userInfo: { |
| | | imagePath: null |
| | | }, |
| | |
| | | }, |
| | | created () { |
| | | }, |
| | | computed: { |
| | | |
| | | }, |
| | | methods: { |
| | | logout: function () { |
| | | window.opener = null |
| | | window.open('about:blank', '_top').close() |
| | | }, |
| | | getLogoHeight: function () { |
| | | |
| | | }, |
| | | imageLoad: function (e) { |
| | | sessionStorage.setItem('logoUrl', this.logo) |
| | | let that = this |
| | | var img = new Image() |
| | | img.onload = function () { |
| | | that.logoHeight = img.height |
| | | if (that.logoHeight > 50) { |
| | | that.logoHeight = 50 |
| | | } |
| | | } |
| | | img.src = that.logo |
| | | }, |
| | | imageError: function (e) { |
| | | if (this.logo === null) { |
| | | this.setLogo(sessionStorage.getItem('logoUrl')) |
| | | } |
| | | }, |
| | | ...mapMutations('user', ['setLogo']) |
| | | }, |
| | | components: { |
| | | 'langSelect': LangSelect |
| | | }, |
| | | computed: { |
| | | ...mapState('user', { langFlag: state => state.langFlag }), |
| | | ...mapState('user', { logo: state => state.logo }), |
| | | ...mapState('exam', { productType: state => state.productType }) |
| | | } |
| | | } |
| | |
| | | userName: Cookies.get('studentUserName'), |
| | | userInfo: Cookies.get('studentUserInfo'), |
| | | imagePath: Cookies.get('studentImagePath'), |
| | | logo: null, |
| | | messageCount: 0, |
| | | memberToken: Cookies.get('memberTocken'), |
| | | langType: 'English', |
| | |
| | | |
| | | // mutations |
| | | const mutations = { |
| | | setLogo (state, logo) { |
| | | state.logo = logo |
| | | }, |
| | | setUserName (state, userName) { |
| | | state.userName = userName |
| | | Cookies.set('studentUserName', userName, { expires: 30 }) |
| | |
| | | }) |
| | | // 已经答完了不能答题 |
| | | examPaperApi.selectTokenId(_this.paraMemberToken).then(re => { |
| | | if (re.response.logoUrl === null || re.response.logoUrl === '') { |
| | | _this.setLogo('none') |
| | | } else { |
| | | _this.setLogo(re.response.logoUrl) |
| | | } |
| | | console.log('response') |
| | | console.log(re.response) |
| | | _this.setProductType(re.response.productType) |
| | | if (re.response.finish === 1) { |
| | | _this.$router.push({ path: '/exam/finish', query: { name: '', content: _this.$t('finishMsg'), tokenId: _this.paraMemberToken } }) |
| | |
| | | ...mapMutations('exam', ['setReportTemplateId']), |
| | | ...mapMutations('user', ['setLangType']), |
| | | ...mapMutations('user', ['getLangType']), |
| | | ...mapMutations('user', ['setLogo']), |
| | | ...mapMutations('exam', ['setProductType']) |
| | | |
| | | }, |