当前位置:网站首页>Tiktok practice ~ search page ~ video details
Tiktok practice ~ search page ~ video details
2022-06-26 19:06:00 【gblfy】

One 、 The front end
1. Search keyword short video list
Search keywords to query the short video list
// Query the short video list according to the search keywords
fetchList(page) {
uni.stopPullDownRefresh();
var me = this;
page = page + 1;
var search = me.search;
var userId = getApp().getUserInfoSession().id;
var serverUrl = app.globalData.serverUrl;
uni.request({
method: "GET",
header: {
headerUserId: userId,
headerUserToken: app.getUserSessionToken()
},
url: serverUrl + "/vlog/indexList?userId=" + userId + "&search=" + search + "&page=" + page + "&pageSize=10",
success(result) {
if (result.data.status == 200) {
var waterList = result.data.data.rows;
var totalPage = result.data.data.total;
me.waterList = me.waterList.concat(waterList);
me.page = page;
me.totalPage = totalPage;
if (waterList == null || waterList == undefined || waterList.length == 0) {
uni.showToast({
title: " No results ~"
})
}
}
uni.stopPullDownRefresh();
}
});
}
2. Select a short video
goToVlog(vlogId) {
uni.navigateTo({
url: "../vlog/vlog?vlogId=" + vlogId
})
},
3. Short video details
// According to the user userId and vlogId Query the details of the short video is the same as the home page, but there is no tab page
displayVideoPaging(page, needClearList) {
// Query the list of short videos on the home page
var me = this;
var vlogId = me.vlogId;
var myUserInfo = getApp().getUserInfoSession();
var userId = "";
if (myUserInfo != null) {
userId = myUserInfo.id;
}
var userId = getApp().getUserInfoSession().id;
var serverUrl = app.globalData.serverUrl;
uni.request({
method: "GET",
header: {
headerUserId: userId,
headerUserToken: app.getUserSessionToken()
},
url: serverUrl + "/vlog/detail?userId=" + userId + "&vlogId=" + vlogId,
success(result) {
if (result.data.status == 200) {
var vlog = result.data.data;
var playerList = [];
playerList.push(vlog);
me.playerList = playerList;
me.freshCommentCounts();
me.setThisVlogInfo();
} else {
uni.showToast({
title: result.data.msg,
icon: "none",` Insert a code chip here `
duration: 3000
});
}
}
});
}
Two 、 Back end part
2.1. Short video entry
/**
* Query based on video PK vlog details
*
* @param userId With the head of the household key ID
* @param vlogId Video primary key ID
* @return
*/
@GetMapping("detail")
public GraceJSONResult detail(@RequestParam(defaultValue = "") String userId,
@RequestParam String vlogId) {
return GraceJSONResult.ok(vlogService.getVlogDetailById(userId, vlogId));
}
2.2. Short video interface layer
/**
* Query based on video PK vlog details
*/
public IndexVlogVO getVlogDetailById(String userId, String vlogId);
2.3. Short video service layer
/**
* Query based on video PK vlog details
*
* @param userId
* @param vlogId
* @return
*/
@Override
public IndexVlogVO getVlogDetailById(String userId, String vlogId) {
Map<String, Object> map = new HashMap<>();
map.put("vlogId", vlogId);
List<IndexVlogVO> list = vlogMapperCustom.getVlogDetailById(map);
if (list != null && list.size() > 0 && !list.isEmpty()) {
IndexVlogVO vlogVO = list.get(0);
// return vlogVO;
return setterVO(vlogVO, userId);
}
return null;
}
2.4. Persistence layer - Interface
/**
* Query based on video PK vlog details
*
* @param map
* @return
*/
public List<IndexVlogVO> getVlogDetailById(@Param("paramMap") Map<String, Object> map);
2.5. Persistence layer - xml
<!-- Query based on video PK vlog details -->
<select id="getVlogDetailById" parameterType="map" resultType="com.gblfy.vo.IndexVlogVO">
SELECT v.id as vlogId,
v.vloger_id as vlogerId,
u.face as vlogerFace,
u.nickname as vlogerName,
v.title as content,
v.url as url,
v.cover as cover,
v.width as width,
v.height as height,
v.like_counts as likeCounts,
v.comments_counts as commentsCounts,
v.is_private as isPrivate
FROM vlog v
LEFT JOIN
users u
ON
v.vloger_id = u.id
WHERE v.id = #{paramMap.vlogId}
</select>
3、 ... and 、 Appreciation of renderings
3.1. Search page

3.2. Short video list

3.3. Short video details

边栏推荐
猜你喜欢

Leetcode 128 longest continuous sequence

Crawl Douban to read top250 and import it into SqList database (or excel table)

LeetCode 238 除自身以外数组的乘积

数据库SQL语句撰写

Web resource preloading - production environment practice

Solidity - contract inheritance sub contract contains constructor errors and one contract calls the view function of another contract to charge gas fees

xlua获取ugui的button注册click事件

IK分词器

Filebeat安装及使用

深度学习之Numpy篇
随机推荐
DVD digital universal disc
Interview key points that must be mastered index and affairs (with B-tree and b+ tree)
Kubernetes resource topology aware scheduling optimization
String string is converted to jsonarray and parsed
NFTGameFi链游系统开发详解方案丨链游系统开发原理解析
Clion编译catkin_ws(ROS工作空间包的简称)加载CMakeLists.txt出现的问题
【Mysql系列】工作常用sql集锦(持续更新)
刷新三观的HP-UX系统中的强指针赋值出core问题
Résolution du problème: la machine virtuelle n'a pas pu copier et coller le fichier
关于Qt数据库开发的一些冷知识
IK word breaker
Micro service single sign on system (SSO)
商品秒杀系统
关于不等式取值转义的思路
Redis Basics
品达通用权限系统(Day 3~Day 4)
Handwritten numeral recognition based on tensorflow
[kubernetes] kubernetes principle analysis and practical application (under update)
ARM裸板调试之串口打印及栈初步分析
Numpy之matplotlib