lrf402788946 %!s(int64=4) %!d(string=hai) anos
pai
achega
18024a0aa9

BIN=BIN
src/assets/jnpx.jpg


+ 4 - 0
src/store/index.js

@@ -8,6 +8,8 @@ import imgtxtdock from './live/imgtxtdock';
 // 技术交流
 import column from './live/column';
 import news from './live/news';
+// 培训问诊
+import trainlive from './live/trainlive';
 // 项目路演
 import newsroadshow from './live/newsroadshow';
 import newsguidance from './live/newsguidance';
@@ -60,6 +62,8 @@ export default new Vuex.Store({
     news,
     // 项目路演
     newsroadshow,
+    // 培训问诊
+    trainlive,
     // 科技超市
     product,
     exportuser,

+ 115 - 0
src/store/live/trainlive.js

@@ -0,0 +1,115 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+import { Notification } from 'element-ui';
+const jwt = require('jsonwebtoken');
+Vue.use(Vuex);
+const api = {
+  trainliveInfo: `/api/live/trainlive`,
+  logininfo: `/api/live/trainlive/login`,
+  userloginInfo: `/api/live/trainlive/user`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit = undefined, ...info } = {}) {
+    const res = await this.$axios.$get(api.trainliveInfo, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.trainliveInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.trainliveInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.trainliveInfo}/update/${id}`, {
+      ...info,
+    });
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.trainliveInfo}/${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);
+    if (res.errcode == '0') {
+      localStorage.setItem('user', JSON.stringify(res.data));
+      commit('setUser', res.data, { root: true });
+      Notification({
+        title: '登录成功',
+        type: 'success',
+        duration: 2000,
+        offset: 50,
+      });
+      return res;
+    } else {
+      Notification({
+        title: '登录失败',
+        message: `失败原因:${res.errmsg || '登陆失败'}`,
+        type: 'error',
+      });
+    }
+  },
+  // 参加用户
+  async userCreate({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.trainliveInfo}/user/${id}`, {
+      ...info,
+    });
+    return res;
+  },
+  async userDelete({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$delete(`${api.trainliveInfo}/user/${id}`, {
+      ...info,
+    });
+    return res;
+  },
+  async userUpdate({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.trainliveInfo}/user/update/${id}`, {
+      ...info,
+    });
+    return res;
+  },
+  async userLogin({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.userloginInfo}/login/${id}`, {
+      ...info,
+    });
+    if (res.errcode == '0') {
+      localStorage.setItem('user', JSON.stringify(res.data));
+      commit('setUser', res.data, { root: true });
+      Notification({
+        title: '登录成功',
+        type: 'success',
+        duration: 2000,
+        offset: 50,
+      });
+      return res;
+    } else {
+      Notification({
+        title: '登录失败',
+        message: `失败原因:${res.errmsg || '登陆失败'}`,
+        type: 'error',
+      });
+    }
+  },
+  async userLogout({ commit }, { id } = {}) {
+    window.localStorage.removeItem('user');
+    const res = await this.$axios.$post(`${api.userloginInfo}/logout/${id}`);
+    commit('deleteUser');
+  },
+};
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 23 - 3
src/views/live/detail/jnpxDetail.vue

@@ -10,6 +10,7 @@
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: trainlive } = createNamespacedHelpers('trainlive');
 export default {
   metaInfo() {
     return { title: this.$route.meta.title };
@@ -18,12 +19,31 @@ export default {
   props: {},
   components: {},
   data: function() {
-    return {};
+    return {
+      info: {},
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...trainlive(['fetch']),
+    async search() {
+      if (!this.id) {
+        this.$toast.fail('缺少必要信息,加载数据失败!');
+        return;
+      }
+      const res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, 'info', res.data);
+      }
+    },
   },
-  created() {},
-  methods: {},
   computed: {
     ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
   },
   watch: {},
 };

+ 127 - 25
src/views/live/index/jnpx.vue

@@ -2,26 +2,51 @@
   <div id="jnpx">
     <el-row>
       <el-col :span="24" class="main">
-        <el-col
-          :span="24"
-          class="list"
-          v-for="(item, index) in list"
-          :key="index"
-          @click.native="$router.push({ path: '/live/detail', query: { id: item.id, type: '3' } })"
-        >
-          <el-col :span="24" class="name textOver">
-            {{ item.title }}
+        <el-col :span="24" class="info">
+          <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="toLogin(item)">
+            <el-col :span="11" class="video">
+              <el-image :src="noimage"> </el-image>
+            </el-col>
+            <el-col :span="13" class="text">
+              <p class="title textOver">
+                <span style="color:#ff0000">[{{ item.room_id }}]</span>{{ item.title }}
+              </p>
+              <!-- <p class="desc">{{ item.desc }}</p>
+              <p class="type textOver">所属类型:{{ getType(item.type) }}</p> -->
+              <p class="time textOver">{{ item.create_date }}</p>
+            </el-col>
           </el-col>
-          <el-col :span="12" class="date textOver"> 发布时间:{{ item.publish_time }} </el-col>
-          <el-col :span="12" class="date textOver"> 信息来源:{{ item.orgin || '暂无' }} </el-col>
         </el-col>
       </el-col>
     </el-row>
+
+    <van-dialog v-model="dialog" title="登陆" @closed="toClose" :show-confirm-button="false">
+      <van-form ref="vantForm" @submit="login">
+        <van-field v-model="info.user_phone" name="user_phone" label="用户名" placeholder="用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
+        <van-field
+          v-model="info.user_password"
+          type="password"
+          name="user_password"
+          label="密码"
+          placeholder="密码"
+          :rules="[{ required: true, message: '请填写密码' }]"
+        />
+        <van-row style="padding:10px" gutter="20" type="flex" justify="space-around">
+          <van-col span="12">
+            <van-button round block type="warning" @click="toClose">取消</van-button>
+          </van-col>
+          <van-col span="12">
+            <van-button round block type="info" native-type="submit">提交</van-button>
+          </van-col>
+        </van-row>
+      </van-form>
+    </van-dialog>
   </div>
 </template>
 
 <script>
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: trainlive } = createNamespacedHelpers('trainlive');
 export default {
   name: 'jnpx',
   props: {
@@ -29,10 +54,41 @@ export default {
   },
   components: {},
   data: function() {
-    return {};
+    return {
+      noimage: require('@/assets/jnpx.jpg'),
+      dialog: false,
+      selectId: undefined,
+      info: {},
+    };
   },
   created() {},
-  methods: {},
+  methods: {
+    ...trainlive(['userLogin']),
+    /**
+     * 点击培训问诊函数
+     */
+    async toLogin({ id }) {
+      if (!id) this.$toast.fail('未获取到此数据的信息');
+      this.selectId = id;
+      this.dialog = true;
+    },
+    /**
+     * 培训问诊登陆
+     */
+    async login() {
+      const res = await this.userLogin({ id: this.selectId, ..._.cloneDeep(this.info) });
+      if (res) this.$router.push({ path: '/live/detail', query: { id: this.selectId, type: '3' } });
+    },
+    /**
+     * 关闭弹框后的函数
+     */
+    toClose() {
+      this.dialog = false;
+      this.$refs.vantForm.resetValidation();
+      this.selectId = undefined;
+      this.info = {};
+    },
+  },
   computed: {
     ...mapState(['user']),
   },
@@ -42,18 +98,64 @@ export default {
 
 <style lang="less" scoped>
 .main {
-  padding: 0 10px;
-  .list {
-    padding: 10px 0;
-    border-bottom: 1px dashed #ccc;
-    .name {
-      font-size: 18px;
-      font-weight: bold;
-    }
-    .date {
-      height: 42px;
-      line-height: 42px;
-      color: #666;
+  .info {
+    padding: 0 10px;
+    position: relative;
+    // top: 46px;
+    padding: 0 0 50px 0;
+    .list {
+      padding: 10px;
+      background-color: #fff;
+      border-radius: 5px;
+      border-bottom: 1px dashed #ccc;
+      .video {
+        height: 100px;
+        overflow: hidden;
+        .el-image {
+          width: 100%;
+          height: 100%;
+          border-radius: 10px;
+          /deep/.image-slot {
+            width: 100%;
+            height: 100%;
+          }
+        }
+      }
+      .text {
+        height: 100px;
+        overflow: hidden;
+        position: relative;
+        padding: 0 0 0 10px;
+        .title {
+          font-size: 16px;
+          font-weight: bold;
+        }
+        .desc {
+          overflow: hidden;
+          text-overflow: ellipsis;
+          display: -webkit-box;
+          -webkit-line-clamp: 2;
+          -webkit-box-orient: vertical;
+          padding: 3px 0;
+          font-size: 12px;
+          color: #666;
+        }
+        .type {
+          padding: 3px 0;
+          font-size: 13px;
+          color: #666;
+          overflow: hidden;
+          text-overflow: ellipsis;
+          white-space: nowrap;
+        }
+        .time {
+          position: absolute;
+          bottom: 0px;
+          width: 95%;
+          font-size: 12px;
+          color: #666;
+        }
+      }
     }
   }
 }

+ 6 - 0
src/views/live/index/trainInter.vue

@@ -32,6 +32,7 @@ import jbft from './jbft.vue';
 import jnpx from './jnpx.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: newsguidance } = createNamespacedHelpers('newsguidance');
+const { mapActions: trainlive } = createNamespacedHelpers('trainlive');
 export default {
   name: 'trainInter',
   props: {},
@@ -60,12 +61,17 @@ export default {
   },
   methods: {
     ...newsguidance(['query']),
+    ...trainlive({ getTrainlive: 'query' }),
     async search({ ...info } = {}) {
       if (this.name) info.title = this.name;
       let res = await this.query({ ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `jbftList`, res.data);
       }
+      const result = await this.getTrainlive();
+      if (this.$checkRes(result)) {
+        this.$set(this, `jnpxList`, result.data);
+      }
     },
     // 选择类型
     changeType(index) {