NEW: Revert "[STUDIO-2476] design_staffpick"

This reverts commit 0063720bbaaa6a680f2d9f395d60cf193d126e11.

Change-Id: Ieb19daf19b38f5e25b78967ee225042988d98c7d
This commit is contained in:
chunmao.guo 2023-04-11 10:30:07 +08:00 committed by Lane.Wei
parent de3bb7eb4f
commit a344ebcf81
18 changed files with 556 additions and 363 deletions

View file

@ -97,8 +97,7 @@ var LangText={
"t103":"Other",
"t104":"Profile name",
"t105":"Profile Author",
"t106":"Profile description",
"t107":"Staff Pick"
"t106":"Profile description"
},
"zh_CN": {
"t1": "欢迎使用Bambu Studio",
@ -198,8 +197,7 @@ var LangText={
"t103":"其他",
"t104":"配置名称",
"t105":"配置作者",
"t106":"配置介绍",
"t107":"人工精选",
"t106":"配置介绍",
"wk1": "快速入门指南",
"wk2": "本文介绍了Bambu Studio的最基本用法。它指导用户配置软件创建项目并逐步完成第一个打印任务。",
"wk3": "基于项目的工作流",
@ -315,8 +313,7 @@ var LangText={
"t103":"その他",
"t104":"構成名",
"t105":"構成著者",
"t106":"構成の概要",
"t107":"スタッフが選ぶ"
"t106":"構成の概要",
}
};

View file

@ -83,15 +83,4 @@ body
.UG_DESC
{
color:#818183;
}
/*---Staff PIck----*/
#HotModel_Swiper
{
background-color: #323238;
}
.HotModel_NameText
{
background-color: #636368;
}

View file

@ -244,13 +244,6 @@ body
height: 100%;
}
.TitleSmallIcon
{
width:30px;
height: 30px;
margin-right: 10px;
}
#MenuArea
{
height: 140px;
@ -309,22 +302,6 @@ body
height: 420px;
}
#HotModelBlock
{
display:flex;
align-items: center;
padding: 6px 2px;
border-bottom-width: 0px;
border-bottom-style: solid;
}
.HotModel_PrevImg
{
width: 200px;
height: 148px;
}
#RecentFileArea
{
margin-top: 10px;
@ -337,7 +314,7 @@ body
{
display:flex;
align-items: center;
padding: 6px 2px;
padding: 6px;
border-bottom-width: 1px;
border-bottom-style: solid;
}
@ -650,53 +627,28 @@ body
font-size: 14px;
}
/*--Staff Pick--*/
#HotModelArea
/*------Christmas cabin---*/
#ChristmasArea
{
display: none;
}
#HotModel_Swiper
{
background-color: #EEEEEE;
padding: 20px 16px 20px 16px;
}
.HotModelPiece
{
width: 200px!important;
display:flex;
margin-top: 10px;
display: flex;
flex-direction: column;
cursor: pointer;
}
.HotModel_PrevBlock
#ChristmasTitleBlock
{
border:2px solid #656568;
height: 148px;
display:flex;
align-items: center;
padding: 6px;
border-bottom-width: 1px;
border-bottom-style: solid;
}
.HotModel_PrevImg
#CabinList
{
width: 100%;
}
display: flex;
flex-wrap: wrap;
align-content: flex-start;
overflow-y: auto;
.HotModel_NameText
{
height: 28px;
line-height: 28px;
padding: 0px 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-color: #cecece;
}
.swiper-scrollbar
{
height: 10px!important;
}
}
}

View file

@ -1,14 +0,0 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 16.646V21.2895C7.5 21.3382 7.5071 21.3866 7.52109 21.4332C7.60044 21.6977 7.87918 21.8478 8.14367 21.7684L12 20.6115L15.8563 21.7684C15.9029 21.7824 15.9513 21.7895 16 21.7895C16.2761 21.7895 16.5 21.5656 16.5 21.2895V16.6462L15.7247 16.7081C15.0954 16.7583 14.498 17.0058 14.0175 17.4152L13.379 17.9594C12.5851 18.6359 11.4175 18.6359 10.6237 17.9594L9.98515 17.4152C9.50466 17.0058 8.90724 16.7583 8.27795 16.7081L7.5 16.646Z" fill="url(#paint0_linear_10080_34787)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.2125 2.79872C11.7202 2.44222 12.4121 2.46866 12.8925 2.87803L13.531 3.42217C14.1316 3.93401 14.8784 4.24333 15.665 4.3061L16.5013 4.37284C17.1739 4.42651 17.708 4.9606 17.7616 5.63318L17.8284 6.46944C17.8912 7.25606 18.2005 8.00284 18.7123 8.60345L19.2565 9.24197C19.6941 9.75551 19.6941 10.5108 19.2565 11.0244L18.7123 11.6629C18.2005 12.2635 17.8912 13.0103 17.8284 13.7969L17.7616 14.6331C17.708 15.3057 17.1739 15.8398 16.5013 15.8935L15.665 15.9602C14.8784 16.023 14.1316 16.3323 13.531 16.8442L12.8925 17.3883C12.379 17.8259 11.6237 17.8259 11.1101 17.3883L10.4716 16.8442C9.871 16.3323 9.12423 16.023 8.33761 15.9602L7.50135 15.8935C6.82876 15.8398 6.29468 15.3057 6.241 14.6331L6.17427 13.7969C6.1115 13.0103 5.80217 12.2635 5.29033 11.6629L4.72569 12.1441L5.29033 11.6629L4.7462 11.0244C4.30856 10.5108 4.30856 9.75551 4.7462 9.24197L5.29033 8.60345C5.80217 8.00284 6.1115 7.25606 6.17427 6.46944L6.241 5.63318C6.29468 4.9606 6.82876 4.42651 7.50135 4.37284L8.33761 4.3061C9.12423 4.24333 9.871 3.93401 10.4716 3.42217L11.1101 2.87803C11.1433 2.84977 11.1775 2.82333 11.2125 2.79872ZM15 10.133C15 11.7898 13.6569 13.133 12 13.133C10.3431 13.133 9 11.7898 9 10.133C9 8.47613 10.3431 7.13298 12 7.13298C13.6569 7.13298 15 8.47613 15 10.133Z" fill="url(#paint1_linear_10080_34787)"/>
<defs>
<linearGradient id="paint0_linear_10080_34787" x1="12.3119" y1="13.1333" x2="12.6038" y2="22.5666" gradientUnits="userSpaceOnUse">
<stop stop-color="#00AE42" stop-opacity="0.24"/>
<stop offset="1" stop-color="#00AE42" stop-opacity="0.64"/>
</linearGradient>
<linearGradient id="paint1_linear_10080_34787" x1="12.0013" y1="1.7998" x2="12.0013" y2="18.4665" gradientUnits="userSpaceOnUse">
<stop stop-color="#00AE42"/>
<stop offset="1" stop-color="#00AE42" stop-opacity="0.64"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -1,10 +0,0 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.4145 8.28147C12.4145 7.82507 12.0445 7.45508 11.5881 7.45508C11.1317 7.45508 10.7617 7.82507 10.7617 8.28147V12.3419C10.7597 12.3655 10.7587 12.3893 10.7587 12.4133C10.7587 12.8604 11.1138 13.2246 11.5573 13.2392C11.5675 13.2396 11.5778 13.2398 11.5881 13.2398L11.6017 13.2397H14.0642C14.5206 13.2397 14.8906 12.8697 14.8906 12.4133C14.8906 11.9569 14.5206 11.5869 14.0642 11.5869H12.4145V8.28147ZM19 12C19 15.866 15.866 19 12 19C8.13401 19 5 15.866 5 12C5 8.13401 8.13401 5 12 5C15.866 5 19 8.13401 19 12Z" fill="url(#paint0_linear_10269_34622)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19ZM12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 7.30558 16.6944 3.5 12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5Z" fill="#00AE42" fill-opacity="0.4"/>
<defs>
<linearGradient id="paint0_linear_10269_34622" x1="17.6667" y1="5.38889" x2="17.6667" y2="18.6111" gradientUnits="userSpaceOnUse">
<stop stop-color="#00AE42"/>
<stop offset="1" stop-color="#00AE42" stop-opacity="0.64"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -5,17 +5,12 @@
<meta http-equiv="Cache-Control" content="max-age=7200" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<title>homepage</title>
<link rel="stylesheet" type="text/css" href="./css/home.css" />
<link rel="stylesheet" type="text/css" href="./css/dark.css" />
<script type="text/javascript" src="../include/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../include/json2.js"></script>
<script type="text/javascript" src="../include/globalapi.js"></script>
<link rel="stylesheet" type="text/css" href="../include/swiper/swiper-bundle.min.css" />
<script type="text/javascript" src="../include/swiper/swiper-bundle.min.js"></script>
<script type="text/javascript" src="../data/text.js"></script>
<link rel="stylesheet" type="text/css" href="css/home.css" />
<link rel="stylesheet" type="text/css" href="css/dark.css" />
<script type="text/javascript" src="js/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="../data/text.js"></script>
<script type="text/javascript" src="js/json2.js"></script>
<script type="text/javascript" src="js/globalapi.js"></script>
<script type="text/javascript" src="js/home.js"></script>
</head>
<body class="ZScrol" onLoad="OnInit()">
@ -79,59 +74,9 @@
</div>
</div>
<div id="DebugText"></div>
<div id="HotModelArea">
<div id="HotModelBlock">
<img class="TitleSmallIcon" src="./img/t1.svg" />
<div id="HotModelTitle" class="Content-Title trans TextS1" tid="t107">Staff pick</div>
</div>
<div id="HotModel_Swiper" class="swiper">
<div id="HotModelList" class="swiper-wrapper">
<!-- <div class="HotModelPiece swiper-slide">
<div class="HotModel_PrevBlock"><img class="HotModel_PrevImg" src="img/wiki.png" /></div>
<div class="HotModel_NameText TextS1">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
</div>
<div class="HotModelPiece swiper-slide">
<div class="HotModel_PrevBlock"><img class="HotModel_PrevImg" src="img/wiki2.png" /></div>
<div class="HotModel_NameText TextS1">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
</div>
<div class="HotModelPiece swiper-slide">
<div class="HotModel_PrevBlock"><img class="HotModel_PrevImg" src="img/wiki3.png" /></div>
<div class="HotModel_NameText TextS1">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
</div>
<div class="HotModelPiece swiper-slide">
<div class="HotModel_PrevBlock"><img class="HotModel_PrevImg" src="img/wiki2.png" /></div>
<div class="HotModel_NameText TextS1">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
</div>
<div class="HotModelPiece swiper-slide">
<div class="HotModel_PrevBlock"><img class="HotModel_PrevImg" src="img/wiki.png" /></div>
<div class="HotModel_NameText TextS1">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
</div>
<div class="HotModelPiece swiper-slide">
<div class="HotModel_PrevBlock"><img class="HotModel_PrevImg" src="img/wiki3.png" /></div>
<div class="HotModel_NameText TextS1">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
</div>
<div class="HotModelPiece swiper-slide">
<div class="HotModel_PrevBlock"><img class="HotModel_PrevImg" src="img/wiki2.png" /></div>
<div class="HotModel_NameText TextS1">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
</div>
<div class="HotModelPiece swiper-slide">
<div class="HotModel_PrevBlock"><img class="HotModel_PrevImg" src="img/wiki.png" /></div>
<div class="HotModel_NameText TextS1">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
</div> -->
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<div class="swiper-scrollbar"></div>
</div>
</div>
<div id="DebugText"></div>
<div id="RecentFileArea">
<div id="HotModelBlock">
<img class="TitleSmallIcon" src="./img/t2.svg" />
<div id="RecentTitleBlock">
<div id="RecentTitle" class="Content-Title trans TextS1" tid="t35">recent open</div>
<div id="RecentClearAllBtn" class="trans TextS1" tid="t12" onClick="OnDeleteAllRecentFiles()">Clear all</div>
</div>

View file

@ -0,0 +1,340 @@
/*------------------ Date Function ------------------------*/
function GetFullToday( )
{
var d=new Date();
var nday=d.getDate();
var nmonth=d.getMonth()+1;
var nyear=d.getFullYear();
var strM=nmonth+'';
if( nmonth<10 )
strM='0'+nmonth;
var strD=nday+'';
if( nday<10 )
strD='0'+nday;
return nyear+'-'+strM+'-'+strD;
}
function GetFullDate()
{
var d=new Date();
var tDate={};
tDate.nyear=d.getFullYear();
tDate.nmonth=d.getMonth()+1;
tDate.nday=d.getDate();
tDate.nhour=d.getHours();
tDate.nminute=d.getMinutes();
tDate.nsecond=d.getSeconds();
tDate.nweek=d.getDay();
tDate.ndate=d.getDate();
var strM=tDate.nmonth+'';
if( tDate.nmonth<10 )
strM='0'+tDate.nmonth;
var strD=tDate.nday+'';
if( tDate.nday<10 )
strD='0'+tDate.nday;
var strH=tDate.nhour+'';
if( tDate.nhour<10 )
strH='0'+tDate.nhour;
var strMin=tDate.nminute+'';
if( tDate.nminute<10 )
strMin='0'+tDate.nminute;
var strS=tDate.nsecond+'';
if( tDate.nsecond<10 )
strS='0'+tDate.nsecond;
tDate.strdate=tDate.nyear+'-'+strM+'-'+strD;
tDate.strFulldate=tDate.strdate+' '+strH+':'+strMin+':'+strS;
return tDate;
}
function Unixtimestamp2Date( nSecond )
{
var d=new Date(nSecond*1000);
var tDate={};
tDate.nyear=d.getFullYear();
tDate.nmonth=d.getMonth()+1;
tDate.nday=d.getDate();
tDate.nhour=d.getHours();
tDate.nminute=d.getMinutes();
tDate.nsecond=d.getSeconds();
tDate.nweek=d.getDay();
tDate.ndate=d.getDate();
var strM=tDate.nmonth+'';
if( tDate.nmonth<10 )
strM='0'+tDate.nmonth;
var strD=tDate.nday+'';
if( tDate.nday<10 )
strD='0'+tDate.nday;
tDate.strdate=tDate.nyear+'-'+strM+'-'+strD;
return tDate.strdate;
}
//------------Array Function-------------
Array.prototype.in_array = function (e) {
let sArray= ',' + this.join(this.S) + ',';
let skey=','+e+',';
if(sArray.indexOf(skey)>=0)
return true;
else
return false;
}
//------------String Function------------------
/**
* Delete Left/Right Side Blank
*/
String.prototype.trim=function()
{
return this.replace(/(^\s*)|(\s*$)/g, '');
}
/**
* Delete Left Side Blank
*/
String.prototype.ltrim=function()
{
return this.replace(/(^\s*)/g,'');
}
/**
* Delete Right Side Blank
*/
String.prototype.rtrim=function()
{
return this.replace(/(\s*$)/g,'');
}
//----------------Get Param-------------
function GetQueryString(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r!=null)
{
return unescape(r[2]);
}
else
{
return null;
}
}
function GetGetStr()
{
let strGet="";
//获取当前URL
let url = document.location.href;
//获取?的位置
let index = url.indexOf("?")
if(index != -1) {
//截取出?后面的字符串
strGet = url.substr(index + 1);
}
return strGet;
}
/*--------------------JSON Function------------*/
/*
功能检查一个字符串是不是标准的JSON格式
参数 strJson 被检查的字符串
返回值 如果字符串是一个标准的JSON格式则返回JSON对象
如果字符串不是标准JSON格式则返回null
*/
function IsJson( strJson )
{
var tJson=null;
try
{
tJson=JSON.parse(strJson);
}
catch(exception)
{
return null;
}
return tJson;
}
/*-----------------------Ajax Function--------------------*/
/*JQueryAjax
参数说明
url 目标地址
action post/get
data 字符串格式的发送内容
asyn true---异步模式;false-----同步模式;
*/
function HttpReq( url,action, data,callbackfunc)
{
var strAction=action.toLowerCase();
if( strAction=="post")
{
$.post(url,data,callbackfunc);
}
else if( strAction=="get")
{
$.get(url,callbackfunc);
}
}
/*---------------Cookie Function-------------------*/
function setCookie(name, value, time='',path='') {
if(time && path){
var strsec = time * 1000;
var exp = new Date();
exp.setTime(exp.getTime() + strsec * 1);
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path="+path;
}else if(time){
var strsec = time * 1000;
var exp = new Date();
exp.setTime(exp.getTime() + strsec * 1);
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}else if(path){
document.cookie = name + "=" + escape(value) + ";path="+path;
}else{
document.cookie = name + "=" + escape(value);
}
}
function getCookie(c_name)
{
if(document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");//获取字符串的起点
if(c_start != -1) {
c_start = c_start + c_name.length + 1;//获取值的起点
c_end = document.cookie.indexOf(";", c_start);//获取结尾处
if(c_end == -1) c_end = document.cookie.length;//如果是最后一个结尾就是cookie字符串的结尾
return decodeURI(document.cookie.substring(c_start, c_end));//截取字符串返回
}
}
return "";
}
function checkCookie(c_name) {
username = getCookie(c_name);
console.log(username);
if (username != null && username != "")
{ return true; }
else
{ return false; }
}
function clearCookie(name) {
setCookie(name, "", -1);
}
/*--------Studio WX Message-------*/
function IsInSlicer()
{
let bMatch=navigator.userAgent.match( RegExp('BBL-Slicer','i') );
return bMatch;
}
function SendWXMessage( strMsg )
{
let bCheck=IsInSlicer();
if(bCheck!=null)
{
window.wx.postMessage(strMsg);
}
}
/*------CSS Link Control----*/
function RemoveCssLink( LinkPath )
{
let pNow=$("head link[href='"+LinkPath+"']");
let nTotal=pNow.length;
for( let n=0;n<nTotal;n++ )
{
pNow[n].remove();
}
}
function AddCssLink( LinkPath )
{
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.href = LinkPath;
link.rel = 'stylesheet';
link.type = 'text/css';
head.appendChild(link);
}
function CheckCssLinkExist( LinkPath )
{
let pNow=$("head link[href='"+LinkPath+"']");
let nTotal=pNow.length;
return nTotal;
}
/*------Dark Mode------*/
function SwitchDarkMode( DarkCssPath )
{
ExecuteDarkMode( DarkCssPath );
setInterval("ExecuteDarkMode('"+DarkCssPath+"')",1000);
}
function ExecuteDarkMode( DarkCssPath )
{
let nMode=0;
let bDarkMode=navigator.userAgent.match( RegExp('dark','i') );
if( bDarkMode!=null )
nMode=1;
let nNow=CheckCssLinkExist(DarkCssPath);
if( nMode==0 )
{
if(nNow>0)
RemoveCssLink(DarkCssPath);
}
else
{
if(nNow==0)
AddCssLink(DarkCssPath);
}
}
SwitchDarkMode("css/dark.css");

View file

@ -12,9 +12,6 @@ function OnInit()
SendMsg_GetLoginInfo();
SendMsg_GetRecentFile();
SendMsg_GetStaffPick();
//InitStaffPick();
}
//------最佳打开文件的右键菜单功能----------
@ -121,10 +118,6 @@ function HandleStudio( pVal )
$("#NoPluginTip").hide();
}
}
else if( strCmd=="modelmall_model_advise_get")
{
ShowStaffPick( pVal['hits'] );
}
}
function GotoMenu( strMenu )
@ -405,90 +398,6 @@ function OpenWikiUrl( strUrl )
SendWXMessage( JSON.stringify(tSend) );
}
//--------------Staff Pick-------
var StaffPickSwiper=null;
function InitStaffPick()
{
if( StaffPickSwiper!=null )
{
StaffPickSwiper.destroy(true,true);
StaffPickSwiper=null;
}
StaffPickSwiper = new Swiper('#HotModel_Swiper.swiper', {
slidesPerView : 'auto',
spaceBetween: 16,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// autoplay: {
// delay: 3000,
// stopOnLastSlide: false,
// disableOnInteraction: true,
// disableOnInteraction: false
// },
// pagination: {
// el: '.swiper-pagination',
// },
scrollbar: {
el: '.swiper-scrollbar',
draggable: true
}
});
}
function SendMsg_GetStaffPick()
{
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="modelmall_model_advise_get";
SendWXMessage( JSON.stringify(tSend) );
}
function ShowStaffPick( ModelList )
{
let PickTotal=ModelList.length;
if(PickTotal==0)
{
$('#HotModelList').html('');
$('#HotModelArea').hide();
return;
}
let strPickHtml='';
for(let a=0;a<PickTotal;a++)
{
let OnePickModel=ModelList[a];
let ModelID=OnePickModel['design']['id'];
let ModelName=OnePickModel['design']['title'];
let ModelCover=OnePickModel['design']['cover'];
strPickHtml+='<div class="HotModelPiece swiper-slide" onClick="OpenOneStaffPickModel('+ModelID+')" >'+
' <div class="HotModel_PrevBlock"><img class="HotModel_PrevImg" src="'+ModelCover+'" /></div>'+
' <div class="HotModel_NameText">'+ModelName+'</div>'+
'</div>';
}
$('#HotModelList').html(strPickHtml);
InitStaffPick();
$('#HotModelArea').show();
}
function OpenOneStaffPickModel( ModelID )
{
var tSend={};
tSend['sequence_id']=Math.round(new Date() / 1000);
tSend['command']="modelmall_model_open";
tSend['data']={};
tSend['data']['id']=ModelID;
SendWXMessage( JSON.stringify(tSend) );
}
//---------------Global-----------------
window.postMessage = HandleStudio;

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,185 @@
var JSON;
if (!JSON) {
JSON = {};
}
(function () {
'use strict';
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
return String(value);
case 'object':
if (!value) {
return 'null';
}
gap += indent;
partial = [];
if (Object.prototype.toString.apply(value) === '[object Array]') {
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
v = partial.length === 0
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
gap = mind;
return v;
}
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
v = partial.length === 0
? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
var i;
gap = '';
indent = '';
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
} else if (typeof space === 'string') {
indent = space;
}
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
return str('', {'': value});
};
}
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
var j;
function walk(holder, key) {
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
j = eval('(' + text + ')');
return typeof reviver === 'function'
? walk({'': j}, '')
: j;
}
throw new SyntaxError('JSON.parse');
};
}
}());

View file

@ -292,10 +292,6 @@ void AppConfig::set_defaults()
set("max_recent_count", "18");
}
if (get("staff_pick_switch").empty()) {
set_bool("staff_pick_switch", true);
}
if (get("sync_system_preset").empty()) {
set_bool("sync_system_preset", true);
}

View file

@ -3702,24 +3702,6 @@ std::string GUI_App::handle_web_request(std::string cmd)
}
}
}
else if (command_str.compare("modelmall_model_advise_get") == 0) {
if (mainframe && this->app_config->get("staff_pick_switch") == "true") {
if (mainframe->m_webview) {
mainframe->m_webview->SendDesignStaffpick(m_agent);
}
}
}
else if (command_str.compare("modelmall_model_open") == 0) {
if (root.get_child_optional("data") != boost::none) {
pt::ptree data_node = root.get_child("data");
boost::optional<std::string> id = data_node.get_optional<std::string>("id");
if (id.has_value() && m_agent) {
std::string url;
if (m_agent->get_model_mall_detail_url(&url, id.value()) == 0)
wxLaunchDefaultBrowser(url);
}
}
}
else if (command_str.compare("homepage_open_recentfile") == 0) {
if (root.get_child_optional("data") != boost::none) {
pt::ptree data_node = root.get_child("data");
@ -3808,12 +3790,6 @@ std::string GUI_App::handle_web_request(std::string cmd)
}
}
}
else if (command_str.compare("common_openurl") == 0) {
boost::optional<std::string> path = root.get_optional<std::string>("url");
if (path.has_value()) {
wxLaunchDefaultBrowser(path.value());
}
}
}
}
catch (...) {
@ -4578,11 +4554,6 @@ void GUI_App::stop_http_server()
m_http_server.stop();
}
void GUI_App::switch_staff_pick(bool on)
{
mainframe->m_webview->SendDesignStaffpick(on ? m_agent : nullptr);
}
bool GUI_App::switch_language()
{
if (select_language()) {

View file

@ -439,7 +439,6 @@ public:
void stop_sync_user_preset();
void start_http_server();
void stop_http_server();
void switch_staff_pick(bool on);
void on_show_check_privacy_dlg(int online_login = 0);
void show_check_privacy_dlg(wxCommandEvent& evt);

View file

@ -604,11 +604,6 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
app_config->set_bool(param, checkbox->GetValue());
app_config->save();
if (param == "staff_pick_switch") {
bool pbool = app_config->get("staff_pick_switch") == "true";
wxGetApp().switch_staff_pick(pbool);
}
// backup
if (param == "backup_switch") {
bool pbool = app_config->get("backup_switch") == "true" ? true : false;
@ -941,11 +936,6 @@ wxWindow* PreferencesDialog::create_general_page()
_L("If enabled, sets BambuStudio as default application to open .step files"), 50, "associate_step");
#endif // _WIN32
auto title_modelmall = create_item_title(_L("Online Models"), page, _L("Online Models"));
// auto item_backup = create_item_switch(_L("Backup switch"), page, _L("Backup switch"), "units");
auto item_modelmall = create_item_checkbox(_L("Show online staff-picked models on the home page"), page, _L("Show online staff-picked models on the home page"), 50, "staff_pick_switch");
auto title_project = create_item_title(_L("Project"), page, "");
auto item_max_recent_count = create_item_input(_L("Maximum recent projects"), "", page, _L("Maximum count of recent projects"), "max_recent_count", [](wxString value) {
long max = 0;
@ -986,9 +976,6 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(item_associate_stl, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_associate_step, 0, wxTOP, FromDIP(3));
#endif // _WIN32
sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20));
sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3));
sizer_page->Add(title_project, 0, wxTOP| wxEXPAND, FromDIP(20));
sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_save_choise, 0, wxTOP, FromDIP(3));

View file

@ -427,23 +427,6 @@ void WebViewPanel::SendRecentList(wxString const &sequence_id)
RunScript(wxString::Format("window.postMessage(%s)", oss.str()));
}
void WebViewPanel::SendDesignStaffpick(NetworkAgent *agent)
{
if (agent) {
agent->get_design_staffpick(0, 60, [this](std::string body) {
if (body.empty() || body.front() != '{') {
BOOST_LOG_TRIVIAL(warning) << "get_design_staffpick failed " + body;
return;
}
CallAfter([this, body] {
auto body2 = body;
body2.insert(1, "\"command\": \"modelmall_model_advise_get\", ");
RunScript(wxString::Format("window.postMessage(%s)", body2));
});
});
}
}
void WebViewPanel::SendLoginInfo()
{
if (wxGetApp().getAgent()) {

View file

@ -27,9 +27,6 @@
namespace Slic3r {
class NetworkAgent;
namespace GUI {
@ -94,7 +91,6 @@ public:
public:
void SendRecentList(wxString const &sequence_id);
void SendDesignStaffpick(NetworkAgent *agent);
void SendLoginInfo();
void ShowNetpluginTip();

View file

@ -92,12 +92,10 @@ func_get_slice_info NetworkAgent::get_slice_info_ptr = nullptr;
func_query_bind_status NetworkAgent::query_bind_status_ptr = nullptr;
func_modify_printer_name NetworkAgent::modify_printer_name_ptr = nullptr;
func_get_camera_url NetworkAgent::get_camera_url_ptr = nullptr;
func_get_design_staffpick NetworkAgent::get_design_staffpick_ptr = nullptr;
func_start_pubilsh NetworkAgent::start_publish_ptr = nullptr;
func_get_profile_3mf NetworkAgent::get_profile_3mf_ptr = nullptr;
func_get_model_publish_url NetworkAgent::get_model_publish_url_ptr = nullptr;
func_get_model_mall_home_url NetworkAgent::get_model_mall_home_url_ptr = nullptr;
func_get_model_mall_detail_url NetworkAgent::get_model_mall_detail_url_ptr = nullptr;
func_get_my_profile NetworkAgent::get_my_profile_ptr = nullptr;
func_track_enable NetworkAgent::track_enable_ptr = nullptr;
func_track_event NetworkAgent::track_event_ptr = nullptr;
@ -240,13 +238,11 @@ int NetworkAgent::initialize_network_module(bool using_backup)
get_slice_info_ptr = reinterpret_cast<func_get_slice_info>(get_network_function("bambu_network_get_slice_info"));
query_bind_status_ptr = reinterpret_cast<func_query_bind_status>(get_network_function("bambu_network_query_bind_status"));
modify_printer_name_ptr = reinterpret_cast<func_modify_printer_name>(get_network_function("bambu_network_modify_printer_name"));
get_camera_url_ptr = reinterpret_cast<func_get_camera_url>(get_network_function("bambu_network_get_camera_url"));
get_design_staffpick_ptr = reinterpret_cast<func_get_design_staffpick>(get_network_function("bambu_network_get_design_staffpick"));
get_camera_url_ptr = reinterpret_cast<func_get_camera_url>(get_network_function("bambu_network_get_camera_url"));
start_publish_ptr = reinterpret_cast<func_start_pubilsh>(get_network_function("bambu_network_start_publish"));
get_profile_3mf_ptr = reinterpret_cast<func_get_profile_3mf>(get_network_function("bambu_network_get_profile_3mf"));
get_model_publish_url_ptr = reinterpret_cast<func_get_model_publish_url>(get_network_function("bambu_network_get_model_publish_url"));
get_model_mall_home_url_ptr = reinterpret_cast<func_get_model_mall_home_url>(get_network_function("bambu_network_get_model_mall_home_url"));
get_model_mall_detail_url_ptr = reinterpret_cast<func_get_model_mall_detail_url>(get_network_function("bambu_network_get_model_mall_detail_url"));
get_my_profile_ptr = reinterpret_cast<func_get_my_profile>(get_network_function("bambu_network_get_my_profile"));
track_enable_ptr = reinterpret_cast<func_track_enable>(get_network_function("bambu_network_track_enable"));
track_event_ptr = reinterpret_cast<func_track_event>(get_network_function("bambu_network_track_event"));
@ -343,12 +339,10 @@ int NetworkAgent::unload_network_module()
query_bind_status_ptr = nullptr;
modify_printer_name_ptr = nullptr;
get_camera_url_ptr = nullptr;
get_design_staffpick_ptr = nullptr;
start_publish_ptr = nullptr;
get_profile_3mf_ptr = nullptr;
get_model_publish_url_ptr = nullptr;
get_model_mall_home_url_ptr = nullptr;
get_model_mall_detail_url_ptr = nullptr;
get_my_profile_ptr = nullptr;
track_enable_ptr = nullptr;
track_event_ptr = nullptr;
@ -1094,17 +1088,6 @@ int NetworkAgent::get_camera_url(std::string dev_id, std::function<void(std::str
return ret;
}
int NetworkAgent::get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback)
{
int ret = 0;
if (network_agent && get_design_staffpick_ptr) {
ret = get_design_staffpick_ptr(network_agent, offset, limit, callback);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%")%network_agent %ret;
}
return ret;
}
int NetworkAgent::start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string *out)
{
int ret = 0;
@ -1148,17 +1131,6 @@ int NetworkAgent::get_model_mall_home_url(std::string* url)
return ret;
}
int NetworkAgent::get_model_mall_detail_url(std::string* url, std::string id)
{
int ret = 0;
if (network_agent && get_model_publish_url_ptr) {
ret = get_model_mall_detail_url_ptr(network_agent, url, id);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
int NetworkAgent::get_my_profile(std::string token, unsigned int *http_code, std::string *http_body)
{
int ret = 0;

View file

@ -72,12 +72,10 @@ typedef int (*func_get_slice_info)(void *agent, std::string project_id, std::str
typedef int (*func_query_bind_status)(void *agent, std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body);
typedef int (*func_modify_printer_name)(void *agent, std::string dev_id, std::string dev_name);
typedef int (*func_get_camera_url)(void *agent, std::string dev_id, std::function<void(std::string)> callback);
typedef int (*func_get_design_staffpick)(void *agent, int offset, int limit, std::function<void(std::string)> callback);
typedef int (*func_start_pubilsh)(void *agent, PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
typedef int (*func_get_profile_3mf)(void *agent, BBLProfile* profile);
typedef int (*func_get_model_publish_url)(void *agent, std::string* url);
typedef int (*func_get_model_mall_home_url)(void *agent, std::string* url);
typedef int (*func_get_model_mall_detail_url)(void *agent, std::string* url, std::string id);
typedef int (*func_get_my_profile)(void *agent, std::string token, unsigned int *http_code, std::string *http_body);
typedef int (*func_track_enable)(void *agent, bool enable);
typedef int (*func_track_event)(void *agent, std::string evt_key, std::string content);
@ -163,12 +161,10 @@ public:
int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body);
int modify_printer_name(std::string dev_id, std::string dev_name);
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback);
int get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback);
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
int get_profile_3mf(BBLProfile* profile);
int get_model_publish_url(std::string* url);
int get_model_mall_home_url(std::string* url);
int get_model_mall_detail_url(std::string* url, std::string id);
int get_my_profile(std::string token, unsigned int* http_code, std::string* http_body);
int track_enable(bool enable);
int track_event(std::string evt_key, std::string content);
@ -243,12 +239,10 @@ private:
static func_query_bind_status query_bind_status_ptr;
static func_modify_printer_name modify_printer_name_ptr;
static func_get_camera_url get_camera_url_ptr;
static func_get_design_staffpick get_design_staffpick_ptr;
static func_start_pubilsh start_publish_ptr;
static func_get_profile_3mf get_profile_3mf_ptr;
static func_get_model_publish_url get_model_publish_url_ptr;
static func_get_model_mall_home_url get_model_mall_home_url_ptr;
static func_get_model_mall_detail_url get_model_mall_detail_url_ptr;
static func_get_my_profile get_my_profile_ptr;
static func_track_enable track_enable_ptr;
static func_track_event track_event_ptr;