Browse Source

finish

master
maochaoying 2 years ago
parent
commit
2cce0e560d
  1. 24
      src/mock/index.js
  2. 16
      src/pages/index.vue

24
src/mock/index.js

@ -1,13 +1,27 @@
const data = [ const data = [
// 3%
{ {
lottery: [],
lottery: ['五星仙元', '四星仙元'],
min: 1, min: 1,
max: 2,
max: 3,
}, },
// 7%
{ {
lottery: [],
min: 1,
max: 2,
lottery: ['转生四星法宝', '转生五星法宝'],
min: 3,
max: 10,
},
// 12%
{
lottery: ['五星20速坐骑', '四星18速坐骑'],
min: 10,
max: 23,
},
// 20%
{
lottery: ['五星加强天书', '四星加强天书', '五星加强妖石', '四星加强妖石'],
min: 23,
max: 44,
}, },
] ]

16
src/pages/index.vue

@ -62,8 +62,22 @@ const chou = number => {
const suan = () => { const suan = () => {
const n = Math.random() * 100 const n = Math.random() * 100
const r = getRnadomFiveInt() const r = getRnadomFiveInt()
let boo = false
let result = ''
// n lotteryList min max list // n lotteryList min max list
return `五星仙元-${r}`
lotteryList.map(item => {
if (item.min <= n && item.max > n) {
boo = true
//
const data = item.lottery
// data
result = `${data[Math.floor(Math.random() * data.length)]}-${r}`
}
})
if (boo) {
return result
}
return `200w银元宝-${r}`
} }
const getRnadomFiveInt = () => { const getRnadomFiveInt = () => {

Loading…
Cancel
Save