woDe.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. <template>
  2. <view class="box">
  3. <u-navbar :autoBack="true" title="我的守护" bgColor="rgba(255,255,255,0)" :placeholder="true" titleStyle="font-weight:bold;color:#000000"></u-navbar>
  4. <!-- <view class="map_tit" style="margin-left: 90rpx">
  5. <image style="width: 211rpx; height: 52rpx" src="/static/img/right_img.png"></image>
  6. <view class="">文物守护</view>
  7. <image style="width: 211rpx; height: 52rpx" src="/static/img/left_img.png"></image>
  8. </view> -->
  9. <view style="width: 90%; margin: auto; display: flex; justify-content: space-between">
  10. <view @click="myTeam" class="td_box">我的团队</view>
  11. <view @click="deleteShow = true" class="td_box">退出组织</view>
  12. </view>
  13. <view class="map_tit" style="margin-left: 90rpx">
  14. <image style="width: 211rpx; height: 52rpx" src="/static/img/right_img.png"></image>
  15. <view class="">守护记录</view>
  16. <image style="width: 211rpx; height: 52rpx" src="/static/img/left_img.png"></image>
  17. </view>
  18. <view class="dc_box">
  19. <view style="display: flex; align-items: center">
  20. <view style="width: 16rpx; height: 60rpx; background-color: #e9ccaf"></view>
  21. <view style="margin-left: 10rpx; font-size: 32rpx; font-weight: 700">个人巡查记录</view>
  22. </view>
  23. <view @click="exportPatrolRecord" class="dc">
  24. <uni-icons type="cloud-download" size="20" color="#934b36"></uni-icons>
  25. <view class="tit">导出记录</view>
  26. </view>
  27. </view>
  28. <view class="ranking_menu">
  29. <view @click="rankingTab(index)" class="ranking_item" :class="{ active2: menuTab == index }" v-for="(item, index) in rankingList" :key="item.index">
  30. <view class="tab_tit">
  31. {{ item.title }}
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 时间-->
  36. <view class="tab_box">
  37. <view @click="tabBtn(index)" class="tab_item" v-for="(item, index) in recordTab" :key="item.index" :class="{ active: index === tab }">
  38. <view class="tab_tit">
  39. {{ item.title }}
  40. </view>
  41. </view>
  42. </view>
  43. <view class="jl_box">
  44. <view class="tit_box">
  45. <view class="">文物点</view>
  46. <view>巡查时间</view>
  47. <!-- <view class="">巡查结果</view> -->
  48. <view class="">任务状态</view>
  49. <view class="">操作</view>
  50. </view>
  51. <scroll-view v-if="recordList.length > 0" style="height: 600rpx" scroll-y="true" @scrolltolower="LoadMore">
  52. <view @click="checkBtn(item)" class="jl_item" v-for="item in recordList" :key="item.id">
  53. <view style="width: 120rpx; overflow-x: auto; white-space: nowrap">
  54. {{ item.cr_title }}
  55. </view>
  56. <view style="width: 180rpx">
  57. {{ item.progress == 3 ? item.submit_time : item.progress == 2 ? item.submit_time : item.progress == -1 ? item.submit_time : '' }}
  58. </view>
  59. <view style="">
  60. {{ item.progress_text }}
  61. </view>
  62. <view>查看</view>
  63. </view>
  64. </scroll-view>
  65. <view v-else>
  66. <u-empty text="暂无数据" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
  67. </view>
  68. </view>
  69. <u-popup bgColor="#f2c8a2" :show="deleteShow" @close="close" mode="center" customStyle="width:600rpx;padding: 30rpx;" round="20rpx">
  70. <view style="text-align: center; font-size: 30rpx">确认退出志愿者组织吗?</view>
  71. <view style="margin-top: 20rpx">
  72. <u--textarea height="50" v-model.trim="reasonVal" placeholder="请填写退出原因:"></u--textarea>
  73. </view>
  74. <view class="bt_box">
  75. <view
  76. class="bt1"
  77. @click="
  78. deleteShow = false;
  79. reasonVal = '';
  80. "
  81. >
  82. 取消
  83. </view>
  84. <view @click="isOk" class="bt2">确认</view>
  85. </view>
  86. </u-popup>
  87. <!-- 日历 -->
  88. <uv-calendars ref="calendars" mode="range" lunar @confirm="confirmOk" />
  89. <!-- 导出弹层 -->
  90. <u-popup bgColor="#f2c8a2" closeable :show="exportShow" @close="close" mode="center" customStyle="width:600rpx;padding: 40rpx " round="20rpx">
  91. <view style="text-align: center; font-size: 26rpx; color: #8a8a8a">点击下方链接复制到浏览器进行下载</view>
  92. <view style="text-align: center; font-size: 26rpx; color: #8a8a8a">链接有效期为三分钟</view>
  93. <view @click="copyText" style="margin-top: 20rpx; word-break: break-all; color: #315efb">
  94. {{ expor }}
  95. </view>
  96. </u-popup>
  97. </view>
  98. </template>
  99. <script>
  100. let that;
  101. export default {
  102. data() {
  103. return {
  104. expor: '' /* 下载链接 */,
  105. exportShow: false,
  106. progressId: '' /* 任务状态id */,
  107. menuTab: 0,
  108. volunteer_id: '' /* 志愿者id */,
  109. reasonVal: '',
  110. deleteShow: false /* 弹层 */,
  111. pageSize: 30,
  112. isLoading: false,
  113. page: 1,
  114. tab: -1,
  115. time: '',
  116. result: '' /* 自定义时间 */,
  117. rankingList: [
  118. {
  119. title: '全部',
  120. id: 'all'
  121. },
  122. {
  123. title: '待巡查',
  124. id: '0'
  125. },
  126. {
  127. title: '待审核',
  128. id: 2
  129. },
  130. {
  131. title: '已通过',
  132. id: 3
  133. },
  134. {
  135. title: '驳回',
  136. id: -1
  137. },
  138. {
  139. title: '已过期',
  140. id: -2
  141. }
  142. ],
  143. recordTab: [
  144. {
  145. title: '今天',
  146. time: 'today'
  147. },
  148. {
  149. title: '本周',
  150. time: 'week'
  151. },
  152. {
  153. title: '上周',
  154. time: 'last week'
  155. },
  156. {
  157. title: '本月',
  158. time: 'month'
  159. },
  160. {
  161. title: '上月',
  162. time: 'last month'
  163. },
  164. {
  165. title: '今年',
  166. time: 'year'
  167. },
  168. {
  169. title: '去年',
  170. time: 'last year'
  171. },
  172. {
  173. title: '自定义',
  174. time: ''
  175. }
  176. ],
  177. recordList: []
  178. };
  179. },
  180. onShow() {
  181. // this.menuTab = 0;
  182. // this.recordList = [];
  183. },
  184. onLoad() {
  185. that = this;
  186. this.details();
  187. this.loadGlobalFont();
  188. },
  189. methods: {
  190. // 志愿者详情判断是否为志愿者
  191. details() {
  192. this.$api.details({ main_body_id: 1 }, function (res) {
  193. if (res.code == 1) {
  194. // console.log(res);
  195. if (res.data != false && res.data.id != undefined) {
  196. that.volunteer_id = res.data.id;
  197. that.getPatrolTask();
  198. }
  199. }
  200. });
  201. },
  202. isOk() {
  203. if (this.reasonVal != undefined && this.reasonVal != '') {
  204. this.$api.logOffVolunteer(
  205. {
  206. main_body_id: 1,
  207. volunteer_id: this.volunteer_id,
  208. logout_desc: this.reasonVal
  209. },
  210. function (res) {
  211. if (res.code === 1) {
  212. that.$common.errorToShow('提交成功,正在审核中');
  213. that.deleteShow = false;
  214. // console.log(res);
  215. } else {
  216. that.$common.errorToShow(res.msg);
  217. that.deleteShow = false;
  218. }
  219. }
  220. );
  221. } else {
  222. that.$common.errorToShow('请填写退出原因');
  223. }
  224. },
  225. // 任务列表
  226. getPatrolTask(id) {
  227. this.isLoading = true;
  228. this.$api.getPatrolTask(
  229. {
  230. custom_time: this.result || '',
  231. created_at: this.time,
  232. main_body_id: 1,
  233. page: this.page,
  234. pageSize: this.pageSize,
  235. progress: id ? id : 'all',
  236. volunteer_id: this.volunteer_id
  237. },
  238. function (res) {
  239. if (res.code === 1) {
  240. that.isLoading = false;
  241. that.recordList = [...that.recordList, ...res.data];
  242. // console.log(that.recordList, '任务');
  243. } else {
  244. }
  245. }
  246. );
  247. },
  248. // 导出
  249. exportPatrolRecord() {
  250. this.$api.exportPatrolRecord(
  251. {
  252. main_body_id: 1,
  253. volunteer_id: this.volunteer_id,
  254. progress: this.progressId,
  255. created_at: this.time,
  256. custom_time: this.result || '',
  257. page: this.page,
  258. pageSize: this.pageSize
  259. },
  260. function (res) {
  261. if (res.code == 1) {
  262. console.log(res, '任务');
  263. that.expor = res.data;
  264. that.exportShow = true;
  265. } else {
  266. that.$common.errorToShow(res.msg);
  267. }
  268. }
  269. );
  270. },
  271. // 复制链接
  272. copyText() {
  273. uni.setClipboardData({
  274. data: this.expor,
  275. success: function () {
  276. uni.showToast({
  277. title: '复制成功',
  278. icon: 'success',
  279. duration: 2000
  280. });
  281. },
  282. fail: (err) => {
  283. uni.showToast({
  284. title: '复制失败',
  285. icon: 'none',
  286. duration: 2000
  287. });
  288. }
  289. });
  290. },
  291. LoadMore() {
  292. if (this.isLoading) {
  293. return;
  294. } else {
  295. this.page++;
  296. this.getPatrolTask(this.progressId);
  297. }
  298. },
  299. // 任务详情
  300. checkBtn(item) {
  301. if (item.progress == 0) {
  302. uni.navigateTo({
  303. url: '/shouhu_fenbao/xunCha/xunCha?id=' + item.id
  304. });
  305. } else {
  306. uni.navigateTo({
  307. url: '/user_fenbao/houTai/taskDEetailsPage?id=' + item.id
  308. });
  309. }
  310. },
  311. myTeam() {
  312. uni.navigateTo({
  313. url: '/shouhu_fenbao/shouHu/tuanDui?id=' + this.volunteer_id
  314. });
  315. },
  316. // 时间tab
  317. tabBtn(i) {
  318. this.page = 1;
  319. if (this.tab === i) {
  320. this.tab = -1;
  321. this.time = '';
  322. return;
  323. }
  324. this.tab = i;
  325. this.recordList = [];
  326. this.time = this.recordTab[i].time;
  327. if (this.recordTab[i].title != '自定义') {
  328. this.result = '';
  329. this.getPatrolTask(this.progressId);
  330. }
  331. if (this.recordTab[i].title == '自定义') {
  332. this.$refs.calendars.open();
  333. }
  334. },
  335. // tab
  336. rankingTab(i) {
  337. this.page = 1;
  338. this.recordList = [];
  339. this.menuTab = i;
  340. this.progressId = this.rankingList[i].id;
  341. if (this.rankingList[i].title == '全部') {
  342. this.time = '';
  343. this.tab = -1;
  344. this.getPatrolTask(this.rankingList[i].id);
  345. } else {
  346. this.getPatrolTask(this.rankingList[i].id);
  347. }
  348. },
  349. confirmOk(e) {
  350. console.log(e);
  351. this.page = 1;
  352. this.result = `${e.range.before} - ${e.range.after}`;
  353. // console.log(this.result, '自定义');
  354. this.recordList = [];
  355. this.getPatrolTask(this.progressId);
  356. },
  357. close() {
  358. this.reasonVal = '';
  359. this.deleteShow = false;
  360. this.exportShow = false;
  361. },
  362. // 加载字体
  363. loadGlobalFont() {
  364. try {
  365. uni.loadFontFace({
  366. family: 'MyGlobalFont', // 自定义字体名
  367. source: 'url("https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/songTi.ttf")',
  368. success() {
  369. console.log('全局字体加载成功');
  370. }
  371. });
  372. } catch (error) {
  373. console.error('全局字体加载异常', error);
  374. }
  375. }
  376. }
  377. };
  378. </script>
  379. <style>
  380. .box {
  381. height: auto;
  382. width: 100%;
  383. padding-bottom: 50rpx;
  384. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xy_bgt.png');
  385. background-repeat: repeat-y;
  386. background-size: cover;
  387. background-size: 100% 100%;
  388. font-family: 'MyGlobalFont';
  389. }
  390. /deep/.u-textarea.data-v-09988a29 {
  391. background-color: #fce3c4 !important;
  392. border-radius: 0;
  393. }
  394. /deep/.u-textarea.data-v-09988a29 {
  395. background-color: #fce3c4 !important;
  396. }
  397. .uv-toolbar__wrapper__confirm.data-v-58504ea1 {
  398. color: #3c9cff !important;
  399. }
  400. .active {
  401. background-image: url('/static/img/sj_tit.png') !important;
  402. background-size: 100% 100%;
  403. }
  404. .map_tit {
  405. display: flex;
  406. align-items: center;
  407. margin-left: 60rpx;
  408. margin-top: 40rpx;
  409. font-size: 40rpx;
  410. font-family: 'MyGlobalFont';
  411. font-weight: 900;
  412. line-height: 52rpx;
  413. color: #444444;
  414. }
  415. .dc_box {
  416. width: 90%;
  417. margin: auto;
  418. margin-top: 20rpx;
  419. display: flex;
  420. justify-content: space-between;
  421. align-items: center;
  422. }
  423. .dc {
  424. padding: 10rpx;
  425. display: flex;
  426. align-items: center;
  427. height: 50rpx;
  428. background-color: #ead2b2;
  429. }
  430. .tit {
  431. font-weight: 700;
  432. font-size: 32rpx;
  433. line-height: 50rpx;
  434. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  435. -webkit-background-clip: text;
  436. -webkit-text-fill-color: transparent;
  437. text-align: center;
  438. }
  439. .tab_box {
  440. width: 94%;
  441. margin: auto;
  442. margin-top: 40rpx;
  443. align-items: center;
  444. display: flex;
  445. justify-content: space-between;
  446. }
  447. .tab_item {
  448. width: 125rpx;
  449. height: 62rpx;
  450. background-image: url('/static/img/sj_tit2.png');
  451. background-size: 100% 100%;
  452. }
  453. .tab_tit {
  454. font-weight: 700;
  455. font-size: 28rpx;
  456. line-height: 62rpx;
  457. color: #95543f;
  458. text-align: center;
  459. }
  460. .jl_box {
  461. width: 92%;
  462. height: 774rpx;
  463. margin: auto;
  464. margin-top: 40rpx;
  465. padding: 60rpx;
  466. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/jl_bg_bg.png');
  467. background-size: 100% 100%;
  468. }
  469. .tit_box {
  470. width: 585rpx;
  471. display: flex;
  472. font-weight: 700;
  473. font-size: 28rpx;
  474. justify-content: space-between;
  475. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  476. -webkit-background-clip: text;
  477. -webkit-text-fill-color: transparent;
  478. }
  479. .jl_item {
  480. display: flex;
  481. align-items: center;
  482. justify-content: space-between;
  483. margin-top: 40rpx;
  484. font-size: 30rpx;
  485. padding: 0 10rpx 0 10rpx;
  486. background-color: #e4c3a6;
  487. }
  488. .td_box {
  489. width: 188rpx;
  490. height: 102rpx;
  491. line-height: 102rpx;
  492. font-weight: 600;
  493. margin-top: 40rpx;
  494. text-align: center;
  495. font-size: 30rpx;
  496. background-image: url('/static/img/rl_bg.png');
  497. background-size: 100% 100%;
  498. }
  499. .bt_box {
  500. display: flex;
  501. margin-top: 50rpx;
  502. justify-content: space-around;
  503. }
  504. .bt1 {
  505. width: 244rpx;
  506. height: 78rpx;
  507. border: 1px solid #312520;
  508. border-radius: 39rpx;
  509. text-align: center;
  510. line-height: 78rpx;
  511. color: black;
  512. }
  513. .bt2 {
  514. width: 244rpx;
  515. height: 78rpx;
  516. background: #ca5642;
  517. border-radius: 39rpx;
  518. text-align: center;
  519. line-height: 78rpx;
  520. color: #ffffff;
  521. }
  522. .ranking_menu {
  523. width: 90%;
  524. margin: auto;
  525. margin-top: 50rpx;
  526. display: flex;
  527. justify-content: space-between;
  528. font-size: 28rpx;
  529. color: rgba(68, 68, 68, 0.6);
  530. text-align: center;
  531. line-height: 60rpx;
  532. }
  533. .ranking_item {
  534. width: 260rpx;
  535. height: 62rpx;
  536. }
  537. .active2 {
  538. background-image: url('/static/img/gr_tab.png');
  539. background-size: 100% 100%;
  540. }
  541. </style>