This article mainly introduces you to a detailed example of the separation and combination of vue-admin and backend (flask). The editor thinks it is quite good, so I will share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.
API summary:
Login
var params = { username: this.ruleForm2.account, password: this.ruleForm2.checkPass }; export const requestLogin = params => { return axios({ method: 'POST', url: `${base}/login`, auth: params }) .then(res => res.data); }; return jsonify({'code': 200, 'msg': "登录成功", 'token': token.decode('ascii'), 'name': g.admin.name})
Change password
let params = Object.assign({}, this.setpwdForm); export const setpwd = params => { return axios.post(`${base}/setpwd`, params); }; return jsonify({'code': 200, 'msg': "密码修改成功"})
User acquisition
let params = { page: this.page, name: this.filters.name }; export const getUserListPage = params => { return axios.get(`${base}/users/listpage`, { params: params }); }; return jsonify({ 'code': 200, 'total': total, 'page_size': page_size, 'infos': [u.to_dict() for u in Infos] })
Delete user
let params = { id: row.id }; export const removeUser = params => { return axios.get(`${base}/user/remove`, { params: params }); }; return jsonify({'code': 200, 'msg': "删除成功"})
Batch delete
let para = { ids: ids }; export const batchRemoveUser = params => { return axios.get(`${base}/user/bathremove`, { params: params }); }; return jsonify({'code': 200, 'msg': "删除成功"})
Get the bar chart data
export const getdrawPieChart = () => { return axios.get(`${base}/getdrawPieChart`); }; return jsonify({'code': 200, 'profess_value': profess_value, 'grade_value': grade_value, 'grade_data': grade_data})
Get the pie chart data
export const getdrawLineChart = () => { return axios.get(`${base}/getdrawLineChart`); }; return jsonify({'code': 200, 'value': data_value, 'total': total})
Vue and Flask implement simple login verification jump
JS implements Ajax cross-domain request flask response content
flask completes a small application method
The above is the detailed content of Separation and combination of vue-admin and back-end flask. For more information, please follow other related articles on the PHP Chinese website!