Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
a50998e6
Commit
a50998e6
authored
Aug 22, 2018
by
youc3576
Committed by
linlinjava
Aug 22, 2018
Browse files
fix 专题商品显示代码
Merge pull request !8 from youc3576/master
parent
8cf5b8f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxTopicController.java
View file @
a50998e6
package
org.linlinjava.litemall.wx.web
;
package
org.linlinjava.litemall.wx.web
;
import
org.linlinjava.litemall.db.domain.LitemallGoods
;
import
org.linlinjava.litemall.db.domain.LitemallTopic
;
import
org.linlinjava.litemall.db.domain.LitemallTopic
;
import
org.linlinjava.litemall.db.service.LitemallGoodsService
;
import
org.linlinjava.litemall.db.service.LitemallTopicService
;
import
org.linlinjava.litemall.db.service.LitemallTopicService
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -11,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -11,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -21,6 +24,8 @@ import java.util.Map;
...
@@ -21,6 +24,8 @@ import java.util.Map;
public
class
WxTopicController
{
public
class
WxTopicController
{
@Autowired
@Autowired
private
LitemallTopicService
topicService
;
private
LitemallTopicService
topicService
;
@Autowired
private
LitemallGoodsService
goodsService
;
/**
/**
* 专题列表
* 专题列表
...
@@ -28,17 +33,17 @@ public class WxTopicController {
...
@@ -28,17 +33,17 @@ public class WxTopicController {
* @param page 分页页数
* @param page 分页页数
* @param size 分页大小
* @param size 分页大小
* @return 专题列表
* @return 专题列表
*
成功则
* 成功则
*
{
* {
*
errno: 0,
* errno: 0,
*
errmsg: '成功',
* errmsg: '成功',
*
data:
* data:
*
{
* {
*
data: xxx,
* data: xxx,
*
count: xxx
* count: xxx
*
}
* }
*
}
* }
*
失败则 { errno: XXX, errmsg: XXX }
* 失败则 { errno: XXX, errmsg: XXX }
*/
*/
@GetMapping
(
"list"
)
@GetMapping
(
"list"
)
public
Object
list
(
@RequestParam
(
defaultValue
=
"1"
)
Integer
page
,
public
Object
list
(
@RequestParam
(
defaultValue
=
"1"
)
Integer
page
,
...
@@ -56,18 +61,27 @@ public class WxTopicController {
...
@@ -56,18 +61,27 @@ public class WxTopicController {
*
*
* @param id 专题ID
* @param id 专题ID
* @return 专题详情
* @return 专题详情
*
成功则
* 成功则
*
{
* {
*
errno: 0,
* errno: 0,
*
errmsg: '成功',
* errmsg: '成功',
*
data: xxx
* data: xxx
*
}
* }
*
失败则 { errno: XXX, errmsg: XXX }
* 失败则 { errno: XXX, errmsg: XXX }
*/
*/
@GetMapping
(
"detail"
)
@GetMapping
(
"detail"
)
public
Object
detail
(
@NotNull
Integer
id
)
{
public
Object
detail
(
@NotNull
Integer
id
)
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
LitemallTopic
topic
=
topicService
.
findById
(
id
);
LitemallTopic
topic
=
topicService
.
findById
(
id
);
return
ResponseUtil
.
ok
(
topic
);
data
.
put
(
"topic"
,
topic
);
List
<
LitemallGoods
>
goods
=
new
ArrayList
<>();
for
(
Integer
i
:
topic
.
getGoods
())
{
LitemallGoods
good
=
goodsService
.
findByIdVO
(
i
);
if
(
null
!=
good
)
goods
.
add
(
good
);
}
data
.
put
(
"goods"
,
goods
);
return
ResponseUtil
.
ok
(
data
);
}
}
/**
/**
...
@@ -75,13 +89,13 @@ public class WxTopicController {
...
@@ -75,13 +89,13 @@ public class WxTopicController {
*
*
* @param id 专题ID
* @param id 专题ID
* @return 相关专题
* @return 相关专题
*
成功则
* 成功则
*
{
* {
*
errno: 0,
* errno: 0,
*
errmsg: '成功',
* errmsg: '成功',
*
data: xxx
* data: xxx
*
}
* }
*
失败则 { errno: XXX, errmsg: XXX }
* 失败则 { errno: XXX, errmsg: XXX }
*/
*/
@GetMapping
(
"related"
)
@GetMapping
(
"related"
)
public
Object
related
(
@NotNull
Integer
id
)
{
public
Object
related
(
@NotNull
Integer
id
)
{
...
...
litemall-wx/pages/topicDetail/topicDetail.js
View file @
a50998e6
...
@@ -9,7 +9,8 @@ Page({
...
@@ -9,7 +9,8 @@ Page({
topic
:
{},
topic
:
{},
topicList
:
[],
topicList
:
[],
commentCount
:
0
,
commentCount
:
0
,
commentList
:
[]
commentList
:
[],
topicGoods
:
[]
},
},
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
// 页面初始化 options为页面跳转所带来的参数
...
@@ -20,12 +21,12 @@ Page({
...
@@ -20,12 +21,12 @@ Page({
util
.
request
(
api
.
TopicDetail
,
{
id
:
that
.
data
.
id
}).
then
(
function
(
res
)
{
util
.
request
(
api
.
TopicDetail
,
{
id
:
that
.
data
.
id
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
that
.
setData
({
topic
:
res
.
data
,
topic
:
res
.
data
.
topic
,
topicGoods
:
res
.
data
.
goods
});
});
WxParse
.
wxParse
(
'
topicDetail
'
,
'
html
'
,
res
.
data
.
content
,
that
);
WxParse
.
wxParse
(
'
topicDetail
'
,
'
html
'
,
res
.
data
.
topic
.
content
,
that
);
}
}
});
});
...
@@ -41,7 +42,6 @@ Page({
...
@@ -41,7 +42,6 @@ Page({
let
that
=
this
;
let
that
=
this
;
util
.
request
(
api
.
CommentList
,
{
valueId
:
that
.
data
.
id
,
type
:
1
,
showType
:
0
,
page
:
1
,
size
:
5
}).
then
(
function
(
res
)
{
util
.
request
(
api
.
CommentList
,
{
valueId
:
that
.
data
.
id
,
type
:
1
,
showType
:
0
,
page
:
1
,
size
:
5
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
that
.
setData
({
commentList
:
res
.
data
.
data
,
commentList
:
res
.
data
.
data
,
commentCount
:
res
.
data
.
count
commentCount
:
res
.
data
.
count
...
...
litemall-wx/pages/topicDetail/topicDetail.wxml
View file @
a50998e6
...
@@ -3,8 +3,28 @@
...
@@ -3,8 +3,28 @@
<import src="../../lib/wxParse/wxParse.wxml"/>
<import src="../../lib/wxParse/wxParse.wxml"/>
<template is="wxParse" data="{{wxParseData:topicDetail.nodes}}"/>
<template is="wxParse" data="{{wxParseData:topicDetail.nodes}}"/>
</scroll-view>
</scroll-view>
<scroll-view class="sv-goods">
<view class="topic-goods">
<view class="topic-goods">
<view class="h">
<text class="t">专题商品</text>
<image bindtap="postComment" class="i" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/comment-add-2aca147c3f.png"></image>
</view>
<view class="b">
<view class="item" wx:for="{{topicGoods}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<view class="right">
<view class="text">
<text class="name">{{item.name}}</text>
<text class="desc">{{item.brief}}</text>
<text class="price">¥{{item.retailPrice}}</text>
</view>
</view>
</navigator>
</view>
</view>
</view>
</view>
</scroll-view>
<scroll-view class="comments">
<scroll-view class="comments">
<view class="h">
<view class="h">
<text class="t">精选留言</text>
<text class="t">精选留言</text>
...
...
litemall-wx/pages/topicDetail/topicDetail.wxss
View file @
a50998e6
.content{
.content{
width: 100%;
width: 100%;
height: auto;
height: auto;
...
@@ -138,6 +135,65 @@
...
@@ -138,6 +135,65 @@
width: 115rpx;
width: 115rpx;
}
}
.sv-goods{
width: 100%;
height: auto;
padding-left:30rpx;
background: #fff;
margin-top: 20rpx;
}
.topic-goods .b .item {
border-top: 1px solid #d9d9d9;
margin: 0 20rpx;
height: 244rpx;
width: 710rpx;
}
.topic-goods .b .img {
margin-top: 12rpx;
margin-right: 12rpx;
float: left;
width: 220rpx;
height: 220rpx;
}
.topic-goods .b .right {
float: left;
height: 244rpx;
width: 476rpx;
display: flex;
flex-flow: row nowrap;
}
.topic-goods .b .text {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
overflow: hidden;
height: 244rpx;
width: 476rpx;
}
.topic-goods .b .name {
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;
font-size: 30rpx;
}
.topic-goods .b .desc {
width: 476rpx;
display: block;
color: #999;
line-height: 50rpx;
font-size: 25rpx;
}
.topic-goods .b .price {
width: 476rpx;
display: flex;
color: #b4282d;
line-height: 50rpx;
font-size: 33rpx;
}
.rec-box{
.rec-box{
width: 690rpx;
width: 690rpx;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment