Skip to content

Commit

Permalink
✨ 优化加载流程及第三方UI布局
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Dec 13, 2022
1 parent 6f654c2 commit 942462b
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 25 deletions.
13 changes: 6 additions & 7 deletions assets/dist/js/libs.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/dist/js/puock.min.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions assets/dist/style/libs.min.css

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions assets/js/puock.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ class Puock {
const dataType = "json";
const successTip = form.attr("data-success");
const errorTip = form.attr("data-error");
const loading = this.startLoading()
$.ajax({
url, method, data, dataType,
success: (res) => {
this.stopLoading(loading)
if (res.code === 0) {
this.toast(res.msg || successTip, TYPE_SUCCESS)
form.trigger("reset")
Expand All @@ -172,6 +174,7 @@ class Puock {
}
},
error: (e) => {
this.stopLoading(loading)
this.toast(`请求错误:${e.statusText}`, TYPE_DANGER)
this.loadCommentCaptchaImage(form, true)
}
Expand Down Expand Up @@ -890,30 +893,35 @@ class Puock {
})
}

getRemoteHtmlNode(url, callback) {
const loading = layer.load(0, {
startLoading() {
return layer.load(0, {
shade: [0.6, '#000']
});
})
}

stopLoading(id = null) {
layer.close(id)
}

getRemoteHtmlNode(url, callback) {
const loading = this.startLoading()
$.get(url, {}, (res) => {
layer.close(loading)
this.stopLoading(loading)
callback(res)
}).error((e) => {
console.error(e)
layer.close(loading)
this.stopLoading(loading)
this.toast("获取内容节点数据失败", TYPE_DANGER)
})
}

initModalToggle() {
$(document).on("click", ".pk-modal-toggle", (e) => {
const el = $(this.ct(e));
let classStr = '';
const noTitle = el.attr("data-no-title") !== undefined;
const noPadding = el.attr("data-no-padding") !== undefined;
// classStr += el.attr("data-transparent") !== undefined ? ' modal-transparent' : '';
const title = el.attr("title") || el.attr("data-title") || '提示';
const url = el.attr("data-url");
console.log(noPadding, noTitle)
this.getRemoteHtmlNode(url, (res) => {
layer.open({
type: 1,
Expand Down
2 changes: 1 addition & 1 deletion assets/libs/layer/theme/default/layer.css

Large diffs are not rendered by default.

Binary file removed assets/libs/layer/theme/default/loading-0.gif
Binary file not shown.
Binary file removed assets/libs/layer/theme/default/loading-1.gif
Binary file not shown.
Binary file removed assets/libs/layer/theme/default/loading-2.gif
Binary file not shown.
10 changes: 10 additions & 0 deletions assets/libs/layer/theme/default/loading.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion inc/ajax/page-oauth-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function pk_oauth_quick_page_callback()
function pk_oauth_quick_buttons($echo = false, $redirect = '')
{
$oauth_list = pk_oauth_list();
$out = "<div class='d-flex justify-content-center wh100'>";
$out = "<div class='d-flex justify-content-center wh100 flex-wrap'>";
foreach ($oauth_list as $key => $val) {
if (!isset($val['system']) || !$val['system'] || pk_is_checked('oauth_' . $key)) {
$url = $val['url'] ?? pk_oauth_url_page_ajax($key, $redirect);
Expand Down

0 comments on commit 942462b

Please sign in to comment.