-
Notifications
You must be signed in to change notification settings - Fork 44
/
edit.html
114 lines (92 loc) · 4.64 KB
/
edit.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-type' content='text/html; charset=utf-8'>
<meta http-equiv="Cache-control" content="public">
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>easy resume editor</title>
<link rel="stylesheet" href="src/stylesheet/edit.css" type="text/css"></link>
<link rel="stylesheet" href="src/stylesheet/resume.css" type="text/css"></link>
<link rel="stylesheet" media="screen and (min-width: 1020px)" href="src/stylesheet/resume_hdp.css" type="text/css"></link>
<link rel="stylesheet" media="screen and (max-width: 1019px) and (min-width: 451px)" href="src/stylesheet/resume_mdp.css" type="text/css"></link>
<link rel="stylesheet" media="screen and (max-width: 450px)" href="src/stylesheet/resume_ldp.css" type="text/css"></link>
<script src="https://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
<script src="react15/react.js"></script>
<script src="react15/react-dom.js"></script>
<script src="react15/browser.min.js"></script>
<script type="text/babel" src="src/js/editor/StringInput.js" charset="UTF-8"></script>
<script type="text/babel" src="src/js/editor/ArrayInput.js" charset="UTF-8"></script>
<script type="text/babel" src="src/js/editor/FragmentEditInput.js" charset="UTF-8"></script>
<script type="text/babel" src="src/js/editor/editSections.js" charset="UTF-8"></script>
<script type="text/babel" src="src/js/editor/WorkEditInput.js" charset="UTF-8"></script>
<script type="text/babel" src="src/js/editor/ProjectEditInput.js" charset="UTF-8"></script>
<script type="text/babel" src="src/js/editor/EducationEditInput.js" charset="UTF-8"></script>
<script type="text/babel" src="src/js/editor/editor.js" charset="UTF-8"></script>
<script type="text/babel" src="src/js/basecomponents.js" charset="UTF-8"></script>
<script type="text/babel" src="src/js/resumecomponents.js" charset="UTF-8"></script>
<style>
</style>
</head>
<body>
<div id="sliderBar">
<button id="uploadBtn">上传JSON配置</button>
<input type="file" id="selectFiles"/><!--上传文件的input,会被隐藏-->
<div id="editorArea"></div>
</div>
<div id="container">
<div id="defaultMsg">
<h2>EasyResume初始化错误</h2>
<p>
如果你看到这个页面,证明页面初始化失败了,这很可能是由于你直接在本地打开简历的缘故。EasyResume需要用HTTP的方法访问才能初始化。若你已经安装了python, 可以尝试:
</p>
<code>python -m SimpleHTTPServer</code>
<p>来启动HTTP服务,然后浏览器中输入<a href="http://localhost:8000">http://localhost:8000</a>去查看resume.html</p>
<h2>EasyResume initiailized error</h2>
<p>
If you can see this, EasyResume is not working right. This is probably because you're viewing this on your file system instead of a web server. If you have installed python, try running
</p>
<code>python -m SimpleHTTPServer</code>
<p>and going to <a href="http://localhost:8000">http://localhost:8000</a> then check resume.html</p>
</div>
</div>
<script type="text/babel">
function renderPage(json) {
$("#editorArea").empty();
editor = ReactDOM.render(<div><Editor json={json}/></div>,document.getElementById('editorArea'));
ReactDOM.render(<div><Resume json={json}/></div>,document.getElementById('container'));
}
var json ={};
var editor;//editor component
var handleUpload = function() {
console.log("getstate",editor);
var files = document.getElementById('selectFiles').files;
if (files.length <= 0) {
return false;
}
var fr = new FileReader();
fr.onload = function (e) {
var json = JSON.parse(e.target.result);
console.log("uploading json ",json);
renderPage(json);
};
fr.readAsText(files.item(0));
};
$("#uploadBtn").off("click").on("click",function(){
$('#selectFiles').trigger("click");
});
$('#selectFiles').change(function(e){
console.log("change....")
handleUpload();
});
//preview
$.getJSON("edit_template.json",[],function(data){
console.log('[resume.json read successfully]',data);
renderPage(data);
});
//一秒后显示默认的提示区域,如果正常初始化,$('#defaultMsg')将不存在,故没有作用
window.setTimeout(function(){
$('#defaultMsg').show();
},1000);
</script>
</body>
</html>