diff --git a/test_mini/app.json b/test_mini/app.json index 3a8f7e1..1dc2b63 100644 --- a/test_mini/app.json +++ b/test_mini/app.json @@ -22,7 +22,8 @@ "pages/yati/index", "pages/article/index", "pages/article/detail", - "pages/quota/quota" + "pages/quota/quota", + "pages/material/index" ], "window": { "backgroundTextStyle": "light", @@ -44,10 +45,16 @@ }, { "pagePath": "pages/article/index", - "iconPath": "images/icon_doc.png", - "selectedIconPath": "images/icon_doc_fill.png", + "iconPath": "images/news.png", + "selectedIconPath": "images/newsc.png", "text": "资讯" }, + { + "pagePath": "pages/material/index", + "iconPath": "images/data.png", + "selectedIconPath": "images/datac.png", + "text": "资料" + }, { "pagePath": "pages/my/index", "iconPath": "images/me.png", diff --git a/test_mini/images/data.png b/test_mini/images/data.png new file mode 100644 index 0000000..d70a394 Binary files /dev/null and b/test_mini/images/data.png differ diff --git a/test_mini/images/datac.png b/test_mini/images/datac.png new file mode 100644 index 0000000..5e8bb0a Binary files /dev/null and b/test_mini/images/datac.png differ diff --git a/test_mini/images/feeds-fill.png b/test_mini/images/feeds-fill.png deleted file mode 100644 index d6ac9c5..0000000 Binary files a/test_mini/images/feeds-fill.png and /dev/null differ diff --git a/test_mini/images/feeds.png b/test_mini/images/feeds.png deleted file mode 100644 index bec6428..0000000 Binary files a/test_mini/images/feeds.png and /dev/null differ diff --git a/test_mini/images/home.png b/test_mini/images/home.png index 3315b13..47ac732 100644 Binary files a/test_mini/images/home.png and b/test_mini/images/home.png differ diff --git a/test_mini/images/homec.png b/test_mini/images/homec.png index 46444aa..51669e3 100644 Binary files a/test_mini/images/homec.png and b/test_mini/images/homec.png differ diff --git a/test_mini/images/icon_doc.png b/test_mini/images/icon_doc.png deleted file mode 100644 index dbd89d1..0000000 Binary files a/test_mini/images/icon_doc.png and /dev/null differ diff --git a/test_mini/images/icon_doc_fill.png b/test_mini/images/icon_doc_fill.png deleted file mode 100644 index 23930a2..0000000 Binary files a/test_mini/images/icon_doc_fill.png and /dev/null differ diff --git a/test_mini/images/me.png b/test_mini/images/me.png index 70ba057..aa8f6af 100644 Binary files a/test_mini/images/me.png and b/test_mini/images/me.png differ diff --git a/test_mini/images/mec.png b/test_mini/images/mec.png index f9df4d0..2c52ba9 100644 Binary files a/test_mini/images/mec.png and b/test_mini/images/mec.png differ diff --git a/test_mini/images/news.png b/test_mini/images/news.png new file mode 100644 index 0000000..42c3828 Binary files /dev/null and b/test_mini/images/news.png differ diff --git a/test_mini/images/newsc.png b/test_mini/images/newsc.png new file mode 100644 index 0000000..71bac6b Binary files /dev/null and b/test_mini/images/newsc.png differ diff --git a/test_mini/images/todo.png b/test_mini/images/todo.png deleted file mode 100644 index 9a39097..0000000 Binary files a/test_mini/images/todo.png and /dev/null differ diff --git a/test_mini/images/todoc.png b/test_mini/images/todoc.png deleted file mode 100644 index 62d13ac..0000000 Binary files a/test_mini/images/todoc.png and /dev/null differ diff --git a/test_mini/pages/material/index.js b/test_mini/pages/material/index.js new file mode 100644 index 0000000..b607799 --- /dev/null +++ b/test_mini/pages/material/index.js @@ -0,0 +1,100 @@ +// pages/lianxi/index.js +const api = require("../../utils/request.js"); +Page({ + + /** + * 页面的初始数据 + */ + data: { + results: [], + query: { + page: 1, + limit: 10 + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + 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/index.json b/test_mini/pages/material/index.json new file mode 100644 index 0000000..2a7b263 --- /dev/null +++ b/test_mini/pages/material/index.json @@ -0,0 +1,5 @@ +{ + "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 new file mode 100644 index 0000000..ae9acb4 --- /dev/null +++ b/test_mini/pages/material/index.wxml @@ -0,0 +1,21 @@ + + + {{count}}条资讯 + + + + + + 置顶 + {{item.title}} + + {{item.ifrom}} + {{item.update_time}} + + + + 查看详情 + + + + \ No newline at end of file diff --git a/test_mini/pages/material/index.wxss b/test_mini/pages/material/index.wxss new file mode 100644 index 0000000..a458506 --- /dev/null +++ b/test_mini/pages/material/index.wxss @@ -0,0 +1,5 @@ +.head{ + color:#fff; + background-color: cornflowerblue; + text-align: center; +} \ No newline at end of file diff --git a/test_server/cms/serializers.py b/test_server/cms/serializers.py index 9f48095..d1a0a7f 100644 --- a/test_server/cms/serializers.py +++ b/test_server/cms/serializers.py @@ -6,8 +6,6 @@ class ArticelSerializer(serializers.ModelSerializer): """ 文章序列化 """ - create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True) - update_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True) class Meta: model = Article fields = '__all__' @@ -16,8 +14,6 @@ class ArticelListSerializer(serializers.ModelSerializer): """ 文章列表序列化 """ - create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True) - update_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True) class Meta: model = Article exclude = ('content',) @@ -25,6 +21,6 @@ class ArticelListSerializer(serializers.ModelSerializer): class MaterialSerializer(serializers.ModelSerializer): class Meta: model = Material - fields = '__all__' + exclude = ('path',) diff --git a/test_server/cms/views.py b/test_server/cms/views.py index f88292c..206f77f 100644 --- a/test_server/cms/views.py +++ b/test_server/cms/views.py @@ -29,7 +29,7 @@ class ArticleViewSet(ModelViewSet): 文章:增删改查 """ perms_map = [ - {'get': 'article_list'}, {'post': 'article_create'}, + {'get': '*'}, {'post': 'article_create'}, {'put': 'article_update'}, {'delete': 'article_delete'}] queryset = Article.objects.filter(is_delete=0).all() serializer_class = ArticelSerializer @@ -60,7 +60,7 @@ class MaterialViewSet(ModelViewSet): 资料:增删改查 """ perms_map = [ - {'get': 'material_list'}, {'post': 'material_create'}, + {'get': '*'}, {'post': 'material_create'}, {'put': 'material_update'}, {'delete': 'material_delete'}] queryset = Material.objects.filter(is_delete=0) serializer_class = MaterialSerializer @@ -78,4 +78,4 @@ class MaterialViewSet(ModelViewSet): instance = self.get_object() instance.down_count = instance.down_count + 1 instance.save() - return Response(status=status.HTTP_200_OK) \ No newline at end of file + return Response({'path':instance.path}) \ No newline at end of file diff --git a/test_server/crm/permission.py b/test_server/crm/permission.py index c0637c0..0cf1315 100644 --- a/test_server/crm/permission.py +++ b/test_server/crm/permission.py @@ -12,14 +12,12 @@ ConsumerPerms = [ 'my_subjects', 'my_examtest', 'examtest_create', - 'article_list', 'exercise' ] VistorPerms = [ 'gen_monitest', 'questioncat_list', - 'article_list', 'my_examtest', 'examtest_create' ] @@ -52,6 +50,6 @@ class MyPermission(RbacPermission): _method = request._request.method.lower() for i in perms_map: for method, alias in i.items(): - if (_method == method or method == '*') and alias in perms: + if ((_method == method or method == '*') and alias in perms)or alias == '*': return True return False \ No newline at end of file diff --git a/test_server/server/settings.py b/test_server/server/settings.py index 166c269..ed4b1f4 100644 --- a/test_server/server/settings.py +++ b/test_server/server/settings.py @@ -88,10 +88,10 @@ WSGI_APPLICATION = 'server.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'devdb2', + 'NAME': 'zkfs', 'USER':'ctcuser', - 'PASSWORD':'ctcuser', - 'HOST':'121.36.23.77', + 'PASSWORD':'zkfs1234', + 'HOST':'116.63.176.211', 'PORT':'5432', }, # 'default': {