个人信息页面有一个tab(作品,收藏,关注)源码:https://github.com/limingios/wxProgram.git 中No.15和springboot

作品,收藏,关注的列表

VideoController.java

package com.idig8.controller;import java.io.File;
import java.util.Date;
import java.util.UUID;import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;import com.idig8.pojo.Bgm;
import com.idig8.pojo.Videos;
import com.idig8.service.BgmService;
import com.idig8.service.VideoService;
import com.idig8.utils.FetchVideoCover;
import com.idig8.utils.JSONResult;
import com.idig8.utils.MergeVideoMp3;
import com.idig8.utils.PagedResult;
import com.idig8.utils.enums.VideoStatusEnum;
import com.idig8.utils.file.FileUtil;import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;@RestController
@Api(value="视频相关业务的接口", tags= {"视频相关业务的controller"})
@RequestMapping("/video")
public class VideoController extends BasicController {@Autowiredprivate BgmService bgmService;@Autowiredprivate VideoService videosService;@Value("${server.file.path}")private String fileSpace;@Value("${server.ffmpeg.path}")private String ffmpegexe;@ApiOperation(value="上传视频", notes="上传视频的接口")@ApiImplicitParams({@ApiImplicitParam(name="userId", value="用户id", required=true, dataType="String", paramType="form"),@ApiImplicitParam(name="bgmId", value="背景音乐id", required=false, dataType="String", paramType="form"),@ApiImplicitParam(name="videoSeconds", value="背景音乐播放长度", required=true, dataType="String", paramType="form"),@ApiImplicitParam(name="videoWidth", value="视频宽度", required=true, dataType="String", paramType="form"),@ApiImplicitParam(name="videoHeight", value="视频高度", required=true, dataType="String", paramType="form"),@ApiImplicitParam(name="desc", value="视频描述", required=false, dataType="String", paramType="form")})@PostMapping(value="/upload", headers="content-type=multipart/form-data")public JSONResult upload(String userId, String bgmId, double videoSeconds, int videoWidth, int videoHeight,String desc,@ApiParam(value="短视频", required=true)MultipartFile file) throws Exception {if (StringUtils.isBlank(userId)) {return JSONResult.errorMsg("用户id不能为空...");}// 文件保存的命名空间String fileName = file.getOriginalFilename();// 保存到数据库中的相对路径String path = "";String videOutPath = "";String ImagePath = "";try {path = FileUtil.uploadFile(file.getBytes(), fileSpace, fileName);} catch (Exception e) {e.getStackTrace();return JSONResult.errorMsg(e.getMessage());}                if(StringUtils.isNotBlank(bgmId)){Bgm bgm = bgmService.queryBgmById(bgmId);String mp3BgmPath = fileSpace + bgm.getPath();MergeVideoMp3 mergeVideoMp3 = new MergeVideoMp3(ffmpegexe);String videOutPathName = UUID.randomUUID().toString()+".mp4";File targetFile = new File(fileSpace + userId);if (!targetFile.exists()) {targetFile.mkdirs();}videOutPath = "/"+userId+"/"+videOutPathName;String videoInput = fileSpace +path;mergeVideoMp3.convertor(videoInput, mp3BgmPath, videoSeconds, fileSpace +videOutPath);}else{videOutPath = path;}ImagePath =  "/"+userId+"/"+UUID.randomUUID().toString()+".jpg";;FetchVideoCover fetchVideoCover = new FetchVideoCover(ffmpegexe);fetchVideoCover.getCover(fileSpace +videOutPath, fileSpace +ImagePath);Videos videos = new Videos();videos.setAudioId(bgmId);videos.setCreateTime(new Date());videos.setVideoDesc(desc);videos.setId(UUID.randomUUID().toString());videos.setUserId(userId);videos.setVideoHeight(videoHeight);videos.setVideoWidth(videoWidth);videos.setVideoPath(videOutPath);videos.setCoverPath(ImagePath);videos.setStatus(VideoStatusEnum.SUCCESS.value);videosService.saveVideo(videos);return JSONResult.ok(path);}@PostMapping(value="/showAll")@ApiOperation(value="视频列表", notes="分页的视频列表")public JSONResult showAll(@RequestBody Videos video,Integer isSaveRecord,Integer page) throws Exception {if(page == null){page = 1;}PagedResult result = videosService.getAllVideos(video,isSaveRecord,page, PAGE_SIZE);     return JSONResult.ok(result);}@PostMapping(value="/userLike")@ApiOperation(value="热搜词列表", notes="热搜词列表")public JSONResult userLike(String userId,String videoId,String videoCreaterId) throws Exception {videosService.userLikeVideo(userId, videoId, videoCreaterId);return JSONResult.ok();}@PostMapping(value="/userUnLike")public JSONResult userUnLike(String userId,String videoId,String videoCreaterId) throws Exception {videosService.userUnLikeVideo(userId, videoId, videoCreaterId);return JSONResult.ok();}@PostMapping(value="/hot")public JSONResult upload() throws Exception {return JSONResult.ok(videosService.gethostList());}@PostMapping(value="/showMyLike")public JSONResult showMyLike(String userId,Integer page,Integer pageSize) throws Exception {if(StringUtils.isBlank(userId)){return JSONResult.ok();}if(page == null){page = 1;}if(pageSize == null){pageSize = PAGE_SIZE;}PagedResult videoList = videosService.queryMyLikeVideos(userId,page,pageSize);return JSONResult.ok(videoList);}@PostMapping(value="/showMyFollow")public JSONResult showMyFollow(String userId,Integer page,Integer pageSize) throws Exception {if(StringUtils.isBlank(userId)){return JSONResult.ok();}if(page == null){page = 1;}if(pageSize == null){pageSize = PAGE_SIZE;}PagedResult videoList = videosService.queryMyFollowVideos(userId,page,pageSize);return JSONResult.ok(videoList);}}

VideoService.java

package com.idig8.service;import java.util.List;import com.idig8.pojo.Videos;
import com.idig8.utils.PagedResult;public interface VideoService {/*** 保存视频信息* @param Id* @return*/public String saveVideo(Videos video);/*** 分析查询视频列表* @param video* @param isSaveRecord* @param page* @param pageSize* @return*/public PagedResult getAllVideos(Videos video,Integer isSaveRecord,Integer page,Integer pageSize);/*** 获取热搜词列表* @return*/public List<String> gethostList();public void userLikeVideo(String userId,String videoId,String videoCreaterId);public void userUnLikeVideo(String userId,String videoId,String videoCreaterId);public PagedResult queryMyLikeVideos(String userId,Integer page,Integer pageSize);public PagedResult queryMyFollowVideos(String userId,Integer page,Integer pageSize);}

VideoServiceImpl.java

package com.idig8.service.Impl;import java.util.List;import org.n3r.idworker.Sid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.idig8.mapper.SearchRecordsMapper;
import com.idig8.mapper.UsersLikeVideosMapper;
import com.idig8.mapper.UsersMapper;
import com.idig8.mapper.VideosMapper;
import com.idig8.mapper.VideosUsersMapper;
import com.idig8.pojo.SearchRecords;
import com.idig8.pojo.UsersLikeVideos;
import com.idig8.pojo.Videos;
import com.idig8.pojo.vo.VideosVO;
import com.idig8.service.VideoService;
import com.idig8.utils.PagedResult;import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;@Service
public class VideoServiceImpl implements VideoService {@Autowiredprivate VideosMapper videosMapper;@Autowiredprivate UsersMapper usersMapper;@Autowiredprivate VideosUsersMapper videosUsersMapper;@Autowiredprivate SearchRecordsMapper searchRecordsMapper;@Autowiredprivate UsersLikeVideosMapper usersLikeVideosMapper;@Autowiredprivate Sid sid;@Transactional(propagation = Propagation.REQUIRED)public String saveVideo(Videos video) {String id = sid.nextShort();video.setId(id);videosMapper.insertSelective(video);return id;}@Override@Transactional(propagation = Propagation.REQUIRED)public PagedResult getAllVideos(Videos video, Integer isSaveRecord, Integer page, Integer pageSize) {String desc = video.getVideoDesc();String userId = video.getUserId();if (isSaveRecord != null && isSaveRecord == 1) {SearchRecords record = new SearchRecords();String recordId = sid.nextShort();record.setId(recordId);record.setContent(desc);searchRecordsMapper.insert(record);}PageHelper.startPage(page, pageSize);List<VideosVO> list = videosUsersMapper.queryAllVideos(desc,userId);PageInfo<VideosVO> pageList = new PageInfo<>(list);PagedResult result = new PagedResult();result.setPage(page);result.setTotal(pageList.getPages());result.setRows(list);result.setRecords(pageList.getTotal());return result;}@Transactional(propagation = Propagation.SUPPORTS)@Overridepublic List<String> gethostList() {return searchRecordsMapper.gethotList();}@Overridepublic void userLikeVideo(String userId, String videoId, String videoCreaterId) {// 1.保存用戶和视频的关联关系String likeId = sid.nextShort();UsersLikeVideos usersLikeVideos = new UsersLikeVideos();usersLikeVideos.setId(likeId);usersLikeVideos.setUserId(userId);usersLikeVideos.setVideoId(videoId);usersLikeVideosMapper.insert(usersLikeVideos);// 2.视频喜欢的累加videosUsersMapper.addVideoLikeCount(videoId);// 3. 用户喜欢的累加usersMapper.addReceiveLikeCount(userId);}@Overridepublic void userUnLikeVideo(String userId, String videoId, String videoCreaterId) {Example example = new Example(UsersLikeVideos.class);Criteria criteria = example.createCriteria();criteria.andEqualTo("userId", userId);criteria.andEqualTo("videoId", videoId);usersLikeVideosMapper.deleteByExample(example);// 2.视频喜欢的累减videosUsersMapper.reduceVideoLikeCount(videoId);// 3. 用户喜欢的累减usersMapper.reduceReceiveLikeCount(userId);}@Overridepublic PagedResult queryMyLikeVideos(String userId, Integer page, Integer pageSize) {PageHelper.startPage(page,pageSize);List<VideosVO> list = videosUsersMapper.queryMyLikeVideos(userId);PageInfo<VideosVO> pageList = new PageInfo<>(list);PagedResult pagedResult = new PagedResult();pagedResult.setTotal(pageList.getPages());pagedResult.setRows(list);pagedResult.setPage(page);pagedResult.setRecords(pageList.getTotal());return pagedResult;}@Overridepublic PagedResult queryMyFollowVideos(String userId, Integer page, Integer pageSize) {PageHelper.startPage(page,pageSize);List<VideosVO> list = videosUsersMapper.queryMyFollowVideos(userId);PageInfo<VideosVO> pageList = new PageInfo<>(list);PagedResult pagedResult = new PagedResult();pagedResult.setTotal(pageList.getPages());pagedResult.setRows(list);pagedResult.setPage(page);pagedResult.setRecords(pageList.getTotal());return pagedResult;}}

VideosUsersMapper.java

package com.idig8.mapper;import java.util.List;import org.apache.ibatis.annotations.Param;import com.idig8.pojo.vo.VideosVO;
import com.idig8.utils.MyMapper;public interface VideosUsersMapper extends MyMapper<VideosVO> {public List<VideosVO> queryAllVideos(@Param("videoDesc") String videoDesc,@Param("userId")String userId);public void addVideoLikeCount(String videoId);public void reduceVideoLikeCount(String videoId);public List<VideosVO> queryMyLikeVideos(String userId);public List<VideosVO> queryMyFollowVideos(String userId);}

VideosUserMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.idig8.mapper.VideosUsersMapper" ><resultMap id="BaseResultMap" type="com.idig8.pojo.vo.VideosVO" ><!--WARNING - @mbg.generated--><id column="id" property="id" jdbcType="VARCHAR" /><result column="user_id" property="userId" jdbcType="VARCHAR" /><result column="audio_id" property="audioId" jdbcType="VARCHAR" /><result column="video_desc" property="videoDesc" jdbcType="VARCHAR" /><result column="video_path" property="videoPath" jdbcType="VARCHAR" /><result column="video_seconds" property="videoSeconds" jdbcType="REAL" /><result column="video_width" property="videoWidth" jdbcType="INTEGER" /><result column="video_height" property="videoHeight" jdbcType="INTEGER" /><result column="cover_path" property="coverPath" jdbcType="VARCHAR" /><result column="like_counts" property="likeCounts" jdbcType="BIGINT" /><result column="status" property="status" jdbcType="INTEGER" /><result column="create_time" property="createTime" jdbcType="TIMESTAMP" /><result column="username" property="username" jdbcType="VARCHAR" /><result column="face_image" property="faceImage" jdbcType="VARCHAR" /><result column="nickname" property="nickname" jdbcType="VARCHAR" /></resultMap><select id="queryAllVideos" resultMap="BaseResultMap" parameterType="String">select v.*,u.face_image,u.username,u.nickname from videos vleft join users u on v.user_id = u.idwhere 1 = 1<if test="videoDesc !=null  and videoDesc != '' ">and v.video_desc like '%${videoDesc}%'</if><if test="userId !=null  and userId != '' ">and v.user_id = #{userId}</if>and v.status = 1order by v.create_time</select><update id="addVideoLikeCount" parameterType="String">update videos set like_counts=like_counts+1 where id=#{videoId}</update><update id="reduceVideoLikeCount" parameterType="String">update videos set like_counts=like_counts-1 where id=#{videoId}</update><select id="queryMyLikeVideos" resultMap="BaseResultMap" parameterType="String">select v.*,u.face_image as face_image,u.nickname as nickname from videos vleft join users u on v.user_id = u.idwherev.id in (select ulv.video_id from users_like_videos ulv where ulv.user_id = #{userId})and v.status = 1order by v.create_time desc</select><select id="queryMyFollowVideos" resultMap="BaseResultMap" parameterType="String">select v.*,u.face_image as face_image,u.nickname as nickname from videos vleft join users u on v.user_id = u.idwherev.id in (select uf.user_id from users_fans uf where uf.fan_id = #{userId})and v.status = 1order by v.create_time desc</select>
</mapper>

小程序开发

mine.js

// pages/mine/mine.js
const app = getApp()
var videoUtils = require('../../utils/videoUtils.js')
Page({/*** 页面的初始数据*/data: {faceImage: "../../resource/images/noneface.png",nickname: "昵称",fansCounts: 0,followCounts: 0,receiveLikeCounts: 0,isMe:true,isFollow:false,publisherId: '',videoSelClass: "video-info",isSelectedWork: "video-info-selected",isSelectedLike: "",isSelectedFollow: "",myVideoList: [],myVideoPage: 1,myVideoTotal: 1,likeVideoList: [],likeVideoPage: 1,likeVideoTotal: 1,followVideoList: [],followVideoPage: 1,followVideoTotal: 1,myWorkFalg: false,myLikesFalg: true,myFollowFalg: true},/*** 用户注销*/logout: function(e) {var user = app.getGlobalUserInfo();wx.showLoading({title: '正在注销中。。。'});wx.request({url: app.serverUrl + "/logout?userId=" + user.id,method: "POST",header: {'content-type': 'application/json' // 默认值},success: function(res) {console.log(res.data);var status = res.data.status;wx.hideLoading();if (status == 200) {wx.showToast({title: "用户注销成功~!",icon: 'none',duration: 3000})// app.userInfo = null;wx.removeStorageSync("userInfo");wx.redirectTo({url: '../userRegister/userRegister',})} else if (status == 500) {wx.showToast({title: res.data.msg,icon: 'none',duration: 3000})}}})},followMe: function (e) {var me = this;var user = app.getGlobalUserInfo();var userId = user.id;var publisherId = me.data.publisherId;var followType = e.currentTarget.dataset.followtype;// 1:关注 0:取消关注var url = '';if (followType == '1') {url = '/user/beyourfans?userId=' + publisherId + '&fanId=' + userId;} else {url = '/user/dontbeyourfans?userId=' + publisherId + '&fanId=' + userId;}wx.showLoading();wx.request({url: app.serverUrl + url,method: 'POST',header: {'content-type': 'application/json', // 默认值'headerUserId': user.id,'headerUserToken': user.userToken},success: function () {wx.hideLoading();if (followType == '1') {me.setData({isFollow: true,fansCounts: ++me.data.fansCounts})} else {me.setData({isFollow: false,fansCounts: --me.data.fansCounts})}}})},/*** 头像上传*/uploadFace: function(e) {// var user = app.userInfo;var user = app.getGlobalUserInfo();var me = this;wx.chooseImage({count: 1, // 默认9sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有success: function(res) {// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片var tempFilePaths = res.tempFilePathsif (tempFilePaths.length > 0) {console.log(tempFilePaths[0]);wx.uploadFile({url: app.serverUrl + "/user/uploadFace?userId=" + user.id, //仅为示例,非真实的接口地址filePath: tempFilePaths[0],name: 'file',success: function(res) {var data = JSON.parse(res.data);console.log(data);wx.hideLoading();if (data.status == 200) {wx.showToast({title: "用户上传成功~!",icon: 'none',duration: 3000})me.setData({faceUrl: app.serverUrl + data.data})} else if (data.status == 500) {wx.showToast({title: data.msg,icon: 'none',duration: 3000})}}})}}})},/*** 生命周期函数--监听页面加载*/onLoad: function(params) {var me = this;var userInfo = app.getGlobalUserInfo();var publisherId = params.publisherId;var userId = userInfo.id;if (publisherId != null && publisherId != '' && publisherId!=undefined){userId = publisherId;me.setData({isMe:false,publisherId: publisherId,})}wx.showLoading({title: '正在获取用户信息。。。'});wx.request({url: app.serverUrl + "/user/queryByUserId?userId=" + userId + "&fanId" + userInfo.id,method: "POST",header: {'content-type': 'application/json', // 默认值'headerUserId': userInfo.id,'headerUserToken': userInfo.userToken},success: function(res) {console.log(res.data);var status = res.data.status;if (status == 200) {var userInfo = res.data.data;wx.hideLoading();var faceImage = me.data.faceUrl;if (userInfo.faceImage != null && userInfo.faceImage != '' && userInfo.faceImage != undefined) {faceImage = app.serverUrl + userInfo.faceImage;}me.setData({faceImage: faceImage,fansCounts: userInfo.fansCounts,followCounts: userInfo.followCounts,receiveLikeCounts: userInfo.receiveLikeCounts,nickname: userInfo.nickname,isFollow: userInfo.follow})me.getMyVideoList(1)} else if (status == 502){wx.showToast({title: res.data.msg,duration:3000,icon:'none',complete:function(){wx.removeStorageSync("userInfo");wx.navigateTo({url: '../userLogin/userLogin',})}})}}})},uploadVideo: function(e) {videoUtils.uploadVideo();},doSelectWork: function () {this.setData({isSelectedWork: "video-info-selected",isSelectedLike: "",isSelectedFollow: "",myWorkFalg: false,myLikesFalg: true,myFollowFalg: true,myVideoList: [],myVideoPage: 1,myVideoTotal: 1,likeVideoList: [],likeVideoPage: 1,likeVideoTotal: 1,followVideoList: [],followVideoPage: 1,followVideoTotal: 1});this.getMyVideoList(1);},doSelectLike: function () {this.setData({isSelectedWork: "",isSelectedLike: "video-info-selected",isSelectedFollow: "",myWorkFalg: true,myLikesFalg: false,myFollowFalg: true,myVideoList: [],myVideoPage: 1,myVideoTotal: 1,likeVideoList: [],likeVideoPage: 1,likeVideoTotal: 1,followVideoList: [],followVideoPage: 1,followVideoTotal: 1});this.getMyLikesList(1);},doSelectFollow: function () {this.setData({isSelectedWork: "",isSelectedLike: "",isSelectedFollow: "video-info-selected",myWorkFalg: true,myLikesFalg: true,myFollowFalg: false,myVideoList: [],myVideoPage: 1,myVideoTotal: 1,likeVideoList: [],likeVideoPage: 1,likeVideoTotal: 1,followVideoList: [],followVideoPage: 1,followVideoTotal: 1});this.getMyFollowList(1)},getMyVideoList: function (page) {var me = this;// 查询视频信息wx.showLoading();// 调用后端var serverUrl = app.serverUrl;wx.request({url: serverUrl + '/video/showAll/?page=' + page + '&pageSize=6',method: "POST",data: {userId: me.data.userId},header: {'content-type': 'application/json' // 默认值},success: function (res) {console.log(res.data);var myVideoList = res.data.data.rows;wx.hideLoading();var newVideoList = me.data.myVideoList;me.setData({myVideoPage: page,myVideoList: newVideoList.concat(myVideoList),myVideoTotal: res.data.data.total,serverUrl: app.serverUrl});}})},getMyLikesList: function (page) {var me = this;var userId = me.data.userId;// 查询视频信息wx.showLoading();// 调用后端var serverUrl = app.serverUrl;wx.request({url: serverUrl + '/video/showMyLike/?userId=' + userId + '&page=' + page + '&pageSize=6',method: "POST",header: {'content-type': 'application/json' // 默认值},success: function (res) {console.log(res.data);var likeVideoList = res.data.data.rows;wx.hideLoading();var newVideoList = me.data.likeVideoList;me.setData({likeVideoPage: page,likeVideoList: newVideoList.concat(likeVideoList),likeVideoTotal: res.data.data.total,serverUrl: app.serverUrl});}})},getMyFollowList: function (page) {var me = this;var userId = me.data.userId;// 查询视频信息wx.showLoading();// 调用后端var serverUrl = app.serverUrl;wx.request({url: serverUrl + '/video/showMyFollow/?userId=' + userId + '&page=' + page + '&pageSize=6',method: "POST",header: {'content-type': 'application/json' // 默认值},success: function (res) {console.log(res.data);var followVideoList = res.data.data.rows;wx.hideLoading();var newVideoList = me.data.followVideoList;me.setData({followVideoPage: page,followVideoList: newVideoList.concat(followVideoList),followVideoTotal: res.data.data.total,serverUrl: app.serverUrl});}})},// 点击跳转到视频详情页面showVideo: function (e) {console.log(e);var myWorkFalg = this.data.myWorkFalg;var myLikesFalg = this.data.myLikesFalg;var myFollowFalg = this.data.myFollowFalg;if (!myWorkFalg) {var videoList = this.data.myVideoList;} else if (!myLikesFalg) {var videoList = this.data.likeVideoList;} else if (!myFollowFalg) {var videoList = this.data.followVideoList;}var arrindex = e.target.dataset.arrindex;var videoInfo = JSON.stringify(videoList[arrindex]);wx.redirectTo({url: '../videoinfo/videoinfo?videoInfo=' + videoInfo})},// 到底部后触发加载onReachBottom: function () {var myWorkFalg = this.data.myWorkFalg;var myLikesFalg = this.data.myLikesFalg;var myFollowFalg = this.data.myFollowFalg;if (!myWorkFalg) {var currentPage = this.data.myVideoPage;var totalPage = this.data.myVideoTotal;// 获取总页数进行判断,如果当前页数和总页数相等,则不分页if (currentPage === totalPage) {wx.showToast({title: '已经没有视频啦...',icon: "none"});return;}var page = currentPage + 1;this.getMyVideoList(page);} else if (!myLikesFalg) {var currentPage = this.data.likeVideoPage;var totalPage = this.data.myLikesTotal;// 获取总页数进行判断,如果当前页数和总页数相等,则不分页if (currentPage === totalPage) {wx.showToast({title: '已经没有视频啦...',icon: "none"});return;}var page = currentPage + 1;this.getMyLikesList(page);} else if (!myFollowFalg) {var currentPage = this.data.followVideoPage;var totalPage = this.data.followVideoTotal;// 获取总页数进行判断,如果当前页数和总页数相等,则不分页if (currentPage === totalPage) {wx.showToast({title: '已经没有视频啦...',icon: "none"});return;}var page = currentPage + 1;this.getMyFollowList(page);}}})

mine.wxml

<view><view class='container'><image src="{{faceImage}}" class="face" bindtap='uploadFace'></image><label class='nickname'>{{nickname}}</label><block wx:if='{{isMe}}'><button size='mini' class='primary' bindtap='uploadVideo'> 上传作品</button><button size='mini' type='' class='logout' bindtap='logout'>注销</button></block><block wx:if='{{!isMe}}'><block wx:if='{{isFollow}}'><button size='mini' type='' class='follow' data-followType='0' bindtap='followMe'>已关注</button></block><block wx:if='{{!isFollow}}'><button size='mini' type='primary' class='follow' data-followType='1' bindtap='followMe'>关注我</button></block></block><view class='container-row'><label class='info-items'>{{fansCounts}} 粉丝</label><label class='info-items'>{{followCounts}} 关注</label><label class='info-items'>{{receiveLikeCounts}} 获赞</label></view></view></view><view class="line"></view><view class='container-video'><!-- 发布过的作品 --><view class='{{videoSelClass}} {{isSelectedWork}}' bindtap='doSelectWork'>作品</view><!-- 收藏的点赞的视频 --><view class='{{videoSelClass}} {{isSelectedLike}}' bindtap='doSelectLike'>收藏</view><!-- 用户关注过人发表的视频 --><view class='{{videoSelClass}} {{isSelectedFollow}}' bindtap='doSelectFollow'>关注</view>
</view><view class='container-video-list'><view hidden='{{myWorkFalg}}'><block wx:for="{{myVideoList}}"><image src='{{serverUrl}}{{item.coverPath}}' class='videoImage' mode="aspectFill" bindtap='showVideo' data-arrindex='{{index}}'></image></block></view><view hidden='{{myLikesFalg}}'><block wx:for="{{likeVideoList}}"><image src='{{serverUrl}}{{item.coverPath}}' class='videoImage' mode="aspectFill" bindtap='showVideo' data-arrindex='{{index}}'></image></block></view><view hidden='{{myFollowFalg}}'><block wx:for="{{followVideoList}}"><image src='{{serverUrl}}{{item.coverPath}}' class='videoImage' mode="aspectFill" bindtap='showVideo' data-arrindex='{{index}}'></image></block></view></view>

PS:基本操作,获取作品列表,关注列表,收藏列表

「小程序JAVA实战」小程序的个人信息作品,收藏,关注(66)相关推荐

  1. 「小程序JAVA实战」 小程序远程调试(九)

    在开发javaweb应用的时候,如果遇见一个问题都会调试,debug,在火狐和谷歌浏览器的时候我们也可以使用断点的方式调试js,小程序可以吗?肯定是可以的!小程序的调试也可以在手机端进行远程调试.源码 ...

  2. 「小程序JAVA实战」小程序的举报功能开发(68)

    转自:https://idig8.com/2018/09/25/xiaochengxujavashizhanxiaochengxudeweixinapicaidancaozuo66-2/ 通过点击举报 ...

  3. 「小程序JAVA实战」小程序头像图片上传(下)(45)

    转自:https://idig8.com/2018/09/09/xiaochengxujavashizhanxiaochengxutouxiangtupianshangchuan44/ 接下来,我们应 ...

  4. miniui datagrid 隐藏列默认赋值_「小程序JAVA实战」 小程序默认加载的页面和生命周期(八)...

    小程序如何加载的呢?生命周期!源码:https://github.com/limingios/wxProgram.git 中的No.3 加载页面 小程序默认加载的pages中的第一个目录 不管你的名称 ...

  5. multipartfile file java 怎么获取里面的属性_「小程序JAVA实战」小程序的举报功能开发(68)...

    通过点击举报按钮,跳转到举报页面完成举报操作. 后台开发 获取发布人的userId,videoId,创建者的Id controller UserController.java package com. ...

  6. 「小程序JAVA实战」小程序的留言和评价功能(70)

    转自:https://idig8.com/2018/10/28/xiaochengxujavashizhanxiaochengxudeliuyanhepingjiagongneng69/ 目前小程序这 ...

  7. 「小程序JAVA实战」小程序我的个人信息页面开发(41)

    转自:https://idig8.com/2018/09/05/xiaochengxujavashizhanxiaochengxuwodegerenxinxiyemiankaifa40/ 已经完成了登 ...

  8. 「小程序JAVA实战」小程序的页面重定向(60)

    转自:https://idig8.com/2018/09/24/xiaochengxujavashizhanxiaochengxudeyemianzhongdingxiang59/ 在我们正常的浏览网 ...

  9. 小程序 video 控制器外观调整_「小程序JAVA实战」小程序视频组件与api介绍(51)...

    这次说下,小程序的视频组件,之前在说小程序基础的时候视频组件没说,现在说下.从属性和api都说下.https://github.com/limingios/wxProgram.git 中No.15 视 ...

最新文章

  1. 安装 sklearn 报错 ImportError: cannot import name Type
  2. MYSQL:1045Access denied for user 'root'@'localhost
  3. cvc降噪和主动降噪_降噪蓝牙耳机哪款好?300内建议入手的五款主动降噪蓝牙耳机...
  4. static在内存层面的作用_static的作用和内存划分?
  5. QT的Q3DBars类的使用
  6. 利用正则匹配数字后边的字符_图解正则——字符匹配
  7. android实现滑动切换图,Android:使用ViewPager实现左右滑动切换图片加点点
  8. 痛苦的vsftpd配置
  9. 快速排序(c语言实现)
  10. [图形学]ASTC纹理压缩格式
  11. (转)sonicstage 完整删除的方法
  12. 2023北京国际老年产业博览会/养老产业展/养老服务业展
  13. kali虚拟机-----破解wifi密码(WiFi渗透)
  14. dnfdpl服务器维护了,DNF2019DPL机制介绍 以及本次DPL怪物顺序汇总
  15. JavaScript 音乐播放器
  16. MacOs Catalina “无法打开,因为无法验证开发者”
  17. 百度地图开发(3)实现本地两点间步行导航
  18. 独立站导航栏装修指南
  19. (三)改掉这些坏习惯,还怕写不出优雅的代码?
  20. Android各国语言Values文件夹命名规则

热门文章

  1. TypeError: can‘t compare offset-naive and offset-aware datetimes
  2. LibreCAD v2.2.0源码编译,使用VS2019+Qt5.12.9+Boost1.71.0环境
  3. 201903-2二十四点[20201213封笔题目]没写呢
  4. Git提交报错git-upload-pack
  5. fiddle 下载及配置
  6. 堆和栈的区别(内存和数据结构)
  7. 网页底部固定版权信息
  8. Qt QList详解
  9. 周三多《管理学—原理与方法》第七版笔记和课后习题答案
  10. 容器学习Day11-docker commit构建容器镜像