Commit 74076163 authored by zjz1994's avatar zjz1994

Merge branch 'walking-cat' of http://gitlab2.dui88.com/wanghongyuan/taobaominiDemo into walking-cat

parents 2e6e40f9 c6576dfd
No preview for this file type
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$');
require('../../client/pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../client/components/task-dialog/task-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/components/prize-dialog/prize-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/components/activity-rule-dialog/activity-rule-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/pages/index/index?hash=f7f58b400fce51a56bcb347f601e6860c0db2b84');
require('../../client/pages/index2/index2?hash=5158fa18297db3fbaac119609b168d20fcdf1eea');
......@@ -29,7 +29,10 @@ if(AFAppX.registerApp) {
function success() {
require('../../client/app');
require('../../client/pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../client/components/task-dialog/task-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/components/prize-dialog/prize-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/components/activity-rule-dialog/activity-rule-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/pages/index/index?hash=f7f58b400fce51a56bcb347f601e6860c0db2b84');
require('../../client/pages/index2/index2?hash=5158fa18297db3fbaac119609b168d20fcdf1eea');
}
self.bootstrapApp ? self.bootstrapApp({ success }) : success();
......
require('@alipay/appx-compiler/lib/sjsEnvInit');
require('./config$');
require('../../client/pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../client/components/task-dialog/task-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/components/prize-dialog/prize-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/components/activity-rule-dialog/activity-rule-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/pages/index/index?hash=f7f58b400fce51a56bcb347f601e6860c0db2b84');
require('../../client/pages/index2/index2?hash=5158fa18297db3fbaac119609b168d20fcdf1eea');
......@@ -54,7 +54,10 @@ if(AFAppX.registerApp) {
function success() {
require('../../client/app');
require('../../client/pages/index/index?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../client/components/task-dialog/task-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/components/prize-dialog/prize-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/components/activity-rule-dialog/activity-rule-dialog?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../client/pages/index/index?hash=f7f58b400fce51a56bcb347f601e6860c0db2b84');
require('../../client/pages/index2/index2?hash=5158fa18297db3fbaac119609b168d20fcdf1eea');
}
self.bootstrapApp ? self.bootstrapApp({ success }) : success();
......
No preview for this file type
import request from "./utils/request";
const API = {
// 获取任务列表
getTaskList: params => request('getTaskList', 'POST', params),
getGameInfo: params => request('getGameInfo', 'POST', params),
};
export default API;
.activity-dialog-wrap {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow: hidden;
background: url(../../resources/mask__e.png) center / cover no-repeat;
}
.activity-dialog-content {
position: absolute;
top: 310rpx;
left: 50%;
margin-left: -275rpx;
width: 550rpx;
/* overflow: hidden; */
transform: translateY(500rpx);
}
.activity-rule-info {
height: 560rpx;
padding: 120rpx 54rpx;
box-sizing: border-box;
font-size: 24rpx;
color: #fff;
background: url(../../resources/activity_rule.png) center / contain no-repeat;
}
.activity-rule-info_title {
font-size: 28rpx;
font-family: "SourceHanSansCN";
color: rgb(255, 255, 255);
font-weight: bold;
line-height: 1.6;
}
.activity-rule-info_tips {
font-size: 24rpx;
font-family: "SourceHanSansCN";
color: #b3b6d0;
font-weight: bold;
line-height: 1.6;
}
.activity-rule-know {
width: 376rpx;
height: 100rpx;
line-height: 80rpx;
font-size: 42rpx;
font-family: "Hiragino Sans GB";
color: rgb(255, 255, 255);
border: none;
background: url(../../resources/know.png) center / cover no-repeat;
position: absolute;
left: 50%;
bottom: -30rpx;
text-align: center;
margin-left: -182rpx;
padding-left: 30rpx;
}
.activity-rule-close {
position: absolute;
left: 50%;
bottom: -150rpx;
width:74rpx;
height: 71rpx;
}
\ No newline at end of file
<view class="activity-dialog-wrap" onTap="onClose">
<view class="activity-dialog-content" animation="{{animation}}" catchTap="() => {}">
<view class="activity-rule-info">
<view style="width:100%;height:150rpx;overflow:scroll">
<!-- <view class="activity-rule-info_title">标题标题标题标题标题标题标题标题标题标题</view>
<view class="activity-rule-info_tips">规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则规则</view>
<view class="activity-rule-info_title">标题标题标题标题标题标题标题标题标题标题</view> -->
<view class="activity-rule-info_tips">{{ruleInfo}}</view>
</view>
</view>
<view size="mini" class="activity-rule-know" onTap="onClose">我知道了</view>
<image class="activity-rule-close" src="../../resources/close.png" onTap="onClose" />
</view>
</view>
\ No newline at end of file
Component({
mixins: [],
data: {
animation:''
},
props: {
onClose: () => {},
taskDialogVisibile: false,
ruleInfo:''
},
didMount() {
this.animation = my.createAnimation({
duration: 300
})
this.animation.translateY('0rpx').step();
this.setData({ animation: this.animation.export() });
},
didUpdate() {},
didUnmount() {},
methods: {
onClose() {
this.animation.translateY('1000rpx').step();
this.setData({ animation: this.animation.export() });
setTimeout(function() {
this.props.onClose()
}.bind(this), 300);
}
},
});
{
"component": true
}
\ No newline at end of file
.prize-dialog-wrap {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow: hidden;
background: url(../../resources/mask__e.png) center / cover no-repeat;
}
.prize-dialog-content {
position: absolute;
top: 420rpx;
left: 0;
width: 100%;
height: 1000rpx;
overflow: hidden;
transform: translateY(1000rpx);
background: url(../../resources/my_prize.png) center / contain no-repeat;
}
.prize-list {
margin-top: 140rpx;
padding: 0 80rpx;
box-sizing: border-box;
}
.prize-item {
background: url(../../resources/task_item_bg.png) center /contain no-repeat ;
height: 120rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: space-around;
padding: 18rpx 20rpx;
box-sizing: border-box;
}
.prize-diamond-left {
display: flex;
flex: 1;
}
.prize-icon {
border-radius: 50%;
width: 86rpx;
height: 86rpx;
margin-right: 24rpx;
}
.prize-tips {
line-height: 44rpx;
font-size: 24rpx;
}
.prize-tips-diamond {
color:#10094e;
}
.prize-tips-exchange {
color: #954ff5;
}
.prize-exchange-common {
color: #fff;
width: 170rpx;
height: 60rpx;
text-align: center;
line-height: 60rpx;
border: none;
}
.prize-exchange {
background: url(../../resources/diamond_btn__m.png) center / contain no-repeat ;
}
.prize-exchange-disabled {
background: url(../../resources/disabled_btn__m.png) center / contain no-repeat ;
color: #6c8bb5;
}
.invite .prize-exchange,.order .prize-exchange {
background-image: url(../../resources/invite_order__m.png)
}
\ No newline at end of file
<view class="prize-dialog-wrap" onTap="onClose">
<view class="prize-dialog-content" animation="{{animation}}" catchTap="() => {}">
<view class="prize-list" >
<view a:for="{{prizeList}}">
<!---会员钻石换积分-->
<!-- <view a:if="{{item.taskType === 'exchangeCredits'}}" class="task-diamond task-item">
<view class="task-diamond-left">
<image class="task-icon" src="../../resources/diamond_icon__m.png"/>
<view class="task-tips">
<view class="task-tips-diamond">会员积分兑换钻石</view>
<view class="task-tips-exchange">50 积分得 {{item.diamond}} 钻石</view>
</view>
</view>
<view size="mini" class="task-exchange-common {{ item.status !== 2 ? 'task-exchange' : 'task-exchange-disabled' }}">{{ item.status !== 2 ? '兑换' : '明日再来' }}</view>
</view> -->
<!---每日浏览店铺-->
<!-- <view class="shop task-item" a:if="{{item.taskType === 'browseGoods'}}">
<view class="task-diamond-left">
<image class="task-icon" src="../../resources/shop_icon__m.png"/>
<view class="task-tips">
<view class="task-tips-diamond">每日浏览店铺10s</view>
<view class="task-tips-exchange">得 {{item.diamond}} 钻石</view>
</view>
</view>
<view size="mini" class="task-exchange-common {{ item.status !== 2 ? 'task-exchange' : 'task-exchange-disabled' }}">{{ item.status === 0 ? '去浏览' : (item.status === 1 ? '去领取' : '明日再来') }}</view>
</view> -->
<!---邀请1位好友加入会员-->
<!-- <view class="invite task-item" a:if="{{item.taskType === 'inviteFriends'}}">
<view class="task-diamond-left">
<image class="task-icon" src="../../resources/invite_icon__m.png"/>
<view class="task-tips">
<view class="task-tips-diamond">邀请1位好友加入会员</view>
<view class="task-tips-exchange">得 {{item.diamond}} 钻石</view>
</view>
</view>
<view size="mini" class="task-exchange-common {{ item.status !== 2 ? 'task-exchange' : 'task-exchange-disabled' }}">{{ item.status === 0 ? '去邀请' : (item.status === 1 ? '去领取' : '明日再来') }}</view>
</view> -->
<!---进行一笔订单消费-->
<!-- <view class="order task-item" a:if="{{item.taskType === 'orderGoods'}}">
<view class="task-diamond-left">
<image class="task-icon" src="../../resources/order_icon__m.png"/>
<view class="task-tips">
<view class="task-tips-diamond">进行一笔订单消费</view>
<view class="task-tips-exchange">得 {{item.diamond}} 钻石</view>
</view>
</view>
<view size="mini" class="task-exchange-common {{ item.status !== 2 ? 'task-exchange' : 'task-exchange-disabled' }}">{{ item.status === 0 ? '去下单' : (item.status === 1 ? '去领取' : '明日再来') }}</view>
</view> -->
</view>
</view>
</view>
</view>
\ No newline at end of file
Component({
mixins: [],
data: {
animation:''
},
props: {
onClose: () => {},
taskList: () => [],
},
didMount() {
this.animation = my.createAnimation({
duration: 300
})
this.animation.translateY('0rpx').step();
this.setData({ animation: this.animation.export() });
},
didUpdate() {},
didUnmount() {},
methods: {
onClose() {
this.animation.translateY('1000rpx').step();
this.setData({ animation: this.animation.export() });
setTimeout(function() {
this.props.onClose()
}.bind(this), 300);
}
}
});
{
"component": true
}
\ No newline at end of file
.task-dialog-wrap {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 999;
overflow: hidden;
background: url(//yun.dui88.com/mask__e.png) center / cover no-repeat;
}
.task-dialog-content {
position: absolute;
top: 420rpx;
left: 0;
width: 100%;
height: 1000rpx;
overflow: hidden;
transform: translateY(1000rpx);
background: url(//yun.dui88.com/task_bg.png) center / contain no-repeat;
}
.task-list {
margin-top: 140rpx;
padding: 0 80rpx;
box-sizing: border-box;
}
.task-item {
background: url(//yun.dui88.com/task_item_bg.png) center /contain no-repeat ;
height: 120rpx;
margin-bottom: 40rpx;
display: flex;
align-items: center;
justify-content: space-around;
padding: 18rpx 20rpx;
box-sizing: border-box;
}
.task-diamond-left {
display: flex;
flex: 1;
}
.task-icon {
border-radius: 50%;
width: 86rpx;
height: 86rpx;
margin-right: 24rpx;
}
.task-tips {
line-height: 44rpx;
font-size: 24rpx;
}
.task-tips-diamond {
color:#10094e;
}
.task-tips-exchange {
color: #954ff5;
}
.task-exchange-common {
color: #fff;
width: 170rpx;
height: 60rpx;
text-align: center;
line-height: 60rpx;
border: none;
}
.task-exchange {
background: url(//yun.dui88.com/diamond_btn__m.png) center / contain no-repeat ;
}
.task-exchange-disabled {
background: url(//yun.dui88.com/disabled_btn__m.png) center / contain no-repeat ;
color: #6c8bb5;
}
.invite .task-exchange,.order .task-exchange {
background-image: url(//yun.dui88.com/invite_order__m.png)
}
\ No newline at end of file
<view class="task-dialog-wrap" onTap="onClose">
<view class="task-dialog-content" animation="{{animation}}" catchTap="() => {}">
<view class="task-list" >
<view a:for="{{taskList}}">
<!---会员钻石换积分-->
<view a:if="{{item.taskType === 'exchangeCredits'}}" class="task-diamond task-item">
<view class="task-diamond-left">
<image class="task-icon" src="../../resources/diamond_icon__m.png"/>
<view class="task-tips">
<view class="task-tips-diamond">会员积分兑换钻石</view>
<view class="task-tips-exchange">50 积分得 {{item.diamond}} 钻石</view>
</view>
</view>
<view size="mini" class="task-exchange-common {{ item.status !== 2 ? 'task-exchange' : 'task-exchange-disabled' }}">{{ item.status !== 2 ? '兑换' : '明日再来' }}</view>
</view>
<!---每日浏览店铺-->
<view class="shop task-item" a:if="{{item.taskType === 'browseGoods'}}">
<view class="task-diamond-left">
<image class="task-icon" src="../../resources/shop_icon__m.png"/>
<view class="task-tips">
<view class="task-tips-diamond">每日浏览店铺10s</view>
<view class="task-tips-exchange">得 {{item.diamond}} 钻石</view>
</view>
</view>
<view size="mini" class="task-exchange-common {{ item.status !== 2 ? 'task-exchange' : 'task-exchange-disabled' }}">{{ item.status === 0 ? '去浏览' : (item.status === 1 ? '去领取' : '明日再来') }}</view>
</view>
<!---邀请1位好友加入会员-->
<view class="invite task-item" a:if="{{item.taskType === 'inviteFriends'}}">
<view class="task-diamond-left">
<image class="task-icon" src="../../resources/invite_icon__m.png"/>
<view class="task-tips">
<view class="task-tips-diamond">邀请1位好友加入会员</view>
<view class="task-tips-exchange">得 {{item.diamond}} 钻石</view>
</view>
</view>
<view size="mini" class="task-exchange-common {{ item.status !== 2 ? 'task-exchange' : 'task-exchange-disabled' }}">{{ item.status === 0 ? '去邀请' : (item.status === 1 ? '去领取' : '明日再来') }}</view>
</view>
<!---进行一笔订单消费-->
<view class="order task-item" a:if="{{item.taskType === 'orderGoods'}}">
<view class="task-diamond-left">
<image class="task-icon" src="../../resources/order_icon__m.png"/>
<view class="task-tips">
<view class="task-tips-diamond">进行一笔订单消费</view>
<view class="task-tips-exchange">得 {{item.diamond}} 钻石</view>
</view>
</view>
<view size="mini" class="task-exchange-common {{ item.status !== 2 ? 'task-exchange' : 'task-exchange-disabled' }}">{{ item.status === 0 ? '去下单' : (item.status === 1 ? '去领取' : '明日再来') }}</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
Component({
mixins: [],
data: {
animation:''
},
props: {
onClose: () => {},
taskList: () => [],
},
didMount() {
console.log('123didMount')
this.animation = my.createAnimation({
duration: 300
})
this.animation.translateY('0rpx').step();
this.setData({ animation: this.animation.export() });
},
didUpdate() {},
didUnmount() {},
methods: {
onClose() {
this.animation.translateY('1000rpx').step();
this.setData({ animation: this.animation.export() });
setTimeout(function() {
this.props.onClose()
}.bind(this), 300);
}
}
});
{
"component": true
}
\ No newline at end of file
export default {
// ams:ams接口,cloud: 云函数
requestType: "cloud",
// app环境
env: "test", // online 线上 test 测试
// 默认云函数名称
cloudFnName: 'cat',
// 小程序appId
appId: "3000000022428794",
// 配置应用appID, 权益插件用
bizCode: "3000000002693435",
};
No preview for this file type
......@@ -47,6 +47,10 @@
onTouchEnd="onMouseEvent"
onReady="onCanvasReady"
></canvas>
<task-dialog a:if="{{taskDialogVisibile}}" taskList="{{taskList}}" onClose="onTaskClose"></task-dialog>
<activity-dialog a:if="{{activityDialogVisibile}}" ruleInfo="{{ruleInfo}}" onClose="onActivityClose"></activity-dialog>
<prize-dialog a:if="{{prizeDialogVisibile}}" onClose="onPrizeClose"></prize-dialog>
<!-- <canvas
id="canva4stats"
type="webgl"
......
This diff is collapsed.
{}
\ No newline at end of file
{
"usingComponents": {
"task-dialog": "/components/task-dialog/task-dialog",
"prize-dialog": "/components/prize-dialog/prize-dialog",
"activity-dialog": "/components/activity-rule-dialog/activity-rule-dialog"
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
export function debounce(fn, wait) {
var timeout = null
return function () {
if (timeout !== null) clearTimeout(timeout)
timeout = setTimeout(fn, wait)
}
}
// 解决小数相加精度问题
export function addFloat(num1, num2) {
var r1, r2, m
r1 = num1.toString().split(".")[1] ? num1.toString().split(".")[1].length : 0
r2 = num2.toString().split(".")[1] ? num2.toString().split(".")[1].length : 0
m = Math.pow(10, Math.max(r1, r2))
return (num1 * m + num2 * m) / m
}
\ No newline at end of file
export * from './helper'
export * from './my-api';
export * from './validate';
\ No newline at end of file
// promise化 淘宝api
// 具体 api参数 -> https://miniapp.open.taobao.com/doc.htm?docId=117502&docType=1
export function chooseImage() {
return promisifyMyApi('chooseImage')
}
export function getImageInfo(params) {
return promisifyMyApi('getImageInfo', params)
};
// 剪切板
export function setClipboard(params) {
return promisifyMyApi('setClipboard', params)
};
function promisifyMyApi(methodName, params = {}) {
return new Promise((resolve, reject) => {
my[methodName]({
...params,
success: res => {
resolve(res)
},
fail: err => {
reject(err)
}
})
})
}
\ No newline at end of file
const {
cloud
} = getApp();
import { requestType, cloudFnName } from '../config';
const request = (url, method, params, ext = {}) => {
const {
isShowLoading
} = ext;
const hideMyLoading = () => {
if (isShowLoading) {
my.hideLoading();
}
};
if (isShowLoading) {
my.showLoading();
}
const requestAms = () => {
return my.request({
url: `https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=${cloudFnName}.${url}`,
method,
data: params,
dataType: 'json'
}).then(res => {
hideMyLoading();
return res.data;
}).catch(() => {
hideMyLoading();
});
}
const requestCloud = () => {
return cloud.function.invoke(cloudFnName, params, url).then(res => {
console.log(res);
hideMyLoading();
return res;
}).catch(() => {
hideMyLoading();
console.log('err');
});
}
return requestType === 'ams' ? requestAms() : requestCloud();
};
export default request;
\ No newline at end of file
// 正整数
export const validatePositiveInteger = number => /^[1-9]\d*$/.test(number);
// 整数
export const validateInteger = number => /^-?\d*$/.test(number);
// 判断是否为数字
export const isNumber = val => {
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
if(regPos.test(val) && regNeg.test(val)){
return true;
}else{
return false;
}
}
/**
*
* 验证一定范围内数,支持整数或小数
* @param {*} number
* @param {*} [ min, max ] 范围 [0,99] [-Infinity, 0] [999, Infinity]
* @param {number} [fixed=0] 小数位数 0时为整数
* @returns { boolean }
*/
export const validateRangeNumber = (number, [ min, max ] = [], fixed = 0) => {
const pattern = new RegExp(`^-?[0-9]+(\\.[0-9]{0,${fixed}})?$`);
if(min > max) {
console.error('数字范围的最小值不能大于最大值');
return;
}
if(!pattern.test(number) || number === '') return false;
if(number < min || number > max) return false;
return true;
}
// 配置验证
// 排名表格验证
export const rankTableValidator = (rule, value, callback, source, options) => {
if(!value.length) return new Error('请配置至少一项奖品配置');
// rank字段不存在或为0
if(value.some(v => !v.rank)) return new Error('名次配置错误, 请检查');
if(value.some(v => !v.name)) return new Error('名次配置错误, 请检查');
const rankArr = (value.map(v => v.rank.split('-')));
// 判断排名连续
let valid = true;
rankArr.forEach((rank, i) => {
if(i === 0) return;
let lastRank = rankArr[i-1][rankArr[i-1].length - 1];
let curRank = rank[0];
if(curRank - lastRank !== 1) {
valid = false;
}
})
if(!valid) return new Error('名次索引必须连续, 请检查');
return callback()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment