修改ico和cookies的token为Web-Token、检索一个输入框的布局、并添加轮播管理

This commit is contained in:
熊丽君
2021-08-23 16:31:40 +08:00
parent 6492955ccf
commit 17aa1285a9
12 changed files with 148 additions and 74 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -1,5 +1,12 @@
import request from '@/utils/request';
// 首页获取所有轮播
export function getRotationList(params) {
return request({
url: '/mobile/list',
params
});
}
// 首页获取政策列表
export function getPolicy(params) {
return request({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -1,15 +1,15 @@
import Cookies from 'js-cookie'
import Cookies from 'js-cookie';
const TokenKey = 'Admin-Token'
const TokenKey = 'Web-Token';
export function getToken() {
return Cookies.get(TokenKey)
return Cookies.get(TokenKey);
}
export function setToken(token) {
return Cookies.set(TokenKey, token)
return Cookies.set(TokenKey, token);
}
export function removeToken() {
return Cookies.remove(TokenKey)
return Cookies.remove(TokenKey);
}

View File

@ -70,14 +70,14 @@ export default {
queryParams: {
userId: '1385154178159804416',
pageNum: 1,
pageSize: 10,
pageSize: 10
},
msgTotal: 0,
// 待发送信息
message: '',
// 聊天记录
chats: [],
isLoading: 0, //是否正在加载中0否1是
isLoading: 0 //是否正在加载中0否1是
};
},
created() {},
@ -85,7 +85,7 @@ export default {
this.init();
},
methods: {
init: function () {
init: function() {
if (typeof WebSocket === 'undefined') {
alert('您的浏览器不支持socket');
} else {
@ -104,7 +104,7 @@ export default {
console.log('socket连接成功');
this.getMsgList(true);
},
error: function () {
error: function() {
if (!this.$store.state.user.userId) {
this.msgError('请先登录');
} else {
@ -114,12 +114,50 @@ export default {
getMessage(msg) {
console.log(JSON.parse(msg.data));
const msgInfo = JSON.parse(msg.data);
let that = this;
if (!('Notification' in window)) {
console.log('浏览器不支持消息通知');
return;
}
Notification.requestPermission(function(permission) {
//如果不是当前页面,标题栏闪动+消息提示
if (document.hidden) {
var options = {
body: '您有新的未读消息,请及时处理',
silent: true
};
var notification = new Notification('消息通知', options);
notification.onclick = function() {
window.open(`/customerService`, '_blank');
};
//标题栏闪动
var defaultTitle = document.title;
if (that.isReceive) {
return;
} else {
that.isReceive = true;
}
that.timer = setInterval(function() {
var title = document.title;
if (document.hidden && that.isReceive) {
if (/你有新消息/.test(title) == false) {
document.title = '【你有新消息】';
} else {
document.title = defaultTitle;
}
} else {
that.isReceive = false;
document.title = defaultTitle;
}
}, 500);
}
});
this.chats.push(msgInfo);
},
send: function (params) {
send: function(params) {
this.socket.send(params);
},
close: function () {
close: function() {
console.log('socket已经关闭');
},
scroll(e) {
@ -138,11 +176,11 @@ export default {
getMsgList(flag) {
this.isLoading = 1;
getChatRecords(this.queryParams).then(({ data }) => {
data.list.map((item) => {
data.list.map(item => {
item.sendTime = new Date(item.sendTime).getTime();
});
// 时间戳排序
data.list.sort(function (a, b) {
data.list.sort(function(a, b) {
return a.sendTime > b.sendTime ? 1 : -1;
});
this.chats = [...data.list, ...this.chats];
@ -208,7 +246,7 @@ export default {
this.chats.push({
type: 'leftinfo',
sendText: this.message,
msgTime: this.getTodayTime(),
msgTime: this.getTodayTime()
});
this.chatWindowActive();
let message = this.message;
@ -217,18 +255,18 @@ export default {
sendMsg({
sendText: message,
receiverUserId: '1385154178159804416',
type: 'leftinfo',
}).then((res) => {
type: 'leftinfo'
}).then(res => {
console.log(res);
this.isLoading = 0;
});
},
}
},
destroyed() {
console.log('out');
// 销毁监听
this.socket.onclose = this.close;
},
}
};
</script>
@ -268,6 +306,8 @@ export default {
-ms-user-select: none;
user-select: none;
img {
background-color: #ffffff;
border-radius: 50%;
width: 42px;
height: 42px;
display: block;
@ -337,9 +377,10 @@ export default {
width: 45px;
height: 45px;
border-radius: 50%;
// background-color: #ffffff;
background-color: #ffffff;
background-image: url('~@/assets/logo/logo.png');
background-size: cover;
// background-size: cover;
background-size: 50% 50%;
background-position: center;
background-repeat: no-repeat;
margin-right: 10px;

View File

@ -268,7 +268,8 @@ export default {
padding: 15px;
margin-top: 30px;
.screen_item_l {
width: 225px;
width: 300px;
height: 160px;
img {
width: 100%;
height: 100%;
@ -282,6 +283,7 @@ export default {
font-weight: bold;
color: #ffa32c;
padding: 10px 0;
text-align: left;
}
.text {
font-size: 14px;

View File

@ -5,8 +5,15 @@
<div class="banner">
<!-- 轮播图 -->
<el-carousel height="345px" trigger="click">
<el-carousel-item v-for="(item, index) in bannerList" :key="index">
<img :src="item" alt="" />
<el-carousel-item v-for="item in bannerList" :key="item.id">
<!-- <router-link
:to="{
path: item.url
}"
target="_blank"
> -->
<img :src="item.pic" alt="" @click="handlePage(item.url)" />
<!-- </router-link> -->
</el-carousel-item>
</el-carousel>
<!-- 政策解读 -->
@ -36,8 +43,8 @@
v-model="queryParams2.attributeId"
@tab-click="handleClick2"
>
<el-tab-pane label="经信" name="JXJ"></el-tab-pane>
<el-tab-pane label="科技" name="KJJ"></el-tab-pane>
<el-tab-pane label="经信" name="JXJ"></el-tab-pane>
<el-tab-pane label="发改" name="FGW"></el-tab-pane>
<el-tab-pane label="其他" name="OTHER"></el-tab-pane>
<div
@ -383,19 +390,21 @@
</div>
</template>
<script>
import logoImg1 from '@/assets/image/banner1.png';
import logoImg2 from '@/assets/image/banner2.png';
import logoImg3 from '@/assets/image/banner3.png';
import { getPolicy, getPolicyRead, getInformation } from '@/api/home/home';
import {
getRotationList,
getPolicy,
getPolicyRead,
getInformation
} from '@/api/home/home';
export default {
data() {
return {
bannerList: [logoImg1, logoImg2, logoImg3],
bannerList: [],
queryParams: {
labelId: '1415156808053559296'
},
queryParams2: {
attributeId: 'JXJ'
attributeId: 'KJJ'
},
queryParams3: {
pageNum: 1,
@ -419,9 +428,15 @@ export default {
getPolicyRead(this.queryParams2).then(({ data }) => {
this.list2 = data.list;
});
},
handlePage(url) {
window.open(url, '_blank');
}
},
created() {
getRotationList({ pageNum: 1, pageSize: 50 }).then(({ data }) => {
this.bannerList = data.list;
});
this.handleClick();
this.handleClick2();
getInformation(this.queryParams3).then(({ data }) => {

View File

@ -389,7 +389,7 @@ export default {
getCityByLevel({ level: 2 }).then(({ data }) => {
this.levelList_3 = data;
});
getCityByLevel({ level: 2 }).then(({ data }) => {
getCityByLevel({ level: 3 }).then(({ data }) => {
this.levelList_4 = data;
this.city = key;
this.getList();

View File

@ -24,12 +24,12 @@
</div>
</el-tooltip>
</div>
<div class="item-box">
<router-link to="/customerService" target="_blank">
<router-link to="/customerService" target="_blank">
<div class="item-box">
<img src="@/assets/image/service.png" />
<div class="text">在线客服</div>
</router-link>
</div>
</div>
</router-link>
</div>
<!-- <div class="img_box">
<img src="@/assets/image/toubu.png" alt="" />
@ -254,6 +254,7 @@ export default {
.el-button {
font-size: 16px;
color: #4097e7;
font-weight: bold;
}
.mark {
width: 1px;

View File

@ -122,41 +122,40 @@ export default {
}
},
created() {
if (this.token) {
console.log();
const { key, val } = this.$route.query;
this.type = key;
this.val = val;
if (key == 'policy') {
userInfo().then(({ data }) => {
if (data.companyId) {
getLabelSetting({ companyId: data.companyId }).then(({ data }) => {
if (data.length) {
console.log(data);
this.portraitList = data.map(item =>
item.labelList
// if (this.token) {
const { key, val } = this.$route.query;
this.type = key;
this.val = val;
if (key == 'policy') {
userInfo().then(({ data }) => {
if (data.companyId) {
getLabelSetting({ companyId: data.companyId }).then(({ data }) => {
if (data.length) {
console.log(data);
this.portraitList = data.map(item =>
item.labelList
? item.labelList.filter(v => v.isHas)[0]
? item.labelList.filter(v => v.isHas)[0]
? item.labelList.filter(v => v.isHas)[0]
: ''
: undefined
);
this.queryParams.labelId = this.portraitList[0].id;
this.getPortraitList();
}
});
}
});
} else if (key == 'policyRead') {
this.queryParams.attributeId = this.attributeOptions[0].value;
this.getPortraitList();
} else if (key == 'information') {
this.getPortraitList();
} else {
this.msgError('非法进入');
}
: ''
: undefined
);
this.queryParams.labelId = this.portraitList[0].id;
this.getPortraitList();
}
});
}
});
} else if (key == 'policyRead') {
this.queryParams.attributeId = this.attributeOptions[0].value;
this.getPortraitList();
} else if (key == 'information') {
this.getPortraitList();
} else {
this.msgError('请先登录');
this.msgError('非法进入');
}
// } else {
// this.msgError('请先登录');
// }
}
};
</script>

View File

@ -211,9 +211,13 @@ export default {
watch: {
formData: {
handler: function() {
this.$nextTick(() => {
this.formatRichText(this.formData.downloadUrl, this.formData.id);
});
if (this.type == 'policy') {
this.$nextTick(() => {
this.formatRichText(this.formData.downloadUrl, this.formData.id);
});
} else {
this.formData.text = this.formData.text.replaceAll('&nbsp;', ' ');
}
}
},
deep: true
@ -302,6 +306,11 @@ export default {
/deep/.editor {
border: 0;
}
/deep/p {
img {
max-width: 100%;
}
}
}
.my_header {
position: fixed;

View File

@ -133,7 +133,7 @@
<el-form v-if="status == -2">
<p>您的高企认定门槛检查未通过,请点击返回重新填写!</p>
<p>未通过项:</p>
<p style="font-weight: bold">未通过项:</p>
<p v-for="(item, index) in badSeason" :key="index">
{{ index + 1 }}、{{ item }}
</p>
@ -233,12 +233,12 @@
<el-form class="el_form_4" v-if="status == -3">
<p>
您的创新指标得分
<span style="color: red; font-size: 22px; font-weight: 700">{{
<span style="color: red; font-size: 27px; font-weight: 700">{{
score
}}</span>
分,不符合高企认定条件!此评分为平台智能估算分,仅供参考,实际评分以政府实际打分为准!
</p>
<p>平台建议:</p>
<p style="font-weight: bold">平台建议:</p>
<p v-for="(item, index) in badSeason1" :key="index">
{{ index + 1 }}{{ item }}
</p>
@ -250,7 +250,7 @@
<el-form class="el_form_4" v-if="status == 4">
<p>
您的创新指标得分
<span style="color: green; font-size: 22px; font-weight: 700">{{
<span style="color: green; font-size: 27px; font-weight: 700">{{
score
}}</span>
符合高企认定条件此评分为平台智能估算分仅供参考实际评分以政府实际打分为准