mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-29 15:12:21 +08:00
feat:搜索从网页加载
This commit is contained in:
parent
df7b49dbe2
commit
fbffe12501
@ -751,38 +751,49 @@ void Widget::searchApp(QString text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//加载动画
|
//加载动画
|
||||||
spinner->show();
|
// spinner->show();
|
||||||
spinner->start();
|
// spinner->start();
|
||||||
|
|
||||||
|
// // 关键字搜索处理
|
||||||
|
// httpClient->get("https://search.deepinos.org.cn/appinfo/search")
|
||||||
|
// .header("content-type", "application/json")
|
||||||
|
// .queryParam("keyword", text)
|
||||||
|
// .onResponse([this](QByteArray result)
|
||||||
|
// {
|
||||||
|
// auto json = QJsonDocument::fromJson(result).array();
|
||||||
|
// if (json.empty())
|
||||||
|
// {
|
||||||
|
// qDebug() << "相关应用未找到!";
|
||||||
|
// sendNotification(tr("Relative apps Not Found!"));
|
||||||
|
// mutex.unlock();
|
||||||
|
// clearSearchApp();
|
||||||
|
// spinner->stop();
|
||||||
|
// spinner->hide();
|
||||||
|
// ui->stackedWidget->setCurrentIndex(0);
|
||||||
|
// ui->webEngineView->setUrl(QUrl("https://wayou.github.io/t-rex-runner"));
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// clearSearchApp();
|
||||||
|
// displaySearchApp(json); })
|
||||||
|
// .onError([this](QString errorStr)
|
||||||
|
// {
|
||||||
|
// qDebug() << "请求出错:" << errorStr;
|
||||||
|
// sendNotification(QString(tr("Request Error: %1")).arg(errorStr));
|
||||||
|
// mutex.unlock();
|
||||||
|
// return; })
|
||||||
|
// .timeout(10 * 1000)
|
||||||
|
// .exec();
|
||||||
|
|
||||||
|
if (!themeIsDark){
|
||||||
|
ui->webEngineView->setUrl(serverUrl + "store/#/search?keywords=" + text);
|
||||||
|
}else{
|
||||||
|
ui->webEngineView->setUrl(serverUrl + "store/#/darksearch?keywords=" + text);
|
||||||
|
}
|
||||||
|
// spinner->stop();
|
||||||
|
// spinner->hide();
|
||||||
|
mutex.unlock();
|
||||||
|
|
||||||
|
|
||||||
// 关键字搜索处理
|
|
||||||
httpClient->get("https://search.deepinos.org.cn/appinfo/search")
|
|
||||||
.header("content-type", "application/json")
|
|
||||||
.queryParam("keyword", text)
|
|
||||||
.onResponse([this](QByteArray result)
|
|
||||||
{
|
|
||||||
auto json = QJsonDocument::fromJson(result).array();
|
|
||||||
if (json.empty())
|
|
||||||
{
|
|
||||||
qDebug() << "相关应用未找到!";
|
|
||||||
sendNotification(tr("Relative apps Not Found!"));
|
|
||||||
mutex.unlock();
|
|
||||||
clearSearchApp();
|
|
||||||
spinner->stop();
|
|
||||||
spinner->hide();
|
|
||||||
ui->stackedWidget->setCurrentIndex(0);
|
|
||||||
ui->webEngineView->setUrl(QUrl("https://wayou.github.io/t-rex-runner"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
clearSearchApp();
|
|
||||||
displaySearchApp(json); })
|
|
||||||
.onError([this](QString errorStr)
|
|
||||||
{
|
|
||||||
qDebug() << "请求出错:" << errorStr;
|
|
||||||
sendNotification(QString(tr("Request Error: %1")).arg(errorStr));
|
|
||||||
mutex.unlock();
|
|
||||||
return; })
|
|
||||||
.timeout(10 * 1000)
|
|
||||||
.exec();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user