info.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view style="padding: 30rpx;">
  3. <view style="position: relative;">
  4. <view class="tip">
  5. 请填写真实信息,以便我们后续为您提供完善的
  6. <br />
  7. 个人职业成长定制服务!
  8. </view>
  9. <view class="btn" style="position: absolute;right: 20rpx;top: 0;">编辑</view>
  10. </view>
  11. <view class="form">
  12. <u-form :model="form" ref="uForm">
  13. <u-form-item label="姓名"><u-input v-model="form.name" /></u-form-item>
  14. <u-form-item label="手机号码" :label-width="auto"><u-input v-model="form.tel" /></u-form-item>
  15. <u-form-item label="身份证号" :label-width="auto"><u-input v-model="form.id" /></u-form-item>
  16. <u-form-item label="性别">
  17. <picker @change="bindPickerChangeSex" :value="index_sex" :range="array_sex">
  18. <view class="picker">{{ array_sex[index_sex] }}</view>
  19. </picker>
  20. </u-form-item>
  21. <u-form-item label="邮箱" :label-width="auto"><u-input v-model="form.email" /></u-form-item>
  22. <u-form-item label="出生日期" prop="birth" :label-width="auto">
  23. <picker mode="date" :value="form.date" @change="bindDateChange">
  24. <view class="picker">{{ form.date }}</view>
  25. </picker>
  26. </u-form-item>
  27. <u-form-item label="身份"></u-form-item>
  28. <u-form-item label="户籍" prop="xz">
  29. <pick-regions :defaultRegion="defaultRegionCode" @getRegion="handleGetRegion">
  30. <view class="picker">{{ form.region1[0] }} {{ form.region1[1] }} {{ form.region1[2] }}</view>
  31. </pick-regions>
  32. </u-form-item>
  33. <u-form-item label="婚姻状况" :label-width="auto">
  34. <picker @change="bindPickerChangeMarry" :value="index_marry" :range="array_marry">
  35. <view class="picker">{{ array_marry[index_marry] }}</view>
  36. </picker>
  37. </u-form-item>
  38. <u-form-item label="所在城市" prop="xz" :label-width="auto">
  39. <pick-regions :defaultRegion="defaultRegionCode" @getRegion="handleGetRegion2">
  40. <view class="picker">{{ form.region2[0] }} {{ form.region2[1] }} {{ form.region2[2] }}</view>
  41. </pick-regions>
  42. </u-form-item>
  43. <u-form-item label="政治面貌" :label-width="auto">
  44. <picker @change="bindPickerChangePolitic" :value="index_politic" :range="array_politic">
  45. <view class="picker">{{ array_politic[index_politic] }}</view>
  46. </picker>
  47. </u-form-item>
  48. <u-form-item label="一寸头像" :label-width="auto" label-position="top">
  49. <u-upload
  50. :auto-upload="false"
  51. custom-btn="true"
  52. :action="action"
  53. :file-list="fileList"
  54. width="120"
  55. height="169"
  56. size-type="['compressed']"
  57. max-count="1"
  58. @on-list-change="changePhotoListHeader"
  59. >
  60. <template v-slot:addBtn>
  61. <image src="/static/info_1.png" style="width: 120rpx; height: 169rpx;"></image>
  62. </template>
  63. </u-upload>
  64. </u-form-item>
  65. <u-form-item label="身份证人像面" :label-width="auto" label-position="top">
  66. <u-upload
  67. :auto-upload="false"
  68. custom-btn="true"
  69. :action="action"
  70. :file-list="fileList1"
  71. width="120"
  72. height="82"
  73. size-type="['compressed']"
  74. max-count="1"
  75. @on-list-change="changePhotoListZ"
  76. >
  77. <template v-slot:addBtn>
  78. <image src="/static/info_2.png" style="width: 120rpx; height: 82rpx;"></image>
  79. </template>
  80. </u-upload>
  81. </u-form-item>
  82. <u-form-item label="身份证国徽面" :label-width="auto" label-position="top">
  83. <u-upload
  84. :auto-upload="false"
  85. custom-btn="true"
  86. :action="action"
  87. :file-list="fileList2"
  88. width="120"
  89. height="82"
  90. size-type="['compressed']"
  91. max-count="1"
  92. @on-list-change="changePhotoListF"
  93. >
  94. <template v-slot:addBtn>
  95. <image src="/static/info_3.png" style="width: 120rpx; height: 82rpx;"></image>
  96. </template>
  97. </u-upload>
  98. </u-form-item>
  99. </u-form>
  100. </view>
  101. <u-button type="success" @click="submitForm">提交</u-button>
  102. </view>
  103. </template>
  104. <script>
  105. export default {
  106. data() {
  107. return {
  108. action: '33',
  109. fileList: [],
  110. fileList1: [],
  111. fileList2: [],
  112. defaultRegionCode: '440112',
  113. form: {
  114. date: '1990-01-01',
  115. region1: ['广东省', '广州市', '天河区'],
  116. region2: ['广东省', '广州市', '天河区']
  117. },
  118. index_sex: 0,
  119. array_sex: ['男', '女'],
  120. index_marry: 0,
  121. array_marry: ['未婚', '已婚'],
  122. index_politic: 0,
  123. array_politic: ['群众', '团员', '党员']
  124. };
  125. },
  126. onLoad(option) {},
  127. onShow() {},
  128. methods: {
  129. changePhotoListHeader(lists, name) {
  130. this.fileList = lists;
  131. },
  132. changePhotoListZ(lists, name) {
  133. this.fileList1 = lists;
  134. },
  135. changePhotoListF(lists, name) {
  136. this.fileList2 = lists;
  137. },
  138. async submitForm() {
  139. console.log(this.form)
  140. const file1 = await this.uploadFile(this.fileList, 0);
  141. // const file2 = await this.uploadFile(this.fileList1, 1);
  142. // const file3 = await this.uploadFile(this.fileList2, 1);
  143. },
  144. uploadFile(options, int) {
  145. var self = this;
  146. return new Promise((resolve, reject) => {
  147. var data = {
  148. imageStatus: int
  149. };
  150. this.$api.aliyunpolicy(data).then(res => {
  151. var ossToken = res.data.data.resultContent;
  152. console.log(ossToken)
  153. uni.uploadFile({
  154. url: ossToken.host,
  155. name: 'file',
  156. filePath: options[0].file.path,
  157. fileType: 'image',
  158. header: {
  159. AuthorizationToken: 'WX ' + this.$store.state.token
  160. },
  161. formData: {
  162. key: ossToken.dir,
  163. OSSAccessKeyId: ossToken.accessid,
  164. policy: ossToken.policy,
  165. Signature: ossToken.signature,
  166. success_action_status: 200,
  167. },
  168. success: (result)=>{
  169. console.log(result);
  170. resolve()
  171. },
  172. fail: (error)=>{
  173. console.log(error)
  174. }
  175. });
  176. });
  177. resolve();
  178. });
  179. },
  180. bindPickerChangeSex(e) {
  181. this.index_sex = e.detail.value;
  182. },
  183. bindPickerChangePolitic(e) {
  184. this.index_politic = e.detail.value;
  185. },
  186. bindPickerChangeMarry(e) {
  187. this.index_marry = e.detail.value;
  188. },
  189. handleGetRegion2(region) {
  190. let array = [];
  191. array.push(region[0].name);
  192. array.push(region[1].name);
  193. array.push(region[2].name);
  194. this.form.region2 = array;
  195. },
  196. // 获取选择的地区
  197. handleGetRegion(region) {
  198. let array = [];
  199. array.push(region[0].name);
  200. array.push(region[1].name);
  201. array.push(region[2].name);
  202. this.form.region1 = array;
  203. },
  204. bindDateChange(e) {
  205. this.form.date = e.detail.value;
  206. var year = this.date.substr(0, 4);
  207. var month = this.date.substr(5, 2);
  208. var day = this.date.substr(8, 2);
  209. },
  210. actionSheetCallback(index) {
  211. uni.hideKeyboard();
  212. this.form.sex_text = this.actionSheetList[index].text;
  213. }
  214. }
  215. };
  216. </script>
  217. <style scope>
  218. .picker {
  219. text-align: right;
  220. }
  221. input {
  222. text-align: right;
  223. }
  224. .form {
  225. background: #ffffff;
  226. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  227. border-radius: 32rpx;
  228. margin: 20rpx 0;
  229. padding: 15rpx;
  230. }
  231. .btn {
  232. width: 96rpx;
  233. height: 48rpx;
  234. background: #32467b;
  235. border-radius: 16rpx;
  236. font-size: 24rpx;
  237. color: #ffffff;
  238. line-height: 48rpx;
  239. text-align: center;
  240. }
  241. page {
  242. background: #fdfdfd;
  243. }
  244. .tip {
  245. width: 70%;
  246. font-size: 20rpx;
  247. font-family: PingFang SC;
  248. font-weight: 400;
  249. color: #32467b;
  250. }
  251. </style>