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
2d4931fc
authored
2020-01-07 20:58:10 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
默认提交
1 parent
c23b19a3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
127 additions
and
20 deletions
package-lock.json
package.json
src/app.json
src/http/api.js
src/http/fetch-api.js
src/pages/blessing/blessing.js
src/pages/blessing/blessing.wxml
src/pages/index/index.js
src/pages/index/index.scss
src/pages/index/index.wxml
package-lock.json
View file @
2d4931f
This diff is collapsed.
Click to expand it.
package.json
View file @
2d4931f
...
...
@@ -48,5 +48,8 @@
"postcss-lazysprite"
:
"^2.0.0"
,
"postcss-px2rpx"
:
"0.0.4"
,
"yargs"
:
"^13.1.0"
},
"dependencies"
:
{
"@vant/weapp"
:
"^1.0.2"
}
}
...
...
src/app.json
View file @
2d4931f
...
...
@@ -22,6 +22,7 @@
"empty-tips"
:
"../../component/empty-tips/empty-tips"
,
"shortcut"
:
"../../component/shortcut/shortcut"
,
"van-popup"
:
"../../ui/vant-weapp/popup/index"
,
"van-dialog"
:
"../../ui/vant-weapp/dialog/index"
,
"van-sticky"
:
"../../ui/vant-weapp/sticky/index"
,
"van-tab"
:
"../../ui/vant-weapp/tab/index"
,
"van-tabs"
:
"../../ui/vant-weapp/tabs/index"
...
...
src/http/api.js
View file @
2d4931f
...
...
@@ -15,6 +15,8 @@ module.exports = {
wxPay
:
'/wx/pay'
,
// 帐号详情
stat
:
'/dot'
,
// 打点
blessDetail
:
"/bless/detail"
,
//
/**
* 通用接口
* 请求时 "mode"传"custom"
...
...
src/http/fetch-api.js
View file @
2d4931f
...
...
@@ -3,7 +3,10 @@ let Store = require('./../utils/stroage');
let
Router
=
require
(
'./../router/index'
);
const
errMsg
=
'服务异常,请稍后重试'
;
// let isWxLogin = false;
/**
* 1.业务接口返回404时,会自动调用自定义login接口重拉sessionId,成功后会重新调用该业务接口
* 2.当自定义login接口返回状态码不为200时,弹出授权登陆
*/
function
wxLogin
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -58,6 +61,7 @@ function login() {
}
=
res2
.
data
;
if
(
code
==
200
&&
content
.
sessionId
)
{
Store
.
setItem
(
'sessionId'
,
content
.
sessionId
);
Store
.
setItem
(
'memberCode'
,
content
.
memberCode
);
resolve
();
}
else
{
wx
.
hideLoading
();
...
...
@@ -128,9 +132,6 @@ const fetch = function ({
if
(
res
.
code
==
404
)
{
//登陆失效的回调
Store
.
clear
(
"sessionId"
);
// wx.reLaunch({
// url: '/pages/index/index'
// })
// 404后拉取登陆后再做一次
login
().
then
((
resultLogin
)
=>
{
wx
.
request
({
...
...
src/pages/blessing/blessing.js
View file @
2d4931f
...
...
@@ -2,6 +2,9 @@ import {
getBindtapData
}
from
'../../utils/util'
;
import
Dialog
from
'../../ui/vant-weapp/dialog/dialog'
;
let
app
=
getApp
();
Page
({
data
:
{
...
...
@@ -12,6 +15,10 @@ Page({
productList
:
[],
// 产品列表
indexInfo
:
{},
userInfo
:
{},
show
:
true
,
detailData
:
{},
memberList
:
[],
options
:
{}
},
onShareAppMessage
()
{},
showAuth
()
{
...
...
@@ -19,7 +26,25 @@ Page({
authorizeVisible
:
true
})
},
onLoad
(
options
)
{},
onLoad
(
options
)
{
this
.
setData
({
options
});
this
.
queryBlessDetail
();
this
.
initData
();
// Dialog.confirm({
// title: '标题',
// message: '弹窗内容',
// asyncClose: true
// }).then(() => {
// setTimeout(() => {
// Dialog.close();
// }, 1000);
// })
// .catch(() => {
// Dialog.close();
// });
},
/**
* 基础方法
...
...
@@ -33,12 +58,12 @@ Page({
* 做加载更多操作
*/
onReachBottom
()
{
if
(
this
.
data
.
dataList
.
length
<
this
.
data
.
total
)
{
this
.
setData
({
page
:
this
.
data
.
page
+
1
});
this
.
queryDataList
();
}
//
if (this.data.dataList.length < this.data.total) {
//
this.setData({
//
page: this.data.page + 1
//
});
//
this.queryDataList();
//
}
},
// 重置页面列表 点击搜索条件时需要
...
...
@@ -74,6 +99,30 @@ Page({
});
},
/**
* 视频详情
*/
queryBlessDetail
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
app
.
post
({
url
:
app
.
api
.
blessDetail
,
data
:
{
blessCode
:
this
.
data
.
options
.
c
,
ownerMemberCode
:
this
.
data
.
options
.
m
?
this
.
data
.
options
.
m
:
app
.
store
.
getItem
(
"memberCode"
)
?
app
.
store
.
getItem
(
"memberCode"
)
:
""
,
}
}).
then
((
result
)
=>
{
this
.
setData
({
detailData
:
result
,
memberList
:
result
.
memberList
});
resolve
(
result
);
}).
catch
((
err
)
=>
{
reject
(
err
);
});
});
},
/**
* 隐藏蒙层
*/
...
...
src/pages/blessing/blessing.wxml
View file @
2d4931f
...
...
@@ -7,7 +7,7 @@
<!-- <view class="top-bg"></view> -->
<view class="top-space"></view>
<view class="content">
<view class="title">
大年初一
</view>
<view class="title">
{{detailData.lunarCalendar}}
</view>
<!-- 用户 -->
<view class="user">
<!-- 用户头像 -->
...
...
@@ -17,18 +17,18 @@
</view>
<!-- 用户名称 -->
<view class="name">
<view class="tt">
姓名
</view>
<view class="tt">
{{detailData.familyName}}
</view>
<image class="name-edit" mode="widthFix" src="../../image/blessing/icon-edit.png" />
</view>
<!-- 编辑 -->
<view class="edit">
<view class="tt t1">
携家人
</view>
<view class="tt t1">
{{detailData.sentence}}
</view>
<image class="name-edit" mode="widthFix" src="../../image/blessing/icon-edit.png" />
<view class="tt t2">
2
人</view>
<view class="tt t2">
{{memberList.length}}
人</view>
</view>
<!-- 用户组 -->
<view class="group">
<view wx:for="{{
6
}}" class="group-item">
<view wx:for="{{
memberList}}" wx:key="{{index
}}" class="group-item">
<view class="group-item-portrait"></view>
<view class="group-item-name">
<view class="t1">李四</view>
...
...
@@ -42,7 +42,7 @@
<image class="icon-down" mode="widthFix" src="../../image/blessing/icon-down-arrow.png" />
</view>
<!-- 自定义句子 -->
<view class="sentence">
给您拜年啦!
</view>
<view class="sentence">
{{detailData.sentence}}
</view>
</view>
<!-- 尾部内容 -->
<view class="tail">
...
...
@@ -77,3 +77,4 @@
</view>
</view>
</view>
<van-dialog id="van-dialog" />
...
...
src/pages/index/index.js
View file @
2d4931f
...
...
@@ -12,11 +12,12 @@ Page({
size
:
10
,
dataList
:
[],
tabList
:
[],
// 标签列表
listType
:
2
,
// 0是普通视频列表 1是推荐 2是祝福语 非2就是普通视频
bannerList
:
[],
curTab
:
{},
queueCode
:
""
,
// 队列标识,每次请求,会返回一个队列标识,用户加载更多时候请携带queueCode参数
active
:
0
,
curBanner
:
{}
curBanner
:
{}
,
},
onShareAppMessage
(
res
)
{
if
(
res
.
from
===
'button'
)
{
...
...
@@ -110,7 +111,19 @@ Page({
*/
onDetailHandler
(
evt
)
{
let
curItem
=
getBindtapData
(
evt
);
let
videoCode
=
curItem
.
videoCode
||
""
let
listType
=
this
.
data
.
listType
;
if
(
listType
==
2
)
{
let
blessCode
=
curItem
.
blessCode
||
""
;
if
(
blessCode
)
{
app
.
router
.
push
({
path
:
"blessing"
,
query
:
{
c
:
blessCode
}
})
}
}
else
{
let
videoCode
=
curItem
.
videoCode
||
""
;
if
(
videoCode
)
{
app
.
router
.
push
({
path
:
"detail"
,
...
...
@@ -119,6 +132,8 @@ Page({
}
})
}
}
},
/**
...
...
@@ -273,6 +288,7 @@ Page({
dataList
:
dataList
,
total
:
result
.
total
,
queueCode
:
result
.
queueCode
,
listType
:
result
.
type
})
resolve
(
result
);
}).
catch
((
err
)
=>
{
...
...
src/pages/index/index.scss
View file @
2d4931f
...
...
@@ -74,6 +74,30 @@
margin
:
0
auto
;
width
:
$contentWidth
;
// 拜年祝福item
&
-bless-item
{
display
:
flex
;
justify-content
:
space-between
;
border-bottom
:
solid
2px
#dfdfdf
;
padding
:
24px
0
;
.tit
{
@extend
.bb
;
padding
:
8px
0
;
height
:
180px
;
flex
:
1
;
font-size
:
40px
;
@include
ellipsis
(
3
);
}
.poster
{
width
:
350px
;
height
:
180px
;
border-radius
:
8px
;
}
}
// 视频item
&
-item
{
// @extend .shadow;
box-shadow
:
0
6px
10px
0
rgba
(
0
,
0
,
0
,
0
.6
);
...
...
@@ -113,7 +137,7 @@
bottom
:
0
;
@include
ellipsis
(
2
);
.tit-t1
{
.tit-t1
{
@extend
.bb
;
padding
:
0
24px
;
position
:
relative
;
...
...
src/pages/index/index.wxml
View file @
2d4931f
...
...
@@ -24,6 +24,15 @@
</view>
<view class="content">
<view class="list">
<!-- 拜年item -->
<block wx:if="{{listType == 2}}">
<view wx:for="{{dataList}}" bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" wx:key="index" class="list-bless-item">
<image class="poster" src="{{item.thumbnail}}" />
<view class="tit">{{item.blessTitle}}</view>
</view>
</block>
<!-- 视频item -->
<block wx:else>
<view wx:for="{{dataList}}" wx:key="index" class="list-item">
<view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" class="list-item-video">
<image class="img" src="{{item.thumbnail}}" mode="aspectFill" />
...
...
@@ -46,6 +55,7 @@
</button>
</view>
</view>
</block>
</view>
</view>
</view>
...
...
Please
register
or
sign in
to post a comment