Commit 60a922d7 by 陆志强

feat: csr改造

parent 1445be5e
module.exports = {
root: true,
env: {
browser: true,
node: true
},
env: {},
extends: [
'alloy',
'alloy/vue',
],
parserOptions: {
parser: '@babel/eslint-parser',
requireConfigFile: false
},
extends: [
'@nuxtjs',
'plugin:nuxt/recommended',
'prettier'
],
plugins: [
],
// add your custom rules here
rules: {}
}
ignorePatterns: ["**/WSTimer/timer.js", "public/**"],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
"vue/component-tags-order": ["error", {
"order": ["template", "script", "style"]
}],
"vue/multi-word-component-names":"off",
'vue/no-reserved-component-names': 'off',
'new-cap': 'off',
'vue/no-duplicate-attributes': 'off',
"max-lines-per-function": 'off',
"complexity": 'off',
"max-params": 'off',
"max-depth": ["error", 6],
"no-param-reassign": [
"error",
{
"props": true,
"ignorePropertyModificationsFor": [
"e", // for e.returnvalue
"ctx", // for Koa routing
"req", // for Express requests
"request", // for Express requests
"res", // for Express responses
"response", // for Express responses
"state", // for vuex state
"item",
"files"
]
}
]
},
};
const protocol = process.client && window.location.protocol
export default {
goDomain: `//${process.env.GO_API_DOMAIN}/v1`,
privateDomain: `//${process.env.PRIVATE_API_DOMAIN}/v1`,
activityDomain: `//${process.env.ACTIVITY_API_DOMAIN}/v1`,
defBanner: `//${process.env.OSS_DOMAIN}/common/img/lottery_banner_default_v2.png`,
defShareImg: `${protocol || 'https:'}//${process.env.OSS_DOMAIN}/common/img/lottery.png`, // 必须带协议头,否则微信分享配置时无法生效
ossImageServe: process.env.IS_PRIVATE ? '' : '?x-oss-process=style/mobilebackground',
}
......@@ -35,21 +35,21 @@
"dependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@easy-messenger/client-connection": "^1.0.3",
"@gdyfe/config": "^2.0.1",
"@gdyfe/config": "^2.1.5",
"@gdyfe/gdy-component-lib": "^0.4.1",
"@gdyfe/rop-client": "1.1.10",
"axios": "^0.18.0",
"@vant/area-data": "^1.5.1",
"core-js": "^3.15.1",
"core-js": "^3.37.1",
"dayjs": "^1.10.6",
"js-cookie": "2.2.0",
"lotteries": "^1.2.2",
"normalize.css": "^8.0.1",
"nuxt": "^2.15.8",
"qrcode": "^1.4.4",
"uuid": "^8.3.2",
"vant": "^2.12.22",
"vconsole": "^3.9.1",
"vue": "^2.6.14",
"vue-clipboard2": "^0.3.1",
"vue-cookie": "^1.1.4",
"vue-router": "^3.1.3",
......@@ -62,14 +62,17 @@
"@babel/eslint-parser": "^7.14.7",
"@gdyfe/webpack-alioss-plugin": "^0.1.6",
"@vant/touch-emulator": "^1.3.2",
"@vue/cli-plugin-babel": "^4.0.0",
"@vue/cli-plugin-eslint": "^4.0.0",
"@vue/cli-service": "^4.0.0",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/eslint-config-airbnb": "^4.0.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-plugin-import": "^1.13.3",
"cross-env": "^7.0.3",
"eslint": "^7.29.0",
"eslint-config-alloy": "^3.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-nuxt": "^2.0.0",
"eslint-plugin-vue": "^7.12.1",
......
......@@ -7,8 +7,10 @@
<meta http-equiv="Cache-Control" content="no-store no-cache" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> -->
<link href="<%= BASE_URL %>config.js" rel="preload" as="script" />
<script src="<%= BASE_URL %>config.js"></script>
<link href="<%= BASE_URL %><%= process.env.VUE_APP_ASSETS_DIR %>/config.js" rel="preload" as="script" />
<!-- <link href="<%= BASE_URL %><%= process.env.VUE_APP_ASSETS_DIR %>/moduleLoader.js" rel="preload" as="script" /> -->
<script src="<%= BASE_URL %><%= process.env.VUE_APP_ASSETS_DIR %>/config.js"></script>
<!-- <script src="<%= BASE_URL %><%= process.env.VUE_APP_ASSETS_DIR %>/moduleLoader.js"></script> -->
<title></title>
<script>
;(function() {
......
/*!
* Global Config for Guangdianyun v1.5.0
* Global Config for Guangdianyun v1.6.0
* https://guangdianyun.tv/
*
* Copyright belongs to Guangdianyun Corporation and other contributors
* Released under the Proprietary License
*
* Date: 2023-10-10 11:45:24
* Date: 2024-05-16 15:01:07
*/
(function () {
if (!!window.__GDY_ENV_CONFIG__) return;
......@@ -29,6 +29,7 @@
"OSS_DOMAIN": "static-pro.guangdianyun.tv",
"ROP_DOMAIN": "aodianyun.com",
"CNAME_DOMAIN": "guangdianyun.tv",
"HELPER_DOMAIN": "help-dev.guangdianyun.tv",
"AODIAN_OSS_DOMAIN": "cdn.aodianyun.com",
"CONSOLES_DOMAIN": "consoles.dev.guangdianyun.tv",
"CHANNEL_DOMAIN": "pindao.dev.guangdianyun.tv",
......
......@@ -17,6 +17,7 @@ axiosService.defaults.baseURL = `https://${ENV_CONFIG.CUSTOMER_API_DOMAIN}/v1`;
axiosService.defaults.timeout = 3 * 1000;
// 请求拦截器
/* eslint-disable no-param-reassign */
axiosService.interceptors.request.use(
config => {
const token = VueCookie.get(ENV_CONFIG.CUSTOMER_TOKEN_KEY);
......
<template>
<van-dialog v-model="visible" class="bind-phone-dialog" confirm-button-text="前往绑定" @confirm="bindMobile">
<div slot="title" class="bind-phone-dialog__title">
<span>提示</span>
<i class="bind-phone-dialog__close van-icon van-icon-cross" @click="onClose"></i>
</div>
<template slot:title>
<div class="bind-phone-dialog__title">
<span>提示</span>
<i class="bind-phone-dialog__close van-icon van-icon-cross" @click="onClose"></i>
</div>
</template>
<div class="bind-phone-dialog__content">您当前未绑定手机号,为确保联系到您,请绑定手机号</div>
</van-dialog>
</template>
......
......@@ -16,15 +16,19 @@
<template v-if="lotteryInfo.premise && lotteryInfo.premise.includes('phone')">
<van-field v-model="form.phone" label-width="60" label="手机号" placeholder="请输入联系电话" @focus="isError = false"/>
<van-field v-model="form.code" label-width="60" label="验证码" placeholder="请输入验证码" @focus="isError = false">
<span slot="button" class="code" @click="sendCode">
<span v-if="!isSend">获取验证码</span>
<span v-else>{{ time }}s后重发</span>
</span>
<template slot:button>
<span class="code" @click="sendCode">
<span v-if="!isSend">获取验证码</span>
<span v-else>{{ time }}s后重发</span>
</span>
</template>
</van-field>
</template>
<template v-if="lotteryInfo.premise && lotteryInfo.premise.includes('address')">
<van-field v-model="form.address" label-width="60" label="收货地址" readonly placeholder="请选择省市区" @focus="isError = false" @click="select" >
<van-icon slot="button" name="location" />
<template slot:button>
<van-icon name="location" />
</template>
</van-field>
<van-field
v-model="form.detail"
......
<template>
<div class="lottery-type">
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.scratch" class="lottery-type-scratch">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.scratch" class="lottery-type-scratch">
<TypeScratch
ref="typeScratchRef"
:win-info="winInfo"
......@@ -10,7 +10,7 @@
:is-lottering="isLottering"
/>
</div>
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.gashapon" class="lottery-type-gashapon">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.gashapon" class="lottery-type-gashapon">
<TypeGashapon
v-if="randomType === 1"
ref="typeGashaponRef"
......@@ -30,7 +30,7 @@
:is-lottering="isLottering"
/>
</div>
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.guess" class="lottery-type-gashapon">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.guess" class="lottery-type-gashapon">
<TypeGuess
v-if="randomType === 1"
ref="typeGuessRef"
......@@ -51,11 +51,11 @@
/>
</div>
<section
v-if="+lotteryInfo.showType === LOTTERY_STYLE.grid || +lotteryInfo.showType === LOTTERY_STYLE.wheel"
v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.grid || Number(lotteryInfo.showType) === LOTTERY_STYLE.wheel"
class="lottery-instant"
>
<Banner class="lottery-instant__banner"></Banner>
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.grid" class="lottery-instant__layout-grid">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.grid" class="lottery-instant__layout-grid">
<div class="lottery-instant__content-grid">
<CountdownBar class="lottery-instant__countdown"></CountdownBar>
<div class="lottery-instant__times">
......@@ -109,7 +109,7 @@
</div>
</div>
</div>
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.wheel" class="lottery-instant__layout-wheel">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.wheel" class="lottery-instant__layout-wheel">
<div class="lottery-instant__content-wheel">
<CountdownBar class="lottery-instant__countdown"></CountdownBar>
<div class="lottery-instant__wheel" :class="{ 'lottery-instant__wheel--no-lightning': !isLottering }">
......@@ -163,8 +163,8 @@ import { LOTTERY_STATUS, LOTTERY_STATUS_TXT, LOTTERY_STYLE } from '@/utils/const
import { PrizeGrid, PrizeWheel } from 'lotteries'
import 'lotteries/lib/index.css'
import Bus from '@/utils/Bus'
import VueCookie from "vue-cookie";
import { ENV_CONFIG } from "@/config";
// import VueCookie from "vue-cookie";
// import { ENV_CONFIG } from "@/config";
export default {
name: 'Main',
......@@ -238,7 +238,7 @@ export default {
isNotStart() {
// 抽奖不在活动日期内
const { status } = this.lotteryInfo
return +status !== LOTTERY_STATUS.start
return Number(status) !== LOTTERY_STATUS.start
},
buttonClass() {
if (!this.lotteryInfo.userTimes || this.isNotStart) {
......@@ -309,7 +309,7 @@ export default {
startLottery() {
// 抽奖不在活动日期内
if (this.isNotStart) {
this.$toast(`抽奖活动${LOTTERY_STATUS_TXT[+this.lotteryInfo.status].label}`)
this.$toast(`抽奖活动${LOTTERY_STATUS_TXT[Number(this.lotteryInfo.status)].label}`)
return
}
// 正在抽奖动画过程中或正在加载数据
......@@ -366,19 +366,19 @@ export default {
times--
this.updateInfo({ userTimes: times })
/* 执行动画 */
if (+this.lotteryInfo.showType === LOTTERY_STYLE.grid) {
this.$refs.prizeGrid.start(+data?.id || 0)
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.grid) {
this.$refs.prizeGrid.start(Number(data?.id) || 0)
}
if (+this.lotteryInfo.showType === LOTTERY_STYLE.wheel) {
this.$refs.prizeWheel.start(+data?.id || 0)
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.wheel) {
this.$refs.prizeWheel.start(Number(data?.id) || 0)
}
if (+this.lotteryInfo.showType === LOTTERY_STYLE.scratch) {
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.scratch) {
this.$refs.typeScratchRef.drawAnimation()
}
if (+this.lotteryInfo.showType === LOTTERY_STYLE.gashapon) {
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.gashapon) {
this.$refs.typeGashaponRef.drawAnimation()
}
if (+this.lotteryInfo.showType === LOTTERY_STYLE.guess) {
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.guess) {
this.$refs.typeGuessRef.drawAnimation()
}
this.isLottering = true
......
<template>
<div class="lottery-type">
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.scratch" class="lottery-type-scratch">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.scratch" class="lottery-type-scratch">
<TypeScratch
ref="typeScratchRef"
:win-info="winInfo"
......@@ -11,7 +11,7 @@
:is-show-intro="isShowIntro"
/>
</div>
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.gashapon" class="lottery-type-gashapon">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.gashapon" class="lottery-type-gashapon">
<TypeGashapon
v-if="randomType === 1"
ref="typeGashaponRef"
......@@ -33,7 +33,7 @@
:is-show-intro="isShowIntro"
/>
</div>
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.guess" class="lottery-type-guess">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.guess" class="lottery-type-guess">
<TypeGuess
v-if="randomType === 1"
ref="typeGuessRef"
......@@ -56,11 +56,11 @@
/>
</div>
<section
v-if="+lotteryInfo.showType === LOTTERY_STYLE.grid || +lotteryInfo.showType === LOTTERY_STYLE.wheel"
v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.grid || Number(lotteryInfo.showType) === LOTTERY_STYLE.wheel"
class="lottery-instant"
>
<Banner v-if="isShowBanner" class="lottery-instant__banner"></Banner>
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.grid" class="lottery-instant__layout-grid">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.grid" class="lottery-instant__layout-grid">
<div class="lottery-instant__content-grid">
<CountdownBar class="lottery-instant__countdown"></CountdownBar>
<div class="lottery-instant__times">
......@@ -114,7 +114,7 @@
</div>
</div>
</div>
<div v-if="+lotteryInfo.showType === LOTTERY_STYLE.wheel" class="lottery-instant__layout-wheel">
<div v-if="Number(lotteryInfo.showType) === LOTTERY_STYLE.wheel" class="lottery-instant__layout-wheel">
<div class="lottery-instant__content-wheel">
<CountdownBar class="lottery-instant__countdown"></CountdownBar>
<div class="lottery-instant__wheel" :class="{ 'lottery-instant__wheel--no-lightning': !isLottering }">
......@@ -243,7 +243,7 @@ export default {
isNotStart() {
// 抽奖不在活动日期内
const { status } = this.lotteryInfo
return +status !== LOTTERY_STATUS.start
return Number(status) !== LOTTERY_STATUS.start
},
buttonClass() {
if (!this.lotteryInfo.userTimes || this.isNotStart) {
......@@ -313,7 +313,7 @@ export default {
startLottery() {
// 抽奖不在活动日期内
if (this.isNotStart) {
this.$toast(`抽奖活动${LOTTERY_STATUS_TXT[+this.lotteryInfo.status].label}`)
this.$toast(`抽奖活动${LOTTERY_STATUS_TXT[Number(this.lotteryInfo.status)].label}`)
return
}
// 正在抽奖动画过程中或正在加载数据
......@@ -370,19 +370,19 @@ export default {
times--
this.updateInfo({ userTimes: times })
/* 执行动画 */
if (+this.lotteryInfo.showType === LOTTERY_STYLE.grid) {
this.$refs.prizeGrid.start(+data?.id || 0)
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.grid) {
this.$refs.prizeGrid.start(Number(data?.id) || 0)
}
if (+this.lotteryInfo.showType === LOTTERY_STYLE.wheel) {
this.$refs.prizeWheel.start(+data?.id || 0)
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.wheel) {
this.$refs.prizeWheel.start(Number(data?.id) || 0)
}
if (+this.lotteryInfo.showType === LOTTERY_STYLE.scratch) {
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.scratch) {
this.$refs.typeScratchRef.drawAnimation()
}
if (+this.lotteryInfo.showType === LOTTERY_STYLE.gashapon) {
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.gashapon) {
this.$refs.typeGashaponRef.drawAnimation()
}
if (+this.lotteryInfo.showType === LOTTERY_STYLE.guess) {
if (Number(this.lotteryInfo.showType) === LOTTERY_STYLE.guess) {
this.$refs.typeGuessRef.drawAnimation()
}
this.isLottering = true
......
......@@ -71,7 +71,7 @@ export default {
}
},
isWin() {
return !!+this.info.id
return !!Number(this.info.id)
}
},
methods: {
......
......@@ -98,7 +98,7 @@ export default {
isNotStart() {
// 抽奖不在活动日期内
const { status } = this.lotteryInfo
return +status !== LOTTERY_STATUS.start
return Number(status) !== LOTTERY_STATUS.start
},
// 按钮图片样式
btnImg() {
......
......@@ -100,7 +100,7 @@ export default {
isNotStart() {
// 抽奖不在活动日期内
const { status } = this.lotteryInfo
return +status !== LOTTERY_STATUS.start
return Number(status) !== LOTTERY_STATUS.start
},
// 按钮图片样式
buttonImg() {
......
......@@ -105,7 +105,7 @@ export default {
isNotStart() {
// 抽奖不在活动日期内
const { status } = this.lotteryInfo
return +status !== LOTTERY_STATUS.start
return Number(status) !== LOTTERY_STATUS.start
},
// 按钮图片样式
btnImg() {
......
......@@ -102,7 +102,7 @@ export default {
isNotStart() {
// 抽奖不在活动日期内
const { status } = this.lotteryInfo
return +status !== LOTTERY_STATUS.start
return Number(status) !== LOTTERY_STATUS.start
},
// 按钮图片样式
buttonImg() {
......
......@@ -124,7 +124,7 @@ export default {
isNotStart() {
// 抽奖不在活动日期内
const { status } = this.lotteryInfo
return +status !== LOTTERY_STATUS.start
return Number(status) !== LOTTERY_STATUS.start
},
// 按钮图片样式
buttonImg() {
......@@ -134,7 +134,7 @@ export default {
return onStartImg
},
isWin() {
return !!+this.winInfo.id
return !!Number(this.winInfo.id)
}
},
mounted() {
......
......@@ -131,7 +131,7 @@ export default {
isNotStart() {
// 抽奖不在活动日期内
const { status } = this.lotteryInfo
return +status !== LOTTERY_STATUS.start
return Number(status) !== LOTTERY_STATUS.start
},
// 按钮图片样式
buttonImg() {
......@@ -141,7 +141,7 @@ export default {
return onStartImg
},
isWin() {
return !!+this.winInfo.id
return !!Number(this.winInfo.id)
}
},
mounted() {
......
<template>
<div class="main">
<div
:style="{
height: this.$route.path === '/mini/index' ? '65.5vh' : lotteryInfo.showType === 7 ? '46.5vh' : '37.5vh'
}"
:style="{styleObj}"
>
<div class="intro">
<div class="intro__title">活动介绍</div>
......@@ -40,7 +38,10 @@ export default {
...mapGetters({
isLogin: 'users/isLogin',
lotteryInfo: 'lottery/lotteryInfo'
})
}),
styleObj() {
return `height: ${this.$route.path === '/mini/index' ? '65.5vh' : this.lotteryInfo.showType === 7 ? '46.5vh' : '37.5vh'}`
}
},
}
</script>
......
......@@ -146,7 +146,7 @@ export default {
}
},
isWin() {
return !!+this.info.id
return !!Number(this.info.id)
}
},
methods: {
......
......@@ -4,6 +4,8 @@
* 传入数字字符串则没有限制
* @param {number|string} digit
*/
/* eslint-disable no-param-reassign */
/* eslint-disable no-unreachable-loop */
export default (digit) => {
digit = typeof digit === 'number' ? String(digit) : digit;
const zh = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
......@@ -13,7 +15,8 @@ export default (digit) => {
let breakLen = Math.ceil(digit.length / 4);
let notBreakSegment = digit.length % 4 || 4;
let segment;
let zeroFlag = [], allZeroFlag = [];
let zeroFlag = []
let allZeroFlag = [];
let result = '';
while (breakLen > 0) {
......@@ -21,7 +24,7 @@ export default (digit) => {
segment = digit.slice(0, notBreakSegment);
let segmentLen = segment.length;
for (let i = 0; i < segmentLen; i++) {
if (segment[i] != 0) {
if (segment[i] !== 0) {
if (zeroFlag.length > 0) {
result += '零' + zh[segment[i]] + unit[4 - segmentLen + i];
// 判断是否需要加上 quot 单位
......@@ -40,7 +43,7 @@ export default (digit) => {
}
} else {
// 处理为 0 的情形
if (segmentLen == 1) {
if (segmentLen === 1) {
result += zh[segment[i]];
break;
}
......@@ -53,7 +56,7 @@ export default (digit) => {
notBreakSegment += 4;
for (let j = 0; j < segment.length; j++) {
if (segment[j] != 0) {
if (segment[j] !== 0) {
if (zeroFlag.length > 0) {
// 第一次执行zeroFlag长度不为0,说明上一个分区最后有0待处理
if (j === 0) {
......@@ -77,8 +80,8 @@ export default (digit) => {
zeroFlag.push(segment[j]);
} else if (allZeroFlag.length > 0) {
// 执行到最后
if (breakLen == 1) {
result += '';
if (breakLen === 1) {
result = String(result);
} else {
zeroFlag.length = 0;
}
......
......@@ -16,7 +16,7 @@ export default {
},
computed: {
statusCode() {
return +this.error?.statusCode || 0
return Number(this.error?.statusCode) || 0
},
errorMessage() {
return this.error?.message || '发生了一些不可预知的错误'
......
<template>
<section class="lottery-box">
<component :is="lotteryComponents[+lotteryInfo.type]" v-if="'type' in lotteryInfo && lotteryInfo.type"></component>
<component :is="lotteryComponents[Number(lotteryInfo.type)]" v-if="'type' in lotteryInfo && lotteryInfo.type"></component>
<ComplaintsDeal></ComplaintsDeal>
<Loading v-model="isLoading" class="lottery-box__loading"></Loading>
</section>
......@@ -87,7 +87,7 @@ export default {
Bus.$on('LotteryInfoUpdate', data => {
const { id } = data
const { uin, id: currentId, sessionId: currentPlayId } = this
if (+id === +currentId) {
if (Number(id) === Number(currentId)) {
this.getLotteryDetail({ id, playId: currentPlayId, uin })
}
})
......@@ -95,7 +95,7 @@ export default {
Bus.$on('LotteryStateUpdate', data => {
const { id, playId } = data
const { sessionId: currentPlayId, id: currentId } = this
if (+id === +currentId && +playId === +currentPlayId) {
if (Number(id) === Number(currentId) && Number(playId) === Number(currentPlayId)) {
const { status, startTime, endTime } = data
// 状态
this.updateInfo({
......
......@@ -106,7 +106,7 @@ export default {
Bus.$on('LotteryInfoUpdate', data => {
const { id } = data
const { uin, id: currentId } = this.$route.query
if (+id === +currentId) {
if (Number(id) === Number(currentId)) {
this.getSessionList({ id, uin })
}
})
......
......@@ -255,14 +255,14 @@ export default {
Bus.$on('LotteryInfoUpdate', data => {
const { id } = data
const { id: currentId } = this.$route.query
if (+id === +currentId) {
if (Number(id) === Number(currentId)) {
this.loadData()
}
})
Bus.$on('LotteryStateUpdate', data => {
const { id } = data
const { id: currentId } = this.$route.query
if (+id === +currentId) {
if (Number(id) === Number(currentId)) {
this.loadData()
}
})
......@@ -271,7 +271,7 @@ export default {
const prizeItem = data?.prizeConfigs?.[0]
return {
...data,
status: +data?.status || '',
status: Number(data?.status) || '',
showResult: !!data?.showResult || false,
prizeName: prizeItem?.name || '',
prizeIcon: prizeItem?.icon || '',
......@@ -284,7 +284,7 @@ export default {
...data,
isWin: !!data?.prizeId,
address: data?.address || '',
exchangeType: +data?.exchangeType || LOTTERY_EXCHANGE_TYPE.offline
exchangeType: Number(data?.exchangeType) || LOTTERY_EXCHANGE_TYPE.offline
}
}
}
......
<template>
<section class="lottery-box">
<component :is="lotteryComponents[+lotteryInfo.type]" v-if="'type' in lotteryInfo && lotteryInfo.type"></component>
<component :is="lotteryComponents[Number(lotteryInfo.type)]" v-if="'type' in lotteryInfo && lotteryInfo.type"></component>
<ComplaintsDeal></ComplaintsDeal>
<Loading v-model="isLoading" class="lottery-box__loading"></Loading>
</section>
......@@ -104,7 +104,7 @@ export default {
Bus.$on('LotteryInfoUpdate', data => {
const { id } = data
const { uin, id: currentId, sessionId: currentPlayId } = this
if (+id === +currentId) {
if (Number(id) === Number(currentId)) {
this.getLotteryDetail({ id, playId: currentPlayId, uin })
}
})
......@@ -112,7 +112,7 @@ export default {
Bus.$on('LotteryStateUpdate', data => {
const { id, playId } = data
const { sessionId: currentPlayId, id: currentId } = this
if (+id === +currentId && +playId === +currentPlayId) {
if (Number(id) === Number(currentId) && Number(playId) === Number(currentPlayId)) {
// eslint-disable-next-line no-unused-vars
const { status, startTime, endTime, userTimes } = data
// 状态
......
......@@ -92,7 +92,7 @@ export default {
Bus.$on('LotteryInfoUpdate', data => {
const { id } = data
const { uin, id: currentId } = this.$route.query
if (+id === +currentId) {
if (Number(id) === Number(currentId)) {
this.getSessionList({ id, uin })
}
})
......
......@@ -37,7 +37,7 @@
</li>
</ul>
</div>
<div v-if="+detailInfo.exchangeType === +LOTTERY_EXCHANGE_TYPE.offline && detailInfo.prizeId !== 0" class="record-detail__code-info">
<div v-if="Number(detailInfo.exchangeType) === Number(LOTTERY_EXCHANGE_TYPE.offline) && detailInfo.prizeId !== 0" class="record-detail__code-info">
<QRCode :url="detailInfo.code" :width="70" :height="70"></QRCode>
<p class="record-detail__code-text">
<label>兑换码:</label>
......@@ -50,7 +50,7 @@
</p>
<p class="record-detail__notice">*兑换信息请勿泄露给他人,以防冒充代领</p>
</div>
<div v-if="+detailInfo.exchangeType === +LOTTERY_EXCHANGE_TYPE.mailing && detailInfo.prizeId !== 0" class="record-detail__addressee-info">
<div v-if="Number(detailInfo.exchangeType) === Number(LOTTERY_EXCHANGE_TYPE.mailing) && detailInfo.prizeId !== 0" class="record-detail__addressee-info">
<span v-if="!detailInfo.name" class="record-detail__edit-btn" @click="isShowAddressPopup = true"
>填写收货地址</span
>
......@@ -114,7 +114,7 @@ export default {
},
data() {
return {
uin: +this.$route?.query?.uin || '',
uin: Number(this.$route?.query?.uin) || '',
id: this.$route?.query?.detailId || '',
tempId: this.$route?.query?.tempId || '',
getAddressList,
......@@ -196,7 +196,7 @@ export default {
drawTime: data?.drawTime || '',
prizeName: data?.prizeName || '',
prizeIcon: data?.prizeIcon || '',
exchangeType: +data?.exchangeType || 1,
exchangeType: Number(data?.exchangeType) || 1,
address: data?.address || '',
contactPhone: data?.contactPhone || '',
code: data?.code || ''
......
/* eslint-disable no-invalid-this */
import Cookie from 'js-cookie'
import action from '../pvStatisticalService'
......
......@@ -44,7 +44,7 @@ const actions = {
}
return new Promise((resolve, reject) => {
if (isReqSuccess) {
return resolve(data)
resolve(data)
}
reject(new Error(JSON.stringify({ errorCode, errorMessage })))
})
......
const path = require('path')
const { defineConfig } = require('@vue/cli-service');
const path = require('path');
const fs = require('fs');
/* config 配置下载 */
const { downloadConfigFile } = require('@gdyfe/config')
const { log } = require('console')
/* config 配置读取 */
const { downloadConfigFile } = require('@gdyfe/config');
// 下载到指定目录
const assetsDirMap = {
test: 'test',
preview: 'pre',
production: 'prod',
};
const assetsDir = assetsDirMap[process.env.mode] || 'prod';
const BASE_URL = '/lottery/';
const assetsDirPath = path.join(__dirname, './public', assetsDir);
if (!fs.existsSync(assetsDirPath)) {
fs.mkdirSync(assetsDirPath);
}
// 下载配置文件到指定目录
downloadConfigFile({
server: process.env.mode,
ic: 'ZmUtZ5WNp%XBzDw=',
path: path.resolve(__dirname, './public/config.js')
path: path.resolve(__dirname, `${assetsDirPath}/config.js`),
})
.then(() => {
console.log('$$ config file downloaded $$')
console.log('$$ config file downloaded $$');
})
.catch(err => {
console.log('$$ config file download failed $$', err)
})
const BASE_URL = '/lottery/'
.catch((err) => {
console.log('$$ config file download failed $$', err);
});
module.exports = {
publicPath: BASE_URL, // vue-cli3 从baseUrl更名为publicPath
productionSourceMap: false,
chainWebpack: config => {
module.exports = defineConfig({
publicPath: BASE_URL,
assetsDir,
transpileDependencies: true,
chainWebpack: (config) => {
// 别名
config.resolve.alias.set('assets', path.resolve('src/assets')).set('public', path.resolve(__dirname, 'public')).set('@', path.resolve(__dirname, 'src'))
config.resolve.alias
.set('@', path.join(__dirname, 'src'))
.set('assets', path.resolve('src/assets'))
.set('public', path.resolve(__dirname, 'public'));
// DefinePlugin
config.plugin('define').tap(args => {
config.plugin('define').tap((args) => {
args[0]['process.env'] = {
...args[0]['process.env'],
mode: JSON.stringify(process.env.mode),
BASE_URL: JSON.stringify(BASE_URL)
}
return args
})
BASE_URL: JSON.stringify(BASE_URL),
VUE_APP_ASSETS_DIR: JSON.stringify(assetsDir),
};
return args;
});
// terser
if (process.env.NODE_ENV === 'production') {
config.optimization.minimizer('terser').tap(args => {
args[0].terserOptions.parallel = 4
args[0].terserOptions.cache = true
args[0].terserOptions.compress.drop_console = true
args[0].terserOptions.compress.drop_debugger = true
return args
})
config.optimization.minimizer('terser').tap((args) => {
args[0].terserOptions.compress.drop_console = true;
args[0].terserOptions.compress.drop_debugger = true;
return args;
});
}
},
configureWebpack: {
plugins: [],
// 警告 webpack 的性能提示
performance: {
hints: false
}
},
runtimeCompiler: true,
devServer: {
disableHostCheck: true
},
css: {
sourceMap: false,
loaderOptions: {
less: {
// 配置less(其他样式解析用法一致)
lessOptions:{
javascriptEnabled: true,
}
},
postcss: {
plugins: [
require('postcss-pxtorem')({
rootValue: 75,
selectorBlackList: [/^html$/, /^body$/], // 忽略转换正则匹配项
propList: ['*'],
})
]
},
}
},
lintOnSave: false
}
});
This source diff could not be displayed because it is too large. You can view the blob instead.
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