feat(uniapp_v2): 二开功能迁移与小程序主包优化
- 从 uniapp 迁移 HJF 页面、API、组件及用户/订单相关改动 - queue、assets 使用独立分包以降低主包体积 - 修复首页单根节点与支付结果页 v-if 链 - 关闭 HjfDemoPanel 全局注册;uniNoticeBar 注释 $getAppWebview 避免 __webviewId__ 报错 - 配置域名与 manifest 应用名称;cache/store 防御性处理 Made-with: Cursor
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,250 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
ul,
|
||||
li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.lottery_container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.grid_wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul li {
|
||||
border-radius: 50%;
|
||||
width: 17upx;
|
||||
height: 17upx;
|
||||
background-color: #bce0e9;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul li:nth-child(even) {
|
||||
width: 24upx;
|
||||
height: 24upx;
|
||||
background-color: #f5fbc8;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(odd) {
|
||||
width: 100%;
|
||||
height: 35upx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(odd) li {
|
||||
margin: 0 10upx;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(even) {
|
||||
width: 35upx;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(even) li {
|
||||
margin: 10upx 0;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(3) {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(4) {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(1) li:nth-child(odd),
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(4) li:nth-child(odd) {
|
||||
animation: blink_large 1s linear infinite;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(1) li:nth-child(even),
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(4) li:nth-child(even) {
|
||||
animation: blink_small 1s linear infinite;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(3) li:nth-child(even),
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(2) li:nth-child(even) {
|
||||
width: 17upx;
|
||||
height: 17upx;
|
||||
background-color: #bce0e9;
|
||||
animation: blink_large 1s linear infinite;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(3) li:nth-child(odd),
|
||||
.grid_wrap .lottery_wrap_border ul:nth-child(2) li:nth-child(odd) {
|
||||
width: 24upx;
|
||||
height: 24upx;
|
||||
background-color: #f5fbc8;
|
||||
animation: blink_small 1s linear infinite;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 14upx;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid {
|
||||
width: 100%;
|
||||
height: 424rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li {
|
||||
width: 32%;
|
||||
height: 130rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
float: left;
|
||||
position: absolute;
|
||||
border-radius: 16rpx;
|
||||
color: #E74435;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 20upx;
|
||||
/* margin: 4px; */
|
||||
padding: 4px;
|
||||
background: #FEF6E7;
|
||||
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li .in_line {
|
||||
border-radius: 12rpx;
|
||||
width: 100%;
|
||||
height: 130rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
padding: 0 4rpx;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li .grid_img {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid .active {
|
||||
background: rgba(255,125,0,0.2) !important;
|
||||
color: #E93323;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li:nth-of-type(1) {
|
||||
left: 1%;
|
||||
top: 1%;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li:nth-of-type(2) {
|
||||
left: 34%;
|
||||
top: 1%;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li:nth-of-type(3) {
|
||||
left: 67%;
|
||||
top: 1%;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li:nth-of-type(4) {
|
||||
left: 67%;
|
||||
top: 34%;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li:nth-of-type(5) {
|
||||
left: 67%;
|
||||
top: 67%;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li:nth-of-type(6) {
|
||||
left: 34%;
|
||||
top: 67%;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li:nth-of-type(7) {
|
||||
left: 1%;
|
||||
top: 67%;
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li:nth-of-type(8) {
|
||||
left: 1%;
|
||||
top: 34%;
|
||||
|
||||
}
|
||||
|
||||
.grid_wrap .lottery_wrap .lottery_grid li:nth-of-type(9) {
|
||||
left: 34%;
|
||||
top: 34%;
|
||||
cursor: pointer;
|
||||
color: #ffffff;
|
||||
background: linear-gradient(90deg, var(--view-gradient) 0, var(--view-theme) 100%);
|
||||
}
|
||||
|
||||
@keyframes blink_large {
|
||||
to {
|
||||
width: 24upx;
|
||||
height: 24upx;
|
||||
background-color: #f5fbc8;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes blink_small {
|
||||
to {
|
||||
width: 17upx;
|
||||
height: 17upx;
|
||||
background-color: #bce0e9;
|
||||
}
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=SJ-LotteryDraw.css.map */
|
||||
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<view class="lottery_container">
|
||||
<view class="grid_wrap">
|
||||
<view class="lottery_wrap">
|
||||
<view class="lottery_grid">
|
||||
<view v-for="(item, index) in prizeData" :key="index" :class="{ active: current_index == index && index != 8 }" class="item" @click="luck_draw">
|
||||
<view :class="{in_line:index != 8 }" class="lottery-msg">
|
||||
<image v-if="index != 8" class="grid_img" mode='aspectFit' :src="item.image" alt="" />
|
||||
<text v-if="index !=8" class="name line1">
|
||||
{{ index == 8 ? '抽奖' : item.name }}
|
||||
</text>
|
||||
<view v-else class="flex-col flex-center lottery-click">
|
||||
<!-- <text class="fs-36">立即抽奖</text> -->
|
||||
<text class="fs-36">{{lotteryNum}}次</text>
|
||||
<text class="fs-20 lh-28rpx">抽奖机会</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="lottery_wrap_border">
|
||||
<ul v-for="(item, index) in 4" :key="index">
|
||||
<li v-for="(item, index) in 12" :key="index"></li>
|
||||
</ul>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LotteryDraw from './js/grids_lottery.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
current_index: -1,
|
||||
lotteryBtn: true
|
||||
};
|
||||
},
|
||||
props: {
|
||||
prizeData: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return []
|
||||
}
|
||||
},
|
||||
lotteryType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
datatime: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
lotteryNum: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
isRotating: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
winingIndex: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
isRotating(newValue, oldValue) {
|
||||
let that = this;
|
||||
if (newValue) {
|
||||
// let lottery_draw_param = res;
|
||||
let win = new LotteryDraw({
|
||||
domData: that.prizeData,
|
||||
// ...lottery_draw_param
|
||||
startIndex: 3, //开始抽奖位置,从0开始
|
||||
totalCount: 3, //一共要转的圈数
|
||||
winingIndex: this.winingIndex, //中奖的位置,从0开始
|
||||
speed: 100 //抽奖动画的速度 [数字越大越慢,默认100]
|
||||
},
|
||||
function(index, count) {
|
||||
that.current_index = index;
|
||||
if (that.winingIndex == index && 3 ==
|
||||
count) {
|
||||
that.lotteryBtn = true
|
||||
that.$emit('luck_draw_finish', that.prizeData[index])
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
|
||||
methods: {
|
||||
luck_draw(event) {
|
||||
let timestamp = Date.parse(new Date()) / 1000;
|
||||
if (this.lotteryType == 1 && parseInt(timestamp) > parseInt(this.datatime)) {
|
||||
return this.$util.Tips({
|
||||
title: '您抽奖的有效时间已到期'
|
||||
}, function() {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
});
|
||||
}
|
||||
let index = event.currentTarget.dataset.index;
|
||||
if (this.lotteryBtn && index == 8) {
|
||||
this.lotteryBtn = false
|
||||
} else {
|
||||
return
|
||||
}
|
||||
let that = this;
|
||||
if (index == 8) {
|
||||
// 点击抽奖之后知道获奖位置,修改父组件中lottery_draw_param的值
|
||||
this.$emit('get_winingIndex', function(res) {
|
||||
let lottery_draw_param = res;
|
||||
let win = new LotteryDraw({
|
||||
domData: that.prizeData,
|
||||
...lottery_draw_param
|
||||
},
|
||||
function(index, count) {
|
||||
that.current_index = index;
|
||||
if (lottery_draw_param.winingIndex == index && lottery_draw_param.totalCount ==
|
||||
count) {
|
||||
that.lotteryBtn = true
|
||||
that.$emit('luck_draw_finish', that.prizeData[index])
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import './css/grids_lottery.css';
|
||||
|
||||
.lottery-msg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0 4rpx;
|
||||
|
||||
.name {}
|
||||
}
|
||||
|
||||
.lottery-click {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.lottery_grid .name {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
function LotteryDraw(obj, callback) {
|
||||
this.timer = null; //计时器
|
||||
this.startIndex = obj.startIndex-1 || 0; //从第几个位置开始抽奖 [默认为零]
|
||||
this.count = 0; //计数,跑的圈数
|
||||
this.winingIndex = obj.winingIndex || 0;//获奖的位置
|
||||
this.totalCount = obj.totalCount || 6;//抽奖跑的圈数
|
||||
this.speed = obj.speed || 100;
|
||||
this.domData=obj.domData;
|
||||
this.rollFn();
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
LotteryDraw.prototype = {
|
||||
rollFn: function() {
|
||||
var that = this;
|
||||
// console.log(`获奖位置:${this.winingIndex}`)
|
||||
// 活动index值增加,即移动到下一个格子
|
||||
this.startIndex++;
|
||||
|
||||
//startIndex是最后一个时一圈走完,重新开始
|
||||
if (this.startIndex >= this.domData.length - 1) {
|
||||
this.startIndex = 0;
|
||||
this.count++;
|
||||
}
|
||||
|
||||
// 当跑的圈数等于设置的圈数,且活动的index值是奖品的位置时停止
|
||||
if (this.count >= this.totalCount && this.startIndex === this.winingIndex) {
|
||||
if (typeof this.callback === 'function') {
|
||||
setTimeout(function() {
|
||||
that.callback(that.startIndex,that.count); //执行回调函数,抽奖完成的相关操作
|
||||
}, 400);
|
||||
}
|
||||
clearInterval(this.timer);
|
||||
}else { //重新开始一圈
|
||||
if (this.count >= this.totalCount - 1) {
|
||||
this.speed += 30;
|
||||
}
|
||||
this.timer = setTimeout(function() {
|
||||
that.callback(that.startIndex,that.count);
|
||||
that.rollFn();
|
||||
}, this.speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LotteryDraw;
|
||||
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<view class="lottery_container">
|
||||
<view class="grid_wrap">
|
||||
<view class="lottery_wrap">
|
||||
<ul class="lottery_grid">
|
||||
<li v-for="(item, index) in prizeData" :class="{ active: current_index == index && index != 8 }"
|
||||
:key="index" @click="luck_draw" :data-index="index">
|
||||
<view :class="{in_line:index != 8 }" class="lottery-msg">
|
||||
<image v-if="index != 8" class="grid_img" mode='aspectFit' :src="item.image" alt="" />
|
||||
<text v-if="index !=8" class="name">
|
||||
{{ index == 8 ? '抽奖' : item.name }}
|
||||
</text>
|
||||
<view v-else class="flex-col flex-center lottery-click">
|
||||
<image src="../../static/lottery_text.png" class="w-140 h-32 block"></image>
|
||||
<text class="fs-20 lh-28rpx pt-6">剩余 {{lotteryNum}} 次机会</text>
|
||||
</view>
|
||||
</view>
|
||||
</li>
|
||||
</ul>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LotteryDraw from './js/grids_lottery.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
current_index: -1,
|
||||
lotteryBtn: true
|
||||
};
|
||||
},
|
||||
props: {
|
||||
prizeData: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
return []
|
||||
}
|
||||
},
|
||||
lotteryType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
datatime: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
lotteryNum:{
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
luck_draw(event) {
|
||||
console.log(123456);
|
||||
let timestamp = Date.parse(new Date())/1000;
|
||||
if(this.lotteryType == 1 && parseInt(timestamp)>parseInt(this.datatime)){
|
||||
return this.$util.Tips({
|
||||
title: '您抽奖的有效时间已到期'
|
||||
},function(){
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
});
|
||||
}
|
||||
let index = event.currentTarget.dataset.index;
|
||||
if (this.lotteryBtn && index == 8) {
|
||||
this.lotteryBtn = false
|
||||
} else {
|
||||
return
|
||||
}
|
||||
let that = this;
|
||||
if (index == 8) {
|
||||
// 点击抽奖之后知道获奖位置,修改父组件中lottery_draw_param的值
|
||||
this.$emit('get_winingIndex', function(res) {
|
||||
let lottery_draw_param = res;
|
||||
let win = new LotteryDraw({
|
||||
domData: that.prizeData,
|
||||
...lottery_draw_param
|
||||
},
|
||||
function(index, count) {
|
||||
that.current_index = index;
|
||||
if (lottery_draw_param.winingIndex == index && lottery_draw_param.totalCount ==
|
||||
count) {
|
||||
that.lotteryBtn = true
|
||||
that.$emit('luck_draw_finish', that.prizeData[index])
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import './css/pay_lottery.css';
|
||||
|
||||
.lottery-msg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0 4rpx;
|
||||
|
||||
.name {}
|
||||
}
|
||||
|
||||
.lottery-click {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user