This section describes how to separate vue-admin from backend (flask ).

Source: Internet
Author: User

This section describes how to separate vue-admin from backend (flask ).

This article introduces an example of how to separate vue-admin from backend (flask ).

I think the vue-admin interface is very good. I wrote a small Demo.

I can see that issues has many questions about backend data requests.

Upload the latest vue-admin-flask-example and share it with you.

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 ': "Logon successful", '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': "password modified successfully "})

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 a user

Let params = {id: row. id}; export const removeUser = params => {return axios. get ('$ {base}/user/delete', {params: params}) ;}; return jsonify ({'code': 200, 'msg ': "deleted successfully "})

Batch Delete

Let para = {ids: ids}; export const batchRemoveUser = params => {return axios. get ('$ {base}/user/bathremove', {params: params}) ;}; return jsonify ({'code': 200, 'msg ': "deleted successfully "})

Obtain 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})

Obtain pie chart data

export const getdrawLineChart = () => {  return axios.get(`${base}/getdrawLineChart`);};return jsonify({'code': 200, 'value': data_value, 'total': total})

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.