myFolder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template>
  2. <view class="content">
  3. <view class="top-fixed">
  4. <u-search bgColor="#F5F7FA" placeholder="请输入文件名称" v-model="keyword" :showAction="false"></u-search>
  5. </view>
  6. <view class="inner">
  7. <view class="align-center justify-between wrap">
  8. <view class="box" v-for="(item,index) in dataList" :key="index" @longpress="cancel(item)">
  9. <view class="img" @click="navgetTo(item)">
  10. <view class="num">{{item.size||0}}张</view>
  11. </view>
  12. <view class="text ellipsis">{{item.fileName}}</view>
  13. </view>
  14. <view class="box" @click="open()">
  15. <view class="add-img">
  16. <image src="/static/images/user/add_picture_icon24.png" class="w40 h40"></image>
  17. </view>
  18. <view class="text">添加文件夹</view>
  19. </view>
  20. <view class="box"></view>
  21. </view>
  22. <view class="popup-box" v-if="show">
  23. <view class="info-mask" @click="close()"></view>
  24. <view class="info-form">
  25. <view class="title">新建文件夹</view>
  26. <view class="form-box">
  27. <view class="form-item">
  28. <text class="label">文件夹名称</text>
  29. <input type="text" v-model="fileName" placeholder="请输入文件夹名称" class="form-input" />
  30. </view>
  31. </view>
  32. <view class="btns">
  33. <view class="sub-btn" @click="add()">确定</view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. addAttachment,
  43. getAttachment,deleteAttachment
  44. } from '@/api/companyUser.js'
  45. export default {
  46. data() {
  47. return {
  48. show: false,
  49. curDate: '',
  50. markDays: [],
  51. type: null,
  52. patientId: null,
  53. famaleurl: "/static/images/health/female_profile.png",
  54. maleurl: "/static/images/health/my_heads.png",
  55. checked: 1,
  56. dataList: [],
  57. form: {
  58. userName: null,
  59. idCard: null,
  60. sex: null,
  61. birthday: null,
  62. remark: null,
  63. },
  64. fileName: null
  65. };
  66. },
  67. onLoad(option) {
  68. this.getAttachment()
  69. uni.$on('refreshMyFolder', () => {
  70. this.getAttachment()
  71. })
  72. },
  73. methods: {
  74. //日历
  75. onDayClick(data) {
  76. this.curDate = data.date;
  77. },
  78. navgetTo(item) {
  79. uni.navigateTo({
  80. url: '/pages_user/user/default?id='+item.attachmentId+'&fileName='+item.fileName
  81. })
  82. },
  83. getAttachment() {
  84. let data = {
  85. parentId:0,
  86. pageNum: 1,
  87. pageSize: 100
  88. }
  89. getAttachment(data).then(
  90. res => {
  91. if (res.code == 200) {
  92. this.dataList = res.data.list
  93. } else {
  94. uni.showToast({
  95. icon: 'none',
  96. title: res.msg,
  97. });
  98. }
  99. },
  100. rej => {}
  101. );
  102. },
  103. open() {
  104. this.show = true
  105. this.fileName=null
  106. // console.log('close');
  107. },
  108. close() {
  109. this.show = false
  110. // console.log('close');
  111. },
  112. add() {
  113. let data = {
  114. // "parentId": 0,
  115. "type": 0, //文件类型 0:文件夹 1图片 2体检报告
  116. "fileName": this.fileName //文件名
  117. }
  118. addAttachment(data).then(
  119. res => {
  120. if (res.code == 200) {
  121. uni.showToast({
  122. icon: 'success',
  123. title: "操作成功",
  124. });
  125. this.show = false
  126. this.getAttachment()
  127. } else {
  128. uni.showToast({
  129. icon: 'none',
  130. title: res.msg,
  131. });
  132. }
  133. },
  134. rej => {}
  135. );
  136. },
  137. ed(v) {
  138. console.log(v)
  139. },
  140. cancel(item){
  141. var that=this
  142. uni.showModal({
  143. title: '提示',
  144. content: '确定删除文件吗',
  145. success: function (res) {
  146. if (res.confirm) {
  147. deleteAttachment(item.attachmentId).then(res => {
  148. if(res.code==200){
  149. uni.showToast({
  150. icon:'success',
  151. title: '删除成功!',
  152. });
  153. that.getAttachment()
  154. }else{
  155. uni.showToast({
  156. icon:'none',
  157. title: res.msg,
  158. });
  159. }
  160. });
  161. }
  162. else if (res.cancel) {
  163. }
  164. }
  165. });
  166. },
  167. onItemIconClick(index, item) {
  168. console.log(index, item)
  169. },
  170. // 出生日期选择
  171. bindDateChange: function(e) {
  172. this.form.birthday = e.target.value
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss">
  178. page {
  179. height: 100%;
  180. background: #fff;
  181. }
  182. .content {
  183. height: 100%;
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: space-between;
  187. .top-fixed {
  188. position: absolute;
  189. top: 0;
  190. background: #FFFFFF;
  191. padding: 20rpx;
  192. width: 100%;
  193. box-sizing: border-box;
  194. }
  195. .popup-box {
  196. position: fixed;
  197. top: 0;
  198. right: 0;
  199. left: 0;
  200. bottom: 0;
  201. z-index: 999;
  202. display: flex;
  203. justify-content: center;
  204. align-items: center;
  205. .info-mask {
  206. position: fixed;
  207. top: 0;
  208. right: 0;
  209. bottom: 0;
  210. left: 0;
  211. background-color: rgba($color: #000000, $alpha: 0.5);
  212. z-index: 999;
  213. }
  214. .info-form {
  215. z-index: 1000;
  216. width: 650rpx;
  217. display: flex;
  218. flex-direction: column;
  219. justify-content: center;
  220. align-items: center;
  221. padding: 0 30upx;
  222. background: #FFFFFF;
  223. border-radius: 16upx;
  224. .title {
  225. padding: 30rpx 0rpx 15rpx;
  226. display: flex;
  227. justify-content: center;
  228. align-items: center;
  229. font-size: 40upx;
  230. line-height: 44upx;
  231. font-family: PingFang SC;
  232. color: #222222;
  233. }
  234. .form-box {
  235. width: 100%;
  236. .form-item {
  237. padding: 30upx 0;
  238. display: flex;
  239. align-items: flex-start;
  240. border-bottom: 1px solid #F1F1F1;
  241. .label {
  242. width: 160upx;
  243. text-align: left;
  244. font-size: 30upx;
  245. line-height: 44upx;
  246. font-family: PingFang SC;
  247. font-weight: 500;
  248. color: #222222;
  249. flex-shrink: 0;
  250. }
  251. input {
  252. text-align: left;
  253. }
  254. .form-input {
  255. font-size: 34upx;
  256. font-family: PingFang SC;
  257. font-weight: 500;
  258. color: #222222;
  259. text-align: left;
  260. }
  261. }
  262. }
  263. .btns {
  264. width: 100%;
  265. height: 120upx;
  266. padding: 0 30upx;
  267. display: flex;
  268. align-items: center;
  269. justify-content: center;
  270. .sub-btn {
  271. width: 100%;
  272. height: 88upx;
  273. line-height: 88upx;
  274. text-align: center;
  275. font-size: 30upx;
  276. font-family: PingFang SC;
  277. font-weight: bold;
  278. color: #FFFFFF;
  279. background: #008FD3;
  280. border-radius: 44upx;
  281. }
  282. }
  283. }
  284. }
  285. .inner {
  286. // height: calc(100% - 120upx);
  287. padding: 20upx;
  288. padding-top: 130rpx;
  289. .box {
  290. width: 210rpx;
  291. display: flex;
  292. flex-direction: column;
  293. align-items: flex-start;
  294. margin-bottom: 20rpx;
  295. .img {
  296. width: 100%;
  297. height: 194rpx;
  298. background-image: url('/static/images/user/cpk_folder_bg.png');
  299. background-size: 100%;
  300. background-repeat: no-repeat;
  301. display: flex;
  302. align-items: center;
  303. justify-content: center;
  304. .num {
  305. width: 72rpx;
  306. height: 40rpx;
  307. background: #F29D0D;
  308. border-radius: 20rpx 20rpx 20rpx 20rpx;
  309. font-family: PingFang SC, PingFang SC;
  310. font-weight: 400;
  311. font-size: 24rpx;
  312. color: #FFFFFF;
  313. text-align: center;
  314. line-height: 40rpx;
  315. }
  316. }
  317. .add-img {
  318. width: 210rpx;
  319. height: 188rpx;
  320. display: flex;
  321. align-items: center;
  322. justify-content: center;
  323. background: #F5F7FA;
  324. border-radius: 16rpx 16rpx 16rpx 16rpx;
  325. }
  326. .text {
  327. margin-top: 20rpx;
  328. font-family: PingFang SC, PingFang SC;
  329. font-weight: 500;
  330. font-size: 28rpx;
  331. color: #222426;
  332. text-align: left;
  333. display: block;
  334. }
  335. }
  336. .title-box {
  337. font-family: PingFang SC, PingFang SC;
  338. font-weight: 400;
  339. font-size: 24rpx;
  340. color: #898E91;
  341. text-align: left;
  342. padding: 24rpx 0;
  343. .select-box {
  344. display: flex;
  345. align-items: center;
  346. justify-content: center;
  347. text {
  348. font-family: PingFang SC;
  349. font-weight: 400;
  350. font-size: 24rpx;
  351. color: #626468;
  352. margin-left: 8rpx;
  353. }
  354. }
  355. .select-box2 {
  356. width: 216rpx;
  357. height: 64rpx;
  358. background: #FFFFFF;
  359. border-radius: 32rpx 32rpx 32rpx 32rpx;
  360. display: flex;
  361. align-items: center;
  362. justify-content: center;
  363. text {
  364. font-family: PingFang SC;
  365. font-weight: 400;
  366. font-size: 24rpx;
  367. color: #626468;
  368. margin-left: 5rpx;
  369. }
  370. }
  371. }
  372. .form-box {
  373. // padding: 0 30upx;
  374. background: #FFFFFF;
  375. border-radius: 16upx;
  376. overflow: hidden;
  377. // margin-bottom: 20upx;
  378. .form-title {
  379. font-family: PingFang SC;
  380. font-weight: 500;
  381. font-size: 32rpx;
  382. color: #626468;
  383. text-align: left;
  384. padding: 30rpx 0;
  385. display: block;
  386. }
  387. .form-item {
  388. padding: 30upx 0;
  389. display: flex;
  390. align-items: center;
  391. justify-content: space-between;
  392. border-bottom: 1px solid #F1F1F1;
  393. &:last-child {
  394. border-bottom: none;
  395. }
  396. .left {
  397. display: flex;
  398. flex-direction: column;
  399. align-items: flex-start;
  400. .time {
  401. font-family: PingFang SC;
  402. font-weight: 400;
  403. font-size: 28rpx;
  404. color: #898E91;
  405. text-align: left;
  406. }
  407. }
  408. .check {
  409. display: flex;
  410. align-items: center;
  411. justify-content: center;
  412. text {
  413. // font-family: PingFang SC;
  414. font-weight: 400;
  415. font-size: 24rpx;
  416. color: #008FD3;
  417. margin-left: 16rpx;
  418. }
  419. }
  420. .label {
  421. // width: 150upx;
  422. text-align: left;
  423. font-weight: 500;
  424. font-size: 32rpx;
  425. color: #222426;
  426. text-align: left;
  427. }
  428. .num {
  429. font-family: PingFang SC;
  430. font-weight: 400;
  431. font-size: 32rpx;
  432. color: #222426;
  433. line-height: 34rpx;
  434. display: flex;
  435. align-items: center;
  436. }
  437. }
  438. }
  439. }
  440. .sub-btn {
  441. // flex: 1;
  442. // width: 100%;
  443. height: 88upx;
  444. line-height: 88upx;
  445. text-align: center;
  446. font-size: 32upx;
  447. font-family: PingFang SC;
  448. font-weight: bold;
  449. color: #FFFFFF;
  450. background: #008FD3;
  451. border-radius: 44upx;
  452. display: flex;
  453. align-items: center;
  454. border: 2rpx solid #008FD3;
  455. justify-content: center;
  456. }
  457. .btn-box2 {
  458. z-index: 9999;
  459. width: 100%;
  460. padding: 30upx;
  461. position: fixed;
  462. bottom: 0;
  463. left: 0;
  464. box-sizing: border-box;
  465. background: #FFFFFF;
  466. display: flex;
  467. align-items: center;
  468. justify-content: space-between;
  469. padding-bottom: 40rpx;
  470. .sub-btn2 {
  471. flex: auto;
  472. height: 88upx;
  473. line-height: 88upx;
  474. display: flex;
  475. align-items: center;
  476. justify-content: center;
  477. text-align: center;
  478. font-size: 32rpx;
  479. color: #fff;
  480. font-family: PingFang SC;
  481. font-weight: bold;
  482. background: #FF5030;
  483. border-radius: 44rpx 44rpx 44rpx 44rpx;
  484. margin-right: 20rpx;
  485. image {
  486. margin-right: 16rpx;
  487. }
  488. }
  489. }
  490. }
  491. </style>