From 46c40ce3a47fd7a1668324d4ebd160dc2be28f9d Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 11 Aug 2020 18:09:27 +0800 Subject: [PATCH] video update --- test_client/src/views/material/material.vue | 9 +- test_mini/app.js | 4 +- test_mini/app.json | 15 ++- test_mini/images/play.png | Bin 0 -> 1793 bytes test_mini/images/playc.png | Bin 0 -> 1282 bytes test_mini/images/video.png | Bin 0 -> 939 bytes test_mini/pages/material/index.js | 3 +- test_mini/pages/material/index.json | 3 +- test_mini/pages/material/index.wxml | 52 +++++----- test_mini/pages/material/video.js | 101 ++++++++++++++++++++ test_mini/pages/material/video.json | 7 ++ test_mini/pages/material/video.wxml | 11 +++ test_mini/pages/material/video.wxss | 13 +++ test_mini/project.config.json | 2 +- test_server/cms/serializers.py | 6 ++ test_server/cms/views.py | 1 + 16 files changed, 191 insertions(+), 36 deletions(-) create mode 100644 test_mini/images/play.png create mode 100644 test_mini/images/playc.png create mode 100644 test_mini/images/video.png create mode 100644 test_mini/pages/material/video.js create mode 100644 test_mini/pages/material/video.json create mode 100644 test_mini/pages/material/video.wxml create mode 100644 test_mini/pages/material/video.wxss 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 0000000000000000000000000000000000000000..2416934d0cf33d69aa655785db2f64f9a7afefee GIT binary patch literal 1793 zcmV+c2mbhpP)>6hG(g!-T#||FD!ojdu6WeUb!XQmm$A*{7)xq-9WvSt*qn6>a3Amf`+kQ3+Yu zU#5MRhNVjp5yZ0W%-xSajHD%rwQ}7gkbCcmBlpSmHt*fJ_kFbR-oWGWcr(8_^P4m0 zoH=t4>bzl{uOAu&G&G>j8E71VI#+;(5o{cRS{?x*L>mB1M#RZPG=;x;ej*w|#9#Rv z0EU!OUA2;{sv6MJ(sD&pQ_~GZG!GH)1b~YS7j~S8K1RfYzVCnA-`{`4a9rwcRUv>E zp3CLd64Bb!5@`k?VyEYMoz)h!xXSpPlO@I*MDFEP|kGI1_w0+{l ziQBuny1Xocwzak8hKGmOAmSPTn5My4uatTv3wB{lSp?X&y#f*6)drcwWzFvG?PYtDs--4?U7clF zy!f-Mz3=;%_4oH5O*MPQ&Mhr1lbV{Eev1w74uW8IS{Ip`0Nb|LBjT3WfE$@Cb$Z1zfy_jhgWeyTTybv>tM}6O)ohD*T zMS$Zt+hXDEVbAksnOJ+`iY1(yRN&}R9IagHJ{}?o~=HNgN1Zo)Qy6i~zs|1yDp> zB&Gb)WD)}c3NVLqx!mHOo}S|-xP?BB|-Uqr^7P)c2Bf?=cqnyBxjQtCXD3Am4j zfX4xVwdZt3DBck987bvvQ~Yp_zX9Of$QYyO(3F6C0bo~T_xDRF`KD&nGz82AfZszB zRu%zaBX*rqiu)xt$8q)%(ZWc_fewi;M_}gR{X=O1)YM0vKcZ^y%k}A3vUhnhizlQevbj zgm?k~wx-=ABLW=9`GkmWkAN>$N_|u*0wS7nZ5Y`tieZ1Clv-A5J|V z;qfd}B5uTeZUlg53%~h>>AG&Q2=gplV*-Q_%K;#oem1@iYa+?hLLlNE-}gKE`uci| zR~zf7yAA`u3Z>MU(7hD4F#%yZ?3XAQ5g8>!Y};(MS%6{>Bei%HDiBcQb*MHEBP>K%3$Q=_9A1mpp(3wBo@H4Jv(yZvGJ;VR3~K`3 z)~I#j-9773(7gtQ?(~7IwE~$5;E7Ar2Gs0%901Cy5h#m*&?pwG5vY2BM7gyAspEiR zsvBOGzKTDWhyD4<`XC}6GEJk0X>LxO&MQ(P!$ndzWvvN_uA^)XD1e1E1030vDv~;h zh~Fg?NnIaHZ^wD(BB=+n)B@->uwn!hTx8vr$wk?%+d|2>it&pw04yM)1^gX-T1#++ zoZL8ohzI!F^rbh8d#&gZND`p#ilvhX84Lf{R0GDsg5xqY2pEgIQcIZ{8c<8N$KqTK j4H%2NQcIcYUIYFGM#^t)92~Xb00000NkvXXu0mjf#WzN< literal 0 HcmV?d00001 diff --git a/test_mini/images/playc.png b/test_mini/images/playc.png new file mode 100644 index 0000000000000000000000000000000000000000..3d5b4a428cc38f16bd160cc8752a250d92da9225 GIT binary patch literal 1282 zcmV+d1^xPoP)=ZRT-`OJSzG}5Rx-%K-bDgYJF*~{RM(m0UTmOu}lsx^=3>SzOq&vc8v z)g9QRT@>*S-P}P7K>1j48-+LtP>;z#^tHIfHU=8^&rK)QNDM$6b(k-m%wV@q8p|{; z3I>uMk%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ini/images/video.png new file mode 100644 index 0000000000000000000000000000000000000000..b00c2d213aba24a99972a71057642f0fe1a5ddec GIT binary patch literal 939 zcmV;c162HpP)xV7L?ViWJRr&oNy^6ydGdAfKoL^%6-ksxisFG1g(8t6p-4(n zC?WYOlA^!n)U@q=_RP6^U$gI-sq?bWnl)?vX04f7Gc7cEYiV--i2z~*G&zBo0!pr<*H)8NlVD25qCB3&7kI9ixGVzPeoj>;~5QDlbvKAMnQLUkR)+Y557b z3e0yM+ZDidV2Y)5YSFovWAH6tVq*LUz&>DUO5d}t5UK*;E-)?u;2AP9tSle68e zPS=d{udQ!E0Z49}w!=3Kh$|ixbQJDlUQirMve0QyKD= z10X*h8wh7|AZYE7^ODbMK?Bfsv>uq5Vg2y}3a#J)XkVTV8~}!;fN(mvR5=3dI({9n z4d`q+^abeVupU%41!@2m0h@p!2~VEnobB`21fK%$fsKFwq&27FrK%~g$~fOE#Q{ae z)&k1wpd%n_;pJUp_a8tfU_Y?B3MWAw zcrGOj^__LQ`)8o5`5--thL;KbL8X9f)BAybzkp|sxtD!0OSfC-i}Dz9}bG^>t-bAZ}?VWwE40JQkDXPX90P5{t$s9UA9bHPbq zv5SGO09F8pT@<#1jKbf(B3JG&1jd?rLXRk_Eu5MwfF6L}=aMC?(;x*4Z2)!^rPCFF z#+wZsNx7dd$`%(rss+*>LtXl&%J=|~f|0;@pl`z?HrDZ*IZfs+YQE}y0r=_ - {{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):