From 28750e10ac908deb8704f1ecfedd8fae64cce8bf Mon Sep 17 00:00:00 2001 From: "zorro.zhang" Date: Wed, 19 Apr 2023 10:42:28 +0800 Subject: [PATCH] ENH: all fix about OnlineModels Change-Id: I9ae1a9fdb364c28f3c9de2827ca1bbb9a2f750fa --- resources/web/data/text.js | 4 +- resources/web/homepage/css/dark.css | 38 ++++++++++- resources/web/homepage/css/home.css | 100 +++++++++++++++++++++++----- resources/web/homepage/index.html | 39 +++++++---- resources/web/homepage/js/home.js | 27 +++++--- resources/web/include/globalapi.js | 20 ++++++ src/slic3r/GUI/WebViewDialog.cpp | 2 +- 7 files changed, 186 insertions(+), 44 deletions(-) diff --git a/resources/web/data/text.js b/resources/web/data/text.js index ea75906ec..7effab0f5 100644 --- a/resources/web/data/text.js +++ b/resources/web/data/text.js @@ -98,7 +98,7 @@ var LangText={ "t104":"Profile name", "t105":"Profile Author", "t106":"Profile description", - "t107":"Staff Pick" + "t107":"Online Models" }, "zh_CN": { "t1": "欢迎使用Bambu Studio", @@ -199,7 +199,7 @@ var LangText={ "t104":"配置名称", "t105":"配置作者", "t106":"配置介绍", - "t107":"人工精选", + "t107":"在线模型", "wk1": "快速入门指南", "wk2": "本文介绍了Bambu Studio的最基本用法。它指导用户配置软件,创建项目,并逐步完成第一个打印任务。", "wk3": "基于项目的工作流", diff --git a/resources/web/homepage/css/dark.css b/resources/web/homepage/css/dark.css index 362de35d4..92e821c03 100644 --- a/resources/web/homepage/css/dark.css +++ b/resources/web/homepage/css/dark.css @@ -14,6 +14,11 @@ body color:#efeff0; } +.TextS2 +{ + color:#B3B3B5; +} + .ZScrol::-webkit-scrollbar-thumb {/*滚动条里面小方块*/ background-color: #939594; } @@ -88,10 +93,39 @@ body /*---Staff PIck----*/ #HotModel_Swiper { - background-color: #323238; + } .HotModel_NameText { - background-color: #636368; + height: 32px; +} + +.HotModelPiece +{ + border: 1px solid #4C4C55; + box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.04); + background-color: #4C4C55; +} + +#HotModel_RIGHT_Title +{ + color: #818183; +} + +.swiper +{ + --swiper-navigation-color: #EFEFF0;/* 单独设置按钮颜色 */ +} + +.swiper-button-prev +{ + background: rgba(54, 54, 60, 0.88); + border: 1px solid rgba(129, 129, 131, 0.64); +} + +.swiper-button-next +{ + background: rgba(54, 54, 60, 0.88); + border: 1px solid rgba(129, 129, 131, 0.64); } \ No newline at end of file diff --git a/resources/web/homepage/css/home.css b/resources/web/homepage/css/home.css index 08392714d..91311d2ef 100644 --- a/resources/web/homepage/css/home.css +++ b/resources/web/homepage/css/home.css @@ -313,15 +313,28 @@ body { display:flex; align-items: center; - padding: 6px 2px; - border-bottom-width: 0px; - border-bottom-style: solid; + justify-content: space-between; + padding: 0px; } +#HotModel_LEFT_Title +{ + display:flex; + align-items: center; + padding: 6px 0px; +} + +#HotModel_RIGHT_Title +{ + font-size:16px; +} + + .HotModel_PrevImg { width: 200px; height: 148px; + object-fit: cover; } @@ -337,9 +350,7 @@ body { display:flex; align-items: center; - padding: 6px 2px; - border-bottom-width: 1px; - border-bottom-style: solid; + padding: 6px 0px; } #RecentClearAllBtn @@ -658,8 +669,37 @@ body #HotModel_Swiper { - background-color: #EEEEEE; - padding: 20px 16px 20px 16px; + padding: 0px; +} + +.HotModel_Designer_Info +{ + display:flex; + align-items: center; + height: 28px; + padding: 0px 8px; +} + +.HotModel_Designer_Info img +{ + width: 16px; + height: 16px; + border-radius: 8px; +} + +.HotModel_Designer_Info span +{ + margin-left: 6px; + font-size: 12px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +#HotModel_RIGHT_Title:hover +{ + cursor: pointer; + color:#00AE42; } .HotModelPiece @@ -668,28 +708,31 @@ body display:flex; flex-direction: column; cursor: pointer; + border: 1px solid #EEEEEE; + box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.04); + border-radius: 8px; } .HotModel_PrevBlock { - border:2px solid #656568; - height: 148px; + height: 150px; } .HotModel_PrevImg { - width: 100%; + width: 200px; + height: 150px; } .HotModel_NameText { - height: 28px; - line-height: 28px; + height: 32px; + line-height: 32px; padding: 0px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - background-color: #cecece; + font-size: 14px; } @@ -698,5 +741,32 @@ body height: 10px!important; } - +.swiper-button-prev +{ + width: 40px!important; + height: 40px!important; + border-radius: 20px!important; + background: rgba(244, 244, 244, 0.88); } + +.swiper-button-next +{ + width: 40px!important; + height: 40px!important; + border-radius: 20px!important; + background: rgba(244, 244, 244, 0.88); +} + +.swiper +{ + --swiper-theme-color: #ff6600;/* 设置Swiper风格 */ + --swiper-navigation-color: #676767;/* 单独设置按钮颜色 */ + --swiper-navigation-size: 12px;/* 设置按钮大小 */ +} + +.swiper-button-disabled +{ + opacity: 1!important; + cursor: pointer!important; + pointer-events: auto!important; +} \ No newline at end of file diff --git a/resources/web/homepage/index.html b/resources/web/homepage/index.html index 39a5403d6..05099767a 100644 --- a/resources/web/homepage/index.html +++ b/resources/web/homepage/index.html @@ -83,56 +83,67 @@
+
-
Staff pick
+
Online Models
+
+
MORE >
- +
-
+
-
+
-
recent open
+
Recently opened
Clear all
diff --git a/resources/web/homepage/js/home.js b/resources/web/homepage/js/home.js index 7be05a331..8547954df 100644 --- a/resources/web/homepage/js/home.js +++ b/resources/web/homepage/js/home.js @@ -6,7 +6,6 @@ function OnInit() //-----Test----- //Set_RecentFile_MouseRightBtn_Event(); - //-----Official----- TranslatePage(); @@ -25,7 +24,7 @@ var MousePosY=0; function Set_RecentFile_MouseRightBtn_Event() { - $("#FileList .FileItem").mousedown( + $(".FileItem").mousedown( function(e) { //FilePath @@ -83,7 +82,6 @@ function Set_RecentFile_MouseRightBtn_Event() function HandleStudio( pVal ) { let strCmd = pVal['command']; - //alert(strCmd); if(strCmd=='get_recent_projects') { @@ -123,6 +121,7 @@ function HandleStudio( pVal ) } else if( strCmd=="modelmall_model_advise_get") { + //alert('hot'); ShowStaffPick( pVal['hits'] ); } } @@ -422,6 +421,8 @@ function InitStaffPick() nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, + slidesPerView : 'auto', + slidesPerGroup : 3 // autoplay: { // delay: 3000, // stopOnLastSlide: false, @@ -431,10 +432,10 @@ function InitStaffPick() // pagination: { // el: '.swiper-pagination', // }, - scrollbar: { - el: '.swiper-scrollbar', - draggable: true - } +// scrollbar: { +// el: '.swiper-scrollbar', +// draggable: true +// } }); } @@ -444,7 +445,9 @@ function SendMsg_GetStaffPick() tSend['sequence_id']=Math.round(new Date() / 1000); tSend['command']="modelmall_model_advise_get"; - SendWXMessage( JSON.stringify(tSend) ); + SendWXMessage( JSON.stringify(tSend) ); + + setTimeout("SendMsg_GetStaffPick()",3600*1000*1); } function ShowStaffPick( ModelList ) @@ -467,9 +470,13 @@ function ShowStaffPick( ModelList ) let ModelName=OnePickModel['design']['title']; let ModelCover=OnePickModel['design']['cover']; + let DesignerName=OnePickModel['design']['designCreator']['name']; + let DesignerAvatar=OnePickModel['design']['designCreator']['avatar']; + strPickHtml+='
'+ + '
'+DesignerName+'
'+ '
'+ - '
'+ModelName+'
'+ + '
'+ModelName+'
'+ '
'; } @@ -480,6 +487,7 @@ function ShowStaffPick( ModelList ) function OpenOneStaffPickModel( ModelID ) { + //alert(ModelID); var tSend={}; tSend['sequence_id']=Math.round(new Date() / 1000); tSend['command']="modelmall_model_open"; @@ -492,4 +500,3 @@ function OpenOneStaffPickModel( ModelID ) //---------------Global----------------- window.postMessage = HandleStudio; - diff --git a/resources/web/include/globalapi.js b/resources/web/include/globalapi.js index 706d12266..0553483e1 100644 --- a/resources/web/include/globalapi.js +++ b/resources/web/include/globalapi.js @@ -244,6 +244,16 @@ function IsJson( strJson ) return tJson; } +function DecodeJsonObject( pJson ) +{ + let tmpJson=JSON.stringify(pJson); + tmpJson=decodeURIComponent(tmpJson); + + pJson=JSON.parse(tmpJson); + + return pJson; +} + /*-----------------------Ajax Function--------------------*/ /*对JQuery的Ajax函数的封装,只支持异步 参数说明: @@ -344,6 +354,16 @@ function SendWXDebugInfo( strMsg ) SendWXMessage( JSON.stringify(tSend) ); } +function OpenUrlInLocalBrowser( strUrl ) +{ + var tSend={}; + tSend['sequence_id']=Math.round(new Date() / 1000); + tSend['command']="common_openurl"; + tSend['url']=strUrl; + + SendWXMessage( JSON.stringify(tSend) ); +} + /*------CSS Link Control----*/ function RemoveCssLink( LinkPath ) diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index 10625ff1e..aacffbbbd 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -436,7 +436,7 @@ void WebViewPanel::SendDesignStaffpick(NetworkAgent *agent) return; } CallAfter([this, body] { - auto body2 = body; + auto body2 = from_u8(body); body2.insert(1, "\"command\": \"modelmall_model_advise_get\", "); RunScript(wxString::Format("window.postMessage(%s)", body2)); });