video update
This commit is contained in:
parent
3d0d5fd05e
commit
46c40ce3a4
|
@ -96,7 +96,7 @@
|
|||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="material.description" placeholder="描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="封面" prop="poster" v-if="material.type=='视频'">
|
||||
<!-- <el-form-item label="封面" prop="poster" v-if="material.type=='视频'">
|
||||
<el-upload
|
||||
accept=".png, .jpeg, .jpg"
|
||||
:before-upload="beforeUploadP"
|
||||
|
@ -109,7 +109,7 @@
|
|||
<img v-if="material.poster" :src="material.poster" class="avatar" />
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item :label="material.type=='文档'?'文件':'视频'" prop="path">
|
||||
<el-upload
|
||||
v-if="material.type=='文档'"
|
||||
|
@ -123,7 +123,7 @@
|
|||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
</el-upload>
|
||||
<el-upload
|
||||
<!-- <el-upload
|
||||
v-else
|
||||
class="avatar-uploader"
|
||||
:action="upUrl"
|
||||
|
@ -150,7 +150,8 @@
|
|||
style="margin-top:30px;"
|
||||
></el-progress>
|
||||
</el-upload>
|
||||
<div >请保证视频格式正确,且不超过100M</div>
|
||||
<div >请保证视频格式正确,且不超过100M</div> -->
|
||||
<el-input v-else v-model="material.path" placeholder="腾讯视频地址" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
|
@ -68,9 +68,9 @@ App({
|
|||
globalData: {
|
||||
userInfo: {},
|
||||
userinfo: {}, // 服务器传回的消费者信息
|
||||
host: 'https://apitest.ahctc.cn',
|
||||
//host: 'https://apitest.ahctc.cn',
|
||||
mediahost: 'https://apitest.ahctc.cn',
|
||||
//host: 'http://127.0.0.1:8000',
|
||||
host: 'http://127.0.0.1:8000',
|
||||
//mediahost: 'http://127.0.0.1:8000',
|
||||
token : '',
|
||||
}
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
"pages/material/index",
|
||||
"pages/question/detail",
|
||||
"pages/candidate/index",
|
||||
"pages/candidate/detail"
|
||||
"pages/candidate/detail",
|
||||
"pages/material/video"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
|
@ -58,6 +59,12 @@
|
|||
"selectedIconPath": "images/datac.png",
|
||||
"text": "资料"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/material/video",
|
||||
"iconPath": "images/play.png",
|
||||
"selectedIconPath": "images/playc.png",
|
||||
"text": "视频"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/my/index",
|
||||
"iconPath": "images/me.png",
|
||||
|
@ -75,6 +82,12 @@
|
|||
"l-message": "/miniprogram_npm/lin-ui/message/index",
|
||||
"l-button": "/miniprogram_npm/lin-ui/button/index"
|
||||
},
|
||||
"plugins": {
|
||||
"tencentvideo": {
|
||||
"version": "1.3.3",
|
||||
"provider": "wxa75efa648b60994b"
|
||||
}
|
||||
},
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json"
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 939 B |
|
@ -9,7 +9,8 @@ Page({
|
|||
results: [],
|
||||
query: {
|
||||
page: 1,
|
||||
limit: 10
|
||||
limit: 10,
|
||||
type:'文档'
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"usingComponents": {},
|
||||
"usingComponents": {
|
||||
},
|
||||
"enablePullDownRefresh": true,
|
||||
"onReachBottomDistance": 50
|
||||
}
|
|
@ -1,30 +1,30 @@
|
|||
<view class="head">
|
||||
|
||||
{{count}}份资料</view>
|
||||
{{count}}份资料</view>
|
||||
<view class="weui-cells weui-cells_after-title">
|
||||
<block wx:for="{{results}}" wx:key="unique">
|
||||
<view class="weui-media-box weui-media-box_appmsg">
|
||||
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">
|
||||
<image wx:if="{{item.path.indexOf('.pdf')!=-1}}" class="weui-media-box__thumb" src="/images/pdf.svg"></image>
|
||||
<image wx:elif="{{item.path.indexOf('.doc')!=-1 || item.path.indexOf('.docx')!=-1}}" class="weui-media-box__thumb" src="/images/word.svg"></image>
|
||||
<image wx:elif="{{item.path.indexOf('.ppt')!=-1 || item.path.indexOf('.pptx')!=-1}}" class="weui-media-box__thumb" src="/images/ppt.svg"></image>
|
||||
<image wx:else class="weui-media-box__thumb" src="/images/file.svg"></image>
|
||||
</view>
|
||||
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||
<view class="weui-media-box__title">
|
||||
{{item.name}}</view>
|
||||
<view class="weui-media-box__desc">
|
||||
{{item.description}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-panel__ft weui-cell__ft_in-access">
|
||||
<view class="weui-media-box__desc">
|
||||
<a class="weui-btn weui-btn_mini weui-btn_primary" bindtap="downFile" data-id="{{item.id}}" data-index="{{index}}">下载</a>
|
||||
</view>
|
||||
<view class="weui-media-box__desc">
|
||||
下载量:<span style="color:darkblue;font-weight:bold">{{item.down_count}}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:for="{{results}}" wx:key="unique">
|
||||
<view class="weui-media-box weui-media-box_appmsg">
|
||||
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">
|
||||
<image wx:if="{{item.path.indexOf('.pdf')!=-1}}" class="weui-media-box__thumb" src="/images/pdf.svg"></image>
|
||||
<image wx:elif="{{item.path.indexOf('.doc')!=-1 || item.path.indexOf('.docx')!=-1}}" class="weui-media-box__thumb" src="/images/word.svg"></image>
|
||||
<image wx:elif="{{item.path.indexOf('.ppt')!=-1 || item.path.indexOf('.pptx')!=-1}}" class="weui-media-box__thumb" src="/images/ppt.svg"></image>
|
||||
<image wx:else class="weui-media-box__thumb" src="/images/file.svg"></image>
|
||||
</view>
|
||||
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||
<view class="weui-media-box__title">
|
||||
{{item.name}}</view>
|
||||
<view class="weui-media-box__desc">
|
||||
{{item.description}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-panel__ft">
|
||||
<view class="weui-media-box__desc">
|
||||
<a class="weui-btn weui-btn_mini weui-btn_primary" bindtap="downFile" data-id="{{item.id}}" data-index="{{index}}">下载</a>
|
||||
</view>
|
||||
<view class="weui-media-box__desc">
|
||||
下载量:<span style="color:darkblue;font-weight:bold">{{item.down_count}}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
|
@ -0,0 +1,101 @@
|
|||
// pages/lianxi/index.js
|
||||
const api = require("../../utils/request.js");
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
results: [],
|
||||
query: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
type:'视频'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function () {
|
||||
var that = this
|
||||
that.getList(that.data.query)
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
},
|
||||
getList: function () {
|
||||
var that = this
|
||||
api.request('/cms/material/', 'GET', that.data.query).then(res => {
|
||||
if (that.data.query.page == 1) {
|
||||
that.data.results = res.data.results
|
||||
} else {
|
||||
that.data.results = that.data.results.concat(res.data.results)
|
||||
}
|
||||
|
||||
that.setData({
|
||||
results: that.data.results,
|
||||
count: res.data.count
|
||||
})
|
||||
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
var that = this
|
||||
that.data.query.page = 1;
|
||||
that.getList();
|
||||
wx.stopPullDownRefresh();
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
var that = this
|
||||
if (that.data.count <= that.data.query.page * that.data.query.limit) {
|
||||
wx.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
that.data.query.page = that.data.query.page + 1
|
||||
that.getList()
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
|
||||
})
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"usingComponents": {
|
||||
"txv-video": "plugin://tencentvideo/video"
|
||||
},
|
||||
"enablePullDownRefresh": true,
|
||||
"onReachBottomDistance": 50
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<view style="text-align:center" wx:if="{{count==0}}">暂无视频资源</view>
|
||||
<block wx:for="{{results}}" wx:key="unique">
|
||||
<view class="weui-panel">
|
||||
<txv-video
|
||||
vid="{{item.vid}}"
|
||||
playerid="txv1">
|
||||
<view class='txv-video-slot'>{{item.name}}</view>
|
||||
</txv-video>
|
||||
<view style="color:darkblue;text-align:center" >{{item.name}}</view>
|
||||
</view>
|
||||
</block>
|
|
@ -0,0 +1,13 @@
|
|||
.head{
|
||||
color:#fff;
|
||||
background-color: cornflowerblue;
|
||||
text-align: center;
|
||||
}
|
||||
.txv-video-slot{
|
||||
width: 80px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
margin: 10px;
|
||||
}
|
|
@ -23,7 +23,7 @@
|
|||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"useCompilerModule": false,
|
||||
"useCompilerModule": true,
|
||||
"userConfirmedUseCompilerModuleSwitch": false,
|
||||
"compileHotReLoad": false,
|
||||
"useIsolateContext": true
|
||||
|
|
|
@ -19,8 +19,14 @@ class ArticelListSerializer(serializers.ModelSerializer):
|
|||
exclude = ('content',)
|
||||
|
||||
class MaterialSerializer(serializers.ModelSerializer):
|
||||
vid = serializers.SerializerMethodField(read_only=True)
|
||||
class Meta:
|
||||
model = Material
|
||||
fields = '__all__'
|
||||
|
||||
def get_vid(self, obj):
|
||||
if obj.type == '视频':
|
||||
return obj.path.split('/')[-1].replace('.html', '')
|
||||
else:
|
||||
return ''
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ class MaterialViewSet(ModelViewSet):
|
|||
search_fields = ['name','description']
|
||||
ordering_fields = ['update_time', 'down_count']
|
||||
ordering = ['-down_count']
|
||||
filterset_fields = ['type']
|
||||
|
||||
@action(methods=['get'], detail=True, url_name='down_material', perms_map=[{'*':'down_material'}])
|
||||
def down(self, request, *args, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue