c6fa739b by McLemore

init

1 parent 0fe43ead
This diff could not be displayed because it is too large.
No preview for this file type
......@@ -8,7 +8,7 @@
<link
rel="stylesheet"
href="https://at.alicdn.com/t/font_1594571_5oi8u1hs5fy.css"/>
<title>luckydraw</title>
<title>赤金科技-年会抽奖</title>
</head>
<body>
<noscript>
......
......@@ -2379,7 +2379,7 @@
shadowOffset: [0, 0],
initial: null,
hideTags: true,
zoom: 1,
zoom: 0.7,
weight: false,
weightMode: "size",
weightFrom: null,
......@@ -2395,7 +2395,7 @@
txtOpt: true,
txtScale: 2,
frontSelect: false,
wheelZoom: true,
wheelZoom: false,
zoomMin: 0.3,
zoomMax: 3,
zoomStep: 0.05,
......@@ -2414,7 +2414,7 @@
shuffleTags: false,
noSelect: false,
noMouse: false,
imageScale: 1,
imageScale: 1.6,
paused: false,
dragControl: false,
dragThreshold: 4,
......
......@@ -75,7 +75,7 @@ export default {
const formData = new FormData();
formData.append('uploadImg', fileList[0]);
const reader = new FileReader();
const AllowImgFileSize = 1024 * 150;
const AllowImgFileSize = 1024 * 200;
const file = fileList[0];
if (file) {
this.filename = file.name;
......
......@@ -31,6 +31,7 @@
:step="1"
></el-input>
</el-form-item>
<!--
<el-form-item label="一等奖">
<el-input
type="number"
......@@ -39,6 +40,7 @@
:step="1"
></el-input>
</el-form-item>
-->
<el-form-item
:label="newitem.name"
v-for="newitem in storeNewLottery"
......@@ -126,7 +128,7 @@ export default {
const str = 'abcdefghijklmnopqrstuvwxyz';
let fieldStr = '';
for (let index = 0; index < 10; index++) {
fieldStr += str.split('')[randomNum(1, 27) - 1];
fieldStr += str.split('')[randomNum(1, 26) - 1];
}
return `${fieldStr}${Date.now()}`;
},
......
......@@ -30,8 +30,11 @@ export default {
result() {
return this.$store.state.result;
},
list() {
return this.$store.state.list;
},
message() {
const { result, config } = this;
const { result, config, list } = this;
const fields = Object.keys(config);
let message = [{ key: 0, title: config.name }];
......@@ -42,7 +45,12 @@ export default {
key: index + 1,
title: `${label}抽奖结果:`,
value: `${
result[item].length > 0 ? result[item].join('、') : '暂未抽取'
result[item].length > 0
? list
.filter(v => result[item].indexOf(v.key) > -1)
.map(v => v.name)
.join('、')
: '暂未抽取'
}`
});
}
......@@ -57,7 +65,6 @@ export default {
.c-Publicity {
height: 100%;
// width: 1000px;
background-color: rgba(255, 255, 255, 0.1);
margin: 0 auto;
position: relative;
overflow: hidden;
......@@ -66,14 +73,14 @@ export default {
color: #fff;
font-size: 16px;
.title {
color: #ccc;
color: #f1d192;
}
.value {
margin-left: 10px;
}
&.actiname {
.title {
color: red;
color: #fff;
font-size: 20px;
}
}
......
......@@ -35,9 +35,9 @@
class="card"
v-for="(data, j) in item.value"
:key="j"
:data-res="data"
:data-res="data.number"
>
{{ data }}
{{ data.name }}
</span>
</span>
</div>
......@@ -59,6 +59,9 @@ export default {
this.$store.commit('setResult', val);
}
},
list() {
return this.$store.state.list;
},
resultList() {
const list = [];
for (const key in this.result) {
......@@ -68,7 +71,10 @@ export default {
list.push({
label: key,
name,
value: element
value: element.map(v => ({
number: v,
name: this.list.filter(vv => vv.key === v)[0].name
}))
});
}
}
......
......@@ -35,13 +35,27 @@ export function randomNum(minNum = 1, maxNum) {
*/
export function luckydrawHandler(total, won = [], num) {
const peolist = generateArray(1, Number(total));
const wons = won;
let wons = won;
const res = [];
for (let j = 0; j < num; j++) {
const nodraws = peolist.filter(item => !wons.includes(item));
const current = nodraws[randomNum(1, nodraws.length) - 1];
res.push(current);
wons.push(current);
const rest = peolist.filter(item => !wons.includes(item));
if (rest.length < num) {
res.push(...rest);
wons = [...rest];
for (let j = 0; j < num - rest.length; j++) {
const nodraws = peolist.filter(item => !wons.includes(item));
const current = nodraws[randomNum(1, nodraws.length) - 1];
res.push(current);
wons.push(current);
}
} else {
for (let j = 0; j < num; j++) {
const nodraws = peolist.filter(item => !wons.includes(item));
const current = nodraws[randomNum(1, nodraws.length) - 1];
res.push(current);
wons.push(current);
}
}
return res;
}
......
......@@ -39,6 +39,7 @@ export const newLotteryField = 'newLottery'; // 新增奖项
export const listField = 'list'; // 名单
export function conversionCategoryName(key) {
let name = '';
/*
switch (key) {
case 'firstPrize':
name = '一等奖';
......@@ -46,6 +47,7 @@ export function conversionCategoryName(key) {
default:
break;
}
*/
const newLottery = getData(newLotteryField) || [];
const findres = newLottery.find(item => item.key === key);
if (findres) {
......
......@@ -13,12 +13,9 @@ export default new Vuex.Store({
state: {
config: {
name: '年会抽奖',
number: 70,
firstPrize: 1
},
result: {
firstPrize: []
number: 44
},
result: {},
newLottery: [],
list: [],
photos: []
......@@ -27,8 +24,7 @@ export default new Vuex.Store({
setClearConfig(state) {
state.config = {
name: '年会抽奖',
number: 70,
firstPrize: 1
number: 44
};
state.newLottery = [];
},
......@@ -39,19 +35,14 @@ export default new Vuex.Store({
state.photos = [];
},
setClearResult(state) {
state.result = {
firstPrize: []
};
state.result = {};
},
setClearStore(state) {
state.config = {
name: '年会抽奖',
number: 70,
firstPrize: 1
};
state.result = {
firstPrize: []
number: 44
};
state.result = {};
state.newLottery = [];
state.list = [];
state.photos = [];
......@@ -65,9 +56,11 @@ export default new Vuex.Store({
setData(resultField, state.result);
},
setNewLottery(state, newLottery) {
/*
if (state.newLottery.find(item => item.name === newLottery.name)) {
return;
}
*/
state.newLottery.push(newLottery);
setData(newLotteryField, state.newLottery);
},
......