修改 /<username> 路由存在的问题(每次调用别的路由他都会被调用),新路由为 /<username>/userpage;同时因为修改了路由导致访问userpage_get的时候会导致静态文件路径生成错误,这里修改了\static\config.yml中的静态资源路径,修改后也都可以正常访问到的
parent
16de0a7fd9
commit
84affaeb69
|
@ -1,16 +1,16 @@
|
|||
# 全局引入的css文件地址
|
||||
css:
|
||||
item:
|
||||
- static/css/bootstrap.css
|
||||
- ../static/css/bootstrap.css
|
||||
|
||||
# 全局引入的js文件地址
|
||||
js:
|
||||
head: # 在页面加载之前加载
|
||||
- static/js/jquery.js
|
||||
- static/js/word_operation.js
|
||||
- ../static/js/jquery.js
|
||||
- ../static/js/word_operation.js
|
||||
bottom: # 在页面加载完之后加载
|
||||
- static/js/fillword.js
|
||||
- static/js/highlight.js
|
||||
- ../static/js/fillword.js
|
||||
- ../static/js/highlight.js
|
||||
|
||||
# 高亮样式,目前仅支持修改颜色
|
||||
highlight:
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
alert('无法通过验证。');
|
||||
window.location.href = "/login";
|
||||
} else if (response.status === '1') {
|
||||
window.location.href = "/"+username;
|
||||
window.location.href = "/"+username+"/userpage";
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<input type="password" placeholder="新密码" class="new-password" name="new-password" id="new-password"/>
|
||||
<input type="password" placeholder="确认新密码" class="re-new-password" name="re-new-password" id="re-new-password"/>
|
||||
<button id="submit" class="btn" onclick="reset()">提交</button>
|
||||
<button class="btn" onclick="window.location.href='/{{ username }}'">放弃修改</button>
|
||||
<button class="btn" onclick="window.location.href='/{{ username }}/userpage'">放弃修改</button>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -35,7 +35,7 @@ You're logged in already! <a href="/logout">Logout</a>.
|
|||
} else if (response.status === '2') {
|
||||
let f = confirm("恭喜,你已成功注册,你的用户名是"+username+'.\n点击“确认”开始使用,或点击“取消”返回首页');
|
||||
if (f) {
|
||||
window.location.href = '/'+username;
|
||||
window.location.href = '/'+username+'/userpage';
|
||||
} else {
|
||||
window.location.href = '/';
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<p><b>收集生词吧</b> (可以在正文中划词,也可以复制黏贴)</p>
|
||||
<form method="post" action="/{{ username }}">
|
||||
<form method="post" action="/{{ username }}/userpage">
|
||||
<textarea name="content" id="selected-words" rows="10" cols="120"></textarea><br/>
|
||||
<input type="submit" value="把生词加入我的生词库"/>
|
||||
<input type="reset" value="清除"/>
|
||||
|
|
|
@ -97,7 +97,7 @@ def deleteword(username, word):
|
|||
return "success"
|
||||
|
||||
|
||||
@userService.route("/<username>", methods=['GET', 'POST'])
|
||||
@userService.route("/<username>/userpage", methods=['GET', 'POST'])
|
||||
def userpage(username):
|
||||
'''
|
||||
用户界面
|
||||
|
@ -105,6 +105,7 @@ def userpage(username):
|
|||
:return: 返回用户界面
|
||||
'''
|
||||
# 未登录,跳转到未登录界面
|
||||
print("123123")
|
||||
if not session.get('logged_in'):
|
||||
return render_template('not_login.html')
|
||||
|
||||
|
|
Loading…
Reference in New Issue