+
-
picker
+
{{ $t("adminUtils.chooseFile") }}
-
diff --git a/frontend/admin/src/locales.js b/frontend/admin/src/locales.js
index b05cab00..ec830104 100644
--- a/frontend/admin/src/locales.js
+++ b/frontend/admin/src/locales.js
@@ -57,7 +57,10 @@ export default {
addSample: "添加样例",
fold: "折叠",
show: "展开",
- deleteThisSample: "删除这组样例?"
+ deleteThisSample: "删除这组样例?",
+ testCase: "测试用例",
+ uploadProgress: "上传进度",
+
},
adminUtils: {
search: "搜索",
@@ -82,6 +85,13 @@ export default {
delete: "删除",
input: "输入",
output: "输出",
+ download: "下载",
+ upload: "上传",
+
+ score: "分数",
+ help: "帮助",
+
+ chooseFile: "选择文件",
unsupportedBrowserWarningMsg: "当前网页
不支持 你正在使用的浏览器, 为了正常的访问,请到
升级你的浏览器"
}
diff --git a/frontend/admin/src/main.js b/frontend/admin/src/main.js
index 90221b75..f0c06755 100644
--- a/frontend/admin/src/main.js
+++ b/frontend/admin/src/main.js
@@ -8,6 +8,7 @@ import "bootstrap"
import bootbox from "bootbox"
import locale from "./locales"
+import getCookie from "./utils/cookie"
import userList from "./components/account/userList.vue"
import editUser from "./components/account/editUser.vue"
@@ -32,14 +33,6 @@ Object.keys(locale).forEach(function (lang) {
// custom ajax
Vue.use({
install: function (Vue, options) {
- function getCookie(name) {
- var value = "; " + document.cookie;
- var parts = value.split("; " + name + "=");
- if (parts.length == 2) {
- return parts.pop().split(";").shift();
- }
- }
-
Vue.prototype.request = function (option) {
var request = new XMLHttpRequest();
request.open(option.method, option.url, true);
@@ -74,10 +67,10 @@ Vue.use({
request.onerror();
}
};
- request.setRequestHeader('x-requested-with', 'XMLHttpRequest');
- if (option.method.toLowerCase() == 'post' || option.method.toLowerCase() == 'put') {
+ request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ if (option.method.toLowerCase() != 'get') {
request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
- request.setRequestHeader('x-csrftoken', getCookie('csrftoken'));
+ request.setRequestHeader('X-CSRFToken', getCookie('csrftoken'));
request.send(JSON.stringify(option.data));
}
else {
diff --git a/frontend/admin/src/utils/cookie.js b/frontend/admin/src/utils/cookie.js
new file mode 100644
index 00000000..bcae3066
--- /dev/null
+++ b/frontend/admin/src/utils/cookie.js
@@ -0,0 +1,10 @@
+function getCookie(name) {
+ var value = "; " + document.cookie;
+ var parts = value.split("; " + name + "=");
+ if (parts.length == 2) {
+ return parts.pop().split(";").shift();
+ }
+}
+
+
+module.exports = getCookie;
\ No newline at end of file