做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

Vue和Flask實(shí)現(xiàn)簡(jiǎn)單的登錄驗(yàn)證跳轉(zhuǎn)

來(lái)源:懂視網(wǎng) 責(zé)編:小OO 時(shí)間:2020-11-27 20:05:58
文檔

Vue和Flask實(shí)現(xiàn)簡(jiǎn)單的登錄驗(yàn)證跳轉(zhuǎn)

文件位置。login.html。<;,{ username: this.username.password: this.password }).then(function (response) { console.log(response.status) // 其實(shí)是應(yīng)該走后臺(tái)路由 if(parseInt(response.status) === 200){ window.location.href = ';index';} }).catch(function (error) { console.log(error.response) }) } } })<;/script>;<;/body>;<;/html>;。
推薦度:
導(dǎo)讀文件位置。login.html。<;,{ username: this.username.password: this.password }).then(function (response) { console.log(response.status) // 其實(shí)是應(yīng)該走后臺(tái)路由 if(parseInt(response.status) === 200){ window.location.href = ';index';} }).catch(function (error) { console.log(error.response) }) } } })<;/script>;<;/body>;<;/html>;。
本文主要介紹了Vue+Flask實(shí)現(xiàn)簡(jiǎn)單的登錄驗(yàn)證跳轉(zhuǎn)的示例代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧,希望能幫助到大家。

文件位置:

login.html

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>Login</title>

 <script type="text/javascript" src="../static/vue.js"></script>
 <script type="text/javascript" src="../static/axios.js"></script>

</head>
<body>

<p id="login">
 <form action="#" novalidate>
 <label for="username">Username</label>
 <input type="text" name="username" id="username" placeholder="Enter your Name" v-model="username"><br>
 <label for="password">Password</label>
 <input type="text" name="password" id="password" placeholder="Enter your Password" v-model="password"><br>
 <br>

 <button type="button" v-on:click="login">Apply</button>
 </form>
</p>


<script type="text/javascript">
 var login = new Vue({
 el: '#login',
 data:{
 username: '',
 password: ''
 },
 methods: {
 login: function () {
 axios.post('http://127.0.0.1:5000/login',{
 username: this.username,
 password: this.password
 }).then(function (response) {
 console.log(response.status)
 // 其實(shí)是應(yīng)該走后臺(tái)路由
 if(parseInt(response.status) === 200){
 window.location.href = 'index'
 }
 }).catch(function (error) {
 console.log(error.response)
 })

 }
 }
 })
</script>

</body>
</html>

index.html

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>Index</title>
</head>
<body>
 <h1>Hello,This is Index Page!</h1>
</body>
</html>

Login.py

# -*- coding: utf-8 -*-

from flask import Flask, request, session, redirect, url_for, render_template, make_response, jsonify
app = Flask(__name__)


@app.route('/login', methods=('GET', 'POST'))
def login():
 if request.method == 'POST':
 session['username'] = request.json.get('username')
 session['password'] = request.json.get('password')
 # 登錄成功,則跳轉(zhuǎn)到index頁(yè)面
 return jsonify({'code': 200, 'token': "123456"})
 # 登錄失敗,跳轉(zhuǎn)到當(dāng)前登錄頁(yè)面
 return render_template('login.html')


@app.route('/index')
def index():
 # 如果用戶名和密碼都存在,則跳轉(zhuǎn)到index頁(yè)面,登錄成功
 if 'username' in session and 'password' in session:
 return render_template('index.html')
 # 否則,跳轉(zhuǎn)到login頁(yè)面
 return redirect(url_for('login'))


@app.route('/logout')
def logout():
 session.pop('username', None)
 session.pop('password', None)
 return redirect(url_for('login'))


# set the secret key. keep this really secret:
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'


if __name__ == '__main__':
 app.run(debug=True)

聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

Vue和Flask實(shí)現(xiàn)簡(jiǎn)單的登錄驗(yàn)證跳轉(zhuǎn)

文件位置。login.html。<;,{ username: this.username.password: this.password }).then(function (response) { console.log(response.status) // 其實(shí)是應(yīng)該走后臺(tái)路由 if(parseInt(response.status) === 200){ window.location.href = ';index';} }).catch(function (error) { console.log(error.response) }) } } })<;/script>;<;/body>;<;/html>;。
推薦度:
標(biāo)簽: VUE fl flask
  • 熱門焦點(diǎn)

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 阳谷县| 宣汉县| 资中县| 庆云县| 罗平县| 乌兰察布市| 静安区| 绵阳市| 乐至县| 墨竹工卡县| 哈巴河县| 湘潭市| 林州市| 邵东县| 龙泉市| 莱阳市| 依兰县| 错那县| 平南县| 开封市| 南通市| 阳原县| 伊通| 阿克苏市| 大方县| 新乡县| 深水埗区| 义马市| 西乌珠穆沁旗| 江源县| 扎囊县| 奉贤区| 曲水县| 池州市| 平罗县| 焦作市| 仁寿县| 汤原县| 昌平区| 湘阴县| 习水县|