Parcourir la source

Merge branch 'master' of http://git.cc-lotus.info/live/web-cms

lrf402788946 il y a 4 ans
Parent
commit
a7bd0a1669
5 fichiers modifiés avec 41 ajouts et 132 suppressions
  1. 0 56
      src/store/adminLogin.js
  2. 3 3
      src/store/index.js
  3. 0 33
      src/store/user/mutations.js
  4. 0 2
      src/store/user/state.js
  5. 38 38
      vue.config.js

+ 0 - 56
src/store/adminLogin.js

@@ -1,56 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-const jwt = require('jsonwebtoken');
-Vue.use(Vuex);
-const api = {
-  adminLoginInfo: `/api/live/v0/users/admin`,
-};
-const state = () => ({});
-const mutations = {};
-
-const actions = {
-  async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    const res = await this.$axios.$get(`${api.adminLoginInfo}`, {
-      skip,
-      limit,
-      ...info,
-    });
-    return res;
-  },
-  async create({ commit }, payload) {
-    const res = await this.$axios.$post(`${api.adminLoginInfo}`, payload);
-    return res;
-  },
-  async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.adminLoginInfo}/${payload}`);
-    return res;
-  },
-  async update({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.adminLoginInfo}/update/${id}`, data);
-    return res;
-  },
-  async delete({ commit }, payload) {
-    const res = await this.$axios.$delete(`${api.adminLoginInfo}/${payload}`);
-    return res;
-  },
-  async login({ commit }, { user }) {
-    const res = await this.$axios.$post(`${api.adminLoginInfo}/login`, user);
-    if (res.errcode === 0) {
-      localStorage.setItem('token', res.data);
-      user = jwt.decode(res.data);
-      commit('setUser', user, { root: true });
-    }
-    return res;
-  },
-  async updatePwd({ commit }, { id, ...data }) {
-    const res = await this.$axios.$post(`${api.adminLoginInfo}/password/${id}`, data);
-    return res;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 3 - 3
src/store/index.js

@@ -1,9 +1,9 @@
 import Vue from 'vue';
 import Vuex from 'vuex';
-import * as ustate from './user/state';
-import * as umutations from './user/mutations';
+import * as ustate from '@common/src/store/user/state';
+import * as umutations from '@common/src/store/user/mutations';
 // 管理员
-import adminLogin from './adminLogin';
+import adminLogin from '@common/src/store/adminLogin';
 // 菜单
 import menu from '@common/src/store/menu';
 // 邀请码

+ 0 - 33
src/store/user/mutations.js

@@ -1,33 +0,0 @@
-export const setUser = (state, payload) => {
-  state.user = payload;
-  // let res = true;
-  // //登陆时
-  // if (payload) {
-  //   state.token = payload;
-  // } else {
-  //   //已经登陆,切换路由时取出客户信息放在总store中
-  //   let token = localStorage.getItem('token');
-  //   if (token && token !== 'guest') {
-  //     state.user = jwt.decode(token);
-  //   } else if (token && token == 'guest') {
-  //     let user = localStorage.getItem('user');
-  //     state.user = JSON.parse(user);
-  //   } else {
-  //     let timestamp = new Date().getTime();
-  //     let user = {
-  //       // id: `guest${timestamp}`,
-  //       name: `游客${timestamp}`,
-  //     };
-  //     state.user = user;
-  //     localStorage.setItem('token', 'guest');
-  //     localStorage.setItem('user', JSON.stringify(user));
-  //     console.warn('游客身份');
-  //   }
-  // }
-  // return res;
-};
-
-export const deleteUser = (state, payload) => {
-  state.user = {};
-  localStorage.removeItem('token');
-};

+ 0 - 2
src/store/user/state.js

@@ -1,2 +0,0 @@
-export const user = {};
-export const menuList = [];

+ 38 - 38
vue.config.js

@@ -1,38 +1,38 @@
-const path = require('path');
-const common = path.resolve(__dirname, '../common');
-module.exports = {
-  publicPath: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_ROUTER,
-  // 打包文件
-  outputDir: 'liveadmin',
-  configureWebpack: config => {
-    Object.assign(config, {
-      // 开发生产共同配置
-      resolve: {
-        alias: {
-          '@': path.resolve(__dirname, './src'),
-          '@c': path.resolve(__dirname, './src/components'),
-          '@a': path.resolve(__dirname, './src/assets'),
-          '@common': common,
-        },
-      },
-    });
-  },
-  devServer: {
-    port: '8001',
-    //api地址前缀
-    proxy: {
-      '/files': {
-        target: 'http://broadcast.waityou24.cn',
-      },
-      '/api': {
-        target: 'http://broadcast.waityou24.cn',
-        changeOrigin: true,
-        ws: false,
-      },
-      '/ws': {
-        target: 'http://broadcast.waityou24.cn',
-        ws: false,
-      },
-    },
-  },
-};
+const path = require('path');
+const common = path.resolve(__dirname, '../common');
+module.exports = {
+  publicPath: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_ROUTER,
+  // 打包文件
+  outputDir: 'liveadmin',
+  configureWebpack: config => {
+    Object.assign(config, {
+      // 开发生产共同配置
+      resolve: {
+        alias: {
+          '@': path.resolve(__dirname, './src'),
+          '@c': path.resolve(__dirname, './src/components'),
+          '@a': path.resolve(__dirname, './src/assets'),
+          '@common': common,
+        },
+      },
+    });
+  },
+  devServer: {
+    port: '8001',
+    //api地址前缀
+    proxy: {
+      '/files': {
+        target: 'http://broadcast.waityou24.cn',
+      },
+      '/api': {
+        target: 'http://192.168.1.19:9101', //http://192.168.1.19:9101
+        changeOrigin: true,
+        ws: false,
+      },
+      '/ws': {
+        target: 'http://broadcast.waityou24.cn',
+        ws: false,
+      },
+    },
+  },
+};