'; notify_content = null; notify_options = {}; alertTip = ''; $error_box = $(".flash_error.flash_error_box"); if (notify_options.type === 'error' && $error_box.length > 0 && !$.isEmptyObject(notify_content.message)) { if (notify_content.message === 'captcha_fail') { alertTip = "验证码不正确"; } else if (notify_content.message === 'captcha_expired') { alertTip = "验证码已过期,请点击刷新"; } else if (notify_content.message === 'not_found_in_database') { alertTip = "帐号或者密码错误"; } else if (notify_content.message === 'not_found_and_show_captcha') { alertTip = "帐号或者密码错误"; } else if (notify_content.message === 'phone_captcha_fail') { alertTip = "手机验证码不通过"; } else { alertTip = notify_content.message; } return $error_box.html(alertTip).show(); } else if (notify_content) { if ("show" === 'third_party_binding') { return $('#third_party_binding-message').html(notify_content.message).addClass('ui message red'); } notify_options.delay = 3000; notify_options.template = template; notify_options.offset = { x: 10, y: 30 }; notify_options.element = '#messages-container'; return $.notify(notify_content, notify_options); } }); }).call(this);
13 Star 137 Fork 55

crudapi/crudapi-admin-web

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
`   $popPanel.append(no_data_html) } var debounceLoadMoreBranches = window.globalUtils.debouce(function () { if (concurrentRequestLock) return; branch_page_number += 1; if (branch_page_number > branch_total_pager) return; loadData(search_text, branch_page_number); }, 350); function loadData(search, page) { if (concurrentRequestLock) { return; } concurrentRequestLock = true; var searchParams = search || ""; var pageParams = page || 1; $.ajax({ url: "/" + gon.user_project + "/branches/names.json", type: 'GET', data: { search: searchParams, page: pageParams, }, dataType: 'json', success: function (data) { branch_total_pager = data.total_pages; var html = ''; if (pageParams === 1) { $branchesDropdown.empty(); } data.branches.forEach(function (branch) { var protectRule = ''; var branchName = filterXSS(branch.name); if(branch.branch_type.value === 1) { var rule = filterXSS(branch.protection_rule.wildcard); protectRule = ` ` } html += `
${branchName} ${protectRule}
` }); $branchesDropdown.append(html); $('.protected-branch-popup').popup() if (pageParams === 1 && data.count === 0) { toggleNoResultView($branchesDropdown); } }, complete: function () { concurrentRequestLock = false; } }); } $tagsDropdown.scroll(function() { var tagsPanel = document.getElementById('tags_panel'); var numOfTags = $tagsDropdown.children().length; if (tagsPanel.clientHeight + tagsPanel.scrollTop + 37 > tagsPanel.scrollHeight && numOfTags < 12) { debounceLoadMore.call(); } }); var debounceLoadMore = window.globalUtils.debouce(function () { if (flag_is_loading) return; flag_page_number += 1; if (flag_page_number > flag_total_pager) return; fetchTags(search_text, flag_page_number); }, 350); function fetchTags(search, page) { var searchParams = search || ""; var pageParams = page || 1; if (flag_is_loading) return; flag_is_loading = true; $.ajax({ url: "/" + gon.user_project + "/tags/names.json", data: { search: searchParams, page: pageParams, }, type: "GET", xhrFields: { withCredentials: true, }, success: function (data) { flag_total_pager = data.total_pages; if (pageParams === 1) { $tagsDropdown.html(''); } data.tags.forEach((tag) => { const itemDiv = document.createElement('div'); itemDiv.classList.add('item'); itemDiv.setAttribute('data-value', tag.name); itemDiv.innerText = window.filterXSS(tag.name); $tagsDropdown.append(itemDiv) }); if (pageParams === 1 && data.count === 0) { toggleNoResultView($tagsDropdown); } }, error: function () { }, complete: function () { flag_is_loading = false; }, }); } $('.project-branch-tab-menu').on('click','.tab-menu-item', function (e) { var $currentTab = $(this).data('tab') if($currentTab === 'branches') { $searchNameInput.val('') search_text = ''; loadData() } if($currentTab === 'tags') { $searchNameInput.val('') search_text = ''; fetchTags(); } })
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT
The MIT License (MIT) Copyright (c) 2021-present crudapi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

所属分支: ".concat(htmlSafe(branch), "

文件路径: ").concat(htmlSafe(readonly_item), " 确认取消分支上这个路径的只读标记?\n "); gitGCModal.confirm("取消只读", confirmString, function() { var parentsReadonly = isParentsReadonly(readonly_item) if (parentsReadonly) { return gitGCModal.alert('提示', '只读记录不存在,或父级目录为只读',function () { location.reload() }) } $.ajax({ url: "/crudapi/crudapi-admin-web/readonly", type: 'DELETE', data: { branch: branch, path: readonly_item }, success: function(res) { if (res.code !== 0) { gitGCModal.alert("提示", res.msg, function() { location.reload(); }) }else { $parent.removeClass('readonly-item') if (gon.readonlyItems) { gon.readonlyItems.splice(gon.readonlyItems.indexOf(readonly_item), 1) } if (type === 'file') { $icon.removeClass('icon-file-readonly readonly-icon') $icon.addClass('icon-file') } else { $icon.removeClass('icon-folder-readonly readonly-icon') $icon.addClass('icon-folders') } $icon.popup('destroy') $item.removeAttr('data-readonly') location.reload(); } } }) }) } // 只读过滤 function isTreeItemReadonly(path, readonlyItems) { var item = readonlyItems.find(function(item) { if (item.slice(-1) === '/') { return path.indexOf(item) === INDEX_BEGIN_WITH_READONLY_DIR } else { return path === item } }) return item !== undefined } function getItemPath(path) { var path_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'file'; return path_type === 'file' ? path : "".concat(path, "/"); } // 启用异步只读差异化的次数 var is_can_readonly = false // 异步对文件树进行只读差异化显示 function markTree() { $.ajax({ url: "/crudapi/crudapi-admin-web/readonly", method: 'get', data: { "branch": "master" }, success:function(result) { var readonlyItems = result.readonly_items gon.readonlyItems = readonlyItems $(".tree-list-item").each(function(){ $this = $(this) var path = $this.attr('data-path') var type = $this.attr('data-type') var item_path = getItemPath(path, type) var readonly = isTreeItemReadonly(item_path, readonlyItems) $icon = $this.find('i') $parent = $this.parent('.tree-item') if (readonly) { $parent.addClass('readonly-item') $this.attr('data-readonly', '') $icon.attr('class', "iconfont icon-".concat(type, "-readonly readonly-icon")); $icon.attr('data-readonly', '') $icon.popup({ content: "只读", className : { popup: 'ui popup dark', }, position: 'top center' }) } else { var className = type === 'file' ? 'file' : 'folders' $this.removeAttr('data-readonly') $icon.attr('class', "iconfont icon-".concat(className)); $icon.removeAttr('data-readonly') } }) } }) } // 若已开启只读功能,对目录进行只读差异化标记 if (is_can_readonly) { markTree() } // 添加只读标记 function addReadonlyMark(path, $item) { var $icon = $($item.context.children[0]) var $parent = $item.parent('.tree-item') var type = $parent.data('type') var branch = $parent.data('branch') var readonly_item = $item.data('path') if (type !== 'file') { readonly_item += "/" } var confirmString = "\n

所属分支: ".concat(htmlSafe(branch), "

文件路径: ").concat(htmlSafe(readonly_item), " 确认将分支上的这个路径标记为只读?\n "); gitGCModal.confirm("标记只读", confirmString,function (){ $.ajax({ url: "/crudapi/crudapi-admin-web/readonly", type: 'POST', data: { branch: branch, path: readonly_item, }, success: function(res) { if (res.code !== 0) { gitGCModal.alert("提示", res.msg,function (){ location.reload(); }) } else { // 之前未开启只读功能 if (!is_can_readonly) { is_can_readonly = true return markTree() } $parent.addClass('readonly-item') var existReadonlyItems = gon.readonlyItems || [] existReadonlyItems.push(readonly_item) gon.readonlyItems = existReadonlyItems $icon.popup({ content: "只读", className : { popup: 'ui popup dark', }, position: 'top center' }) if (type === 'file') { $icon.removeClass('icon-file') $icon.addClass('icon-file-readonly readonly-icon') } else { $icon.removeClass('icon-folders') $icon.addClass('icon-folder-readonly readonly-icon') } $item.attr('data-readonly', '') location.reload(); } } }) }) } function removeFile(path, file_name) { var file_name = file_name || path var content = "确定要删除 %{name} 吗?".replace('%{name}', htmlSafe(file_name)); gitGCModal.confirm("删除", content, function() { $.ajax({ type: "DELETE", dataType: "JSON", url: "/crudapi/crudapi-admin-web/delete/" + path, success: function(res) { if (res.status != 1) { var alert_message = res.message || "删除失败" return gitGCModal.alert("提示", alert_message) } if ($('.tree-item-file-name').length == 2) { window.location.href = '/' + gon.user_project; if(file_name.toUpperCase()==='LICENSE'){ window.location.reload(); } } else { window.location.href = window.location.pathname; if(file_name.toUpperCase()==='LICENSE'){ window.location.reload(); } } } }); }) } // 删除子模块 function removeSubmodule(deleteUrl, $item) { if (!deleteUrl) return var file_name = $item.text().trim() var content = "此操作无法恢复,确定要删除子模块%{name}?".replace('%{name}', htmlSafe(file_name)); new GiteeModalHelper({ approveText: "删除并提交推送", cancelText: "取消", okText: "删除并提交推送", }).confirm("删除", content, function() { $.ajax({ type: "DELETE", dataType: "JSON", url: deleteUrl, success: function(res) { if (res.status == 200) { $item.closest('.row.tree-item').remove(); window.location.reload(); } else { Flash.error(res.message, 5000) } }, error: function (err) { err.responseJSON && Flash.error(err.responseJSON.message); }, }); }) } function rename(file_hex) { $(".row.tree-item").show(); $(".tree-item-rename").hide(); if($("."+file_hex).is(':hidden') == true) return; $("."+file_hex).hide(); var _t = $(".rename-"+file_hex); src = _t.attr('src_text') if(src==undefined){ newName = _t.find("[name='new_filename']").val() _t.attr('src_text',newName) }else{ _t.find("[name='new_filename']").val(_t.attr('src_text')) } $(".rename-"+file_hex).css("display",""); } setTimeout(function(){ $(".popup-save").click(function(){ form = $(this).parents(".ui.form") file_hex = $(this).parents(".row.tree-item").attr("file_hex"); new_filename = $.trim(form.find("[name='new_filename']").val()) overwrite = false $('.tree-item-file-name').find('a').each(function(a){ title = $(this).attr('title'); if(title != undefined){ if (title.split('/')[0] == new_filename) { overwrite = true; } } }); if(overwrite){ form.find("[name='new_filename']").focus(); gitGCModal.alert("提示", "存在相同的文件名,请修改后重试") return; } $.ajax({ type: 'POST', url: "/crudapi/crudapi-admin-web/rename/"+ form.attr('path').replace(/\+/g, '%20'), data: { new_filename: new_filename }, success: function(o){ if(o.status == 1){ href = window.location.href.split('?')[0] window.location.href = href; }else { var alert_message = o.message || "重命名失败" gitGCModal.alert("提示", alert_message) } }, dataType: "json" }); }) $(".popup-close").click(function(){ $(".row.tree-item").show(); $(".tree-item-rename").hide(); }) $('.tree-item-file-name, .tree-item-submodule-name').each(function() { var $this = $(this); if (typeof $this.parent().attr('file_hex') === 'undefined') { return; } $this.on('contextmenu', function(event) { event.preventDefault(); createContextMenu($this, event.pageX, event.pageY); }) }) },1000) })

"; } $complainCommentType.find('.menu').html(result); } }); $complainCommentType.dropdown({showOnFocus: false}); initedCommentsType = true; } } $complainCommentType.on('click', function() { $complaintCommentsModal.modal({ autofocus: false, onApprove: function() { return false; }, onHidden: function() { restoreCommonentDefault(); } }).modal('show'); }); $complaintCommentsContent.on('change keyup', function(e) { var content = $(this).val(); if ($.trim(content).length > 0 && $complainCommentType.dropdown('get value').length > 0 ) { $complaintCommentBtn.removeClass('disabled'); return; } $complaintCommentBtn.addClass('disabled'); }); $complainCommentType.dropdown({ showOnFocus: false, onChange: function(value, text, $selectedItem) { if (value.length > 0 && $.trim($complaintCommentsContent.val()).length > 0) { $complaintCommentBtn.removeClass('disabled'); return } $complaintCommentBtn.addClass('disabled'); } }); function restoreCommonentDefault() { $complainCommentType.dropdown('restore defaults'); $complaintCommentsContent.val(''); $('.exceeded-size-tip').text('').hide(); $complaintModalTip.text('').hide(); setTimeout(function() { setCommentSendTip(false); }, 1500); } $complaintCommentBtn.on('click',function(e){ var reason = $complaintCommentsContent.val(); var appealableId = $('#landing-comments-complaint-modal').attr('data-id'); if (complaintSending) { return; } var appealType = $complainCommentType.dropdown('get value'); var formData = new FormData(); formData.append('appeal_type_id', appealType); formData.append('reason', reason); formData.append('appeal_type','Note'); formData.append('target_id',appealableId); $.ajax({ type: 'POST', url: "/appeals", cache: false, contentType: false, processData: false, data: formData, beforeSend: function() { setCommentSendStatus(true); }, success: function(res) { if (res.status == 200) { setCommentSendTip(true); setTimeout(function() { $complaintCommentsModal.modal('hide'); restoreCommonentDefault(); }, 3000); } setCommentSendStatus(false); }, error: function(err) { showCommonTips(err.responseJSON.message, 'error'); setCommentSendStatus(false); } }) }); function showCommonTips(text, type) { $complaintModalTip.text(text).show(); if (type == 'error') { $complaintModalTip.removeClass('success').addClass('error'); } else { $complaintModalTip.removeClass('error').addClass('success'); } } function setCommentSendStatus(value) { complaintSending = value; if (complaintSending) { $complaintCommentBtn.addClass('loading'); $complaintCommentsContent.attr('readonly', true); $complainCommentType.attr('readonly', true); } else { $complaintCommentBtn.removeClass('loading'); $complaintCommentsContent.attr('readonly', false); $complainCommentType.attr('readonly', false); } } function setCommentSendTip(value) { if (value) { $('.appeal-success-tip').removeClass('hide'); $('.appeal-tip').addClass('hide'); $('.appeal-form').addClass('hide'); $('#landing-comments-complaint-modal .actions').addClass('hide'); } else { $('.appeal-success-tip').addClass('hide'); $('.appeal-tip').removeClass('hide'); $('.appeal-form').removeClass('hide'); $('#landing-comments-complaint-modal .actions').removeClass('hide'); } }

简介

crudapi增删改查接口零代码后台管理页面,框架采用Vue,控件库为Quasar, 形式为SPA单页面应用。 主要知识点:Vue基本知识,自定义组件,axios网络请求,Vuex状态管理,Router路由,本地存储LocalStorage、Session、Cookie,登录,本地调试,docker打包等。 主要功能:元数据管理,序列号管理,表关系设置,业务数据crud增删改查,数据导入导出等。 展开 收起
JavaScript 等 5 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/crudapi/crudapi-admin-web.git
[email protected]:crudapi/crudapi-admin-web.git
crudapi
crudapi-admin-web
crudapi-admin-web
master