Commit d972afde by Lays-lzq

Merge branch 'dev'

parents 485738a8 8bd86519
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
import { get, post } from '@/api/request' import { get, post } from '@/api/request'
import CONFIG from '@/config' import CONFIG from '@/config'
const { env, privateDomain } = CONFIG const { privateDomain } = CONFIG
const flag = env || CONFIG.private const flag = process.env.X_CA_STAGE
// 获取地址列表 // 获取地址列表
export const getAddressList = data => export const getAddressList = data =>
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
/* /*
1# 模块分割命名请使用与模块内容较为贴近的命名,模块每个请求必须添加注释以说明用途 1# 模块分割命名请使用与模块内容较为贴近的命名,模块每个请求必须添加注释以说明用途
2# 键命名规则(建议拼接对应关键词) 2# 键命名规则(建议拼接对应关键词)
查询/获取信息getxxx 新增addxxx 删除removexxx 修改/编辑/保存setxxx 查询/获取信息getxxx 新增addxxx 删除removexxx 修改/编辑/保存setxxx
3# 注意post和get传递的参数不同 3# 注意post和get传递的参数不同
4# 业务模块需要哪个接口则引入哪个 4# 业务模块需要哪个接口则引入哪个
*/ */
import { get, post } from '@/api/request' import { get, post } from '@/api/request'
import CONFIG from '@/config' import CONFIG from '@/config'
const { env, privateDomain, noGateDomain, goDomain } = CONFIG const { privateDomain, goDomain } = CONFIG
const flag = env || CONFIG.private const flag = process.env.X_CA_STAGE
// 获取dms sub_key // 获取dms sub_key
export const getDmsInfo = data => export const getDmsInfo = data =>
...@@ -18,8 +18,8 @@ export const getDmsInfo = data => ...@@ -18,8 +18,8 @@ export const getDmsInfo = data =>
// 获取用户信息 // 获取用户信息
export const getUserInfo = data => export const getUserInfo = data =>
flag flag
? get('/picText/live/Content/getUserInfo', { data }) ? get('/Program/Index/getUserInfo', { data })
: get('/live/live/pictext/getUserInfo', { data, baseURL: noGateDomain }) : get('/Program/Index/getUserInfo', { data, baseURL: privateDomain })
// pv 统计 // pv 统计
export const setPvInfo = data => export const setPvInfo = data =>
......
/* eslint-disable no-confusing-arrow */ /* eslint-disable no-confusing-arrow */
import { post, get } from '@/api/request' import { post, get } from '@/api/request'
import CONFIG from '@/config' import CONFIG from '@/config'
const { env, activityDomain } = CONFIG const { activityDomain } = CONFIG
const flag = env || CONFIG.private const flag = process.env.X_CA_STAGE
// 获取抽奖(场次)列表 // 获取抽奖(场次)列表
export const getLotterySessionList = data => export const getLotterySessionList = data =>
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
import { post, get } from '@/api/request' import { post, get } from '@/api/request'
import CONFIG from '@/config' import CONFIG from '@/config'
const { env, activityDomain } = CONFIG const { activityDomain } = CONFIG
const flag = env || CONFIG.private const flag = process.env.X_CA_STAGE
// 获取个人抽奖记录 // 获取个人抽奖记录
export const getRecordList = data => export const getRecordList = data =>
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
import { get } from '@/api/request' import { get } from '@/api/request'
import CONFIG from '@/config' import CONFIG from '@/config'
const { env, activityDomain } = CONFIG const { activityDomain } = CONFIG
const flag = env || CONFIG.private const flag = process.env.X_CA_STAGE
// 获取留言抽奖中奖名单 // 获取留言抽奖中奖名单
export const getWinnersList = data => export const getWinnersList = data =>
......
...@@ -4,15 +4,6 @@ import qs from "qs"; ...@@ -4,15 +4,6 @@ import qs from "qs";
import VueCookie from "vue-cookie"; import VueCookie from "vue-cookie";
// message消息弹窗,可自行引入其他插件 // message消息弹窗,可自行引入其他插件
import { Toast } from "vant"; import { Toast } from "vant";
// 全局配置文件
import CONFIG from "@/config";
const { env, armsPid } = CONFIG;
const arms = process.client && !CONFIG.private ? require('@/utils/arms') : null
const logger = arms && arms(armsPid, true);
// 环境变量
// 创建axios实例,不污染axios全局 // 创建axios实例,不污染axios全局
const axiosService = axios.create(); const axiosService = axios.create();
...@@ -20,14 +11,14 @@ const axiosService = axios.create(); ...@@ -20,14 +11,14 @@ const axiosService = axios.create();
// 默认content-type // 默认content-type
axiosService.defaults.headers["Content-Type"] = "application/x-www-form-urlencoded"; axiosService.defaults.headers["Content-Type"] = "application/x-www-form-urlencoded";
// 默认baseURL // 默认baseURL
axiosService.defaults.baseURL = CONFIG.defDomain; axiosService.defaults.baseURL = `//${process.env.CUSTOMER_API_DOMAIN}/v1`;
// 默认请求超时时间 // 默认请求超时时间
axiosService.defaults.timeout = 3 * 1000; axiosService.defaults.timeout = 3 * 1000;
// 请求拦截器 // 请求拦截器
axiosService.interceptors.request.use( axiosService.interceptors.request.use(
config => { config => {
const token = VueCookie.get(CONFIG.tokenKey); const token = VueCookie.get(process.env.CUSTOMER_TOKEN_KEY);
const { method, headers } = config; const { method, headers } = config;
const data = filterNull(config.data); const data = filterNull(config.data);
// 格式化序列,目前只对post进行处理,可新增其他请求逻辑 // 格式化序列,目前只对post进行处理,可新增其他请求逻辑
...@@ -47,9 +38,8 @@ axiosService.interceptors.request.use( ...@@ -47,9 +38,8 @@ axiosService.interceptors.request.use(
config.headers.token = token; config.headers.token = token;
} }
// 自定义header键:X-Ca-Stage(环境变量) // 自定义header键:X-Ca-Stage(环境变量)
if (env) { config.headers["X-Ca-Stage"] = process.env.X_CA_STAGE;
config.headers["X-Ca-Stage"] = env;
}
config.metadata = { startTime: new Date() }; config.metadata = { startTime: new Date() };
return config; return config;
}, },
...@@ -65,19 +55,17 @@ axiosService.interceptors.response.use( ...@@ -65,19 +55,17 @@ axiosService.interceptors.response.use(
// 否则的话抛出错误 // 否则的话抛出错误
response.config.metadata.endTime = new Date(); response.config.metadata.endTime = new Date();
response.duration = (response.config?.metadata?.endTime || 0) - (response.config?.metadata?.startTime || 0); response.duration = (response.config?.metadata?.endTime || 0) - (response.config?.metadata?.startTime || 0);
const { status, statusText, duration, data, config } = response; const { status, data } = response;
if (status === 200) { if (status === 200) {
// console.log(data && data.errorCode === 0 && data.code === 200); // console.log(data && data.errorCode === 0 && data.code === 200);
if (data && data.errorCode === 0 && data.code === 200) { if (data && data.errorCode === 0 && data.code === 200) {
// success // success
} else { } else {
// failed // failed
logger && logger.api(config.url, true, duration, data.errorCode, data.errorMessage);
} }
return Promise.resolve(response.data); return Promise.resolve(response.data);
} else { } else {
// failed // failed
logger && logger.api(config.url, false, duration, status, statusText);
errorHandle(502); errorHandle(502);
return Promise.reject(response); return Promise.reject(response);
} }
...@@ -85,13 +73,10 @@ axiosService.interceptors.response.use( ...@@ -85,13 +73,10 @@ axiosService.interceptors.response.use(
error => { error => {
error.config.metadata.endTime = new Date(); error.config.metadata.endTime = new Date();
error.duration = (error.config?.metadata?.endTime || 0) - (error.config?.metadata?.startTime || 0); error.duration = (error.config?.metadata?.endTime || 0) - (error.config?.metadata?.startTime || 0);
const { message, duration, config } = error; const { message } = error;
if (message.includes("timeout")) { if (message.includes("timeout")) {
// url, false, time, res.data.Flag, res.data.FlagString
logger && logger.api(config.url, false, duration, "NetworkTimeout", message);
errorHandle(408); errorHandle(408);
} else { } else {
logger && logger.api(config.url, false, duration, "NetworkError", message);
errorHandle(504); errorHandle(504);
} }
return Promise.reject(error); return Promise.reject(error);
......
...@@ -4,7 +4,7 @@ RUN apk add --no-cache --update nodejs yarn ...@@ -4,7 +4,7 @@ RUN apk add --no-cache --update nodejs yarn
COPY package.json yarn.lock ./ COPY package.json yarn.lock ./
RUN yarn install --registry=https://registry.yarnpkg.com RUN yarn install --registry=https://registry.yarnpkg.com
FROM registry.cn-hangzhou.aliyuncs.com/open_images/node12.13.1-pm2 FROM registry.cn-hangzhou.aliyuncs.com/cduan/customer-resource-base:zabbix
ADD ./ /var/www/web_lottery ADD ./ /var/www/web_lottery
ENV HOST 0.0.0.0 ENV HOST 0.0.0.0
ENV TZ Asia/Shanghai ENV TZ Asia/Shanghai
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
</template> </template>
<script> <script>
import CONFIG from '@/config'
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
import { CUSTOM_SOURCE_TYPE } from '@/utils/constant' import { CUSTOM_SOURCE_TYPE } from '@/utils/constant'
...@@ -14,6 +13,7 @@ export default { ...@@ -14,6 +13,7 @@ export default {
data() { data() {
return { return {
color: '', color: '',
bgColor: '',
entry: null, entry: null,
body: null body: null
} }
...@@ -24,8 +24,9 @@ export default { ...@@ -24,8 +24,9 @@ export default {
}) })
}, },
mounted() { mounted() {
Bus.$on('initDeal', color => { Bus.$on('initDeal', (color, bgColor) => {
this.color = color this.color = color
this.bgColor = bgColor
this.init() this.init()
this.dealAnimation() this.dealAnimation()
}) })
...@@ -45,7 +46,7 @@ export default { ...@@ -45,7 +46,7 @@ export default {
height: '0.62667rem', height: '0.62667rem',
right: '0.13333rem', right: '0.13333rem',
bottom: '0.33333rem', bottom: '0.33333rem',
zIndex: 6, zIndex: 51,
background: '#fff', background: '#fff',
iconColor: '#80411a', iconColor: '#80411a',
transition: 'all 0.25s cubic-bezier(0.55, 0, 0.1, 1)' transition: 'all 0.25s cubic-bezier(0.55, 0, 0.1, 1)'
...@@ -53,6 +54,9 @@ export default { ...@@ -53,6 +54,9 @@ export default {
if (this.color) { if (this.color) {
Object.assign(defaultEntryStyle, { iconColor: this.color }) Object.assign(defaultEntryStyle, { iconColor: this.color })
} }
if (this.bgColor) {
Object.assign(defaultEntryStyle, { background: this.bgColor })
}
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
complaintsDeal({ complaintsDeal({
...@@ -60,13 +64,13 @@ export default { ...@@ -60,13 +64,13 @@ export default {
props: { props: {
// rootFontSize: '.62667rem', // rootFontSize: '.62667rem',
defaultEntryStyle, defaultEntryStyle,
zIndex: 999, zIndex: 51,
uin, uin,
url: window.location.href, url: window.location.href,
company: '管理员', company: '管理员',
pageId: id, pageId: id,
pageType: CUSTOM_SOURCE_TYPE.vote, pageType: CUSTOM_SOURCE_TYPE.vote,
env: CONFIG.env, env: process.env.X_CA_STAGE,
beforeShow: next => { beforeShow: next => {
if (this.isLogin) { if (this.isLogin) {
next() next()
...@@ -95,14 +99,20 @@ export default { ...@@ -95,14 +99,20 @@ export default {
dealAnimation() { dealAnimation() {
setTimeout(() => { setTimeout(() => {
this.entry = document.querySelector('.entry') this.entry = document.querySelector('.entry')
this.entry.classList.add('sidebar-hidden-scroll')
this.body = document.body this.body = document.body
this.body.addEventListener('touchstart', () => { this.body.addEventListener('touchstart', () => {
this.body.addEventListener('touchmove', this.dealScrollOn) this.body.addEventListener('touchmove', this.dealScrollOn)
}) })
this.body.addEventListener('touchend', () => { this.body.addEventListener('touchend', () => {
this.body.removeEventListener('touchmove', this.dealScrollOn) this.body.removeEventListener('touchmove', this.dealScrollOn)
this.dealScrollOff() // this.dealScrollOff()
})
this.entry.addEventListener('click', () => {
if (this.entry && this.entry.classList.contains('sidebar-hidden-scroll')) {
this.entry.classList.remove('sidebar-hidden-scroll')
return false
}
}) })
}, 500) }, 500)
}, },
......
...@@ -269,7 +269,7 @@ export default { ...@@ -269,7 +269,7 @@ export default {
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin', updateInfo: 'lottery/updateInfo' }), ...mapActions({ jumpToLogin: 'users/jumpToLogin', updateInfo: 'lottery/updateInfo' }),
// 中奖后, 关闭窗口回调 // 中奖后, 关闭窗口回调
winCloseCallback(){ winCloseCallback() {
this.isShowWin = false this.isShowWin = false
if (this.winInfo.id !== 0 && !this.isBindPhone) { if (this.winInfo.id !== 0 && !this.isBindPhone) {
this.isShowBindPhone = true this.isShowBindPhone = true
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
<div ref="recordsLayouts" class="records__layouts"> <div ref="recordsLayouts" class="records__layouts">
<div class="records__entry" @click="openRecord"> <div class="records__entry" @click="openRecord">
<div class="records__entry-wrap"> <div class="records__entry-wrap">
<p :style="textColor">抽奖</p> <p>抽奖</p>
<p :style="textColor">记录</p> <p>记录</p>
</div> </div>
</div> </div>
<div v-if="isShowWinnersList" class="records__entry records__entry--winners" @click="openRecordPopup('winners')"> <div v-if="isShowWinnersList" class="records__entry records__entry--winners" @click="openRecordPopup('winners')">
<div class="records__entry-wrap"> <div class="records__entry-wrap">
<p :style="textColor">中奖</p> <p>中奖</p>
<p :style="textColor">名单</p> <p>名单</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -58,6 +58,10 @@ export default { ...@@ -58,6 +58,10 @@ export default {
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin' }), ...mapActions({ jumpToLogin: 'users/jumpToLogin' }),
openRecord() { openRecord() {
if (this.recordsLayouts && this.recordsLayouts.classList.contains('sidebar-hidden-scroll')) {
this.recordsLayouts.classList.remove('sidebar-hidden-scroll')
return false
}
if (!this.isLogin) { if (!this.isLogin) {
this.$toast({ this.$toast({
message: '请先登录,正在为您转跳', message: '请先登录,正在为您转跳',
...@@ -71,6 +75,10 @@ export default { ...@@ -71,6 +75,10 @@ export default {
} }
}, },
openRecordPopup(type) { openRecordPopup(type) {
if (this.recordsLayouts && this.recordsLayouts.classList.contains('sidebar-hidden-scroll')) {
this.recordsLayouts.classList.remove('sidebar-hidden-scroll')
return false
}
this.activeTab = type this.activeTab = type
this.isShowRecordsPopup = true this.isShowRecordsPopup = true
}, },
...@@ -79,12 +87,13 @@ export default { ...@@ -79,12 +87,13 @@ export default {
}, },
recordsAnimation() { recordsAnimation() {
setTimeout(() => { setTimeout(() => {
this.recordsLayouts.classList.add('sidebar-hidden-scroll')
this.body.addEventListener('touchstart', () => { this.body.addEventListener('touchstart', () => {
this.body.addEventListener('touchmove', this.recordsScrollOn) this.body.addEventListener('touchmove', this.recordsScrollOn)
// this.recordsScrollOff()
}) })
this.body.addEventListener('touchend', () => { this.body.addEventListener('touchend', () => {
this.body.removeEventListener('touchmove', this.recordsScrollOn) this.body.removeEventListener('touchmove', this.recordsScrollOn)
this.recordsScrollOff()
}) })
}, 500) }, 500)
}, },
...@@ -108,7 +117,7 @@ export default { ...@@ -108,7 +117,7 @@ export default {
.records { .records {
&__layouts { &__layouts {
position: fixed; position: fixed;
z-index: 50; z-index: 51;
right: 10px; right: 10px;
bottom: 90px; bottom: 90px;
transition: all 0.25s cubic-bezier(0.55, 0, 0.1, 1); transition: all 0.25s cubic-bezier(0.55, 0, 0.1, 1);
......
...@@ -13,23 +13,26 @@ ...@@ -13,23 +13,26 @@
<div class="records-popup__list-wrapper"> <div class="records-popup__list-wrapper">
<div class="records-popup__personal-record"> <div class="records-popup__personal-record">
<div class="records-popup__record-content"> <div class="records-popup__record-content">
<div class="records-popup__phone"> <!-- <div class="records-popup__phone">
领奖手机号: 领奖手机号:
<span v-if="isBindPhone">{{ userInfo.phone }}</span> <span v-if="isBindPhone">{{ userInfo.phone }}</span>
<span v-else class="records-popup__bind-phone" @click="bindMobile">绑定手机号</span> <span v-else class="records-popup__bind-phone" @click="bindMobile">绑定手机号</span>
</div> </div> -->
<ul v-if="Object.keys(recordList).length !== 0" class="records-popup__record-list"> <ul v-if="Object.keys(recordList).length !== 0" class="records-popup__record-list">
<li v-for="(session, key, index) in recordList" :key="index"> <li v-for="(session, key, index) in recordList" :key="index">
<div v-for="(item, itemIndex) in session" :key="itemIndex" class="records-popup__session-info"> <div class="records-popup__session-info">
<div class="records-popup__info-wrap"> <div class="records-popup__info-wrap">
<div v-if="session.length > 1" class="records-popup__session"> <div style="display: flex; align-items: center">
{{ NUMBER_LIST[index + 1] }}场次 <div style="margin: 0" class="records-popup__time">
</div> {{ (session.drawTime * 1000) | formatDate('MM-DD') }}
<div class="records-popup__time"> </div>
<span>{{ (item.drawTime * 1000) | formatDate('MM-DD HH:mm:ss') }}</span> <div class="records-popup__session">
{{ session.drawPlay }}<span v-if="session.showType === 6">直播福袋</span>
<span v-if="session.showType === 7">直播宝箱</span>
</div>
</div> </div>
<div class="records-popup__prize-name">{{ session.prizeName }}</div>
</div> </div>
<div class="records-popup__prize-name">{{ item.prizeName }}</div>
</div> </div>
</li> </li>
</ul> </ul>
...@@ -47,7 +50,16 @@ ...@@ -47,7 +50,16 @@
<div class="records-popup__record-content"> <div class="records-popup__record-content">
<div class="records-popup__winners-list"> <div class="records-popup__winners-list">
<div v-for="(item, index) in winnersList" :key="index" class="records-popup__item"> <div v-for="(item, index) in winnersList" :key="index" class="records-popup__item">
{{ item.userNick }} 获得 <span class="records-popup__prize-name">{{ item.prizeName }}</span> <div class="records-popup__time">
{{ (item.startTime * 1000) | formatDate('MM-DD HH:mm') }}
<span v-if="item.showType === 6">福袋</span>
<span v-if="item.showType === 7">宝箱</span>
</div>
<div v-for="(i, ind) in item.data" :key="ind" class="records-popup__item-user">
<div style="margin-bottom: 13px; width: 84.5px">{{ i.userNick }}</div>
<div style="margin-bottom: 13px; margin-left: 16px">获得了</div>
<div style="margin-bottom: 13px; margin-left: 16px; color: #fe3924">{{ i.prizeName }}</div>
</div>
</div> </div>
<div v-if="winnersList.length === 0" class="records-popup__no-data">暂无数据</div> <div v-if="winnersList.length === 0" class="records-popup__no-data">暂无数据</div>
</div> </div>
...@@ -95,7 +107,8 @@ export default { ...@@ -95,7 +107,8 @@ export default {
...mapGetters({ ...mapGetters({
uin: 'users/uin', uin: 'users/uin',
userInfo: 'users/userInfo', userInfo: 'users/userInfo',
isBindPhone: 'users/isBindPhone' isBindPhone: 'users/isBindPhone',
lotteryInfo: 'lottery/lotteryInfo',
}), }),
visible: { visible: {
get() { get() {
...@@ -177,8 +190,8 @@ export default { ...@@ -177,8 +190,8 @@ export default {
<style lang='less' scoped> <style lang='less' scoped>
.records-popup { .records-popup {
width: 258px; width: 251.5px;
height: 291px; height: 292px;
background: #ffe9d8; background: #ffe9d8;
border-radius: 15px; border-radius: 15px;
overflow: visible; overflow: visible;
...@@ -249,7 +262,7 @@ export default { ...@@ -249,7 +262,7 @@ export default {
.van-tab__pane { .van-tab__pane {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 15px 0; padding: 5px 0;
} }
} }
} }
...@@ -278,6 +291,7 @@ export default { ...@@ -278,6 +291,7 @@ export default {
color: #ff0024; color: #ff0024;
font-size: 12px; font-size: 12px;
margin-top: 10px; margin-top: 10px;
margin-bottom: 8px;
} }
&__phone { &__phone {
color: #666; color: #666;
...@@ -287,6 +301,7 @@ export default { ...@@ -287,6 +301,7 @@ export default {
color: #f57641; color: #f57641;
} }
&__record-list { &__record-list {
margin-top: 12px;
li { li {
margin-bottom: 15px; margin-bottom: 15px;
&:last-child { &:last-child {
...@@ -306,21 +321,43 @@ export default { ...@@ -306,21 +321,43 @@ export default {
&__info-wrap { &__info-wrap {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 13px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
line-height: 18.5px;
justify-content: space-between;
} }
&__session { &__session {
margin-right: 5px; margin-left: 20px;
font-size: 13px; font-size: 13px;
color: #333; color: #333;
} }
&__time { &__time {
color: #666; font-size: 13px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 18.5px;
margin-bottom: 13px;
} }
&__prize-name { &__prize-name {
margin: 8px 0 15px; margin: 0 0 15px;
color: #666; font-size: 13px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fe3924;
line-height: 18.5px;
} }
&__item { &__item {
margin-bottom: 8px; margin-bottom: 8px;
&-user {
display: flex;
font-size: 13px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
line-height: 18.5px;
}
} }
&__winners-record { &__winners-record {
width: 100%; width: 100%;
...@@ -334,7 +371,7 @@ export default { ...@@ -334,7 +371,7 @@ export default {
&__no-data { &__no-data {
color: #999; color: #999;
text-align: center; text-align: center;
padding-top: 40px; padding-top: 100px;
} }
} }
</style> </style>
<template> <template>
<section class="join-button"> <section class="join-button" :class="lotteryInfo.showType === 7 ? 'treasure' : 'luckybag'">
<div class="btn-box"> <div class="btn-box" :style="{ '--btnBottom': btnBottom }">
<template v-if="+lotteryInfo.status === LOTTERY_STATUS.teaser"> <template v-if="+lotteryInfo.status === LOTTERY_STATUS.teaser">
<button v-if="lotteryInfo.condition === 1" class="join-btn pre">未开始</button> <button v-if="lotteryInfo.condition === 1" class="join-btn pre">未开始</button>
<button v-if="lotteryInfo.condition === 2" class="join-btn pre countdown"> <button v-if="lotteryInfo.condition === 2" class="join-btn pre">未开始</button>
<template v-if="hours > 0">{{ hours | filterNum }}:</template>
{{ minutes | filterNum }}:{{ seconds | filterNum }}后开始
</button>
</template> </template>
<template v-if="+lotteryInfo.status === LOTTERY_STATUS.start"> <template v-if="+lotteryInfo.status === LOTTERY_STATUS.start">
<template v-if="lotteryInfo.userTimes === 0 && lotteryInfo.isDraw"> <template v-if="lotteryInfo.userTimes === 0 && lotteryInfo.isDraw">
<button class="join-btn pre">待开奖</button> <button class="join-btn pre">待开奖</button>
</template> </template>
<template v-else> <template v-else>
<div class="btn-mask"></div> <div class="btn-mask"></div>
<button class="join-btn" @click="lottery">点击参加</button> <button class="join-btn" @click="lottery">立即参与</button>
</template> </template>
</template> </template>
<template v-if="+lotteryInfo.status === LOTTERY_STATUS.end"> <template v-if="+lotteryInfo.status === LOTTERY_STATUS.end">
<template v-if="isLogin && lotteryInfo.isDraw && lotteryInfo.isWin"> <template v-if="isLogin && lotteryInfo.isDraw && lotteryInfo.isWin">
<div class="win-result-box"> <div class="win-result-box">
<p class="win-result">恭喜您中奖!</p> <button class="join-btn">恭喜您中奖!</button>
</div> </div>
</template> </template>
<template v-if="isLogin && lotteryInfo.isDraw && !lotteryInfo.isWin"> <template v-if="isLogin && lotteryInfo.isDraw && !lotteryInfo.isWin">
<div class="win-result-box"> <div class="win-result-box">
<p class="win-result">很遗憾,您没有中奖</p> <button class="join-btn end">很遗憾,您未中奖</button>
</div> </div>
</template> </template>
<template v-if="!isLogin || !lotteryInfo.isDraw"> <template v-if="!isLogin || !lotteryInfo.isDraw">
...@@ -33,9 +30,9 @@ ...@@ -33,9 +30,9 @@
</template> </template>
</template> </template>
</div> </div>
<div v-if="+lotteryInfo.status !== LOTTERY_STATUS.end ? true : !isLogin || !lotteryInfo.isDraw" class="join-num"> <!-- <div v-if="+lotteryInfo.status !== LOTTERY_STATUS.end ? true : !isLogin || !lotteryInfo.isDraw" class="join-num">
已有 {{ lotteryInfo.activeNum }} 人参与 已有 {{ lotteryInfo.activeNum }} 人参与
</div> </div> -->
</section> </section>
</template> </template>
<script> <script>
...@@ -54,13 +51,14 @@ export default { ...@@ -54,13 +51,14 @@ export default {
data() { data() {
return { return {
LOTTERY_STATUS, LOTTERY_STATUS,
timer: null timer: null,
btnBottom: '' // 按钮下边距 为适应不同背景图
} }
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
isLogin: 'users/isLogin', isLogin: 'users/isLogin',
lotteryInfo: 'lottery/lotteryInfo' lotteryInfo: 'lottery/lotteryInfo',
}) })
}, },
watch: { watch: {
...@@ -73,6 +71,11 @@ export default { ...@@ -73,6 +71,11 @@ export default {
}, },
mounted() { mounted() {
this.dateInit() this.dateInit()
if (this.lotteryInfo.showType === 6) {
this.btnBottom = '-10px'
} else {
this.btnBottom = '20px'
}
}, },
methods: { methods: {
dateInit() { dateInit() {
...@@ -94,28 +97,29 @@ export default { ...@@ -94,28 +97,29 @@ export default {
} }
} }
</script> </script>
<style lang="less"> <style lang="less" scoped>
@--box-width: 100px; @--box-width: 194px;
@--box-height: @--box-width; @--box-height: 78px;
@keyframes wave { // @keyframes wave {
0% { // 0% {
opacity: 0.5; // opacity: 0.5;
} // }
100% { // 100% {
opacity: 1; // opacity: 1;
transform: scale(1.1); // transform: scale(1.1);
} // }
} // }
@keyframes wavetwo { // @keyframes wavetwo {
0% { // 0% {
opacity: 1; // opacity: 1;
} // }
100% { // 100% {
opacity: 0.5; // opacity: 0.5;
} // }
} // }
.join-button { .join-button {
height: 310px;
.btn-box { .btn-box {
width: @--box-width; width: @--box-width;
min-height: @--box-height; min-height: @--box-height;
...@@ -123,7 +127,7 @@ export default { ...@@ -123,7 +127,7 @@ export default {
margin: 0 auto; margin: 0 auto;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: flex-end;
position: relative; position: relative;
flex-wrap: wrap; flex-wrap: wrap;
.btn-mask { .btn-mask {
...@@ -137,32 +141,6 @@ export default { ...@@ -137,32 +141,6 @@ export default {
margin: auto; margin: auto;
width: @--box-width - 16px; width: @--box-width - 16px;
height: @--box-height - 16px; height: @--box-height - 16px;
&::before {
content: '';
border-radius: 50%;
opacity: 0.5;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #fbaca6;
animation: wave 1s ease-out infinite;
}
&:after {
content: '';
border-radius: 50%;
opacity: 0.5;
position: absolute;
top: 0;
left: 0;
width: @--box-width - 16px;
height: @--box-height - 16px;
background-color: #fbaca6;
transform: scale(1.1);
animation: wavetwo 1s ease-out infinite;
// animation-delay: 0.5s;
}
} }
.join-btn { .join-btn {
border: 0; border: 0;
...@@ -173,16 +151,22 @@ export default { ...@@ -173,16 +151,22 @@ export default {
width: @--box-width - 16px; width: @--box-width - 16px;
height: @--box-height - 16px; height: @--box-height - 16px;
line-height: @--box-height - 16px; line-height: @--box-height - 16px;
border-radius: 50%; margin-bottom: var(--btnBottom);
background-color: #e85c52; background: url(./img/button-light.png) no-repeat top;
outline: none; outline: none;
position: relative;
z-index: 1; z-index: 1;
font-size: 18px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #db0000;
// line-height: 70px;
&.pre { &.pre {
background-color: #e77e7b; color: #ffffff;
background: url(./img/button-dark.png) no-repeat top;
} }
&.end { &.end {
background-color: #999; color: #ffffff;
background: url(./img/button-dark.png) no-repeat top;
} }
&.countdown { &.countdown {
font-size: 12px; font-size: 12px;
...@@ -219,4 +203,12 @@ export default { ...@@ -219,4 +203,12 @@ export default {
text-align: center; text-align: center;
} }
} }
.treasure {
background: url(img/treasure.png) no-repeat center;
background-size: contain;
}
.luckybag {
background: url(img/luckybag.png) no-repeat center;
background-size: contain;
}
</style> </style>
<template> <template>
<section class="main-timing"> <div class="main-timing">
<TimingBanner class="timing-banner" :info="config[0]"></TimingBanner> <LuckyBag
<div class="prize-info"> v-if="lotteryInfo.showType === 6 || lotteryInfo.showType === 1"
<label>奖品:</label> :is-btn-loading="isBtnLoading"
<p> :is-show-win="isShowWin"
<span class="text-name">{{ config[0].name }}</span> :is-show-bind-phone="isShowBindPhone"
<span class="text-num">x {{ config[0].sum }}</span> :win-info="winInfo"
</p> @lotteryCallback="lotteryCallback"
</div> ></LuckyBag>
<TimingStatus class="timing-status-box"></TimingStatus> <Treasure
<JoinButton class="join-button-box" @lottery="lotteryCallback"></JoinButton> v-if="lotteryInfo.showType === 7"
<BackButton v-if="backUrl" class="back-box" :url="backUrl"></BackButton> :is-btn-loading="isBtnLoading"
<Records></Records> :is-show-win="isShowWin"
<WinPopup v-model="isShowWin" :info="winInfo"></WinPopup> :is-show-bind-phone="isShowBindPhone"
<BindPhoneDialog v-model="isShowBindPhone"></BindPhoneDialog> :win-info="winInfo"
</section> @lotteryCallback="lotteryCallback"
></Treasure>
</div>
</template> </template>
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
import { setLottery, getUserRecord } from '@/api/modules/lottery' import { setLottery, getUserRecord } from '@/api/modules/lottery'
import Bus from '@/utils/Bus' import Bus from '@/utils/Bus'
// banner
import TimingBanner from '@/components/Lottery/Timing/TimingBanner'
// 状态信息
import TimingStatus from '@/components/Lottery/Timing/TimingStatus'
// 参加按钮
import JoinButton from '@/components/Lottery/Timing/JoinButton'
// 返回直播间按钮
import BackButton from '@/components/Lottery/Timing/BackButton'
// 中奖弹窗
import WinPopup from '@/components/Lottery/Instant/WinPopup'
export default { export default {
components: { components: {
TimingBanner, LuckyBag: () => import('@/components/Lottery/Timing/type/LuckyBag'),
TimingStatus, Treasure: () => import('@/components/Lottery/Timing/type/Treasure'),
JoinButton, // Records: () => import('@/components/Lottery/Instant/Records')
BackButton,
WinPopup,
BindPhoneDialog: () => import('@/components/Common/BindPhoneDialog'),
Records: () => import('@/components/Lottery/Instant/Records')
}, },
data() { data() {
return { return {
...@@ -50,7 +37,8 @@ export default { ...@@ -50,7 +37,8 @@ export default {
playId: this.$route.query.sessionId, playId: this.$route.query.sessionId,
isShowWin: false, isShowWin: false,
isShowBindPhone: false, // 是否显示绑定手机号提示 isShowBindPhone: false, // 是否显示绑定手机号提示
winInfo: this.winInfoTranslator() winInfo: this.winInfoTranslator(),
isShowIntro: false
} }
}, },
computed: { computed: {
...@@ -98,7 +86,7 @@ export default { ...@@ -98,7 +86,7 @@ export default {
}) })
}, },
// 中奖后, 关闭窗口回调 // 中奖后, 关闭窗口回调
winCloseCallback(){ winCloseCallback() {
this.isShowWin = false this.isShowWin = false
if (this.winInfo.id !== 0 && !this.isBindPhone) { if (this.winInfo.id !== 0 && !this.isBindPhone) {
this.isShowBindPhone = true this.isShowBindPhone = true
...@@ -159,6 +147,7 @@ export default { ...@@ -159,6 +147,7 @@ export default {
this.isBtnLoading = false this.isBtnLoading = false
} else { } else {
this.$toast.fail(errorMessage) this.$toast.fail(errorMessage)
this.isBtnLoading = false
} }
}) })
} }
...@@ -167,7 +156,7 @@ export default { ...@@ -167,7 +156,7 @@ export default {
getUserRecord({ getUserRecord({
id: this.$route?.query?.id || '', id: this.$route?.query?.id || '',
uin: this.$route?.query?.uin || '', uin: this.$route?.query?.uin || '',
nowPlay: 1 nowPlay: this.lotteryInfo.nowPlay
}).then(res => { }).then(res => {
const { code, errorCode, errorMessage, data } = res const { code, errorCode, errorMessage, data } = res
if (code === 200 && errorCode === 0) { if (code === 200 && errorCode === 0) {
...@@ -184,57 +173,16 @@ export default { ...@@ -184,57 +173,16 @@ export default {
id: data?.prizeId || '', id: data?.prizeId || '',
name: data?.prizeName || '' name: data?.prizeName || ''
} }
},
goRule() {
this.isShowIntro = true
} }
} }
} }
</script> </script>
<style lang="less"> <style lang="less" scoped>
.main-timing { .main-timing {
height: 100%; height: 100%;
position: relative; position: relative;
.timing-banner {
padding-top: 115 / 330 * 100%;
position: relative;
}
.prize-info {
margin-top: 10px;
padding-left: 16px;
min-height: 20px;
line-height: 20px;
font-size: 16px;
display: flex;
align-items: center;
justify-content: left;
label {
min-width: 50px;
}
p {
flex: 1;
span {
color: #000;
&.text-num {
margin-left: 4px;
color: #999;
}
}
}
}
.timing-status-box {
padding-left: 16px;
margin-top: 10px;
height: 20px;
line-height: 20px;
font-size: 14px;
}
.join-button-box {
margin-top: 50px;
}
.back-box {
position: absolute;
bottom: 16px;
left: 0;
width: 100%;
border-radius: 22px;
}
} }
</style> </style>
<template>
<div class="main-timing">
<LuckyBag
v-if="lotteryInfo.showType === 6 || lotteryInfo.showType === 1"
:is-mini="true"
:is-btn-loading="isBtnLoading"
:is-show-win="isShowWin"
:is-show-bind-phone="isShowBindPhone"
:win-info="winInfo"
:is-show-intro="isShowIntro"
class="bgluckybag"
@lotteryCallback="lotteryCallback"
@goRule="goRule"
></LuckyBag>
<Treasure
v-if="lotteryInfo.showType === 7"
:is-mini="true"
:is-btn-loading="isBtnLoading"
:is-show-win="isShowWin"
:is-show-bind-phone="isShowBindPhone"
:win-info="winInfo"
:is-show-intro="isShowIntro"
class="bgtreasure"
@lotteryCallback="lotteryCallback"
@goRule="goRule"
></Treasure>
</div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import { setLottery, getUserRecord } from '@/api/modules/lottery'
import Bus from '@/utils/Bus'
export default {
components: {
LuckyBag: () => import('@/components/Lottery/Timing/type/LuckyBag'),
Treasure: () => import('@/components/Lottery/Timing/type/Treasure'),
},
data() {
return {
isBtnLoading: false,
id: this.$route.query.id || '',
stype: this.$route.query.stype || null, // 引用类型
playId: this.$route.query.sessionId,
isShowWin: false,
isShowBindPhone: false, // 是否显示绑定手机号提示
winInfo: this.winInfoTranslator(),
isShowIntro: false
}
},
computed: {
...mapGetters({
uin: 'users/uin',
isLogin: 'users/isLogin',
lotteryInfo: 'lottery/lotteryInfo',
isBindPhone: 'users/isBindPhone',
userInfo: 'users/userInfo',
}),
backUrl() {
return this.$route.query.backUrl || ''
},
config() {
const list =
typeof this.lotteryInfo.prizeConfigs === 'object'
? Object.values(this.lotteryInfo.prizeConfigs)
: this.lotteryInfo.prizeConfigs
return list
}
},
// watch: {
// 'lotteryInfo.status': {
// handler(newVal, oldVal) {
// if (newVal === 2 && oldVal === 2 && this.lotteryInfo.isDraw === 1) {
// this.loadWinInfo()
// }
// },
// deep: true
// }
// },
mounted() {
this.eventHubInit()
Bus.$emit('initDeal', '#db0000', '#ffdccb')
// this.loadWinInfo()
// 抽奖结果通知
Bus.$on('LotteryResult', data => {
if (data.userId === this.userInfo.id && data.isPrize === 1) {
this.updateInfo({
isWin: 1
})
}
if (this.lotteryInfo.isDraw === 1) {
this.loadWinInfo()
}
})
},
methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin', updateInfo: 'lottery/updateInfo' }),
eventHubInit() {
Bus.$on('updateMain', data => {
for (const [key, value] of Object.entries(data)) {
if (key === 'func') {
this[value]()
} else {
this[key] = value
}
}
})
},
// 中奖后, 关闭窗口回调
winCloseCallback() {
this.isShowWin = false
if (this.winInfo.id !== 0 && !this.isBindPhone) {
this.isShowBindPhone = true
}
},
// 中奖后, "查看奖品详情"回调
winCallback() {
this.isShowWin = false
if (this.winInfo.id !== 0) {
this.$router.push({
path: '/recordDetail',
query: {
tempId: this.winInfo.tempId,
uin: this.uin
}
})
}
},
// 抽奖回调
lotteryCallback() {
// 抽奖点击事件
if (!this.isLogin) {
this.$toast({
message: '请先登录',
duration: 1500,
onClose: () => {
this.jumpToLogin()
}
})
} else if (this.lotteryInfo.status !== 1) {
// 抽奖不在活动日期内
} else if (this.isBtnLoading) {
// 正在抽奖动画过程中或正在加载数据
} else if (this.lotteryInfo.userTimes <= 0) {
this.$toast('抽奖次数已用完')
} else {
this.isBtnLoading = true
const params = {
id: this.id,
uin: this.uin,
playId: this.playId,
type: this.stype || 'link',
sourceId: this.sid || this.id
}
setLottery(params).then(res => {
const { code, errorCode, errorMessage } = res
if (code === 200 && errorCode === 0) {
let times = this.lotteryInfo.userTimes
times--
let num = this.lotteryInfo.activeNum
num++
this.updateInfo({
userTimes: times,
isDraw: 1,
activeNum: num
})
this.$toast.success('参与成功')
this.isBtnLoading = false
} else {
this.$toast.fail(errorMessage)
this.isBtnLoading = false
}
})
}
},
loadWinInfo() {
getUserRecord({
id: this.$route?.query?.id || '',
uin: this.$route?.query?.uin || '',
nowPlay: this.lotteryInfo.nowPlay
}).then(res => {
const { code, errorCode, errorMessage, data } = res
if (code === 200 && errorCode === 0) {
this.winInfo = this.winInfoTranslator(data)
console.log(this.winInfo);
this.isShowWin = true
} else {
this.$toast(errorMessage)
}
})
},
winInfoTranslator(data) {
return {
...data,
id: data?.prizeId || '',
name: data?.prizeName || ''
}
},
goRule() {
this.isShowIntro = true
}
}
}
</script>
<style lang="less" scoped>
.main-timing {
height: 100%;
position: relative;
}
</style>
<template>
<div class="main">
<div
:style="{
height: this.$route.path === '/mini/index' ? '65.5vh' : lotteryInfo.showType === 7 ? '46.5vh' : '37.5vh'
}"
>
<div class="intro">
<div class="intro__title">活动介绍</div>
<div class="intro__detail">{{ lotteryInfo.intro }}</div>
</div>
<div class="rule">
<div class="rule__sub">本场活动奖品:</div>
<div class="intro__rewards">
<div v-for="item in lotteryInfo.prizeConfigs" :key="item.id" class="intro__rewards-item">
<img v-if="item.icon" :src="item.icon" alt="" />
<img v-else src="./img/gift.png" alt="" />
<div>{{ item.name }}</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { LOTTERY_STATUS } from '@/utils/constant'
// 倒计时逻辑处理
import CountDown from '@/mixins/CountDown'
export default {
mixins: [CountDown],
data() {
return {
LOTTERY_STATUS,
timer: null
}
},
computed: {
...mapGetters({
isLogin: 'users/isLogin',
lotteryInfo: 'lottery/lotteryInfo'
})
},
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
height: 100%;
padding: 0 13px;
overflow-x: scroll;
display: flex;
flex-direction: column;
.intro {
// margin-bottom: 24px;
// height: 30%;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-bottom: 30px;
&__title {
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fff6da;
line-height: 22.5px;
text-align: center;
}
// &__sub {
// font-size: 14px;
// font-family: PingFangSC-Regular, PingFang SC;
// font-weight: 400;
// color: #fff6da;
// // line-height: 20px;
// // margin-top: 4%;
// margin-left: 16px;
// }
&__detail {
width: 335px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #fff6da;
line-height: 20px;
// margin-top: 15px;
margin-left: 16px;
margin-top: 16px;
white-space: pre-wrap;
word-wrap: break-word;
}
&__rewards {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
// margin-top: 15px;
&-item {
width: 33%;
display: inline-block;
font-size: 13px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #fff6da;
line-height: 18.5px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-bottom: 12px;
img {
width: 48px;
height: 48px;
border-radius: 2px;
}
div {
width: 100%;
margin-top: 4px;
text-align: center;
height: 38.5px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
white-space: pre-wrap;
word-wrap: break-word;
}
}
}
}
.rule {
height: 44%;
display: flex;
flex-direction: column;
&__sub {
// font-size: 16px;
// font-family: PingFangSC-Medium, PingFang SC;
// font-weight: 500;
// color: #fff6da;
// line-height: 22.5px;
// text-align: center;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #fff6da;
line-height: 20px;
// margin-top: 4%;
margin-left: 16px;
margin-bottom: 15px;
}
&__detail {
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #fff6da;
line-height: 20px;
// margin-top: 15px;
margin-left: 16px;
}
}
}
</style>
<template>
<van-popup
v-model="visible"
:overlay="false"
position="bottom"
transition="van-fade"
class="introduction-popup"
z-index="49"
:class="lotteryInfo.showType === 7 ? 'bgtreasureColor' : 'bgluckybagColor'"
>
<div class="introduction-popup__main">
<Rewards></Rewards>
<div class="main-link" @click="visible = false">返回活动</div>
</div>
</van-popup>
</template>
<script>
import { mapGetters } from 'vuex'
import img from '@/assets/images/lottery/gift.png'
import Bus from '@/utils/Bus'
// 奖品介绍
import Rewards from '@/components/Lottery/Timing/Rewards'
export default {
name: 'Introduction',
components: {
Rewards
},
props: {
value: {
type: Boolean,
default: false
},
rulePosition: {
type: String,
default: 'top'
},
},
data() {
return {
img
}
},
computed: {
...mapGetters({ lotteryInfo: 'lottery/lotteryInfo' }),
visible: {
get() {
return this.value
},
set(val) {
Bus.$emit('updateMain', { isShowIntro: val })
}
}
},
methods: {
getContainer() {
return document.querySelector('.lottery-instant')
}
}
}
</script>
<style lang="less" scoped>
.introduction-popup {
width: 100%;
height: calc(100% - 46px);
&__main {
width: 100%;
height: 100%;
border-radius: 6px;
padding-bottom: 13px;
padding-top: 38px;
position: relative;
.main-link {
width: 24px;
height: 74px;
font-size: 12px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #db0000;
line-height: 13px;
writing-mode: tb-rl;
text-align: center;
background: url(img/link.png) no-repeat center;
background-size: cover;
position: absolute;
right: 0;
top: 20px;
padding-right: 3px;
}
}
}
.bgtreasureColor {
background-color: #ed112f;
}
.bgluckybagColor {
background-color: #fb3f42;
}
</style>
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
} }
} }
</script> </script>
<style lang="less"> <style lang="less" scoped>
.banner-box { .banner-box {
padding: 10px; padding: 10px;
position: absolute; position: absolute;
......
<template> <template>
<section class="timing-status"> <section class="timing-status">
<template v-if="type === 1"> <template v-if="type === 1">
<div v-if="state !== 2" class="countdown-box"> <div class="countdown-box">
<label>倒计时:</label> <div v-if="state !== 2" class="countdown-box__time">
<p> <label v-if="state === 0">抽奖倒计时:</label>
<span class="text-time"> <label v-else-if="state === 1">开奖倒计时:</label>
<template v-if="hours > 0">{{ hours | filterNum }} : </template>{{ minutes | filterNum }} : <span v-if="lotteryInfo.startModel === 'manual' && state === 0">
{{ seconds | filterNum }} 00:{{ lotteryInfo.countDown | filterNum }}:00
<template v-if="state === 0">后开始</template>
<template v-else-if="state === 1">后结束</template>
</span> </span>
</p> <span v-else>
<template v-if="hours > 0">{{ hours | filterNum }}:</template>{{ minutes | filterNum }}:{{
seconds | filterNum
}}
</span>
</div>
<div v-else class="countdown-box__time">抽奖已结束</div>
</div> </div>
<span v-else class="end-lottery">抽奖已结束</span>
</template> </template>
<template v-if="type === 2"> <template v-if="type === 2">
<div class="joinnum-box"> <div class="joinnum-box">
<p>参与人数满 {{ lotteryInfo.joinNum }} 人自动开奖(当前参与 {{ lotteryInfo.activeNum }} 人)</p> <p>参与人数满 {{ lotteryInfo.joinNum }} 人自动开奖 ( 当前参与 {{ lotteryInfo.activeNum }} 人 )</p>
</div> </div>
</template> </template>
</section> </section>
...@@ -72,7 +75,7 @@ export default { ...@@ -72,7 +75,7 @@ export default {
methods: { methods: {
dateInit() { dateInit() {
// 倒计时开始 // 倒计时开始
if (this.state === 0) { if (this.state === 0 && this.lotteryInfo.startModel !== 'manual') {
this.lotteryInfo.startTime && this.reloadTime(this.lotteryInfo.startTime * 1000) this.lotteryInfo.startTime && this.reloadTime(this.lotteryInfo.startTime * 1000)
} else if (this.state === 1) { } else if (this.state === 1) {
this.lotteryInfo.endTime && this.reloadTime(this.lotteryInfo.endTime * 1000) this.lotteryInfo.endTime && this.reloadTime(this.lotteryInfo.endTime * 1000)
...@@ -89,14 +92,30 @@ export default { ...@@ -89,14 +92,30 @@ export default {
} }
</script> </script>
<style lang="less"> <style lang="less" scoped>
.timing-status { .timing-status {
position: relative;
z-index: 2;
.countdown-box { .countdown-box {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: left; justify-content: center;
font-size: 13px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fff6da;
line-height: 18.5px;
&__time {
display: flex;
align-items: center;
justify-content: center;
width: 144px;
height: 23px;
background: rgba(0, 0, 0, 0.21);
border-radius: 11.5px;
}
label { label {
color: #999999; // color: #999999;
min-width: 58px; min-width: 58px;
} }
p { p {
...@@ -115,9 +134,22 @@ export default { ...@@ -115,9 +134,22 @@ export default {
color: #999; color: #999;
} }
.joinnum-box { .joinnum-box {
font-size: 14px; display: flex;
align-items: center;
justify-content: center;
font-size: 13px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fff6da;
line-height: 18.5px;
p { p {
color: #999999; display: flex;
align-items: center;
justify-content: center;
padding: 0 9px;
height: 23px;
background: rgba(0, 0, 0, 0.21);
border-radius: 11.5px;
} }
} }
} }
......
<template>
<van-popup
v-model="visible"
class="win-popup"
closeable
close-icon="close"
:style="{ background: 'transparent' }"
@click-close-icon="onClose"
>
<div v-if="type === 'luckybag'" class="lucky-popup__container">
<div class="lucky-popup__wrap">
<div class="lucky-popup__content">
<slot v-if="isWin" name="title-bg"></slot>
<div v-if="isWin" class="lucky-popup__win-info">
<div class="lucky-popup__title">恭喜获得</div>
<div class="lucky-popup__prize-img">
<img v-if="info.prizeIcon" :src="info.prizeIcon" alt="" />
<img v-else src="@/assets/images/lottery/gift.png" alt="" />
</div>
<div class="lucky-popup__prize-name">
{{ info.name }}
</div>
</div>
<div v-else class="lucky-popup__thanks">
<slot name="thanks">
<div
style="
font-size: 18px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fd0c2a;
line-height: 25px;
margin-bottom: 10px;
"
>
很遗憾
</div>
<div
style="
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #fd0c2a;
line-height: 20px;
"
>
您未抽中福袋
</div>
</slot>
</div>
</div>
<div class="lucky-popup__footer">
<van-button
class="lucky-popup__sure"
color="linear-gradient(180deg, #FEDF96, #FF8A42)"
round
@click="visible = false"
>我知道了</van-button
>
</div>
</div>
</div>
<div v-if="type === 'treasure'" class="treasure-popup__container">
<div class="treasure-popup__wrap">
<div class="treasure-popup__content">
<slot v-if="isWin" name="title-bg"></slot>
<div v-if="isWin" class="treasure-popup__win-info">
<div class="treasure-popup__title">恭喜获得</div>
<div class="treasure-popup__prize-img">
<img v-if="info.prizeIcon" :src="info.prizeIcon" alt="" />
<img v-else src="@/assets/images/lottery/gift.png" alt="" />
</div>
<div class="treasure-popup__prize-name">
{{ info.name }}
</div>
</div>
<div v-else class="treasure-popup__thanks">
<slot name="thanks">
<div
style="
font-size: 18px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fd0c2a;
line-height: 25px;
margin-bottom: 10px;
"
>
很遗憾
</div>
<div
style="
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #fd0c2a;
line-height: 20px;
"
>
您未抽中宝箱
</div>
</slot>
</div>
</div>
<div class="treasure-popup__footer">
<van-button
class="treasure-popup__sure"
color="linear-gradient(180deg, #FEDF96, #FF8A42)"
round
@click="visible = false"
>我知道了</van-button
>
</div>
</div>
</div>
</van-popup>
</template>
<script>
import Bus from '@/utils/Bus'
export default {
name: 'WinPopup',
components: {},
props: {
value: {
type: Boolean,
default: false
},
info: {
type: Object,
default: () => ({})
},
type: {
type: String,
default: ''
}
},
computed: {
visible: {
get() {
return this.value
},
set(val) {
Bus.$emit('updateMain', { isShowWin: val })
}
},
isWin() {
return !!+this.info.id
}
},
methods: {
know() {
Bus.$emit('updateMain', { func: 'winCallback' })
},
onClose() {
Bus.$emit('updateMain', { func: 'winCloseCallback' })
}
}
}
</script>
<style lang="less" scoped>
@containerWidth: 326px;
@wrapWidth: 275px;
@wrapHeight: 292px;
.win-popup {
overflow: visible;
/deep/ .van-popup__close-icon {
right: 10px;
top: -16px;
font-size: 22px;
color: #fff;
}
}
.lucky-popup {
&__container {
width: 100%;
height: 100%;
position: relative;
width: @containerWidth;
}
&__wrap {
margin: 0 auto;
width: 275px;
height: 321px;
overflow: hidden;
background-image: url('img/luckybag-popup.png');
background-size: cover;
background-repeat: no-repeat;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
&__content {
color: #fff;
font-size: 16px;
height: 175px;
width: 100%;
overflow: hidden;
}
&__win-info {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
&__title {
width: 100%;
text-align: center;
font-size: 18px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fd0c2a;
line-height: 25px;
height: 18px;
margin: 7px 0 13px;
}
&__prize-img {
img {
display: block;
width: 65px;
}
}
&__prize-name {
width: 100%;
padding: 0 10px;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #fd0c2a;
line-height: 16.5px;
margin-top: 11px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
text-align: center;
}
&__thanks {
margin-top: -24px;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
&__footer {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 65px;
}
&__sure {
width: 126px;
height: 33px;
line-height: 33px;
border: 0;
outline: none;
/deep/ .van-button__text {
font-size: 14px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #c10000;
line-height: 20px;
}
}
&__win-msg {
margin: 13px 0 20px;
font-size: 12px;
color: #fff;
}
}
.treasure-popup {
overflow: visible;
/deep/ .van-popup__close-icon {
right: 10px;
top: -16px;
font-size: 22px;
color: #fff;
}
&__container {
width: 100%;
height: 100%;
position: relative;
width: @containerWidth;
}
&__wrap {
margin: 0 auto;
width: 275px;
height: 321px;
overflow: hidden;
background-image: url('img/treasure-popup.png');
background-size: cover;
background-repeat: no-repeat;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
}
&__content {
color: #fff;
font-size: 16px;
height: 142px;
width: 100%;
overflow: hidden;
}
&__win-info {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}
&__title {
width: 100%;
text-align: center;
font-size: 18px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fd0c2a;
line-height: 25px;
height: 18px;
margin: 7px 0 13px;
}
&__prize-img {
img {
display: block;
width: 65px;
}
}
&__prize-name {
width: 100%;
padding: 0 10px;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #fd0c2a;
line-height: 16.5px;
margin-top: 11px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
text-align: center;
}
&__thanks {
margin-top: 0;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
&__footer {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
min-height: 65px;
}
&__sure {
width: 126px;
height: 33px;
line-height: 33px;
border: 0;
outline: none;
/deep/ .van-button__text {
font-size: 14px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #c10000;
line-height: 20px;
}
}
&__win-msg {
margin: 13px 0 20px;
font-size: 12px;
color: #fff;
}
}
</style>
<template>
<section class="main-timing" :style="{ backgroundPosition: isMini ? '0 0' : '' }">
<div v-if="isMini" class="main-link" @click="goRule">活动介绍</div>
<TimingStatus class="timing-status-box"></TimingStatus>
<JoinButton
class="join-button-box"
:style="{ bottom: isMini ? '26%' : '51%' }"
@lottery="lotteryCallback"
></JoinButton>
<Rewards v-if="!isMini" :style="{ height: isMini ? '65.5vh' : '40.5vh' }" class="reward-box"></Rewards>
<BackButton v-if="backUrl" class="back-box" :url="backUrl"></BackButton>
<Records v-if="isMini"></Records>
<RulePopup :value="isShowIntro"></RulePopup>
<WinPopup :value="isShowWin" :info="winInfo" type="luckybag"></WinPopup>
<BindPhoneDialog :value="isShowBindPhone"></BindPhoneDialog>
</section>
</template>
<script>
import { mapGetters } from 'vuex'
// banner
// import TimingBanner from '@/components/Lottery/Timing/TimingBanner'
// 状态信息
import TimingStatus from '@/components/Lottery/Timing/TimingStatus'
// 参加按钮
import JoinButton from '@/components/Lottery/Timing/JoinButton'
// 奖品介绍
import Rewards from '@/components/Lottery/Timing/Rewards'
// 返回直播间按钮
import BackButton from '@/components/Lottery/Timing/BackButton'
// 中奖弹窗
import WinPopup from '@/components/Lottery/Timing/WinPopup'
export default {
components: {
// TimingBanner,
TimingStatus,
JoinButton,
Rewards,
BackButton,
WinPopup,
BindPhoneDialog: () => import('@/components/Common/BindPhoneDialog'),
RulePopup: () => import('@/components/Lottery/Timing/RulePopup'),
Records: () => import('@/components/Lottery/Instant/Records')
},
props: {
isMini: {
type: Boolean,
default: false
},
isBtnLoading: {
type: Boolean,
default: false
},
isShowWin: {
type: Boolean,
default: false
},
isShowBindPhone: {
type: Boolean,
default: false
},
winInfo: {
type: Object,
default: () => {
return {}
}
},
isShowIntro: {
type: Boolean,
default: false
}
},
data() {
return {
}
},
computed: {
...mapGetters({
uin: 'users/uin',
isLogin: 'users/isLogin',
lotteryInfo: 'lottery/lotteryInfo',
isBindPhone: 'users/isBindPhone'
}),
backUrl() {
return this.$route.query.backUrl || ''
},
config() {
const list =
typeof this.lotteryInfo.prizeConfigs === 'object'
? Object.values(this.lotteryInfo.prizeConfigs)
: this.lotteryInfo.prizeConfigs
return list
}
},
methods: {
lotteryCallback() {
this.$emit('lotteryCallback')
},
goRule() {
this.$emit('goRule')
// this.isShowIntro = true
}
}
}
</script>
<style lang="less" scoped>
.main-timing {
height: 100%;
position: relative;
padding-top: 20px;
background: url(../img/background-luckybag.png) no-repeat center;
background-size: cover;
.main-link {
width: 24px;
height: 74px;
font-size: 12px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #db0000;
line-height: 13px;
writing-mode: tb-rl;
text-align: center;
background: url(../img/link.png) no-repeat center;
background-size: cover;
position: absolute;
right: 0;
top: 20px;
padding-right: 3px;
}
.timing-status-box {
// padding-left: 16px;
// margin-top: 10px;
height: 20px;
line-height: 20px;
font-size: 14px;
}
.join-button-box {
position: absolute;
width: 92%;
left: 50%;
transform: translateX(-50%);
bottom: 51%;
}
.back-box {
position: absolute;
bottom: 16px;
left: 0;
width: 100%;
border-radius: 22px;
}
.reward-box {
width: 100%;
position: absolute;
bottom: 3%;
}
}
// 样式穿透
.main-timing {
// records
/deep/ .records {
&__entry {
width: 48px;
height: 48px;
background: #ffdccb;
box-shadow: 0px 2px 8px 0px rgba(254, 35, 23, 0.5);
}
&__entry-wrap p {
font-size: 13px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #db0000;
line-height: 17px;
}
}
}
</style>
<template>
<section class="main-timing" :style="{ backgroundPosition: isMini ? '0 0' : '' }">
<div v-if="isMini" class="main-link" @click="goRule">活动介绍</div>
<TimingStatus class="timing-status-box"></TimingStatus>
<JoinButton
class="join-button-box"
:style="{ bottom: isMini ? '32%' : '49%' }"
@lottery="lotteryCallback"
></JoinButton>
<Rewards v-if="!isMini" :style="{ height: isMini ? '65.5vh' : '46.5vh' }" class="reward-box"></Rewards>
<BackButton v-if="backUrl" class="back-box" :url="backUrl"></BackButton>
<Records v-if="isMini"></Records>
<RulePopup :value="isShowIntro"></RulePopup>
<WinPopup :value="isShowWin" :info="winInfo" type="treasure"></WinPopup>
<BindPhoneDialog :value="isShowBindPhone"></BindPhoneDialog>
</section>
</template>
<script>
import { mapGetters } from 'vuex'
// banner
// import TimingBanner from '@/components/Lottery/Timing/TimingBanner'
// 状态信息
import TimingStatus from '@/components/Lottery/Timing/TimingStatus'
// 参加按钮
import JoinButton from '@/components/Lottery/Timing/JoinButton'
// 奖品介绍
import Rewards from '@/components/Lottery/Timing/Rewards'
// 返回直播间按钮
import BackButton from '@/components/Lottery/Timing/BackButton'
// 中奖弹窗
import WinPopup from '@/components/Lottery/Timing/WinPopup'
export default {
components: {
// TimingBanner,
TimingStatus,
JoinButton,
Rewards,
BackButton,
WinPopup,
BindPhoneDialog: () => import('@/components/Common/BindPhoneDialog'),
RulePopup: () => import('@/components/Lottery/Timing/RulePopup'),
Records: () => import('@/components/Lottery/Instant/Records')
},
props: {
isMini: {
type: Boolean,
default: false
},
isBtnLoading: {
type: Boolean,
default: false
},
isShowWin: {
type: Boolean,
default: false
},
isShowBindPhone: {
type: Boolean,
default: false
},
winInfo: {
type: Object,
default: () => {
return {}
}
},
isShowIntro: {
type: Boolean,
default: false
}
},
data() {
return {
}
},
computed: {
...mapGetters({
uin: 'users/uin',
isLogin: 'users/isLogin',
lotteryInfo: 'lottery/lotteryInfo',
isBindPhone: 'users/isBindPhone'
}),
backUrl() {
return this.$route.query.backUrl || ''
},
config() {
const list =
typeof this.lotteryInfo.prizeConfigs === 'object'
? Object.values(this.lotteryInfo.prizeConfigs)
: this.lotteryInfo.prizeConfigs
return list
}
},
methods: {
lotteryCallback() {
this.$emit('lotteryCallback')
},
goRule() {
this.$emit('goRule')
}
}
}
</script>
<style lang="less" scoped>
.main-timing {
height: 100%;
position: relative;
padding-top: 20px;
background: url(../img/background-treasure.png) no-repeat center;
background-size: cover;
.main-link {
width: 24px;
height: 74px;
font-size: 12px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #db0000;
line-height: 13px;
writing-mode: tb-rl;
text-align: center;
background: url(../img/link.png) no-repeat center;
background-size: cover;
position: absolute;
right: 0;
top: 20px;
padding-right: 3px;
}
.timing-status-box {
// padding-left: 16px;
// margin-top: 10px;
height: 20px;
line-height: 20px;
font-size: 14px;
}
.join-button-box {
position: absolute;
width: 92%;
left: 50%;
bottom: 49%;
transform: translateX(-50%);
}
.back-box {
position: absolute;
bottom: 16px;
left: 0;
width: 100%;
border-radius: 22px;
}
.reward-box {
width: 100%;
position: absolute;
bottom: 3%;
}
}
// 样式穿透
.main-timing {
// records
/deep/ .records {
&__entry {
width: 48px;
height: 48px;
background: #ffdccb;
box-shadow: 0px 2px 8px 0px rgba(254, 35, 23, 0.5);
}
&__entry-wrap p {
font-size: 13px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #db0000;
line-height: 17px;
}
}
}
</style>
const packageEnv = require('./package.json')
const protocol = process.client && window.location.protocol const protocol = process.client && window.location.protocol
const isHttps = protocol === 'https:'
export default { export default {
defDomain: isHttps ? process.env.API_DOMAIN.replace('8680', '843') : process.env.API_DOMAIN, goDomain: `//${process.env.GO_API_DOMAIN}/v1`,
noGateDomain: '//1812501212048408.cn-hangzhou.fc.aliyuncs.com/2016-08-15/proxy/gdyactivity.online', privateDomain: `//${process.env.PRIVATE_API_DOMAIN}/v1`,
goDomain: '//golivec.guangdianyun.tv/v1', activityDomain: `//${process.env.ACTIVITY_API_DOMAIN}/v1`,
privateDomain: '//privateapi.guangdianyun.tv/v1', defBanner: `//${process.env.OSS_DOMAIN}/common/img/lottery_banner_default_v2.png`,
activityDomain: '//activity.guangdianyun.tv/v1', defShareImg: `${protocol || 'https:'}//${process.env.OSS_DOMAIN}/common/img/lottery.png`, // 必须带协议头,否则微信分享配置时无法生效
defBanner: `${process.env.OSS_DOMAIN}/common/img/lottery_banner_default_v2.png`, ossImageServe: process.env.IS_PRIVATE ? '' : '?x-oss-process=style/mobilebackground',
defShareImg: `${protocol || 'https:'}${process.env.OSS_DOMAIN}/common/img/lottery.png`, // 必须带协议头,否则微信分享配置时无法生效
env: process.env.X_CA_STAGE,
private: process.env.private,
ossImageServe: process.env.private ? '' : '?x-oss-process=style/mobilebackground',
tokenKey: 'token'
} }
/* sentry */
export const sentryOptions = {
dsn: `${protocol}//610a9f4b831d4d10b228658886eaa18d@sentry.guangdianyun.tv/14`,
version: packageEnv.version,
env: process.env.X_CA_STAGE,
name: packageEnv.name,
isAjax: false,
isError: false,
}
/* 谷歌统计 */
export const GTAG_ID = 'G-HZHJLDPT80'
// arms
export const armsPid = 'huh7k89btk@1db1146a1ca55ff'
/* 正式:私有化部署(private)环境变量 */
module.exports = {
X_CA_STAGE: '',
API_DOMAIN: '//cgateway.cbnbn.cn/v1',
OSS_DOMAIN: '//static.cbnbn.cn',
ROP_DOMAIN: 'cbnbn.cn',
private: true,
privateType: 'cbn'
}
/* 正式:私有化部署(private)环境变量 */
module.exports = {
X_CA_STAGE: '',
API_DOMAIN: '//cgateway.cbnclouds.cn/v1',
OSS_DOMAIN: '//gd-resource.cbnclouds.cn',
ROP_DOMAIN: 'cbnclouds.cn',
private: true,
privateType: 'cbnclouds',
run_port: 4002,
}
/* 正式:私有化部署(private)环境变量 */
module.exports = {
X_CA_STAGE: '',
API_DOMAIN: '//cgateway.hemeiyun.net:8680/v1',
OSS_DOMAIN: '//eos-wuxi-1.cmecloud.cn/g-resource',
ROP_DOMAIN: 'hemeiyun.net',
private: true,
privateType: 'cm'
}
/* 测试(dev)环境变量 */
module.exports = {
NODE_ENV: 'production',
X_CA_STAGE: 'TEST',
private: false,
run_server: 'development'
}
/* 写在该文件下的所有配置在所有环境下都会设置 且值可被覆盖 */
module.exports = {
baseUrl: '/lottery/',
API_DOMAIN: '//apiliveroom.dev.guangdianyun.tv/v1',
OSS_DOMAIN: '//static-pro.guangdianyun.tv',
ROP_DOMAIN: 'aodianyun.com',
X_CA_STAGE: 'TEST',
TOKEN_KEY: 'token',
private: false,
run_port: 4002,
}
/* 正式:私有化部署(private)环境变量 */
module.exports = {
X_CA_STAGE: '',
API_DOMAIN: '//cgateway.huaguangyun.cn/v1',
OSS_DOMAIN: '//g-resource.obs.cn-north-4.myhuaweicloud.com',
ROP_DOMAIN: 'huaguangyun.cn',
private: true,
privateType: 'huawei',
run_port: 34002,
}
/* 灰度(pre)环境变量 */
module.exports = {
NODE_ENV: 'production',
X_CA_STAGE: 'PRE',
private: false,
run_server: 'preview'
}
/* 正式(prod)环境变量 */
module.exports = {
NODE_ENV: 'production',
X_CA_STAGE: '',
private: false,
run_server: 'production'
}
/* 正式:私有化部署(private)环境变量 */
module.exports = {
X_CA_STAGE: '',
API_DOMAIN: '//cgateway.vvku.com/v1',
OSS_DOMAIN: '//static.vvku.com',
ROP_DOMAIN: 'vvku.com',
private: true,
privateType: 'vvku'
}
/* eslint-disable nuxt/no-cjs-in-config */ /* eslint-disable nuxt/no-cjs-in-config */
const path = require('path') const path = require('path')
/* env configs */
const globalEnvConfig = require(`./config/global.js`)
const envConfig = require(`./config/${process.env.mode || 'production'}.js`)
const env = Object.assign(globalEnvConfig, envConfig)
/* ali-oss */
const WebpackAliOSSPlugin = require('@gdyfe/webpack-alioss-plugin') const WebpackAliOSSPlugin = require('@gdyfe/webpack-alioss-plugin')
const { getEnvConfig } = require('@gdyfe/config')
const { version, name } = require('./package.json')
const env = getEnvConfig({
server: process.env.mode,
ic: 'ZmUtZ5WNp%XBzDw='
})
/* version from package.json */ const { X_CA_STAGE, RUN_SERVER, STATIC_SOURCE_DOMAIN, STATIC_OSS_ACCESS, OSS_DOMAIN } = env
const { version } = require('./package.json') const { SERVE_PORT, BASE_URL, PROJECT_NAME, SENTRY_DSN, GTAG_ID } = env.lottery
const PROJECT_NAME = 'lottery' const IS_USE_OSS = process.env.NODE_ENV === 'production'
const IS_USE_OSS = process.env.NODE_ENV === 'production' && !env.private
const plugins = IS_USE_OSS const plugins = IS_USE_OSS
? [ ? [
// 优化打包速度 // 优化打包速度
new WebpackAliOSSPlugin({ new WebpackAliOSSPlugin({
accessKeyId: 'LTAI5tDdsn3rPhNSkED4jDDz', accessKeyId: STATIC_OSS_ACCESS.accessKeyId,
accessKeySecret: 'rsWsmunIglT1NqYUNe8fvbjl02UqTk', accessKeySecret: STATIC_OSS_ACCESS.accessKeySecret,
region: 'oss-cn-hangzhou', region: STATIC_OSS_ACCESS.region,
bucket: `guangdianyun-static-${env.run_server}`, bucket: STATIC_OSS_ACCESS.bucket,
prefix: PROJECT_NAME, prefix: PROJECT_NAME,
limit: 10, // 备份最近 10 个版本的 oss 文件 limit: 10, // 备份最近 10 个版本的 oss 文件
format: version, format: version,
...@@ -32,14 +31,14 @@ const plugins = IS_USE_OSS ...@@ -32,14 +31,14 @@ const plugins = IS_USE_OSS
}) })
] ]
: [] : []
const REMOTE_OSS_DOMAIN = `//static-${env.run_server}.guangdianyun.tv`
const sentryConfig = IS_USE_OSS const sentryConfig = IS_USE_OSS
? { ? {
sentry: { sentry: {
dsn: 'https://610a9f4b831d4d10b228658886eaa18d@sentry.guangdianyun.tv/14', dsn: SENTRY_DSN,
config: { config: {
environment: env.run_server, name,
environment: RUN_SERVER,
release: version, release: version,
autoSessionTracking: false autoSessionTracking: false
}, },
...@@ -51,7 +50,7 @@ const sentryConfig = IS_USE_OSS ...@@ -51,7 +50,7 @@ const sentryConfig = IS_USE_OSS
const gtagConfig = IS_USE_OSS const gtagConfig = IS_USE_OSS
? { ? {
'google-gtag': { 'google-gtag': {
id: 'G-HZHJLDPT80', // required id: GTAG_ID, // required
config: { config: {
anonymize_ip: true, anonymize_ip: true,
send_page_view: false send_page_view: false
...@@ -68,7 +67,7 @@ export default { ...@@ -68,7 +67,7 @@ export default {
STATIC_OSS_ACCESS: '' STATIC_OSS_ACCESS: ''
}, },
router: { router: {
base: globalEnvConfig.baseUrl, base: BASE_URL,
middleware: ['device'], middleware: ['device'],
extendRoutes(routes, resolve) { extendRoutes(routes, resolve) {
routes.push({ routes.push({
...@@ -104,11 +103,11 @@ export default { ...@@ -104,11 +103,11 @@ export default {
link: [ link: [
{ {
rel: 'stylesheet', rel: 'stylesheet',
href: `${env.OSS_DOMAIN}/common/icon/iconfont.css`, href: `//${OSS_DOMAIN}/common/icon/iconfont.css`,
ssr: false ssr: false
}, },
{ rel: 'icon', href: `${env.OSS_DOMAIN}/common/img/gdy_favicon.png` }, { rel: 'icon', href: `//${OSS_DOMAIN}/common/img/gdy_favicon.png` },
{ rel: 'stylesheet', href: `${REMOTE_OSS_DOMAIN}/web-component/complaintsDeal/complaintsDeal.min.css` }, { rel: 'stylesheet', href: `//${STATIC_SOURCE_DOMAIN}/web-component/complaintsDeal/complaintsDeal.min.css` },
{ {
href: '//apiliveroom.dev.guangdianyun.tv/v1', href: '//apiliveroom.dev.guangdianyun.tv/v1',
rel: 'dns-prefetch' rel: 'dns-prefetch'
...@@ -130,7 +129,7 @@ export default { ...@@ -130,7 +129,7 @@ export default {
rel: 'dns-prefetch' rel: 'dns-prefetch'
} }
], ],
script: [{ src: `${REMOTE_OSS_DOMAIN}/web-component/complaintsDeal/complaintsDeal.min.js`, defer: true }] script: [{ src: `//${STATIC_SOURCE_DOMAIN}/web-component/complaintsDeal/complaintsDeal.min.js`, defer: true }]
}, },
// Global CSS: https://go.nuxtjs.dev/config-css // Global CSS: https://go.nuxtjs.dev/config-css
...@@ -171,14 +170,14 @@ export default { ...@@ -171,14 +170,14 @@ export default {
axios: {}, axios: {},
server: { server: {
https: !process.env.NODE_ENV === 'production', https: !process.env.NODE_ENV === 'production',
port: env.run_port, // default: 3000 port: SERVE_PORT, // default: 3000
host: '0.0.0.0' // default: localhost host: '0.0.0.0' // default: localhost
}, },
// Build Configuration: https://go.nuxtjs.dev/config-build // Build Configuration: https://go.nuxtjs.dev/config-build
build: { build: {
publicPath: !env.private publicPath: IS_USE_OSS
? `${REMOTE_OSS_DOMAIN}/${PROJECT_NAME}/${version}` ? `//${STATIC_SOURCE_DOMAIN}/${PROJECT_NAME}/${version}`
: `/${env.X_CA_STAGE.toLowerCase() || 'prod'}/`, : `/${X_CA_STAGE.toLowerCase() || 'prod'}/`,
transpile: [/vant.*?less/], transpile: [/vant.*?less/],
babel: { babel: {
plugins: [ plugins: [
......
...@@ -4,44 +4,38 @@ ...@@ -4,44 +4,38 @@
"private": true, "private": true,
"license": "UNLICENSED", "license": "UNLICENSED",
"scripts": { "scripts": {
"release": "standard-version", "serve:dev": "cross-env mode=test nuxt",
"release:minor": "standard-version -r minor", "serve:pre": "cross-env mode=preview nuxt",
"release:patch": "standard-version -r patch",
"serve": "cross-env mode=dev nuxt",
"serve:dev": "cross-env mode=dev nuxt",
"serve:pre": "cross-env mode=pre nuxt",
"serve:prod": "cross-env mode=production nuxt", "serve:prod": "cross-env mode=production nuxt",
"serve:cm": "cross-env mode=cm.private nuxt", "serve:cm": "cross-env mode=cm nuxt",
"serve:vvku": "cross-env mode=vvku.private nuxt", "serve:vvku": "cross-env mode=vvku nuxt",
"serve:cbn": "cross-env mode=cbn.private nuxt", "serve:cbn": "cross-env mode=cbn nuxt",
"serve:huawei": "cross-env mode=huawei.private nuxt", "serve:huawei": "cross-env mode=huawei nuxt",
"serve:cbnclouds": "cross-env mode=cbnclouds.private nuxt", "serve:cbnclouds": "cross-env mode=cbnclouds nuxt",
"build": "cross-env mode=dev nuxt build", "build:dev": "cross-env mode=test nuxt build",
"build:dev": "cross-env mode=dev nuxt build", "build:pre": "cross-env mode=preview nuxt build",
"build:pre": "cross-env mode=pre nuxt build",
"build:prod": "cross-env mode=production nuxt build", "build:prod": "cross-env mode=production nuxt build",
"build:cm": "cross-env mode=cm.private nuxt build", "build:cm": "cross-env mode=cm nuxt build",
"build:vvku": "cross-env mode=vvku.private nuxt build", "build:vvku": "cross-env mode=vvku nuxt build",
"build:cbn": "cross-env mode=cbn.private nuxt build", "build:cbn": "cross-env mode=cbn nuxt build",
"build:huawei": "cross-env mode=huawei.private nuxt build", "build:huawei": "cross-env mode=huawei nuxt build",
"build:cbnclouds": "cross-env mode=cbnclouds.private nuxt build", "build:cbnclouds": "cross-env mode=cbnclouds nuxt build",
"start": "cross-env mode=dev nuxt start", "start:dev": "cross-env mode=test nuxt start",
"start:dev": "cross-env mode=dev nuxt start", "start:pre": "cross-env mode=preview nuxt start",
"start:pre": "cross-env mode=pre nuxt start",
"start:prod": "cross-env mode=production nuxt start", "start:prod": "cross-env mode=production nuxt start",
"start:cm": "cross-env mode=cm.private nuxt start", "start:cm": "cross-env mode=cm nuxt start",
"start:vvku": "cross-env mode=vvku.private nuxt start", "start:vvku": "cross-env mode=vvku nuxt start",
"start:cbn": "cross-env mode=cbn.private nuxt start", "start:cbn": "cross-env mode=cbn nuxt start",
"start:huawei": "cross-env mode=huawei.private nuxt start", "start:huawei": "cross-env mode=huawei nuxt start",
"start:cbnclouds": "cross-env mode=cbnclouds.private nuxt start", "start:cbnclouds": "cross-env mode=cbnclouds nuxt start",
"pm2:dev": "pm2 start pm2.json --only lottery_test", "pm2:dev": "pm2 start pm2.json --only lottery-test",
"pm2:pre": "pm2 start pm2.json --only lottery_pre", "pm2:pre": "pm2 start pm2.json --only lottery-pre",
"pm2": "pm2 start pm2.json --only lottery", "pm2:prod": "pm2 start pm2.json --only lottery-prod",
"pm2:cm": "pm2 start pm2.json --only lottery_cm", "pm2:cm": "pm2 start pm2.json --only lottery-cm",
"pm2:vvku": "pm2 start pm2.json --only lottery_vvku", "pm2:vvku": "pm2 start pm2.json --only lottery-vvku",
"pm2:cbn": "pm2 start pm2.json --only lottery_cbn", "pm2:cbn": "pm2 start pm2.json --only lottery-cbn",
"pm2:huawei": "pm2 start pm2.json --only lottery_huawei", "pm2:huawei": "pm2 start pm2.json --only lottery-huawei",
"pm2:cbnclouds": "pm2 start pm2.json --only lottery_cbnclouds", "pm2:cbnclouds": "pm2 start pm2.json --only lottery-cbnclouds",
"generate": "nuxt generate", "generate": "nuxt generate",
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .", "lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
"lint:style": "stylelint \"**/*.{vue,css}\" --ignore-path .gitignore", "lint:style": "stylelint \"**/*.{vue,css}\" --ignore-path .gitignore",
...@@ -49,6 +43,7 @@ ...@@ -49,6 +43,7 @@
}, },
"dependencies": { "dependencies": {
"@easy-messenger/client-connection": "^1.0.3", "@easy-messenger/client-connection": "^1.0.3",
"@gdyfe/config": "^1.2.8",
"@gdyfe/gdy-component-lib": "^0.4.1", "@gdyfe/gdy-component-lib": "^0.4.1",
"@gdyfe/rop-client": "1.1.10", "@gdyfe/rop-client": "1.1.10",
"@nuxtjs/axios": "^5.13.6", "@nuxtjs/axios": "^5.13.6",
......
...@@ -48,7 +48,6 @@ export default { ...@@ -48,7 +48,6 @@ export default {
...mapActions({ ...mapActions({
getLotteryDetail: 'lottery/getLotteryDetail', getLotteryDetail: 'lottery/getLotteryDetail',
updateInfo: 'lottery/updateInfo', updateInfo: 'lottery/updateInfo',
getUerInfo: 'users/getUerInfo',
postInfo: 'users/postInfo' postInfo: 'users/postInfo'
}), }),
// 页面进入初始化 // 页面进入初始化
......
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
{{ getStatus(item).label }} {{ getStatus(item).label }}
</div> </div>
<div class="session-list__time"> <div class="session-list__time">
{{ index + 1 }}场: {{ index + 1 }}<span v-if="getStatus(item).label === '已结束'"
{{ (item.startTime * 1000) | formatDate('MM/DD HH:mm') }} >
{{ (item.startTime * 1000) | formatDate('MM/DD HH:mm') }}
{{ (item.endTime * 1000) | formatDate('MM/DD HH:mm') }}
{{ (item.endTime * 1000) | formatDate('MM/DD HH:mm') }}</span
>
</div> </div>
</div> </div>
</li> </li>
......
<template> <template>
<section class="lottery-box"> <section class="lottery-box">
<component <component :is="lotteryComponents[+lotteryInfo.type]" v-if="'type' in lotteryInfo && lotteryInfo.type"></component>
:is="lotteryComponents[+lotteryInfo.type]" <ComplaintsDeal></ComplaintsDeal>
v-if="'type' in lotteryInfo && lotteryInfo.type"
></component>
<Loading v-model="isLoading" class="lottery-box__loading"></Loading> <Loading v-model="isLoading" class="lottery-box__loading"></Loading>
</section> </section>
</template> </template>
...@@ -14,9 +12,11 @@ import { LOTTERY_TYPE } from '@/utils/constant' ...@@ -14,9 +12,11 @@ import { LOTTERY_TYPE } from '@/utils/constant'
import Bus from '@/utils/Bus' import Bus from '@/utils/Bus'
import UserAgents from '@/utils/UserAgents' import UserAgents from '@/utils/UserAgents'
import CONFIG from '@/config' import CONFIG from '@/config'
import ComplaintsDeal from '@/components/Common/ComplaintsDeal'
export default { export default {
components: { components: {
ComplaintsDeal,
Loading: () => import('@/components/Loading') Loading: () => import('@/components/Loading')
}, },
layout: 'miniNavBar', layout: 'miniNavBar',
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
isLoading: true, isLoading: true,
lotteryComponents: { lotteryComponents: {
[LOTTERY_TYPE.instant]: () => import('@/components/Lottery/Instant/MiniMain'), [LOTTERY_TYPE.instant]: () => import('@/components/Lottery/Instant/MiniMain'),
[LOTTERY_TYPE.timing]: () => import('@/components/Lottery/Timing/Main') [LOTTERY_TYPE.timing]: () => import('@/components/Lottery/Timing/MiniMain')
}, },
id: this.$route.query.id || null, // 接收抽奖id id: this.$route.query.id || null, // 接收抽奖id
sessionId: this.$route.query.sessionId || null, // 接收抽奖场次id sessionId: this.$route.query.sessionId || null, // 接收抽奖场次id
...@@ -54,7 +54,6 @@ export default { ...@@ -54,7 +54,6 @@ export default {
...mapActions({ ...mapActions({
getLotteryDetail: 'lottery/getLotteryDetail', getLotteryDetail: 'lottery/getLotteryDetail',
updateInfo: 'lottery/updateInfo', updateInfo: 'lottery/updateInfo',
getUerInfo: 'users/getUerInfo',
postInfo: 'users/postInfo' postInfo: 'users/postInfo'
}), }),
connectionInit() { connectionInit() {
...@@ -72,7 +71,7 @@ export default { ...@@ -72,7 +71,7 @@ export default {
}, 1000) }, 1000)
} }
}, },
connectionListener() {}, connectionListener() { },
// 页面进入初始化 // 页面进入初始化
dataInit() { dataInit() {
const { id, sessionId: playId, uin } = this.$route.query const { id, sessionId: playId, uin } = this.$route.query
...@@ -116,6 +115,7 @@ export default { ...@@ -116,6 +115,7 @@ export default {
const { id, playId } = data const { id, playId } = data
const { sessionId: currentPlayId, id: currentId } = this const { sessionId: currentPlayId, id: currentId } = this
if (+id === +currentId && +playId === +currentPlayId) { if (+id === +currentId && +playId === +currentPlayId) {
// eslint-disable-next-line no-unused-vars
const { status, startTime, endTime, userTimes } = data const { status, startTime, endTime, userTimes } = data
// 状态 // 状态
this.updateInfo({ this.updateInfo({
......
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
{{ getStatus(item).label }} {{ getStatus(item).label }}
</div> </div>
<div class="session-list__time"> <div class="session-list__time">
{{ index + 1 }}场: {{ index + 1 }}<span v-if="getStatus(item).label === '已结束'"
{{ (item.startTime * 1000) | formatDate('MM/DD HH:mm') }} >
{{ (item.startTime * 1000) | formatDate('MM/DD HH:mm') }}
{{ (item.endTime * 1000) | formatDate('MM/DD HH:mm') }}
{{ (item.endTime * 1000) | formatDate('MM/DD HH:mm') }}</span
>
</div> </div>
</div> </div>
</li> </li>
......
import Vue from "vue";
import VueGtag from "vue-gtag"; // 谷歌统计
import { GTAG_ID } from "@/config";
if (process.env.NODE_ENV === "production" && !process.env.private) {
Vue.use(VueGtag, {
config: {
id: GTAG_ID,
params: {
anonymize_ip: true,
send_page_view: false,
},
},
});
}
export default async function ({ route, store }) { export default async function ({ route, store }) {
const { id = 0, uin = 0 } = route.query const { id = 0, uin = 0 } = route.query
await store.dispatch('users/getUerInfo', { uin }) try {
// pv统计 await store.dispatch('users/getUerInfo', { uin })
await store.dispatch('users/postInfo', id) // pv统计
await store.dispatch('users/postInfo', id)
}
catch (error) {
console.log(error)
}
} }
import Report from "gdy-report";
import { sentryOptions } from "@/config";
import Vue from "vue";
/* 初始化 */
if (process.env.NODE_ENV === "production" && !process.env.private) {
Report(sentryOptions);
}
Vue.prototype.$report = Report;
\ No newline at end of file
{ {
"apps": [ "apps": [
{ {
"name": "lottery_test", "name": "lottery-test",
"script": "npm", "script": "npm",
"args": "run start:dev", "args": "run start:dev",
"instances": "max", "instances": "max",
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
"autorestart": true, "autorestart": true,
"max_memory_restart": "4G", "max_memory_restart": "4G",
"env": { "env": {
"port": 4002, "mode": "test",
"NODE_ENV": "production" "NODE_ENV": "production"
}, },
"error_file": "./logs/app-err.log", // 错误日志文件 "error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log" // 正常日志文件 "out_file": "./logs/app-out.log"
}, },
{ {
"name": "lottery_pre", "name": "lottery-pre",
"script": "npm", "script": "npm",
"args": "run start:pre", "args": "run start:pre",
"instances": "max", "instances": "max",
...@@ -24,14 +24,14 @@ ...@@ -24,14 +24,14 @@
"autorestart": true, "autorestart": true,
"max_memory_restart": "4G", "max_memory_restart": "4G",
"env": { "env": {
"port": 4002, "mode": "preview",
"NODE_ENV": "production" "NODE_ENV": "production"
}, },
"error_file": "./logs/app-err.log", // 错误日志文件 "error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log" // 正常日志文件 "out_file": "./logs/app-out.log"
}, },
{ {
"name": "lottery", "name": "lottery-prod",
"script": "npm", "script": "npm",
"args": "run start:prod", "args": "run start:prod",
"instances": "max", "instances": "max",
...@@ -39,14 +39,14 @@ ...@@ -39,14 +39,14 @@
"autorestart": true, "autorestart": true,
"max_memory_restart": "8G", "max_memory_restart": "8G",
"env": { "env": {
"port": 4002, "mode": "production",
"NODE_ENV": "production" "NODE_ENV": "production"
}, },
"error_file": "./logs/app-err.log", // 错误日志文件 "error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log" // 正常日志文件 "out_file": "./logs/app-out.log"
}, },
{ {
"name": "lottery_cm", "name": "lottery-cm",
"script": "npm", "script": "npm",
"args": "run start:cm", "args": "run start:cm",
"instances": "max", "instances": "max",
...@@ -54,14 +54,14 @@ ...@@ -54,14 +54,14 @@
"autorestart": true, "autorestart": true,
"max_memory_restart": "8G", "max_memory_restart": "8G",
"env": { "env": {
"port": 4002, "mode": "cm",
"NODE_ENV": "production" "NODE_ENV": "production"
}, },
"error_file": "./logs/app-err.log", "error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log" "out_file": "./logs/app-out.log"
}, },
{ {
"name": "lottery_vvku", "name": "lottery-vvku",
"script": "npm", "script": "npm",
"args": "run start:vvku", "args": "run start:vvku",
"instances": "max", "instances": "max",
...@@ -69,14 +69,14 @@ ...@@ -69,14 +69,14 @@
"autorestart": true, "autorestart": true,
"max_memory_restart": "8G", "max_memory_restart": "8G",
"env": { "env": {
"port": 4002, "mode": "vvku",
"NODE_ENV": "production" "NODE_ENV": "production"
}, },
"error_file": "./logs/app-err.log", "error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log" "out_file": "./logs/app-out.log"
}, },
{ {
"name": "lottery_cbn", "name": "lottery-cbn",
"script": "npm", "script": "npm",
"args": "run start:cbn", "args": "run start:cbn",
"instances": "max", "instances": "max",
...@@ -84,14 +84,14 @@ ...@@ -84,14 +84,14 @@
"autorestart": true, "autorestart": true,
"max_memory_restart": "8G", "max_memory_restart": "8G",
"env": { "env": {
"port": 4002, "mode": "cbn",
"NODE_ENV": "production" "NODE_ENV": "production"
}, },
"error_file": "./logs/app-err.log", "error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log" "out_file": "./logs/app-out.log"
}, },
{ {
"name": "lottery_huawei", "name": "lottery-huawei",
"script": "npm", "script": "npm",
"args": "run start:huawei", "args": "run start:huawei",
"instances": "max", "instances": "max",
...@@ -99,14 +99,14 @@ ...@@ -99,14 +99,14 @@
"autorestart": true, "autorestart": true,
"max_memory_restart": "8G", "max_memory_restart": "8G",
"env": { "env": {
"port": 34002, "mode": "huawei",
"NODE_ENV": "production" "NODE_ENV": "production"
}, },
"error_file": "./logs/app-err.log", "error_file": "./logs/app-err.log",
"out_file": "./logs/app-out.log" "out_file": "./logs/app-out.log"
}, },
{ {
"name": "lottery_cbnclouds", "name": "lottery-cbnclouds",
"script": "npm", "script": "npm",
"args": "run start:cbnclouds", "args": "run start:cbnclouds",
"instances": "max", "instances": "max",
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
"autorestart": true, "autorestart": true,
"max_memory_restart": "32G", "max_memory_restart": "32G",
"env": { "env": {
"port": 4002, "mode": "cbnclouds",
"NODE_ENV": "production" "NODE_ENV": "production"
}, },
"error_file": "./logs/app-err.log", "error_file": "./logs/app-err.log",
......
#!/bin/sh #!/bin/sh
/etc/init.d/zabbix_agentd start /etc/init.d/zabbix_agentd start
yarn run pm2 yarn run pm2:prod
while true while true
do do
......
...@@ -64,8 +64,12 @@ class Dms { ...@@ -64,8 +64,12 @@ class Dms {
Bus.$emit('LotteryInfoUpdate', data) Bus.$emit('LotteryInfoUpdate', data)
} }
// 抽奖时间更新 // 抽奖时间更新
if (data.cmd === 'draw_time_start') { // if (data.cmd === 'draw_time_start') {
Bus.$emit('LotteryInfoUpdate', data) // Bus.$emit('LotteryInfoUpdate', data)
// }
// 中奖结果
if (data.cmd === 'draw_result') {
Bus.$emit('LotteryResult', data)
} }
break break
default: default:
......
/**
* @file aliyun arms report method of commonJS
* @since 1.0.8
* @author whzcorcd <whzcorcd@gmail.com>
*
* 阿里前端监控
* 配置文档 https://www.npmjs.com/package/alife-logger
*
* 使用示例:const arms = require('arms')
* const logger = arms('huh7k89btk@39bb266d318880a', true, true)
* logger && logger.api(url, true, time, res.data.Flag, res.data.FlagString)
* 示例解析:arms(应用 pid, 是否关闭 API 自动上报, 是否启用 SPA 分析)
* api(请求地址,请求成功与否,请求耗时,请求状态码,请求返回 Msg)
*/
const BrowerLogger = require('alife-logger')
const __bl = (pid, disableHook = false, enableSPA = true) => {
try {
return BrowerLogger.singleton({
pid,
appType: 'web',
imgUrl: 'https://arms-retcode.aliyuncs.com/r.png?',
sendResource: true,
enableLinkTrace: true,
behavior: true,
disableHook,
useFmp: true,
enableSPA
})
} catch (e) {
// eslint-disable-next-line no-console
console.error('init logger fail', e)
return false
}
}
module.exports = process.env.NODE_ENV === 'production' ? __bl : false
...@@ -58,7 +58,7 @@ class WxShare { ...@@ -58,7 +58,7 @@ class WxShare {
link: info?.link || window.location.href, link: info?.link || window.location.href,
title: info?.title || '分享', title: info?.title || '分享',
desc: info?.desc || window.location.href, // 副标题 desc: info?.desc || window.location.href, // 副标题
imgUrl: info?.imgUrl || `${window.location.protocol}${process.env.OSS_DOMAIN}/common/img/shop_share.png`, imgUrl: info?.imgUrl || `${window.location.protocol}//${process.env.OSS_DOMAIN}/common/img/shop_share.png`,
success: info?.success || function () {}, success: info?.success || function () {},
fail: info?.fail || function () {}, fail: info?.fail || function () {},
} }
......
...@@ -964,6 +964,13 @@ ...@@ -964,6 +964,13 @@
dependencies: dependencies:
"@fortawesome/fontawesome-common-types" "^0.2.35" "@fortawesome/fontawesome-common-types" "^0.2.35"
"@gdyfe/config@^1.2.8":
version "1.2.8"
resolved "https://registry.yarnpkg.com/@gdyfe/config/-/config-1.2.8.tgz#f93b04ce74579af6249f28dfb992c72818f46d8a"
integrity sha512-IEg9Pb/UAJqwOjIlNx05OFrWXjw+Ci6pDk0HdgdjDzqhI6RMpoNGAjCiDfA9UA1oQpMG/KUNlKyJnDCXmCj3gA==
dependencies:
node-rsa "^1.1.1"
"@gdyfe/gdy-component-lib@^0.4.1": "@gdyfe/gdy-component-lib@^0.4.1":
version "0.4.1" version "0.4.1"
resolved "https://registry.yarnpkg.com/@gdyfe/gdy-component-lib/-/gdy-component-lib-0.4.1.tgz#05f60cb3a2542064730b104875633eae597630ca" resolved "https://registry.yarnpkg.com/@gdyfe/gdy-component-lib/-/gdy-component-lib-0.4.1.tgz#05f60cb3a2542064730b104875633eae597630ca"
...@@ -2251,6 +2258,13 @@ asn1.js@^5.2.0: ...@@ -2251,6 +2258,13 @@ asn1.js@^5.2.0:
minimalistic-assert "^1.0.0" minimalistic-assert "^1.0.0"
safer-buffer "^2.1.0" safer-buffer "^2.1.0"
asn1@^0.2.4:
version "0.2.6"
resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d"
integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==
dependencies:
safer-buffer "~2.1.0"
assert@^1.1.1: assert@^1.1.1:
version "1.5.0" version "1.5.0"
resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb" resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb"
...@@ -6481,6 +6495,13 @@ node-res@^5.0.1: ...@@ -6481,6 +6495,13 @@ node-res@^5.0.1:
on-finished "^2.3.0" on-finished "^2.3.0"
vary "^1.1.2" vary "^1.1.2"
node-rsa@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/node-rsa/-/node-rsa-1.1.1.tgz#efd9ad382097782f506153398496f79e4464434d"
integrity sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==
dependencies:
asn1 "^0.2.4"
normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: normalize-package-data@^2.3.2, normalize-package-data@^2.5.0:
version "2.5.0" version "2.5.0"
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8"
...@@ -8363,7 +8384,7 @@ safe-regex@^2.1.1: ...@@ -8363,7 +8384,7 @@ safe-regex@^2.1.1:
dependencies: dependencies:
regexp-tree "~0.1.1" regexp-tree "~0.1.1"
"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.1.0: "safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2" version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
......
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