Browse Source

form -> post

zweizhao 7 years ago
parent
commit
7b44c82121

+ 1 - 2
src/main.js

@@ -4,14 +4,13 @@ import router from './router'
 import store from './store'
 import ElementUI from 'element-ui'
 import 'element-ui/lib/theme-chalk/index.css'
-import { get, post, form, request } from '@/utils/http'
+import { get, post, request } from '@/utils/http'
 
 Vue.use(ElementUI);
 
 Vue.config.productionTip = false
 Vue.prototype.$get = get
 Vue.prototype.$post = post
-Vue.prototype.$form = form
 Vue.prototype.$request = request
 
 new Vue({

+ 1 - 1
src/module/login/index.vue

@@ -54,7 +54,7 @@ export default {
       // this.$router.replace('/main')
       // return
       const { webmaster, password, cypher } = this.ruleForm
-      const res = await this.$form('/api/admin/index/login', { webmaster, password, cypher })
+      const res = await this.$post('/api/admin/index/login', { webmaster, password, cypher })
       console.log(res)
       if(res && res.status) this.$router.replace('/main')
     }

+ 2 - 2
src/module/main/components/cloud_balance.vue

@@ -89,7 +89,7 @@ export default {
   methods: {
     // 点击重试
     async clickRetry(id) {
-      const res = await this.$form('/api/admin/payment/redoDraw', { id })
+      const res = await this.$post('/api/admin/payment/redoDraw', { id })
       console.log(res)
     },
     // 点击用户的 uid
@@ -114,7 +114,7 @@ export default {
     },
     // 获取列表数据
     async getTableData(page = 1) {
-      const res = await this.$form('/api/admin/job/jobs', { page }) // /api/admin/job/jobs {status: 0, p:1} /api/admin/job/job_status_map
+      const res = await this.$post('/api/admin/job/jobs', { page }) // /api/admin/job/jobs {status: 0, p:1} /api/admin/job/job_status_map
       // console.log(res)
       const data = res.data
       this.tableData = this.formatTableData(res.data.list)

+ 4 - 4
src/module/main/components/cloud_developer.vue

@@ -141,7 +141,7 @@
       addVer(formName) {
         this.$refs[formName].validate(async (valid) => {
           if (valid) {
-            await this.$form(apis.addVer, this.form)
+            await this.$post(apis.addVer, this.form)
             this.dialogFormVisible = false
             this.getTableData()
           } else {
@@ -153,7 +153,7 @@
       clickDelete(uid) {
         this.$confirm(`确认删除 uid 为${uid}?`)
           .then(async _ => {
-            await this.$form(apis.delete, {
+            await this.$post(apis.delete, {
               uid
             })
             this.getTableData()
@@ -203,7 +203,7 @@
       },
       // 获取培训状态列表
       async getTrainStates() {
-        const res = await this.$form(apis.getTrainStates)
+        const res = await this.$post(apis.getTrainStates)
         if(res) {
           // console.log(res.data)
           this.states = res.data
@@ -212,7 +212,7 @@
       // 获取列表数据
       async getTableData(status = 0) {
         const p = this.currentPage
-        const res = await this.$form(apis.dataList, {
+        const res = await this.$post(apis.dataList, {
           p
         })
         // console.log(res.data.data)

+ 2 - 2
src/module/main/components/cloud_job.vue

@@ -98,7 +98,7 @@ export default {
     },
     // 获取筛选
     async getFilters() {
-      const res = await this.$form("/api/admin/job/job_status_map");
+      const res = await this.$post("/api/admin/job/job_status_map");
       const data = res.data;
       this.statuses = data || [];
       if (data.length) this.selected = data[0];
@@ -130,7 +130,7 @@ export default {
     // 获取列表数据
     async getTableData(status = 0) {
       const p = this.currentPage;
-      const res = await this.$form("/api/admin/job/jobs", { p, status });
+      const res = await this.$post("/api/admin/job/jobs", { p, status });
       // console.log(res)
       const data = res.data;
       const list = data.list;

+ 2 - 2
src/module/main/components/withdraw.vue

@@ -88,7 +88,7 @@ export default {
   methods: {
     // 点击重试
     async clickRetry(id) {
-      const res = await this.$form("/api/admin/payment/redoDraw", { id });
+      const res = await this.$post("/api/admin/payment/redoDraw", { id });
       console.log(res);
     },
     // 点击用户的 uid
@@ -113,7 +113,7 @@ export default {
     },
     // 获取列表数据
     async getTableData(page = 1) {
-      const res = await this.$form("/api/admin/payment/listDraw", { page });
+      const res = await this.$post("/api/admin/payment/listDraw", { page });
       // console.log(res)
       const data = res.data;
       this.tableData = this.formatTableData(res.data.list);

+ 1 - 1
src/module/welcome/index.vue

@@ -11,7 +11,7 @@ export default {
   },
   methods: {
     async checkLogin() {
-      const res = await this.$form('/api/admin/index/check_login')
+      const res = await this.$post('/api/admin/index/check_login')
       // console.log(res)
       if(res.status) this.$router.replace('/main')
       else this.$router.replace('/login')

+ 0 - 14
src/utils/http.js

@@ -29,20 +29,6 @@ export const get = async (path, data, payload) => {
  */
 export const post = async (path, data = {}, payload) => {
   let result = null
-  await request('post', path, data, payload)
-    .then(res => result = res)
-  return result
-}
-
-/**
- *
- * @param {string} path 请求地址的 path
- * @param {string} data 请求实体
- * @param {object} payload 其他选项
- * @param {object} promise 返回一个 promise
- */
-export const form = async (path, data = {}, payload) => {
-  let result = null
   let formData = ''
   for (const key in data) {
     if (data.hasOwnProperty(key)) {