Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
home-with-kids-mp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
423786fb
authored
2020-01-17 01:58:01 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
默认提交
1 parent
92629e08
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
284 additions
and
119 deletions
src/app.js
src/app.scss
src/pages/blessing/blessing.js
src/pages/blessing/blessing.scss
src/pages/blessing/blessing.wxml
src/pages/index/index.scss
src/utils/util.js
src/app.js
View file @
423786f
//app.js
//
const ald = require('./utils/ald-stat.js')
const
ald
=
require
(
'./utils/ald-stat.js'
)
let
fetchApi
=
require
(
'./http/fetch-api.js'
);
let
api
=
require
(
'./http/api'
);
let
config
=
require
(
'./config'
);
let
router
=
require
(
'./router/index'
);
let
store
=
require
(
'./utils/stroage'
);
import
{
getUuid
}
from
'/utils/util'
;
require
(
'./http/mock-data'
);
App
({
...
...
@@ -44,6 +48,29 @@ App({
this
.
globalData
.
statusBarHeight
=
wx
.
getSystemInfoSync
().
statusBarHeight
;
this
.
globalData
.
barHeight
=
height
;
this
.
share
();
// let uuid = store.getItem("aldstat_uuid");
// console.log("uuid222:", uuid);
// store.setItem("uuid", uuid);
// console.log("uuid:", uuid);
// wx.aldstat.sendOpenid(uuid);
// 阿拉丁
// wx.login({
// success: function (res) {
// wx.request({
// url: "",
// data: {
// jscode: res.code
// },
// success: function (res) {
// //.....
// //调用上传OpenID
// wx.aldstat.sendOpenid(uuid);
// }
// })
// }
// })
},
globalData
:
{
share
:
false
,
...
...
src/app.scss
View file @
423786f
...
...
@@ -153,6 +153,23 @@ button {
}
}
@keyframes
ani-scal-key-2
{
0
%
{
transform
:
scale
(
1
);
}
25
%
{
transform
:
scale
(
1
.04
);
}
50
%
{
transform
:
scale
(
1
);
}
75
%
{
transform
:
scale
(
1
.04
);
}
}
// web font icon
...
...
src/pages/blessing/blessing.js
View file @
423786f
...
...
@@ -32,6 +32,7 @@ Page({
// type: 0, // 0单人 1组队
// 个人信息修改
updateUserInfoDialogVisible
:
false
,
joinRoomDialogVisibleUnAuth
:
false
,
updateUserInfo
:
{},
// 需要更新的用户数据
files
:
[],
// 上传文件列表
...
...
@@ -41,7 +42,7 @@ Page({
// 加入房间
joinRoomDialogVisible
:
false
,
//
joinRoomDialogVisibleUnAuth: false,
joinRoomDialogVisibleUnAuth
:
false
,
isJoin
:
false
,
// 是否能加入状态
joined
:
false
,
// 是否已加入
...
...
@@ -82,6 +83,11 @@ Page({
if
(
shareType
)
{
title
=
`
${
ownerMember
.
memberName
}
邀请您组队发祝福!体验今年最火爆的拜年方式`
}
else
{}
let
act
=
res
.
target
.
dataset
.
act
||
""
;
if
(
act
==
"made"
)
{
this
.
onShareBlessMakeHandler
();
}
}
else
{}
// 权重 参数memberCode(房主memberCode) => 本人memberCode
...
...
@@ -158,6 +164,11 @@ Page({
this
.
pauseBgm
();
},
onLoad
(
options
)
{
wx
.
login
({
success
(
res
)
{
app
.
store
.
setItem
(
'wxcode2'
,
res
.
code
);
}
});
let
date
=
new
Date
();
let
lunar
=
calendar
.
calendar
.
solar2lunar
(
date
.
getFullYear
(),
date
.
getMonth
()
+
1
,
date
.
getDate
());
...
...
@@ -205,23 +216,21 @@ Page({
})
if
(
detailData
.
customMade
==
1
&&
detailData
.
type
==
1
&&
ownerMember
.
mySelf
==
0
&&
options
.
t
==
"join"
&&
!
joined
)
{
this
.
setData
({
joinRoomDialogVisible
:
true
,
//
joinRoomDialogVisible: true,
isJoin
:
true
,
});
//
if (detailData.isAuth == 1) {
//
this.setData({
//
joinRoomDialogVisible: true,
//
})
//
} else {
//
this.setData({
//
joinRoomDialogVisibleUnAuth: true,
//
})
//
}
if
(
detailData
.
isAuth
==
1
)
{
this
.
setData
({
joinRoomDialogVisible
:
true
,
})
}
else
{
this
.
setData
({
joinRoomDialogVisibleUnAuth
:
true
,
})
}
}
});
console
.
log
(
"memberCode:"
,
app
.
store
.
getItem
(
"memberCode"
));
},
/**
...
...
@@ -280,11 +289,18 @@ Page({
},
showTips
(
evt
)
{
showTips
(
tips
)
{
wx
.
showToast
({
title
:
tips
+
""
,
icon
:
"none"
})
},
showTipsByWxml
(
evt
)
{
let
tips
=
getBindtapData
(
evt
);
wx
.
show
Modal
({
content
:
tips
,
success
(
res
)
{}
wx
.
show
Toast
({
title
:
tips
+
""
,
icon
:
"none"
})
},
...
...
@@ -421,10 +437,20 @@ Page({
this
.
onCreatePoster
(
posterData
);
});
}
else
{
wx
.
showModal
({
content
:
"请先定制祝福"
,
success
(
res
)
{}
})
// this.showTips("请先定制祝福")
app
.
post
({
url
:
app
.
api
.
blessMade
,
data
:
{
blessCode
:
detailData
.
blessCode
,
}
}).
then
((
result
)
=>
{
this
.
queryBlessDetail
().
then
((
result
)
=>
{
this
.
getWxCode
().
then
((
result
)
=>
{
let
posterData
=
this
.
getPosterConfig
();
this
.
onCreatePoster
(
posterData
);
});
});
}).
catch
((
err
)
=>
{});
}
},
...
...
@@ -621,12 +647,8 @@ Page({
})
});
}
else
{
wx
.
showModal
({
content
:
"请先定制祝福"
,
success
(
res
)
{}
})
this
.
showTips
(
"请先定制祝福"
);
}
},
// 房主名字
...
...
@@ -651,10 +673,7 @@ Page({
})
});
}
else
{
wx
.
showModal
({
content
:
"请先定制祝福"
,
success
(
res
)
{}
})
this
.
showTips
(
"请先定制祝福"
);
}
},
...
...
@@ -881,70 +900,79 @@ Page({
}
=
this
.
data
;
console
.
log
(
"isAuth:"
,
isAuth
);
if
(
isAuth
)
{
// 已授权
app
.
post
({
url
:
app
.
api
.
blessMade
,
data
:
{
blessCode
:
detailData
.
blessCode
,
}
}).
then
((
result
)
=>
{
this
.
queryBlessDetail
().
then
((
result
)
=>
{
wx
.
showModal
({
title
:
'定制祝福成功!'
,
content
:
'马上为亲朋好友送上祝福吧~'
,
success
(
res
)
{}
})
});
}).
catch
((
err
)
=>
{});
// 把房间变成自己
this
.
setData
({
isJoin
:
false
,
joined
:
false
,
"options.m"
:
app
.
store
.
getItem
(
"memberCode"
)
})
this
.
queryBlessDetail
().
then
((
result
)
=>
{
// 已授权
app
.
post
({
url
:
app
.
api
.
blessMade
,
data
:
{
blessCode
:
detailData
.
blessCode
,
}
}).
then
((
result
)
=>
{
this
.
queryBlessDetail
().
then
((
result
)
=>
{
this
.
showTips
(
"定制祝福成功!"
);
});
}).
catch
((
err
)
=>
{});
})
}
else
{
// 未授权
}
},
/**
* 未定制时但已授权时,戳起分享作为定制
*/
onShareBlessMakeHandler
()
{
let
{
detailData
,
isAuth
}
=
this
.
data
;
app
.
post
({
url
:
app
.
api
.
blessMade
,
data
:
{
blessCode
:
detailData
.
blessCode
,
}
}).
then
((
result
)
=>
{
this
.
queryBlessDetail
().
then
((
result
)
=>
{});
}).
catch
((
err
)
=>
{});
},
/**
* 加入房间
*/
onBlessJoinHandler
(
e
)
{
this
.
checkAuthShowComp
(
"join"
).
then
((
result
)
=>
{
let
{
options
,
detailData
}
=
this
.
data
;
app
.
post
({
url
:
app
.
api
.
blessJoin
,
data
:
{
ownerMemberCode
:
options
.
m
,
blessCode
:
detailData
.
blessCode
}
}).
then
((
result
)
=>
{
this
.
setData
({
isJoin
:
false
})
this
.
queryBlessDetail
().
then
((
result
)
=>
{
wx
.
showModal
({
showCancel
:
false
,
content
:
'加入成功'
,
success
(
res
)
{}
})
});
}).
catch
((
err
)
=>
{
// this.checkAuthShowComp("join").then((result) => {
let
{
options
,
detailData
}
=
this
.
data
;
app
.
post
({
url
:
app
.
api
.
blessJoin
,
data
:
{
ownerMemberCode
:
options
.
m
,
blessCode
:
detailData
.
blessCode
}
}).
then
((
result
)
=>
{
this
.
setData
({
isJoin
:
false
})
this
.
queryBlessDetail
().
then
((
result
)
=>
{
this
.
showTips
(
"加入成功"
);
});
}).
catch
((
err
)
=>
{
});
}).
catch
((
err
)
=>
{});
},
// 点击确认授权按钮
bindGetUserInfo
(
e
)
{
let
_this
=
this
;
wx
.
showLoading
();
wx
.
login
({
success
(
res
)
{
app
.
store
.
setItem
(
'wxcode'
,
res
.
code
);
_this
.
getUserInfo
(
e
.
detail
);
}
});
_this
.
getUserInfo
(
e
.
detail
);
},
// 授权操作
...
...
@@ -962,7 +990,7 @@ Page({
blessCode
:
detailData
.
blessCode
,
encryptedData
:
e
.
encryptedData
,
iv
:
e
.
iv
,
code
:
app
.
store
.
getItem
(
"wxcode"
),
code
:
app
.
store
.
getItem
(
"wxcode
2
"
),
tlMemberCode
:
app
.
globalData
.
tlMemberCode
}
}).
then
((
res2
)
=>
{
...
...
@@ -971,10 +999,7 @@ Page({
app
.
store
.
setItem
(
'sessionId'
,
res2
.
sessionId
);
app
.
store
.
setItem
(
'memberCode'
,
res2
.
memberCode
);
}
wx
.
showModal
({
content
:
'授权成功'
,
success
(
res
)
{}
})
this
.
showTips
(
"授权成功"
);
this
.
queryBlessDetail
().
then
((
result
)
=>
{
this
.
checkAuth
().
then
((
result
)
=>
{}).
catch
((
err
)
=>
{});
...
...
@@ -991,6 +1016,74 @@ Page({
}
},
// 授权后加入组队
getUserInfo2
(
evt
)
{
let
{
detailData
}
=
this
.
data
;
let
e
=
evt
.
detail
;
if
(
e
.
encryptedData
&&
e
.
iv
)
{
wx
.
showLoading
();
// 同意授权
app
.
post
({
url
:
app
.
api
.
register
,
sid
:
false
,
data
:
{
// blessCode: detailData.blessCode,
encryptedData
:
e
.
encryptedData
,
iv
:
e
.
iv
,
code
:
app
.
store
.
getItem
(
"wxcode2"
),
tlMemberCode
:
app
.
globalData
.
tlMemberCode
}
}).
then
((
res2
)
=>
{
wx
.
hideLoading
();
if
(
res2
&&
res2
.
sessionId
)
{
app
.
store
.
setItem
(
'sessionId'
,
res2
.
sessionId
);
app
.
store
.
setItem
(
'memberCode'
,
res2
.
memberCode
);
}
this
.
onBlessJoinHandler
();
}).
catch
((
err
)
=>
{
wx
.
hideLoading
();
})
}
else
{}
},
// 授权后定制祝福
getUserInfo3
(
evt
)
{
console
.
log
(
"getUserInfo3 33333"
);
let
{
detailData
}
=
this
.
data
;
let
e
=
evt
.
detail
;
if
(
e
.
encryptedData
&&
e
.
iv
)
{
wx
.
showLoading
();
// 同意授权
app
.
post
({
url
:
app
.
api
.
register
,
sid
:
false
,
data
:
{
// blessCode: detailData.blessCode,
encryptedData
:
e
.
encryptedData
,
iv
:
e
.
iv
,
code
:
app
.
store
.
getItem
(
"wxcode2"
),
tlMemberCode
:
app
.
globalData
.
tlMemberCode
}
}).
then
((
res2
)
=>
{
wx
.
hideLoading
();
if
(
res2
&&
res2
.
sessionId
)
{
app
.
store
.
setItem
(
'sessionId'
,
res2
.
sessionId
);
app
.
store
.
setItem
(
'memberCode'
,
res2
.
memberCode
);
}
console
.
log
(
"1111"
);
this
.
queryBlessDetail
().
then
((
result
)
=>
{
this
.
onBlessMakeHandler
();
});
}).
catch
((
err
)
=>
{
wx
.
hideLoading
();
})
}
else
{}
},
/**
* 隐藏蒙层
*/
...
...
src/pages/blessing/blessing.scss
View file @
423786f
...
...
@@ -437,6 +437,8 @@ $blessContentLabelWidth: 650px;
color
:
#940023
;
box-shadow
:
5
.9px
5
.5px
18px
0
rgba
(
26
,
36
,
91
,
0
.73
);
background-image
:
linear-gradient
(
to
top
,
#f4b44d
,
#e8b976
,
#ffebb5
);
animation
:
ani-scal-key-2
2s
infinite
;
}
}
}
...
...
src/pages/blessing/blessing.wxml
View file @
423786f
...
...
@@ -41,24 +41,8 @@
</view>
<!-- 邀请 房主或组队模式显示 -->
<view class="group-item" wx:if="{{options.t || ownerMember.mySelf == 1}}">
<block wx:if="{{isAuth}}">
<!-- 已授权 -->
<!-- 未定制 -->
<block wx:if="{{detailData.customMade == 0}}">
<button bindtap="showTips" data-data="请定制祝福后再邀请" class="group-item-inv">
<image class="icon-inv" mode="widthFix" src="../../image/icon/icon-inv.png" />
</button>
</block>
<!-- 已定制 -->
<block wx:else>
<button data-data="join" open-type="share" class="group-item-inv">
<image class="icon-inv" mode="widthFix" src="../../image/icon/icon-inv.png" />
</button>
</block>
</block>
<block wx:else>
<!-- 未授权 -->
<button open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo" class="group-item-inv">
<block wx:if="{{detailData.customMade == 1}}">
<button data-data="join" open-type="share" class="group-item-inv">
<image class="icon-inv" mode="widthFix" src="../../image/icon/icon-inv.png" />
</button>
</block>
...
...
@@ -127,8 +111,11 @@
<block wx:if="{{ownerMember.mySelf == 1}}">
<!-- 未定制 -->
<view wx:if="{{detailData.customMade == 0}}" class="btn-wrap">
<button bindtap="onPosterHandler" class="btn btn1">分享图片祝福</button>
<button wx:if="{{!isAuth}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo" class="btn btn2">
<button wx:if="{{!isAuth}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo" class="btn btn1">
分享图片祝福
</button>
<button wx:else bindtap="onPosterHandler" class="btn btn1">分享图片祝福</button>
<button wx:if="{{!isAuth}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo3" class="btn btn2">
定制我的祝福
</button>
<view wx:else bindtap="onBlessMakeHandler" class="btn btn2">定制我的祝福</view>
...
...
@@ -141,7 +128,10 @@
</block>
<block wx:else>
<view class="btn-wrap">
<view bindtap="onBlessMakeHandler" class="btn btn1">定制我的祝福</view>
<button wx:if="{{!isAuth}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo3" class="btn btn1">
定制我的祝福
</button>
<view wx:else bindtap="onBlessMakeHandler" class="btn btn1">定制我的祝福</view>
<button open-type="share" class="btn btn2">送祝福给亲友</button>
</view>
</block>
...
...
@@ -155,14 +145,22 @@
<button open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo" class="btn btn1">
邀亲友组团拜年
</button>
<button
open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo
" class="btn btn2">
<button
wx:if="{{!isAuth}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo3
" class="btn btn2">
定制我的祝福
</button>
<view wx:else bindtap="onBlessMakeHandler" class="btn btn2">定制我的祝福</view>
</block>
<!-- 已授权 -->
<block wx:else>
<button bindtap="showTips" data-data="请定制祝福后再邀请" class="btn btn1">邀亲友组团拜年</button>
<button bindtap="onBlessMakeHandler" class="btn btn2">定制我的祝福</button>
<!-- 11111 -->
<button data-data="join" data-act="made" open-type="share" class="btn btn1">
邀亲友组团拜年
</button>
<!-- <button bindtap="onBlessMakeHandler" class="btn btn2">定制我的祝福</button> -->
<button wx:if="{{!isAuth}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo3" class="btn btn2">
定制我的祝福
</button>
<view wx:else bindtap="onBlessMakeHandler" class="btn btn2">定制我的祝福</view>
</block>
</view>
<!-- 已经定制 -->
...
...
@@ -175,17 +173,29 @@
<block wx:else>
<!-- 能加入状态 -->
<block wx:if="{{isJoin}}">
<button bindtap="onBlessMakeHandler" class="btn btn1">定制我的祝福</button>
<button bindtap="onBlessJoinHandler" class="btn btn2">加入组队祝福</button>
<button wx:if="{{!isAuth}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo3" class="btn btn1">
定制我的祝福
</button>
<view wx:else bindtap="onBlessMakeHandler" class="btn btn1">定制我的祝福</view>
<button wx:if="{{!isAuth}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo2" class="btn btn2">
加入组队祝福
</button>
<button wx:else bindtap="onBlessJoinHandler" class="btn btn2">加入组队祝福</button>
</block>
<!-- 不能加入状态 -->
<block wx:else>
<!-- 自己房间 -->
<b
utton wx:if="{{ownerMember.mySelf == 1}}" data-data="join" open-type="share" class="btn btn1
">
邀亲友组团拜年
</b
utton
>
<b
lock wx:if="{{ownerMember.mySelf == 1}}
">
<button data-data="join" open-type="share" class="btn btn1">邀亲友组团拜年</button>
</b
lock
>
<!-- 非自己房间 -->
<button wx:else bindtap="onBlessMakeHandler" class="btn btn1">定制我的祝福</button>
<block wx:else>
<!-- <button bindtap="onBlessMakeHandler" class="btn btn1">定制我的祝福</button> -->
<button wx:if="{{!isAuth}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo3" class="btn btn1">
定制我的祝福
</button>
<view wx:else bindtap="onBlessMakeHandler" class="btn btn1">定制我的祝福</view>
</block>
<button open-type="share" class="btn btn2">送祝福给亲友</button>
</block>
</block>
...
...
@@ -235,7 +245,7 @@
<view class="t1">邀请你一起加入组队送祝福!</view>
</view>
</van-dialog>
<
!-- <van-dialog close-on-click-overlay use-slot confirm-button-text="点击加入" show="{{ joinRoomDialogVisibleUnAuth }}" confirm-button-open-type="getUserInfo" bind:getuserinfo="getUserInfo
">
<
van-dialog close-on-click-overlay use-slot confirm-button-text="点击加入" show="{{ joinRoomDialogVisibleUnAuth }}" confirm-button-open-type="getUserInfo" bind:getuserinfo="getUserInfo2
">
<view class="dialog dialog2">
<view class="portrait">
<image class="portrait-inner" mode="scaleToFill" src="{{ownerMember.memberHead}}" />
...
...
@@ -243,7 +253,7 @@
<view class="nickname">{{ownerMember.memberName}}</view>
<view class="t1">邀请你一起加入组队送祝福!</view>
</view>
</van-dialog>
-->
</van-dialog>
<van-popup class="poster-popup" show="{{ authorizeVisible }}">
<authorize-comp evttype="{{evttype}}" bind:evtcomp="evtcomp"></authorize-comp>
</van-popup>
...
...
src/pages/index/index.scss
View file @
423786f
...
...
@@ -98,7 +98,7 @@
// background-color: wheat;
font-size
:
40px
;
@include
ellipsis
(
2
);
color
:
#
fc464a
;
color
:
#
333333
;
// word-break : normal;
}
...
...
@@ -107,7 +107,7 @@
font-size
:
32px
;
bottom
:
12px
;
left
:
14px
;
color
:
#
333333
;
color
:
#
888888
;
@include
ellipsis
(
1
);
}
...
...
src/utils/util.js
View file @
423786f
...
...
@@ -247,6 +247,21 @@ function checkAuthUtils(name, url) {
});
}
//普通生成uuid
function
getUuid
()
{
var
s
=
[];
var
hexDigits
=
"0123456789abcdef"
;
for
(
var
i
=
0
;
i
<
36
;
i
++
)
{
s
[
i
]
=
hexDigits
.
substr
(
Math
.
floor
(
Math
.
random
()
*
0x10
),
1
);
}
s
[
14
]
=
"4"
;
// bits 12-15 of the time_hi_and_version field to 0010
s
[
19
]
=
hexDigits
.
substr
((
s
[
19
]
&
0x3
)
|
0x8
,
1
);
// bits 6-7 of the clock_seq_hi_and_reserved to 01
s
[
8
]
=
s
[
13
]
=
s
[
18
]
=
s
[
23
]
=
"-"
;
var
uuid
=
s
.
join
(
""
);
return
uuid
;
}
module
.
exports
=
{
formatTime
:
formatTime
,
checkMobile
:
checkMobile
,
...
...
@@ -260,5 +275,6 @@ module.exports = {
wxacodeGet
:
wxacodeGet
,
getObjByListKeyValue
:
getObjByListKeyValue
,
getQueryByUrl
:
getQueryByUrl
,
checkAuthUtils
:
checkAuthUtils
checkAuthUtils
:
checkAuthUtils
,
getUuid
:
getUuid
,
}
...
...
Please
register
or
sign in
to post a comment