本文主要和大家介绍了详解vue-admin和后端(flask)分离结合的例子,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧,希望能帮助到大家。
API汇总:
登录
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})
修改密码
let params = Object.assign({}, this.setpwdForm); export const setpwd = params => { return axios.post(`${base}/setpwd`, params); }; return jsonify({'code': 200, 'msg': "密码修改成功"})
用户获取
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] })
删除用户
let params = { id: row.id }; export const removeUser = params => { return axios.get(`${base}/user/remove`, { params: params }); }; return jsonify({'code': 200, 'msg': "删除成功"})
批量删除
let para = { ids: ids }; export const batchRemoveUser = params => { return axios.get(`${base}/user/bathremove`, { params: params }); }; return jsonify({'code': 200, 'msg': "删除成功"})
获取柱状图数据
export const getdrawPieChart = () => { return axios.get(`${base}/getdrawPieChart`); }; return jsonify({'code': 200, 'profess_value': profess_value, 'grade_value': grade_value, 'grade_data': grade_data})
获取饼状图数据
export const getdrawLineChart = () => { return axios.get(`${base}/getdrawLineChart`); }; return jsonify({'code': 200, 'value': data_value, 'total': total})
相关推荐:
Atas ialah kandungan terperinci vue-admin和后端flask分离结合. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!