permission
|
@ -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",
|
||||
|
|
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 723 B After Width: | Height: | Size: 816 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 892 B After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 808 B |
After Width: | Height: | Size: 895 B |
Before Width: | Height: | Size: 715 B |
Before Width: | Height: | Size: 512 B |
|
@ -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 () {
|
||||
|
||||
},
|
||||
|
||||
})
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"usingComponents": {},
|
||||
"enablePullDownRefresh": true,
|
||||
"onReachBottomDistance": 50
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<view class="head">
|
||||
|
||||
{{count}}条资讯</view>
|
||||
<view class="weui-cells weui-cells_after-title">
|
||||
<block wx:for="{{results}}" wx:key="unique">
|
||||
<navigator url="detail?id={{item.id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
|
||||
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
|
||||
<view class="weui-media-box__title">
|
||||
<text class="weui-badge" style="background:orange" wx:if="{{item.is_top}}">置顶</text>
|
||||
{{item.title}}</view>
|
||||
<view class="weui-media-box__desc">
|
||||
<span style="font-weight:bold;color:darkblue">{{item.ifrom}} </span>
|
||||
{{item.update_time}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="weui-panel__ft weui-cell__ft_in-access">
|
||||
<view class="weui-media-box__desc">查看详情</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</block>
|
||||
</view>
|
|
@ -0,0 +1,5 @@
|
|||
.head{
|
||||
color:#fff;
|
||||
background-color: cornflowerblue;
|
||||
text-align: center;
|
||||
}
|
|
@ -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',)
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
return Response({'path':instance.path})
|
|
@ -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
|
|
@ -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': {
|
||||
|
|