mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 03:46:44 +08:00
提交弹出窗口配置
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
|
|
||||||
import ajax from '@/utils/xajax.js'
|
import ajax from '@/utils/xajax.js'
|
||||||
|
|
||||||
const userList=function (){
|
/**
|
||||||
return ajax.get('/xboe/m/popup/user');
|
* @param {Object} device 不包含的平台, 1表pc, 2表移动端
|
||||||
|
*/
|
||||||
|
const findByNoDevice=function (device){
|
||||||
|
return ajax.get('/xboe/m/popup/user?device='+device);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
userList
|
findByNoDevice
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<!--弹出窗口设置-->
|
<!--弹出窗口设置-->
|
||||||
<div>
|
<div>
|
||||||
|
<div v-for="pop in popupList" :key="pop.id">wwww
|
||||||
|
<el-dialog :close-on-press-escape="false" :close-on-click-modal="false" class="medalbox" :visible.sync="pop.show" :append-to-body="true" >
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<el-image :src="baseUrl+pop.bgImage"></el-image>
|
||||||
<div>
|
<div>
|
||||||
<el-dialog :close-on-press-escape="false" :close-on-click-modal="false" class="medalbox" :visible.sync="showGonggao" :append-to-body="true" >
|
<span v-if="pop.closeable" class="dlg-close" @click="pop.show = false"><i style="font-size: 28px;color: #999;" class="el-icon-close"></i></span>
|
||||||
<div class="dlg-box" :style="`width:${config.width};height:${config.height}; background: url(${webBaseUrl}/images/gonggao/${config.bgImage}.png) no-repeat;`">
|
|
||||||
<span class="dlg-close" @click="showGonggao = false"><i style="font-size: 28px;color: #999;" class="el-icon-close"></i></span>
|
|
||||||
<div style="text-align:left;">
|
|
||||||
<div class="dlg-title" v-html="config.title"></div>
|
|
||||||
<div class="dlg-content" v-html="config.content"></div>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="config.btnText"><a :href="config.pcUrl" @click="showGonggao = false" target="_blank" :style="{'background-color':config.btnColor}" class="dlg-button">{{config.btnText}}</a> </div>
|
|
||||||
<div v-if="config.author" style="text-align: right;padding-top: 20px;"><span>{{config.author}}</span> </div>
|
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,30 +18,15 @@
|
|||||||
import apiPopup from '@/api/modules/popup.js';
|
import apiPopup from '@/api/modules/popup.js';
|
||||||
export default{
|
export default{
|
||||||
props:{
|
props:{
|
||||||
config: {
|
page: {
|
||||||
type:Object,
|
type:String,
|
||||||
default(){
|
default:''
|
||||||
return{
|
|
||||||
id:'',//数据id
|
|
||||||
closeable:false,//不可以关闭
|
|
||||||
width:'500px',//宽度
|
|
||||||
height:'500px',
|
|
||||||
title:'公告',//标题
|
|
||||||
content:'',//文字内容
|
|
||||||
bgImage:'dlg_bg',//背景图
|
|
||||||
pcUrl:'',//点击后打开的地址,最好是使用相对地址
|
|
||||||
h5Url:'',
|
|
||||||
btnText:'立即参与',//
|
|
||||||
btnColor:'#008BFF',
|
|
||||||
author:'',
|
|
||||||
type:0,//0表不控制,
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showGonggao:false,
|
showGonggao:true,
|
||||||
|
baseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||||
popupList:[],//需要弹出的窗口
|
popupList:[],//需要弹出的窗口
|
||||||
sessionKey:'alertpopup',
|
sessionKey:'alertpopup',
|
||||||
};
|
};
|
||||||
@@ -51,22 +34,26 @@
|
|||||||
mounted() {
|
mounted() {
|
||||||
//获取用户需要弱出的窗口信息,放在状态中
|
//获取用户需要弱出的窗口信息,放在状态中
|
||||||
let has = sessionStorage.getItem(this.sessionKey);
|
let has = sessionStorage.getItem(this.sessionKey);
|
||||||
|
//has=false;
|
||||||
if(!has){
|
if(!has){
|
||||||
apiPopup.userList().then(rs=>{
|
apiPopup.findByNoDevice(2).then(rs=>{
|
||||||
if(rs.status==200){
|
if(rs.status==200){
|
||||||
|
rs.result.forEach(item=>{
|
||||||
|
item.show=true;
|
||||||
|
})
|
||||||
this.popupList=rs.result;
|
this.popupList=rs.result;
|
||||||
if(rs.result.length>0){
|
if(rs.result.length>0){
|
||||||
sessionStorage.setItem(this.sessionKey,JSON.stringify(rs.result));
|
sessionStorage.setItem(this.sessionKey,"1");
|
||||||
this.countPopup();
|
this.countPopup();
|
||||||
}else{
|
}else{
|
||||||
sessionStorage.setItem(this.sessionKey,'[]');
|
sessionStorage.removeItem(this.sessionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
this.popupList=JSON.parse(has);
|
//this.popupList=JSON.parse(has);
|
||||||
this.countPopup();
|
//this.countPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -97,13 +84,12 @@
|
|||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
countPopup(){
|
countPopup(){
|
||||||
let newLogin = localStorage.getItem(this.$xpage.constants.newLoginKey);
|
// let newLogin = localStorage.getItem(this.$xpage.constants.newLoginKey);
|
||||||
this.popupList.forEach(item=>{
|
// this.popupList.forEach(item=>{
|
||||||
if(item.loginEd && newLogin && newLogin==1){
|
// if(item.loginEd && newLogin && newLogin==1){
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,8 +125,11 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
.dlg-close{
|
.dlg-close{
|
||||||
float: right;
|
//float: right;
|
||||||
margin-top: -90px;
|
//margin-top: -90px;
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 20px 10px 10px 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.medalbox {
|
.medalbox {
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<popup v-if="popupConfig.id" :config="popupConfig"></popup>
|
<popup></popup>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -184,23 +184,7 @@ export default {
|
|||||||
//this.loadPopupConfig();
|
//this.loadPopupConfig();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadPopupConfig(){
|
|
||||||
this.popupConfig={
|
|
||||||
id:'123',//数据id
|
|
||||||
closeable:false,//不可以关闭
|
|
||||||
width:'472px',//宽度
|
|
||||||
height:'500px',
|
|
||||||
title:'用户体验调研',//标题
|
|
||||||
content:'<div style="font-size:20px;font-weight: 600;padding-bottom:10px;">亲爱的校友:</div><div> 诚邀您对11月4日上线的学习平台V2.0的使用体验进行测评,我们将以您的意见反馈为输入,不断的优化和改进。</div>',//文字内容
|
|
||||||
bgImage:'dlg_bg_pen',//背景图
|
|
||||||
pcUrl:'https://boehrsurvey.wjx.cn/vm/O5XcWrk.aspx',//点击后打开的地址,最好是使用相对地址
|
|
||||||
h5Url:'',
|
|
||||||
btnText:'立即参与',//
|
|
||||||
btnColor:'#008BFF',
|
|
||||||
author:'BOEU学习平台产品团队',
|
|
||||||
type:0,//0表不控制,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setCurIdentity(iden){
|
setCurIdentity(iden){
|
||||||
this.$store.dispatch('SetCurIdentity',iden);
|
this.$store.dispatch('SetCurIdentity',iden);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user