liuyu 4 years ago
parent
commit
0ca1426098
4 changed files with 172 additions and 34 deletions
  1. 10 1
      src/store/onlive/user.js
  2. 1 1
      src/views/index.vue
  3. 3 1
      src/views/live/roomDetail.vue
  4. 158 31
      src/views/user/index.vue

+ 10 - 1
src/store/onlive/user.js

@@ -5,6 +5,7 @@ Vue.use(Vuex);
 const api = {
   onliveInfo: `/api/onlive/user`,
   registerInfo: `/api/onlive/register`,
+  roomUserInfo: `/api/onlive/roomuser`,
 };
 const state = () => ({});
 const mutations = {};
@@ -27,7 +28,7 @@ const actions = {
     return res;
   },
   async update({ commit }, { id, ...info } = {}) {
-    const res = await this.$axios.$post(`${api.onliveInfo}/${id}`, { ...info });
+    const res = await this.$axios.$post(`${api.onliveInfo}/update/${id}`, { ...info });
     return res;
   },
   async delete({ commit }, payload) {
@@ -38,6 +39,14 @@ const actions = {
     const res = await this.$axios.$post(`${api.registerInfo}`, payload);
     return res;
   },
+  async roomuserfetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.roomUserInfo}/${payload}`);
+    return res;
+  },
+  async roomuserupdate({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.roomUserInfo}/update/${id}`, { ...info });
+    return res;
+  },
 };
 
 export default {

+ 1 - 1
src/views/index.vue

@@ -31,7 +31,7 @@
               <i class="iconfont icon111 icon" style="color:#00A8C4;"></i>
               <p style="color:#00A8C4;">专家介绍</p>
             </van-col>
-            <van-col span="8" class="btn" @click.native="$router.push({ path: '/meetingBrief/index', query: { type: '5' } })">
+            <van-col span="8" class="btn" @click.native="$router.push({ path: '/user/index', query: { type: '5' } })">
               <i class="iconfont iconjiaoyu icon" style="color:#3B9C55;"></i>
               <p style="color:#3B9C55;">继续再教育申请表</p>
             </van-col>

+ 3 - 1
src/views/live/roomDetail.vue

@@ -35,7 +35,9 @@
           <span>直播中:{{ total }}</span>
         </el-col>
         <el-col :span="12" class="meetBtn">
-          <el-button v-show="switchbtn" type="warning" round size="small" @click="roomMeetBtn()">小程序<i class="el-icon-camera el-icon--right"></i></el-button>
+          <el-button v-show="switchbtn" type="warning" round size="small" @click="roomMeetBtn()"
+            >苹果用户互动<i class="el-icon-camera el-icon--right"></i
+          ></el-button>
         </el-col>
       </el-col>
       <el-col :span="24" class="gnanBtn">

+ 158 - 31
src/views/user/index.vue

@@ -6,16 +6,99 @@
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          <el-col :span="24" class="one">
-            <el-image :src="imgUrl"></el-image>
-            <p>{{ user.name }}</p>
-          </el-col>
-          <el-col :span="24" class="two">
-            <clickBtn></clickBtn>
-          </el-col>
-        </el-col>
-        <el-col :span="24" class="foot">
-          <footInfo></footInfo>
+          <van-row>
+            <van-col class="title" span="24"></van-col>
+            <van-form @submit="onSubmit" v-model="form" :show-error-message="false">
+              <van-field
+                required
+                v-model="form.name"
+                left-icon="manager-o"
+                name="name"
+                label="用户名"
+                placeholder="请填写用户名"
+                :rules="[{ required: true, message: '请填写用户名' }]"
+              />
+              <van-field required left-icon="eye-o" v-model="form.age" name="age" label="年龄" type="digit" placeholder="请填写年龄" />
+              <van-field name="gender" left-icon="friends-o" label="性别">
+                <template #input>
+                  <van-radio-group v-model="form.gender" direction="horizontal">
+                    <van-radio name="男">男</van-radio>
+                    <van-radio name="女">女</van-radio>
+                  </van-radio-group>
+                </template>
+              </van-field>
+              <van-field
+                required
+                v-model="form.idnumber"
+                name="idnumber"
+                label="身份证号"
+                left-icon="vip-card-o"
+                placeholder="请填写身份证号"
+                :rules="[{ required: true, message: '请填写身份证号' }]"
+              />
+              <van-field
+                required
+                v-model="form.phone"
+                name="phone"
+                label="手机号"
+                left-icon="phone-o"
+                placeholder="请填写手机号"
+                :rules="[{ required: true, message: '请填写手机号' }]"
+              />
+              <van-field v-model="form.hosname" left-icon="wap-home-o" name="hosname" label="单位" placeholder="请填写单位名称" />
+              <van-field v-model="form.deptname" left-icon="apps-o" name="deptname" label="科室" placeholder="请填写科室名称" />
+              <van-field v-model="form.level" left-icon="gem-o" name="level" label="职称" placeholder="请填写职称" />
+              <van-field v-model="form.major" left-icon="user-o" name="major" label="专业" placeholder="请填写专业" />
+              <van-field v-model="form.isxf" name="isxf" left-icon="star-o" label="学分" placeholder="请填写需要授予学分" />
+              <van-field name="isjc" left-icon="points" label="是否来自基层">
+                <template #input>
+                  <van-switch v-model="form.isjc" size="20" />
+                </template>
+              </van-field>
+              <van-field
+                left-icon="location-o"
+                readonly
+                clickable
+                name="address"
+                :value="form.address"
+                label="地址"
+                placeholder="点击选择单位所在地"
+                @click="showPicker = true"
+              />
+              <van-popup round v-model="showPicker" position="bottom">
+                <van-picker show-toolbar :columns="addresslist" @confirm="onConfirm" @cancel="showPicker = false" />
+              </van-popup>
+              <van-field
+                v-model="form.title"
+                name="title"
+                label="简介"
+                left-icon="like-o"
+                placeholder="请填写个人简介"
+                type="textarea"
+                rows="2"
+                autosize
+                maxlength="500"
+                show-word-limit
+              />
+              <van-field
+                v-model="form.remark"
+                name="remark"
+                left-icon="description"
+                label="备注"
+                placeholder="请填写备注"
+                type="textarea"
+                rows="2"
+                autosize
+                maxlength="500"
+                show-word-limit
+              />
+              <div style="margin: 16px;">
+                <van-button round block type="info" native-type="submit">
+                  保存
+                </van-button>
+              </div>
+            </van-form>
+          </van-row>
         </el-col>
       </el-col>
     </el-row>
@@ -23,18 +106,16 @@
 </template>
 
 <script>
+import Vue from 'vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 import NavBar from '@/layout/common/topInfo.vue';
-import footInfo from '@/layout/common/footInfo.vue';
-import clickBtn from './parts/clickBtn.vue';
+const { mapActions: onliveUser } = createNamespacedHelpers('onliveUser');
 
 export default {
   name: 'index',
   props: {},
   components: {
     NavBar,
-    footInfo,
-    clickBtn,
   },
   data: function() {
     return {
@@ -44,13 +125,49 @@ export default {
       isleftarrow: '',
       // 返回
       navShow: true,
+      addresslist: ['省直', '黄石', '鄂州', '孝感', '黄冈', '咸宁'],
+      showPicker: false,
       imgUrl: require('@/assets/test.jpg'),
+      form: {},
     };
   },
-  created() {},
-  methods: {},
+  created() {
+    this.searchInfo();
+  },
+  methods: {
+    ...onliveUser(['roomuserfetch', 'roomuserupdate']),
+    onConfirm(value) {
+      this.form.address = value;
+      this.showPicker = false;
+    },
+    async searchInfo() {
+      this.user.uid = '5ee84acb778c700c98d8bf35';
+      const res = await this.roomuserfetch(this.user.uid);
+      if (this.$checkRes(res)) {
+        console.log(res.data);
+        this.$set(this, `form`, res.data);
+      }
+    },
+    async onSubmit() {
+      const res = await this.roomuserupdate(this.form);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '修改信息成功',
+          type: 'success',
+        });
+        this.back();
+      }
+    },
+    // 返回
+    back() {
+      this.$router.push({ path: '/live/index' });
+    },
+  },
   computed: {
     ...mapState(['user']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
   },
   mounted() {
     this.title = this.$route.meta.title;
@@ -74,24 +191,34 @@ export default {
 }
 .main {
   min-height: 570px;
-  .one {
-    text-align: center;
-    background-color: #fff;
-    padding: 15px 0;
-    margin: 0 0 15px 0;
-    .el-image {
-      width: 80px;
-      height: 80px;
-      border-radius: 90px;
+  .newsList {
+    margin: 10px;
+    border-bottom: 1px dashed #ccc;
+    width: 95%;
+    .image {
+      .el-image {
+        border-radius: 10px;
+      }
     }
-    p {
-      font-size: 18px;
-      padding: 15px 0;
+    .text {
+      padding: 0 10px;
+      .title {
+        padding: 10px 0;
+      }
+      .type {
+        font-size: 14px;
+        color: #ccc;
+        padding: 5px 0;
+      }
+      .time {
+        font-size: 14px;
+        color: #ccc;
+        padding: 5px 0;
+      }
     }
   }
 }
-.foot {
-  position: absolute;
-  bottom: 0;
+/deep/.van-field__control {
+  margin: 5px 10px;
 }
 </style>