diff --git a/test_client/src/views/material/material.vue b/test_client/src/views/material/material.vue
index 11b8e64..57f9665 100644
--- a/test_client/src/views/material/material.vue
+++ b/test_client/src/views/material/material.vue
@@ -96,7 +96,7 @@
-
+
点击上传
-
- 请保证视频格式正确,且不超过100M
+ 请保证视频格式正确,且不超过100M
-->
+
diff --git a/test_mini/app.js b/test_mini/app.js
index a7c9ddb..ad0d1c5 100644
--- a/test_mini/app.js
+++ b/test_mini/app.js
@@ -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 : '',
}
diff --git a/test_mini/app.json b/test_mini/app.json
index e876a1e..76b614b 100644
--- a/test_mini/app.json
+++ b/test_mini/app.json
@@ -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"
}
\ No newline at end of file
diff --git a/test_mini/images/play.png b/test_mini/images/play.png
new file mode 100644
index 0000000..2416934
Binary files /dev/null and b/test_mini/images/play.png differ
diff --git a/test_mini/images/playc.png b/test_mini/images/playc.png
new file mode 100644
index 0000000..3d5b4a4
Binary files /dev/null and b/test_mini/images/playc.png differ
diff --git a/test_mini/images/video.png b/test_mini/images/video.png
new file mode 100644
index 0000000..b00c2d2
Binary files /dev/null and b/test_mini/images/video.png differ
diff --git a/test_mini/pages/material/index.js b/test_mini/pages/material/index.js
index 1b6dd92..b15bf28 100644
--- a/test_mini/pages/material/index.js
+++ b/test_mini/pages/material/index.js
@@ -9,7 +9,8 @@ Page({
results: [],
query: {
page: 1,
- limit: 10
+ limit: 10,
+ type:'文档'
}
},
diff --git a/test_mini/pages/material/index.json b/test_mini/pages/material/index.json
index 2a7b263..77aa06a 100644
--- a/test_mini/pages/material/index.json
+++ b/test_mini/pages/material/index.json
@@ -1,5 +1,6 @@
{
- "usingComponents": {},
+ "usingComponents": {
+ },
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}
\ No newline at end of file
diff --git a/test_mini/pages/material/index.wxml b/test_mini/pages/material/index.wxml
index 602e8fb..e77bdd7 100644
--- a/test_mini/pages/material/index.wxml
+++ b/test_mini/pages/material/index.wxml
@@ -1,30 +1,30 @@
- {{count}}份资料
+ {{count}}份资料
-
-
-
-
-
-
-
-
-
-
- {{item.name}}
-
- {{item.description}}
-
-
-
-
- 下载
-
-
- 下载量:{{item.down_count}}
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {{item.name}}
+
+ {{item.description}}
+
+
+
+
+ 下载
+
+
+ 下载量:{{item.down_count}}
+
+
+
+
\ No newline at end of file
diff --git a/test_mini/pages/material/video.js b/test_mini/pages/material/video.js
new file mode 100644
index 0000000..04f5d8d
--- /dev/null
+++ b/test_mini/pages/material/video.js
@@ -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 () {
+
+ },
+
+})
\ No newline at end of file
diff --git a/test_mini/pages/material/video.json b/test_mini/pages/material/video.json
new file mode 100644
index 0000000..9fc3298
--- /dev/null
+++ b/test_mini/pages/material/video.json
@@ -0,0 +1,7 @@
+{
+ "usingComponents": {
+ "txv-video": "plugin://tencentvideo/video"
+ },
+ "enablePullDownRefresh": true,
+ "onReachBottomDistance": 50
+}
\ No newline at end of file
diff --git a/test_mini/pages/material/video.wxml b/test_mini/pages/material/video.wxml
new file mode 100644
index 0000000..672c052
--- /dev/null
+++ b/test_mini/pages/material/video.wxml
@@ -0,0 +1,11 @@
+暂无视频资源
+
+
+
+ {{item.name}}
+
+{{item.name}}
+
+
\ No newline at end of file
diff --git a/test_mini/pages/material/video.wxss b/test_mini/pages/material/video.wxss
new file mode 100644
index 0000000..aa8fa32
--- /dev/null
+++ b/test_mini/pages/material/video.wxss
@@ -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;
+}
\ No newline at end of file
diff --git a/test_mini/project.config.json b/test_mini/project.config.json
index 631541b..ab52b0f 100644
--- a/test_mini/project.config.json
+++ b/test_mini/project.config.json
@@ -23,7 +23,7 @@
"disablePlugins": [],
"outputPath": ""
},
- "useCompilerModule": false,
+ "useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"compileHotReLoad": false,
"useIsolateContext": true
diff --git a/test_server/cms/serializers.py b/test_server/cms/serializers.py
index 7389f78..b95f2e0 100644
--- a/test_server/cms/serializers.py
+++ b/test_server/cms/serializers.py
@@ -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 ''
diff --git a/test_server/cms/views.py b/test_server/cms/views.py
index 86ba268..a556d92 100644
--- a/test_server/cms/views.py
+++ b/test_server/cms/views.py
@@ -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):