guhongwei 4 gadi atpakaļ
vecāks
revīzija
e1441b8601

+ 30 - 0
src/store/live/channel.js

@@ -4,6 +4,7 @@ import _ from 'lodash';
 Vue.use(Vuex);
 const api = {
   channelInfo: `/api/live/channel`,
+  logininfo: `/api/live/channel/login`,
 };
 const state = () => ({});
 const mutations = {};
@@ -33,6 +34,35 @@ const actions = {
     const res = await this.$axios.$delete(`${api.channelInfo}/${payload}`);
     return res;
   },
+  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',
+    //     });
+    //   }
+    // }
+  },
 };
 export default {
   namespaced: true,

+ 58 - 48
src/views/hallList/kjpdLogin.vue

@@ -1,62 +1,58 @@
 <template>
-  <div id="webLogin">
-    <login-detail :form="form" @submitDate="submitnewLogin" :forms="forms" @submitDates="submitRegisters"></login-detail>
+  <div id="kjpdLogin">
+    <el-row>
+      <el-col :span="24">
+        <el-col :span="5" class="info"> </el-col>
+        <el-col :span="13" class="login">
+          <el-col :span="24" class="title">
+            管理登录
+          </el-col>
+          <el-col :span="24" class="form">
+            <el-form ref="form" :model="form" :rules="rules" label-width="140px">
+              <el-form-item label="房间号" prop="room_id">
+                <el-input v-model="form.room_id" placeholder="房间号"></el-input>
+              </el-form-item>
+              <el-form-item label="登录密码" prop="passwd">
+                <el-input v-model="form.passwd" placeholder="请输入登录密码" show-password></el-input>
+              </el-form-item>
+              <el-col :span="24" class="btn">
+                <el-button type="primary" @click="onSubmit">登录</el-button>
+              </el-col>
+            </el-form>
+          </el-col>
+        </el-col>
+        <el-col :span="5" class="info"> </el-col>
+      </el-col>
+    </el-row>
   </div>
 </template>
 
 <script>
-import loginDetail from '@/layout/login/webLogin.vue';
-import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
-const { mapActions: mapMarket } = createNamespacedHelpers('market');
-const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
-const { mapActions: login } = createNamespacedHelpers('login');
-
-expertsuser;
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: channel } = createNamespacedHelpers('channel');
 export default {
-  name: 'webLogin',
+  name: 'kjpdLogin',
   props: {},
-  components: { loginDetail },
-  data: () => {
+  components: {},
+  data: function() {
     return {
-      // 个人
       form: {},
-      // 注册
-      forms: {},
+      rules: {
+        room_id: [{ required: true, message: '请输入房间号', trigger: 'blur' }],
+        passwd: [{ required: true, message: '请输入密码', trigger: 'blur' }],
+      },
     };
   },
   created() {},
   methods: {
-    ...mapMarket({ userFetch: 'fetch', userCreate: 'create', userUpdate: 'update' }),
-    ...login({ toLogin: 'login' }),
-    ...expertsuser({ expertsuserCreate: 'create' }),
-    // 用户登录
-    async submitnewLogin(form) {
-      let res = await this.toLogin({ user: form });
+    ...channel({ toLogin: 'login' }),
+    async onSubmit() {
+      let data = this.form;
+      const res = await this.toLogin({ user: data });
       if (res.uid) {
-        if (res.role == '2') {
-          this.$router.push('/market/index');
-        } else {
-          this.$router.push({ path: '/userCenter/index', query: { num: '1' } });
-        }
-      }
-    },
-    // 注册
-    async submitRegisters({ data }) {
-      if (data.role == '4' || data.role == '5') {
-        let res = await this.userCreate(data);
-        console.log(res.data);
-        let msg = `注册成功,等待管理员审核,方可登录`;
-        this.$checkRes(res, msg);
-      } else if (data.role == '6') {
-        let res = await this.expertsuserCreate(data);
-        let msg = `注册成功,等待管理员审核,方可登录`;
-        this.$checkRes(res, msg);
-      } else if (data.role == '7') {
-        data.status = '3';
-        let res = await this.userCreate(data);
-        let msg = `注册成功,等待管理员审核,方可登录`;
+        console.log(res);
+        // this.$router.push({ path: '/kjpdCenter/index', query: { num: '1' } });
       }
-      window.location.reload();
     },
   },
   computed: {
@@ -64,9 +60,6 @@ export default {
     pageTitle() {
       return `${this.$route.meta.title}`;
     },
-    redirect_uri() {
-      return `${this.$route.query.redirect_uri}`;
-    },
   },
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -74,4 +67,21 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.info {
+  height: 800px;
+}
+.login {
+  padding: 15px 0;
+  .title {
+    text-align: center;
+    font-size: 40px;
+    padding: 40px 0;
+  }
+  .form {
+    .btn {
+      text-align: center;
+    }
+  }
+}
+</style>

+ 4 - 36
src/views/hallList/parts/kjpdlist.vue

@@ -40,46 +40,14 @@ export default {
   methods: {
     // 进入对接会
     async jrpdBtn(item) {
-      if (this.user.uid || this.user.suid) {
-        if (
-          this.user.role == '0' ||
-          this.user.role == '1' ||
-          this.user.role == '2' ||
-          this.user.role == '3' ||
-          this.user.role == '4' ||
-          this.user.role == '5' ||
-          this.user.role == '6' ||
-          this.user.role == '7' ||
-          this.user.role == '8'
-        ) {
-          this.$router.push({ path: '/kjpdhall/index', query: { id: item.id } });
-        } else {
-          this.$router.push({ path: '/webLogin' });
-        }
-      } else {
-        this.$router.push({ path: '/webLogin' });
-      }
+      this.$router.push({ path: '/kjpdhall/index', query: { id: item.id } });
     },
     //管理进入
     async adminBtn(item) {
-      if (this.user.uid || this.user.suid) {
-        if (
-          this.user.role == '0' ||
-          this.user.role == '1' ||
-          this.user.role == '2' ||
-          this.user.role == '3' ||
-          this.user.role == '4' ||
-          this.user.role == '5' ||
-          this.user.role == '6' ||
-          this.user.role == '7' ||
-          this.user.role == '8'
-        ) {
-          this.$router.push({ path: '/kjpdhall/index', query: { id: item.id } });
-        } else {
-          this.$router.push({ path: '/webLogin' });
-        }
+      if (this.user.uid) {
+        this.$router.push({ path: '/kjpdCenter/index', query: { num: '1' } });
       } else {
-        this.$router.push({ path: '/webLogin' });
+        this.$router.push({ path: '/hallList/kjpdLogin' });
       }
     },
   },