guhongwei 4 年之前
父节点
当前提交
9e575351d7
共有 3 个文件被更改,包括 62 次插入3 次删除
  1. 2 1
      src/store/index.js
  2. 58 0
      src/store/live/mechanism.js
  3. 2 2
      vue.config.js

+ 2 - 1
src/store/index.js

@@ -3,7 +3,7 @@ import Vuex from 'vuex';
 import * as ustate from '@common/src/store/user/state';
 import * as umutations from '@common/src/store/user/mutations';
 // 环南湖接口
-import mechanism from '@common/src/store/mechanism';
+
 import expert from '@common/src/store/expert';
 import product from '@common/src/store/product';
 import patent from '@common/src/store/patent';
@@ -16,6 +16,7 @@ import statistics from '@common/src/store/statistics';
 // 直播平台接口
 import adminLogin from './live/adminLogin';
 import organization from './live/organization';
+import mechanism from './live/mechanism';
 import coupons from './live/coupons';
 import couponsApply from './live/couponsApply';
 import declare from './live/declare';

+ 58 - 0
src/store/live/mechanism.js

@@ -0,0 +1,58 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  interface: `/api/live/v0/cysci/mechanism`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...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.interface}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
+    return res;
+  },
+
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
+    return res;
+  },
+  async password({ commit }, { id, passwd }) {
+    const res = await this.$axios.$post(`${api.interface}/password/${id}`, { passwd });
+    return res;
+  },
+  async login({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.interface}/login`, payload);
+    const jwt = require('jsonwebtoken');
+    if (res.errcode === 0) {
+      localStorage.setItem('token', res.data);
+      localStorage.setItem('type', 'ZJJG');
+      const user = jwt.decode(res.data);
+      commit('setUser', user, { root: true });
+    }
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 2 - 2
vue.config.js

@@ -23,12 +23,12 @@ module.exports = {
         target: 'http://broadcast.waityou24.cn',
       },
       '/api/live': {
-        target: 'http://192.168.1.19:9101', //http://192.168.1.19:9101//http://broadcast.waityou24.cn
+        target: 'http://broadcast.waityou24.cn', //http://192.168.1.19:9101//http://broadcast.waityou24.cn
         changeOrigin: true,
         ws: false,
       },
       '/api': {
-        target: 'http://192.168.1.19:9200', //http://192.168.1.19:9200//http://cccysci.waityou24.cn
+        target: 'http://cccysci.waityou24.cn', //http://192.168.1.19:9200//http://cccysci.waityou24.cn
         changeOrigin: true,
         ws: false,
       },