Commit 8b281c3b by xiawei

eslint

parent c50f6d1e
......@@ -281,7 +281,16 @@ module.exports = {
'no-cond-assign': [2, 'except-parens'],
// 禁止出现难以理解的箭头函数,除非用圆括号括起来
'no-confusing-arrow': [2, {}],
'no-confusing-arrow': [
2,
{
allowParens: true
}
],
// 禁止使用 console,线上环境检测
'no-console': process.env.NODE_ENV === 'production' ? 1 : 0,
// 禁止 debugger 语句,线上环境检测
'no-debugger': process.env.NODE_ENV === 'production' ? 1 : 0,
......@@ -795,6 +804,9 @@ module.exports = {
// @off 没有必要
'prefer-arrow-callback': 0,
// 声明后不再修改的变量必须使用 const,仅作提醒
'prefer-const': 1,
// 必须使用解构
// @off 没有必要
'prefer-destructuring': 0,
......
......@@ -38,7 +38,7 @@ export default {
uin: this.channelInfo.uin
});
if (res.code === 200 && res.errorCode === 0) {
let info = res.data || {};
const info = res.data || {};
if (info.needPayInvalid === 1) {
this.isWatchPay = false;
} else if (info.isCanPlay === 0) {
......
......@@ -34,7 +34,7 @@ export default {
set_encrypt: 'set_encrypt'
}),
async get_encrypt() {
let passToken = this.$cookie.get(this.tokenKey) || '';
const passToken = this.$cookie.get(this.tokenKey) || '';
if (passToken) {
const res = await checkPassword({
id: this.channelInfo.id,
......
......@@ -56,20 +56,20 @@ export default {
uin: this.channelInfo.uin
});
if (res.code === 200 && res.errorCode === 0) {
let list = res.data || [];
const list = res.data || [];
this.list = list.filter(x => {
return x.display;
});
}
},
_changePlayer(url, id) {
let info = JSON.parse(JSON.stringify(this.playerInfo));
const info = JSON.parse(JSON.stringify(this.playerInfo));
info.playUrl = url;
info.cameraId = id;
this.set_playerInfo(info);
},
_scrollGo(go) {
let page = this.page
let page = this.page
if (go === 'left') {
page = page - 1 > 0 ? page - 1 : 0;
} else if (go === 'right') {
......
......@@ -24,7 +24,7 @@ export default {
channelInfo: 'channelInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......
......@@ -21,7 +21,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -23,7 +23,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -28,7 +28,7 @@ export default {
channelInfo: 'channelInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......@@ -45,7 +45,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -23,7 +23,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -28,7 +28,7 @@ export default {
channelInfo: 'channelInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......@@ -45,7 +45,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -21,7 +21,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -21,7 +21,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -48,7 +48,7 @@ export default {
channelInfo: 'channelInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......@@ -62,7 +62,7 @@ export default {
},
methods: {
_reply(id, userNick, filterContent) {
let obj = {
const obj = {
id: id,
userNick: userNick,
filterContent: filterContent
......
......@@ -53,12 +53,12 @@ export default {
},
methods: {
getMore() {
let chatListBoxDom = this.$refs.chatListBox;
let chatListDom = this.$refs.chatList;
const chatListBoxDom = this.$refs.chatListBox;
const chatListDom = this.$refs.chatList;
if (chatListBoxDom && chatListDom) {
let boxHeight = chatListBoxDom.clientHeight;
let boxScrollTop = chatListBoxDom.scrollTop;
let listHeigth = chatListDom.clientHeight;
const boxHeight = chatListBoxDom.clientHeight;
const boxScrollTop = chatListBoxDom.scrollTop;
const listHeigth = chatListDom.clientHeight;
if (boxScrollTop <= 100) {
this.getChatList();
}
......@@ -80,8 +80,8 @@ export default {
num: this.num
});
if (res.code === 200 && res.errorCode === 0) {
let list = res.data || [];
let firstLi =
const list = res.data || [];
const firstLi =
document.querySelector('#chatList') && document.querySelector('#chatList').children[0];
list.forEach(item => {
this.addChat(item, true);
......@@ -90,7 +90,7 @@ export default {
if (this.page === 1) {
this._scrollBottom();
} else {
let chatListBoxDom = this.$refs.chatListBox;
const chatListBoxDom = this.$refs.chatListBox;
if (chatListBoxDom && firstLi) {
chatListBoxDom.scrollTop = firstLi.offsetTop;
}
......@@ -110,13 +110,13 @@ export default {
}
},
addChat(obj, order = false) {
let chatObj = obj;
const chatObj = obj;
this.list = this.list.filter(x => {
return Number(x.id) !== Number(chatObj.id);
});
if (this.list.length) {
let newTime = chatObj.addTime;
let prevTime = order ? this.list[0].addTime : this.list[this.list.length - 1].addTime;
const newTime = chatObj.addTime;
const prevTime = order ? this.list[0].addTime : this.list[this.list.length - 1].addTime;
if (Math.abs(newTime - prevTime) > 600) {
chatObj.showTime = true;
}
......@@ -138,12 +138,12 @@ export default {
});
},
_scrollKeep() {
let chatListBoxDom = this.$refs.chatListBox;
let chatListDom = this.$refs.chatList;
const chatListBoxDom = this.$refs.chatListBox;
const chatListDom = this.$refs.chatList;
if (chatListBoxDom && chatListDom) {
let boxHeight = chatListBoxDom.clientHeight;
let boxScrollTop = chatListBoxDom.scrollTop;
let listHeigth = chatListDom.clientHeight;
const boxHeight = chatListBoxDom.clientHeight;
const boxScrollTop = chatListBoxDom.scrollTop;
const listHeigth = chatListDom.clientHeight;
if (boxHeight + boxScrollTop > listHeigth - 250) {
this.$nextTick(() => {
chatListBoxDom.scrollTop = this.$refs.chatList.clientHeight;
......@@ -154,10 +154,10 @@ export default {
}
},
_scrollBottom() {
let chatListBoxDom = this.$refs.chatListBox;
let chatListDom = this.$refs.chatList;
const chatListBoxDom = this.$refs.chatListBox;
const chatListDom = this.$refs.chatList;
if (chatListBoxDom && chatListDom) {
let listHeigth = chatListDom.clientHeight;
const listHeigth = chatListDom.clientHeight;
chatListBoxDom.scrollTop = listHeigth;
}
},
......@@ -170,13 +170,13 @@ export default {
}
},
_scrollReply() {
let id = this.replyChatId;
let el = document.querySelectorAll(`[data-chatid="${id}"]`)[0];
const id = this.replyChatId;
const el = document.querySelectorAll(`[data-chatid="${id}"]`)[0];
if (!el) {
this._scrollBottom();
return false;
}
let scrollTop = el.offsetTop;
const scrollTop = el.offsetTop;
this.$refs.chatListBox.scrollTop = scrollTop;
this._closeReply();
},
......
......@@ -45,7 +45,7 @@ export default {
return this.watchNum.custom + this.watchNum.real;
},
liveNowStatus() {
let status = this.channelInfo.liveNowStatus;
const status = this.channelInfo.liveNowStatus;
if (status === 1) {
return '<span class="type green"><span class="icon"></span><span class="title">直播中</span></span>';
}
......@@ -74,7 +74,7 @@ export default {
uin: this.channelInfo.uin
});
if (res.code === 200 && res.errorCode === 0) {
let { customWatchNum, watchNum } = res.data;
const { customWatchNum, watchNum } = res.data;
this.watchNum = {
custom: Number(customWatchNum) || 0,
real: Number(watchNum) || 0
......
......@@ -59,7 +59,7 @@ export default {
}
},
_play(url) {
let info = JSON.parse(JSON.stringify(this.playerInfo));
const info = JSON.parse(JSON.stringify(this.playerInfo));
info.playUrl = url;
info.cameraId = '';
this.set_playerInfo(info);
......
......@@ -62,7 +62,7 @@ export default {
},
computed: {
newList() {
let list = this.list;
const list = this.list;
return list.sort((a, b) => {
if (this.sort) {
return new Date(b.createTime) - new Date(a.createTime);
......@@ -81,9 +81,9 @@ export default {
},
methods: {
getMore() {
let listBoxT = this.$refs.listBox && this.$refs.listBox.scrollTop;
let listBoxH = this.$refs.listBox && this.$refs.listBox.clientHeight;
let listH = this.$refs.list && this.$refs.list.clientHeight;
const listBoxT = this.$refs.listBox && this.$refs.listBox.scrollTop;
const listBoxH = this.$refs.listBox && this.$refs.listBox.clientHeight;
const listH = this.$refs.list && this.$refs.list.clientHeight;
if (listBoxT + listBoxH > listH - 100) {
this.getList();
}
......@@ -102,7 +102,7 @@ export default {
this.isMore = true;
if (res.code === 200 && res.errorCode === 0) {
this.count = res.data.count;
let data = res.data.list;
const data = res.data.list;
if (data.length < this.num) {
this.isMore = false;
}
......@@ -138,7 +138,7 @@ export default {
time: obj.time
});
if (res.code === 200 && res.errorCode === 0) {
let data = res.data;
const data = res.data;
if (
this.list.some(x => {
return Number(x.id) === Number(data.id);
......
......@@ -40,11 +40,11 @@ export default {
playerInfo: 'playerInfo'
}),
isPeep() {
let peep = this.channelConfig.peep || {};
const peep = this.channelConfig.peep || {};
return !!peep.isEnable;
},
mpsBackgroundUrl() {
let bgUrl = this.channelInfo.mpsBackgroundUrl;
const bgUrl = this.channelInfo.mpsBackgroundUrl;
return bgUrl ? `${bgUrl}?x-oss-process=style/twzb_origin` : '';
},
mpsOptions() {
......
......@@ -42,7 +42,7 @@ export default {
set_playerInfo: 'set_playerInfo'
}),
_backPlay() {
let info = JSON.parse(JSON.stringify(this.playerInfo));
const info = JSON.parse(JSON.stringify(this.playerInfo));
info.playUrl = info.saveUrl;
info.cameraId = '';
this.set_playerInfo(info);
......@@ -54,7 +54,7 @@ export default {
}
},
makeColor() {
let colorArray = '0123456789abcdef';
const colorArray = '0123456789abcdef';
let color = '';
for (let i = 0; i < 6; i++) {
color += colorArray[Math.floor(Math.random() * 16)];
......@@ -62,18 +62,18 @@ export default {
return color;
},
_sendBarrage(str) {
let content = str.replace(/(#)[\u4e00-\u9fa5A-Za-z0-9.]+(#)/gi, '');
const content = str.replace(/(#)[\u4e00-\u9fa5A-Za-z0-9.]+(#)/gi, '');
if (!this.mps || !content || !this.showBarrage || this.barrageInfo.status !== 1) {
return false;
}
let fontColor = this.barrageInfo.fontColor || 'FFFFFF';
let fontSize = this.barrageInfo.fontSize || 2;
let fontSpeed = this.barrageInfo.speed || 2;
let color = fontColor === 'random' ? this.makeColor() : fontColor;
let sizeArr = { '1': 16, '2': 20, '3': 32 };
let speedArr = { '1': 100, '2': 50, '3': 20 };
let size = sizeArr[fontSize] || 16;
let speed = speedArr[fontSpeed] || 50;
const fontColor = this.barrageInfo.fontColor || 'FFFFFF';
const fontSize = this.barrageInfo.fontSize || 2;
const fontSpeed = this.barrageInfo.speed || 2;
const color = fontColor === 'random' ? this.makeColor() : fontColor;
const sizeArr = { '1': 16, '2': 20, '3': 32 };
const speedArr = { '1': 100, '2': 50, '3': 20 };
const size = sizeArr[fontSize] || 16;
const speed = speedArr[fontSpeed] || 50;
this.mps.sendbarrage2(content, size, '#' + color, speed, '', '微软雅黑');
}
},
......
......@@ -47,11 +47,11 @@ export default {
}
},
emojiArr() {
let arr = [];
let num = 20;
for (let key in emoji_icon) {
const arr = [];
const num = 20;
for (const key in emoji_icon) {
if (emoji_icon.hasOwnProperty(key)) {
let index = parseInt((key - 1) / num, 10);
const index = parseInt((key - 1) / num, 10);
if (!arr[index]) {
arr[index] = [];
}
......@@ -70,7 +70,7 @@ export default {
methods: {
_initSwiper() {
if (!this.swiper) {
let option = {
const option = {
direction: 'horizontal',
pagination: {
el: this.$refs.emojiPagination
......@@ -84,7 +84,7 @@ export default {
},
_remText() {
let text = this.content;
let reg = /(#)[\u4e00-\u9fa5A-Za-z0-9.]+(#)$/;
const reg = /(#)[\u4e00-\u9fa5A-Za-z0-9.]+(#)$/;
if (text) {
if (text.match(reg) != null) {
text = text.replace(reg, '');
......
......@@ -153,13 +153,13 @@ export default {
this.$refs.file.click();
},
_uploadImg(e) {
let self = this;
let input = e.target;
const self = this;
const input = e.target;
if (!input.value) {
return false;
}
if (input.files && input.files[0]) {
let reader = new FileReader();
const reader = new FileReader();
reader.onload = function() {
self._createCanvas(reader.result);
input.value = '';
......@@ -168,18 +168,18 @@ export default {
}
},
_createCanvas(src) {
let self = this;
let canvas = document.createElement('canvas');
let cxt = canvas.getContext('2d');
let img = new Image();
const self = this;
const canvas = document.createElement('canvas');
const cxt = canvas.getContext('2d');
const img = new Image();
img.src = src;
let maxW = 400;
let maxH = 600;
const maxW = 400;
const maxH = 600;
img.onload = function() {
let w = img.width;
let h = img.height;
if (w > maxW || h > maxH) {
let p = w / maxW > h / maxH ? w / maxW : h / maxH;
const p = w / maxW > h / maxH ? w / maxW : h / maxH;
w = img.width / p;
h = img.height / p;
img.width = w;
......@@ -188,7 +188,7 @@ export default {
canvas.width = w;
canvas.height = h;
cxt.drawImage(img, 0, 0, w, h);
let newsrc = canvas.toDataURL('image/jpeg', 0.9);
const newsrc = canvas.toDataURL('image/jpeg', 0.9);
self._sendPhoto(newsrc);
};
},
......
......@@ -44,10 +44,10 @@ export default {
},
methods: {
getMore() {
let chatListBoxDom = this.$refs.chatListBox;
let chatListDom = this.$refs.chatList;
const chatListBoxDom = this.$refs.chatListBox;
const chatListDom = this.$refs.chatList;
if (chatListBoxDom && chatListDom) {
let boxScrollTop = chatListBoxDom.scrollTop;
const boxScrollTop = chatListBoxDom.scrollTop;
if (boxScrollTop <= 100) {
this.getChatList();
}
......@@ -66,8 +66,8 @@ export default {
num: this.num
});
if (res.code === 200 && res.errorCode === 0) {
let list = res.data || [];
let firstLi =
const list = res.data || [];
const firstLi =
document.querySelector('#chatList') && document.querySelector('#chatList').children[0];
list.forEach(item => {
this.addChat(item, true);
......@@ -76,7 +76,7 @@ export default {
if (this.page === 1) {
this._scrollBottom();
} else {
let chatListBoxDom = this.$refs.chatListBox;
const chatListBoxDom = this.$refs.chatListBox;
if (chatListBoxDom && firstLi) {
chatListBoxDom.scrollTop = firstLi.offsetTop;
}
......@@ -98,13 +98,13 @@ export default {
}
},
addChat(obj, order = false) {
let chatObj = obj;
const chatObj = obj;
this.list = this.list.filter(x => {
return Number(x.id) !== Number(chatObj.id);
});
if (this.list.length) {
let newTime = chatObj.addTime;
let prevTime = order ? this.list[0].addTime : this.list[this.list.length - 1].addTime;
const newTime = chatObj.addTime;
const prevTime = order ? this.list[0].addTime : this.list[this.list.length - 1].addTime;
if (Math.abs(newTime - prevTime) > 600) {
chatObj.showTime = true;
}
......@@ -125,12 +125,12 @@ export default {
});
},
_scrollKeep() {
let chatListBoxDom = this.$refs.chatListBox;
let chatListDom = this.$refs.chatList;
const chatListBoxDom = this.$refs.chatListBox;
const chatListDom = this.$refs.chatList;
if (chatListBoxDom && chatListDom) {
let boxHeight = chatListBoxDom.clientHeight;
let boxScrollTop = chatListBoxDom.scrollTop;
let listHeigth = chatListDom.clientHeight;
const boxHeight = chatListBoxDom.clientHeight;
const boxScrollTop = chatListBoxDom.scrollTop;
const listHeigth = chatListDom.clientHeight;
if (boxHeight + boxScrollTop > listHeigth - 250) {
this.$nextTick(() => {
chatListBoxDom.scrollTop = this.$refs.chatList.clientHeight;
......@@ -139,10 +139,10 @@ export default {
}
},
_scrollBottom() {
let chatListBoxDom = this.$refs.chatListBox;
let chatListDom = this.$refs.chatList;
const chatListBoxDom = this.$refs.chatListBox;
const chatListDom = this.$refs.chatList;
if (chatListBoxDom && chatListDom) {
let listHeigth = chatListDom.clientHeight;
const listHeigth = chatListDom.clientHeight;
chatListBoxDom.scrollTop = listHeigth;
}
}
......
......@@ -24,7 +24,7 @@ export default {
channelInfo: 'channelInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......
......@@ -29,7 +29,7 @@ export default {
userInfo: 'userInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......@@ -46,7 +46,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -29,7 +29,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -29,7 +29,7 @@ export default {
userInfo: 'userInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......@@ -46,7 +46,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -27,7 +27,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -26,7 +26,7 @@ export default {
channelInfo: 'channelInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......
......@@ -28,7 +28,7 @@ export default {
}),
countDowmInfo() {
let time = 0;
let now = this.nowDate / 1000;
const now = this.nowDate / 1000;
if (now) {
time = this.channelInfo.liveBegin - now;
}
......
......@@ -37,7 +37,7 @@ export default {
channelConfig: 'channelConfig'
}),
isShop() {
let info = this.channelConfig.shop || {};
const info = this.channelConfig.shop || {};
return info.isShow === 1;
}
},
......
......@@ -52,7 +52,7 @@ export default {
},
methods: {
giftImg(info) {
let giftInfo = JSON.parse(info.filterContent || '{}');
const giftInfo = JSON.parse(info.filterContent || '{}');
if (!giftInfo.img) {
giftInfo.img = `${process.env.DEF_OSS}/static/reward/gift-${giftInfo.imgType}.png`;
}
......
......@@ -65,11 +65,11 @@ export default {
}
},
top3List() {
let list = this.list || [];
const list = this.list || [];
return list.slice(0, 3);
},
otherList() {
let list = this.list || [];
const list = this.list || [];
return list.slice(3);
}
},
......
......@@ -40,7 +40,7 @@ export default {
jumpUrls: 'jumpUrls'
}),
isQuestionnaire() {
let info = this.channelConfig.questionnaire || {};
const info = this.channelConfig.questionnaire || {};
return info;
}
},
......
......@@ -24,7 +24,7 @@ export default {
playerInfo: 'playerInfo'
}),
mpsBackgroundUrl() {
let bgUrl = this.channelInfo.mpsBackgroundUrl;
const bgUrl = this.channelInfo.mpsBackgroundUrl;
return bgUrl ? `${bgUrl}?x-oss-process=style/twzb_origin` : require('./img/bg.png');
},
mpsOptions() {
......
......@@ -20,7 +20,7 @@ export default {
showRedInfo: 'showRedInfo'
}),
shareConfig() {
let self = this;
const self = this;
return {
title: this.channelInfo.shareTitle || this.channelInfo.channelName,
desc: this.channelInfo.shareSubTitle || window.location.href,
......@@ -80,7 +80,7 @@ export default {
},
// 微信分享init
_InitWXShare() {
let self = this;
const self = this;
window.wx.ready(() => {
window.wx.onMenuShareTimeline(self.shareConfig);
window.wx.onMenuShareAppMessage(self.shareConfig);
......
......@@ -63,7 +63,7 @@ export default {
}
},
editShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
if (this.info.id === goodInfo.id) {
this.info = goodInfo;
......@@ -71,7 +71,7 @@ export default {
}
},
deleteShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
if (this.info.id === goodInfo.id) {
this.info = {};
......@@ -79,7 +79,7 @@ export default {
}
},
cancelShopBind(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
if (goodInfo.id.some(id => id === this.info.id)) {
this.info = {};
......@@ -87,13 +87,13 @@ export default {
}
},
setTopShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
this.info = goodInfo;
}
},
cancelTopShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
if (this.info.id === goodInfo.id) {
this.info = {};
......
......@@ -102,9 +102,9 @@ export default {
},
methods: {
getMore() {
let shopContainerTop = this.$refs.shopContainer && this.$refs.shopContainer.scrollTop;
let shopContainerHeight = this.$refs.shopContainer && this.$refs.shopContainer.clientHeight;
let shopBodHeight = this.$refs.shopBody && this.$refs.shopBody.clientHeight;
const shopContainerTop = this.$refs.shopContainer && this.$refs.shopContainer.scrollTop;
const shopContainerHeight = this.$refs.shopContainer && this.$refs.shopContainer.clientHeight;
const shopBodHeight = this.$refs.shopBody && this.$refs.shopBody.clientHeight;
if (shopContainerTop + shopContainerHeight > shopBodHeight - 100) {
this.getList();
}
......@@ -114,7 +114,7 @@ export default {
return false;
}
this.isAjax = false;
let res = await goodsList({
const res = await goodsList({
includeId: this.channelInfo.id,
uin: this.channelInfo.uin,
type: 2,
......@@ -123,7 +123,7 @@ export default {
});
this.isAjax = true;
if (res.code === 200 && res.errorCode === 0) {
let { list, count } = res.data;
const { list, count } = res.data;
this.addList(list, true);
this.count = count;
if (list.length < this.num) {
......@@ -134,7 +134,7 @@ export default {
}
},
addList(list, sort) {
let fList = list.filter(item => !this.list.some(x => x.id === item.id));
const fList = list.filter(item => !this.list.some(x => x.id === item.id));
if (sort) {
this.list = this.list.concat(fList);
} else {
......@@ -142,7 +142,7 @@ export default {
}
},
editShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
this.list = this.list.map(x => {
if (x.id === goodInfo.id) {
......@@ -153,19 +153,19 @@ export default {
}
},
deleteShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
this.list = this.list.filter(x => x.id !== goodInfo.id);
}
},
addShopBind(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
this.addList(goodInfo);
}
},
cancelShopBind(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
this.list = this.list.filter(x => {
return !goodInfo.id.some(id => id === x.id);
......@@ -173,7 +173,7 @@ export default {
}
},
changeSort(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 2 && this.channelInfo.id === includeId) {
this.list = this.list.map(x => {
if (x.id === goodInfo.id) {
......
......@@ -79,23 +79,23 @@ export default {
userInfo: 'userInfo'
}),
isOffice() {
let info = this.channelConfig.officeLive || {};
const info = this.channelConfig.officeLive || {};
return info.isEnable === 1;
},
isDraw() {
return this.channelInfo.drawStatus === 1;
},
isInvitation() {
let info = this.channelConfig.invitation || {};
const info = this.channelConfig.invitation || {};
return info.isInvitation === 1;
},
isReward() {
let rewardStatus = this.channelInfo.rewardStatus;
let rewardGiftStatus = this.channelInfo.rewardGiftStatus;
const rewardStatus = this.channelInfo.rewardStatus;
const rewardGiftStatus = this.channelInfo.rewardGiftStatus;
return rewardStatus === 1 || rewardGiftStatus === 1;
},
isPraise() {
let info = this.channelConfig.praise;
const info = this.channelConfig.praise;
if (info) {
return info.isEnable === 1;
} else {
......
......@@ -79,7 +79,7 @@ export default {
}
},
isShowList() {
let info = this.channelConfig.invitation || {};
const info = this.channelConfig.invitation || {};
return info.isShowList === 1;
},
allWatchNum() {
......@@ -99,7 +99,7 @@ export default {
uin: this.channelInfo.uin
});
if (res.code === 200 && res.errorCode === 0) {
let { customWatchNum, watchNum } = res.data;
const { customWatchNum, watchNum } = res.data;
this.watchNum = {
custom: Number(customWatchNum) || 0,
real: Number(watchNum) || 0
......
......@@ -42,8 +42,8 @@ export default {
set_advertMiddle: 'set_advertMiddle'
}),
_initSwiper() {
let self = this;
let option = {
const self = this;
const option = {
direction: 'horizontal',
loop: true,
autoplay: self.list.length > 1 ? { delay: 5000 } : false
......@@ -51,7 +51,7 @@ export default {
this.swiper = new this.$swiper(this.$refs.swiper, option);
},
_close() {
let info = JSON.parse(JSON.stringify(this.advertMiddle));
const info = JSON.parse(JSON.stringify(this.advertMiddle));
info.status = false;
this.set_advertMiddle(info);
}
......
......@@ -42,8 +42,8 @@ export default {
set_advertTop: 'set_advertTop'
}),
_initSwiper() {
let self = this;
let option = {
const self = this;
const option = {
direction: 'vertical',
loop: true,
autoplay: self.list.length > 1 ? { delay: 5000 } : false
......@@ -51,7 +51,7 @@ export default {
this.swiper = new this.$swiper(this.$refs.swiper, option);
},
_close() {
let info = JSON.parse(JSON.stringify(this.advertTop));
const info = JSON.parse(JSON.stringify(this.advertTop));
info.status = false;
this.set_advertTop(info);
}
......
......@@ -44,14 +44,14 @@ export default {
uin: this.channelInfo.uin
});
if (res.code === 200 && res.errorCode === 0) {
let list = res.data || [];
const list = res.data || [];
this.list = list.filter(x => {
return x.display;
});
}
},
_changePlayer(url, id) {
let info = JSON.parse(JSON.stringify(this.playerInfo));
const info = JSON.parse(JSON.stringify(this.playerInfo));
info.playUrl = url;
info.cameraId = id;
this.set_playerInfo(info);
......
......@@ -23,7 +23,7 @@ export default {
advertMiddle: 'advertMiddle'
}),
commodity() {
let list = this.advertMiddle.list || [];
const list = this.advertMiddle.list || [];
return list.map(x => {
return {
e: null,
......
......@@ -76,7 +76,7 @@ export default {
isShowChat() {
let index = -1;
for (let i = 0; i < this.menuList.length; i++) {
let item = this.menuList[i];
const item = this.menuList[i];
if (item.menuType === 'chat') {
index = i;
}
......@@ -91,8 +91,8 @@ export default {
},
methods: {
_initSwiper() {
let self = this;
let option = {
const self = this;
const option = {
touchRatio: 0.5,
on: {
slideChange() {
......
......@@ -67,12 +67,12 @@ export default {
},
methods: {
getMore() {
let chatListBoxDom = this.$refs.chatListBox;
let chatListDom = this.$refs.chatList;
const chatListBoxDom = this.$refs.chatListBox;
const chatListDom = this.$refs.chatList;
if (chatListBoxDom && chatListDom) {
let boxHeight = chatListBoxDom.clientHeight;
let boxScrollTop = chatListBoxDom.scrollTop;
let listHeigth = chatListDom.clientHeight;
const boxHeight = chatListBoxDom.clientHeight;
const boxScrollTop = chatListBoxDom.scrollTop;
const listHeigth = chatListDom.clientHeight;
if (boxScrollTop <= 100) {
this.getChatList();
}
......@@ -96,8 +96,8 @@ export default {
});
if (res.code === 200 && res.errorCode === 0) {
let list = res.data || [];
let firstLi =
const list = res.data || [];
const firstLi =
document.querySelector('#chatList') && document.querySelector('#chatList').children[0];
list.forEach(item => {
this.addChat(item, true);
......@@ -106,7 +106,7 @@ export default {
if (this.page === 1) {
this._scrollBottom();
} else {
let chatListBoxDom = this.$refs.chatListBox;
const chatListBoxDom = this.$refs.chatListBox;
if (chatListBoxDom && firstLi) {
chatListBoxDom.scrollTop = firstLi.offsetTop;
}
......@@ -141,8 +141,8 @@ export default {
});
},
addChat(obj, order = false) {
let chatObj = obj;
let redType = [3, 8]; // msgType红包类型
const chatObj = obj;
const redType = [3, 8]; // msgType红包类型
this.list = this.list.filter(x => {
return Number(x.id) !== Number(chatObj.id);
});
......@@ -151,8 +151,8 @@ export default {
this.addRedList(chatObj, order);
}
if (this.list.length) {
let newTime = chatObj.addTime;
let prevTime = order ? this.list[0].addTime : this.list[this.list.length - 1].addTime;
const newTime = chatObj.addTime;
const prevTime = order ? this.list[0].addTime : this.list[this.list.length - 1].addTime;
if (Math.abs(newTime - prevTime) > 600) {
chatObj.showTime = true;
}
......@@ -175,12 +175,12 @@ export default {
this.delRedList(id);
},
_scrollKeep() {
let chatListBoxDom = this.$refs.chatListBox;
let chatListDom = this.$refs.chatList;
const chatListBoxDom = this.$refs.chatListBox;
const chatListDom = this.$refs.chatList;
if (chatListBoxDom && chatListDom) {
let boxHeight = chatListBoxDom.clientHeight;
let boxScrollTop = chatListBoxDom.scrollTop;
let listHeigth = chatListDom.clientHeight;
const boxHeight = chatListBoxDom.clientHeight;
const boxScrollTop = chatListBoxDom.scrollTop;
const listHeigth = chatListDom.clientHeight;
if (boxHeight + boxScrollTop > listHeigth - 250) {
this.$nextTick(() => {
chatListBoxDom.scrollTop = this.$refs.chatList.clientHeight;
......@@ -191,10 +191,10 @@ export default {
}
},
_scrollBottom() {
let chatListBoxDom = this.$refs.chatListBox;
let chatListDom = this.$refs.chatList;
const chatListBoxDom = this.$refs.chatListBox;
const chatListDom = this.$refs.chatList;
if (chatListBoxDom && chatListDom) {
let listHeigth = chatListDom.clientHeight;
const listHeigth = chatListDom.clientHeight;
chatListBoxDom.scrollTop = listHeigth;
}
},
......@@ -207,13 +207,13 @@ export default {
}
},
_scrollReply() {
let id = this.replyChatId;
let el = document.querySelectorAll(`[data-chatid="${id}"]`)[0];
const id = this.replyChatId;
const el = document.querySelectorAll(`[data-chatid="${id}"]`)[0];
if (!el) {
this._scrollBottom();
return false;
}
let scrollTop = el.offsetTop;
const scrollTop = el.offsetTop;
this.$refs.chatListBox.scrollTop = scrollTop;
this._closeReply();
},
......
......@@ -24,7 +24,7 @@ export default {
channelInfo: 'channelInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......
......@@ -29,7 +29,7 @@ export default {
userInfo: 'userInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......@@ -46,7 +46,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -29,7 +29,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -29,7 +29,7 @@ export default {
userInfo: 'userInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......@@ -46,7 +46,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -27,7 +27,7 @@ export default {
set_showRedInfo: 'set_showRedInfo'
}),
_showRed(type, id) {
let obj = {
const obj = {
type: type,
id: id
};
......
......@@ -47,7 +47,7 @@ export default {
channelInfo: 'channelInfo'
}),
userHead() {
let userHeadImg = this.info.userHeadImg;
const userHeadImg = this.info.userHeadImg;
if (userHeadImg === 'phoneHead') {
return this.channelInfo.defaultPhoneHeadAva;
} else if (userHeadImg === 'default') {
......@@ -61,7 +61,7 @@ export default {
},
methods: {
_reply(id, name) {
let obj = {
const obj = {
id: id,
name: name
};
......
......@@ -127,10 +127,10 @@ export default {
}
},
getMore() {
let wrapT = this.$refs.wrapBox.scrollTop;
let wrapH = this.$refs.wrapBox.clientHeight;
const wrapT = this.$refs.wrapBox.scrollTop;
const wrapH = this.$refs.wrapBox.clientHeight;
if (this.$refs.list) {
let listH = this.$refs.list.clientHeight;
const listH = this.$refs.list.clientHeight;
if (listH - wrapH - wrapT < 100) {
this.page++;
this._getList();
......
......@@ -64,7 +64,7 @@ export default {
}
},
_play(url) {
let info = JSON.parse(JSON.stringify(this.playerInfo));
const info = JSON.parse(JSON.stringify(this.playerInfo));
info.playUrl = url;
info.cameraId = '';
this.set_playerInfo(info);
......
......@@ -62,7 +62,7 @@ export default {
},
computed: {
newList() {
let list = this.list;
const list = this.list;
return list.sort((a, b) => {
if (this.sort) {
return new Date(b.createTime) - new Date(a.createTime);
......@@ -81,9 +81,9 @@ export default {
},
methods: {
getMore() {
let listBoxT = this.$refs.listBox && this.$refs.listBox.scrollTop;
let listBoxH = this.$refs.listBox && this.$refs.listBox.clientHeight;
let listH = this.$refs.list && this.$refs.list.clientHeight;
const listBoxT = this.$refs.listBox && this.$refs.listBox.scrollTop;
const listBoxH = this.$refs.listBox && this.$refs.listBox.clientHeight;
const listH = this.$refs.list && this.$refs.list.clientHeight;
if (listBoxT + listBoxH > listH - 100) {
this.getList();
}
......@@ -102,7 +102,7 @@ export default {
this.isMore = true;
if (res.code === 200 && res.errorCode === 0) {
this.count = res.data.count;
let data = res.data.list;
const data = res.data.list;
if (data.length < this.num) {
this.isMore = false;
}
......@@ -138,7 +138,7 @@ export default {
time: obj.time
});
if (res.code === 200 && res.errorCode === 0) {
let data = res.data;
const data = res.data;
if (
this.list.some(x => {
return Number(x.id) === Number(data.id);
......
......@@ -63,7 +63,7 @@ export default {
}
},
editShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
if (this.info.id === goodInfo.id) {
this.info = goodInfo;
......@@ -71,7 +71,7 @@ export default {
}
},
deleteShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
if (this.info.id === goodInfo.id) {
this.info = {};
......@@ -79,7 +79,7 @@ export default {
}
},
cancelShopBind(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
if (goodInfo.id.some(id => id === this.info.id)) {
this.info = {};
......@@ -87,13 +87,13 @@ export default {
}
},
setTopShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
this.info = goodInfo;
}
},
cancelTopShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
if (this.info.id === goodInfo.id) {
this.info = {};
......
......@@ -102,9 +102,9 @@ export default {
},
methods: {
getMore() {
let shopContainerTop = this.$refs.shopContainer && this.$refs.shopContainer.scrollTop;
let shopContainerHeight = this.$refs.shopContainer && this.$refs.shopContainer.clientHeight;
let shopBodHeight = this.$refs.shopBody && this.$refs.shopBody.clientHeight;
const shopContainerTop = this.$refs.shopContainer && this.$refs.shopContainer.scrollTop;
const shopContainerHeight = this.$refs.shopContainer && this.$refs.shopContainer.clientHeight;
const shopBodHeight = this.$refs.shopBody && this.$refs.shopBody.clientHeight;
if (shopContainerTop + shopContainerHeight > shopBodHeight - 100) {
this.getList();
}
......@@ -114,7 +114,7 @@ export default {
return false;
}
this.isAjax = false;
let res = await goodsList({
const res = await goodsList({
includeId: this.menuId,
uin: this.channelInfo.uin,
type: 1,
......@@ -123,7 +123,7 @@ export default {
});
this.isAjax = true;
if (res.code === 200 && res.errorCode === 0) {
let { list, count } = res.data;
const { list, count } = res.data;
this.addList(list, true);
this.count = count;
if (list.length < this.num) {
......@@ -134,7 +134,7 @@ export default {
}
},
addList(list, sort) {
let fList = list.filter(item => !this.list.some(x => x.id === item.id));
const fList = list.filter(item => !this.list.some(x => x.id === item.id));
if (sort) {
this.list = this.list.concat(fList);
} else {
......@@ -142,7 +142,7 @@ export default {
}
},
editShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
this.list = this.list.map(x => {
if (x.id === goodInfo.id) {
......@@ -153,19 +153,19 @@ export default {
}
},
deleteShop(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
this.list = this.list.filter(x => x.id !== goodInfo.id);
}
},
addShopBind(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
this.addList(goodInfo);
}
},
cancelShopBind(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
this.list = this.list.filter(x => {
return !goodInfo.id.some(id => id === x.id);
......@@ -173,7 +173,7 @@ export default {
}
},
changeSort(data) {
let { type, includeId, goodInfo } = data;
const { type, includeId, goodInfo } = data;
if (type === 1 && this.menuId === includeId) {
this.list = this.list.map(x => {
if (x.id === goodInfo.id) {
......
......@@ -26,7 +26,7 @@ export default {
}),
countDowmInfo() {
let time = 0;
let now = this.nowDate / 1000;
const now = this.nowDate / 1000;
if (now) {
time = this.channelInfo.liveBegin - now;
}
......
......@@ -52,7 +52,7 @@ export default {
playerInfo: 'playerInfo'
}),
isPeep() {
let peep = this.channelConfig.peep || {};
const peep = this.channelConfig.peep || {};
return !!peep.isEnable;
},
isDownTime() {
......@@ -78,7 +78,7 @@ export default {
return false;
},
mpsBackgroundUrl() {
let bgUrl = this.channelInfo.mpsBackgroundUrl;
const bgUrl = this.channelInfo.mpsBackgroundUrl;
return bgUrl ? `${bgUrl}?x-oss-process=style/twzb_origin` : '';
},
mpsOptions() {
......
......@@ -24,10 +24,10 @@ export default {
channelConfig: 'channelConfig'
}),
mark() {
let info = this.channelConfig.mark || {};
let position = info.position || { top: '10px', left: '10px' };
let positionNew = {};
for (let key in position) {
const info = this.channelConfig.mark || {};
const position = info.position || { top: '10px', left: '10px' };
const positionNew = {};
for (const key in position) {
if (key) {
positionNew[key] = `${position[key].replace('px', '') / 100}rem`;
}
......
......@@ -42,7 +42,7 @@ export default {
set_playerInfo: 'set_playerInfo'
}),
_backPlay() {
let info = JSON.parse(JSON.stringify(this.playerInfo));
const info = JSON.parse(JSON.stringify(this.playerInfo));
info.playUrl = info.saveUrl;
info.cameraId = '';
this.set_playerInfo(info);
......@@ -54,7 +54,7 @@ export default {
}
},
makeColor() {
let colorArray = '0123456789abcdef';
const colorArray = '0123456789abcdef';
let color = '';
for (let i = 0; i < 6; i++) {
color += colorArray[Math.floor(Math.random() * 16)];
......@@ -62,18 +62,18 @@ export default {
return color;
},
_sendBarrage(str) {
let content = str.replace(/(#)[\u4e00-\u9fa5A-Za-z0-9.]+(#)/gi, '');
const content = str.replace(/(#)[\u4e00-\u9fa5A-Za-z0-9.]+(#)/gi, '');
if (!this.mps || !content || !this.showBarrage || this.barrageInfo.status !== 1) {
return false;
}
let fontColor = this.barrageInfo.fontColor || 'FFFFFF';
let fontSize = this.barrageInfo.fontSize || 2;
let fontSpeed = this.barrageInfo.speed || 2;
let color = fontColor === 'random' ? this.makeColor() : fontColor;
let sizeArr = { '1': 12, '2': 16, '3': 22 };
let speedArr = { '1': 50, '2': 30, '3': 10 };
let size = sizeArr[fontSize] || 16;
let speed = speedArr[fontSpeed] || 30;
const fontColor = this.barrageInfo.fontColor || 'FFFFFF';
const fontSize = this.barrageInfo.fontSize || 2;
const fontSpeed = this.barrageInfo.speed || 2;
const color = fontColor === 'random' ? this.makeColor() : fontColor;
const sizeArr = { '1': 12, '2': 16, '3': 22 };
const speedArr = { '1': 50, '2': 30, '3': 10 };
const size = sizeArr[fontSize] || 16;
const speed = speedArr[fontSpeed] || 30;
this.mps.sendbarrage2(content, size, '#' + color, '', speed, '微软雅黑');
}
},
......
......@@ -61,7 +61,7 @@ export default {
uin: this.channelInfo.uin
});
if (res.code === 200 && res.errorCode === 0) {
let { customWatchNum, watchNum } = res.data;
const { customWatchNum, watchNum } = res.data;
this.watchNum = {
custom: Number(customWatchNum) || 0,
real: Number(watchNum) || 0
......
......@@ -46,8 +46,8 @@ export default {
showRedInfo: 'showRedInfo'
}),
list() {
let answerList = this.answerList || [];
let list = answerList.sort((a, b) => {
const answerList = this.answerList || [];
const list = answerList.sort((a, b) => {
return b.redpacketId - a.redpacketId;
});
return list;
......
......@@ -146,9 +146,9 @@ export default {
},
nextRed() {
this.del_answerList();
let nextInfo = this.answerList[this.redIndex - 1];
const nextInfo = this.answerList[this.redIndex - 1];
if (nextInfo) {
let id = nextInfo.redpacketId;
const id = nextInfo.redpacketId;
this.set_showRedInfo({
type: RED_TYPE,
id: id
......
......@@ -44,8 +44,8 @@ export default {
computed: {
hasSum() {
let sum = 0;
let detail = this.luckInfo.detail || {};
for (let key in detail) {
const detail = this.luckInfo.detail || {};
for (const key in detail) {
if (detail.hasOwnProperty(key)) {
sum += parseFloat(detail[key].amount);
}
......@@ -53,10 +53,10 @@ export default {
return sum;
},
bestUser() {
let arr = [];
let num = this.luckInfo.num || 1;
let detail = this.luckInfo.detail || {};
for (let key in detail) {
const arr = [];
const num = this.luckInfo.num || 1;
const detail = this.luckInfo.detail || {};
for (const key in detail) {
if (detail.hasOwnProperty(key)) {
arr.push(detail[key]);
}
......
......@@ -59,10 +59,10 @@ export default {
showRedInfo: 'showRedInfo'
}),
list() {
let arr = [];
let businessList = this.businessList;
const arr = [];
const businessList = this.businessList;
for (let i = 0; i < businessList.length; i++) {
let item = this.businessList[i];
const item = this.businessList[i];
if (item.isRob === 2) {
arr.push(item);
} else {
......@@ -73,9 +73,9 @@ export default {
},
rodNum() {
let num = 0;
let businessList = this.businessList;
const businessList = this.businessList;
for (let i = 0; i < businessList.length; i++) {
let item = this.businessList[i];
const item = this.businessList[i];
if (item.isExpire !== 1 && item.isRob !== 1 && item.isEmpty !== 0) {
num++;
}
......
......@@ -43,10 +43,10 @@ export default {
},
computed: {
bestUser() {
let arr = [];
let num = this.luckInfo.num || 1;
let detail = this.luckInfo.detail || {};
for (let key in detail) {
const arr = [];
const num = this.luckInfo.num || 1;
const detail = this.luckInfo.detail || {};
for (const key in detail) {
if (detail.hasOwnProperty(key)) {
arr.push(detail[key]);
}
......
......@@ -43,10 +43,10 @@ export default {
},
computed: {
bestUser() {
let arr = [];
let num = this.luckInfo.num || 1;
let detail = this.luckInfo.detail || {};
for (let key in detail) {
const arr = [];
const num = this.luckInfo.num || 1;
const detail = this.luckInfo.detail || {};
for (const key in detail) {
if (detail.hasOwnProperty(key)) {
arr.push(detail[key]);
}
......
......@@ -65,7 +65,7 @@ export default {
}
},
_shareSuspension() {
let shareList = this.$refs.shareItem;
const shareList = this.$refs.shareItem;
if (shareList) {
this.shareTimer.forEach(obj => {
clearInterval(obj);
......@@ -78,15 +78,15 @@ export default {
_position(dom) {
let x = Math.random() > 0.5 ? 1 : -1;
let y = Math.random() > 0.5 ? 1 : -1;
let AW = Math.floor(Math.random() * window.innerWidth);
let AH = Math.floor(Math.random() * window.innerHeight);
const AW = Math.floor(Math.random() * window.innerWidth);
const AH = Math.floor(Math.random() * window.innerHeight);
if (!dom.style.top) {
dom.style.top = AH + 'px';
}
if (!dom.style.left) {
dom.style.left = AW + 'px';
}
let tiemr = setInterval(function() {
const tiemr = setInterval(function() {
let top = parseInt(dom.offsetTop, 10);
let left = parseInt(dom.offsetLeft, 10);
y = top <= 0 ? 1 : top >= window.innerHeight - 30 ? -1 : y;
......
......@@ -47,11 +47,11 @@ export default {
}
},
emojiArr() {
let arr = [];
let num = 20;
for (let key in emoji_icon) {
const arr = [];
const num = 20;
for (const key in emoji_icon) {
if (emoji_icon.hasOwnProperty(key)) {
let index = parseInt((key - 1) / num, 10);
const index = parseInt((key - 1) / num, 10);
if (!arr[index]) {
arr[index] = [];
}
......@@ -70,7 +70,7 @@ export default {
methods: {
_initSwiper() {
if (!this.swiper) {
let option = {
const option = {
direction: 'horizontal',
pagination: {
el: this.$refs.emojiPagination
......@@ -84,7 +84,7 @@ export default {
},
_remText() {
let text = this.content;
let reg = /(#)[\u4e00-\u9fa5A-Za-z0-9.]+(#)$/;
const reg = /(#)[\u4e00-\u9fa5A-Za-z0-9.]+(#)$/;
if (text) {
if (text.match(reg) != null) {
text = text.replace(reg, '');
......
......@@ -56,7 +56,7 @@ export default {
jumpUrls: 'jumpUrls'
}),
isQuestionnaire() {
let info = this.channelConfig.questionnaire || {};
const info = this.channelConfig.questionnaire || {};
return info;
}
},
......@@ -80,13 +80,13 @@ export default {
}
},
_uploadImg(e) {
let self = this;
let input = e.target;
const self = this;
const input = e.target;
if (!input.value) {
return false;
}
if (input.files && input.files[0]) {
let reader = new FileReader();
const reader = new FileReader();
reader.onload = function() {
self._createCanvas(reader.result);
input.value = '';
......@@ -95,18 +95,18 @@ export default {
}
},
_createCanvas(src) {
let self = this;
let canvas = document.createElement('canvas');
let cxt = canvas.getContext('2d');
let img = new Image();
const self = this;
const canvas = document.createElement('canvas');
const cxt = canvas.getContext('2d');
const img = new Image();
img.src = src;
let maxW = window.innerWidth > 300 ? window.innerWidth : 300;
let maxH = window.innerHeight > 300 ? window.innerHeight : 300;
const maxW = window.innerWidth > 300 ? window.innerWidth : 300;
const maxH = window.innerHeight > 300 ? window.innerHeight : 300;
img.onload = function() {
let w = img.width;
let h = img.height;
if (w > maxW || h > maxH) {
let p = w / maxW > h / maxH ? w / maxW : h / maxH;
const p = w / maxW > h / maxH ? w / maxW : h / maxH;
w = img.width / p;
h = img.height / p;
img.width = w;
......@@ -115,20 +115,20 @@ export default {
canvas.width = w;
canvas.height = h;
cxt.drawImage(img, 0, 0, w, h);
let newsrc = canvas.toDataURL('image/jpeg', 0.9);
const newsrc = canvas.toDataURL('image/jpeg', 0.9);
self._sendPhoto(newsrc);
};
},
_uplaod() {
let self = this;
const self = this;
if (UserAgent.isWx()) {
let wx = window.wx;
const wx = window.wx;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
let localIds = res.localIds;
const localIds = res.localIds;
wx.uploadImage({
localId: localIds[0],
success(e) {
......
......@@ -20,7 +20,7 @@ export default {
showRedInfo: 'showRedInfo'
}),
shareConfig() {
let self = this;
const self = this;
return {
title: this.channelInfo.shareTitle || this.channelInfo.channelName,
desc: this.channelInfo.shareSubTitle || window.location.href,
......@@ -80,7 +80,7 @@ export default {
},
// 微信分享init
_InitWXShare() {
let self = this;
const self = this;
window.wx.ready(() => {
window.wx.onMenuShareTimeline(self.shareConfig);
window.wx.onMenuShareAppMessage(self.shareConfig);
......
......@@ -329,8 +329,8 @@ const allSkin = {
jieri_61
};
const skin = color => {
let layoutColor = color;
let defStyle = allSkin.def;
const layoutColor = color;
const defStyle = allSkin.def;
let style = '';
if (layoutColor) {
if (layoutColor.indexOf('#') !== -1) {
......@@ -339,7 +339,7 @@ const skin = color => {
style = allSkin[layoutColor];
}
}
let styleHtml = `
const styleHtml = `
:root{
${style || defStyle}
}
......
......@@ -83,23 +83,23 @@ export default {
userInfo: 'userInfo'
}),
isOffice() {
let info = this.channelConfig.officeLive || {};
const info = this.channelConfig.officeLive || {};
return info.isEnable === 1;
},
isDraw() {
return this.channelInfo.drawStatus === 1;
},
isInvitation() {
let info = this.channelConfig.invitation || {};
const info = this.channelConfig.invitation || {};
return info.isInvitation === 1;
},
isReward() {
let rewardStatus = this.channelInfo.rewardStatus;
let rewardGiftStatus = this.channelInfo.rewardGiftStatus;
const rewardStatus = this.channelInfo.rewardStatus;
const rewardGiftStatus = this.channelInfo.rewardGiftStatus;
return rewardStatus === 1 || rewardGiftStatus === 1;
},
isPraise() {
let info = this.channelConfig.praise;
const info = this.channelConfig.praise;
if (info) {
return info.isEnable === 1;
} else {
......@@ -107,7 +107,7 @@ export default {
}
},
redPacketFilterButton() {
let info = this.channelConfig.redPacketFilterButton || {};
const info = this.channelConfig.redPacketFilterButton || {};
return info.isEnable === 1;
},
isToggle() {
......
......@@ -39,7 +39,7 @@ export default {
}
},
_jump() {
let info = JSON.parse(JSON.stringify(this.welcomeInfo));
const info = JSON.parse(JSON.stringify(this.welcomeInfo));
info.imgState = 2;
this.set_welcomeInfo(info);
}
......
......@@ -15,8 +15,8 @@ const mixin = {
channelConfig: 'channelConfig'
}),
isFront() {
let info = this.channelConfig.questionnaire || {};
let { isEnable, isFront } = info;
const info = this.channelConfig.questionnaire || {};
const { isEnable, isFront } = info;
return isEnable && isFront;
}
},
......@@ -32,11 +32,11 @@ const mixin = {
referralUrl: window.location.href
});
if (questionnaireHasRes.code === 200 && questionnaireHasRes.errorCode === 0) {
let { url: questionnaire_url, isJoin } = questionnaireHasRes.data;
const { url: questionnaire_url, isJoin } = questionnaireHasRes.data;
if (noback) {
if (isJoin === 0 && questionnaire_url) {
if (!this.userInfo.id) {
let loginUrl = `${this.jumpUrls.login_noback}${encodeURIComponent(
const loginUrl = `${this.jumpUrls.login_noback}${encodeURIComponent(
questionnaire_url
)}`;
window.location.replace(loginUrl);
......
......@@ -93,7 +93,7 @@ export default {
this.showEdit = true;
},
del(id) {
let self = this;
const self = this;
this.$layer.sConfirm({
title: '提示',
msg: '是否删除该地址?',
......
......@@ -102,9 +102,9 @@ export default {
},
computed: {
provinceList() {
let province = this.cityData[100000];
let arr = [];
for (let key in province) {
const province = this.cityData[100000];
const arr = [];
for (const key in province) {
if (province[key]) {
arr.push({
val: key,
......@@ -115,9 +115,9 @@ export default {
return arr;
},
cityList() {
let city = this.cityData[this.changeCity.province] || {};
let arr = [];
for (let key in city) {
const city = this.cityData[this.changeCity.province] || {};
const arr = [];
for (const key in city) {
if (city[key]) {
arr.push({
val: key,
......@@ -128,9 +128,9 @@ export default {
return arr;
},
areaList() {
let area = this.cityData[this.changeCity.city] || {};
let arr = [];
for (let key in area) {
const area = this.cityData[this.changeCity.city] || {};
const arr = [];
for (const key in area) {
if (area[key]) {
arr.push({
val: key,
......@@ -166,8 +166,8 @@ export default {
this.changeCity.province = '';
this.changeCity.city = '';
this.changeCity.area = '';
let address = this.address || '浙江省-杭州市-西湖区';
let arr = address.split('-');
const address = this.address || '浙江省-杭州市-西湖区';
const arr = address.split('-');
for (let i = 0; i < this.provinceList.length; i++) {
if (this.provinceList[i].name === arr[0]) {
this.changeCity.province = this.provinceList[i].val;
......@@ -258,7 +258,7 @@ export default {
},
touchMove(e, type) {
e.preventDefault();
let y = e.targetTouches[0].pageY - this.pageY;
const y = e.targetTouches[0].pageY - this.pageY;
this.pageY = e.targetTouches[0].pageY;
this.translateY = y + this.translateY;
switch (type) {
......@@ -317,10 +317,10 @@ export default {
this.$emit('input', false);
},
sub() {
let province = this.cityData[100000][this.changeCity.province] || '';
let city = this.cityData[this.changeCity.province][this.changeCity.city] || '';
let area = this.cityData[this.changeCity.city][this.changeCity.area] || '';
let address = `${province}-${city}-${area}`;
const province = this.cityData[100000][this.changeCity.province] || '';
const city = this.cityData[this.changeCity.province][this.changeCity.city] || '';
const area = this.cityData[this.changeCity.city][this.changeCity.area] || '';
const address = `${province}-${city}-${area}`;
this.$emit('setCity', false, {
address: address,
province: province,
......
......@@ -38,9 +38,9 @@ export default {
confStr() {
let str = '';
for (let i = 0; i < this.choiceList.length; i++) {
let listItem = this.choiceList[i];
const listItem = this.choiceList[i];
for (let j = 0; j < listItem.spec_value.length; j++) {
let item = listItem.spec_value[j];
const item = listItem.spec_value[j];
if (item.select) {
str += str ? `,${item.name}` : item.name;
}
......
......@@ -46,9 +46,9 @@ export default {
confStr() {
let str = '';
for (let i = 0; i < this.choiceList.length; i++) {
let listItem = this.choiceList[i];
const listItem = this.choiceList[i];
for (let j = 0; j < listItem.spec_value.length; j++) {
let item = listItem.spec_value[j];
const item = listItem.spec_value[j];
if (item.select) {
str += str ? `,${item.name}` : item.name;
}
......
......@@ -86,9 +86,9 @@ export default {
},
goodsKey() {
let keyStr = '';
let choiceList = this.choiceList || [];
const choiceList = this.choiceList || [];
choiceList.forEach(choiceItem => {
let spec_value = choiceItem.spec_value || [];
const spec_value = choiceItem.spec_value || [];
spec_value.forEach(item => {
if (item.select) {
keyStr = keyStr ? `${keyStr}:${item.key}` : item.key;
......@@ -98,9 +98,9 @@ export default {
return keyStr;
},
goodsInfo() {
let shopInfo = this.shopInfo || {};
let goodsList = shopInfo.specInfo || {};
let goodsInfo = goodsList[this.goodsKey] || {
const shopInfo = this.shopInfo || {};
const goodsList = shopInfo.specInfo || {};
const goodsInfo = goodsList[this.goodsKey] || {
price: shopInfo.price,
stock: shopInfo.stock
};
......@@ -114,7 +114,7 @@ export default {
setChoiceList() {
let choiceList = this.shopInfo.spec || [];
choiceList = choiceList.map(choiceItem => {
let spec_value = choiceItem.spec_value || [];
const spec_value = choiceItem.spec_value || [];
return {
id: choiceItem.id,
name: choiceItem.name,
......@@ -133,7 +133,7 @@ export default {
changeChoice(choiceItem, itemId) {
for (let i = 0; i < choiceItem.spec_value.length; i++) {
if (choiceItem.spec_value[i].id === itemId) {
let select = !choiceItem.spec_value[i].select;
const select = !choiceItem.spec_value[i].select;
choiceItem.spec_value[i].select = select;
} else {
choiceItem.spec_value[i].select = false;
......@@ -141,7 +141,7 @@ export default {
}
},
sub() {
let goodsKeyLen = this.goodsKey ? this.goodsKey.split(':').length : 0;
const goodsKeyLen = this.goodsKey ? this.goodsKey.split(':').length : 0;
if (this.choiceList.length && goodsKeyLen !== this.choiceList.length) {
this.$layer.msg('请选择商品分类!');
return false;
......
......@@ -77,7 +77,7 @@ export default {
},
methods: {
async getGoodsMsg() {
let res = await getGoodsMsg({
const res = await getGoodsMsg({
uin: this.channelInfo.uin,
goodsId: this.goodsId
});
......
......@@ -101,7 +101,7 @@ export default {
}
},
changeAddressInfo() {
let arr = this.addressList.filter(item => {
const arr = this.addressList.filter(item => {
return item.id === this.addressId;
});
return arr[0] || this.addressList[0] || {};
......@@ -138,20 +138,20 @@ export default {
payType: 1
});
if (res.code === 200 && res.errorCode === 0) {
let { tradeType, prepayInfo } = res.data;
let { uin } = this.channelInfo;
const { tradeType, prepayInfo } = res.data;
const { uin } = this.channelInfo;
if (res.data.url) {
window.location.href = res.data.url;
} else if (tradeType === 'MWEB') {
let wxh5pay = `https://web.guangdianyun.tv/pay/wxh5pay?uin=${uin}`;
let backUrl = encodeURIComponent(window.location.href);
let transferUrl = encodeURIComponent(`${wxh5pay}&url=${backUrl}`);
let payUrl = encodeURIComponent(`${prepayInfo.mweb_url}&redirect_url=${transferUrl}`);
let url = `${wxh5pay}&url=${payUrl}`;
const wxh5pay = `https://web.guangdianyun.tv/pay/wxh5pay?uin=${uin}`;
const backUrl = encodeURIComponent(window.location.href);
const transferUrl = encodeURIComponent(`${wxh5pay}&url=${backUrl}`);
const payUrl = encodeURIComponent(`${prepayInfo.mweb_url}&redirect_url=${transferUrl}`);
const url = `${wxh5pay}&url=${payUrl}`;
window.location.href = url;
} else if (tradeType === 'JSAPI') {
let data = encodeURIComponent(JSON.stringify(res.data));
let url = `//web.guangdianyun.tv/pay/wxpay?uin=${uin}&payconfig=${data}`;
const data = encodeURIComponent(JSON.stringify(res.data));
const url = `//web.guangdianyun.tv/pay/wxpay?uin=${uin}&payconfig=${data}`;
window.location.href = url;
} else {
this.$layer.msg('网络错误,请稍后重试!');
......
......@@ -35,8 +35,8 @@ export default {
this.isShow = false;
},
_copy() {
let self = this;
let clipboardObj = new Clipboard('#copySourceCommand', {
const self = this;
const clipboardObj = new Clipboard('#copySourceCommand', {
text: () => {
return this.content;
}
......
......@@ -21,14 +21,14 @@ export default {
channelInfo: 'channelInfo'
}),
countDowm() {
let now = this.nowDate / 1000;
const now = this.nowDate / 1000;
if (!this.info.id) {
return '未开始';
}
if (this.info.endTime <= now) {
return '已结束';
} else if (this.info.startTime >= now) {
let time = this.info.startTime - now;
const time = this.info.startTime - now;
return this.$options.filters.formatTime(time, 'mm:ss');
} else {
return '进行中';
......@@ -40,10 +40,10 @@ export default {
if (!this.userInfo.id) {
this.$Bus.$emit('bus-showLogin', true);
} else {
let { previewUrl } = this.info;
let channelId = this.channelInfo.id;
let type = this.type;
let backUrl = encodeURIComponent(window.location.href);
const { previewUrl } = this.info;
const channelId = this.channelInfo.id;
const type = this.type;
const backUrl = encodeURIComponent(window.location.href);
window.location.href = `${previewUrl}&stype=${type}&sid=${channelId}&backUrl=${backUrl}`;
}
}
......
......@@ -29,10 +29,10 @@ export default {
this.$layer.msg('请先登录');
this.$Bus.$emit('bus-showLogin', true);
} else {
let uin = this.channelInfo.uin;
let channelId = this.channelInfo.id;
let type = this.type;
let watchUrl = `${window.location.origin}${window.location.pathname}?uin=${uin}`;
const uin = this.channelInfo.uin;
const channelId = this.channelInfo.id;
const type = this.type;
const watchUrl = `${window.location.origin}${window.location.pathname}?uin=${uin}`;
window.location.href = `/invite/?id=${channelId}&uin=${uin}&type=${type}&watchUrl=${encodeURIComponent(
watchUrl
)}`;
......
......@@ -59,8 +59,8 @@ export default {
},
pageUrlRule() {
if (this.form.pageUrlRule) {
let sql = this.form.name.split('.');
let type = sql[sql.length - 1];
const sql = this.form.name.split('.');
const type = sql[sql.length - 1];
let pagePath = this.form.currentPage;
if (type === 'xlsx' || type === 'xls') {
pagePath = `s1/${this.form.currentPage}`;
......@@ -89,8 +89,8 @@ export default {
};
},
_copy() {
let self = this;
let clipboardObj = new Clipboard('#copyDownUrl', {
const self = this;
const clipboardObj = new Clipboard('#copyDownUrl', {
text: () => {
return this.form.downUrl;
}
......@@ -110,11 +110,11 @@ export default {
this.full = !this.full;
},
_prev() {
let page = this.form.currentPage - 1;
const page = this.form.currentPage - 1;
this.form.currentPage = page <= 1 ? 1 : page;
},
_next() {
let page = this.form.currentPage + 1;
const page = this.form.currentPage + 1;
this.form.currentPage = page >= this.form.pageCount ? this.form.pageCount : page;
},
_colse() {
......
......@@ -36,8 +36,8 @@ export default {
id: this.channelInfo.id
});
if (res.code === 200 && res.errorCode === 0) {
let praiseNum = Number(res.data.praiseNum) || 0;
let customPraiseNum = Number(res.data.customPraiseNum) || 0;
const praiseNum = Number(res.data.praiseNum) || 0;
const customPraiseNum = Number(res.data.customPraiseNum) || 0;
this.praiseTotal = praiseNum + customPraiseNum;
}
},
......@@ -78,8 +78,8 @@ export default {
}
},
_add(type) {
let div = document.createElement('div');
let a = Math.floor(Math.random() * 7);
const div = document.createElement('div');
const a = Math.floor(Math.random() * 7);
div.style.backgroundPosition = `-${a * 0.6}rem 0`;
div.style.transform = `matrix(1, 0, 0, 1, 0, 0)`;
this.$refs.praisBox.appendChild(div);
......
......@@ -41,20 +41,20 @@ export default {
payType: 1
});
if (res.code === 200 && res.errorCode === 0) {
let { tradeType, prepayInfo } = res.data;
let { uin } = this.channelInfo;
const { tradeType, prepayInfo } = res.data;
const { uin } = this.channelInfo;
if (res.data.url) {
window.location.href = res.data.url;
} else if (tradeType === 'MWEB') {
let wxh5pay = `https://web.guangdianyun.tv/pay/wxh5pay?uin=${uin}`;
let backUrl = encodeURIComponent(window.location.href);
let transferUrl = encodeURIComponent(`${wxh5pay}&url=${backUrl}`);
let payUrl = encodeURIComponent(`${prepayInfo.mweb_url}&redirect_url=${transferUrl}`);
let url = `${wxh5pay}&url=${payUrl}`;
const wxh5pay = `https://web.guangdianyun.tv/pay/wxh5pay?uin=${uin}`;
const backUrl = encodeURIComponent(window.location.href);
const transferUrl = encodeURIComponent(`${wxh5pay}&url=${backUrl}`);
const payUrl = encodeURIComponent(`${prepayInfo.mweb_url}&redirect_url=${transferUrl}`);
const url = `${wxh5pay}&url=${payUrl}`;
window.location.href = url;
} else if (tradeType === 'JSAPI') {
let data = encodeURIComponent(JSON.stringify(res.data));
let url = `//web.guangdianyun.tv/pay/wxpay?uin=${uin}&payconfig=${data}`;
const data = encodeURIComponent(JSON.stringify(res.data));
const url = `//web.guangdianyun.tv/pay/wxpay?uin=${uin}&payconfig=${data}`;
window.location.href = url;
} else {
this.$layer.msg('网络错误,请稍后重试!');
......
......@@ -45,12 +45,12 @@ export default {
userInfo: 'userInfo'
}),
giftInfo() {
let list = this.list || [];
const list = this.list || [];
return list[this.changeIndex] || {};
},
priceSum() {
if (this.giftInfo.id) {
let price = Number(this.giftInfo.price) || 0;
const price = Number(this.giftInfo.price) || 0;
return (price * this.giftNum).toFixed(2);
} else {
return 0;
......@@ -82,7 +82,7 @@ export default {
}
},
_setCount(step) {
let num = Number(this.giftNum) + step;
const num = Number(this.giftNum) + step;
this.giftNum = num;
},
async _giftReward() {
......@@ -95,20 +95,20 @@ export default {
payType: 1
});
if (res.code === 200 && res.errorCode === 0) {
let { tradeType, prepayInfo } = res.data;
let { uin } = this.channelInfo;
const { tradeType, prepayInfo } = res.data;
const { uin } = this.channelInfo;
if (res.data.url) {
window.location.href = res.data.url;
} else if (tradeType === 'MWEB') {
let wxh5pay = `https://web.guangdianyun.tv/pay/wxh5pay?uin=${uin}`;
let backUrl = encodeURIComponent(window.location.href);
let transferUrl = encodeURIComponent(`${wxh5pay}&url=${backUrl}`);
let payUrl = encodeURIComponent(`${prepayInfo.mweb_url}&redirect_url=${transferUrl}`);
let url = `${wxh5pay}&url=${payUrl}`;
const wxh5pay = `https://web.guangdianyun.tv/pay/wxh5pay?uin=${uin}`;
const backUrl = encodeURIComponent(window.location.href);
const transferUrl = encodeURIComponent(`${wxh5pay}&url=${backUrl}`);
const payUrl = encodeURIComponent(`${prepayInfo.mweb_url}&redirect_url=${transferUrl}`);
const url = `${wxh5pay}&url=${payUrl}`;
window.location.href = url;
} else if (tradeType === 'JSAPI') {
let data = encodeURIComponent(JSON.stringify(res.data));
let url = `//web.guangdianyun.tv/pay/wxpay?uin=${uin}&payconfig=${data}`;
const data = encodeURIComponent(JSON.stringify(res.data));
const url = `//web.guangdianyun.tv/pay/wxpay?uin=${uin}&payconfig=${data}`;
window.location.href = url;
} else {
this.$layer.msg('网络错误,请稍后重试!');
......@@ -118,7 +118,7 @@ export default {
},
watch: {
giftNum(nVal) {
let num = nVal > 999 ? 999 : nVal < 1 ? 1 : nVal;
const num = nVal > 999 ? 999 : nVal < 1 ? 1 : nVal;
this.giftNum = parseInt(num, 10);
}
}
......
......@@ -25,8 +25,8 @@ export default {
if (!this.userInfo.id) {
this.$Bus.$emit('bus-showLogin', true);
} else {
let id = this.info.id;
let uin = this.channelInfo.uin;
const id = this.info.id;
const uin = this.channelInfo.uin;
window.location.href = `/vote/?id=${id}&uin=${uin}`;
}
}
......
......@@ -48,7 +48,7 @@ export default {
jumpUrls: 'jumpUrls'
}),
isPeep() {
let peep = this.channelConfig.peep || {};
const peep = this.channelConfig.peep || {};
return !!peep.isEnable;
}
},
......@@ -72,7 +72,7 @@ export default {
uin: this.channelInfo.uin
});
if (res.code === 200 && res.errorCode === 0) {
let info = res.data.watchUserInfo;
const info = res.data.watchUserInfo;
if (!info.id && this.isPeep) {
this._toggleLogin(true);
return false;
......
......@@ -24,7 +24,7 @@ export default {
channelConfig: 'channelConfig'
}),
watchWhite() {
let watchWhiteList = this.channelConfig.watchWhiteList || {};
const watchWhiteList = this.channelConfig.watchWhiteList || {};
return watchWhiteList;
},
tokenKey() {
......@@ -39,8 +39,8 @@ export default {
set_white: 'set_white'
}),
async get_watchWhite() {
let watchObj = this.$cookie.get(this.tokenKey) || '{}';
let { ticket, code } = JSON.parse(watchObj);
const watchObj = this.$cookie.get(this.tokenKey) || '{}';
const { ticket, code } = JSON.parse(watchObj);
if (ticket) {
const res = await checkWatchList({
uin: this.channelInfo.uin,
......
const packageEnv = require('../package.json');
/* sentry */
function getEnv() {
let env = process.env.mode || '';
const env = process.env.mode || '';
let environment = '';
switch (env) {
case 'test':
......
......@@ -5,8 +5,8 @@
import REPORT from '@/plugins/report';
export default {
async mounted() {
let uin = this.$route.query.uin;
let id = this.$route.params.id;
const uin = this.$route.query.uin;
const id = this.$route.params.id;
REPORT(this.$sentry, { AppId: id, Uin: uin });
}
};
......
......@@ -19,7 +19,7 @@ service.interceptors.request.use(
config.headers['token'] =
Cookie.get('token') || Cookie.get('BCC_PROGRAM_USER_LOGIN_TOKEN') || '';
}
let noMsg = config.headers['noMsg'] || '';
const noMsg = config.headers['noMsg'] || '';
if (config.headers.hasOwnProperty('noMsg')) {
delete config.headers['noMsg'];
}
......@@ -66,7 +66,7 @@ service.interceptors.response.use(
);
const get = (url, params, config = {}) => {
let default_config = {
const default_config = {
method: 'get',
url: url,
params: params,
......@@ -75,7 +75,7 @@ const get = (url, params, config = {}) => {
return service(default_config);
};
const post = (url, data, config = {}) => {
let default_config = {
const default_config = {
method: 'post',
url: url,
data: qs.stringify(data),
......
......@@ -12,9 +12,9 @@ function getTarget(dom) {
}
Vue.directive("transfer-dom", {
inserted(el, { value }, vnode) {
let parentNode = el.parentNode;
const parentNode = el.parentNode;
if (!parentNode) return;
let home = document.createComment("");
const home = document.createComment("");
let hasMovedOut = false;
if (value !== false) {
......@@ -32,11 +32,11 @@ Vue.directive("transfer-dom", {
}
},
componentUpdated(el, { value }) {
let ref$1 = el.__transferDomData;
const ref$1 = el.__transferDomData;
if (!ref$1) return;
let parentNode = ref$1.parentNode;
let home = ref$1.home;
let hasMovedOut = ref$1.hasMovedOut;
const parentNode = ref$1.parentNode;
const home = ref$1.home;
const hasMovedOut = ref$1.hasMovedOut;
if (!hasMovedOut && value) {
parentNode.replaceChild(home, el);
......@@ -56,7 +56,7 @@ Vue.directive("transfer-dom", {
}
},
unbind(el) {
let ref$1 = el.__transferDomData;
const ref$1 = el.__transferDomData;
if (!ref$1) return;
if (el.__transferDomData.hasMovedOut === true) {
el.__transferDomData.parentNode &&
......
import icons from './icons';
export default str => {
let text = str;
for (let key in icons) {
for (const key in icons) {
if (icons[key]) {
let reg = new RegExp(`#${icons[key]}#`, 'ig');
const reg = new RegExp(`#${icons[key]}#`, 'ig');
text = text.replace(
reg,
`<img class="emoji" src="${process.env.DEF_OSS}/static/emoji/newqq/${key}.gif">`
......
......@@ -3,8 +3,8 @@ export default (time, fmt) => {
if (!time) {
return "";
}
let date = new Date(parseInt(time, 10));
let o = {
const date = new Date(parseInt(time, 10));
const o = {
"y+": date.getFullYear(),
"M+": date.getMonth() + 1,
"d+": date.getDate(),
......@@ -13,7 +13,7 @@ export default (time, fmt) => {
"s+": date.getSeconds()
};
for (let k in o) {
for (const k in o) {
if (new RegExp(`(${k})`).test(format)) {
let str = o[k] + "";
str = str.length > 1 ? str : 0 + str;
......
let msg = (message = '提示', time = 1500) => {
let div = document.createElement('div');
const msg = (message = '提示', time = 1500) => {
const div = document.createElement('div');
div.className = 's-layer';
div.innerHTML = `<div class="s-layer-tips">${message}</>`;
document.body.appendChild(div);
......@@ -9,16 +9,16 @@ let msg = (message = '提示', time = 1500) => {
}, time);
}
};
let close = () => {
let layer = document.querySelectorAll('.s-layer');
const close = () => {
const layer = document.querySelectorAll('.s-layer');
layer.forEach(item => {
document.body.removeChild(item);
});
};
let sConfirm = conf => {
let title = conf.title ? conf.title : '提示';
let message = conf.msg ? conf.msg : '提示';
let div = document.createElement('div');
const sConfirm = conf => {
const title = conf.title ? conf.title : '提示';
const message = conf.msg ? conf.msg : '提示';
const div = document.createElement('div');
div.className = 's-layer';
div.innerHTML = `<div class="s-layer-confirm">
<div class="s-layer-box">
......
......@@ -16,9 +16,9 @@ const mixin = {
}),
reportDms() {
let dms = '';
let menuList = this.menuList || [];
const menuList = this.menuList || [];
for (let i = 0; i < menuList.length; i++) {
let item = menuList[i];
const item = menuList[i];
if (item.menuType === 'report' && item.menuInfo) {
dms = `pic_text_${item.menuInfo}`;
}
......@@ -26,7 +26,7 @@ const mixin = {
return dms;
},
otherTopic() {
let channelInfo = this.channelInfo || {};
const channelInfo = this.channelInfo || {};
return {
audience: `dms_${channelInfo.uin}_audience`,
config: `channel_config_${channelInfo.id}`
......@@ -57,15 +57,15 @@ const mixin = {
},
_makeClientId() {
ROP.Leave();
let uin = this.channelInfo.uin || '0';
let channelId = this.channelInfo.id || '0';
let timeStr = String(new Date().getTime() + Math.floor(Math.random() * 100000));
let clientId = `${uin}_${channelId}_${timeStr}`;
const uin = this.channelInfo.uin || '0';
const channelId = this.channelInfo.id || '0';
const timeStr = String(new Date().getTime() + Math.floor(Math.random() * 100000));
const clientId = `${uin}_${channelId}_${timeStr}`;
console.log(clientId);
ROP.Enter('', this.channelInfo.sub_key, clientId, true);
},
_DMSInit() {
let self = this;
const self = this;
// chat连接成功后的消息
ROP.On('enter_suc', function() {
console.log('服务器连接成功');
......@@ -94,7 +94,7 @@ const mixin = {
});
// chat接收到的消息
ROP.On('publish_data', function(res, topic) {
let data = JSON.parse(res);
const data = JSON.parse(res);
switch (topic) {
case self.channelInfo.dmsTopic:
case self.channelInfo.dmsRewardTopic:
......@@ -130,14 +130,14 @@ const mixin = {
},
_dmsChat(data) {
if (data.cmd === 'watchCode') {
let tokenKey = `white-${this.type}-${this.channelInfo.id}`;
const tokenKey = `white-${this.type}-${this.channelInfo.id}`;
if (data.clearAll === 1) {
this.set_white(true);
this.$cookie.remove(tokenKey);
} else {
let watchObj = this.$cookie.get(tokenKey) || '{}';
let { ticket, code } = JSON.parse(watchObj);
let watchData = data.watchData;
const watchObj = this.$cookie.get(tokenKey) || '{}';
const { ticket, code } = JSON.parse(watchObj);
const watchData = data.watchData;
if (watchData.ticket === ticket && watchData.code === code) {
this.set_white(true);
this.$cookie.remove(tokenKey);
......@@ -194,34 +194,34 @@ const mixin = {
}
if (data.cmd === 'chatDisable') {
// 是否全员禁言
let info = JSON.parse(JSON.stringify(this.channelInfo));
const info = JSON.parse(JSON.stringify(this.channelInfo));
info.chatDisable = data.status;
this.set_channelInfo(info);
return false;
}
if (data.cmd === 'chatLogin') {
// 是否禁止游客聊天
let info = JSON.parse(JSON.stringify(this.channelInfo));
const info = JSON.parse(JSON.stringify(this.channelInfo));
info.chatLogin = data.status;
this.set_channelInfo(info);
}
if (data.cmd === 'chatSee') {
// 聊天是否自己可见
let info = JSON.parse(JSON.stringify(this.channelInfo));
const info = JSON.parse(JSON.stringify(this.channelInfo));
info.chatSee = data.status;
this.set_channelInfo(info);
return false;
}
if (data.cmd === 'chatCountStatus') {
// 是否显示聊天数
let info = JSON.parse(JSON.stringify(this.channelInfo));
const info = JSON.parse(JSON.stringify(this.channelInfo));
info.chatCountStatus = data.status;
this.set_channelInfo(info);
return false;
}
if (data.cmd === 'living') {
// 开启结束直播
let info = JSON.parse(JSON.stringify(this.channelInfo));
const info = JSON.parse(JSON.stringify(this.channelInfo));
info.liveStatus = data.status;
this.set_channelInfo(info);
return false;
......@@ -244,7 +244,7 @@ const mixin = {
// 删除聊天
if (typeof data.id === 'string') {
let ids = data.id.split(',');
const ids = data.id.split(',');
ids.forEach(item => {
this.$Bus.$emit('bus-delTopChat', Number(item));
this.$Bus.$emit('bus-delChat', Number(item));
......@@ -320,18 +320,18 @@ const mixin = {
}
},
_dmsAudience(data) {
let ids = data.ids.map(x => Number(x));
const ids = data.ids.map(x => Number(x));
if (ids.indexOf(Number(this.userInfo.id)) === -1) {
return false;
}
if (data.cmd === 'disableChat') {
let info = JSON.parse(JSON.stringify(this.userInfo));
const info = JSON.parse(JSON.stringify(this.userInfo));
info.isDisableChat = Number(data.isDisable);
this.set_userInfo(info);
return false;
}
if (data.cmd === 'setStatus') {
let info = JSON.parse(JSON.stringify(this.userInfo));
const info = JSON.parse(JSON.stringify(this.userInfo));
info.status = Number(data.status);
this.set_userInfo(info);
return false;
......@@ -339,8 +339,8 @@ const mixin = {
},
_dmsChannelConfig(data) {
if (data.cmd === 'commodity') {
let list = [];
let { cad } = data;
const list = [];
const { cad } = data;
if (cad) {
list.push(cad);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment