index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-col :span="24" class="top">
  6. <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
  7. </el-col>
  8. <el-col :span="24" class="main">
  9. <van-row>
  10. <van-col class="title" span="24"></van-col>
  11. <van-form @submit="onSubmit" v-model="form" :show-error-message="false">
  12. <van-field
  13. required
  14. v-model="form.name"
  15. left-icon="manager-o"
  16. name="name"
  17. label="用户名"
  18. placeholder="请填写用户名"
  19. :rules="[{ required: true, message: '请填写用户名' }]"
  20. />
  21. <van-field required left-icon="eye-o" v-model="form.age" name="age" label="年龄" type="digit" placeholder="请填写年龄" />
  22. <van-field name="gender" left-icon="friends-o" label="性别">
  23. <template #input>
  24. <van-radio-group v-model="form.gender" direction="horizontal">
  25. <van-radio name="男">男</van-radio>
  26. <van-radio name="女">女</van-radio>
  27. </van-radio-group>
  28. </template>
  29. </van-field>
  30. <van-field
  31. required
  32. v-model="form.idnumber"
  33. name="idnumber"
  34. label="身份证号"
  35. left-icon="vip-card-o"
  36. placeholder="请填写身份证号"
  37. :rules="[{ required: true, message: '请填写身份证号' }]"
  38. />
  39. <van-field
  40. required
  41. v-model="form.phone"
  42. name="phone"
  43. label="手机号"
  44. left-icon="phone-o"
  45. placeholder="请填写手机号"
  46. :rules="[{ required: true, message: '请填写手机号' }]"
  47. />
  48. <van-field v-model="form.hosname" left-icon="wap-home-o" name="hosname" label="单位" placeholder="请填写单位标准全称" />
  49. <van-field v-model="form.deptname" left-icon="apps-o" name="deptname" label="科室" placeholder="请填写学员所在科室" />
  50. <van-field v-model="form.level" left-icon="gem-o" name="level" label="职称" placeholder="请填写职称" />
  51. <van-field v-model="form.major" left-icon="user-o" name="major" label="专业" placeholder="请填写所属专业名称" />
  52. <van-field v-model="form.isxf" name="isxf" left-icon="star-o" label="学分" placeholder="请填写需要授予学分" />
  53. <van-field name="isjc" left-icon="points" label="是否来自基层">
  54. <template #input>
  55. <van-switch v-model="form.isjc" size="20" />
  56. </template>
  57. </van-field>
  58. <van-field
  59. left-icon="location-o"
  60. readonly
  61. clickable
  62. name="address"
  63. :value="form.address"
  64. label="地址"
  65. placeholder="点击选择单位所在地"
  66. @click="showPicker = true"
  67. />
  68. <van-popup round v-model="showPicker" position="bottom">
  69. <van-picker show-toolbar :columns="addresslist" @confirm="onConfirm" @cancel="showPicker = false" />
  70. </van-popup>
  71. <!-- <van-field
  72. v-model="form.title"
  73. name="title"
  74. label="简介"
  75. left-icon="like-o"
  76. placeholder="请填写个人简介"
  77. type="textarea"
  78. rows="2"
  79. autosize
  80. maxlength="500"
  81. show-word-limit
  82. /> -->
  83. <!-- <van-field
  84. v-model="form.remark"
  85. name="remark"
  86. left-icon="description"
  87. label="备注"
  88. placeholder="请填写备注"
  89. type="textarea"
  90. rows="2"
  91. autosize
  92. maxlength="500"
  93. show-word-limit
  94. /> -->
  95. <div style="margin: 16px;">
  96. <van-button round block type="info" native-type="submit">
  97. 提交
  98. </van-button>
  99. </div>
  100. </van-form>
  101. </van-row>
  102. </el-col>
  103. </el-col>
  104. </el-row>
  105. </div>
  106. </template>
  107. <script>
  108. import Vue from 'vue';
  109. import { mapState, createNamespacedHelpers } from 'vuex';
  110. import NavBar from '@/layout/common/topInfo.vue';
  111. const { mapActions: onliveUser } = createNamespacedHelpers('onliveUser');
  112. export default {
  113. name: 'index',
  114. props: {},
  115. components: {
  116. NavBar,
  117. },
  118. data: function() {
  119. return {
  120. // 头部标题
  121. title: '',
  122. // meta为true
  123. isleftarrow: '',
  124. // 返回
  125. navShow: true,
  126. addresslist: ['省直', '黄石', '鄂州', '孝感', '黄冈', '咸宁'],
  127. showPicker: false,
  128. imgUrl: require('@/assets/test.jpg'),
  129. form: {},
  130. };
  131. },
  132. created() {
  133. this.searchInfo();
  134. },
  135. methods: {
  136. ...onliveUser(['roomuserfetch', 'roomuserupdate']),
  137. onConfirm(value) {
  138. this.form.address = value;
  139. this.showPicker = false;
  140. },
  141. async searchInfo() {
  142. // this.user.uid = '5ee84acb778c700c98d8bf35';
  143. const res = await this.roomuserfetch(this.user.uid);
  144. if (this.$checkRes(res)) {
  145. console.log(res.data);
  146. this.$set(this, `form`, res.data);
  147. }
  148. },
  149. async onSubmit() {
  150. const res = await this.roomuserupdate(this.form);
  151. if (this.$checkRes(res)) {
  152. this.$message({
  153. message: '修改信息成功',
  154. type: 'success',
  155. });
  156. this.back();
  157. }
  158. },
  159. // 返回
  160. back() {
  161. this.$router.push({ path: '/live/index' });
  162. },
  163. },
  164. computed: {
  165. ...mapState(['user']),
  166. pageTitle() {
  167. return `${this.$route.meta.title}`;
  168. },
  169. },
  170. mounted() {
  171. this.title = this.$route.meta.title;
  172. this.isleftarrow = this.$route.meta.isleftarrow;
  173. },
  174. };
  175. </script>
  176. <style lang="less" scoped>
  177. .style {
  178. width: 100%;
  179. min-height: 667px;
  180. position: relative;
  181. background-color: #f9fafc;
  182. }
  183. .top {
  184. height: 46px;
  185. overflow: hidden;
  186. position: relative;
  187. z-index: 999;
  188. }
  189. .main {
  190. min-height: 570px;
  191. .newsList {
  192. margin: 10px;
  193. border-bottom: 1px dashed #ccc;
  194. width: 95%;
  195. .image {
  196. .el-image {
  197. border-radius: 10px;
  198. }
  199. }
  200. .text {
  201. padding: 0 10px;
  202. .title {
  203. padding: 10px 0;
  204. }
  205. .type {
  206. font-size: 14px;
  207. color: #ccc;
  208. padding: 5px 0;
  209. }
  210. .time {
  211. font-size: 14px;
  212. color: #ccc;
  213. padding: 5px 0;
  214. }
  215. }
  216. }
  217. }
  218. /deep/.van-field__control {
  219. margin: 5px 10px;
  220. }
  221. </style>