合并代码

This commit is contained in:
zpc 2025-05-03 13:37:24 +08:00
commit 53665b748d
7 changed files with 2784 additions and 2163 deletions

424
App.vue
View File

@ -1,239 +1,255 @@
<script>
import Vue from "vue";
//
import Vue from "vue";
//
export default {
data() {
return {
isFirstLaunch: true, //
}
},
onLaunch: function () {
console.log("App Launch");
// #ifdef MP-WEIXIN
const updateManager = uni.getUpdateManager();
export default {
data() {
return {
isFirstLaunch: true, //
}
},
onLaunch: function() {
console.log("App Launch");
// #ifdef MP-WEIXIN
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
//
console.log(res.hasUpdate);
});
updateManager.onCheckForUpdate(function(res) {
//
console.log(res.hasUpdate);
});
updateManager.onUpdateReady(function (res) {
uni.showModal({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success(res) {
if (res.confirm) {
// applyUpdate
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateReady(function(res) {
uni.showModal({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success(res) {
if (res.confirm) {
// applyUpdate
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function (res) {
//
});
//#endif
var that = this;
updateManager.onUpdateFailed(function(res) {
//
});
//#endif
var that = this;
this.$config.init().then(async (data) => {
//
let src = await that.$config.getAppSettingAsync("win_audio");
if (src == null || src == "") {
src = that.$img("/static/mp3/open.mp3");
}
//
const openBgm = uni.createInnerAudioContext();
Vue.prototype.bgmCtx = {};
Vue.prototype.bgmCtx.openBgm = openBgm;
openBgm.src = src;
});
this.$config.init().then(async (data) => {
//
let src = await that.$config.getAppSettingAsync("win_audio");
if (src == null || src == "") {
src = that.$img("/static/mp3/open.mp3");
}
//
const openBgm = uni.createInnerAudioContext();
Vue.prototype.bgmCtx = {};
Vue.prototype.bgmCtx.openBgm = openBgm;
openBgm.src = src;
//
this.callLoginRecordApi();
/* 重置首页公告弹窗状态 */
uni.setStorageSync("_is_this_show", false);
//
let src2 = await that.$config.getAppSettingAsync("win_audio2");
if (src2 == null || src2 == "") {
src2 = that.$img("/static/mp3/slot_open.mp3");
}
//
const slotBgm = uni.createInnerAudioContext();
Vue.prototype.bgmCtx = {};
Vue.prototype.bgmCtx.slotBgm = slotBgm;
slotBgm.src = src2;
/* 清除缓存中的广告id */
uni.removeStorageSync("_ad_id");
/* 清除缓存中的click_id */
uni.removeStorageSync("_click_id");
},
onShow: function () {
console.log("App Show");
// // onLaunch
// if (!this.isFirstLaunch) {
// this.callLoginRecordApi();
// } else {
// this.isFirstLaunch = false; //
// }
},
onHide: function () {
console.log("App Hide");
},
methods: {
//
callLoginRecordApi() {
//
const token = uni.getStorageSync('token');
if (!token) {
console.log('用户未登录,不调用登录记录接口');
return;
}
this.req({
url: 'login_record',
method: 'POST',
success: (res) => {
console.log('登录记录接口调用成功', res);
},
fail: (err) => {
console.log('登录记录接口调用失败', err);
}
});
}
}
};
});
//
this.callLoginRecordApi();
/* 重置首页公告弹窗状态 */
uni.setStorageSync("_is_this_show", false);
/* 清除缓存中的广告id */
uni.removeStorageSync("_ad_id");
/* 清除缓存中的click_id */
uni.removeStorageSync("_click_id");
},
onShow: function() {
console.log("App Show");
// // onLaunch
// if (!this.isFirstLaunch) {
// this.callLoginRecordApi();
// } else {
// this.isFirstLaunch = false; //
// }
},
onHide: function() {
console.log("App Hide");
},
methods: {
//
callLoginRecordApi() {
//
const token = uni.getStorageSync('token');
if (!token) {
console.log('用户未登录,不调用登录记录接口');
return;
}
this.req({
url: 'login_record',
method: 'POST',
success: (res) => {
console.log('登录记录接口调用成功', res);
},
fail: (err) => {
console.log('登录记录接口调用失败', err);
}
});
}
}
};
</script>
<style lang="scss">
/*每个页面公共css */
@import "./common/animate.css";
@import url("./common/common.css");
@import url("/components/gaoyia-parse/parse.css");
/*每个页面公共css */
@import "./common/animate.css";
@import url("./common/common.css");
@import url("/components/gaoyia-parse/parse.css");
/* 引入字体 */
@font-face {
font-family: "YouSheBiaoTiHei";
src: url($imgurl + "font/YouSheBiaoTiHei.ttf") format("truetype");
}
/* 引入字体 */
@font-face {
font-family: "YouSheBiaoTiHei";
src: url($imgurl + "font/YouSheBiaoTiHei.ttf") format("truetype");
}
@font-face {
font-family: "zihun152hao-jijiachaojihei";
src: url($imgurl + "font/zihun152hao-jijiachaojihei.TTF") format("truetype");
}
@font-face {
font-family: "zihun152hao-jijiachaojihei";
src: url($imgurl + "font/zihun152hao-jijiachaojihei.TTF") format("truetype");
}
@font-face {
font-family: "zihun147hao-xingyuanhei";
src: url($imgurl + "font/zihun147hao-xingyuanhei.TTF") format("truetype");
}
@font-face {
font-family: "zihun147hao-xingyuanhei";
src: url($imgurl + "font/zihun147hao-xingyuanhei.TTF") format("truetype");
}
page {
overflow-x: hidden;
page {
overflow-x: hidden;
&:before {
content: "";
position: fixed;
z-index: -1;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: #1c1b20;
}
}
&:before {
content: "";
position: fixed;
z-index: -1;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: #1c1b20;
}
}
.ziti {
font-family: YouSheBiaoTiHei;
}
.ziti {
font-family: YouSheBiaoTiHei;
}
.flex_center {
display: flex;
align-items: center;
}
.flex_center {
display: flex;
align-items: center;
}
.hang2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-wrap: break-word;
word-break: break-all;
}
.hang2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
word-wrap: break-word;
word-break: break-all;
}
.hang1 {
overflow: hidden;
/*超出部分隐藏*/
white-space: nowrap;
/*不换行*/
text-overflow: ellipsis;
/*超出部分文字以...显示*/
}
.hang1 {
overflow: hidden;
/*超出部分隐藏*/
white-space: nowrap;
/*不换行*/
text-overflow: ellipsis;
/*超出部分文字以...显示*/
}
.icon {
display: flex;
justify-content: center;
align-items: center;
.icon {
display: flex;
justify-content: center;
align-items: center;
image {
width: 100%;
height: 100%;
}
}
image {
width: 100%;
height: 100%;
}
}
.common_bg {
background-repeat: no-repeat;
background-position: 0 0;
background-size: 100% 100%;
}
.common_bg {
background-repeat: no-repeat;
background-position: 0 0;
background-size: 100% 100%;
}
.relative {
position: relative;
}
.relative {
position: relative;
}
button.hide {
position: absolute;
width: 100% !important;
height: 100% !important;
left: 0;
top: 0;
z-index: 1;
opacity: 0;
}
button.hide {
position: absolute;
width: 100% !important;
height: 100% !important;
left: 0;
top: 0;
z-index: 1;
opacity: 0;
}
/* 重写组件样式 */
/deep/.uni-noticebar {
padding: 0 !important;
margin: 0 !important;
}
/* 重写组件样式 */
/deep/.uni-noticebar {
padding: 0 !important;
margin: 0 !important;
}
/deep/.mescroll-upwarp {
box-sizing: border-box;
min-height: 55px;
padding: 15px 0;
text-align: center;
clear: both;
}
/deep/.mescroll-upwarp {
box-sizing: border-box;
min-height: 55px;
padding: 15px 0;
text-align: center;
clear: both;
}
/deep/.cmd-progress-outer {
line-height: 0;
/deep/.cmd-progress-outer {
line-height: 0;
.cmd-progress-bg {
margin: 0 !important;
}
}
.cmd-progress-bg {
margin: 0 !important;
}
}
.uni-tabbar__bd {
height: 50px !important;
}
.uni-tabbar__bd {
height: 50px !important;
}
.uni-tabbar__icon {
height: 50px !important;
}
.uni-tabbar__icon {
height: 50px !important;
}
@keyframes m-zoom {
0% {
transform: scale(1);
}
@keyframes m-zoom {
0% {
transform: scale(1);
}
50% {
transform: scale(0.9);
}
50% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
</style>
100% {
transform: scale(1);
}
}
</style>

View File

@ -336,7 +336,7 @@ $nav-height: 44px;
top: 0;
left: 0;
right: 0;
z-index: 998;
z-index: 98;
}
&--shadow {

View File

@ -0,0 +1,349 @@
<template>
<view class="scroll-view" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd">
<view class="view-list" :style="scrollOffsetStyle">
<view class="list-item" v-for="(item,index) in suffixItems" :key="index+'left'"
:style="(index-excessCount == curIndex && itemSelectBig) ? itemParentSelectStyle : itemParentNomalStyle"
@click="onItemClick(-excessCount,index)">
<view :class="{'item-checked ':itemSelectBig && (curIndex == index - excessCount)}"
:style="itemAnimateStyle">
<slot :item="item" :index="index"></slot>
</view>
</view>
<view class="list-item" v-for="(item,index) in items"
:style="(index == curIndex && itemSelectBig) ? itemParentSelectStyle : itemParentNomalStyle"
@click="onItemClick(index)" :key="index">
<view :class="{'item-checked ':itemSelectBig && (index == curIndex)}" :style="itemAnimateStyle">
<slot :item="item" :index="index"></slot>
</view>
</view>
<view class="list-item" v-for="(item,index) in prefixItems" :key="index + 'right'"
:style="(items.length + index == curIndex && itemSelectBig) ? itemParentSelectStyle : itemParentNomalStyle"
@click="onItemClick(items.length,index)">
<view :class="{'item-checked ':itemSelectBig && (curIndex == index + items.length)}"
:style="itemAnimateStyle">
<slot :item="item" :index="index"></slot>
</view>
</view>
</view>
</view>
</template>
<script>
let lottrypoolCount = 30;
export default {
props: {
aTime: {
type: [Number],
default: 0.2
},
// px
itemW: {
type: [Number],
default: uni.upx2px(170)
},
//, px
itemH: {
type: [Number],
default: uni.upx2px(220)
},
//item
excessCount: {
type: [Number],
default: 4
},
items: {
type: [Array],
default: []
},
//item
itemSelectBig: {
type: [Boolean],
default: false
},
//
disableTouch: {
type: [Boolean],
default: false
},
//
isLottry: {
type: [Boolean],
default: false
}
},
data() {
return {
scrolloffset: 0,
aniTime: this.aTime,
curIndex: 0,
isTouch: false,
isMove: false,
startX: 0,
endX: 0,
prizePoolItems: [], //
}
},
computed: {
//
startOffset() {
let itemScle = 1;
if (this.itemSelectBig) {
itemScle = 1.4
}
return uni.upx2px(375) - this.itemW * itemScle / 2 - this.excessCount * this.itemW;
},
scrollOffsetStyle() {
// translateX pxrpx
return `transition: all ${ this.isTouch ? 0 :this.aniTime }s ${this.isLottry?'ease-in-out':'linear'};transform: translateX(${this.scrolloffset}px);`
},
//
prefixItems() {
return this.items.slice(0, this.excessCount);
},
//
suffixItems() {
return this.items.slice(this.items.length - this.excessCount, this.items.length);
},
//item1.4
itemParentSelectStyle() {
return `width:${this.itemW * 1.4}px;height:${this.itemH*1.4}px;transition: all ${this.aniTime}s linear;`
},
//
itemParentNomalStyle() {
return `width:${this.itemW}px;height:${this.itemH}px;transition: all ${this.aniTime}s linear;`
},
itemAnimateStyle() {
return `transition: all ${this.aniTime}s linear;transform-origin: bottom center;`
}
},
mounted() {
if (this.isLottry) {
this.initLottryData();
} else {
this.scrolloffset = this.startOffset;
}
},
methods: {
onTouchStart(e) {
if (this.disableTouch) return
let x = e.changedTouches[0].clientX;
//console.log("=====",x);
this.isTouch = true;
//
this.oldOffset = this.scrolloffset;
this.startX = x;
},
onTouchMove(e) {
if (this.disableTouch) return
this.isMove = true;
let x = e.changedTouches[0].clientX;
console.log("触摸结束=====", x);
this.endX = x;
this.scrolloffset = this.oldOffset + this.endX - this.startX;
},
onTouchEnd(e) {
if (this.disableTouch || this.isLottry) return
let x = e.changedTouches[0].clientX;
//console.log("=====",x);
if (this.isMove && !this.isLottry) {
//item
this.moveItemAfterToCenter();
}
this.isTouch = false;
this.isMove = false;
},
//item使
moveItemAfterToCenter() {
//1itemcurIndex
//this.scrolloffset = startOffset - realIndex * this.itemW;
//realIndex = (startOffset - this.scrolloffset)/this.itemW;
//realIndex realIndex ± 0.5 item, this.itemW/2
//realIndex = (startOffset - this.scrolloffset - this.itemW/2)/this.itemW;
// let curIndex = Math.round((startOffset - this.scrolloffset) / this.itemW);
//
let curIndex = Math.ceil((this.startOffset - this.scrolloffset - this.itemW / 2) / this.itemW);
this.curIndex = curIndex;
console.log("计算得到当前索引:", curIndex);
this.scrolloffset = this.startOffset - curIndex * this.itemW;
this.loopOffset(curIndex);
},
onItemClick(startIndex, index) {
if (this.disableTouch) {
return;
}
let realIndex = startIndex;
if (startIndex > 9) {
realIndex = startIndex + index;
}
if (startIndex < 0) {
realIndex = startIndex + index;
}
this.curIndex = realIndex;
this.scrolloffset = this.startOffset - realIndex * this.itemW;
//console.log("",this.scrolloffset);
this.loopOffset(realIndex);
},
//
loopOffset(realIndex) {
if (realIndex > this.items.length - 1 || realIndex < 0) {
let rindex = 0;
if (realIndex > this.items.length - 1) { //item
rindex = realIndex - this.items.length;
} else { //itemitem
rindex = this.items.length + realIndex;
}
setTimeout(() => {
console.log("归正:");
//使
this.aniTime = 0;
this.scrolloffset = this.startOffset - rindex * this.itemW;
this.curIndex = rindex;
setTimeout(() => {
console.log("归正结束");
this.aniTime = this.aTime;
}, 100) //
}, 300)
} else {
this.curIndex = realIndex;
}
},
//
initLottryData() {
//
// let winPrizeItemIndex = parseInt(Math.random()*this.items.length);
let winPrizeItemIndex = 4;
let prizeItem = this.items[winPrizeItemIndex]; //
let listLength = this.items.length;
let prizePoolItems = [];
if (this.prizePoolItems.length == 0) { //
console.log("第一次抽奖:");
while (prizePoolItems.length < lottrypoolCount) {
if (prizePoolItems.length == lottrypoolCount - 3) {
//
prizePoolItems.push(prizeItem);
} else {
//
const randomIndex = parseInt(Math.random() * listLength);
prizePoolItems.push(this.items[randomIndex]);
}
}
} else {
//
prizePoolItems.push(this.prizePoolItems[this.prizePoolItems.length - 5]);
prizePoolItems.push(this.prizePoolItems[this.prizePoolItems.length - 4]);
prizePoolItems.push(this.prizePoolItems[this.prizePoolItems.length - 3]);
prizePoolItems.push(this.prizePoolItems[this.prizePoolItems.length - 2]);
prizePoolItems.push(this.prizePoolItems[this.prizePoolItems.length - 1]);
while (prizePoolItems.length < lottrypoolCount) {
if (prizePoolItems.length == lottrypoolCount - 3) {
//
prizePoolItems.push(prizeItem);
} else {
//
const randomIndex = parseInt(Math.random() * listLength);
prizePoolItems.push(this.items[randomIndex]);
}
}
}
//
this.prizePoolItems = prizePoolItems;
this.items = prizePoolItems;
console.log("奖品池数据:", prizePoolItems);
this.aniTime = 0;
this.scrolloffset = this.startOffset - 2 * this.itemW;
setTimeout(() => {
this.aniTime = this.aTime;
}, 100)
},
startDraw() {
console.log("startDraw");
if (this.drawTimer) {
uni.showToast({
title: "正在抽奖,请稍后。。。",
icon: "none"
})
return
}
this.scrolloffset = this.startOffset - 27 * this.itemW;
console.log("this.scrolloffset", this.scrolloffset);
this.drawTimer = setTimeout(() => {
clearTimeout(this.drawTimer);
this.drawTimer = null;
this.initLottryData();
}, this.aniTime * 1000);
}
}
}
</script>
<style lang="scss">
.scroll-view {
position: relative;
height: 152.78rpx;
overflow: hidden;
display: flex;
align-items: center;
flex-direction: row;
box-sizing: border-box;
}
.view-list {
position: relative;
display: flex;
flex-wrap: nowrap;
flex-direction: row;
align-items: center;
box-sizing: border-box;
.list-item {
position: relative;
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
transform-origin: bottom center;
// .itemnormal {
// box-sizing: border-box;
// transform-origin: bottom center;
// }
.item-checked {
background-color: gold;
transform: scale(1.4);
}
.item-center-line {
position: absolute;
height: 100%;
width: 1rpx;
background-color: green;
box-sizing: border-box;
}
}
}
</style>

View File

@ -365,6 +365,13 @@
"navigationStyle": "custom"
}
},
{
"path" : "pages/shouye/slots",
"style" :
{
"navigationStyle": "custom"
}
},
{
"path" : "pages/other/choose_address",
"style" :

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
<view class="content">
<view class="navLeft align-center" :style="{ top: $sys().statusBarHeight + 'px' }" @tap="$c.back(1)">
<view class="flex" style="width: 100%">
<view class="title1" style="width: 166rpx; height: 64rpx; margin-top: 5rpx;">
<view class="title1" style="width: 166rpx; height: 64rpx; margin-top: 5rpx;" @click="jumapSlots()">
<image :src="$img1('common/home_logo.png')" style="width: 166rpx; height: 64rpx;" mode=""></image>
</view>
</view>
@ -430,6 +430,10 @@ export default {
toyaqingRanking() {
this.$customRouter.navigateTo("/pages/shouye/yaoqing_ranking");
},
jumapSlots(){
this.$customRouter.navigateTo("/pages/shouye/slots");
}
},
};
</script>

175
pages/shouye/slots.vue Normal file
View File

@ -0,0 +1,175 @@
<template>
<page-container title="老虎机" :showBack="true">
<view class="content-container">
<view class="slot-view">
<view class=""
style="width: 100%; height: 152.78rpx; background-color: aquamarine; margin-top: 195rpx;">
<tiner-swiper-loop ref="lottryRef" :itemW="lotteryItemSize[0]" :itemH="lotteryItemSize[1]"
:items="items" :aTime="5" :isLottry="true" :excessCount="0" :disableTouch="true"
style="height: 152.78rpx;">
<template v-slot="{item,index}">
<view class="item-lottry" :style="{ color: item.color }">{{item.value}}</view>
</template>
</tiner-swiper-loop>
</view>
</view>
</view>
<button style="margin-top: 20rpx;" @click="onStartDraw">开始抽奖</button>
</page-container>
</template>
<script>
export default {
data() {
return {
//
items: [{
value: '一等奖',
color: '#ff0000'
},
{
value: '七等奖',
color: '#ff8800'
}, {
value: '七等奖',
color: '#ff8800'
}, {
value: '七等奖',
color: '#ff8800'
},
{
value: '二等奖',
color: '#00ff00'
},
{
value: '七等奖',
color: '#ff8800'
}, {
value: '七等奖',
color: '#ff8800'
},
{
value: '七等奖',
color: '#ff8800'
},
{
value: '三等奖',
color: '#0000ff'
},
{
value: '七等奖',
color: '#ff8800'
},
{
value: '四等奖',
color: '#ffff00'
},
{
value: '七等奖',
color: '#ff8800'
}, {
value: '七等奖',
color: '#ff8800'
}, {
value: '七等奖',
color: '#ff8800'
},
{
value: '五等奖',
color: '#ff00ff'
},
{
value: '六等奖',
color: '#00ffff'
},
{
value: '七等奖',
color: '#ff8800'
},
{
value: '七等奖',
color: '#ff8800'
},
],
}
},
computed: {
lotteryItemSize() {
let height = uni.upx2px(220);
let width = uni.upx2px(170);
return [width, height];
}
},
methods: {
onStartDraw() {
//this.$refs.lottryRef.initLottryData();
this.bgmCtx.slotBgm.play()
this.$refs.lottryRef.startDraw();
}
}
}
</script>
<style lang="scss">
.content-container {
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
background-image: url($imgurl + 'common/slot_bg.webp');
background-size: cover;
background-position: center;
}
.slot-view {
background-image: url($imgurl + 'common/slot1.png');
background-size: cover;
background-position: center;
width: 100%;
height: 427.78rpx;
}
.view-center-line {
position: absolute;
width: 1rpx;
background-color: red;
height: 300rpx;
z-index: 10;
}
.item-lottry {
height: 152.78rpx;
width: 152.78rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
border-radius: 16rpx;
color: black;
box-sizing: border-box;
background-color: rgba(255, 255, 255, 0.8);
}
</style>