账户中心 退出系统
5.0 版本 3.0 版本
使用手册 模板中心 账户中心 合作 · 服务
快速开始
框架介绍版权要求
更新日志
常见问题
框架部署目录结构
版本差别V5 vs V3
皮肤说明
nvue 说明
数据转换格式问题
页面布局 ( 13 )
页面组件 独创 · 好用
全屏加载 + 挂件
自定义头部返回 · 主页
自定义头部动态变化
自定义头部双击回顶部
返回顶部组件组件模式
自定义底部详情模式
自定义 tabbar凸出按钮
吸顶元素插槽实现
动态吸顶逻辑演示
iPhone 底部适配自动适配
小程序胶囊按钮躲避
下拉选择筛选 · 排序
框架基础 ( 7 )
文本相关尺寸及修饰
定位样式absolute · fixed
手势操作触屏 · 缩放
内置图标
按钮样式
常用标题更多 · 换一批
动画效果
Grace.JS ( 16 )
工具介绍
网络请求
页面跳转
数据缓存
图片操作
设备信息
消息提示
头部导航 动态设置
底部导航 动态设置
元素选择 尺寸获取
字符常用
数组操作
随机数据
日期时间
延时循环
对象操作
请求工具库 ( 7 )
工具库介绍
GET 请求
POST 请求
upload 上传
签名验证
用户登录检查
后端代码 php 版本示例
常用组件 ( 18 )
图片组件等比缩放
排序按钮
搜索组件
徽章角标
标签组件
功能标签选择 · 删除
星级组件
倒计时组件
城市选择
地区联动省市区三级
链接组件
为空展示
多图选择
多图上传
头像群组
数值动画
PK 投票
抽奖转盘
常用布局 ( 10 )
Flex布局必备技能
宫格布局默认5格
普通表格
数据表格
横向公告
时间轴布局
步骤展示
骨架加载
瀑布流布局
启动页广告全屏轮播形式
列表布局 ( 8 )
列表布局样式模式
滑动列表
可选列表
全选列表
树状列表
排序列表竖向拖拽
卡片列表
名片卡片
切换布局 ( 8 )
切换导航单行
切换导航多行
局部选项卡
全屏选项卡布局原理
分段切换
折叠面板
竖向切换导航适配
分类切换
滚动 · 轮播 ( 6 )
滚动区域原生 scroll-view
滚动公告基于 swiper
无缝滚动横向文本形式
无缝滚动横向卡片形式
竖向公告顺序卡片形式
轮播组件
刷新加载 ( 5 )
下拉刷新基于页面组件
加载更多基于页面组件
刷新和加载基于页面组件
刷新和加载自定义组合
刷新和加载原生组合模式
弹层 · 对话框 ( 6 )
遮罩弹层 popup
顶部消息框
模态对话框
底部操作表
右侧菜单
弹出菜单 popup menu
表单相关 ( 12 )
表单元素 form 布局
表单验证
字数限制
动态表单 添加删除元素
分步提交
步进器
数字键盘
滑动解锁
进度滑块 单滑块
区间滑块 双滑块
功能标签 选择 · 删除
点选按钮
日期时间 ( 6 )
日历日期 带有农历及时间
日期区间 日历形式
日期时间 picker 模式
时间段选择 picker 模式
日程日历 日程 · 提醒
横向日历 布局模式
文章相关 ( 10 )
文章列表 基础用法
文章列表 切换模式
文章列表 全屏选项卡模式
编辑器 自主研发 · 多端兼容
文章详情 编辑器解析
富文本 字符串转数组
展开阅读
评论布局
评论提交
底部分享
媒体播放 ( 2 )
音乐播放器
视频播放器
地图使用 ( 3 )
位置标注
地图周边
拖拽定位
用户模板 ( 8 )
用户登录
短信登录
短信验证
个人中心
头像剪裁
证件上传
会员排行榜
手写签名
电商常用 ( 10 )
商品列表
商品详情
订单中心
购物车模板
排序与筛选
地址列表
地址添加
抽奖模板
分类图标
优惠券组件
即时通讯 ( 3 )
消息展示组件
消息输入组件
消息列表展示
二维码及条码 ( 3 )
二维码生成
条形码生成
海报模板
抽奖模板

手册版本 V5.0

兼容平台

H5APP小程序NVUE
✔✔✔✔

模板代码

UNI 普通版本
NVUE 版本
<template>
	<view style="background-color:#FFD800;">
		<view class="gui-img-in">
			<image class="lottery-draw-banner" 
			src='https://staticimgs.oss-cn-beijing.aliyuncs.com/choujiang-banner.png' mode='widthFix'></image>
		</view>
		<view class="lottery-draw-msg gui-border-box gui-margin-top">
			<gui-speaker :items="speakerMsgs" :vertical="true"
			styles="overflow:hidden; height:60rpx; line-height:60rpx; font-size:28rpx; color:#ED6A0C;">
				<text slot="icon" class="gui-block-text gui-icons demo-icon gui-color-orange" 
				style="width:100rpx;">&#xe62b;</text>
			</gui-speaker>
		</view>
		<view class="lottery-draw-main-bg gui-border-box">
			<view class="lottery-draw-main gui-border-box gui-flex">
				<view v-for="(item, index) in prizes" :key="index" 
				:class="[
					'lottery-draw-main-items', 
					'gui-border-box',
					animateIndex == index ? 'lottery-draw-animate' : '']">
					<view class="gui-img-in">
						<image :src="item.imgurl" 
						class="lottery-draw-main-img" mode='widthFix' 
						v-if="index != 4"></image>
					</view>
					<text class="lottery-draw-main-name gui-block-text" v-if="index != 4">{{item.title}}</text>
					<text class="lottery-draw-main-btn gui-block-text" v-if="index == 4" @tap="go">{{item.title}}</text>
				</view>
			</view>
		</view>
		<view class="gui-margin-top-large gui-padding" 
		style="padding-bottom:60rpx;">
			<view class="gui-flex gui-rows gui-justify-content-center gui-align-items-center">
				<text class="gui-icons gui-text gui-color-white ">&#xe69b;</text>
				<text class="gui-color-white gui-blod gui-h5 gui-margin">活动说明</text>
				<text class="gui-icons gui-text gui-color-white">&#xe69b;</text>
			</view>
			<text class="gui-text-small gui-text-center gui-color-white gui-block-text" style="margin-top:8rpx;">活动有效期 : 2018-12-30 至 2019-12-30</text>
		</view>
	</view>
</template>
<script>
var animateTimer = null;
export default {
    data() {
    	return {
			speakerMsgs: [
				{ title: "用户 *** 刚刚抽中一台 iphoneX", url: "", opentype: "navigate" },
				{ title: "用户 *** 刚刚抽中跑鞋", url: "", opentype: "navigate" }
			],
			// 奖品及按钮
			prizes : [
			  { title: 'iphoneX', 'imgurl': "https://img.alicdn.com/bao/uploaded/i1/809107100/TB2giNsX0LO8KJjSZPcXXaV0FXa_!!809107100.jpg" },
			  { title: '小米3', 'imgurl': "https://img.alicdn.com/bao/uploaded/i4/1714128138/O1CN015ZGeGj29zFfjpg41N_!!1714128138.jpg" },
			  { title: '记录仪', 'imgurl': "https://img.alicdn.com/bao/uploaded/i4/2631451752/O1CN01IyRW2w1OoSNvglF0E_!!2631451752.jpg" },
			  { title: '腾讯视频会员', 'imgurl': "https://img.alicdn.com/bao/uploaded/i4/2966815968/O1CN01DRE0eb1txOC21pZDc_!!0-item_pic.jpg" },
			  { title: 'GO', 'imgurl': "" },
			  { title: '小米手环', 'imgurl': "https://img.alicdn.com/bao/uploaded/i1/1099051825/TB2gMRodgHqK1RjSZFEXXcGMXXa_!!1099051825.jpg" },
			  { title: '跑鞋', 'imgurl': "https://img.alicdn.com/bao/uploaded/i1/890482188/O1CN01vzTaOr1S294ocZqkG_!!0-item_pic.jpg" },
			  { title: '台灯', 'imgurl': "https://img.alicdn.com/bao/uploaded/i3/2616970884/O1CN016tVSDi1IOubrk1Tjl_!!2616970884.jpg" },
			  { title: '谢谢参与', 'imgurl': "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3225805949,731297870&fm=26&gp=0.jpg" },
			],
			// 转圈 index
			turnIndex : 0,
			// 动画 index
			animateIndex : -1,
			// 动画 执行状态 stop 停止 ing 执行中 end 结束
			animateStatus : 'stop' 
		}
    },
	methods:{
		// 抽奖动画
		go : function(){
			// 用户如果已经抽过奖或者不满足条件这里使用 return 返回,终止程序运行
			// your code ...

			// 判断是否正在执行动画
			if (this.animateStatus != 'stop'){return false;}
			this.animateStatus = 'ing';

			// 此处根据自己的业务决定抽奖结果[ 算法可以是后端或前端 自行百度根据自己概率做算法 ]

			// 比如模拟一个随机 0 - 8 数字[ 中奖率极高 ]
			var num = Math.floor(Math.random() * 8);
			// 不能抽中按钮所以抽中按钮等没中奖
			if(num == 4){num = 8;}
			// num 代表奖品的 index 应该使用自己的算法得出
			
			// 动画
			this.animate(num);
		  },
		  animate:function(num){
			//执行动画 100 代表动画切换时间可以调整动画速度
			this.turnIndex    = 0;
			this.animateIndex = 0;
			animateTimer = setInterval(() => {this.turn(num);}, 100);
		  },
		  turn : function(num){
			var orders = [0, 1, 2, 5, 8, 7, 6, 3]; //奖品序号
			var turnNumForPrizes = 0; //奖品的位置
			for(var i = 0; i < orders.length; i++){
			  if (orders[i] == num){
				turnNumForPrizes = i;
				break;
			  }
			}
			var turnNum = 3; //此处设置预先转几圈
			if (this.turnIndex >= 8 * turnNum + turnNumForPrizes){
			  clearInterval(animateTimer) ; 
			  // 动画结束 此处可以进行后续操作
			  this.animateStatus = 'stop'; // 可以继续抽奖
			  // this.animateStatus = 'end'; // 这样写就可以结束抽奖

			  if(num == 8){
				uni.showToast({
				  title: '感谢参与 ^_^',
				  icon:"none"
				});
			  }else{
				uni.showToast({
				  title: '恭喜您!抽中了 : ' + this.prizes[num].title,
				  icon: "none"
				});
			  }
			  // your code ...
			  return ;
			}
			this.turnIndex++;
			var animateIndex  = this.turnIndex % 8;
			this.animateIndex = orders[animateIndex];
		}
	}
}
</script>
<style scoped>
.lottery-draw-banner{width:750rpx; height:388rpx;}
.lottery-draw-msg{width:630rpx; border-width:1rpx; border-style:solid; border-color:#FC5566; border-radius:50px; color:#E81B54; background-color:rgba(255, 255,255, 0.8); padding:0rpx 30rpx; margin-left:60rpx;}
.lottery-draw-main-bg{width:630rpx; padding:15rpx; border-radius:10px; margin:30rpx 60rpx; background-color:#FC5566;}
.lottery-draw-main{width:600rpx; height:630rpx; padding:15rpx; background-color:#E81B54; border-radius:8px; flex-direction:row; flex-wrap:wrap; justify-content:space-between;}
.lottery-draw-main-items{width:180rpx; height:180rpx; background-color:rgba(255,255,255, 1); margin:5rpx; border-radius:5rpx; border-width:8rpx; border-style:solid; border-color:#FFFFFF; overflow:hidden;}
.lottery-draw-main-btn{color:#AB6120; background-color:#FFB001; font-weight:bold; height:164rpx; line-height:164rpx; text-align:center; font-size:50rpx;}
.lottery-draw-main-img{width:100rpx; height:100rpx; margin:8rpx 30rpx; overflow:hidden;}
.lottery-draw-main-name{line-height:40rpx; height:40rpx; overflow:hidden; text-align:center; color:#AB6120; font-size:22rpx;}
.lottery-draw-animate{border-color:#FFD800;}
</style>