personal-information.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view>
  3. <view class="uni-list">
  4. <view class="uni-list-cell">
  5. <view class="uni-list-cell-left">
  6. 姓名<text>*</text>
  7. </view>
  8. <view class="uni-list-cell-db">
  9. <input type="text" value="haha" style="direction: rtl;" />
  10. </view>
  11. </view>
  12. </view>
  13. <view class="uni-list">
  14. <view class="uni-list-cell">
  15. <view class="uni-list-cell-left">
  16. 性别<text>*</text>
  17. </view>
  18. <view class="uni-list-cell-db">
  19. <picker @change="bindPickerChange" :value="index" :range="array">
  20. <view class="uni-input">{{array[index]}}</view><image src="../../static/右箭头.svg" mode="">
  21. </picker>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="uni-list">
  26. <view class="uni-list-cell">
  27. <view class="uni-list-cell-left">
  28. 手机号<text>*</text>
  29. </view>
  30. <view class="uni-list-cell-db">
  31. <picker @change="bindPickerChange" :value="index" :range="array">
  32. <view class="uni-input">{{phone[index]}}</view><image src="../../static/右箭头.svg" mode="">
  33. </picker>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="uni-list">
  38. <view class="uni-list-cell">
  39. <view class="uni-list-cell-left">
  40. 备选手机号<text>*</text>
  41. </view>
  42. <view class="uni-list-cell-db">
  43. <picker @change="bindPickerChange" :value="index" :range="array">
  44. <view class="uni-input">{{phones[index]}}</view><image src="../../static/右箭头.svg" mode="">
  45. </picker>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="uni-list">
  50. <view class="cuni-list-cell">
  51. <view class="uni-list-cell-left">
  52. 学生宿舍<text>*</text>
  53. </view>
  54. <view class="uni-list-cell-db">
  55. <picker mode="multiSelector" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray">
  56. <view class="uni-input">{{multiArray[0][multiIndex[0]]}}{{multiArray[1][multiIndex[1]]}}{{multiArray[2][multiIndex[2]]}}
  57. <image src="../../static/右箭头.svg" mode="">
  58. </view>
  59. </picker>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="uni-list">
  64. <view class="uni-list-cell">
  65. <view class="uni-list-cell-left">
  66. 学生校区<text>*</text>
  67. </view>
  68. <view class="uni-list-cell-db">
  69. <picker @change="bindPickerChange" :value="index" :range="array">
  70. <view class="uni-input">{{school[index]}}</view><image src="../../static/右箭头.svg" mode="">
  71. </picker>
  72. </view>
  73. </view>
  74. </view>
  75. <button @click="getRoom()" type="default">确认</button>
  76. </view>
  77. </template>
  78. <script>
  79. export default {
  80. data() {
  81. return {
  82. array:['男','女'],
  83. phone:['182798******','********'],
  84. phones:['000000','00000'],
  85. school:['黄家湖','墨轩湖'],
  86. index:0,
  87. multiArray: [
  88. ['1栋', '2栋'],
  89. ['1', '2'],
  90. ['01', '02', '03']
  91. ],
  92. multiIndex: [0, 0, 0],
  93. }
  94. },
  95. methods: {
  96. getRoom(){
  97. console.log('获取宿舍')
  98. // 发起请求,获取楼栋
  99. this.multiArray[0] = ['1栋', '2栋','3栋','4栋','5栋','6栋','7栋','8栋']
  100. // this.multiArray[0] = res.data.data
  101. // 发起请求,获取楼层
  102. this.multiArray[1] = ['1', '2','3','4']
  103. this.multiArray[2] = ['01', '02', '03','04','05']
  104. },
  105. bindPickerChange: function(e) {
  106. console.log('picker发送选择改变,携带值为', e.target.value)
  107. this.index = e.target.value
  108. },
  109. bindMultiPickerColumnChange: function(e) {
  110. console.log('修改的列为:' + e.detail.column + ',值为:' + e.detail.value)
  111. this.multiIndex[e.detail.column] = e.detail.value
  112. switch (e.detail.column) {
  113. case 0: //拖动第1列
  114. switch (this.multiIndex[0]) {
  115. case 0:
  116. this.multiArray[1] = ['1', '2']
  117. this.multiArray[2] = ['01', '02', '03']
  118. break
  119. case 1:
  120. this.multiArray[1] = ['1', '2']
  121. this.multiArray[2] = ['01', '02']
  122. break
  123. }
  124. this.multiIndex.splice(1, 1, 0)
  125. this.multiIndex.splice(2, 1, 0)
  126. break
  127. case 1: //拖动第2列
  128. switch (this.multiIndex[0]) { //判断第一列是什么
  129. case 0:
  130. switch (this.multiIndex[1]) {
  131. case 0:
  132. this.multiArray[2] = ['101', '102', '103']
  133. break
  134. case 1:
  135. this.multiArray[2] = ['201','202']
  136. break
  137. }
  138. break
  139. case 1:
  140. switch (this.multiIndex[1]) {
  141. case 0:
  142. this.multiArray[2] = ['101', '102']
  143. break
  144. case 1:
  145. this.multiArray[2] = ['201', '202']
  146. break
  147. }
  148. break
  149. }
  150. this.multiIndex.splice(2, 1, 0)
  151. break
  152. }
  153. this.$forceUpdate()
  154. },
  155. }
  156. }
  157. </script>
  158. <style>
  159. .uni-list-cell-left{
  160. float: left;
  161. width: 22%;
  162. height: 47px;
  163. text-align: center;
  164. font-size: 14px;
  165. border-bottom: 1px solid rgba(200, 200, 205, 1);
  166. line-height: 47px;
  167. }
  168. .uni-list-cell-left text{
  169. color: red;
  170. }
  171. .uni-list-cell-db{
  172. float: right;
  173. width: 78%;
  174. height: 47px;
  175. border-bottom: 1px solid rgba(200, 200, 205, 1);
  176. }
  177. .uni-list-cell-db .name{
  178. float: right;
  179. }
  180. .uni-list{
  181. position: relative;
  182. font-size: 14px;
  183. }
  184. .uni-list-cell-db input{
  185. height: 47px;
  186. width: 78%;
  187. text-align: center;
  188. line-height: 47px;
  189. font-size: 14px;
  190. }
  191. .uni-list-cell-db .uni-input{
  192. float: right;
  193. margin-right: 36px;
  194. text-align: center;
  195. line-height: 47px;
  196. }
  197. .uni-list-cell-db uni-image{
  198. position: absolute;
  199. width: 26px;
  200. height: 26px;
  201. right: 3px;
  202. top:11px;
  203. }
  204. button{
  205. position: absolute;
  206. top:345px;
  207. left: 24px;
  208. width: 328px;
  209. height: 47px;
  210. color: white;
  211. background-color: rgba(42, 130, 228, 1);
  212. }
  213. </style>