本文介绍了vue-admin和后端(flask)分离结合的例子,分享给大家,具体如下
感觉 vue-admin 界面很不错,写了一个小 Demo
看到issues好多问后端数据请求的
就上传了自己最近的这个vue-admin-flask-example,做下小小的分享
API汇总:
export const requestLogin = params => {
return axios({
method: 'POST',url:
})
.then(res => res.data);
};
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})
export const setpwd = params => {
return axios.post(
};
return axios.post(
${base}/setpwd
,params);};
return jsonify({'code': 200,'msg': "密码修改成功"})
export const getUserListPage = params => {
return axios.get(
};
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]
})
export const removeUser = params => {
return axios.get(
};
return axios.get(
${base}/user/remove
,{ params: params });};
return jsonify({'code': 200,'msg': "删除成功"})
批量删除
获取柱状图数据
{
return axios.get(`${base}/getdrawPieChart`);
};
return jsonify({'code': 200,'profess_value': profess_value,'grade_value': grade_value,'grade_data': grade_data})
获取饼状图数据
{
return axios.get(`${base}/getdrawLineChart`);
};
return jsonify({'code': 200,'value': data_value,'total': total})