guhongwei 4 年之前
父節點
當前提交
f34e8c68a1
共有 4 個文件被更改,包括 59 次插入3 次删除
  1. 4 0
      src/store/index.js
  2. 54 0
      src/store/user/auth-user.js
  3. 1 1
      src/views/dockbind.vue
  4. 0 2
      vue.config.js

+ 4 - 0
src/store/index.js

@@ -18,6 +18,8 @@ import markettype from './market/markettype';
 import transaction from './market/transaction';
 // 交易记录
 import productpact from './market/productpact';
+// 登录用户表
+import authUser from './user/auth-user';
 // 公共
 import * as ustate from '@/store/common/state';
 import * as umutations from '@/store/common/mutations';
@@ -49,5 +51,7 @@ export default new Vuex.Store({
     //修改密码
     password,
     apply,
+    // 登录用户表
+    authUser,
   },
 });

+ 54 - 0
src/store/user/auth-user.js

@@ -0,0 +1,54 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+//用户的菜单选项增删改查
+Vue.use(Vuex);
+const api = {
+  interface: `/api/auth/user`,
+  getMenu: `/api/auth/user/menus`,
+  bindInfo: `/api/auth/user/bind`,
+  dockInfo: `/api/auth/wxbind`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit = undefined, ...info } = {}) {
+    const res = await this.$axios.$get(api.interface, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.interface}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    //特殊变化,查用户菜单
+    const res = await this.$axios.$get(`${api.getMenu}`, payload);
+    return res;
+  },
+  async update({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.interface}/update/${id}`, {
+      ...info,
+    });
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
+    return res;
+  },
+  async bind({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.bindInfo}`, payload);
+    return res;
+  },
+  async dockInfos({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.dockInfo}`, payload);
+    return res;
+  },
+};
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 1 - 1
src/views/dockbind.vue

@@ -45,7 +45,7 @@ export default {
     async bindBtn() {
       let data = {};
       data.dock_id = this.qrcode;
-      data.role='3';
+      data.role = '3';
       data.openid = this.openid;
       let res = await this.dockInfos(data);
       if (res.errcode == '0') {

+ 0 - 2
vue.config.js

@@ -1,5 +1,4 @@
 const path = require('path');
-const common = path.resolve(__dirname, '../common');
 module.exports = {
   publicPath: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_ROUTER,
   outputDir: 'platmobile',
@@ -11,7 +10,6 @@ module.exports = {
           '@': path.resolve(__dirname, './src'),
           '@c': path.resolve(__dirname, './src/components'),
           '@a': path.resolve(__dirname, './src/assets'),
-          '@common': common,
         },
       },
     });