当前位置:网站首页>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
边栏推荐
- 数据库范式和主码的选择
- uni-app使用canvas绘制二维码
- The successfully resolved idea cannot use the log normally after referencing Lombok's @slf4j
- Leetcode 238 product of arrays other than itself
- Summary of several common UML diagrams
- 50行代码爬取Top500图书导入TXT文档
- 威胁猎人必备的六个威胁追踪工具
- 商品秒杀系统
- 8VC Venture Cup 2017 - Final Round C. Nikita and stack
- Résolution du problème: la machine virtuelle n'a pas pu copier et coller le fichier
猜你喜欢
微信小程序 uniapp 左滑 删除 带删除icon
抖音实战~分享模块~生成短视频二维码
9. Intelligent transportation project (2)
LeetCode 面试题29 顺时针打印矩阵
Yujun product methodology
Wechat applet uniapp left slide delete with Delete Icon
Crawl Douban to read top250 and import it into SqList database (or excel table)
LeetCode 238 除自身以外数组的乘积
Project practice 6: distributed transaction Seata
Create a time blocker yourself
随机推荐
To: Apple CEO Cook: great ideas come from constantly rejecting the status quo
To: seek truth from facts
问题解决:虚拟机无法复制粘贴文件
Take you to resolve hash conflicts and implement a simple hash table,
Crawl Douban to read top250 and import it into SqList database (or excel table)
Reading notes: process consulting III
Filebeat安装及使用
微服务架构
Development principle analysis and source code of dapp-lp single and dual currency liquidity pledge mining system
Installation and use of filebeat
50 lines of code to crawl TOP500 books and import TXT documents
8VC Venture Cup 2017 - Final Round C. Nikita and stack
抖音实战~分享模块~短视频下载(保存到相册)
Numpy's Matplotlib
Enter n integers and output the number of occurrences greater than or equal to half the length of the array
威胁猎人必备的六个威胁追踪工具
Résumé des points de connaissance
The cross compilation environment appears So link file not found problem
Chain game development finished product source code chain game system development details
Feign remote call