修改转盘
This commit is contained in:
parent
fb9733d9eb
commit
8a340fabdd
|
|
@ -1,27 +1,11 @@
|
||||||
|
// const ROOTPATH1 = "https://dj-api.hnsiyao.cn/sqx_fast/"; //
|
||||||
|
// const ROOTPATH = "https://dj-api.hnsiyao.cn/sqx_fast/"; //后台服务域名
|
||||||
|
// const ROOTPATH2 = "https://dj-api.hnsiyao.cn"; //后台服务域名
|
||||||
|
|
||||||
const ROOTPATH1 = "https://video.hnsiyao.cn/sqx_fast/"; //
|
const ROOTPATH1 = "https://video.hnsiyao.cn/sqx_fast/"; //
|
||||||
const ROOTPATH = "https://video.hnsiyao.cn/sqx_fast/"; //后台服务域名
|
const ROOTPATH = "https://video.hnsiyao.cn/sqx_fast/"; //后台服务域名
|
||||||
const ROOTPATH2 = "https://video.hnsiyao.cn"; //后台服务域名
|
const ROOTPATH2 = "https://video.hnsiyao.cn"; //后台服务域名
|
||||||
|
|
||||||
// const ROOTPATH1 = location.origin + "/sqx_fast"; //
|
|
||||||
// const ROOTPATH = location.origin + "/sqx_fast"; //后台服务域名
|
|
||||||
// const ROOTPATH2 = location.origin; //后台服务域名
|
|
||||||
|
|
||||||
// const ROOTPATH1 = "https://duanju12.xianmxkj.com/sqx_fast"; //
|
|
||||||
// const ROOTPATH = "https://duanju12.xianmxkj.com/sqx_fast"; //后台服务域名
|
|
||||||
// const ROOTPATH2 = "https://duanju12.xianmxkj.com"; //后台服务域名
|
|
||||||
|
|
||||||
// const ROOTPATH1 = "https://wap.xingqiu1985.com/sqx_fast"; //
|
|
||||||
// const ROOTPATH = "https://wap.xingqiu1985.com/sqx_fast"; //后台服务域名
|
|
||||||
// const ROOTPATH2 = "https://wap.xingqiu1985.com"; //后台服务域名
|
|
||||||
|
|
||||||
|
|
||||||
// const ROOTPATH1 = "https://jc.118zp.com/sqx_fast"; //
|
|
||||||
// const ROOTPATH = "https://jc.118zp.com/sqx_fast"; //后台服务域名
|
|
||||||
// const ROOTPATH2 = "https://jc.118zp.com"; //后台服务域名
|
|
||||||
|
|
||||||
// const ROOTPATH1 = "http://192.168.0.132:8100/sqx_fast"; //后台服务域名
|
|
||||||
// const ROOTPATH = "http://192.168.0.132:8100/sqx_fast"; //后台服务域名
|
|
||||||
// const ROOTPATH2 = "http://192.168.0.132:8100"; //后台服务域名
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
APIHOST: ROOTPATH,
|
APIHOST: ROOTPATH,
|
||||||
APIHOST1: ROOTPATH1,
|
APIHOST1: ROOTPATH1,
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ module.exports = {
|
||||||
},
|
},
|
||||||
//全局域名 部分html中需要单独替换 需要修改config中的网络请求域名
|
//全局域名 部分html中需要单独替换 需要修改config中的网络请求域名
|
||||||
publicYuMing() {
|
publicYuMing() {
|
||||||
return 'https://video.hnsiyao.cn'
|
return 'https://dj-api.hnsiyao.cn'
|
||||||
},
|
},
|
||||||
//全局域名 部分html中需要单独替换 需要修改config中的网络请求域名
|
//全局域名 部分html中需要单独替换 需要修改config中的网络请求域名
|
||||||
publicYuMingAll() {
|
publicYuMingAll() {
|
||||||
return 'https://video.hnsiyao.cn/sqx_fast/'
|
return 'https://dj-api.hnsiyao.cn/sqx_fast/'
|
||||||
},
|
},
|
||||||
minMoney() {
|
minMoney() {
|
||||||
return uni.getStorageSync("minMoney") ? uni.getStorageSync("minMoney") : '0.3'
|
return uni.getStorageSync("minMoney") ? uni.getStorageSync("minMoney") : '0.3'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,742 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<u-popup v-model="show">
|
||||||
|
<view class="almost-lottery">
|
||||||
|
<!-- head -->
|
||||||
|
<view class="almost-lottery__head">
|
||||||
|
<view class="btn-group u-flex u-row-between">
|
||||||
|
<view :class="['action', isApple && 'action-shadow']" @click="toRed">
|
||||||
|
<text class="pack"></text>
|
||||||
|
<text class="content">红包<text class="num">{{ totalMoney }}</text></text>
|
||||||
|
</view>
|
||||||
|
<view :class="['action', isApple && 'action-shadow']" @click="toGift">
|
||||||
|
<text class="gift"></text>
|
||||||
|
<text class="content">我的奖品</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="tip"><text class="tip-content">每次抽奖消耗 {{ goldNum }} 金币,不限次数</text></view> -->
|
||||||
|
</view>
|
||||||
|
<!-- action -->
|
||||||
|
|
||||||
|
<!-- <view class="almost-lottery__action-dev" @tap="handleInitCanvas" v-if="isDev">
|
||||||
|
<text class="text">重新生成画板-开发模式使用</text>
|
||||||
|
</view>
|
||||||
|
<view class="almost-lottery__action-dev" @tap="handleCheckPopup">
|
||||||
|
<text class="text">查看 uni-popup 用例</text>
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
<!-- lottery -->
|
||||||
|
<view class="almost-lottery__wheel">
|
||||||
|
<almost-lottery :lottery-size="lotteryConfig.lotterySize" :action-size="lotteryConfig.actionSize"
|
||||||
|
:ring-count="2" :duration="1" :self-rotaty="false" :img-circled="true" :canvasCached="true"
|
||||||
|
:prize-list="prizeList" :prize-index="prizeIndex" :lotteryBg="lotteryBg" :actionBg="actionBg"
|
||||||
|
@reset-index="prizeIndex = -1" @draw-before="handleDrawBefore" @draw-start="handleDrawStart"
|
||||||
|
@draw-end="handleDrawEnd" @finish="handleDrawFinish" v-if="prizeList.length" />
|
||||||
|
<view class="almost-lottery__count">
|
||||||
|
<text class="text">剩余免费抽奖 {{ freeNum }} 次</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- rule -->
|
||||||
|
<view class="almost-lottery__rule">
|
||||||
|
<view class="rule-head">
|
||||||
|
<view class="line"></view>
|
||||||
|
<text class="title">活动规则</text>
|
||||||
|
<view class="line"></view>
|
||||||
|
</view>
|
||||||
|
<view class="rule-body">
|
||||||
|
<view class="item">
|
||||||
|
<view class="number">1</view>
|
||||||
|
<view class="text">
|
||||||
|
<text>抽奖细则:</text>
|
||||||
|
<text>每人每天最多拥有{{ freeNumDay }}次抽奖机会</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item item-rule">
|
||||||
|
<view class="number">2</view>
|
||||||
|
<view class="text">
|
||||||
|
<text>奖励说明:</text>
|
||||||
|
<text>a.现金奖:系统会即时转入红包余额,可提现。</text>
|
||||||
|
<!-- <text>b.金币奖:系统会即时转入金币账户,可在平台内使用。</text> -->
|
||||||
|
<text>b.实物奖:中奖后需联系客服领取。</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <template >
|
||||||
|
<view class="item">
|
||||||
|
<view class="number">3</view>
|
||||||
|
<view class="text">本次活动由XXXXXXX发起。</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="number">4</view>
|
||||||
|
<view class="text">本活动仅限17岁以上用户参加。</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="number">5</view>
|
||||||
|
<view class="text">本活动最终解释权归XXXXXXX所有。</view>
|
||||||
|
</view>
|
||||||
|
</template> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AlmostLottery from '@/uni_modules/almost-lottery/components/almost-lottery/almost-lottery.vue'
|
||||||
|
import {
|
||||||
|
clearCacheFile,
|
||||||
|
clearStore
|
||||||
|
} from '@/uni_modules/almost-lottery/utils/almost-utils.js'
|
||||||
|
export default {
|
||||||
|
name: 'Home',
|
||||||
|
components: {
|
||||||
|
AlmostLottery
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
show:true,
|
||||||
|
//红包余额
|
||||||
|
totalMoney: 0,
|
||||||
|
//抽奖结果
|
||||||
|
result: '',
|
||||||
|
// 开启调试模式
|
||||||
|
isDev: true,
|
||||||
|
option: {},
|
||||||
|
// 以下是转盘配置相关数据
|
||||||
|
lotteryConfig: {
|
||||||
|
// 抽奖转盘的整体尺寸,单位rpx
|
||||||
|
lotterySize: 600,
|
||||||
|
// 抽奖按钮的尺寸,单位rpx
|
||||||
|
actionSize: 200
|
||||||
|
},
|
||||||
|
|
||||||
|
// 以下是转盘 UI 配置
|
||||||
|
// 转盘外环图,如有需要,请参考替换为自己的设计稿
|
||||||
|
lotteryBg: require('@/uni_modules/almost-lottery/static/almost-lottery/almost-lottery__bg2x.png'),
|
||||||
|
// 抽奖按钮图
|
||||||
|
actionBg: require('@/uni_modules/almost-lottery/static/almost-lottery/almost-lottery__action2x.png'),
|
||||||
|
|
||||||
|
// 以下是奖品配置数据
|
||||||
|
// 奖品数据
|
||||||
|
prizeList: [],
|
||||||
|
// 奖品是否设有库存
|
||||||
|
onStock: true,
|
||||||
|
// 中奖下标
|
||||||
|
prizeIndex: -1,
|
||||||
|
|
||||||
|
// 是否正在抽奖中,避免重复触发
|
||||||
|
prizeing: false,
|
||||||
|
|
||||||
|
// 以下为中奖概率有关数据
|
||||||
|
// 是否由前端控制概率,默认不开启,强烈建议由后端控制
|
||||||
|
onFrontend: false,
|
||||||
|
// 权重随机数的最大值
|
||||||
|
prizeWeightMax: 0,
|
||||||
|
// 权重数组
|
||||||
|
prizeWeightArr: [],
|
||||||
|
|
||||||
|
// 以下为业务需求有关示例数据
|
||||||
|
// 金币余额
|
||||||
|
goldCoin: 20,
|
||||||
|
// 当日免费抽奖次数余额
|
||||||
|
freeNum: 1,
|
||||||
|
// 每次消耗的金币数
|
||||||
|
goldNum: 20,
|
||||||
|
// 每天免费抽奖次数
|
||||||
|
freeNumDay: 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isApple() {
|
||||||
|
return uni.getSystemInfoSync().platform === 'ios'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toRed() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/me/balance/index'
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
toGift() {
|
||||||
|
console.log('1');
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/me/gift/gift'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 重新生成
|
||||||
|
handleInitCanvas() {
|
||||||
|
clearCacheFile()
|
||||||
|
clearStore()
|
||||||
|
|
||||||
|
this.prizeList = []
|
||||||
|
this.getPrizeList()
|
||||||
|
},
|
||||||
|
// 通过 popup 打开
|
||||||
|
handleCheckPopup() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/popup/popup'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取奖品列表
|
||||||
|
async getPrizeList() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '奖品准备中...'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 等待接口返回的数据进一步处理
|
||||||
|
let res = await this.requestApiGetPrizeList()
|
||||||
|
console.log('获取奖品列表', res)
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
let data = res.data
|
||||||
|
if (data.length) {
|
||||||
|
this.prizeList = data
|
||||||
|
console.log('已获取到奖品列表数据,开始绘制抽奖转盘')
|
||||||
|
|
||||||
|
// 计算开始绘制的时间
|
||||||
|
if (console.time) {
|
||||||
|
console.time('绘制转盘用时')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果开启了前端控制概率
|
||||||
|
// 得出权重的最大值并生成权重数组
|
||||||
|
if (this.onFrontend) {
|
||||||
|
// 生成权重数组并排序取得最大值
|
||||||
|
this.prizeWeightArr = this.prizeList.map(item => item.prizeWeight)
|
||||||
|
let prizeWeightArrSort = [...this.prizeWeightArr]
|
||||||
|
prizeWeightArrSort.sort((a, b) => b - a)
|
||||||
|
|
||||||
|
// 开放自定义权重最大值,没有自定义则取权重数组中的最大值
|
||||||
|
this.prizeWeightMax = this.prizeWeightMax > 0 ? this.prizeWeightMax : prizeWeightArrSort[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({
|
||||||
|
title: '获取奖品失败',
|
||||||
|
mask: true,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 模拟请求 获取奖品列表 接口,
|
||||||
|
// 注意这里返回的是一个 Promise
|
||||||
|
// 大哥,这里只是模拟,别告诉我你不会对接自己的接口
|
||||||
|
async requestApiGetPrizeList() {
|
||||||
|
const res = await this.$Request.getT('/app/discSpinning/selectDiscSpinning')
|
||||||
|
if (res.code == 0) {
|
||||||
|
return {
|
||||||
|
ok: true,
|
||||||
|
data: res.data.records.map(v => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
prizeId: v.id,
|
||||||
|
prizeName: v.name,
|
||||||
|
prizeStock: 10,
|
||||||
|
prizeWeight: 200,
|
||||||
|
prizeImage: v.url,
|
||||||
|
// prizeImage: require('@/static/git.png')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let requestTimer = setTimeout(() => {
|
||||||
|
clearTimeout(requestTimer)
|
||||||
|
requestTimer = null
|
||||||
|
|
||||||
|
// prizeStock 奖品库存
|
||||||
|
// prizeWeight 中奖概率,数值越大中奖概率越高,权重一样时随机中奖
|
||||||
|
resolve({
|
||||||
|
ok: true,
|
||||||
|
data: [{
|
||||||
|
prizeId: 1,
|
||||||
|
prizeName: '0.1元现金',
|
||||||
|
prizeStock: 10,
|
||||||
|
prizeWeight: 200,
|
||||||
|
prizeImage: require('@/static/git.png')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prizeId: 2,
|
||||||
|
prizeName: '10元现金',
|
||||||
|
prizeStock: 0,
|
||||||
|
prizeWeight: 50,
|
||||||
|
prizeImage: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/56f085e0-bcfe-11ea-b244-a9f5e5565f30.png'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prizeId: 3,
|
||||||
|
prizeName: '5元话费',
|
||||||
|
prizeStock: 1,
|
||||||
|
prizeWeight: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prizeId: 4,
|
||||||
|
prizeName: '50元现金',
|
||||||
|
prizeStock: 0,
|
||||||
|
prizeWeight: 10,
|
||||||
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAB2klEQVRIia3Wv09TURjG8U+u2kQZcNENh2ok0cnJ0R+L0RB2g/EvwITEwRgnV0Zx0fAHYBh0khBD4sBAmAgDiwQNg4qwmSBDAYf7Fi+n97al9UlObnvO836f3tO355b2GsAYZrCBPRzGdSPmx8J3YtXwDDsB7TR2wl/rNmAYK13C07ES9W11E9s9BjTHdnBKVf8PAcWgehpwCssF0w/5FzqLgw7AA7zDQ/wqzC8H90jjSeFMYW0Yr8PzALfjOh7z1wve2YTzpLlQw2ay+KZ1N7vS24SziVqGexhKzB07pEJXk/dDwTetdZ9HewwZLWFNw2oyudZjQFNrCW8109pqS32GpPX1TOu586fPkLR+IEMjmbzYZ0ha34Atx/fwW58hXxPeFixo7Yg7PQbcKmEtZFgsMb/C4AkDBuUnQKpFuFZI3cZuvP6C+8g6wDP572O95C4Og49/W/YJl/G5YPqO9yV3dh4f8LMCfhjcI93Afix8xAX5SVx2YBY10yagEdxjmiwY7uISXuIFrlSEPG0TMllWcAbzYViXd0rzeXC6ImSiImA+eKU6h7mCeV/eCBMnCJkLzpHSztnFCJ7L//ZkOFv1iRLtRd1IcLpSHVP4jccVnkexPqXkmd7UX15b7tiz29ReAAAAAElFTkSuQmCC'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prizeId: 5,
|
||||||
|
prizeName: '1卷抽纸',
|
||||||
|
prizeStock: 3,
|
||||||
|
prizeWeight: 3000,
|
||||||
|
prizeImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAABCElEQVRoge3YMa4BURSH8Y8o7UAp0WgkotBZwluAfhqlZSgUGr23ENUUCpppJnTswAIUSCaTiziZJ8d9/193zdzrfMltABF5plb+oLscDoAV0Pn8OC/lwDhL0k35QT3wstcIuM61Cj0IhXiNuAvOFwr5SgrxRiHeKMSbhnHfAVgU1i1gajhnBpwK6wnQtgxkDTlmSTq/L7rLYQ9byG+WpLvCOT8YQ6K5WgrxRiHeKMQbhXijEG8U4o1CvIkmxPrDquwMrI37KlFJSJake2BUxVlW0VytaEKsV6t5+8Ohak3rRmtIH9hav/QvRHO1FOKNQrwJheQfn+I9wflCIeNHLzuQc51PRP6rC1ZeIm1I8cC5AAAAAElFTkSuQmCC'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prizeId: 6,
|
||||||
|
prizeName: '0.2元现金',
|
||||||
|
prizeStock: 8,
|
||||||
|
prizeWeight: 120
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prizeId: 7,
|
||||||
|
prizeName: '谢谢参与',
|
||||||
|
prizeStock: 100,
|
||||||
|
prizeWeight: 10000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prizeId: 8,
|
||||||
|
prizeName: '100金币',
|
||||||
|
prizeStock: 100,
|
||||||
|
prizeWeight: 3000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}, 200)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 抽奖开始之前
|
||||||
|
async handleDrawBefore(callback) {
|
||||||
|
|
||||||
|
console.log('抽奖开始之前')
|
||||||
|
let flag = false
|
||||||
|
|
||||||
|
// 还有免费数次
|
||||||
|
if (this.freeNum > 0) {
|
||||||
|
this.freeNum--
|
||||||
|
flag = true
|
||||||
|
} else {
|
||||||
|
flag = false
|
||||||
|
uni.showToast({
|
||||||
|
title: '抽奖次数不足',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(flag)
|
||||||
|
},
|
||||||
|
// 本次抽奖开始
|
||||||
|
handleDrawStart() {
|
||||||
|
console.log('触发抽奖按钮')
|
||||||
|
if (this.prizeing) return
|
||||||
|
this.prizeing = true
|
||||||
|
|
||||||
|
this.tryLotteryDraw()
|
||||||
|
},
|
||||||
|
// 尝试发起抽奖
|
||||||
|
tryLotteryDraw() {
|
||||||
|
console.log('旋转开始,获取中奖下标......')
|
||||||
|
// 判断是否由前端控制概率
|
||||||
|
if (this.onFrontend) {
|
||||||
|
this.localGetPrizeIndex()
|
||||||
|
} else {
|
||||||
|
this.remoteGetPrizeIndex()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 本地获取中奖下标
|
||||||
|
localGetPrizeIndex() {
|
||||||
|
console.warn('###当前处于前端控制中奖概率,安全起见,强烈建议由后端控制###')
|
||||||
|
// 前端控制概率的情况下,需要拿到最接近随机权重且大于随机权重的值
|
||||||
|
// 后端控制概率的情况下,通常会直接返回 prizeId
|
||||||
|
if (!this.prizeWeightMax || !this.prizeWeightArr.length) {
|
||||||
|
console.warn('###当前已开启前端控制中奖概率,但是奖品数据列表中的 prizeWeight 参数似乎配置不正确###')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('当前权重最大值为 =>', this.prizeWeightMax)
|
||||||
|
|
||||||
|
// 注意这里使用了 Math.ceil,如果某个权重的值为 0,则始终无法中奖
|
||||||
|
let randomWeight = Math.ceil(Math.random() * this.prizeWeightMax)
|
||||||
|
console.log('本次权重随机数 =>', randomWeight)
|
||||||
|
|
||||||
|
// 生成大于等于随机权重的数组
|
||||||
|
let tempMaxArrs = []
|
||||||
|
this.prizeList.forEach((item) => {
|
||||||
|
if (item.prizeWeight >= randomWeight) {
|
||||||
|
tempMaxArrs.push(item.prizeWeight)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log('tempMaxArrs', tempMaxArrs)
|
||||||
|
|
||||||
|
// 如果大于随机权重的数组有值,先对这个数组排序然后取值
|
||||||
|
// 反之新建一个临时的包含所有权重的已排序数组,然后取值
|
||||||
|
let tempMaxArrsLen = tempMaxArrs.length
|
||||||
|
if (tempMaxArrsLen) {
|
||||||
|
tempMaxArrs.sort((a, b) => a - b)
|
||||||
|
// 取值时,如果存在多个值,分两种情况
|
||||||
|
if (tempMaxArrsLen > 1) {
|
||||||
|
// 检查是否存在重复的值
|
||||||
|
let sameCount = 0
|
||||||
|
for (let i = 0; i < tempMaxArrs.length; i++) {
|
||||||
|
if (tempMaxArrs[i] === tempMaxArrs[0]) {
|
||||||
|
sameCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 值不相等的情况下取最接近的值,也就是第1个值
|
||||||
|
if (sameCount === 1) {
|
||||||
|
this.prizeIndex = this.prizeWeightArr.indexOf(tempMaxArrs[0])
|
||||||
|
} else {
|
||||||
|
// 存在值相等时,随机取值,当然这里你可以自己决定是否随机取值
|
||||||
|
let sameWeight = tempMaxArrs[0]
|
||||||
|
let sameWeightArr = []
|
||||||
|
let sameWeightItem = {}
|
||||||
|
this.prizeWeightArr.forEach((item, index) => {
|
||||||
|
if (item === sameWeight) {
|
||||||
|
sameWeightArr.push({
|
||||||
|
prizeWeight: item,
|
||||||
|
index
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log('sameWeightArr', sameWeightArr)
|
||||||
|
sameWeightItem = sameWeightArr[Math.floor(Math.random() * sameWeightArr.length)]
|
||||||
|
console.log('sameWeightItem', sameWeightItem)
|
||||||
|
this.prizeIndex = sameWeightItem.index
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.prizeIndex = this.prizeWeightArr.indexOf(tempMaxArrs[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('本次抽中奖品 =>', this.prizeList[this.prizeIndex].prizeName)
|
||||||
|
|
||||||
|
// 如果奖品设有库存
|
||||||
|
if (this.onStock) {
|
||||||
|
console.log('本次奖品库存 =>', this.prizeList[this.prizeIndex].prizeStock)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 远程请求接口获取中奖下标
|
||||||
|
// 大哥,这里只是模拟,别告诉我你不会对接自己的接口
|
||||||
|
async remoteGetPrizeIndex() {
|
||||||
|
this.result = ''
|
||||||
|
console.warn('###当前处于模拟的请求接口,并返回了中奖信息###')
|
||||||
|
const res = await this.$Request.getT('app/discSpinning/draw', {
|
||||||
|
orderId: this.option.orderId || 2145
|
||||||
|
})
|
||||||
|
console.log(res);
|
||||||
|
if (res.code != 0) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: res.msg
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.result = res.data
|
||||||
|
|
||||||
|
let list = [...this.prizeList]
|
||||||
|
// 这里随机产生的 prizeId 是模拟后端返回的 prizeId
|
||||||
|
const arr = list.filter(v => v.type == res.data.type)
|
||||||
|
let prizeId = arr[0].prizeId
|
||||||
|
|
||||||
|
// 拿到后端返回的 prizeId 后,开始循环比对得出那个中奖的数据
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
let item = list[i]
|
||||||
|
if (item.prizeId === prizeId) {
|
||||||
|
// 中奖下标
|
||||||
|
this.prizeIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('本次抽中奖品 =>', this.prizeList[this.prizeIndex].prizeName)
|
||||||
|
},
|
||||||
|
// 本次抽奖结束
|
||||||
|
handleDrawEnd() {
|
||||||
|
console.log('旋转结束,执行拿到结果后到逻辑')
|
||||||
|
// 旋转结束后,开始处理拿到结果后的逻辑
|
||||||
|
// const prize = this.prizeList[this.prizeIndex]
|
||||||
|
const prize = this.result
|
||||||
|
let {
|
||||||
|
name
|
||||||
|
} = prize
|
||||||
|
let tipContent = ''
|
||||||
|
|
||||||
|
if (name.type == 1) {
|
||||||
|
tipContent = '很遗憾,没有中奖,请再接再厉!'
|
||||||
|
} else {
|
||||||
|
tipContent = `恭喜您,获得 ${name}${this.result.type==2?(this.result.number+'元'):''} !`
|
||||||
|
}
|
||||||
|
const _this = this;
|
||||||
|
uni.showModal({
|
||||||
|
content: tipContent,
|
||||||
|
showCancel: false,
|
||||||
|
success() {
|
||||||
|
const {
|
||||||
|
orderId,
|
||||||
|
id
|
||||||
|
} = _this.result
|
||||||
|
_this.$Request.postJson('app/discSpinning/receive', _this.result).then(res => {
|
||||||
|
_this.result = ''
|
||||||
|
console.log(res)
|
||||||
|
if (res.code == 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '领取成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
_this.getRedPack()
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '领取失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
complete: () => {
|
||||||
|
this.prizeing = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 抽奖转盘绘制完成
|
||||||
|
handleDrawFinish(res) {
|
||||||
|
console.log('抽奖转盘绘制完成', res)
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
// 计算结束绘制的时间
|
||||||
|
if (console.timeEnd) {
|
||||||
|
console.timeEnd('绘制转盘用时')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let stoTimer = setTimeout(() => {
|
||||||
|
stoTimer = null
|
||||||
|
|
||||||
|
uni.hideLoading()
|
||||||
|
// uni.showToast({
|
||||||
|
// title: res.msg,
|
||||||
|
// mask: true,
|
||||||
|
// icon: 'none'
|
||||||
|
// })
|
||||||
|
}, 50)
|
||||||
|
},
|
||||||
|
async getRedPack() {
|
||||||
|
const res = await this.$Request.getT('app/moneyDetails/selectUserMoney')
|
||||||
|
if (res.code == 0) {
|
||||||
|
this.totalMoney = res.data.amount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(opt) {
|
||||||
|
this.option = opt
|
||||||
|
this.prizeList = []
|
||||||
|
this.getRedPack()
|
||||||
|
this.getPrizeList()
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
uni.hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.btn-group {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 2;
|
||||||
|
top: 200px;
|
||||||
|
gap: 20rpx;
|
||||||
|
padding: 0 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.almost-lottery {
|
||||||
|
flex: 1;
|
||||||
|
background-color: #FF893F;
|
||||||
|
}
|
||||||
|
|
||||||
|
.almost-lottery__head {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 640rpx;
|
||||||
|
background: url('~static/images/lottery/top-bg.png') no-repeat center center/cover;
|
||||||
|
|
||||||
|
.action {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex: 1;
|
||||||
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 32rpx;
|
||||||
|
background-color: rgba(255, 136, 61, 1);
|
||||||
|
border-radius: 44rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-shadow {
|
||||||
|
box-shadow: 0px 14rpx 0px 0px rgba(235, 112, 36, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pack {
|
||||||
|
width: 44rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center center;
|
||||||
|
background-size: contain;
|
||||||
|
background-image: url("~static/red-pack.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
.gift {
|
||||||
|
width: 44rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center center;
|
||||||
|
background-size: contain;
|
||||||
|
background-image: url("~static/gift.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
.gold {
|
||||||
|
width: 44rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center center;
|
||||||
|
background-size: contain;
|
||||||
|
background-image: url("~static/images/lottery/gold.png");
|
||||||
|
|
||||||
|
@media (-webkit-min-device-pixel-ratio: 2),
|
||||||
|
(min-device-pixel-ratio: 2) {
|
||||||
|
background-image: url("~static/images/lottery/gold@2x.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (-webkit-min-device-pixel-ratio: 3),
|
||||||
|
(min-device-pixel-ratio: 3) {
|
||||||
|
background-image: url("~static/images/lottery/gold@3x.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.num {
|
||||||
|
color: #F9FC31;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tip {
|
||||||
|
position: relative;
|
||||||
|
top: 428rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.almost-lottery__wheel {
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.almost-lottery__count {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
padding: 40rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.almost-lottery__rule {
|
||||||
|
padding: 0 28rpx;
|
||||||
|
color: #FFF8CB;
|
||||||
|
|
||||||
|
.rule-head {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
margin: 40rpx 0;
|
||||||
|
|
||||||
|
.line {
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
background-color: #FFF3A5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
width: 280rpx;
|
||||||
|
color: #F63857;
|
||||||
|
line-height: 70rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 20rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
background-image: linear-gradient(0deg, rgba(255, 242, 158, 1), rgba(255, 244, 168, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.rule-body {
|
||||||
|
color: #FFF8CB;
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding: 10rpx 0 40rpx;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number {
|
||||||
|
position: relative;
|
||||||
|
top: 4rpx;
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
line-height: 28rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: #F63857;
|
||||||
|
background: #FFF8CB;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-rule .text {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.almost-lottery__action-dev {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 400rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: red;
|
||||||
|
margin: 0 auto 40rpx;
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.almost-lottery__popup-wrap {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.almost-lottery {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<!-- head -->
|
<!-- head -->
|
||||||
<view class="almost-lottery__head">
|
<view class="almost-lottery__head">
|
||||||
<view class="btn-group u-flex u-row-between">
|
<view class="btn-group u-flex u-row-between">
|
||||||
<view :class="['action', isApple && 'action-shadow']">
|
<view :class="['action', isApple && 'action-shadow']" @click="toRed">
|
||||||
<text class="pack"></text>
|
<text class="pack"></text>
|
||||||
<text class="content">红包<text class="num">{{ totalMoney }}</text></text>
|
<text class="content">红包<text class="num">{{ totalMoney }}</text></text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -46,14 +46,14 @@
|
||||||
<view class="number">1</view>
|
<view class="number">1</view>
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<text>抽奖细则:</text>
|
<text>抽奖细则:</text>
|
||||||
<text>每人每天拥有{{ freeNumDay }}次抽奖机会,每次消耗{{ goldNum }}金币。</text>
|
<text>每人每天最多拥有{{ freeNumDay }}次抽奖机会</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item item-rule">
|
<view class="item item-rule">
|
||||||
<view class="number">2</view>
|
<view class="number">2</view>
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<text>奖励说明:</text>
|
<text>奖励说明:</text>
|
||||||
<text>a.现金奖:系统会即时转入账户余额,可提现。</text>
|
<text>a.现金奖:系统会即时转入红包余额,可提现。</text>
|
||||||
<!-- <text>b.金币奖:系统会即时转入金币账户,可在平台内使用。</text> -->
|
<!-- <text>b.金币奖:系统会即时转入金币账户,可在平台内使用。</text> -->
|
||||||
<text>b.实物奖:中奖后需联系客服领取。</text>
|
<text>b.实物奖:中奖后需联系客服领取。</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -134,11 +134,11 @@
|
||||||
// 金币余额
|
// 金币余额
|
||||||
goldCoin: 20,
|
goldCoin: 20,
|
||||||
// 当日免费抽奖次数余额
|
// 当日免费抽奖次数余额
|
||||||
freeNum: 1,
|
freeNum: 0,
|
||||||
// 每次消耗的金币数
|
// 每次消耗的金币数
|
||||||
goldNum: 20,
|
goldNum: 20,
|
||||||
// 每天免费抽奖次数
|
// 每天免费抽奖次数
|
||||||
freeNumDay: 1
|
freeNumDay: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -147,6 +147,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
toRed(){
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/me/balance/index'
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
toGift() {
|
toGift() {
|
||||||
console.log('1');
|
console.log('1');
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|
@ -309,7 +315,7 @@
|
||||||
flag = true
|
flag = true
|
||||||
} else {
|
} else {
|
||||||
flag = false
|
flag = false
|
||||||
uni.showModal({
|
uni.showToast({
|
||||||
title: '抽奖次数不足',
|
title: '抽奖次数不足',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
|
|
@ -413,8 +419,9 @@
|
||||||
this.result=''
|
this.result=''
|
||||||
console.warn('###当前处于模拟的请求接口,并返回了中奖信息###')
|
console.warn('###当前处于模拟的请求接口,并返回了中奖信息###')
|
||||||
const res = await this.$Request.getT('app/discSpinning/draw', {
|
const res = await this.$Request.getT('app/discSpinning/draw', {
|
||||||
orderId: this.option.orderId
|
orderId: this.option.orderId||2145
|
||||||
})
|
})
|
||||||
|
this.getCount()
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res.code != 0) {
|
if (res.code != 0) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
|
|
@ -510,11 +517,18 @@
|
||||||
if(res.code==0){
|
if(res.code==0){
|
||||||
this.totalMoney=res.data.amount
|
this.totalMoney=res.data.amount
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
async getCount(){
|
||||||
|
const res=await this.$Request.getT('app/discSpinning/drawCount')
|
||||||
|
if(res.code==0){
|
||||||
|
this.freeNum=res.count||0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(opt) {
|
onLoad(opt) {
|
||||||
this.option = opt
|
this.option = opt
|
||||||
this.prizeList = []
|
this.prizeList = []
|
||||||
|
this.getCount()
|
||||||
this.getRedPack()
|
this.getRedPack()
|
||||||
this.getPrizeList()
|
this.getPrizeList()
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -311,50 +311,8 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
noBuyVideoIndex:null,
|
||||||
// 奖品列表,
|
// 奖品列表,
|
||||||
prizeList: [{
|
|
||||||
id: 'coupon88',
|
|
||||||
name: '8.8折',
|
|
||||||
img: 'https://img11.360buyimg.com/pop/jfs/t1/175718/35/12595/5477/60b660c6Eb850717b/a1cfe750dcdb5b78.png',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'coupon900',
|
|
||||||
Color: 'rgb(251, 219, 216)',
|
|
||||||
name: '900',
|
|
||||||
img: 'https://img11.360buyimg.com/pop/jfs/t1/190845/9/6092/4489/60b65fe8Ebb8f8284/955da889f6d1c13e.png',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'coupon1',
|
|
||||||
name: '1元',
|
|
||||||
img: 'https://img11.360buyimg.com/pop/jfs/t1/189927/14/6092/4174/60b66173E23c472ea/44af15a151defca1.png',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'apple',
|
|
||||||
Color: 'rgba(246, 142, 46, 0.5)',
|
|
||||||
name: '苹果手机',
|
|
||||||
img: 'https://img11.360buyimg.com/pop/jfs/t1/177670/26/4591/2514/60a25874Ee0e5332a/99c7bdfede732ae4.png'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'coupon210',
|
|
||||||
name: '210元',
|
|
||||||
img: 'https://img11.360buyimg.com/pop/jfs/t1/124578/12/20170/4429/60b635d8E7089ebb0/7a47d76a2a260cc0.png'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'jd100',
|
|
||||||
name: '100京豆',
|
|
||||||
img: 'https://img11.360buyimg.com/pop/jfs/t1/162790/37/15087/28046/6062a49aE8f2c10f2/5591ff0ff38a45e2.png',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'coupon400',
|
|
||||||
name: '400元',
|
|
||||||
img: 'https://img11.360buyimg.com/pop/jfs/t1/177090/2/7001/4535/60b6607aEe9c1db2a/76c67675f547db3f.png'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'thanks',
|
|
||||||
name: '谢谢参与',
|
|
||||||
img: 'https://storage.jd.com/cdn-upload/dialTemplateHeart.png',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
showMoney: true,
|
showMoney: true,
|
||||||
nowBs: 1, //当前倍速
|
nowBs: 1, //当前倍速
|
||||||
subList: [{
|
subList: [{
|
||||||
|
|
@ -422,6 +380,7 @@
|
||||||
'width': '750rpx',
|
'width': '750rpx',
|
||||||
},
|
},
|
||||||
isShowVideo: '',
|
isShowVideo: '',
|
||||||
|
noBuyVideoIndex:null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
|
|
@ -890,7 +849,7 @@
|
||||||
qdCode = uni.getStorageSync('qdCode')
|
qdCode = uni.getStorageSync('qdCode')
|
||||||
}
|
}
|
||||||
let url = config.APIHOST2 + '/pages/login/registerApp?invitation=' + invitationCode + '&qdCode=' + qdCode
|
let url = config.APIHOST2 + '/pages/login/registerApp?invitation=' + invitationCode + '&qdCode=' + qdCode
|
||||||
this.setShareNum()
|
// this.setShareNum()
|
||||||
uni.setClipboardData({
|
uni.setClipboardData({
|
||||||
data: url,
|
data: url,
|
||||||
success(res) {
|
success(res) {
|
||||||
|
|
@ -985,6 +944,8 @@
|
||||||
this.zongPrice = this.info.price
|
this.zongPrice = this.info.price
|
||||||
this.countPrice = this.videoList[this.current].price
|
this.countPrice = this.videoList[this.current].price
|
||||||
this.$refs.popupPya.open('bottom')
|
this.$refs.popupPya.open('bottom')
|
||||||
|
this.noBuyVideoIndex=this.current
|
||||||
|
console.log(this.noBuyVideoIndex)
|
||||||
},
|
},
|
||||||
//关闭购买弹窗
|
//关闭购买弹窗
|
||||||
closePay() {
|
closePay() {
|
||||||
|
|
@ -1148,6 +1109,7 @@
|
||||||
//菜单数组
|
//菜单数组
|
||||||
this.meunList = arr;
|
this.meunList = arr;
|
||||||
if (type == true) { //购买视频后返回的
|
if (type == true) { //购买视频后返回的
|
||||||
|
console.log('购买视频后返回的')
|
||||||
let courseDetailsIds = this.videoList[this.current].courseDetailsId;
|
let courseDetailsIds = this.videoList[this.current].courseDetailsId;
|
||||||
this.meunList.some((item) => {
|
this.meunList.some((item) => {
|
||||||
if (item.courseDetailsId == courseDetailsIds) {
|
if (item.courseDetailsId == courseDetailsIds) {
|
||||||
|
|
@ -1163,6 +1125,12 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
if(this.noBuyVideoIndex!==null&&this.noBuyVideoIndex==indexss){
|
||||||
|
this.noBuyVideoIndex=null
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:'/me/choujiang/choujiang?orderId'+2144
|
||||||
|
})
|
||||||
|
}
|
||||||
} else { //直接跳转进来的
|
} else { //直接跳转进来的
|
||||||
this.videoList = this.meunList
|
this.videoList = this.meunList
|
||||||
//滚动到记录视频的位置(如果有记录)
|
//滚动到记录视频的位置(如果有记录)
|
||||||
|
|
@ -1173,6 +1141,12 @@
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
let indexss = indexs > 0 ? indexs : 0
|
let indexss = indexs > 0 ? indexs : 0
|
||||||
if (this.videoList[indexss].videoUrl) { //有播放权限
|
if (this.videoList[indexss].videoUrl) { //有播放权限
|
||||||
|
if(this.noBuyVideoIndex!==null&&this.noBuyVideoIndex==indexss){
|
||||||
|
this.noBuyVideoIndex=null
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:'/me/choujiang/choujiang'
|
||||||
|
})
|
||||||
|
}
|
||||||
let numIdCurr = this.videoList[indexss].courseDetailsId;
|
let numIdCurr = this.videoList[indexss].courseDetailsId;
|
||||||
this.videoContextId = 'myVideo' + numIdCurr;
|
this.videoContextId = 'myVideo' + numIdCurr;
|
||||||
this.videoContext = uni.createVideoContext(this
|
this.videoContext = uni.createVideoContext(this
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,8 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
//记录未购买视频索引
|
||||||
|
noBuyVideoIndex:null,
|
||||||
//奖品列表
|
//奖品列表
|
||||||
prizeList: [{
|
prizeList: [{
|
||||||
id: 'coupon88',
|
id: 'coupon88',
|
||||||
|
|
@ -755,6 +757,7 @@
|
||||||
this.zongPrice = this.info.price
|
this.zongPrice = this.info.price
|
||||||
this.countPrice = this.videoList[this.current].price
|
this.countPrice = this.videoList[this.current].price
|
||||||
this.showPay = true
|
this.showPay = true
|
||||||
|
this.noBuyVideoIndex=this.current
|
||||||
},
|
},
|
||||||
// 获取收藏状态
|
// 获取收藏状态
|
||||||
getMyLoveStatus() {
|
getMyLoveStatus() {
|
||||||
|
|
@ -1419,6 +1422,12 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
if(this.noBuyVideoIndex!==null&&this.noBuyVideoIndex==indexss){
|
||||||
|
this.noBuyVideoIndex=null
|
||||||
|
return uni.navigateTo({
|
||||||
|
url:'/me/choujiang/choujiang?orderId'+2144
|
||||||
|
})
|
||||||
|
}
|
||||||
} else { //直接跳转进来的
|
} else { //直接跳转进来的
|
||||||
|
|
||||||
let indexs = -1
|
let indexs = -1
|
||||||
|
|
@ -1502,6 +1511,13 @@
|
||||||
this.zongPrice = this.info.price
|
this.zongPrice = this.info.price
|
||||||
this.countPrice = this.videoList[this.current].price
|
this.countPrice = this.videoList[this.current].price
|
||||||
this.showPay = true
|
this.showPay = true
|
||||||
|
this.noBuyVideoIndex=this.current
|
||||||
|
}else{
|
||||||
|
if(this.noBuyVideoIndex!==null&& this.current==this.noBuyVideoIndex){
|
||||||
|
uni.navigateTo({
|
||||||
|
url:'/me/choujaing/choujiang'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -1654,6 +1670,7 @@
|
||||||
this.zongPrice = this.info.price
|
this.zongPrice = this.info.price
|
||||||
this.countPrice = this.videoList[this.current].price
|
this.countPrice = this.videoList[this.current].price
|
||||||
this.showPay = true
|
this.showPay = true
|
||||||
|
this.noBuyVideoIndex=this.current
|
||||||
}
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
//插入历史记录
|
//插入历史记录
|
||||||
|
|
@ -1694,6 +1711,7 @@
|
||||||
this.zongPrice = this.info.price
|
this.zongPrice = this.info.price
|
||||||
this.countPrice = this.videoList[this.current].price
|
this.countPrice = this.videoList[this.current].price
|
||||||
this.showPay = true
|
this.showPay = true
|
||||||
|
this.noBuyVideoIndex=this.current
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//播放时的回掉
|
//播放时的回掉
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-p-t-30 u-p-b-30" v-if="hasAjax&&!list.length">
|
<view class="u-p-t-30 u-p-b-30 empty" v-if="hasAjax&&!list.length">
|
||||||
<u-empty text="暂无奖品"></u-empty>
|
<u-empty text="暂无奖品" src="/static/icon-empty.svg"></u-empty>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="u-p-30">
|
<!-- <view class="u-p-30">
|
||||||
|
|
@ -90,6 +90,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.empty{
|
||||||
|
// min-height: 50vh;
|
||||||
|
}
|
||||||
|
|
||||||
.min-page {
|
.min-page {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@
|
||||||
<u-popup v-model="showjl" :closeable="true" close-icon-color="#ffffff" mode="center">
|
<u-popup v-model="showjl" :closeable="true" close-icon-color="#ffffff" mode="center">
|
||||||
<view class="zl" @click="goZl()">
|
<view class="zl" @click="goZl()">
|
||||||
<image class="zl-bg"
|
<image class="zl-bg"
|
||||||
src="https://video.hnsiyao.cn/file/uploadPath/2023/12/14/adf37beca97826d44970d20118f88e29.png"
|
src="https://dj-api.hnsiyao.cn/file/uploadPath/2023/12/14/adf37beca97826d44970d20118f88e29.png"
|
||||||
mode=""></image>
|
mode=""></image>
|
||||||
<view class="zl-title">
|
<view class="zl-title">
|
||||||
会员免费领
|
会员免费领
|
||||||
|
|
@ -136,7 +136,7 @@
|
||||||
<u-popup v-model="xxPopu" :closeable="false" close-icon-color="#ffffff" mode="center">
|
<u-popup v-model="xxPopu" :closeable="false" close-icon-color="#ffffff" mode="center">
|
||||||
<view class="zl" style="height: 580rpx;" @click="saveNewUser()">
|
<view class="zl" style="height: 580rpx;" @click="saveNewUser()">
|
||||||
<image class="zl-bgs"
|
<image class="zl-bgs"
|
||||||
src="https://video.hnsiyao.cn/file/uploadPath/2024/02/22/cee2fcdc4c4ebe31ab4ce2c3c3a3d183.png"
|
src="https://dj-api.hnsiyao.cn/file/uploadPath/2024/02/22/cee2fcdc4c4ebe31ab4ce2c3c3a3d183.png"
|
||||||
mode=""></image>
|
mode=""></image>
|
||||||
<view class="zl-titles">
|
<view class="zl-titles">
|
||||||
{{xxJDNum}} <text>金豆</text>
|
{{xxJDNum}} <text>金豆</text>
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@
|
||||||
<u-popup v-model="showjl" :closeable="true" close-icon-color="#ffffff" mode="center">
|
<u-popup v-model="showjl" :closeable="true" close-icon-color="#ffffff" mode="center">
|
||||||
<view class="zl" @click="goZl()">
|
<view class="zl" @click="goZl()">
|
||||||
<image class="zl-bg"
|
<image class="zl-bg"
|
||||||
src="https://video.hnsiyao.cn/file/uploadPath/2023/12/14/adf37beca97826d44970d20118f88e29.png"
|
src="https://dj-api.hnsiyao.cn/file/uploadPath/2023/12/14/adf37beca97826d44970d20118f88e29.png"
|
||||||
mode=""></image>
|
mode=""></image>
|
||||||
<view class="zl-title">
|
<view class="zl-title">
|
||||||
会员免费领
|
会员免费领
|
||||||
|
|
@ -163,7 +163,7 @@
|
||||||
<u-popup v-model="xxPopu" :closeable="false" close-icon-color="#ffffff" mode="center">
|
<u-popup v-model="xxPopu" :closeable="false" close-icon-color="#ffffff" mode="center">
|
||||||
<view class="zl" style="height: 580rpx;" @click="saveNewUser()">
|
<view class="zl" style="height: 580rpx;" @click="saveNewUser()">
|
||||||
<image class="zl-bgs"
|
<image class="zl-bgs"
|
||||||
src="https://video.hnsiyao.cn/file/uploadPath/2024/02/22/cee2fcdc4c4ebe31ab4ce2c3c3a3d183.png"
|
src="https://dj-api.hnsiyao.cn/file/uploadPath/2024/02/22/cee2fcdc4c4ebe31ab4ce2c3c3a3d183.png"
|
||||||
mode=""></image>
|
mode=""></image>
|
||||||
<view class="zl-titles">
|
<view class="zl-titles">
|
||||||
{{xxJDNum}} <text>金豆</text>
|
{{xxJDNum}} <text>金豆</text>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view style="padding-bottom: 40rpx;">
|
<view style="padding-bottom: 40rpx;">
|
||||||
<u-navbar :background="background" :is-back="false" :title="title" :border-bottom="false">
|
<u-navbar :background="background" :is-back="false" :title="title" :border-bottom="false">
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
<!-- 登录信息 -->
|
<!-- 登录信息 -->
|
||||||
<view class="info flex align-center justify-center">
|
<view class="info flex align-center justify-center">
|
||||||
|
|
@ -134,6 +134,15 @@
|
||||||
卡密兑换
|
卡密兑换
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="tool-box-content-item flex align-center justify-center flex-wrap"
|
||||||
|
@click="goNav('/me/choujiang/choujiang')">
|
||||||
|
<view class="tool-box-content-item-img">
|
||||||
|
<image src="../../static/images/me/zhuanpan.png" mode=""></image>
|
||||||
|
</view>
|
||||||
|
<view class="tool-box-content-item-txt">
|
||||||
|
转盘抽奖
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="tool-box-content-item flex align-center justify-center flex-wrap"
|
<view class="tool-box-content-item flex align-center justify-center flex-wrap"
|
||||||
@click="goNav('/me/invite/index')">
|
@click="goNav('/me/invite/index')">
|
||||||
<view class="tool-box-content-item-img">
|
<view class="tool-box-content-item-img">
|
||||||
|
|
@ -278,7 +287,7 @@
|
||||||
rate: 0,
|
rate: 0,
|
||||||
kmPaySel: '否',
|
kmPaySel: '否',
|
||||||
isWxIosPay: true, //微信下是否显示支付功能
|
isWxIosPay: true, //微信下是否显示支付功能
|
||||||
userInfo: null,
|
userInfo: {amount:0},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
<u-popup v-model="showjl" :closeable="true" close-icon-color="#ffffff" mode="center">
|
<u-popup v-model="showjl" :closeable="true" close-icon-color="#ffffff" mode="center">
|
||||||
<view class="zl" @click="goZl()">
|
<view class="zl" @click="goZl()">
|
||||||
<image class="zl-bg"
|
<image class="zl-bg"
|
||||||
src="https://video.hnsiyao.cn/file/uploadPath/2023/12/14/adf37beca97826d44970d20118f88e29.png"
|
src="https://dj-api.hnsiyao.cn/file/uploadPath/2023/12/14/adf37beca97826d44970d20118f88e29.png"
|
||||||
mode=""></image>
|
mode=""></image>
|
||||||
<view class="zl-title">
|
<view class="zl-title">
|
||||||
会员免费领
|
会员免费领
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="162.885" height="167.944" viewBox="0 0 162.885 167.944"><defs><style>.a,.b,.c{fill:#4a68cc;}.a{opacity:0.1;}.b{opacity:0.5;}.c{opacity:0.2;}</style></defs><g transform="translate(-102.4 -97.28)"><path class="a" d="M102.4,854.917c0,5.587,36.237,10.117,80.937,10.117s80.937-4.53,80.937-10.117S228.037,844.8,183.337,844.8,102.4,849.33,102.4,854.917Z" transform="translate(0 -599.811)"/><path class="b" d="M116.736,152.519a3.035,3.035,0,1,0,3.035-3.035A3.112,3.112,0,0,0,116.736,152.519ZM276.788,242.46c-3.844,1.012-4.654,1.821-5.564,5.564-1.012-3.844-1.821-4.654-5.564-5.564,3.743-1.012,4.654-1.821,5.564-5.564C272.134,240.639,272.944,241.55,276.788,242.46ZM133.632,141.9c-4.957,1.315-5.969,2.327-7.284,7.284-1.315-4.957-2.327-5.969-7.284-7.284,4.957-1.315,5.969-2.428,7.284-7.284C127.561,139.569,128.674,140.581,133.632,141.9Zm121.4-17.4c-3.035.809-3.642,1.416-4.452,4.452-.809-3.035-1.416-3.642-4.452-4.452,3.035-.809,3.642-1.416,4.452-4.452C251.293,123.079,252,123.686,255.036,124.495Zm13.051-15.58c-7.891,2.023-9.51,3.743-11.635,11.635-2.023-7.891-3.743-9.51-11.635-11.635,7.891-2.023,9.51-3.743,11.635-11.635C258.476,105.07,260.2,106.79,268.087,108.915Z" transform="translate(-11.503)"/><path class="c" d="M419.84,679.117v.809l6.677,6.171,25.6-12.444-23.168,14.872v7.284l3.743-3.642v0l3.743,3.642,19.829-24.281v-.809Z" transform="translate(-254.714 -460.129)"/><path class="b" d="M301.843,252.852v-.2c0-.2-.1-.3-.1-.506v-.1L279.99,195.286A23.264,23.264,0,0,0,257.834,179.2H208.361A23.264,23.264,0,0,0,186.2,195.286l-21.752,56.757v.1a.912.912,0,0,0-.1.506v40.873a23.273,23.273,0,0,0,23.269,23.269h91.054a23.273,23.273,0,0,0,23.269-23.269V253.055C301.843,252.953,301.843,252.953,301.843,252.852ZM191.87,197.411a.1.1,0,0,1,.1-.1,17.027,17.027,0,0,1,16.39-12.039h49.371a17.279,17.279,0,0,1,16.491,11.938.1.1,0,0,0,.1.1l20.133,52.609H248.223a2.981,2.981,0,0,0-3.035,3.035,12.14,12.14,0,1,1-24.281,0,2.981,2.981,0,0,0-3.035-3.035H171.737Zm103.9,96.112a17.185,17.185,0,0,1-17.2,17.2H187.52a17.185,17.185,0,0,1-17.2-17.2V256.09H215.14a18.153,18.153,0,0,0,35.814,0h44.819Z" transform="translate(-49.71 -65.733)"/><path class="c" d="M304.531,311.521a5.009,5.009,0,0,1-5.059-5.059V296.345H253.44l16.592-43.3.1-.2a10.2,10.2,0,0,1,9.712-7.082h49.371a10.2,10.2,0,0,1,9.712,7.082l.1.2,16.592,43.3H309.59v10.117a5.009,5.009,0,0,1-5.059,5.059Z" transform="translate(-121.195 -119.141)"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 47 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Loading…
Reference in New Issue