Преглед на файлове

Merge branch 'master' of http://39.104.94.153:3000/yf_zd/second

Your Name преди 5 години
родител
ревизия
84a680abd3

+ 32 - 1
apps/AppInfo/admin.py

@@ -5,7 +5,8 @@ from django.utils.translation import ugettext_lazy as _
 from django.contrib.auth.forms import UserCreationForm, UserChangeForm
 # Register your models here.
 from apps.AppInfo.models import MyUser, QXZdata, QXZstatus, Equip, Equip_type, QXZdata_New, JKdata, Article, Video_data,Product,Blog,QXZstatus_New,QXZswitchstatus,QXZswitchdata,\
-CKArticle,GardenManage,GardenArea,Areacrop,Store_Manage,Hotel_Info,Hotel_Photo,FarmUser,FarmList,Pick_Pub,Sell_Manage,Person_Pick,QXZAutoswitch, Pic_Info,Sightsee_Info,QXZ_Alarm_Log
+CKArticle,GardenManage,GardenArea,Areacrop,Store_Manage,Hotel_Info,Hotel_Photo,FarmUser,FarmList,Pick_Pub,Sell_Manage,Person_Pick,QXZAutoswitch, Pic_Info,Sightsee_Info,QXZ_Alarm_Log,\
+Experts
 
 
 
@@ -784,3 +785,33 @@ class QXZ_Alarm_LogAdmin(admin.ModelAdmin):
     list_per_page = 10
     
 
+
+# 专家表
+@admin.register(Experts)
+class ExpertsAdmin(admin.ModelAdmin):
+    actions_on_bottom = False
+    actions_on_top = True
+    # 详情显示项:
+    fields = [
+        'name',
+        'relation',
+        'desc',
+        'pic',
+        'upl_time',
+    ]
+    # 列表显示项:
+    list_display = [
+        'name',
+        'relation',
+        'desc',
+        'pic',
+        'upl_time',
+    ]
+    # 筛选过滤项:
+    list_filter = ('upl_time',)
+    # 搜索项:
+    search_fields = ['name']
+    # 设置每页显示记录数:
+    list_per_page = 10    
+
+

+ 22 - 0
apps/AppInfo/models.py

@@ -663,3 +663,25 @@ class QXZ_Alarm_Log(models.Model):
     ekey = models.CharField(u'监测指标',max_length=20, blank=True, null=True)
     # info = models.CharField(u'内容',max_length=20, blank=True)
     upl_time = models.DateTimeField(u'上报时间', default=timezone.now)
+
+    class Meta:
+        verbose_name = u'气象站短信预警记录'
+        verbose_name_plural = verbose_name
+        ordering = ['-upl_time']
+        get_latest_by = 'upl_time'
+
+
+
+# 专家数据表
+class Experts(models.Model):
+    name = models.CharField(u'专家名字',max_length=20, blank=True, null=True)
+    relation = models.CharField(u'联系方式',max_length=20, blank=True, null=True)
+    desc = models.CharField(u'专家描述',max_length=50, blank=True, null=True)
+    pic = models.CharField(u'专家图片',max_length=200, blank=True, null=True)
+    upl_time = models.DateTimeField(u'创建时间', default=timezone.now)
+    
+    class Meta:
+        verbose_name = u'专家数据表'
+        verbose_name_plural = verbose_name
+        ordering = ['-upl_time']
+        get_latest_by = 'upl_time'

+ 11 - 1
apps/Equipment/urls.py

@@ -20,7 +20,7 @@ from apps.Equipment.views import (
     Video_Upload,JKview,Person_Area_Pub,CropCount_View,Sell_Del,Pick_Del,
     Pick_New,Repertory_New_View,Park_Land,Contrast_Detail,Contrast_List,Person_View,Person_List,
     Area_Create,Area_Map,Person_Limit,Limit_View,Expert,learnDepot,Create_User,Change_Pwd,Delete_User,User_Change_Pwd,QXZ_Auto,QXZ_Value_Mqtt,QXZ_Status2, QXZ_Report_Detail2,
-    Sightsee_Photo,Pic_locat,Home_Farm,Guide_Img,Alarm_Record)
+    Sightsee_Photo,Pic_locat,Home_Farm,Guide_Img,Alarm_Record,Expert_Img,Expert_Info,User_Info)
 
 app_name = 'Equipment'
 
@@ -251,6 +251,16 @@ urlpatterns = [
     
     url(r'^alarm_record$', Alarm_Record.as_view(), name='alarm_record'),
     
+    url(r'^expert_info$', Expert_Info.as_view(), name='expert_info'),
+    
+    url(r'^expert_img$', Expert_Img.as_view(), name='expert_img'),
+    
+    url(r'^user_info$', User_Info.as_view(), name='user_info'),
+    
+    
+    
+    
+    
     
     
     

+ 89 - 5
apps/Equipment/views.py

@@ -24,7 +24,7 @@ from apps.AppInfo.models import (
     Hotel_Info, Hotel_Photo, JKdata, MyUser, Pick_Pub, Product, QXZdata,
     QXZdata_New, QXZstatus, QXZstatus_New, QXZswitchdata, QXZswitchstatus,
     Video_data,GardenArea,Store_Manage,Areacrop,Sell_Manage,Person_Pick,QXZAutoswitch,Sightsee_Info,Pic_Info,
-    QXZ_Alarm_Log)
+    QXZ_Alarm_Log,Experts)
 from apps.Equipment.all_dict import qxz_dict
 
 
@@ -3392,7 +3392,13 @@ class Person_Limit(ListView):
 # 专家诊断
 class Expert(ListView):
     def get(self,request):
-        return render(request, 'backstageNet/limit/expert.html', context={})
+        username = request.user.username
+        print('username:',username)
+        user = MyUser.objects.get(username=username)
+        role = "0"
+        if user.is_staff == True:
+            role = "1"
+        return render(request, 'backstageNet/limit/expert.html', context={"role":role})
     def post(self,request):
         pass
 class learnDepot(ListView):
@@ -3406,12 +3412,22 @@ class Create_User(ListView):
     def get(self,request):
         currpage = request.GET.get("currpage")
         f_name = request.GET.get("f_name")
-        return render(request, 'backstageNet/systemSet/creatUser.html', context={"currpage":currpage,"f_name":f_name})
+        userId = request.GET.get("userId")
+        return render(request, 'backstageNet/systemSet/creatUser.html', context={"currpage":currpage,"f_name":f_name,"userId":userId})
     def post(self,request):
         name = request.POST.get("name")
         email = request.POST.get("email")
         phone = request.POST.get("phone")
+        role = request.POST.get("role")
         user_remark = request.POST.get("desc")
+        uid = request.POST.get("id")
+        if uid:
+            userobj = MyUser.objects.get(id=uid)
+            userobj.user_phone = phone
+            userobj.is_staff = role
+            userobj.user_remark = user_remark
+            userobj.save()
+            return HttpResponse("1")
         if MyUser.objects.extra(where=['binary username=%s'], params=[name]).exists():
             # 用户已存在!!!
             data = "3"
@@ -3426,7 +3442,7 @@ class Create_User(ListView):
             try:
                 user = UserModel.objects.create_user(username=name, email=email,\
                         user_phone=phone, password="yf123456",\
-                        is_active = 1,is_staff = 0,user_remark = user_remark,limit = 
+                        is_active = 1,is_staff = int(role),user_remark = user_remark,limit = 
                         [{
                             "id": 1,
                             "title": "首页",
@@ -3537,6 +3553,17 @@ class User_Change_Pwd(ListView):
         return HttpResponse(data)
 
 
+# 用户信息
+class User_Info(ListView):
+    def get(self,request):
+        pass
+    def post(self,request):
+        uid = request.POST.get('id')
+        user = MyUser.objects.get(id=uid)
+        data = {"name":user.username,"email":user.email,"phone":user.user_phone,"remark":user.user_remark,"role":user.is_staff}
+        data = json.dumps(data)
+        return HttpResponse(data)
+
 
 
 
@@ -3662,4 +3689,61 @@ class Alarm_Record(ListView):
         dat = dat[(10*(page-1)):(page*10)]
         data = {"dat":dat,"nums":nums}
         data = json.dumps(data)
-        return HttpResponse(data)
+        return HttpResponse(data)
+    
+
+
+class Expert_Img(ListView):
+    def get(self,request):
+        pass
+    def post(self,request):
+        # e_id = request.POST.get('id')
+        # news_sta = Article.objects.get(id=e_id)
+        guide_photo = request.FILES['upload']
+        if guide_photo:
+            print("新闻图片:", guide_photo)
+            news_photo_dir = 'media/uploads/'
+            end_name = guide_photo.name.split('.')[-1]
+            # 判断如果路径不存在,即创建路径
+            if os.path.exists(news_photo_dir) == False:
+                os.makedirs(news_photo_dir)
+            img = Image.open(guide_photo)
+            now_time = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
+            pic_name = now_time + '.' + end_name
+            print("pic_name:", pic_name)
+            img.save(news_photo_dir + pic_name)
+            news_photo = news_photo_dir + pic_name
+            print("new_photo:",news_photo)
+            data = {"code": 0,"msg": "","data": {"src": news_photo}}
+        else:
+            new_photo = "0"
+            data = {"code": 404,"msg": "","data": {"src": news_photo}}
+        data = json.dumps(data)
+        return HttpResponse(data)
+
+
+
+class Expert_Info(ListView):
+    def get(self,request):
+        page = int(request.GET.get("page"))
+        expert = Experts.objects.all()
+        nums = expert.count()
+        username = request.user.username
+        print('username:',username)
+        user = MyUser.objects.get(username=username)
+        role = "0"
+        if user.is_staff == True:
+            role = "1"
+        expert = expert[(9*(page-1)):(page*9)]
+        return render(request, 'backstageNet/limit/expertList.html', context={"expert":expert,"nums":nums,"role":role})
+    def post(self, request):
+        ex_id = request.POST.get('id')
+        if ex_id:
+            Experts.objects.get(id=ex_id).delete()
+            return HttpResponse("1")
+        name = request.POST.get('name')
+        relation = request.POST.get('relation')
+        desc = request.POST.get('desc')
+        pic = request.POST.get('pic')
+        Experts.objects.create(name=name,relation=relation,desc=desc,pic=pic)
+        return HttpResponse("1")

+ 13 - 1
templates/backstageNet/datacenter/contrast.html

@@ -296,10 +296,22 @@
                     farm = dat[i][j].farm;
                 }
                 if (i == 5 - 1) {
+                    var currYear = new Date().getFullYear();
+                    line_option.xAxis.data = [currYear-3+'年',currYear-2+'年',currYear-1+'年',currYear+'年']
                     line_option.series[0] = {
                         type: 'line',
                         name: farm,
                         data: arr,
+                        itemStyle: {
+                            normal: {
+                                label: {
+                                    show: true,
+                                    position: 'top',
+        //                             formatter: '{c}'
+                                    formatter: '¥{c}'
+                                },
+                            },
+                        },
                     }
                     var lineChart = echarts.init(document.getElementById('line-chart'));
                     lineChart.setOption(line_option, true);
@@ -356,7 +368,7 @@
             xAxis: {
                 type: 'category',
                 boundaryGap: false,
-                data: ['2016年', '2017年', '2018年', '2019年']
+                data: []
             },
             yAxis: {
                 type: 'value',

+ 110 - 43
templates/backstageNet/datacenter/cropdata.html

@@ -168,17 +168,33 @@
         // 指定图表的配置项和数据
         var line_option = {
             title: {
-                text: '生长周期(天)',
+                text: '面积收益对比',
                 textStyle: {
                     color: '#029eef'
                 }
             },
 
-            tooltip: {
+            tooltip : {
                 trigger: 'axis',
+                formatter: function (params, ticket, callback) {
+                    console.log(params);
+                    var showHtm='<span>'+params[0][1]+'</span>农场<br>';
+                    for(var i=0;i<params.length;i++){
+                        //名称
+                        var text = params[i][0];
+                        //值
+                        var value = params[i].value;
+                        if(text == '面积'){
+                            showHtm += text+':'+ value+'亩<br>'
+                        }else{
+                            showHtm += text+':'+ value+'元<br>'
+                        }
+                    }
+                    return showHtm;
+                },
             },
             legend: {
-                data: ['羊', '牛', '梨', '苹果', '香蕉']
+                data: ['面积','收益']
             },
             grid: {
                 left: '0%',
@@ -193,15 +209,17 @@
                     saveAsImage: { show: true }
                 }
             },
-            xAxis: {
-                type: 'category',
-                boundaryGap: false,
-                data: ['2016年', '2017年', '2018年', '2019年']
-            },
-            yAxis: {
-                type: 'value',
-                data: []
-            },
+            xAxis: [
+                {
+                    type: 'category',
+                    data: []
+                }
+            ],
+            yAxis: [
+                {
+                    type: 'value'
+                }
+            ],
             dataZoom: {
                 show: false,
                 // start: 70
@@ -211,10 +229,10 @@
             ]
         };
 
-        setTimeout(function () {
-            var lineChart = echarts.init(document.getElementById('line-chart'));
-            lineChart.setOption(line_option, true);
-        })
+        // setTimeout(function () {
+        //     var lineChart = echarts.init(document.getElementById('line-chart'));
+        //     lineChart.setOption(line_option, true);
+        // })
 
         // 1基于准备好的dom,初始化echarts实例
         var pieChart = echarts.init(document.getElementById('pie-chart'));
@@ -285,22 +303,6 @@
                 }
             ]
         };
-        // setTimeout(function () {
-        //     var pieChart = echarts.init(document.getElementById('pie-chart'));
-        //     pieChart.setOption(pie_option, true);
-        //     pieChart.on("click", function (param) {
-        //         console.log(param)
-        //         var lineChart = echarts.init(document.getElementById('line-chart'));
-        //         var price = [];
-        //         for (var i = 0; i < 4; i++) {
-        //             price.push(Math.floor(Math.random() * 100));
-        //             if (i == 3) {
-        //                 line_option.series[0].data = price
-        //                 lineChart.setOption(line_option, true);
-        //             }
-        //         }
-        //     });
-        // })
 
         // 1基于准备好的dom,初始化echarts实例
         var barChart = echarts.init(document.getElementById('bar-chart'));
@@ -364,28 +366,93 @@
             success: function (data) {
                 if (data.dat.length) {
                     var pieData = [];
+                    var lineChartName = [];
+                    var lineMoneyData = [];
+                    var lineAreaData = [];
                     for (var i = 0; i < data.dat.length; i++) {
                         var currData = {
                             "value": data.dat[i].area,
                             "name": data.dat[i].name
                         }
                         pieData.unshift(currData);
+                        lineChartName.unshift(data.dat[i].name);
+                        lineMoneyData.unshift(data.dat[i].money);
+                        lineAreaData.unshift(data.dat[i].area);
                         if (i == data.dat.length - 1) {
                             pie_option.series[0].data = pieData;
                             var pieChart = echarts.init(document.getElementById('pie-chart'));
                             pieChart.setOption(pie_option, true);
-                            pieChart.on("click", function (param) {
-                                console.log(param)
-                                var lineChart = echarts.init(document.getElementById('line-chart'));
-                                var price = [];
-                                for (var i = 0; i < 4; i++) {
-                                    price.push(Math.floor(Math.random() * 100));
-                                    if (i == 3) {
-                                        line_option.series[0].data = price
-                                        lineChart.setOption(line_option, true);
+
+                            line_option.xAxis[0].data = lineChartName;
+                            line_option.series[0] = {
+                                data:lineMoneyData,
+                                type:'bar',
+                                name:'收益',
+                                itemStyle: {
+                                    normal: {
+                                        color: function(params) {
+                                            // build a color map as your need.
+                                            var colorList = [
+                                            '#C1232B','#B5C334','#FCCE10','#E87C25','#27727B',
+                                            '#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD',
+                                            '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
+                                            ];
+                                            return colorList[params.dataIndex]
+                                        },
+                                        label: {
+                                            show: true,
+                                            position: 'top',
+                //                             formatter: '{c}'
+                                            formatter: '¥{c}'
+                                        },
+                                    },
+                                },
+                            };
+                            line_option.series[1] = {
+                                data:lineAreaData,
+                                type:'bar',
+                                name:'面积',
+                                itemStyle: {
+                                    normal: { //静态的时候显示的默认样式n
+                              //好,这里就是重头戏了,定义一个list,然后根据所以取得不同的值,这样就实现了,
+                                        color: function(params) {
+                                            // build a color map as your need.
+                                            var colorList = [
+                                            '#C1232B','#B5C334','#FCCE10','#E87C25','#27727B',
+                                            '#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD',
+                                            '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
+                                            ];
+                                            return colorList[params.dataIndex]
+                                        },
+                              //以下为是否显示,显示位置和显示格式的设置了
+                                        label: {
+                                            show: true,
+                                            position: 'top',
+                                            formatter: '{c}亩'
+                                        },
+                                    },
+                                    emphasis:{  //鼠标移入动态的时候显示的默认样式
+                                    //   color:'green'
                                     }
-                                }
-                            });
+                                },
+                                barWidth:20,
+                            };
+                            // var linelegend = { data:lineChartName };
+                            // line_option.legend = linelegend;
+                            lineChart.setOption(line_option, true);
+
+                            // pieChart.on("click", function (param) {
+                            //     console.log(param)
+                            //     var lineChart = echarts.init(document.getElementById('line-chart'));
+                            //     var price = [];
+                            //     for (var i = 0; i < 4; i++) {
+                            //         price.push(Math.floor(Math.random() * 100));
+                            //         if (i == 3) {
+                            //             line_option.series[0].data = price
+                            //             lineChart.setOption(line_option, true);
+                            //         }
+                            //     }
+                            // });
 
                         }
                     }

+ 46 - 32
templates/backstageNet/datacenter/industrydata.html

@@ -137,7 +137,7 @@
                             <tr>
                                 <td>农场名称</td>
                                 <td>农场面积</td>
-                                <td>负责人</td>
+                                <!-- <td>负责人</td> -->
                                 <td>农场收益</td>
                             </tr>
                         </thead>
@@ -262,11 +262,11 @@
                 trigger: 'item',
                 formatter: "{a} <br/>{b} : {c} ({d}%)"
             },
-            // legend: {
-            //     orient: 'vertical',
-            //     x: 'left',
-            //     data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
-            // },
+            legend: {
+                orient : 'vertical',
+                x : 'right',
+                data: []
+            },
             toolbox: {
                 show: true,
                 x: 'right',
@@ -290,35 +290,48 @@
             series: [
                 {
                     name: '收益占比',
-                    type: 'pie',
-                    radius: '80%',
-                    center: ['50%', '50%'],
-                    data: [
-                        { value: 335, name: '农场一' },
-                        { value: 310, name: '农场二' },
-                        { value: 234, name: '农场三' },
-                        { value: 135, name: '农场四' },
-                        { value: 548, name: '农场五' }
-                    ],
-                    itemStyle: {
-                        normal: {
-                            label: {            //饼图图形上的文本标签
-                                show: true,
-                                position: 'inner', //标签的位置
-                                textStyle: {
-                                    color: "#fff",
-                                    fontWeight: 300,
-                                    fontSize: 14    //文字的字体大小
-                                },
-                                formatter: '{b}\n({d}%)'
+                    type:'pie',
+                    radius : ['50%', '70%'],
+                    itemStyle : {
+                        normal : {
+                            label : {
+                                show : false
                             },
-
-                            labelLine: {
-                                show: false   //隐藏标示线
+                            labelLine : {
+                                show : false
+                            }
+                        },
+                        emphasis : {
+                            label : {
+                                show : true,
+                                position : 'center',
+                                textStyle : {
+                                    fontSize : '14',
+                                    fontWeight : 'bold'
+                                }
                             }
                         }
                     },
-                }
+                    data: [],
+                    // itemStyle: {
+                    //     normal: {
+                    //         label: {            //饼图图形上的文本标签
+                    //             show: true,
+                    //             position: 'inner', //标签的位置
+                    //             textStyle: {
+                    //                 color: "#fff",
+                    //                 fontWeight: 300,
+                    //                 fontSize: 14    //文字的字体大小
+                    //             },
+                    //             formatter: '{b}\n({d}%)'
+                    //         },
+
+                    //         labelLine: {
+                    //             show: false   //隐藏标示线
+                    //         }
+                    //     }
+                    // },
+                },
             ]
         };
         setTimeout(function () {
@@ -357,6 +370,7 @@
                                 bar_option.series[0].data = money;
                                 var barChart = echarts.init(document.getElementById('bar-chart'));
                                 barChart.setOption(bar_option)
+                                // pie_option.legend = { data:farm,orient : 'vertical',x : 'right',};
                                 pie_option.series[0].data = pieData;
                                 var pieChart = echarts.init(document.getElementById('pie-chart'));
                                 pieChart.setOption(pie_option, true);
@@ -414,7 +428,7 @@
             for (var i = 0; i < data.length; i++) {
                 var manage = data[i].manage ? data[i].manage : '暂无';
                 html += "<tr>";
-                html += "<td>" + data[i].farm + "</td><td>" + data[i].area + "</td><td><span class='redClolr'>" + manage + "</span></td><td>" + data[i].money + "</td>";
+                html += "<td>" + data[i].farm + "</td><td>" + data[i].area + "</td><td>" + data[i].money + "</td>";
                 html += "</tr>";
                 if (i == data.length - 1) {
                     $(table).html(html);

+ 2 - 2
templates/backstageNet/infoManage/pickManageList.html

@@ -14,12 +14,12 @@
         <a href="JavaScript:;" class="passBtn"  onclick="passFun('{{msg.id}}')">通过</a>
         |
         {% else %}
-            {% if msg.hatType == 1 %}
+            <!-- {% if msg.hatType == 1 %}
             <button type="button" onclick="hatPush('{{msg.id}}',1)" class="layui-btn layui-btn-xs layui-btn-danger hatPush"><i class="layui-icon layui-icon-fire"></i></button>
             {% else %}
             <button type="button" onclick="hatPush('{{msg.id}}',0)" class="layui-btn layui-btn-xs layui-btn-primary rejectBtn"><i class="layui-icon layui-icon-fire"></i></button>
             {% endif %}
-            <span>|</span>
+            <span>|</span> -->
         {% endif %}
         <a href="JavaScript:;" class="delBtn" onclick="delFun('{{msg.id}}')">删除</a>
         |

+ 160 - 117
templates/backstageNet/limit/expert.html

@@ -133,6 +133,7 @@
             width: 90%;
             margin-top: 30px;
         }
+
         .uploadImg {
             position: absolute;
             margin: 10px 0;
@@ -142,6 +143,7 @@
             border: 1px solid #b8b8b8;
             cursor: pointer;
         }
+
         .uploadImgIcon {
             background: url(../../static/imgs/uploadImgIcon.png) no-repeat center;
             background-size: 80% 80%;
@@ -152,6 +154,12 @@
             right: 40px;
             top: 55px;
         }
+
+        .layui-upload-img {
+            width: 92px;
+            height: 92px;
+            margin: 0 10px 10px 0;
+        }
     </style>
 </head>
 
@@ -170,121 +178,21 @@
         </div>
 
         <!-- 新增 -->
+        {% if role ==  '1' %} 
         <div class="additional">
             <button type="button" class="layui-btn  layui-btn-normal layui-btn-sm rightBtn"
                 onclick="selectModelFun('新增')">新增</button>
         </div>
+        {% endif %}
+        
 
         <!-- 内容 -->
-        <div class="expertGather">
-            <div class="expertGatherItem">
-                <img src="{% static '/imgs/cornerIcon.png' %}" alt="">
-                <div class="expertInner">
-                    <div class="expertImg">
-                        <img src="{% static '/imgs/Customer.png'%}" alt="">
-                    </div>
-                    <div class="expertTxt">
-                        <h1>吴玉金教授</h1>
-                        <p>简介:</p>
-                        <div class="desc">
-                            吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授</div>
-                        <div class="ctrlBtn">
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">视频电话</a>
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">发信息</a>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <div class="expertGatherItem">
-                <img src="{% static '/imgs/cornerIcon.png' %}" alt="">
-                <div class="expertInner">
-                    <div class="expertImg">
-                        <img src="{% static '/imgs/Customer.png'%}" alt="">
-                    </div>
-                    <div class="expertTxt">
-                        <h1>吴玉金教授</h1>
-                        <p>简介:</p>
-                        <div class="desc">
-                            吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授</div>
-                        <div class="ctrlBtn">
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">视频电话</a>
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">发信息</a>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <div class="expertGatherItem">
-                <img src="{% static '/imgs/cornerIcon.png' %}" alt="">
-                <div class="expertInner">
-                    <div class="expertImg">
-                        <img src="{% static '/imgs/Customer.png'%}" alt="">
-                    </div>
-                    <div class="expertTxt">
-                        <h1>吴玉金教授</h1>
-                        <p>简介:</p>
-                        <div class="desc">
-                            吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授</div>
-                        <div class="ctrlBtn">
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">视频电话</a>
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">发信息</a>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <div class="expertGatherItem">
-                <img src="{% static '/imgs/cornerIcon.png' %}" alt="">
-                <div class="expertInner">
-                    <div class="expertImg">
-                        <img src="{% static '/imgs/Customer.png'%}" alt="">
-                    </div>
-                    <div class="expertTxt">
-                        <h1>吴玉金教授</h1>
-                        <p>简介:</p>
-                        <div class="desc">
-                            吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授</div>
-                        <div class="ctrlBtn">
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">视频电话</a>
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">发信息</a>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <div class="expertGatherItem">
-                <img src="{% static '/imgs/cornerIcon.png' %}" alt="">
-                <div class="expertInner">
-                    <div class="expertImg">
-                        <img src="{% static '/imgs/Customer.png'%}" alt="">
-                    </div>
-                    <div class="expertTxt">
-                        <h1>吴玉金教授</h1>
-                        <p>简介:</p>
-                        <div class="desc">
-                            吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授</div>
-                        <div class="ctrlBtn">
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">视频电话</a>
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">发信息</a>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <div class="expertGatherItem">
-                <img src="{% static '/imgs/cornerIcon.png' %}" alt="">
-                <div class="expertInner">
-                    <div class="expertImg">
-                        <img src="{% static '/imgs/Customer.png'%}" alt="">
-                    </div>
-                    <div class="expertTxt">
-                        <h1>吴玉金教授</h1>
-                        <p>简介:</p>
-                        <div class="desc">
-                            吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授吴玉金教授</div>
-                        <div class="ctrlBtn">
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">视频电话</a>
-                            <a href="tencent://message/?uin=405204799&Site=sc.chinaz.com&Menu=yes">发信息</a>
-                        </div>
-                    </div>
-                </div>
-            </div>
+        <div class="expertGather" id="expertGather">
+
+        </div>
+        <div class="fenpei-bottom" style="padding: 20px 20px 20px 45px;">
+            <input type="hidden" id="totalPage" value={{ nums }}>
+            <div id="page"></div>
         </div>
 
         <!-- 筛选框 -->
@@ -303,17 +211,17 @@
                     <div class="layui-form-item">
                         <label class="layui-form-label">联系QQ:</label>
                         <div class="layui-input-inline">
-                            <input type="text" name="curr_var" required lay-verify="required" placeholder="请输入联系的QQ号"
+                            <input type="text" name="relation" required lay-verify="required" placeholder="请输入联系的QQ号"
                                 autocomplete="off" class="layui-input">
                         </div>
                     </div>
 
                     <div class="layui-form-item">
                         <label class="layui-form-label">专家照片:</label>
-                        <div class="layui-input-inline" style="margin-top: 0; margin-bottom: 65px;">
+                        <div class="layui-input-inline">
                             <button type="button" class="uploadImg uploadImgIcon" id="pickImg"></button>
                             <!-- 隐藏的input -->
-                            <input type="hidden" id="img_url" name="img_url" value="" />
+                            <input type="hidden" id="img_url" name="pic" value="" />
                             <div class="layui-upload-list">
                                 <img class="layui-upload-img" id="demo1">
                                 <p id="demoText"></p>
@@ -323,8 +231,8 @@
 
                     <div class="layui-form-item layui-form-text">
                         <label class="layui-form-label">专家介绍:</label>
-                        <div class="layui-input-inline">
-                            <textarea name="content" id="editor1" lay-verify="required" placeholder="请输入介绍"
+                        <div class="layui-input-block">
+                            <textarea name="desc" id="desc" lay-verify="required" placeholder="请输入介绍"
                                 class="layui-textarea"></textarea>
                         </div>
                     </div>
@@ -351,6 +259,118 @@
 
 </body>
 <script>
+    var laypage, form, upload;
+    layui.use(['laypage', 'form', 'upload'], function () {
+        laypage = layui.laypage;
+        form = layui.form;
+        upload = layui.upload;
+        var uploadInst = upload.render({
+            elem: '#pickImg'
+            , url: 'expert_img'
+            , field: 'upload'
+            , accept: 'images' //只允许上传图片
+            // , acceptMime: 'image/*' //只筛选图片
+            // ,exts: 'jpg|jpeg' 
+            , size: 1024 * 2 //限定大小
+            , xhr: function () { } //上传视频进度条
+            , before: function (obj) {
+                $('.uploadImg').removeClass('uploadImgIcon')
+                //预读本地文件示例,不支持ie8
+                obj.preview(function (index, file, result) {
+                    $('#demo1').attr('src', result); //图片链接(base64)
+                });
+            }
+            , done: function (res) {
+                //如果上传失败
+                if (res.code == 0) {
+                    //上传成功
+                    document.getElementById("img_url").value = res.data.src;
+                } else {
+                    return layer.msg('上传失败');
+                }
+
+
+            }
+            , error: function () {
+                //演示失败状态,并实现重传
+                var demoText = $('#demoText');
+                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
+                demoText.find('.demo-reload').on('click', function () {
+                    uploadInst.upload();
+                });
+            }
+        });
+
+        //监听提交
+        form.on('submit(formDemo)', function (data) {
+            window.id = data.field.id
+            var img_url = $('#img_url').val();
+            if (!img_url) {
+                layer.msg("请上传专家照片", { icon: 5 });
+                return false;
+            }
+            $.ajax({
+                url: 'expert_info',
+                data: $("#formDiv").serialize(),
+                type: 'post',
+                success: function (data) {
+                    if (data) {
+                        getData('expert_info', $('.layui-laypage-curr em').eq(1).html())
+                        clearForm()
+                    } else {
+
+                    }
+                },
+                error: function (type) {
+
+                }
+            })
+            return false;
+
+        });
+        getData('expert_info', 1)
+        
+    })
+    function getData(url, page) {
+            $.ajax({
+                url: url,
+                type: 'get',
+                data: {
+                    page: page
+                },
+                dataType: 'html',
+                success: function (data) {
+                    $('#expertGather').html(data);
+                    laypage.render({
+                        elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
+                        // , count: 30
+                        , count: $('#totalPage').val()
+                        , theme: '#2ca9f9'
+                        , curr: page
+                        , layout: ['prev', 'page', 'next', 'skip']
+                        , jump: function (obj, first) {
+                            if (!first) {
+                                $.ajax({
+                                    url: url,
+                                    type: 'get',
+                                    data: { page: obj.curr },
+                                    dataType: 'html',
+                                    success: function (data) {
+                                        $('#expertGather').html(data);
+                                    },
+                                    error: function (type) {
+                                        console.log(type)
+                                    }
+                                })
+                            }
+                        }
+                    });
+                },
+                error: function (type) {
+                    // console.log(type)
+                }
+            })
+        }
     function selectModelFun() {
         layui.use(['layer'], function () {
             layer = layui.layer;
@@ -362,18 +382,41 @@
                 cancel: function () {
                     // 右上角关闭事件的逻辑
                     clearForm()
-                    sessionStorage.removeItem('seelectID')
                 }
             })
         })
     }
 
     function clearForm() {
+        form.val('newsFormDiv', {
+            "title": "",
+            "writer": "",
+            "intro": ""
+        });
         $('#img_url').val('');
         $('.uploadImg').addClass('uploadImgIcon');
         $('#demo1').removeAttr('src'); //图片链接(base64)
-        layer.closeAll(); //疯狂模式,关闭所有层
-        location.reload()
+        layer.closeAll();
+    }
+
+    function del(id) {
+        $.ajax({
+            url: 'expert_info',
+            data: {
+                id:id
+            },
+            type: 'post',
+            success: function (data) {
+                if (data) {
+                    getData('expert_info', $('.layui-laypage-curr em').eq(1).html())
+                } else {
+
+                }
+            },
+            error: function (type) {
+
+            }
+        })
     }
 </script>
 

+ 28 - 0
templates/backstageNet/limit/expertList.html

@@ -0,0 +1,28 @@
+{% load staticfiles %}
+{% if expert|length %} 
+    {% for msg in expert %}
+    <div class="expertGatherItem">
+        <img src="{% static '/imgs/cornerIcon.png' %}" alt="">
+        <div class="expertInner">
+            <div class="expertImg">
+                <img src="http://192.168.1.9:8000{{msg.pic}}" alt="">
+            </div>
+            <div class="expertTxt">
+                <h1>{{msg.name}}</h1>
+                <p>简介:</p>
+                <div class="desc">
+                    {{msg.desc}}</div>
+                <div class="ctrlBtn">
+                    <a href="tencent://message/?uin={{msg.relation}}&Site=sc.chinaz.com&Menu=yes">视频电话</a>
+                    {% if role ==  '1' %} 
+                    <a href="JavaScript:;" style="background-color: red;" onclick="del('{{msg.id}}')">删除</a>
+                    {% endif %}
+                </div>
+            </div>
+        </div>
+    </div>
+    {% endfor %}
+{% else %}
+    <div style="text-align:center;line-height: 200px;">暂无数据</div>
+{% endif %}
+<input type="hidden" value="{{nums}}" id="totalPage">

+ 2 - 305
templates/backstageNet/limit/limit.html

@@ -155,315 +155,12 @@
     <script src="{% static '/lib/js/jquery-2.1.4.min.js'%}"></script>
     <script src="{% static '/lib/layui/layui.js'%}"></script>
     <script src="{% static '/js/backstageNet/common.js'%}"></script>
+    <script src="{% static '/js/backstageNet/limit/limit.js'%}"></script>
     <script>
         layui.use(['element'], function () {
             var element = layui.element;
         })
-        var navList = [
-            {
-                "id": 1,
-                "title": "首页",
-                "icon": "&#xe626;",
-                "url": "map",
-                "children": []
-            },
-            {
-                "id": 2,
-                "title": "设备分配",
-                "icon": "&#xe609;",
-                "url": "equipallot",
-                "disabled": "true",
-                "children": []
-            },
-            {
-                "id": 3,
-                "title": "信息发布",
-                "icon": "&#xe765;",
-                "url": "",
-                "children": [
-                    {
-                        "id": 3.1,
-                        "title": "新闻资讯",
-                        "url": "news_pub",
-                    },
-                    {
-                        "id": 3.2,
-                        "title": "视频资讯",
-                        "url": "video_pub",
-                    },
-                    {
-                        "id": 3.2,
-                        "title": "产品展厅",
-                        "url": "equip_pub",
-                    },
-                    {
-                        "id": 3.3,
-                        "title": "四季采摘",
-                        "url": "garden_pub",
-                    },
-                    {
-                        "id": 3.4,
-                        "title": "民宿导览",
-                        "url": "dorm_pub",
-                    },
-                    {
-                        "id": 3.5,
-                        "title": "旅游景点",
-                        "url": "sightsee_pub",
-                    },
-                ]
-            },
-            {
-                "id": 4,
-                "title": "我的发布",
-                "icon": "&#xe609;",
-                "url": "my_pub",
-                "disabled": "true",
-                "children": []
-            },
-            {
-                "id": 5,
-                "title": "视频监控",
-                "icon": "&#xe610;",
-                "url": "jkview",
-                "children": []
-            },
-            {
-                "id": 6,
-                "title": "传感及控制",
-                "icon": "&#xe654;",
-                "url": "",
-                "children": [
-                    {
-                        "id": 6.1,
-                        "title": "控制模块",
-                        "url": "qxzcontrol",
-                    },
-                    {
-                        "id": 6.2,
-                        "title": "趋势分析",
-                        "url": "qxzchart",
-                    },
-                    {
-                        "id": 6.3,
-                        "title": "数据统计",
-                        "url": "qxz_status",
-                    }
-                ]
-            },
-            {
-                "id": 7,
-                "title": "预警中心",
-                "icon": "&#xe634;",
-                "url": "",
-                "children": [
-                    {
-                        "id": 7.1,
-                        "title": "阈值设置",
-                        "url": "qxz_warning_view",
-                    },
-                    {
-                        "id": 7.2,
-                        "title": "生产方式设置",
-                        "url": "productionset",
-                    },
-                    {
-                        "id": 7.3,
-                        "title": "预警记录",
-                        "url": "qxz_warning_list",
-                    },
-                ]
-            },
-            {
-                "id": 8,
-                "title": "开心农场",
-                "icon": "&#xe603;",
-                "url": "",
-                "children": [
-                    {
-                        "id": 8.1,
-                        "title": "我的农场",
-                        "url": "person_farm_edit",
-                    },
-                    {
-                        "id": 8.2,
-                        "title": "农场管理",
-                        "url": "garden_manage_view",
-                    },
-                    {
-                        "id": 8.3,
-                        "title": "人员管理",
-                        "url": "garden_user_view",
-                    },
-                    {
-                        "id": 8.4,
-                        "title": "库存管理",
-                        "url": "repertory_view",  //物料管理    
-                    },
-                    {
-                        "id": 8.5,
-                        "title": "种植管理",
-                        "url": "cropcount",
-                    },
-                    {
-                        "id": 8.6,
-                        "title": "入库管理",
-                        "url": "pick",
-                    },
-                    {
-                        "id": 8.7,
-                        "title": "销售管理",
-                        "url": "sell_view",
-                    }
-                ]
-            },
-            {
-                "id": 9,
-                "title": "数据中心",
-                "icon": "&#xe603;",
-                "url": "",
-                "children": [
-                    {
-                        "id": 9.1,
-                        "title": "产业数据",
-                        "url": "industrydata",
-                    },
-                    {
-                        "id": 9.2,
-                        "title": "类型分析",
-                        "url": "type",
-                    },
-                    {
-                        "id": 9.3,
-                        "title": "对比分析",
-                        "url": "contrast",
-                    },
-                ]
-            },
-            {
-                "id": 10,
-                "title": "通知公告",
-                "icon": "&#xe765;",
-                "url": "",
-                "disabled": "true",
-                "children": [
-                    {
-                        "id": 10.1,
-                        "title": "发布公告",
-                        "url": "policy_pub",
-                        "disabled": "true",
-                    },
-                    {
-                        "id": 10.2,
-                        "title": "查看公告",
-                        "url": "policy_list_view",
-                        "disabled": "true",
-                    },
-                ]
-            },
-            {
-                "id": 11,
-                "title": "信息审核",
-                "icon": "&#xe765;",
-                "url": "",
-                "disabled": "true",
-                "children": [
-                    {
-                        "id": 11.1,
-                        "title": "新闻资讯",
-                        "url": "news_check",
-                        "disabled": "true",
-                    },
-
-                    {
-                        "id": 11.2,
-                        "title": "视频资讯",
-                        "url": "video_check",
-                        "disabled": "true",
-                    },
-                    {
-                        "id": 11.3,
-                        "title": "产品展厅",
-                        "url": "equip_check",
-                        "disabled": "true",
-                    },
-                    {
-                        "id": 11.4,
-                        "title": "四季采摘",
-                        "url": "garden_check",
-                        "disabled": "true",
-                    },
-                    {
-                        "id": 11.5,
-                        "title": "民宿导览",
-                        "url": "dorm_check",
-                        "disabled": "true",
-                    },
-                    {
-                        "id": 11.6,
-                        "title": "旅游景点",
-                        "url": "sightsee_check",
-                        "disabled": "true",
-                    },
-                    {
-                        "id": 11.7,
-                        "title": "个人农场",
-                        "url": "farm_check",
-                        "disabled": "true",
-                    },
-                ]
-            },
-            {
-                "id": 12,
-                "title": "权限",
-                "icon": "&#xe765;",
-                "url": "limit_view",
-                "disabled": "true",
-                "children": []
-            },
-            {
-                "id": 13,
-                "title": "系统设置",
-                "icon": "&#xe765;",
-                "url": "",
-                "disabled": "true",
-                "children": [
-                    {
-                        "id": 13.1,
-                        "title": "用户管理",
-                        "url": "person_view",
-                        "disabled": "true",
-                    },
-                    {
-                        "id": 13.2,
-                        "title": "修改密码",
-                        "url": "policy_list_view",
-                        "disabled": "true",
-                    }
-                ]
-            },
-			{
-                "id": 14,
-                "title": "专家诊断",
-                "icon": "&#xe765;",
-                "url": "",
-                "disabled": "true",
-                "children": [
-                    {
-                        "id": 14.1,
-                        "title": "在线专家",
-                        "url": "expert",
-                        "disabled": "true",
-                    },
-                    {
-                        "id": 14.2,
-                        "title": "知识库",
-                        "url": "learning_depot",
-                        "disabled": "true",
-                    }
-                ]
-            },
-        ]
+        
 
         $.ajax({
             url: 'limit',

+ 11 - 11
templates/static/js/limit/limit.js

@@ -128,11 +128,11 @@ var navList = [
                 "title": "农场管理",
                 "url": "garden_manage_view",
             },
-            {
-                "id": 8.3,
-                "title": "人员管理",
-                "url": "garden_user_view",
-            },
+            // {
+            //     "id": 8.3,
+            //     "title": "人员管理",
+            //     "url": "garden_user_view",
+            // },
             {
                 "id": 8.4,
                 "title": "库存管理",
@@ -293,12 +293,12 @@ var navList = [
                 "url": "expert",
                 "disabled": "true",
             },
-            {
-                "id": 14.2,
-                "title": "知识库",
-                "url": "learn_depot",
-                "disabled": "true",
-            }
+            // {
+            //     "id": 14.2,
+            //     "title": "知识库",
+            //     "url": "learn_depot",
+            //     "disabled": "true",
+            // }
         ]
     },
 ]