当前位置:网站首页>抖音实战~分享模块~生成短视频二维码
抖音实战~分享模块~生成短视频二维码
2022-06-26 18:52:00 【gblfy】



文章目录
一、可见范围
保存到相册、复制链接、二维码 都是前端完成的
1. 自己发布短视频
自己发布的短视频会有“保存到相册、复制链接、二维码、转为私密”
2. 其他人发布短视频
其他人发布短视频,自己只能看到“保存到相册、复制链接、二维码”
二、源码分析
2.1. 底部窗口popup
<view>
<!-- 底部窗口popup -->
<uni-popup ref="comment" type="comment">
<uni-popup-comments :thisVlogerId="thisVlogerId" :thisVlogId="thisVlogId"></uni-popup-comments>
</uni-popup>
<uni-popup ref="share" background-color="#fff" type="share">
<uni-popup-share :thisVlogerId="thisVlogerId" :thisVlogId="thisVlogId" :vlogUrl="thisVlog.url"
:isPrivate="thisVlog.isPrivate"></uni-popup-share>
</uni-popup>
</view>
2.2. 实现组件uQRCode
插件链接:https://ext.dcloud.net.cn/plugin?id=1287
组件案例:
2.3. 插件涉及组件

2.4. 组件改造
uQRCode基于uqrcode.js实现
gotoQRCode() {
uni.navigateTo({
url: "/pages/qrcode/qrcode?vlogId=" + this.thisVlogId
})
},
onReady() {
var vlogId = this.vlogId;
var content = {
type: "vlog",
content: vlogId
};
var contentStr = JSON.stringify(content);
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
size: 170,
margin: 10,
text: contentStr,
backgroundColor: '#ffffff',
foregroundColor: '#0f0827',
fileType: 'png',
errorCorrectLevel: uQRCode.errorCorrectLevel.H
})
.then(res => {
})
},
2.5. 实现原理
- 1.其实生成短视频二维码就是短视频的发布ID
- 2.当微信扫描只会显示二维码生成的type和content文字内容,是因为没有对文字进行其他的操作。
- 3.咱们抖音app当你扫描二维码时,做了以下几件事:
- 3.1. 第一件事和微信扫描一样解析二维码后面的文字信息
- 3.2. 获取短视频发布ID后,调用了后端短视频详情的api接口
- 3.3.调用完接口后,有对短视频详情进行了短视频信息转视频的处理(其实就是预览短视频而已),和搜索页面实现的原理是一样的。
后期会补充实现原理流程图,为大家详细揭晓
三、作品鉴赏
3.1. 生成短视频二维码

3.2. 微信扫描

3.3. 抖音扫描


边栏推荐
- 最小生成树、最短路径、拓扑排序、关键路径
- The successfully resolved idea cannot use the log normally after referencing Lombok's @slf4j
- IK分词器
- Logstash安装及使用
- (树) 树状数组
- Using cache in vuex to solve the problem of data loss in refreshing state
- PC端录制扫515地机器人/scan数据
- 8VC Venture Cup 2017 - Final Round C. Nikita and stack
- 数据库范式和主码的选择
- Deep learning: numpy
猜你喜欢
随机推荐
物联网协议的王者:MQTT
手机影像内卷几时休?
知识点总结
字符串String转换为jsonArray并解析
一些基本错误
SSO微服务工程中用户行为日志的记录
Installation and use of logstash
Image binarization
微服务版单点登陆系统(SSO)
Redis单点登陆系统+投票系统
9. Intelligent transportation project (2)
Leetcode 238 product of arrays other than itself
CD-CompactDisk
品达通用权限系统(Day 3~Day 4)
ARM裸板调试之串口打印及栈初步分析
项目实战四:用户登录及token访问验证(reids+jwt)
Usage and difference between ros:: spinonce() and ros:: spin()
Record of user behavior log in SSO microservice Engineering
Using cache in vuex to solve the problem of data loss in refreshing state
sql 中的alter操作总结









