perInfo.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <!-- 商户/非商户个人信息维护 -->
  2. <template>
  3. <view style="padding-bottom: 100upx;" class="main_width">
  4. <view>
  5. <view>
  6. <view class="form_item">
  7. <image class="rht" @click="upload_img" style="width: 110upx;height: 110upx;border-radius: 55upx;"
  8. :src="sub_data.profile_photo==''?'../../static/user.png': (sub_data.profile_photo.indexOf('http://')==0||sub_data.profile_photo.indexOf('https://')==0)?sub_data.profile_photo:(serverUrl+ sub_data.profile_photo)">
  9. </view>
  10. <view class="form_item" :key="item.key"
  11. v-for="(item, index) in (sys_role==0? user_info_item:user_info_item_merchant)">
  12. <view class="rht">{{item.name}}</view>
  13. <input :value="sub_data[item.key]||''" :data-index="item.key" @input="ipt_change" :type="item.type"
  14. :placeholder="'请输入'+item.name" />
  15. </view>
  16. <!-- 商户显示 -->
  17. <view v-if="sys_role==1">
  18. <view class="form_item">
  19. <view class="rht">联系人性别</view>
  20. <radio-group style="margin-right: 30upx;" @change="sex_change_merchant">
  21. <label>
  22. <radio color="#2bcfb4" value="男" :checked="sub_data.linker_gender=='0'||sub_data.linker_gender=='男'" />
  23. <text>男</text>
  24. </label>
  25. <label style="margin-left: 50upx;">
  26. <radio color="#2bcfb4" value="女" :checked="sub_data.linker_gender=='1'||sub_data.linker_gender=='女'" />
  27. <text>女</text>
  28. </label>
  29. </radio-group>
  30. </view>
  31. </view>
  32. <!-- 非商户显示 -->
  33. <view v-if="sys_role==0">
  34. <view class="form_item">
  35. <view class="rht">性别</view>
  36. <radio-group style="margin-right: 30upx;" @change="sex_change">
  37. <label>
  38. <radio color="#2bcfb4" value="男" :checked="sub_data.gender=='男'" />
  39. <text>男</text>
  40. </label>
  41. <label style="margin-left: 50upx;">
  42. <radio color="#2bcfb4" value="女" :checked="sub_data.gender=='女'" />
  43. <text>女</text>
  44. </label>
  45. </radio-group>
  46. </view>
  47. <view class="form_item">
  48. <view class="rht">出生日期</view>
  49. <view style="width: 435upx;">
  50. <uni-datetime-picker type='date' :value="sub_data.birthday" start="1900-01-01"
  51. :end="end_start" @change="date_change" />
  52. </view>
  53. </view>
  54. <view class="form_item">
  55. <view class="rht">学历</view>
  56. <view @click="select_education" style="margin-right: 30upx;color: #8f8f91;">
  57. {{sub_data.edulevel_name||''}}<text
  58. style="color: #8E97AE;font-size: 28upx;margin-left: 15upx;">点击切换</text>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view style="display: block;" class="form_item" :key="item.key"
  64. v-for="(item, index) in (sys_role==0? resume_info_item_edit:resume_info_item_edit_merchant)">
  65. <view class="rht">{{item.name}}</view>
  66. <textarea class="main_text_area" :value="sub_data[item.key]||''" :data-index="item.key"
  67. @input="ipt_change" :placeholder="'请输入'+item.name" />
  68. </view>
  69. <view v-if="sys_role==0" style="display: block;position: relative;" class="form_item">
  70. <image v-if="sub_data.certificates.length<5" @click="upload_img_certificates"
  71. style="width: 40upx;height: 40upx;position: absolute;right: 20upx;top: 36upx;"
  72. src="../../static/add_img.png"></image>
  73. <view style="width: 100%;padding-bottom: 25upx;" class="rht">相关证书(最多上传5张图片,长按图片可删除)</view>
  74. <view @longtap="delete_certificates(index)" class="cert_img_box" :key="index"
  75. v-for="(item,index) in sub_data.certificates">
  76. <image :src="item" style="width: 100%;" mode="widthFix"></image>
  77. </view>
  78. </view>
  79. <view style="height: 80upx;"></view>
  80. </view>
  81. <view @click="sub" class="conf_btn_per">确定</view>
  82. </view>
  83. </template>
  84. <script>
  85. import commonData from '../../commonData.js'
  86. import commonFun from '../../commonFun.js'
  87. export default {
  88. data() {
  89. return {
  90. end_start: '',
  91. serverUrl: commonFun.serverUrl,
  92. user_info_item: commonData.user_info_item,
  93. user_info_item_merchant: commonData.user_info_item_merchant,
  94. resume_info_item_edit: commonData.resume_info_item_edit,
  95. resume_info_item_edit_merchant: commonData.resume_info_item_edit_merchant,
  96. sys_role: commonData.sys_role,
  97. sub_data: {
  98. profile_photo: '',
  99. certificates: [],
  100. }, //个人信息
  101. education_arr: ['初中及以下', '中专', '高中', '专科', '本科', '硕士及以上']
  102. }
  103. },
  104. onLoad() {
  105. this.end_start = commonFun.formatDate2(new Date())
  106. if (commonFun.sys_role == 1) {
  107. uni.setNavigationBarTitle({
  108. title: '企业信息'
  109. })
  110. }
  111. this.get_info()
  112. },
  113. onPullDownRefresh() {
  114. this.get_info()
  115. },
  116. methods: {
  117. // 出生日期
  118. date_change(e) {
  119. let sub_data = {
  120. ...this.sub_data
  121. }
  122. sub_data.birthday = e
  123. this.sub_data = sub_data
  124. },
  125. // 删除证书
  126. delete_certificates(index) {
  127. uni.showModal({
  128. title: '确认删除?',
  129. success: (res) => {
  130. if (res.confirm) {
  131. let sub_data = {
  132. ...this.sub_data
  133. }
  134. sub_data.certificates = sub_data.certificates.splice(index, 1)
  135. this.certificates = sub_data
  136. }
  137. }
  138. })
  139. },
  140. // 上传证书
  141. upload_img_certificates() {
  142. commonFun.uploadFileApiOSS(res => {
  143. if (res.status) {
  144. let sub_data = {
  145. ...this.sub_data
  146. }
  147. let certificates = sub_data.certificates
  148. certificates.push(res.data)
  149. sub_data.certificates = certificates
  150. this.certificates = sub_data
  151. }
  152. })
  153. },
  154. // 上传头像
  155. upload_img(e) {
  156. commonFun.uploadFileApiOSS(res => {
  157. if (res.status) {
  158. let sub_data = {
  159. ...this.sub_data
  160. }
  161. sub_data.profile_photo = res.data
  162. this.sub_data = sub_data
  163. }
  164. })
  165. },
  166. // 获取个人信息
  167. get_info() {
  168. uni.showLoading({
  169. title: '加载中...',
  170. mask: true,
  171. })
  172. commonFun.get_user_info(res => {
  173. if (res.status) {
  174. uni.hideLoading()
  175. let sub_data = res.data.Result
  176. sub_data.certificates = sub_data.certificates ? sub_data.certificates : []
  177. this.sub_data = sub_data
  178. console.log('个人信息页面获取个人信息')
  179. console.log(this.sub_data)
  180. }
  181. uni.stopPullDownRefresh()
  182. })
  183. },
  184. // 选择学历
  185. select_education(e) {
  186. let sub_data = {
  187. ...this.sub_data
  188. }
  189. uni.showActionSheet({
  190. itemList: this.education_arr,
  191. success: (res) => {
  192. sub_data.edulevel_name = this.education_arr[res.tapIndex]
  193. this.sub_data = sub_data
  194. },
  195. fail: function(res) {
  196. console.log(res.errMsg);
  197. }
  198. });
  199. },
  200. // 性别选择
  201. sex_change(e) {
  202. let sub_data = {
  203. ...this.sub_data
  204. }
  205. sub_data.gender = e.target.value
  206. this.sub_data = sub_data
  207. },
  208. // 商家性别选择
  209. sex_change_merchant(e) {
  210. let sub_data = {
  211. ...this.sub_data
  212. }
  213. sub_data.linker_gender = e.target.value
  214. this.sub_data = sub_data
  215. },
  216. // 输入框输入
  217. ipt_change(e) {
  218. const key = e.currentTarget.dataset.index
  219. let sub_data = {
  220. ...this.sub_data
  221. }
  222. sub_data[key] = e.target.value
  223. this.sub_data = sub_data
  224. },
  225. // 点击确定提交
  226. sub() {
  227. let sub_data = {
  228. ...this.sub_data,
  229. }
  230. let gender = sub_data.gender == '男' ? '0' : sub_data.gender == '女' ? '1' : '-1'
  231. let linker_gender = sub_data.linker_gender == '男' ? '0' : sub_data.linker_gender == '女' ? '1' : '0'
  232. sub_data.gender = gender
  233. sub_data.linker_gender = linker_gender
  234. console.log(sub_data)
  235. // return
  236. uni.showLoading({
  237. title: '加载中...',
  238. mask: true
  239. })
  240. commonFun.requestUrl('&WsAjaxBiz=Worker&WsAjaxAction=registerInfo', {
  241. ...sub_data
  242. }, res => {
  243. if (res.status) {
  244. uni.hideLoading()
  245. uni.showToast({
  246. title: '修改成功'
  247. })
  248. uni.showModal({
  249. content: '修改成功!',
  250. showCancel: false,
  251. success: () => {
  252. uni.navigateBack({
  253. delta: 1
  254. });
  255. }
  256. })
  257. }
  258. })
  259. },
  260. }
  261. }
  262. </script>
  263. <style>
  264. .conf_btn_per {
  265. width: 100%;
  266. height: 80upx;
  267. line-height: 80upx;
  268. background: linear-gradient(90deg, #26daad 0%, #68d7c4 100%);
  269. color: white;
  270. text-align: center;
  271. z-index: 10000;
  272. border-radius: 15upx;
  273. }
  274. .form_item {
  275. justify-content: flex-start;
  276. }
  277. .form_item .rht {
  278. width: 200upx;
  279. /* background-color: #00C7B2; */
  280. }
  281. .form_item input {
  282. text-align: left;
  283. /* background-color: #07C160; */
  284. width: 430upx;
  285. }
  286. .cert_img_box {
  287. background-color: #f5f5f5;
  288. overflow: hidden;
  289. margin: 15upx auto;
  290. width: 95%;
  291. border-radius: 20upx;
  292. }
  293. </style>