Commit 2dddf70e authored by 汪欢's avatar 汪欢

dist

parent cc1c3876
<view class="you_xi_gui_ze">
<image class="cha_cha123" src={{resList['3ec90532-9a2c-4fc0-8ee1-ce8477937c3e'].url}} />
<image class="zu13974" src={{resList['67074958-8231-4f79-a860-454e3bfd8d04'].url}} />
<view class="gou_mai_ji_lu_kao_bei28">
<image class="ju_xing705_kao_bei31" src={{resList['dc93cdcd-b823-436f-a844-9c785b24bab5'].url}} />
<image class="yuan_jiao_ju_xing71730" src={{resList['d2226a56-df2a-4685-b008-c284a56f75ae'].url}} />
<label class="wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen">
文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案文案
</label>
<view class="zu1357">
<label class="you_xi_gui_ze29">游戏规则</label>
</view>
</view>
</view>
\ No newline at end of file
<image class="cha_cha123" onTap="onModalClose" src={{resList['3ec90532-9a2c-4fc0-8ee1-ce8477937c3e'].url}} />
<image class="zu13974" src={{resList['67074958-8231-4f79-a860-454e3bfd8d04'].url}} />
<view class="gou_mai_ji_lu_kao_bei28">
<image class="ju_xing705_kao_bei31" src={{resList['dc93cdcd-b823-436f-a844-9c785b24bab5'].url}} />
<image class="yuan_jiao_ju_xing71730" src={{resList['d2226a56-df2a-4685-b008-c284a56f75ae'].url}} />
<label class="wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen_an_wen">
<!-- 文案文案文案文案文案文案文案文案文案文 -->
<slot />
</label>
<view class="zu1357">
<label class="you_xi_gui_ze29">游戏规则</label>
</view>
</view>
</view>
\ No newline at end of file
......@@ -3,13 +3,20 @@
import resList from '../../resconfig/resList';
Component({
props: {},
data: {},
methods: {},
data: {
resList:resList
},
methods: {
onModalClose() {
const { onModalClose } = this.props;
onModalClose && onModalClose();
}
},
onInit(props) {
this.setData(this.data || {
resList: resList
});
// this.setData({
// resList: resList
// });
}
});
\ No newline at end of file
......@@ -6,6 +6,7 @@
display: block;
position: absolute;
}
.huo_dong_ye .bei_jing_tu2 {
width: 750rpx;
height: 1624rpx;
......@@ -16,6 +17,7 @@
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.huo_dong_ye .huo_dong_ye_zhu_ti {
width: 750rpx;
height: 1153rpx;
......@@ -26,6 +28,7 @@
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .tu2 {
width: 543rpx;
height: 494rpx;
......@@ -35,6 +38,7 @@
top: 14rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .an_niu2 {
width: 305rpx;
height: 80rpx;
......@@ -44,6 +48,7 @@
top: 663rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .dao_ji_shi87 {
width: 440rpx;
height: 86rpx;
......@@ -52,12 +57,14 @@
left: 156rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .dao_ji_shi87 .di22 {
width: 440rpx;
height: 86rpx;
opacity: 1;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .dao_ji_shi87 .tu_ceng2291 {
width: 35rpx;
height: 25rpx;
......@@ -68,6 +75,7 @@
font-size: 14.41518rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .dao_ji_shi87 .tu_ceng22_kao_bei90 {
width: 35rpx;
height: 25rpx;
......@@ -78,6 +86,7 @@
font-size: 14.41518rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .dao_ji_shi87 .tu_ceng2289 {
width: 35rpx;
height: 25rpx;
......@@ -88,6 +97,7 @@
font-size: 14.41518rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .dao_ji_shi87 .tu_ceng22_kao_bei388 {
width: 35rpx;
height: 25rpx;
......@@ -98,6 +108,7 @@
font-size: 14.41518rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 {
width: 750rpx;
height: 308rpx;
......@@ -106,12 +117,14 @@
top: 757rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu116 {
width: 750rpx;
height: 308rpx;
opacity: 1;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .ju_xing67 {
width: 374rpx;
height: 51rpx;
......@@ -120,6 +133,7 @@
top: 23rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .ji_fen_gai_lou_ying_qian_yuan_xin_pin_da_jiang {
width: 312rpx;
height: 25rpx;
......@@ -130,6 +144,7 @@
font-size: 16.17499rpx;
color: #f23f47;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 {
width: 680rpx;
height: 190rpx;
......@@ -138,18 +153,21 @@
top: 75rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 {
width: 680rpx;
height: 190rpx;
opacity: 1;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .ju_xing51_kao_bei2 {
width: 680rpx;
height: 136rpx;
opacity: 1;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .n20_lou_ceng86 {
width: 105rpx;
height: 20rpx;
......@@ -160,6 +178,18 @@
font-size: 13.68653rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .imgpos {
width: 125rpx;
height: 125rpx;
opacity: 1;
left: 0rpx;
top: 12rpx;
position: absolute;
font-size: 13.68653rpx;
background-color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .xxx_yuan_jiang_pin85 {
width: 98rpx;
height: 21rpx;
......@@ -170,6 +200,7 @@
font-size: 13.68653rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .n20_lou_ceng84 {
width: 105rpx;
height: 20rpx;
......@@ -180,6 +211,7 @@
font-size: 13.68653rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .xxx_yuan_jiang_pin83 {
width: 98rpx;
height: 21rpx;
......@@ -190,6 +222,7 @@
font-size: 13.68653rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .n20_lou_ceng82 {
width: 105rpx;
height: 20rpx;
......@@ -200,6 +233,7 @@
font-size: 13.68653rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .xxx_yuan_jiang_pin81 {
width: 98rpx;
height: 21rpx;
......@@ -210,6 +244,7 @@
font-size: 13.68653rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .n20_lou_ceng80 {
width: 105rpx;
height: 20rpx;
......@@ -220,6 +255,7 @@
font-size: 13.68653rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .jiang_pin78 .zu114 .zu128 .xxx_yuan_jiang_pin79 {
width: 98rpx;
height: 21rpx;
......@@ -230,6 +266,7 @@
font-size: 13.68653rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou {
width: 585rpx;
height: 69rpx;
......@@ -239,15 +276,58 @@
top: 571rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .wo_yao_gou_mai_ge_lou_ceng {
width: 585rpx;
/* width: 585rpx; */
width: 200rpx;
height: 44rpx;
opacity: 1;
top: 11rpx;
/* top: 11rpx; */
left: -10rpx;
position: absolute;
font-size: 28.61729rpx;
/* font-size: 28.61729rpx; */
font-size: 46rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .wo_yao_gou_mai_ge_lou_ceng1 {
/* width: 585rpx; */
width: 250rpx;
height: 44rpx;
opacity: 1;
/* top: 11rpx; */
left: 450rpx;
position: absolute;
/* font-size: 28.61729rpx; */
font-size: 46rpx;
color: #ffffff;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .addto {
width: 46rpx;
height: 42rpx;
opacity: 1;
display: block;
left: 182rpx;
top: 13rpx;
position: absolute;
transform-origin: 0px 0px 0px;
background-color: white;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .jian {
width: 46rpx;
height: 42rpx;
opacity: 1;
display: block;
left: 396rpx;
top: 13rpx;
position: absolute;
transform-origin: 0px 0px 0px;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .di3 {
width: 137rpx;
height: 69rpx;
......@@ -255,6 +335,7 @@
left: 244rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .di_kao_bei {
width: 46rpx;
height: 42rpx;
......@@ -263,6 +344,7 @@
top: 13rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .di_kao_bei2 {
width: 46rpx;
height: 42rpx;
......@@ -271,6 +353,8 @@
top: 13rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .tu_ceng77 {
width: 24rpx;
height: 25rpx;
......@@ -278,7 +362,8 @@
left: 193rpx;
top: 22rpx;
position: absolute;
}
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .tu_ceng76 {
width: 25rpx;
height: 7rpx;
......@@ -288,16 +373,18 @@
position: absolute;
background-color: #091636;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .mai_lou .xxx {
width: 86rpx;
height: 34rpx;
opacity: 1;
left: 270rpx;
top: 17rpx;
left: 290rpx;
top: 12rpx;
position: absolute;
font-size: 28.61729rpx;
color: #f23f47;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .dang_qian_zong_lou_ceng {
width: 120rpx;
height: 25rpx;
......@@ -310,6 +397,7 @@
color: #306faf;
display: block;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .xxxxxx {
width: 120rpx;
height: 24rpx;
......@@ -321,6 +409,7 @@
font-size: 31.96651rpx;
color: #e7210a;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .ji_fen {
width: 371rpx;
height: 52rpx;
......@@ -330,12 +419,14 @@
top: 492rpx;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .ji_fen .di111 {
width: 371rpx;
height: 52rpx;
opacity: 1;
position: absolute;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .ji_fen .gou_mai_ji_lu75 {
width: 107rpx;
height: 27rpx;
......@@ -346,6 +437,7 @@
font-size: 15.55287rpx;
color: #64a7e4;
}
.huo_dong_ye .huo_dong_ye_zhu_ti .ji_fen .dang_qian_ji_fenxxxx {
width: 172rpx;
height: 25rpx;
......@@ -355,4 +447,4 @@
position: absolute;
font-size: 16.17499rpx;
color: #5392cc;
}
}
\ No newline at end of file
......@@ -16,7 +16,7 @@
<label class="ji_fen_gai_lou_ying_qian_yuan_xin_pin_da_jiang">· 积分盖楼 赢千元新品大奖  ·</label>
<view class="zu114">
<view class="zu128">
<image class="ju_xing51_kao_bei2" src={{resList['d196657b-b657-4bdd-a966-6ca0e72c53e4'].url}} />
<!-- <image class="ju_xing51_kao_bei2" src={{resList['d196657b-b657-4bdd-a966-6ca0e72c53e4'].url}} /> -->
<label class="n20_lou_ceng86">n*20%楼层</label>
<label class="xxx_yuan_jiang_pin85">XXX元奖品</label>
<label class="n20_lou_ceng84">n*20%楼层</label>
......@@ -25,17 +25,28 @@
<label class="xxx_yuan_jiang_pin81">XXX元奖品</label>
<label class="n20_lou_ceng80">n*20%楼层</label>
<label class="xxx_yuan_jiang_pin79">XXX元奖品</label>
<!-- 遍历循环 -->
<view>
<view class="imgpos"></view>
<label></label>
<label></label>
</view>
</view>
</view>
</view>
<view class="mai_lou">
<label class="wo_yao_gou_mai_ge_lou_ceng">我要购买 个楼层</label>
<image class="di3" src={{resList['b0666d8c-2ba9-4e42-b6db-dc0f54f67db8'].url}} />
<image class="di_kao_bei" src={{resList['93ee38f2-3f0a-4550-93e4-e50a5e1e29cb'].url}} />
<image class="di_kao_bei2" src={{resList['93ee38f2-3f0a-4550-93e4-e50a5e1e29cb'].url}} />
<label class="wo_yao_gou_mai_ge_lou_ceng">我要购买</label>
<image class="jian" onTap="reduceFloor" src={{resList['3538abe5-6195-4ddb-867c-732e10059f3d'].url}} />
<!-- <image class="addto" src={{resList['c77af861-3466-4db9-8dbd-ca7ff9f2a558'].url}}/> -->
<image class="di3" src={{resList['b0666d8c-2ba9-4e42-b6db-dc0f54f67db8'].url}} />
<image class="di_kao_bei" onTap="addFloor" src={{resList['93ee38f2-3f0a-4550-93e4-e50a5e1e29cb'].url}} />
<!-- <image class="di_kao_bei2" src={{resList['93ee38f2-3f0a-4550-93e4-e50a5e1e29cb'].url}} /> -->
<image class="tu_ceng77" src={{resList['c064c8f7-ddd6-4db9-81be-7077d99f7053'].url}} />
<view class="tu_ceng76" />
<label class="xxx">XXX</label>
<label class="xxx">{{canBuyFloor}}</label>
<label class="wo_yao_gou_mai_ge_lou_ceng1">个楼层</label>
</view>
<label class="dang_qian_zong_lou_ceng">当前总楼层</label>
<label class="xxxxxx">XXXXXX</label>
......
......@@ -3,12 +3,33 @@
import resList from '../../resconfig/resList'; //import API from '../../api';
Page({
data: {},
data: {
canBuyFloor:10
},
onLoad(props) {
this.setData({
resList: resList
});
}
},
// 减楼层
reduceFloor(){
let {canBuyFloor} = this.data
if(canBuyFloor > 1){
this.setData({
canBuyFloor:canBuyFloor - 1
})
}
},
// 加楼层
addFloor(){
let {canBuyFloor} = this.data;
if(canBuyFloor < 100){
this.setData({
canBuyFloor:canBuyFloor + 1
})
}
},
});
\ No newline at end of file
......@@ -9,6 +9,19 @@ Page({
this.setData({
resList: resList
});
},
getEndTime(prizeList = []) {
if (!prizeList || !prizeList.length) return null
const endTime = prizeList[0].expiredTime
if (!endTime) return null
const t1 = new Date(endTime).toLocaleDateString() + '';//获取年月日
const t2 = new Date(endTime).getHours() + '';//获取时
const t3 = new Date(endTime).getMinutes() + '';//获取分
const t4 = new Date(endTime).getMilliseconds() + '';//获取秒
console.log(endTime, new Date(endTime + 48 * 60 * 60 * 1000).toLocaleString(), 'endTime');
this.setData({
endTime: t1 + " " + t2.padStart(2, '0') + ":" + t3.padStart(2, '0') + ":" + t4.padStart(2, '0')
})
}
});
\ No newline at end of file
<view class="shou_ye">
<image class="bei_jing_tu" src={{resList['a96b0452-f0f1-4ef8-b225-cfca9b511bd4'].url}} />
<image class="logo" src={{resList['76d8e1fd-36f4-4c66-af33-58ceaa885b1e'].url}} />
<image class="jiang_pin" src={{resList['da365587-7a12-4272-b05e-e042e2e6430e'].url}} />
<image class="gui_ze" src={{resList['0c977f31-f5f8-4b5a-9cc8-cdaf00f0e64c'].url}} />
<view class="zhu_ti">
<image class="tu" src={{resList['8c476736-ed81-4e91-bcb4-6b2ac884d48d'].url}} />
<image class="an_niu" onTap="handleStart" src={{resList['84e9b0a1-0e07-4324-9073-40d28008ce1f'].url}} />
<image class="wen_an" src={{resList['7622c471-422b-4f1e-8897-785c4d91aeff'].url}} />
</view>
</view>
\ No newline at end of file
<image class="bei_jing_tu" src={{resList['a96b0452-f0f1-4ef8-b225-cfca9b511bd4'].url}} />
<image class="logo" src={{resList['76d8e1fd-36f4-4c66-af33-58ceaa885b1e'].url}} />
<!-- <navigator open-type="navigate" url="/pages/myprize/myprize" class="jiang_pin">我的奖品</navigator> -->
<image class="jiang_pin" onTap="" src={{resList['da365587-7a12-4272-b05e-e042e2e6430e'].url}} />
<image class="gui_ze" onTap="showRuleModal" src={{resList['0c977f31-f5f8-4b5a-9cc8-cdaf00f0e64c'].url}} />
<view class="zhu_ti">
<image class="tu" src={{resList['8c476736-ed81-4e91-bcb4-6b2ac884d48d'].url}} />
<image class="an_niu" onTap="handleStart" src={{resList['84e9b0a1-0e07-4324-9073-40d28008ce1f'].url}} />
<image class="wen_an" src={{resList['7622c471-422b-4f1e-8897-785c4d91aeff'].url}} />
</view>
</view>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>案文文案文案文案文案文案文案文案文案文案文案</text></rule-modal>
\ No newline at end of file
......@@ -3,7 +3,9 @@
import resList from '../../resconfig/resList'; //import API from '../../api';
Page({
data: {},
data: {
ruleModalVisible:false
},
onLoad(props) {
this.setData({
......@@ -16,6 +18,17 @@ Page({
my.redirectTo({
url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye'
});
},
showRuleModal(){
this.setData({
ruleModalVisible:true
})
},
ruleModalClose(){
this.setData({
ruleModalVisible:false
})
}
});
\ No newline at end of file
{
"usingComponents": {}
"usingComponents": {
"rule-modal": "/components/comyou_xi_gui_ze/comyou_xi_gui_ze"
}
}
\ No newline at end of file
......@@ -95,6 +95,20 @@ const resList = {
uuid: 'c064c8f7-ddd6-4db9-81be-7077d99f7053',
url: '//yun.duiba.com.cn/spark-dev/assets/bd27530a5427e15b885c626d47ea94d4476be635.png',
},
'c77af861-3466-4db9-8dbd-ca7ff9f2a558': {
name: 'add',
ext: '.png',
url: '//yun.duiba.com.cn/spark-dev/assets/add.369c8598a4a097cb9401cbdcc16ae116662d8cfd.png',
uuid: 'c77af861-3466-4db9-8dbd-ca7ff9f2a558'
},
'3538abe5-6195-4ddb-867c-732e10059f3d': {
name: '减按钮',
ext: '.png',
url: '//yun.duiba.com.cn/spark-dev/assets/jian.2cf232e30af36c08a39f55732e96add39c26a86d.png',
uuid: '3538abe5-6195-4ddb-867c-732e10059f3d'
},
'789df59d-2616-41e0-8111-d8009dfd0aaf': {
name: '底111',
ext: '.png',
......
/**
* 通用toast
* @param {string} content toast内容
* @param {number} duration 时长
*/
export const commonToast = (content, duration = 3000) => {
my.showToast({
content:content || '请稍后再试~',
content: content || '换个姿势再试一次~',
duration
});
}
/**
* 跳转到内部链接(新开窗口)
* @param {string} url 跳转链接
*/
export const navigateTo = url => my.navigateTo({ url });
};
/**
* 跳转到内部链接(不新开窗口)
* @param {string} url 跳转链接
*/
export const redirectTo = url => my.redirectTo({ url });
export const getAuthUserInfo = () => {
return new Promise((resolve, reject) => {
my.authorize({
scopes: 'scope.userInfo',
success: res => {
my.getAuthUserInfo({
success: userInfo => { resolve(userInfo); }
});
},
fail: err => {
reject(err);
}
});
});
};
/**
* 时间格式化
* @param date 接收可以被new Date()方法转换的内容
* @param format 字符串,需要的格式例如:'yyyy-MM-dd hh:mm:ss'
* @returns {String}
* 获取系统信息
* @returns {object} 小程序系统信息
*/
export const dateFormatter = (date, format = 'yyyy-MM-dd') => {
if (!date) return '-';
export const getSystemInfo = () => {
return new Promise((resolve, reject) => {
my.getSystemInfo({
success: res => { resolve(res); },
fail: err => { reject(err); }
});
});
};
date = new Date(typeof date === 'string' && isNaN(date) ? date.replace(/-/g, '/') : date);
let o = {
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds(),
'q+': Math.floor((date.getMonth() + 3) / 3),
'S': date.getMilliseconds()
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
}
for (let k in o) {
if (new RegExp('(' + k + ')').test(format)) {
format = format.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)));
}
}
return format;
};
\ No newline at end of file
This diff is collapsed.
{
"_args": [
[
"@tbmp/mp-cloud-sdk@1.3.4",
"d:\\develop\\nodejs\\sparkProject\\filaFloor\\project\\hello_taobao\\taobao1"
]
],
"_from": "@tbmp/mp-cloud-sdk@1.3.4",
"_id": "@tbmp/mp-cloud-sdk@1.3.4",
"_inBundle": false,
"_integrity": "sha1-+1HCYryYfVc0kze0SOWv1oL6xgk=",
"_location": "/@tbmp/mp-cloud-sdk",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@tbmp/mp-cloud-sdk@1.3.4",
"name": "@tbmp/mp-cloud-sdk",
"escapedName": "@tbmp%2fmp-cloud-sdk",
"scope": "@tbmp",
"rawSpec": "1.3.4",
"saveSpec": null,
"fetchSpec": "1.3.4"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npm.taobao.org/@tbmp/mp-cloud-sdk/download/@tbmp/mp-cloud-sdk-1.3.4.tgz",
"_spec": "1.3.4",
"_where": "d:\\develop\\nodejs\\sparkProject\\filaFloor\\project\\hello_taobao\\taobao1",
"author": "",
"description": "",
"gitHead": "1dff694baa0d0714e10794820a1df4806c19eebb",
"license": "ISC",
"main": "index.js",
"name": "@tbmp/mp-cloud-sdk",
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"types": "./types/platforms/mp/index.d.ts",
"version": "1.3.4"
}
import { Db } from "./db";
export interface IFindOptions {
/**
* 查询的文档数量限制
*/
limit?: number;
/**
* 跳过的文档数量
*/
skip?: number;
/**
* 排序规则
*/
sort?: object;
/**
* 查询后过滤的字段
*/
projection?: object;
}
export declare class CollectionReference {
/**
* 初始化
*
* @internal
*
* @param db - 数据库的引用
* @param coll - 集合名称
*/
private _db;
private _coll;
constructor(db: Db, coll: string);
/**
* 读取集合名字
*/
readonly name: string;
/**
* 对集合执行聚合查询
* @param pipeline 聚合查询对象
*/
aggregate(pipeline: object | object[]): Promise<any>;
/**
* 获取集合中复合条件的记录数量
* @param filter 过滤条件
*/
count(filter: object): Promise<any>;
/**
* 删除集合中的一批记录
* @param filter 过滤条件
*/
deleteMany(filter: object): Promise<any>;
/**
* 查找集合中符合条件的所有记录
* @param filter 过滤条件
* @param options 查询配置项
*/
find(filter: any, options?: IFindOptions): Promise<any>;
/**
* 替换一条数据
* @param filter 过滤条件
* @param data 新数据
*/
replaceOne(filter: object, data: object): Promise<any>;
/**
* 在集合中添加一条记录
* @param data 带插入的数据
*/
insertOne(data: object): Promise<any>;
/**
* 在集合中添加一批记录
* @param data 待插入的数据,只能为数组
*/
insertMany(data: object[]): Promise<any>;
/**
*
* @param filter 过滤条件
* @param data 更新规则
*
*/
updateMany(filter: object, data: object): Promise<any>;
}
import { CollectionReference } from "./collection";
import { IAsyncInvokeOptions } from "../../shared/types";
import { ICloudService } from "../interface/cloudService";
export declare class Db extends ICloudService {
/**
* 获取集合的引用
*
* @param collName - 集合名称
*/
collection(collName: string): CollectionReference;
/**
* 创建集合
*/
createCollection(name: string, options: {
collName: string;
} & IAsyncInvokeOptions): Promise<any>;
dbRequest(action?: string, params?: any): Promise<any>;
}
import { Db } from "./db";
export default Db;
import { IAsyncInvokeOptions } from '../../shared/types';
import { ICloudService } from '../interface/cloudService';
export interface ICallFunctionOptions extends IAsyncInvokeOptions {
name: string;
data: any;
}
export interface IInvokeMethod {
(IAsyncInvokeOptions: any): void;
}
export default class CloudFunction extends ICloudService {
invoke(name: string, data?: object, handler?: string): Promise<any>;
private fcRequest;
}
import { Request } from "../../shared/request";
export interface ICloudServiceOptions {
env?: 'test' | 'online' | 'pre';
}
export declare abstract class ICloudService {
options: ICloudServiceOptions;
request: Request;
constructor(options: ICloudServiceOptions, request: Request);
init?(): void;
}
import Powermsg from '@ali/lib-powermsg-sdk';
import { Env } from '../../shared/types';
export default class Client {
env: Env;
pmg: Powermsg;
deviceId: string;
initing: boolean;
queue: (() => void)[];
config: any;
constructor(env: Env);
init: () => Promise<any>;
onMessage: (callback: any) => Promise<() => void>;
private createPwgInstance;
}
import { ICloudService, ICloudServiceOptions } from "../interface/cloudService";
import Client from './client';
import Server from './server';
export default class Message extends ICloudService {
server: Server;
client: Client;
constructor(options: ICloudServiceOptions);
}
import { Request } from '../../shared/request';
import { Env } from "../../../packages/mp-cloud-node-sdk/types/shared/types";
interface IPushOptions {
subType: number;
deviceId?: string;
data: object;
pushType: string;
}
export default class Server {
env: Env;
request: Request;
constructor(env: Env, request: Request);
push(options: IPushOptions): Promise<any>;
}
export {};
import {ICloudService} from "../../interface/cloudService";
export default class Process extends ICloudService {
invoke(options: { api: string, data?: any, headers?: any }): Promise<any>;
private topRequest;
}
import {ICloudService} from "../../interface/cloudService";
export default class Qimen extends ICloudService {
invoke(options: { api: string, data?: any, targetAppKey?: any, headers?: any }): Promise<any>;
private topRequest;
}
import {ICloudService} from "../../interface/cloudService";
export default class Top extends ICloudService {
invoke(options: { api: string, data?: any, headers?: any, authScope?: string }): Promise<any>;
private topRequest;
}
import { IRequestOptions } from "../../../shared/request";
export default class Top {
client: any;
context: IRequestOptions;
constructor(context: IRequestOptions);
invoke(apiName: string, data?: any, httpHeaders?: any): Promise<any>;
}
import { IAsyncInvokeOptions } from "../../shared/types";
import { ICloudService } from "../interface/cloudService";
export interface IUploadFileOptions extends IAsyncInvokeOptions {
/**
* 选择到的本地文件路径
*/
filePath: string;
/**
* 文件类型, image/audio/video
*/
fileType: FileTypes;
/**
* 云存储文件名可带路径, 如a/xxx.jpg
*/
fileName?: string;
/**
* web环境上传 file对象
*/
file?: any;
}
export interface IDownloadFileOptions extends IAsyncInvokeOptions {
fileType?: FileTypes;
fileId: string;
}
export interface ITempFileURLOptions extends IAsyncInvokeOptions {
fileList: string[];
}
export declare type IDeleteFileOptions = IDownloadFileOptions;
export declare type FileTypes = "image" | "video" | "audio";
export default class CloudStorage extends ICloudService {
private parseUploadResult;
private parsePostUploadResult;
private parseAusUploadResult;
/**
* 文件上传
* 1.获取上传配置
* 2.调用my.api上传
* 3.建立存储关系
* @param options
*/
uploadFile(options: IUploadFileOptions): Promise<any>;
/**
* 删除文件
* @param options
*/
deleteFile(options: IDeleteFileOptions): Promise<boolean>;
/**
* 根据文件id(cloud://)获取授权的url
* @param options
*/
getTempFileURL(options: IAsyncInvokeOptions & {
fileType: string;
fileId: string | string[];
}): Promise<any>;
/**
* 从服务端获取文件并在本地读取
* @param options
*/
readRemoteFile(options: IAsyncInvokeOptions & {
url: string;
}): Promise<ArrayBuffer>;
/**
* 存储的请求代理, 统一sdk环境和存储环境
* @param action
* @param data
* @param requestType
*/
private storageRequest;
}
import { Cloud } from '../mp';
declare const cloudInstance: Cloud;
export default cloudInstance;
import { Cloud as MpCloud } from '../mp';
import { ICloudOptions } from '../../shared/types';
import Client from '../../core/message/client';
import { IProxy } from '../../shared/request';
export declare class Cloud extends MpCloud {
message: {
client: Client;
};
init(options: ICloudOptions, proxy: IProxy): Promise<boolean>;
}
declare const _default: Cloud;
export default _default;
import {IProxy} from '../../shared/request';
import {ICloudOptions} from '../../shared/types';
import CloudFunction from '../../core/functions';
import CloudStorage from '../../core/storage';
import Db from '../../core/db';
import Top from '../../core/openApi/client/top';
import Qimen from '../../core/openApi/client/qimen';
import Process from '../../core/openApi/client/process';
export declare class Cloud {
function: CloudFunction;
file: CloudStorage;
db: Db;
topApi: Top;
qimenApi: Qimen;
processApi: Process;
init(options: ICloudOptions, proxy?: IProxy): Promise<boolean>;
}
declare const _default: Cloud;
export default _default;
import { IProxy, IRequestOptions } from '../../shared/request';
import { ICloudOptions } from '../../shared/types';
import CloudFunction from '../../core/functions';
import Database from '../../core/db';
import Server from '../../core/message/server';
import Top from '../../core/openApi/server/top';
export declare class Cloud {
private _options;
db: Database;
function: CloudFunction;
message: {
server: Server;
};
private request;
topApi: Top;
setEnv(env: any): void;
init(options: ICloudOptions & IRequestOptions, proxy: IProxy): void;
}
export declare function cloud(context: any, options: ICloudOptions): Cloud;
export declare const BASE_APIS: {
GET_SESSION: string;
GET_SECRET: string;
};
export declare const STORAGE_KEYS: {
SECRET: string;
};
export declare const ENV_CONFIG: {
pre: {
gw: string;
};
online: {
gw: string;
};
};
import { IAsyncInvokeOptions } from "./types";
export declare function invokeCallback(options: IAsyncInvokeOptions, asyncTask: Promise<any>): Promise<void>;
export declare function myApiPromisify(method: (options: any) => void, options?: any): Promise<any>;
export declare function getUserId(): Promise<string>;
export declare function noop(): void;
export declare function invokeTaskCallback(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
export declare function safeAccess(props: any, keys: string[] | string, def?: any): any;
export declare function getValue(key: string): Promise<any>;
export declare function setValue(key: string, data: any): Promise<any>;
export interface IRequestOptions {
appKey?: string,
sourceAppKey?: string,
requestAppKey?:string,
miniappId?: string,
sourceMiniAppId?: string,
appOwnerOpenId?: string,
signSecret?: string;
sessionKey?: string;
requestId?: string;
cloudId?: string;
openId?: string;
unionId?: string;
userNick?: string,
mixNick?: string,
session?: string;
accessToken?: string;
env?: string;
}
export declare enum RequestTypes {
MTOP = 1,
MY = 2,
GATEWAY = 3
}
export interface IGatewayResponse {
error_response: {
code: string;
};
}
export interface IRequestDetail {
url: string;
data?: any;
rawData?: any;
method?: string;
headers?: any;
dataType?: string;
v?: string;
__is_retry_task__?: boolean;
env?: string;
mtopOptions?: any;
}
export interface IProxyOptions {
gatewayUrl?: string;
dataProxyGatewayUrl?: string;
}
export declare abstract class IProxy {
options: IProxyOptions;
abstract apply(task: IRequestDetail, requestType?: RequestTypes): Promise<any>;
constructor(options?: IProxyOptions);
}
export declare class Request {
networkType?: string;
options: IRequestOptions;
tasks: {
detail: IRequestDetail;
success?: (res: any) => void;
fail?: (res: any) => void;
}[];
proxy: IProxy;
inited: boolean;
pauseExecTask: boolean;
init(options: IRequestOptions, proxy: IProxy): Promise<void>;
listenNetworkChange(): Promise<void>;
static getRequestType(url: string): RequestTypes;
/**
* 验证响应结果, 特定情况下重试请求
* @param res
*/
private verifyResponse;
private tryThrowError;
private sendGatewayRequest;
flushGatewayRequestQueue(reject?: boolean): void;
exec(detail: IRequestDetail, requestType?: RequestTypes): Promise<any>;
/**
*
* @param url 网关请求
* @param method 请求方法
* @param queryString
* @param headers mc_开头的http header
* @param content json body
*/
private getHttpRequestSign;
/**
* 对网关请求签名
* @param detail
*/
private createGatewayRequest;
}
export declare const request: Request;
export interface ICallback {
(res: any): void;
}
export interface IHttpRequestOptions extends IAsyncInvokeOptions {
url: string;
method?: string;
headers?: any;
data?: any;
dataType?: string;
}
export declare type Env = 'test' | 'pre' | 'online';
export declare type Envs = {
database: Env;
file: Env;
function: Env;
message: Env;
};
export interface ICloudOptions {
env?: Env | Envs;
appKey?: string;
}
declare global {
interface Window {
}
var my: {
httpRequest: (options: IHttpRequestOptions) => void;
sendMtop: (options: any) => void;
alert: (options: {
title?: string;
content?: string;
}) => void;
};
var NODE_PLATFORM: boolean;
var SDK_VERSION: string;
}
export interface IAsyncInvokeOptions {
success?: ICallback;
fail?: ICallback;
complete?: ICallback;
}
export declare type AsyncInvokeResult = Promise<any> | void;
export declare type Constructor<T = {}> = new (...args: any[]) => T;
import { IAsyncInvokeOptions, Env, Envs } from "./types";
export declare function noop(): void;
export declare function invokeTaskCallback(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
export declare function safeAccess(props: any, keys: string[] | string, def?: any): any;
export declare function invokeCallback(options: IAsyncInvokeOptions, asyncTask: Promise<any>): Promise<void>;
export declare function myApiPromisify(method: (options: any) => void, options?: any): Promise<any>;
export declare function getUserId(): Promise<string>;
export declare function getEnvs(env: Env | Envs): Envs;
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