Home > Web Front-end > JS Tutorial > body text

Separation and combination of vue-admin and back-end flask

小云云
Release: 2018-02-22 15:33:11
Original
2151 people have browsed it

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})
Copy after login

Change password


let params = Object.assign({}, this.setpwdForm);

export const setpwd = params => {
  return axios.post(`${base}/setpwd`, params);
};

return jsonify({'code': 200, 'msg': "密码修改成功"})
Copy after login

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]
  })
Copy after login

Delete user


let params = { id: row.id };

export const removeUser = params => {
  return axios.get(`${base}/user/remove`, { params: params });
};

return jsonify({'code': 200, 'msg': "删除成功"})
Copy after login

Batch delete


let para = { ids: ids };

export const batchRemoveUser = params => {
  return axios.get(`${base}/user/bathremove`, { params: params });
};

return jsonify({'code': 200, 'msg': "删除成功"})
Copy after login

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})
Copy after login

Get the pie chart data


export const getdrawLineChart = () => {
  return axios.get(`${base}/getdrawLineChart`);
};

return jsonify({'code': 200, 'value': data_value, 'total': total})
Copy after login

##Related recommendations:


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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!