index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. //import * as WxJsApi from '@/utils/wxJsApi.js'
  2. import * as API from '@/apis/job/install.js'
  3. import * as API_common from '@/apis/common.js'
  4. import * as WxJsApi from '@/utils/wxJsApi.js'
  5. export default {
  6. data() {
  7. return {
  8. isReady:true,
  9. endyear:2020,
  10. pickerShow:false,
  11. form: {
  12. name: '',
  13. sex: '',
  14. value:''
  15. },
  16. leftStyle:{
  17. color: '#2979ff',
  18. fontSize:'32rpx',
  19. },
  20. actionSheetList: [
  21. {
  22. id:1,
  23. text: '男'
  24. },
  25. {
  26. id:0,
  27. text: '女'
  28. },
  29. {
  30. id:2,
  31. text: '保密'
  32. }
  33. ],
  34. pickerShowSList:[],
  35. pickerShowS:false,
  36. actionSheetShow: false,
  37. }
  38. },
  39. methods: {
  40. uploadPic(){
  41. if(!this.isReady){
  42. return
  43. }
  44. WxJsApi.chooseImage().then(res=>{
  45. var formData = {
  46. 'photoName': '1.jpg',
  47. 'photoFile': res.localData
  48. }
  49. uni.showLoading({
  50. title:"加载中",mask:true,
  51. })
  52. API_common.uploadBase64(formData).then(response => {
  53. this.form.headImageUrl=response.data;
  54. uni.showToast({
  55. title:"上传成功",
  56. icon:"none"
  57. })
  58. this.$forceUpdate()
  59. }).catch(error => {
  60. uni.showToast({
  61. title:error,
  62. icon:"none"
  63. })
  64. })
  65. })
  66. },
  67. selectpicker(item){
  68. this.form.birthday=item.year+"-"+item.month+"-"+item.day;
  69. },
  70. // 点击actionSheet回调
  71. save(){
  72. var form=this.form;
  73. var error=""
  74. if(!form.realName){
  75. error="请输入姓名"
  76. }else if(!form.sex){
  77. error="请选择性别"
  78. }else if(!form.birthday){
  79. error="请选择出生年月"
  80. }else if(!form.address){
  81. error="请输入常驻地区"
  82. }else if(!form.firstJobTime){
  83. error="请选择参加工作时间"
  84. }
  85. if(error){
  86. uni.showToast({
  87. title:error
  88. })
  89. return false;
  90. }
  91. uni.showLoading({
  92. title:"加载中",mask:true,
  93. })
  94. API.saveInformation(this.form).then((res)=>{
  95. uni.showToast({
  96. title:res.data
  97. })
  98. this.carhelp.setPersonInfo(this.form);
  99. // uni.hideLoading()
  100. }).catch(error => {
  101. uni.showToast({
  102. title:error
  103. })
  104. })
  105. },
  106. selectpickerS(item){
  107. this.form.firstJobTime=item[0].label+item[1].label;
  108. },
  109. getInfo() {
  110. uni.showLoading({
  111. title:"加载中",mask:true,
  112. })
  113. API.myInformation().then((res)=>{
  114. this.form=res.data;
  115. uni.hideLoading()
  116. }).catch(error => {
  117. uni.showToast({
  118. title:error
  119. })
  120. })
  121. },
  122. },
  123. onReady(){
  124. WxJsApi.getWxConfig(['chooseImage']).then(()=>{
  125. this.isReady=true
  126. });
  127. var list=["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]
  128. list=list.map((item)=>{
  129. return {
  130. value:item,
  131. label:item,
  132. }
  133. })
  134. var year=new Date().getYear()+1900;
  135. this.endyear=year-5;
  136. console.log(this.endyear)
  137. var list2=[];
  138. for(var i=0;i< 40;i++){
  139. list2.push({
  140. value:year-i+"年",
  141. label:year-i+"年",
  142. children:list
  143. })
  144. }
  145. this.pickerShowSList.push(list2)
  146. this.pickerShowSList.push(list)
  147. this.getInfo()
  148. }
  149. }