Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nyx
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
发现
nyx
Commits
dbf780cc
Commit
dbf780cc
authored
Mar 27, 2020
by
jscat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nyx: discover相关功能接口更新
parent
876b8820
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
143 行增加
和
85 行删除
+143
-85
增值产品-小程序及app/nyx-master/config.js
+3
-1
增值产品-小程序及app/nyx-master/pages/discover/discover.js
+105
-56
增值产品-小程序及app/nyx-master/pages/discover/discover.wxml
+35
-28
没有找到文件。
增值产品-小程序及app/nyx-master/config.js
查看文件 @
dbf780cc
//con
fig.js API全局域名配置
//con
fig.js API全局域名配置
...
@@ -47,6 +47,7 @@ var config={
...
@@ -47,6 +47,7 @@ var config={
match_add_item_url
:
host_key
+
"/api/nyx/match/add/item"
,
match_add_item_url
:
host_key
+
"/api/nyx/match/add/item"
,
user_reg_url
:
host_key
+
"/api/nyx/user/reg"
,
user_reg_url
:
host_key
+
"/api/nyx/user/reg"
,
userinfo_query_url
:
host_key
+
"/api/nyx/userinfo/query"
,
userinfo_query_url
:
host_key
+
"/api/nyx/userinfo/query"
,
notes_query_url
:
host_key
+
"/api/nyx/notes/query"
,
socket_url
:
socket_url
,
socket_url
:
socket_url
,
}
}
module
.
exports
=
config
;
module
.
exports
=
config
;
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/discover/discover.js
查看文件 @
dbf780cc
// pa
ges/kinds/kinds.js
// pa
ges/kinds/kinds.js
// pages/kinds/kinds.js
// pages/kinds/kinds.js
const
app
=
getApp
()
const
app
=
getApp
()
var
config
=
wx
.
getStorageSync
(
"config"
);
Page
({
Page
({
...
@@ -9,62 +10,52 @@ Page({
...
@@ -9,62 +10,52 @@ Page({
data
:
{
data
:
{
category
:
[
// 导航栏内容数据
category
:
[
// 导航栏内容数据
{
name
:
'推荐'
,
id
:
'tuijian'
},
{
name
:
'推荐'
,
id
:
'tuijian'
},
{
name
:
'附近'
,
id
:
'fujin'
},
{
name
:
'复工'
,
id
:
'fugong'
},
{
name
:
'复工'
,
id
:
'fugong'
},
{
name
:
'酒单'
,
id
:
'jiudan'
},
{
name
:
'酒单'
,
id
:
'jiudan'
},
{
name
:
'
DJ'
,
id
:
'dj
'
},
{
name
:
'
音乐'
,
id
:
'yinyue
'
},
{
name
:
'饮事'
,
id
:
'yinshi'
},
{
name
:
'饮事'
,
id
:
'yinshi'
},
],
],
curIndex
:
0
,
curIndex
:
0
,
// 给选中的tab加粗
detail
:
[
notes
:
[
{
{
id
:
"tuijian"
,
note_image
:
[
"https://img.xiaohongshu.com/items/c1a0056ba9ba17b30446a0e040dc9e30@800w_90Q_1x_2o.jpg"
,
notes
:
[
"https://img.xiaohongshu.com/items/c1a0056ba9ba17b30446a0e040dc9e30@800w_90Q_1x_2o.jpg"
,
{
],
note_image
:
"https://img.xiaohongshu.com/items/c1a0056ba9ba17b30446a0e040dc9e30@800w_90Q_1x_2o.jpg"
,
title
:
"便携香水加香一天"
,
title
:
"便携香水加香一天"
,
like
:
10
,
writer
:
"无敌花木兰"
,
writer_name
:
"无敌花木兰"
,
like
:
10
,
writer_image
:
"../../icon/icon_avatar3.png"
writer_image
:
"../../icon/icon_avatar3.png"
},
{
note_image
:
"https://img.xiaohongshu.com/items/c1a0056ba9ba17b30446a0e040dc9e30@800w_90Q_1x_2o.jpg"
,
title
:
"便携香水加香一天"
,
writer
:
"无敌花木兰"
,
like
:
10
,
writer_image
:
"../../icon/icon_avatar3.png"
}
]
},
},
{
{
id
:
"fujin"
,
note_image
:
[
"https://img.xiaohongshu.com/items/c1a0056ba9ba17b30446a0e040dc9e30@800w_90Q_1x_2o.jpg"
,
notes
:
[
],
{
title
:
"便携香水加香一天"
,
note_image
:
"https://img.xiaohongshu.com/items/c1a0056ba9ba17b30446a0e040dc9e30@800w_90Q_1x_2o.jpg"
,
like
:
10
,
title
:
"便携香水加香一天"
,
writer_name
:
"无敌花木兰"
,
writer
:
"大小姐嫁到"
,
writer_image
:
"../../icon/icon_avatar3.png"
like
:
10
,
},
writer_image
:
"https://img.xiaohongshu.com/seller/0d1b063d887360fc5a3779bd6784a453"
{
},
note_image
:
[
"https://img.xiaohongshu.com/items/c1a0056ba9ba17b30446a0e040dc9e30@800w_90Q_1x_2o.jpg"
,
{
],
title
:
"便携香水加香一天"
,
note_image
:
"https://img.xiaohongshu.com/items/c1a0056ba9ba17b30446a0e040dc9e30@800w_90Q_1x_2o.jpg"
,
like
:
10
,
title
:
"便携香水加香一天"
,
writer_name
:
"无敌花木兰"
,
writer
:
"百里玄策"
,
writer_image
:
"../../icon/icon_avatar3.png"
like
:
10
,
},
writer_image
:
"https://img.xiaohongshu.com/seller/0d1b063d887360fc5a3779bd6784a453"
{
}
note_image
:
[
"https://img.xiaohongshu.com/items/c1a0056ba9ba17b30446a0e040dc9e30@800w_90Q_1x_2o.jpg"
,
]
],
}
title
:
"便携香水加香一天"
,
like
:
10
,
writer_name
:
"无敌花木兰"
,
writer_image
:
"../../icon/icon_avatar3.png"
},
],
],
toView
:
'tuijian'
,
scroll
:
true
},
},
switchCategory
(
e
)
{
switchCategory
(
e
)
{
this
.
setData
({
this
.
setData
({
curIndex
:
e
.
currentTarget
.
dataset
.
index
?
e
.
currentTarget
.
dataset
.
index
:
0
,
curIndex
:
e
.
currentTarget
.
dataset
.
index
?
e
.
currentTarget
.
dataset
.
index
:
0
,
toView
:
e
.
currentTarget
.
dataset
.
index
,
})
})
},
},
// 搜索点击事件
// 搜索点击事件
...
@@ -73,22 +64,24 @@ Page({
...
@@ -73,22 +64,24 @@ Page({
url
:
'../index/searchbar/searchbar'
,
url
:
'../index/searchbar/searchbar'
,
})
})
},
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
var
_this
=
this
;
wx
.
setNavigationBarTitle
({
wx
.
setNavigationBarTitle
({
title
:
'发现'
,
title
:
'发现'
,
})
})
// 请求数据
//
wx.request({
//
初始载入四个推荐notes
// url: 'https://www.easy-mock.com/mock/5b1e17a0d4a14a3247a6cd6b/',
if
(
_this
.
__data
.
notes
.
length
==
0
)
// success: (res) =>
{
{
// this.setData({
//getNotes(strCategory)
// detail: res.data.data
var
strCategory
=
_this
.
__data__
.
category
[
curIndex
].
name
// })
_this
.
getNotes
(
strCategory
);
//
}
}
// })
},
},
/**
/**
...
@@ -130,7 +123,31 @@ Page({
...
@@ -130,7 +123,31 @@ Page({
* 页面上拉触底事件的处理函数
* 页面上拉触底事件的处理函数
*/
*/
onReachBottom
:
function
()
{
onReachBottom
:
function
()
{
console
.
log
(
'页面上拉触底'
)
var
_that
=
this
;
var
isHideLoadMore
=
_that
.
__data__
.
isHideLoadMore
;
var
pageIndex
=
_that
.
__data__
.
pageIndex
;
var
strSearchName
=
_that
.
__data__
.
strSearchName
;
//判断是否已经全部加载完毕
//没有则加载更多
if
(
!
isHideLoadMore
)
{
console
.
log
(
'加载更多'
)
//如果是全部搜索状态
if
(
strSearchName
.
length
>
0
)
{
setTimeout
(()
=>
{
_that
.
getBookGlobal
(
1
,
strSearchName
,
pageIndex
,
4
);
},
1000
)
}
else
{
setTimeout
(()
=>
{
_that
.
getBook
(
1
,
pageIndex
,
4
);
},
1000
)
}
}
else
{
console
.
log
(
'没有更多'
)
}
},
},
/**
/**
...
@@ -138,6 +155,38 @@ Page({
...
@@ -138,6 +155,38 @@ Page({
*/
*/
onShareAppMessage
:
function
()
{
onShareAppMessage
:
function
()
{
}
},
/**
* 用户自定义函数
*
*/
// 获取notes数据
getNotes
:
function
(
strCategory
)
{
var
_this
=
this
;
config
.
debug
==
1
?
console
.
log
(
"===getNotes strCategory is:
\"
"
+
strCategory
+
"
\"
"
)
:
""
wx
.
request
({
url
:
config
.
notes_query_url
+
'?tag='
+
strCategory
,
method
:
'GET'
,
header
:
{
'Cookie'
:
wx
.
getStorageSync
(
'cookieKey'
),
},
success
:
function
(
res
)
{
if
(
res
.
data
.
resultCode
==
200
)
{
//表示HTTP请求成功
console
.
log
(
res
.
data
);
var
result
=
res
.
data
.
data
for
(
var
j
=
0
;
j
<
result
.
length
;
j
++
)
{
var
list
=
result
[
i
].
note_image
.
split
(
"::"
)
result
[
i
][
"note_image"
]
=
list
}
_this
.
setData
({
notes
:
result
,
})
}
}
})
},
})
})
增值产品-小程序及app/nyx-master/pages/discover/discover.wxml
查看文件 @
dbf780cc
<view
class="page">
<view
class="page">
...
@@ -14,35 +14,42 @@
...
@@ -14,35 +14,42 @@
bindtap="switchCategory">{{item.name}}</view>
bindtap="switchCategory">{{item.name}}</view>
</scroll-view>
</scroll-view>
</view>
</view>
<!-- 文章列表 -->
<!-- 文章列表 -->
<swiper class="notes" current="{{toView}}">
<scroll-view class="list-block" scroll-y="true">
<swiper-item class="category" wx:for="{{detail}}" wx:key="{{item.id}}">
<!-- 文章封面内容 -->
<scroll-view class="cate-box" id="{{item.id}}" scroll-y>
<view class="notes-block" wx:for="{{notes}}" wx:for-item="item" wx:key="{{index}}">
<!-- 文章封面内容 -->
<view class="note-info">
<view class="note" wx:for="{{item.notes}}" wx:for-item="notes" wx:key="{{index}}">
<navigator url="../discover/note-info/note-info?bookId={{item.bookId}}&channelId={{item.channelId}}&imgUrl={{item.imgUrl}}&channelType={{item.channelType}}&channelName={{item.channelName}}" >
<view class="note-info">
<view class="home-note-img">
<navigator url="../discover/note-info/note-info" >
<image src="{{item.note_image[0]}}"/>
<view class="home-note-img">
<image src="{{notes.note_image}}"/>
</view>
<span>{{notes.title}}</span>
</navigator>
</view>
<!-- 作者信息 -->
<view class="note-handle">
<navigator class="writer" url="../discover/note-writer/note-writer">
<image class="photo-img" src="{{notes.writer_image}}"/>
<span class="name">{{notes.writer}}</span>
</navigator>
<view class="like">
<image class="like-icon" src="../../icon/discover/like.png"/>
<span>{{notes.like}}</span>
</view>
</view>
</view>
</view>
</scroll-view>
<span>{{item.title}}</span>
</swiper-item>
</navigator>
</swiper>
</view>
<!-- 作者信息 -->
<view class="note-handle">
<navigator class="writer" url="../discover/note-writer/note-writer">
<image class="photo-img" src="{{item.writer_image}}"/>
<span class="name">{{item.writer_name}}</span>
</navigator>
<view class="like">
<image class="like-icon" src="../../icon/discover/like.png"/>
<span>{{item.like}}</span>
</view>
</view>
</view>
</scroll-view>
<!-- 加载更多 -->
<view class="weui-loadmore" hidden="{{isHideLoadMore}}">
<view class="weui-loading"></view>
<view class="weui-loadmore__tips">正在加载</view>
</view>
<view class="weui-loadmore" hidden="{{!isHideLoadMore}}">
<view class="weui-loadmore__tips">没有更多啦 {{'>'}}_{{'<'}} </view>
</view>
</view>
</view>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论