attachment.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. <template>
  2. <view>
  3. <!-- 顶部导航栏 -->
  4. <view class="navbar" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
  5. <view class="navbar-content">
  6. <view class="navbar-left" @click="goBack">
  7. <u-icon name="arrow-leftward" size="36" color="#333"></u-icon>
  8. </view>
  9. <view class="navbar-title">附件管理</view>
  10. <view class="navbar-right"></view>
  11. </view>
  12. </view>
  13. <!-- <nav-bar title="基本信息"></nav-bar> -->
  14. <view class="contain flex flex-direction">
  15. <view class="usermain">
  16. <scroll-view scroll-with-animation scroll-y>
  17. <!-- 我的公司 -->
  18. <view class="usermain-item item-padding" v-for="item in content">
  19. <view class="usermain-item-title c-flex-center"><image src="../../static/images/pdf.svg" class="header-icon" /></view>
  20. <view @click="seekDoc(item)" class="fileContent c-flex-center">
  21. <view class="fileName">{{item.attachment_name}}</view>
  22. <view class="filedesc">{{item.attachment_size}} 更新于{{item.create_time}}</view>
  23. </view>
  24. <view @click.stop="more(item.resumes_attachment_id)" class="c-flex-center">
  25. <u-icon name="more-dot-fill"></u-icon>
  26. </view>
  27. </view>
  28. <empty :isShow="false" v-if="content.length==0" />
  29. </scroll-view>
  30. </view>
  31. <view class="footer-btn">
  32. <fileSelector title="上传简历" allowType=".doc,.docx,.xls,.xlsx,.pdf" @fileSelected="uploadResumes" @filesChanged="onFilesChanged" />
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import configdata from '../../common/config.js';
  39. import navBar from "@/components/nav-bar/index.vue";
  40. // 引入组件
  41. import fileSelector from '@/uni_modules/zhouquan-fileSelector/components/zhouquan-fileSelector/file-selector.vue';
  42. import empty from '../../components/empty.vue'
  43. export default {
  44. components: {
  45. navBar,
  46. fileSelector,
  47. empty
  48. },
  49. data() {
  50. return {
  51. statusBarHeight: 0, // 状态栏高度
  52. phone: '',
  53. weChatNum:'',//微信号
  54. email: '',//接收简历邮箱
  55. selectedCompany: '深圳市汉瑞国际猎头服务有限公司', // 我的公司
  56. selectedPosition: '人事总监', // 我的职务
  57. avatar: '../../static/logo.png',
  58. userName: '',
  59. nickName: '',
  60. userId: '',
  61. realName: '',
  62. weChatId: "",
  63. password: '',
  64. platform: '',
  65. createTime: '',
  66. money: '',
  67. jiFen: '',
  68. status: '',
  69. zhiFuBao: '',
  70. zhiFuBaoName: '',
  71. sex: 1,
  72. age: 0,
  73. content:[]
  74. };
  75. },
  76. computed: {
  77. phoneWithMask() {
  78. if (this.phone && this.phone.length >= 11) {
  79. return this.phone.substring(0, 3) + '******' + this.phone.substring(9);
  80. }
  81. return this.phone || '请设置手机号';
  82. }
  83. },
  84. onLoad(e) {
  85. // 获取状态栏高度
  86. let systemInfo = uni.getSystemInfoSync();
  87. this.statusBarHeight = systemInfo.statusBarHeight || 0;
  88. this.getUserInfo()
  89. // this.avatar = uni.getStorageSync('avatar')
  90. },
  91. methods: {
  92. // 返回上一页
  93. goBack() {
  94. uni.navigateBack();
  95. },
  96. // 修改手机号
  97. modifyPhone() {
  98. console.log('点击修改手机号,当前手机号:', this.phone);
  99. const url = `/pages/my/userphone?currentPhone=${this.phone}`;
  100. console.log('跳转路径:', url);
  101. uni.navigateTo({
  102. url: url,
  103. });
  104. },
  105. // 选择公司
  106. selectCompany() {
  107. uni.navigateTo({
  108. url: '/pages/my/myCompany'
  109. });
  110. },
  111. // 选择职务
  112. selectPosition() {
  113. // 这里可以跳转到职务选择页面或显示职务选择弹窗
  114. console.log('选择职务');
  115. },
  116. onChooseAvatar(e) {
  117. let that = this;
  118. let token = uni.getStorageSync('token');
  119. uni.uploadFile({
  120. url: that.config("APIHOST1") +
  121. '/alioss/upload', //真实的接口地址
  122. filePath: e.detail.avatarUrl,
  123. header: {
  124. token: token
  125. },
  126. name: 'file',
  127. success: uploadFileRes => {
  128. let url = JSON.parse(uploadFileRes.data);
  129. that.avatar = url.data
  130. uni.hideLoading();
  131. }
  132. });
  133. },
  134. goMyAddress() {
  135. uni.navigateTo({
  136. url: '../jifen/myaddress'
  137. });
  138. },
  139. uploadImg() {
  140. let token = uni.getStorageSync('token')
  141. if (!token) {
  142. this.goLoginInfo();
  143. return;
  144. }
  145. let that = this;
  146. var url = null;
  147. uni.showActionSheet({
  148. // itemList按钮的文字接受的是数组
  149. itemList: ["查看头像", "从相册选择图片"],
  150. success(e) {
  151. var index = e.tapIndex
  152. if (index === 0) {
  153. // 用户点击了预览当前图片
  154. // 可以自己实现当前头像链接的读取
  155. let url = that.avatar;
  156. let arr = []
  157. arr.push(url)
  158. uni.previewImage({
  159. // 预览功能图片也必须是数组的
  160. urls: arr
  161. })
  162. } else if (index === 1) {
  163. uni.chooseImage({
  164. count: 1, //默认9
  165. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  166. sourceType: ['album'], //从相册选择
  167. success: function(res) {
  168. uni.showLoading({
  169. title: '上传中...'
  170. });
  171. let token = uni.getStorageSync('token');
  172. let userId = uni.getStorageSync('userId');
  173. uni.uploadFile({
  174. url: that.config("APIHOST1") +
  175. '/alioss/upload', //真实的接口地址
  176. filePath: res.tempFilePaths[0],
  177. header: {
  178. token: token
  179. },
  180. name: 'file',
  181. success: uploadFileRes => {
  182. url = JSON.parse(uploadFileRes.data);
  183. that.avatar = url.data
  184. uni.hideLoading();
  185. }
  186. });
  187. }
  188. });
  189. }
  190. }
  191. })
  192. },
  193. config: function(name) {
  194. var info = null;
  195. if (name) {
  196. var name2 = name.split("."); //字符分割
  197. if (name2.length > 1) {
  198. info = configdata[name2[0]][name2[1]] || null;
  199. } else {
  200. info = configdata[name] || null;
  201. }
  202. if (info == null) {
  203. let web_config = cache.get("web_config");
  204. if (web_config) {
  205. if (name2.length > 1) {
  206. info = web_config[name2[0]][name2[1]] || null;
  207. } else {
  208. info = web_config[name] || null;
  209. }
  210. }
  211. }
  212. }
  213. return info;
  214. },
  215. getUserInfo() {
  216. this.$Request.get("/app/resumes/getAttachment").then(res => {
  217. if (res.code == 0) {
  218. this.content=res.data
  219. }
  220. uni.hideLoading();
  221. });
  222. },
  223. // 保存
  224. uploadResumes(e) {
  225. var that=this
  226. console.log(e.path)
  227. uni.getFileInfo({
  228. filePath: e.path,
  229. success: (info) => {
  230. console.log('文件大小:', info.size); // 单位:字节
  231. let attachment_size=parseInt(info.size/1024)
  232. that.$queue.uploadFile(e.path,function(path){
  233. if(path)
  234. that.$Request.postJson("/app/resumes/saveAttachment", {
  235. attachment_address:path,
  236. attachment_name:e.name,
  237. attachment_size
  238. }).then(res => {
  239. if (res.code === 0) {
  240. that.getUserInfo()
  241. } else {
  242. uni.showToast({
  243. title: res.msg,
  244. icon: "none"
  245. })
  246. }
  247. })
  248. else
  249. that.$queue.showToast('文件上传失败')
  250. })
  251. },
  252. fail: (err) => {
  253. console.error('获取失败', err);
  254. }
  255. });
  256. },
  257. more(id){
  258. var that=this
  259. uni.showActionSheet({
  260. itemList: ["删除"],
  261. itemColor: "#3273db",
  262. success(res) {
  263. if(res.tapIndex==0)
  264. that.deleteAttachment(id)
  265. },
  266. fail(res) {
  267. console.log(res.errMsg);
  268. },
  269. });
  270. },
  271. deleteAttachment(id){
  272. var that = this;
  273. uni.showModal({
  274. title: '提示',
  275. content: '确定删除?',
  276. success(res) {
  277. if (res.confirm) {
  278. that.$Request.postJson("/app/resumes/deleteAttachment", {
  279. resumes_attachment_id: id
  280. }).then(res => {
  281. if (res.code === 0) {
  282. var info = that.content.filter(function (item) {
  283. return item.resumes_attachment_id != id;
  284. });
  285. that.content=info
  286. } else {
  287. uni.showToast({
  288. title: res.msg,
  289. icon: "none"
  290. })
  291. }
  292. })
  293. } else if (res.cancel) {
  294. console.log('用户点击取消')
  295. }
  296. }
  297. })
  298. },
  299. onFilesChanged(e){
  300. console.log(e)
  301. },
  302. seekDoc(it){
  303. uni.navigateTo({
  304. url: '/pages/index/webView?url=' + it.attachment_address
  305. });
  306. }
  307. },
  308. // userphone(){
  309. // uni.navigateTo({
  310. // url:'/pages/my/userphone'
  311. // })
  312. // }
  313. };
  314. </script>
  315. <style lang="scss" scoped>
  316. page {
  317. /* background: #f6f6f6; */
  318. }
  319. .navbar {
  320. position: fixed;
  321. top: 0;
  322. left: 0;
  323. right: 0;
  324. z-index: 999;
  325. background: #fff;
  326. padding: 0 0 40rpx 20rpx;
  327. .navbar-content {
  328. display: flex;
  329. align-items: center;
  330. justify-content: space-between;
  331. padding: 0 30rpx;
  332. height: 60rpx;
  333. .navbar-left {
  334. width: 60rpx;
  335. height: 60rpx;
  336. display: flex;
  337. align-items: center;
  338. justify-content: center;
  339. }
  340. .navbar-title {
  341. color: rgba(23, 23, 37, 1);
  342. font-family: DM Sans;
  343. font-size: 36rpx;
  344. font-weight: 700;
  345. line-height: 52rpx;
  346. letter-spacing: 0%;
  347. text-align: center;
  348. }
  349. .navbar-right {
  350. width: 60rpx;
  351. height: 60rpx;
  352. }
  353. }
  354. }
  355. button::after {
  356. border: none;
  357. background-color: none;
  358. }
  359. button {
  360. position: relative;
  361. display: block;
  362. margin-left: auto;
  363. margin-right: auto;
  364. padding-left: 0px;
  365. padding-right: 0px;
  366. box-sizing: border-box;
  367. text-decoration: none;
  368. line-height: 1.35;
  369. overflow: hidden;
  370. color: #666666;
  371. /* background-color: #fff; */
  372. background-color: rgba(255, 255, 255, 0) !important;
  373. width: 100%;
  374. height: 100%;
  375. }
  376. .contain{
  377. padding-top: 120rpx; /* 为固定导航栏留出空间 */
  378. height: 100vh;
  379. }
  380. .usermain {
  381. background: #ffffff;
  382. /* color: #fff; */
  383. height: 100vh;
  384. scroll-view{
  385. height: 100%;
  386. }
  387. }
  388. .usermain-item {
  389. display: flex;
  390. justify-content: space-between;
  391. margin: 0 40rpx;
  392. padding: 30rpx 0;
  393. // border-bottom: 1rpx solid rgba(229, 229, 229, 0.3);
  394. background: #fff;
  395. gap: 16rpx;
  396. .fileContent{
  397. width: 80%;
  398. margin:0 20rpx;
  399. }
  400. .fileName{
  401. color: #222;
  402. }
  403. .filedesc{
  404. margin-top: 10rpx;
  405. font-size: 20rpx;
  406. }
  407. .c-flex-center{
  408. align-self: center;
  409. color: #aaa;
  410. }
  411. }
  412. .usermain-item-title {
  413. color: rgba(31, 44, 55, 1);
  414. font-family: DM Sans;
  415. font-size: 28rpx;
  416. font-weight: 500;
  417. line-height: 44rpx;
  418. text-align: left;
  419. .header-icon{
  420. width: 50rpx;
  421. height: 50rpx;
  422. display: block;
  423. }
  424. }
  425. .usermain-item.item-padding {
  426. /* padding: 0; */
  427. }
  428. .cu-form-group {
  429. padding: 0;
  430. background: #ffffff;
  431. text-align: right;
  432. }
  433. .cu-form-group input {
  434. background: #ffffff;
  435. font-size: 28rpx;
  436. /* color: #fff; */
  437. }
  438. /* 姓名字段样式 - 参考basicInfo.vue */
  439. .usermain-item .form-label {
  440. color: rgba(31, 44, 55, 1);
  441. font-family: DM Sans;
  442. font-size: 32rpx;
  443. font-weight: 500;
  444. line-height: 44rpx;
  445. letter-spacing: 0.5%;
  446. text-align: left;
  447. display: flex;
  448. align-items: center;
  449. margin-bottom: 16rpx;
  450. }
  451. .usermain-item .required-mark {
  452. color: #FF3B30;
  453. font-size: 36rpx;
  454. font-weight: 600;
  455. margin-right: 8rpx;
  456. }
  457. .usermain-item .cu-form-group {
  458. background: transparent;
  459. text-align: left;
  460. padding: 0;
  461. }
  462. .usermain-item .cu-form-group input {
  463. width: 100%;
  464. height: 68rpx;
  465. font-size: 28rpx;
  466. border: 1rpx solid rgba(227, 231, 236, 1);
  467. border-radius: 44rpx;
  468. color: rgba(23, 23, 37, 1);
  469. padding: 0 32rpx;
  470. background: #ffffff;
  471. font-family: DM Sans;
  472. font-weight: 400;
  473. }
  474. .usermain-item .cu-form-group input::placeholder {
  475. color: rgba(155, 155, 155, 1);
  476. font-size: 28rpx;
  477. }
  478. /* 联系方式样式 */
  479. .contact-structure {
  480. border-bottom: none !important;
  481. }
  482. .contact-wrapper {
  483. display: flex;
  484. align-items: center;
  485. justify-content: space-between;
  486. padding: 0;
  487. margin-top: 8rpx;
  488. }
  489. .phone-display {
  490. color: rgba(23, 23, 37, 1);
  491. font-family: DM Sans;
  492. font-size: 28rpx;
  493. font-weight: 400;
  494. line-height: 40rpx;
  495. letter-spacing: 0.5%;
  496. }
  497. .modify-link {
  498. color: rgba(24, 144, 255, 1);
  499. font-family: DM Sans;
  500. font-size: 28rpx;
  501. font-weight: 400;
  502. line-height: 40rpx;
  503. letter-spacing: 0.5%;
  504. cursor: pointer;
  505. text-decoration: none;
  506. }
  507. .modify-link:active {
  508. opacity: 0.7;
  509. }
  510. /* 头像编辑图标样式 */
  511. .avatar-wrapper {
  512. position: relative;
  513. display: inline-block;
  514. }
  515. .edit-avatar-icon {
  516. position: absolute;
  517. bottom: 10rpx;
  518. right: 2rpx;
  519. width: 24rpx;
  520. height: 24rpx;
  521. // background: #fff;
  522. border-radius: 50%;
  523. display: flex;
  524. align-items: center;
  525. justify-content: center;
  526. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  527. }
  528. .avatar-button {
  529. position: relative;
  530. padding: 0;
  531. margin: 0;
  532. background: transparent;
  533. border: none;
  534. }
  535. .footer-btn {
  536. margin-top: 40rpx;
  537. padding-bottom: 40rpx;
  538. }
  539. .footer-btn .usermain-btn {
  540. color: rgba(255, 255, 255, 1);
  541. background: rgba(1, 107, 246, 1);
  542. text-align: center;
  543. width: 90%;
  544. height: 80rpx;
  545. font-size: 32rpx;
  546. line-height: 80rpx;
  547. margin: 20rpx auto;
  548. border-radius: 40rpx;
  549. }
  550. /* 选择器样式 - 参考workExperience页面 */
  551. .form-input-selector {
  552. width: 100%;
  553. height: 68rpx;
  554. padding: 0 40rpx;
  555. border: 1px solid rgba(227, 231, 236, 1);
  556. border-radius: 24px;
  557. background: rgba(255, 255, 255, 1);
  558. display: flex;
  559. align-items: center;
  560. justify-content: space-between;
  561. cursor: pointer;
  562. transition: all 0.2s ease;
  563. .placeholder {
  564. color: #999999;
  565. font-family: DM Sans;
  566. font-size: 28rpx;
  567. font-weight: 400;
  568. line-height: 40rpx;
  569. }
  570. text {
  571. color: rgba(23, 23, 37, 1);
  572. font-family: DM Sans;
  573. font-size: 28rpx;
  574. font-weight: 400;
  575. line-height: 40rpx;
  576. }
  577. }
  578. .arrow-down {
  579. color: rgba(96, 98, 102, 1);
  580. font-size: 24rpx;
  581. font-weight: 400;
  582. transform: scale(1.5);
  583. }
  584. .selector-group:active {
  585. background: #f5f7fa !important;
  586. transform: scale(0.99);
  587. }
  588. </style>