guhongwei 4 年之前
父节点
当前提交
3325cc81da

+ 109 - 0
src/layout/kjpdCenter/menuInfo.vue

@@ -0,0 +1,109 @@
+<template>
+  <div id="menuInfo">
+    <el-row>
+      <el-col :span="24">
+        <el-col :span="24" class="top">
+          <el-image :src="topUrl"></el-image>
+          <span>个人中心</span>
+        </el-col>
+        <el-col :span="24">
+          <el-menu :default-active="num" @select="selectMenu" text-color="#999" active-text-color="#044b79">
+            <el-menu-item index="1">
+              <template slot="title">
+                <i class="el-icon-notebook-1"></i>
+                <span>基本信息</span>
+              </template>
+            </el-menu-item>
+            <el-menu-item index="2">
+              <template slot="title">
+                <i class="el-icon-notebook-1"></i>
+                <span>视频管理</span>
+              </template>
+            </el-menu-item>
+            <el-menu-item index="3">
+              <template slot="title">
+                <i class="el-icon-circle-close"></i>
+                <span>退出登录</span>
+              </template>
+            </el-menu-item>
+          </el-menu>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: login } = createNamespacedHelpers('login');
+export default {
+  name: 'menuInfo',
+  props: {},
+  components: {},
+  data: function() {
+    return {
+      topUrl: require('@/assets/live/square_big.png'),
+      num: 1,
+      haveMsg: false,
+    };
+  },
+  created() {
+    this.$set(this, `num`, this.$route.query.num);
+  },
+  mounted() {},
+  methods: {
+    ...login({ logout: 'logout', transactiondtetle: 'delete' }),
+    // 菜单跳转
+    async selectMenu(key) {
+      if (key == '3') {
+        this.logout();
+        this.$message({
+          message: '退出登录成功',
+          type: 'success',
+        });
+        this.$router.push({ path: '/market/index' });
+      } else {
+        this.$router.push({ path: '/kjpdCenter/index', query: { num: key } });
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.top {
+  height: 50px;
+  line-height: 50px;
+  text-align: center;
+  border-bottom: 1px solid #2d64b3;
+  .el-image {
+    float: left;
+    padding: 10px 40px;
+    width: 30px;
+    height: 30px;
+  }
+  span {
+    font-size: 24px;
+    color: #92959a;
+    font-weight: 600;
+    float: left;
+    text-align: left;
+  }
+}
+/deep/.el-menu-item {
+  font-weight: bold;
+  font-size: 20px;
+  text-align: center;
+  border-bottom: 1px solid #2d64b3;
+  margin: 0 20px;
+}
+</style>

+ 6 - 0
src/router/index.js

@@ -189,6 +189,12 @@ const live = [
     meta: { title: '个人中心', subSite: true },
     component: () => import('../views/vipCenter/index.vue'),
   },
+  // 科技频道-个人中心
+  {
+    path: '/kjpdCenter/index',
+    meta: { title: '个人中心', subSite: true },
+    component: () => import('../views/kjpdCenter/index.vue'),
+  },
   // 通知
   {
     path: '/notice/index',

+ 19 - 26
src/store/live/channel.js

@@ -1,6 +1,9 @@
 import Vue from 'vue';
 import Vuex from 'vuex';
 import _ from 'lodash';
+import { Notification } from 'element-ui';
+const jwt = require('jsonwebtoken');
+Vue.use(Vuex);
 Vue.use(Vuex);
 const api = {
   channelInfo: `/api/live/channel`,
@@ -36,32 +39,22 @@ const actions = {
   },
   async login({ commit, dispatch }, { user, router, path = '/', needReturn = false, typeCheck = false, isWx = false, needNotice = true }) {
     let res = await this.$axios.$post(`${api.logininfo}`, user);
-    // const setUser = async (token, commit) => {
-    //   localStorage.setItem('token', token);
-    //   let userInfo = await dispatch('toGetUser');
-    //   return userInfo;
-    // };
-    // let userInfo = {};
-    // if (res.errcode == '0') {
-    //   userInfo = await setUser(res.data.key, commit);
-    //   Notification({
-    //     title: '登录成功',
-    //     // message: `欢迎,${user.user_name}`,
-    //     type: 'success',
-    //     duration: 2000,
-    //     offset: 50,
-    //   });
-    //   return userInfo;
-    // } else {
-    //   if (needReturn) return res;
-    //   else {
-    //     Notification({
-    //       title: '登录失败',
-    //       message: `失败原因:${res.errmsg || '登陆失败'}`,
-    //       type: 'error',
-    //     });
-    //   }
-    // }
+    if (res.errcode == '0') {
+      commit('setUser', res.data, { root: true });
+      Notification({
+        title: '登录成功',
+        type: 'success',
+        duration: 2000,
+        offset: 50,
+      });
+      return res;
+    } else {
+      Notification({
+        title: '登录失败',
+        message: `失败原因:${res.errmsg || '登陆失败'}`,
+        type: 'error',
+      });
+    }
   },
 };
 export default {

+ 2 - 3
src/views/hallList/kjpdLogin.vue

@@ -49,9 +49,8 @@ export default {
     async onSubmit() {
       let data = this.form;
       const res = await this.toLogin({ user: data });
-      if (res.uid) {
-        console.log(res);
-        // this.$router.push({ path: '/kjpdCenter/index', query: { num: '1' } });
+      if (this.$checkRes(res)) {
+        this.$router.push({ path: '/kjpdCenter/index', query: { num: '1' } });
       }
     },
   },

+ 32 - 0
src/views/kjpdCenter/basicInfo/index.vue

@@ -0,0 +1,32 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24">
+        <p>基本信息</p>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'index',
+  props: {},
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped></style>

+ 93 - 0
src/views/kjpdCenter/index.vue

@@ -0,0 +1,93 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="info">
+        <el-col :span="24" class="top">
+          <heads></heads>
+        </el-col>
+        <el-col :span="24" class="main">
+          <div class="w_1200">
+            <el-col :span="4" class="mainMenu">
+              <menuInfo></menuInfo>
+            </el-col>
+            <el-col :span="19" class="mainMess">
+              <span v-if="num == '1'">
+                <basicInfo></basicInfo>
+              </span>
+              <span v-else-if="num == '2'">
+                <videoinfo></videoinfo>
+              </span>
+              <span v-else>
+                退出登录
+              </span>
+            </el-col>
+          </div>
+        </el-col>
+        <el-col :span="24" class="foot">
+          <foot></foot>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import heads from '@/layout/userCenter/heads.vue';
+import menuInfo from '@/layout/kjpdCenter/menuInfo.vue';
+import foot from '@/layout/live/foot.vue';
+import basicInfo from './basicInfo/index.vue';
+import videoinfo from './videoinfo/index.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    heads,
+    menuInfo,
+    foot,
+    basicInfo,
+    videoinfo,
+  },
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+    num() {
+      return this.$route.query.num;
+    },
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.w_1200 {
+  width: 80%;
+  margin: 0 auto;
+}
+.info {
+  background-color: #e9edf6;
+}
+.main {
+  min-height: 600px;
+  margin: 15px 0;
+}
+.mainMenu {
+  width: 20%;
+  min-height: 600px;
+  background-color: #fff;
+}
+.mainMess {
+  float: right;
+  min-height: 600px;
+  background-color: #fff;
+}
+</style>

+ 32 - 0
src/views/kjpdCenter/videoinfo/index.vue

@@ -0,0 +1,32 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24">
+        <p>视频管理</p>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'index',
+  props: {},
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped></style>