video update
This commit is contained in:
parent
3d0d5fd05e
commit
46c40ce3a4
|
@ -96,7 +96,7 @@
|
||||||
<el-form-item label="描述" prop="description">
|
<el-form-item label="描述" prop="description">
|
||||||
<el-input v-model="material.description" placeholder="描述" />
|
<el-input v-model="material.description" placeholder="描述" />
|
||||||
</el-form-item>
|
</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
|
<el-upload
|
||||||
accept=".png, .jpeg, .jpg"
|
accept=".png, .jpeg, .jpg"
|
||||||
:before-upload="beforeUploadP"
|
:before-upload="beforeUploadP"
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
<img v-if="material.poster" :src="material.poster" class="avatar" />
|
<img v-if="material.poster" :src="material.poster" class="avatar" />
|
||||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item :label="material.type=='文档'?'文件':'视频'" prop="path">
|
<el-form-item :label="material.type=='文档'?'文件':'视频'" prop="path">
|
||||||
<el-upload
|
<el-upload
|
||||||
v-if="material.type=='文档'"
|
v-if="material.type=='文档'"
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
>
|
>
|
||||||
<el-button size="small" type="primary">点击上传</el-button>
|
<el-button size="small" type="primary">点击上传</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<el-upload
|
<!-- <el-upload
|
||||||
v-else
|
v-else
|
||||||
class="avatar-uploader"
|
class="avatar-uploader"
|
||||||
:action="upUrl"
|
:action="upUrl"
|
||||||
|
@ -150,7 +150,8 @@
|
||||||
style="margin-top:30px;"
|
style="margin-top:30px;"
|
||||||
></el-progress>
|
></el-progress>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<div >请保证视频格式正确,且不超过100M</div>
|
<div >请保证视频格式正确,且不超过100M</div> -->
|
||||||
|
<el-input v-else v-model="material.path" placeholder="腾讯视频地址" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,9 @@ App({
|
||||||
globalData: {
|
globalData: {
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
userinfo: {}, // 服务器传回的消费者信息
|
userinfo: {}, // 服务器传回的消费者信息
|
||||||
host: 'https://apitest.ahctc.cn',
|
//host: 'https://apitest.ahctc.cn',
|
||||||
mediahost: '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',
|
//mediahost: 'http://127.0.0.1:8000',
|
||||||
token : '',
|
token : '',
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
"pages/material/index",
|
"pages/material/index",
|
||||||
"pages/question/detail",
|
"pages/question/detail",
|
||||||
"pages/candidate/index",
|
"pages/candidate/index",
|
||||||
"pages/candidate/detail"
|
"pages/candidate/detail",
|
||||||
|
"pages/material/video"
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"backgroundTextStyle": "light",
|
"backgroundTextStyle": "light",
|
||||||
|
@ -58,6 +59,12 @@
|
||||||
"selectedIconPath": "images/datac.png",
|
"selectedIconPath": "images/datac.png",
|
||||||
"text": "资料"
|
"text": "资料"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/material/video",
|
||||||
|
"iconPath": "images/play.png",
|
||||||
|
"selectedIconPath": "images/playc.png",
|
||||||
|
"text": "视频"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/my/index",
|
"pagePath": "pages/my/index",
|
||||||
"iconPath": "images/me.png",
|
"iconPath": "images/me.png",
|
||||||
|
@ -75,6 +82,12 @@
|
||||||
"l-message": "/miniprogram_npm/lin-ui/message/index",
|
"l-message": "/miniprogram_npm/lin-ui/message/index",
|
||||||
"l-button": "/miniprogram_npm/lin-ui/button/index"
|
"l-button": "/miniprogram_npm/lin-ui/button/index"
|
||||||
},
|
},
|
||||||
|
"plugins": {
|
||||||
|
"tencentvideo": {
|
||||||
|
"version": "1.3.3",
|
||||||
|
"provider": "wxa75efa648b60994b"
|
||||||
|
}
|
||||||
|
},
|
||||||
"style": "v2",
|
"style": "v2",
|
||||||
"sitemapLocation": "sitemap.json"
|
"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: [],
|
results: [],
|
||||||
query: {
|
query: {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10
|
limit: 10,
|
||||||
|
type:'文档'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"usingComponents": {},
|
"usingComponents": {
|
||||||
|
},
|
||||||
"enablePullDownRefresh": true,
|
"enablePullDownRefresh": true,
|
||||||
"onReachBottomDistance": 50
|
"onReachBottomDistance": 50
|
||||||
}
|
}
|
|
@ -17,7 +17,7 @@
|
||||||
{{item.description}}
|
{{item.description}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-panel__ft weui-cell__ft_in-access">
|
<view class="weui-panel__ft">
|
||||||
<view class="weui-media-box__desc">
|
<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>
|
<a class="weui-btn weui-btn_mini weui-btn_primary" bindtap="downFile" data-id="{{item.id}}" data-index="{{index}}">下载</a>
|
||||||
</view>
|
</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": [],
|
"disablePlugins": [],
|
||||||
"outputPath": ""
|
"outputPath": ""
|
||||||
},
|
},
|
||||||
"useCompilerModule": false,
|
"useCompilerModule": true,
|
||||||
"userConfirmedUseCompilerModuleSwitch": false,
|
"userConfirmedUseCompilerModuleSwitch": false,
|
||||||
"compileHotReLoad": false,
|
"compileHotReLoad": false,
|
||||||
"useIsolateContext": true
|
"useIsolateContext": true
|
||||||
|
|
|
@ -19,8 +19,14 @@ class ArticelListSerializer(serializers.ModelSerializer):
|
||||||
exclude = ('content',)
|
exclude = ('content',)
|
||||||
|
|
||||||
class MaterialSerializer(serializers.ModelSerializer):
|
class MaterialSerializer(serializers.ModelSerializer):
|
||||||
|
vid = serializers.SerializerMethodField(read_only=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Material
|
model = Material
|
||||||
fields = '__all__'
|
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']
|
search_fields = ['name','description']
|
||||||
ordering_fields = ['update_time', 'down_count']
|
ordering_fields = ['update_time', 'down_count']
|
||||||
ordering = ['-down_count']
|
ordering = ['-down_count']
|
||||||
|
filterset_fields = ['type']
|
||||||
|
|
||||||
@action(methods=['get'], detail=True, url_name='down_material', perms_map=[{'*':'down_material'}])
|
@action(methods=['get'], detail=True, url_name='down_material', perms_map=[{'*':'down_material'}])
|
||||||
def down(self, request, *args, **kwargs):
|
def down(self, request, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue