瀏覽代碼

优化主屏页面

Yue 3 年之前
父節點
當前提交
4c407d5169

+ 0 - 0
SourceCode/We.App_V2_2022.sln → SourceCode/We.App_V2.3_2023.sln


+ 8 - 0
SourceCode/WeApp.Core/Hubs/IwbHub.cs

@@ -50,6 +50,14 @@ namespace WeApp.Hubs
                 case 6:
                 case 6:
                     clientGroup.getReloadPlay(str);
                     clientGroup.getReloadPlay(str);
                     break;
                     break;
+
+                case 20:
+                    clientGroup.getShowTotalRoundScore(str, true);
+                    break;
+
+                case 21:
+                    clientGroup.getShowTotalRoundScore(str, false);
+                    break;
             }
             }
         }
         }
 
 

+ 1 - 0
SourceCode/WeApp.Web/App_Start/RouteConfig.cs

@@ -11,6 +11,7 @@ namespace WeApp
             routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
             routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
             routes.MapRoute("M", url: "M", defaults: new { controller = "MsgMonitor", action = "Index", id = UrlParameter.Optional });
             routes.MapRoute("M", url: "M", defaults: new { controller = "MsgMonitor", action = "Index", id = UrlParameter.Optional });
             routes.MapRoute("P", url: "P", defaults: new { controller = "Play", action = "Index", id = UrlParameter.Optional });
             routes.MapRoute("P", url: "P", defaults: new { controller = "Play", action = "Index", id = UrlParameter.Optional });
+            routes.MapRoute("P1", url: "P1", defaults: new { controller = "Play", action = "IndexWithScore", id = UrlParameter.Optional });
             routes.MapRoute("T", url: "T/{id}", defaults: new { controller = "Home", action = "Test", id = UrlParameter.Optional });
             routes.MapRoute("T", url: "T/{id}", defaults: new { controller = "Home", action = "Test", id = UrlParameter.Optional });
             routes.MapRoute("R", url: "R", defaults: new { controller = "Home", action = "Refresh", id = UrlParameter.Optional });
             routes.MapRoute("R", url: "R", defaults: new { controller = "Home", action = "Refresh", id = UrlParameter.Optional });
             routes.MapRoute("G", url: "G", defaults: new { controller = "Exercise", action = "Gis", id = UrlParameter.Optional });
             routes.MapRoute("G", url: "G", defaults: new { controller = "Exercise", action = "Gis", id = UrlParameter.Optional });

+ 48 - 0
SourceCode/WeApp.Web/Controllers/ExerciseController.cs

@@ -709,6 +709,54 @@ namespace WeApp.Controllers
                 Session.Timeout = TimeOut;
                 Session.Timeout = TimeOut;
             }
             }
 
 
+            ViewBag.Camp = ObjectMapper.Map<CampDto>(camp);
+            if (camp.CampState != CampStateDefinition.Run)
+            {
+                return View("Wait");
+            }
+            ViewBag.Groups = await QueryApp.GetCampGroups(id);
+            return View();
+        }   /// <summary>
+        /// 专家屏页面
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<ActionResult> IndexWithScore(string id)
+        {
+            CampInfo camp;
+            if (id == "1")
+            {
+                camp = await CampRepository.FirstOrDefaultAsync(a => a.CampState == CampStateDefinition.Run);
+                if (camp == null)
+                {
+                    CheckErrors("未查询到正在运行的培训营!");
+                    return Content("Error");
+                }
+            }
+            else
+            {
+                string campNo = id.IsEmpty() ? (string)Session["CampNo"] : id;
+                if (campNo.IsEmpty())
+                {
+                    TempData[ExerciseController.SelectDataKey] = new SelectCampModel
+                    {
+                        PageUrl = "/Play/IndexWithScore",
+                        PageTitle = "演示屏选择培训营",
+                        HasGroup = false
+                    };
+                    return RedirectToAction("SelectCamp", "Exercise");
+                }
+                camp = await CampRepository.FirstOrDefaultAsync(a => a.Id == campNo);
+                if (camp == null)
+                {
+                    CheckErrors($"未查到到编号为【{campNo}】的培训营!");
+                    return null;
+                }
+
+                Session["CampNo"] = campNo;
+                Session.Timeout = TimeOut;
+            }
+
             ViewBag.Camp = ObjectMapper.Map<CampDto>(camp);
             ViewBag.Camp = ObjectMapper.Map<CampDto>(camp);
             if (camp.CampState != CampStateDefinition.Run)
             if (camp.CampState != CampStateDefinition.Run)
             {
             {

+ 9 - 2
SourceCode/WeApp.Web/Views/Play/Index.cshtml

@@ -472,11 +472,13 @@
             </div>
             </div>
         </div>
         </div>
     </div>
     </div>
+@Html.Partial("/Views/Play/__/_Chart_RoundScore_Max.cshtml",0)
 </div>
 </div>
 @section scripts{
 @section scripts{
     <script src="~/Content/Libs/eCharts/echarts.min.js"></script>
     <script src="~/Content/Libs/eCharts/echarts.min.js"></script>
 
 
     <script>
     <script>
+        var chartRefreshTimeout = 0;
         var textColor = ["#0647a6", "#9fceff","#40faee"];
         var textColor = ["#0647a6", "#9fceff","#40faee"];
         var color = ['#FF3030', '#FF6A6A', '#FFD700', '#54FF9F', '#00E5EE'];
         var color = ['#FF3030', '#FF6A6A', '#FFD700', '#54FF9F', '#00E5EE'];
         var roundColor = ['#72a6e4', '#df9f3b', '#3db14e', '#72a6e4', '#df9f3b', '#3db14e', '#72a6e4', '#df9f3b', '#3db14e'];
         var roundColor = ['#72a6e4', '#df9f3b', '#3db14e', '#72a6e4', '#df9f3b', '#3db14e', '#72a6e4', '#df9f3b', '#3db14e'];
@@ -525,7 +527,6 @@
                 }
                 }
             }
             }
         }
         }
-
         function GetChartData() {
         function GetChartData() {
             $.iwbAjax5({
             $.iwbAjax5({
                 url: abp.appUrl + "Query/GetScoreChart?no=@camp.Id",
                 url: abp.appUrl + "Query/GetScoreChart?no=@camp.Id",
@@ -621,6 +622,7 @@
                         window.SiGongChart(sgCharts, sgTags);
                         window.SiGongChart(sgCharts, sgTags);
                         window.WuLiChart(wlCharts, wlLegend);
                         window.WuLiChart(wlCharts, wlLegend);
                         window.RoundScoreChart(roundCharts, roundCategory);
                         window.RoundScoreChart(roundCharts, roundCategory);
+                        window.RoundScoreChart_Max(roundCharts, roundCategory);
                 }
                 }
             });
             });
 
 
@@ -652,7 +654,12 @@
                 }
                 }
             });
             });
 
 
-            setTimeout(GetChartData, 1000 * 30);
+           chartRefreshTimeout=  setTimeout(GetChartData, 1000 * 30);
+        }
+
+        function RefreshChartData() {
+            clearTimeout(chartRefreshTimeout);
+            GetChartData();
         }
         }
     </script>
     </script>
 
 

文件差異過大導致無法顯示
+ 318 - 0
SourceCode/WeApp.Web/Views/Play/IndexWithScore.cshtml


+ 0 - 0
SourceCode/WeApp.Web/Views/Play/__/_Chart_Cmd - 副本.cshtml → SourceCode/WeApp.Web/Views/Play/__/_Chart_Cmd2.cshtml


+ 80 - 57
SourceCode/WeApp.Web/Views/Play/__/_Chart_RoundScore.cshtml

@@ -7,46 +7,30 @@
         //轮次得分
         //轮次得分
         function RoundScoreChart(data, category) {
         function RoundScoreChart(data, category) {
             if (data && data.length > 0) {
             if (data && data.length > 0) {
-                console.log("======ROUND", data,category);
+                //console.log("======ROUND", data, category);
             } else {
             } else {
                 console.log("ROUND-Null");
                 console.log("ROUND-Null");
                 return;
                 return;
             }
             }
-           
-            var series = [],nData=[],tData=[0,0,0];
+
+            var series = [], nData = [], tData = [0, 0, 0];
             for (var ii = 0; ii < data.length; ii++) {
             for (var ii = 0; ii < data.length; ii++) {
                 var item = data[ii];
                 var item = data[ii];
-                if (item.data&& item.data.length) {
-                    var vail = false;
-                    for (var iii = 0; iii < item.data.length; iii++) {
-                        var v = item.data[iii];
-                        if (v) {
-                            vail = true;
-                        }
-                        tData[iii] += v;
-
-                    }
-                    if (vail) {
-                        nData.push(item);
-                    }
-                }
-            }
-            for (var i = 0; i < nData.length; i++) {
-                var item = nData[i];
                 series.push({
                 series.push({
                     name: item.name,
                     name: item.name,
                     type: "bar",
                     type: "bar",
-                    stack: "rs",
                     data: item.data,
                     data: item.data,
-                    barMinHeight: 40,
-                    barMaxWidth: 60,
-                    label: {
-                        normal: {
-                            show: true,
-                            formatter: function(v) { return v.value ? v.value + ' 分' : "0 分" },
-                            color: '#eee',
-                        }
-                    },
+                    barMinHeight: 20,
+                    barMaxWidth: 30,
+                    /*stack: "round",*/
+                    //barMinHeight: 150,
+                    //label: {
+                    //    normal: {
+                    //        show: true,
+                    //        formatter: '{a} : {c} 分',
+                    //        color: textColor[1],
+                    //    }
+                    //},
                     itemStyle: {
                     itemStyle: {
                         color: {
                         color: {
                             type: 'linear',
                             type: 'linear',
@@ -57,7 +41,7 @@
                             colorStops: [
                             colorStops: [
                                 {
                                 {
                                     offset: 0,
                                     offset: 0,
-                                    color: roundColor[i % 3] // 0% 处的颜色
+                                    color: roundColor[ii % 3] // 0% 处的颜色
                                 }, {
                                 }, {
                                     offset: 1,
                                     offset: 1,
                                     color: '#27303f' // 100% 处的颜色
                                     color: '#27303f' // 100% 处的颜色
@@ -65,35 +49,74 @@
                             ]
                             ]
                         },
                         },
                         //color: roundColor[i % 3],
                         //color: roundColor[i % 3],
-                        barBorderRadius: i == nData.length-1?[50, 50, 0, 0]:[0]
+                        barBorderRadius: [50, 50, 0, 0]
                     }
                     }
                 });
                 });
             }
             }
-            if (nData.length > 1) {
-                //显示总分 ,重复一个bar,移位-100% ,最后一个显示label
-                var dataLength=series.length
-                for (var i = 0; i < dataLength; i++) {
-                    var ns = $.extend({}, series[i]);
-                    ns.name = ns.name + "_total";
-                    ns.stack = "total";
-                    ns.barGap = '-100%';
-                    ns.itemStyle = { color: 'rgba(0,0,0,0)', }
-                    if (i == dataLength -1) {
-                        ns.label = {
-                            position: 'top',
-                            show: true,
-                            formatter: function (v) { return v.value ? ' 总分:' + v.value + ' 分' : "" },
-                            color: '#fff',
-                            fontWeight: "bold"
-                        }
-                    } else {
-                        ns.label = {
-                            show: false,
-                        }
-                    }
-                    series.push(ns);
-                }
-            }
+            //for (var i = 0; i < nData.length; i++) {
+            //    var item = nData[i];
+            //    series.push({
+            //        name: item.name,
+            //        type: "bar",
+            //        stack: "rs",
+            //        data: item.data,
+            //        barMinHeight: 40,
+            //        barMaxWidth: 60,
+            //        label: {
+            //            normal: {
+            //                show: false,
+            //                formatter: function (v) { return v.value ? v.value + ' 分' : "0 分" },
+            //                color: '#eee',
+            //            }
+            //        },
+            //        itemStyle: {
+            //            color: {
+            //                type: 'linear',
+            //                x: 0,
+            //                y: 0,
+            //                x2: 1,
+            //                y2: 0,
+            //                colorStops: [
+            //                    {
+            //                        offset: 0,
+            //                        color: roundColor[i % 3] // 0% 处的颜色
+            //                    }, {
+            //                        offset: 1,
+            //                        color: '#27303f' // 100% 处的颜色
+            //                    }
+            //                ]
+            //            },
+            //            //color: roundColor[i % 3],
+            //            barBorderRadius: i == nData.length - 1 ? [50, 50, 0, 0] : [0]
+            //        }
+            //    });
+            //}
+            //if (nData.length > 1) {
+            //    //显示总分 ,重复一个bar,移位-100% ,最后一个显示label
+            //    var dataLength = series.length
+            //    for (var i = 0; i < dataLength; i++) {
+            //        var ns = $.extend({}, series[i]);
+            //        ns.name = ns.name + "_total";
+            //        ns.stack = "total";
+            //        ns.barGap = '-100%';
+            //        ns.itemStyle = { color: 'rgba(0,0,0,0)', }
+            //        if (i == dataLength - 1) {
+            //            //ns.label = {
+            //            //    position: 'top',
+            //            //    show: true,
+            //            //    formatter: function (v) { return v.value ? ' 总分:' + v.value + ' 分' : "" },
+            //            //    color: '#fff',
+            //            //    fontWeight: "bold"
+            //            //}
+            //        } else {
+            //            ns.label = {
+            //                show: false,
+            //            }
+            //        }
+            //        series.push(ns);
+            //    }
+            //}
+
             window.titleOpt.text = "演练得分评析示意图";
             window.titleOpt.text = "演练得分评析示意图";
             var option = {
             var option = {
                 grid: {
                 grid: {

+ 181 - 0
SourceCode/WeApp.Web/Views/Play/__/_Chart_RoundScore_Max.cshtml

@@ -0,0 +1,181 @@
+@using WeApp.Helpers
+@model int
+<div id="total-round-score_box" style="visibility:@(Model==0?"hidden":"visible") ;position: fixed; top: 65px; bottom: 10px; left: 10px; right: 10px; background: rgba(5, 21, 66, .9); border-radius: 15px;">
+    <div class="area" style="width: 100%;height: 100%" id="chart-round_max"></div>
+</div>
+@using (Html.BeginScripts())
+{
+    <script>
+
+        var roundScoreChart_Max = echarts.init(document.getElementById('chart-round_max'));
+        //轮次得分
+        function RoundScoreChart_Max(data, category) {
+            if (data && data.length > 0) {
+                //console.log("======ROUND", data, category);
+            } else {
+                console.log("ROUND-Null");
+                return;
+            }
+
+            var series = [], nData = [], tData = [0, 0, 0];
+            for (var ii = 0; ii < data.length; ii++) {
+                var item = data[ii];
+                if (item.data && item.data.length) {
+                    var vail = false;
+                    for (var iii = 0; iii < item.data.length; iii++) {
+                        var v = item.data[iii];
+                        if (v) {
+                            vail = true;
+                        }
+                        tData[iii] += v;
+
+                    }
+                    if (vail) {
+                        nData.push(item);
+                    }
+                }
+            }
+            for (var i = 0; i < nData.length; i++) {
+                var item = nData[i];
+                series.push({
+                    name: item.name,
+                    type: "bar",
+                    stack: "rs",
+                    data: item.data,
+                    barMinHeight: 40,
+                    barMaxWidth: 160,
+                    label: {
+                        normal: {
+                            show: true,
+                            formatter: function (v) { return v.value ? v.value + ' 分' : "0 分" },
+                            color: '#eee',
+                            fontSize: 24
+                        }
+                    },
+                    itemStyle: {
+                        color: {
+                            type: 'linear',
+                            x: 0,
+                            y: 0,
+                            x2: 1,
+                            y2: 0,
+                            colorStops: [
+                                {
+                                    offset: 0,
+                                    color: roundColor[i % 3] // 0% 处的颜色
+                                }, {
+                                    offset: 1,
+                                    color: '#27303f' // 100% 处的颜色
+                                }
+                            ]
+                        },
+                        //color: roundColor[i % 3],
+                        barBorderRadius: i == nData.length - 1 ? [80, 80, 0, 0] : [0]
+                    }
+                });
+            }
+            if (nData.length > 1) {
+                //显示总分 ,重复一个bar,移位-100% ,最后一个显示label
+                var dataLength = series.length
+                for (var i = 0; i < dataLength; i++) {
+                    var ns = $.extend({}, series[i]);
+                    ns.name = ns.name + "_total";
+                    ns.stack = "total";
+                    ns.barGap = '-100%';
+                    ns.itemStyle = { color: 'rgba(0,0,0,0)', }
+                    if (i == dataLength - 1) {
+                        ns.label = {
+                            position: 'top',
+                            show: true,
+                            formatter: function (v) {
+                                //console.log(tData[v.dataIndex])
+                                return v.value ? ' 总分:' + tData[v.dataIndex] + ' 分' : ""
+                            },
+                            color: '#fff',
+                            fontWeight: "bold",
+                            fontSize:26
+                        }
+                    } else {
+                        ns.label = {
+                            show: false,
+                        }
+                    }
+                    series.push(ns);
+                }
+            }
+            window.titleOpt.text = "";
+            var option = {
+                grid: {
+                    top: 55,
+                    bottom: 55,
+                    left: 70,
+                    right: 30,
+                    borderColor: textColor[1]
+                },
+                //legend: {
+                //    right: 20,
+                //    textStyle: {
+                //        color: textColor[1]
+                //    },
+                //    icon: 'circle'
+                //},
+                title: window.titleOpt,
+                xAxis: {
+                    type: 'category',
+                    data: category,
+                    axisLabel: {
+                        color: textColor[1],
+                        fontSize:24
+                    },
+                    axisLine: {
+                        show: true,
+                        lineStyle: {
+                            color: textColor[0]
+                        }
+                    }
+                },
+                yAxis: {
+                    type: 'value',
+                    axisLabel: {
+                        color: textColor[1],
+                        fontSize: 24
+
+                    },
+                    splitNumber: 4,
+                    axisLine: {
+                        show: false,
+                        lineStyle: {
+                            color: textColor[0]
+                        }
+                    },
+                    splitLine: {
+                        show: true,
+                        lineStyle: {
+                            color: textColor[0]
+                        }
+                    }
+                },
+                series: series
+            };
+            //console.log(option);
+            roundScoreChart_Max.setOption(option);
+        }
+      
+        iwbHub.client.getShowTotalRoundScore = function (msg, isShow) {
+            console.log('getShowTotalRoundScore: ', msg, isShow);
+            @if (Model == 0)
+            {
+              <text>
+                if (isShow) {
+                    setTimeout(() => {
+                        $("#total-round-score_box").css({ "visibility": "visible" })
+                    }, 1000 * 2)
+                } else {
+                    $("#total-round-score_box").css({ "visibility": "hidden" })
+                }
+                </text>
+            }
+            window.RefreshChartData();
+        }
+    </script>
+}

+ 32 - 14
SourceCode/WeApp.Web/Views/Train/Eval.cshtml

@@ -277,6 +277,8 @@
                                                 <option value="4">刷新公共屏页面</option>
                                                 <option value="4">刷新公共屏页面</option>
                                                 <option value="5">刷新专家页面</option>
                                                 <option value="5">刷新专家页面</option>
                                                 <option value="6">刷新大屏页面</option>
                                                 <option value="6">刷新大屏页面</option>
+                                                <option value="20">显示大屏总分</option>
+                                                <option value="21">隐藏大屏总分</option>
                                             </select>
                                             </select>
                                         </div>
                                         </div>
                                     </div>
                                     </div>
@@ -709,9 +711,18 @@
                                         abp.log.debug('SendRefreshDownTime:', '@(campNo)', 1, m);
                                         abp.log.debug('SendRefreshDownTime:', '@(campNo)', 1, m);
                                     });
                                     });
                                     abp.message.warn(`已自动发送倒计时命令:${m}分钟,速率1秒`);
                                     abp.message.warn(`已自动发送倒计时命令:${m}分钟,速率1秒`);
-                                }
+
+
+                        }
                             </text>
                             </text>
                         }
                         }
+                        if (type == 0 && (cmd == 3)) {
+                            //自动隐藏大屏总分
+                            iwbHub.server.sendReload('@(campNo)', 21).done(function () {
+                                abp.log.debug('sendShowTotalRoundScore===>HIDE:', no, cmd);
+                            });
+                        }
+
                     }
                     }
                 });
                 });
             }
             }
@@ -936,6 +947,7 @@
 
 
         function SendScore() {
         function SendScore() {
             SaveScore(true);
             SaveScore(true);
+
         }
         }
 
 
         function SaveScore(send) {
         function SaveScore(send) {
@@ -977,6 +989,12 @@
                 data: data,
                 data: data,
                 success: function () {
                 success: function () {
                     abp.message.warn("保存成功!");
                     abp.message.warn("保存成功!");
+                    if (send) {
+                         //自动显示大屏总分
+                        iwbHub.server.sendReload('@(campNo)', 20).done(function () {
+                            abp.log.debug('sendShowTotalRoundScore===>SHOW:', no, cmd);
+                        });
+                    }
                 }
                 }
             });
             });
         }
         }
@@ -1106,17 +1124,17 @@
         }
         }
     </script>
     </script>
 
 
-}
+    }
 
 
-<section style="display: none">
-    <select id="hid-type">
-        <option value=""></option>
-    </select>
-    <select id="hid-camp-state">
-        @(Html.Raw(campState))
-    </select>
-    <select id="hid-group-state">
-        @(Html.Raw(groupState))
-    </select>
-    @*@Html.DropDownList("hid-type", type)*@
-</section>
+    <section style="display: none">
+        <select id="hid-type">
+            <option value=""></option>
+        </select>
+        <select id="hid-camp-state">
+            @(Html.Raw(campState))
+        </select>
+        <select id="hid-group-state">
+            @(Html.Raw(groupState))
+        </select>
+        @*@Html.DropDownList("hid-type", type)*@
+    </section>

+ 3 - 0
SourceCode/WeApp.Web/WeApp.Web.csproj

@@ -2003,6 +2003,9 @@
     <Content Include="Views\Basic\StudentHelp.cshtml" />
     <Content Include="Views\Basic\StudentHelp.cshtml" />
     <Content Include="Views\Basic\PhoneQuestion.cshtml" />
     <Content Include="Views\Basic\PhoneQuestion.cshtml" />
     <Content Include="Views\Basic\PhoneAnswer.cshtml" />
     <Content Include="Views\Basic\PhoneAnswer.cshtml" />
+    <Content Include="Views\Play\__\_Chart_Cmd2.cshtml" />
+    <Content Include="Views\Play\__\_Chart_RoundScore_Max.cshtml" />
+    <Content Include="Views\Play\IndexWithScore.cshtml" />
     <None Include="Web.Debug.config">
     <None Include="Web.Debug.config">
       <DependentUpon>Web.config</DependentUpon>
       <DependentUpon>Web.config</DependentUpon>
     </None>
     </None>

部分文件因文件數量過多而無法顯示