task.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. <template>
  2. <view class="content">
  3. <view id="header">
  4. <view :class="isFinish?'':'select'" @click="change('unfinish')">未完成</view>
  5. <view :class="!isFinish?'':'select'" @click="change('finish')">已完成</view>
  6. </view>
  7. <scroll-view scroll-y :style="{height:s_height+'px'}" @scrolltolower="getMore">
  8. <view class="item" v-for="item in tasks">
  9. <view class="image" @click="finish(item)">
  10. <image :src="item.endDate?'../../static/images/finish.png':'../../static/images/unfinish.png'"
  11. mode="widthFix"></image>
  12. </view>
  13. <view class="taskdetail" :style="{width:t_width+'px'}" @click="detail(item)">
  14. <text style="margin-right: 10px; ">{{item.name}}</text>
  15. </view>
  16. <view v-if="type!=='assigned'" class="image" @click="important(item)">
  17. <image mode="widthFix"
  18. :src="item.important?'../../static/images/zhongyao.png':'../../static/images/buzhongyao.png'">
  19. </image>
  20. </view>
  21. </view>
  22. </scroll-view>
  23. <view id="bottom">
  24. <button class="btnSuggest" type="primary" v-if="type==='today'" @click="()=>{leftPop=true}">建议</button>
  25. <button class="btnAdd" type='primary' v-if="type!=='assigned'" @click="()=>{addPop=true}">+</button>
  26. </view>
  27. <u-popup :show="leftPop" mode="left" :closeable="true" @open="leftOpen()" @close="leftClose"
  28. :closeOnClickOverlay="false">
  29. <view solt class="leftPop">
  30. <scroll-view scroll-y="true" :style="{height:s_height+'px'}" @scrolltolower="getSuggest()">
  31. <view v-for="item in personTasks">
  32. <u-cell :title="item.name">
  33. <u-icon slot="right-icon" name="plus" @click="addToday(item)"></u-icon>
  34. </u-cell>
  35. </view>
  36. </scroll-view>
  37. </view>
  38. </u-popup>
  39. <u-popup :show="addPop" mode="bottom" :closeOnClickOverlay="false">
  40. <view class="addPop">
  41. <u--input placeholder="请输入任务名称" v-model="taskName" style="margin-top: 50px;"></u--input>
  42. <view style="display: flex;">
  43. <u-button type="error" @click="()=>{addPop=false}">关闭</u-button>
  44. <u-button type="primary" @click="addTask">新增</u-button>
  45. </view>
  46. </view>
  47. </u-popup>
  48. <u-popup :show="personDetail" mode="bottom" @open="personOpen" @close="personClose" :closeable="true">
  49. <view class="detail">
  50. <scroll-view scroll-y="true" :style="{height:s_height+'px'}">
  51. <uni-group title="任务名称">
  52. <u-row customStyle="height:100rpx">
  53. <u-col span="1">
  54. <view class="image" @click="finish(currTask)">
  55. <image
  56. :src="currTask.endDate?'../../static/images/finish.png':'../../static/images/unfinish.png'"
  57. mode="widthFix"></image>
  58. </view>
  59. </u-col>
  60. <u-col span="9">
  61. <u--input @change="saveTask" border="surround" style="margin-right: 10px; "
  62. v-model="currTask.name"></u--input>
  63. </u-col>
  64. <u-col span="1">
  65. <view class="image" @click="important(currTask)">
  66. <image mode="widthFix"
  67. :src="currTask.important?'../../static/images/zhongyao.png':'../../static/images/buzhongyao.png'">
  68. </image>
  69. </view>
  70. </u-col>
  71. <u-col span="1">
  72. <u-icon size="26px" name="trash" color="red" @click="deleteTask"></u-icon>
  73. </u-col>
  74. </u-row>
  75. <u-row customStyle="height:70rpx">
  76. <u-col span="1">
  77. <view class="image">
  78. <u-icon name="heart-fill" size="26px" :color="currTask.todayId?'red':'blue'">
  79. </u-icon>
  80. </view>
  81. </u-col>
  82. <u-col span="10">
  83. <u-text margin="0px 0px 0px 20px"
  84. :text="currTask.todayId==null?'添加到“今日任务”':'已添加到“今日任务”'"
  85. :color="currTask.todayId?'red':'blue'" @click="addToday(currTask)"></u-text>
  86. </u-col>
  87. <u-col span="1">
  88. <u-icon v-if="currTask.todayId" size="26px" name="trash" color="red"
  89. @click="deleteToday"></u-icon>
  90. </u-col>
  91. </u-row>
  92. </uni-group>
  93. <uni-group title="任务步骤">
  94. <view v-for="step in taskSteps">
  95. <u-row customStyle="border-bottom:1rpx solid lightgrey;height:80rpx">
  96. <u-col span="1">
  97. <image style="width: 26px;"
  98. :src="step.endTime?'../../static/images/finish.png':'../../static/images/unfinish.png'"
  99. mode="widthFix" @click="finishStep(step)"></image>
  100. </u-col>
  101. <u-col span="10">
  102. <u-text :decoration="step.endTime?'line-through':'none'" :text="step.name">
  103. </u-text>
  104. </u-col>
  105. <u-col span="1" align="center" textAlign="right">
  106. <u-icon name="trash" color="red" size="26px" @click="deleteStep(step)"></u-icon>
  107. </u-col>
  108. </u-row>
  109. </view>
  110. <u-input placeholder="请输入步骤名称" border="bottom" v-model="stepName">
  111. <template slot="suffix">
  112. <u-icon name="plus" color="blue" size="26px" @click="addStep"></u-icon>
  113. </template>
  114. </u-input>
  115. </uni-group>
  116. <uni-group title="任务详情">
  117. <u-textarea placeholder="请输入任务详情" v-model="currTask.content" @input="saveTask"></u-textarea>
  118. </uni-group>
  119. <uni-group title="日期安排">
  120. <u-input placeholder="请选择计划日期" v-model="taskDate" disabled>
  121. <template slot="suffix">
  122. <u-icon name="calendar" size="26px" color="blue" @click="()=>{calendar=true}"></u-icon>
  123. </template>
  124. </u-input>
  125. <u-calendar :show="calendar" mode="multiple" maxCount="2" @confirm="dateConfirm"
  126. :defaultDate="defaultDate" monthNum="13" :minDate="minDate" @close="()=>{calendar=false}">
  127. </u-calendar>
  128. </uni-group>
  129. <uni-group title="工时">
  130. <u-input type="number" placeholder="请输入工时" border="bottom" v-model="currTask.manhours"
  131. @change="saveTask"></u-input>
  132. </uni-group>
  133. <uni-group title="附加文件">
  134. <u-text text="上传文件" prefixIcon="attach" @click="fileOpen" margin="0rpx 0rpx 30rpx 0rpx">
  135. </u-text>
  136. <u-row v-for="item in fileList" customStyle="margin-top:5px">
  137. <u-col span="11">
  138. <u-text :text="item.fileOriginName" color="blue" @click="downFile(item)"></u-text>
  139. </u-col>
  140. <u-col span="1">
  141. <u-icon name="trash" color="red" size="26px" @click="deleteFile(item)"></u-icon>
  142. </u-col>
  143. </u-row>
  144. </uni-group>
  145. <u-button text="确定" type="primary" @click="personClose"></u-button>
  146. <u-popup :show="fileType" mode="bottom" @close="fileClose">
  147. <view
  148. style="height: 200px;width:100%;display: flex;flex-direction: column; align-items: center;">
  149. <u-text text="上传图片" color="blue" size="30" @click="uploadImage"></u-text>
  150. <u-text text="上传文件" color="blue" size="30" @click="uploadFile"></u-text>
  151. </view>
  152. </u-popup>
  153. </scroll-view>
  154. </view>
  155. </u-popup>
  156. </view>
  157. </template>
  158. <script>
  159. import taskManage from '../../api/taskManage.js'
  160. import env from '../../utils/js/env.js'
  161. import {
  162. debounce
  163. } from 'lodash'
  164. export default {
  165. data() {
  166. return {
  167. type: "",
  168. isFinish: false,
  169. pageNo: 1,
  170. pageSize: 20,
  171. s_height: 0,
  172. t_width: 0,
  173. tasks: [],
  174. currTask: {},
  175. leftPop: false,
  176. personTasks: [],
  177. addPop: false,
  178. taskName: "",
  179. sugPgNo: 1,
  180. personDetail: false,
  181. assignedDetail: false,
  182. taskSteps: [],
  183. stepName: "",
  184. taskDate: "",
  185. calendar: false,
  186. minDate: "",
  187. defaultDate: [],
  188. saveTask: {},
  189. fileList: [],
  190. fileType: false,
  191. }
  192. },
  193. onLoad(options) {
  194. this.type = options.type;
  195. this.setTitle(this.type);
  196. this.getDate();
  197. },
  198. onReady() {
  199. let that = this
  200. uni.getSystemInfo({
  201. success(res) {
  202. that.t_width = res.windowWidth - 82;
  203. const w_height = res.windowHeight;
  204. var query = uni.createSelectorQuery();
  205. query.select('#header').boundingClientRect();
  206. query.select('#bottom').boundingClientRect();
  207. query.exec(function(res) {
  208. that.s_height = w_height - res[0].height - res[1].height;
  209. })
  210. }
  211. })
  212. },
  213. created() {
  214. let _this = this
  215. this.saveTask = debounce(function() {
  216. taskManage.taskEdit(_this.currTask)
  217. }, 2000)
  218. },
  219. methods: {
  220. setTitle(type) {
  221. let titleText = ""
  222. switch (type) {
  223. case "today": {
  224. titleText = "今日任务";
  225. break;
  226. }
  227. case "important": {
  228. titleText = "重要任务";
  229. break;
  230. }
  231. case "plan": {
  232. titleText = "计划内";
  233. break;
  234. }
  235. // case "assigned": {
  236. // titleText = "已分配给我";
  237. // break;
  238. // }
  239. case "task": {
  240. titleText = "任务";
  241. break;
  242. }
  243. default: {
  244. titleText = "其他任务";
  245. }
  246. }
  247. uni.setNavigationBarTitle({
  248. title: titleText
  249. })
  250. },
  251. change(e) {
  252. if (e === 'unfinish' && !this.isFinish) {
  253. return;
  254. }
  255. if (e === 'finish' && this.isFinish) {
  256. return;
  257. }
  258. this.pageNo = 1;
  259. this.isFinish = !this.isFinish;
  260. this.getDate();
  261. },
  262. getDate() {
  263. let data = {
  264. taskType: this.type,
  265. isFinish: this.isFinish,
  266. pageNo: this.pageNo,
  267. pageSize: this.pageSize
  268. }
  269. taskManage.getTask(data).then(res => {
  270. if (res.data.success) {
  271. this.tasks = res.data.data.records;
  272. }
  273. })
  274. },
  275. getMore() {
  276. let data = {
  277. taskType: this.type,
  278. isFinish: this.isFinish,
  279. pageNo: this.pageNo + 1,
  280. pageSize: this.pageSize
  281. }
  282. taskManage.getTask(data).then(res => {
  283. if (res.data.success) {
  284. if (res.data.data.records.length == 0) {
  285. uni.showToast({
  286. title: "没有更多的数据~~",
  287. mask: true,
  288. icon: 'none',
  289. position: "bottom"
  290. })
  291. return;
  292. }
  293. this.pageNo += 1;
  294. this.tasks = this.tasks.concat(res.data.data.records);
  295. }
  296. })
  297. },
  298. finish(task) {
  299. let _this = this;
  300. let data = null;
  301. // if (this.type === "assigned") {
  302. // data = {
  303. // projectTaskId: task.id,
  304. // taskId: task.personTaskId,
  305. // }
  306. // } else {
  307. data = {
  308. taskId: task.id,
  309. projectTaskId: task.projectTaskId,
  310. }
  311. // }
  312. if (this.isFinish) {
  313. taskManage.taskUnFinish(data).then(res => {
  314. if (res.data.success) {
  315. _this.removeItem(_this.tasks, task)
  316. }
  317. })
  318. } else {
  319. taskManage.taskFinish(data).then(res => {
  320. if (res.data.success) {
  321. _this.removeItem(_this.tasks, task)
  322. }
  323. })
  324. }
  325. this.currTask = {};
  326. this.personDetail = false;
  327. this.assignedDetail = false;
  328. },
  329. important(task) {
  330. let data = {
  331. id: task.id,
  332. important: !task.important,
  333. }
  334. taskManage.changeImportant(data).then((res) => {
  335. if (res.data.success) {
  336. task.important = !task.important
  337. if (this.type === "important" && !task.important) {
  338. this.removeItem(this.tasks, task);
  339. }
  340. }
  341. })
  342. },
  343. detail(item) {
  344. this.currTask = item;
  345. if (this.type === "assigned") {
  346. this.assignedDetail = true;
  347. } else {
  348. this.personDetail = true;
  349. }
  350. },
  351. leftOpen() {
  352. let data = {
  353. pageNo: this.sugPgNo,
  354. pageSize: 30,
  355. }
  356. taskManage.getSuggest(data).then(res => {
  357. if (res.data.success) {
  358. this.personTasks = res.data.data.records;
  359. }
  360. })
  361. },
  362. getSuggest() {
  363. let data = {
  364. pageNo: this.sugPgNo + 1,
  365. pageSize: 30,
  366. }
  367. taskManage.getSuggest(data).then(res => {
  368. if (res.data.success) {
  369. if (res.data.data.records.length === 0) {
  370. uni.showToast({
  371. title: "没有更多数据",
  372. mask: true,
  373. icon: "none"
  374. });
  375. return;
  376. }
  377. this.personTasks = this.personTasks.concat(res.data.data.records);
  378. this.sugPgNo += 1;
  379. }
  380. })
  381. },
  382. leftClose() {
  383. this.currTask = {};
  384. this.sugPgNo = 1;
  385. this.leftPop = false;
  386. },
  387. addToday(task) {
  388. let data = {
  389. taskId: task.id,
  390. sort: 100,
  391. }
  392. taskManage.addToday(data).then((res) => {
  393. if (res.data.success) {
  394. this.removeItem(this.personTasks, task)
  395. task.todayId = res.data.data
  396. if (!this.isFinish && this.leftPop) {
  397. this.tasks.unshift(task)
  398. }
  399. }
  400. })
  401. },
  402. addClose() {
  403. this.currTask = {};
  404. this.addPop = false;
  405. },
  406. addTask() {
  407. if (this.taskName.trim() === "") {
  408. uni.showToast({
  409. title: "请输入任务名称",
  410. mask: true,
  411. icon: "none"
  412. });
  413. return;
  414. }
  415. //今日任务添加任务,同时添加到今日任务
  416. if (this.type === "today") {
  417. let data = {
  418. name: this.taskName,
  419. important: false,
  420. sort: 100,
  421. }
  422. taskManage.addTodayTask(data).then((res) => {
  423. if (res.data.success) {
  424. if (!this.isFinish) {
  425. this.tasks.unshift(res.data.data)
  426. }
  427. this.taskName = ''
  428. }
  429. })
  430. } else {
  431. let data = null;
  432. if (this.type === "important") {
  433. data = {
  434. name: this.taskName,
  435. important: true,
  436. sort: 100,
  437. }
  438. } else if (this.type === "plan") {
  439. let currTime = new Date()
  440. let strDate = currTime.getFullYear() + '/' + (currTime.getMonth() + 1) + '/' + currTime.getDate()
  441. data = {
  442. name: this.taskName,
  443. estimatedStartDate: strDate,
  444. estimatedEndDate: strDate,
  445. important: false,
  446. sort: 100,
  447. }
  448. } else {
  449. data = {
  450. name: this.taskName,
  451. important: false,
  452. sort: 100,
  453. }
  454. }
  455. taskManage.addTask(data).then((res) => {
  456. if (res.data.success) {
  457. if (!this.isFinish) {
  458. this.tasks.unshift(res.data.data);
  459. }
  460. this.taskName = "";
  461. }
  462. })
  463. }
  464. },
  465. personOpen() {
  466. if (this.currTask.estimatedStartDate != null) {
  467. let begin = ""
  468. let end = ""
  469. if (this.currTask.estimatedStartDate.indexOf(
  470. ' ') > 0) {
  471. begin = this.currTask.estimatedStartDate.substring(0, this.currTask.estimatedStartDate.indexOf(
  472. ' '))
  473. end = this.currTask.estimatedEndDate.substring(0, this.currTask.estimatedEndDate.indexOf(' '))
  474. } else {
  475. begin = this.currTask.estimatedStartDate
  476. end = this.currTask.estimatedEndDate
  477. }
  478. this.taskDate = begin + '~' + end
  479. this.defaultDate = [begin, end]
  480. }
  481. let currDate = new Date()
  482. this.minDate = (currDate.getFullYear() - 1) + "-12-27"
  483. taskManage.getTaskStep(this.currTask.id).then((res) => {
  484. if (res.data.success) {
  485. this.taskSteps = res.data.data
  486. }
  487. })
  488. this.getFile();
  489. },
  490. getFile() {
  491. taskManage.getFile(this.currTask.id).then((res) => {
  492. if (res.data.success) {
  493. this.fileList = res.data.data
  494. }
  495. })
  496. },
  497. personClose() {
  498. this.personDetail = false;
  499. this.taskDate = "";
  500. },
  501. deleteToday() {
  502. let _this = this
  503. uni.showModal({
  504. title: "今日任务删除",
  505. content: "是否确认从今日任务删除?",
  506. showCancel: true,
  507. success(e) {
  508. if (e.confirm) {
  509. let data = [{
  510. id: _this.currTask.todayId,
  511. }, ]
  512. taskManage.deleteToday(data).then((res) => {
  513. if (res.data.success) {
  514. _this.currTask.todayId = null
  515. if (_this.type === "today") {
  516. _this.removeItem(_this.tasks, _this.currTask);
  517. _this.personDetail = false;
  518. }
  519. }
  520. })
  521. }
  522. }
  523. })
  524. },
  525. deleteTask() {
  526. let _this = this;
  527. uni.showModal({
  528. content: "是否确认删除当前任务?",
  529. success(e) {
  530. if (e.cancel) {
  531. return
  532. }
  533. let data = [{
  534. id: _this.currTask.id
  535. }]
  536. taskManage.deleteTask(data).then((res) => {
  537. if (res.data.success) {
  538. _this.removeItem(_this.tasks, _this.currTask)
  539. _this.currTask = {};
  540. _this.taskInfo = {};
  541. _this.personDetail = false;
  542. _this.taskDate = "";
  543. }
  544. })
  545. }
  546. })
  547. },
  548. finishStep(step) {
  549. let data = {
  550. id: step.id,
  551. }
  552. if (step.endTime == null) {
  553. taskManage.stepFinish(data).then((res) => {
  554. if (res.data.success) {
  555. step.endTime = res.data.data
  556. }
  557. })
  558. } else {
  559. taskManage.stepUnFinish(data).then((res) => {
  560. if (res.data.success) {
  561. step.endTime = null
  562. }
  563. })
  564. }
  565. },
  566. addStep() {
  567. if (this.stepName.trim() === "") {
  568. uni.showToast({
  569. title: "请输入步骤名称",
  570. mask: true,
  571. icon: "none"
  572. });
  573. return;
  574. }
  575. let data = {
  576. taskId: this.currTask.id,
  577. name: this.stepName,
  578. sort: 100,
  579. }
  580. taskManage.addStep(data).then((res) => {
  581. if (res.data.success) {
  582. this.taskSteps.push(res.data.data)
  583. }
  584. })
  585. this.stepName = ''
  586. },
  587. deleteStep(step) {
  588. let data = [{
  589. id: step.id,
  590. }, ]
  591. taskManage.deleteStep(data).then((res) => {
  592. if (res.data.success) {
  593. this.removeItem(this.taskSteps, step)
  594. }
  595. })
  596. },
  597. dateConfirm(e) {
  598. this.defaultDate = e;
  599. this.calendar = false;
  600. this.taskDate = e[0] + '~' + e[1];
  601. this.currTask.estimatedStartDate = e[0];
  602. this.currTask.estimatedEndDate = e[1];
  603. this.saveTask();
  604. },
  605. fileOpen() {
  606. this.fileType = true
  607. },
  608. fileClose() {
  609. this.fileType = false
  610. },
  611. uploadImage() {
  612. let _this = this;
  613. const token = uni.getStorageSync("token")
  614. console.log(token);
  615. uni.chooseImage({
  616. sizeType: ["original", "compressed"],
  617. success: function(e) {
  618. for (var i = 0; i < e.tempFiles.length; i++) {
  619. uni.uploadFile({
  620. url: env.baseUrl + "/task/mp/uploadimage",
  621. filePath: e.tempFiles[i].path,
  622. name: 'file',
  623. formData: {
  624. "taskId": _this.currTask.id,
  625. },
  626. header: {
  627. "Authorization": "Bearer " + token,
  628. "Content-Type": "multipart/form-data"
  629. },
  630. success: (res) => {
  631. _this.getFile()
  632. _this.fileType = false
  633. }
  634. })
  635. }
  636. }
  637. })
  638. },
  639. uploadFile() {
  640. let _this = this;
  641. const token = uni.getStorageSync("token")
  642. wx.chooseMessageFile({
  643. success: function(e) {
  644. for (var i = 0; i < e.tempFiles.length; i++) {
  645. uni.uploadFile({
  646. url: env.baseUrl + "/task/mp/upload",
  647. filePath: e.tempFiles[i].path,
  648. name: 'file',
  649. formData: {
  650. "taskId": _this.currTask.id,
  651. "fileName": e.tempFiles[i].name
  652. },
  653. header: {
  654. "Authorization": "Bearer " + token,
  655. "Content-Type": "multipart/form-data"
  656. },
  657. success: (res) => {
  658. _this.getFile()
  659. _this.fileType = false
  660. }
  661. })
  662. }
  663. }
  664. })
  665. },
  666. downFile(e) {
  667. let parts = e.fileOriginName.split(".");
  668. let filetype = parts[parts.length - 1];
  669. let documentType = ["doc", "xls", "ppt", "pdf", "docx", "xlsx", "pptx"]
  670. let imageType = ["png", "jpg", "jpeg", "gif"]
  671. if (!documentType.find(function(value) {
  672. return value == filetype
  673. }) && !imageType.find(function(value) {
  674. return value == filetype
  675. })) {
  676. uni.showModal({
  677. content: "小程序暂时不支持该类型文件,请到其他版本应用中查看",
  678. showCancel: false
  679. })
  680. return;
  681. }
  682. let _this = this;
  683. const token = uni.getStorageSync("token")
  684. uni.request({
  685. url: env.baseUrl + "/task/file/download",
  686. data: {
  687. fileId: e.fileId
  688. },
  689. header: {
  690. "Authorization": "Bearer " + token,
  691. },
  692. method: "GET",
  693. responseType: "arraybuffer",
  694. success(res) {
  695. const fs = wx.getFileSystemManager();
  696. fs.writeFile({
  697. filePath: wx.env.USER_DATA_PATH + "/" + e.fileOriginName,
  698. data: res.data,
  699. encoding: "binary",
  700. success(s) {
  701. if (imageType.find(function(value) {
  702. return value == filetype
  703. })) {
  704. uni.previewImage({
  705. urls: [wx.env.USER_DATA_PATH + "/" + e.fileOriginName]
  706. })
  707. } else {
  708. uni.openDocument({
  709. filePath: wx.env.USER_DATA_PATH + "/" + e.fileOriginName,
  710. showMenu: true
  711. })
  712. }
  713. }
  714. })
  715. }
  716. })
  717. },
  718. deleteFile(e) {
  719. taskManage.deleteFile(e.id, e.fileId).then((res) => {
  720. if (res.data.success) {
  721. this.removeItem(this.fileList, e)
  722. }
  723. })
  724. },
  725. }
  726. }
  727. </script>
  728. <style>
  729. page {
  730. height: 100%;
  731. }
  732. .content {
  733. width: 100%;
  734. height: 100%;
  735. }
  736. #header {
  737. height: 70upx;
  738. display: flex;
  739. align-items: flex-end;
  740. border-bottom: #C0C0C0 solid 5upx;
  741. }
  742. #header view {
  743. height: 50upx;
  744. font-family: 粗体;
  745. padding: 0upx 20upx 0upx 20upx;
  746. margin-bottom: -5upx;
  747. }
  748. .select {
  749. font-weight: bolder;
  750. font-size: 35upx;
  751. color: #00aaff;
  752. border-bottom: #00aaff solid 5upx;
  753. }
  754. .item {
  755. border-bottom: #ececec solid 1upx;
  756. display: flex;
  757. align-items: center;
  758. padding: 10px 10px 10px 10px;
  759. }
  760. .image {
  761. width: 26px;
  762. height: 26px;
  763. }
  764. .image image {
  765. width: 100%;
  766. height: 100%;
  767. }
  768. .taskdetail {
  769. margin-left: 20px;
  770. margin-right: 10px;
  771. }
  772. .taskdetail text {
  773. font-size: 30upx;
  774. }
  775. #bottom {
  776. height: 60upx;
  777. display: flex;
  778. justify-content: flex-end;
  779. }
  780. .btnSuggest {
  781. width: 100upx;
  782. height: 50upx;
  783. line-height: 50upx;
  784. border-radius: 25upx;
  785. padding: 0upx;
  786. font-size: 25upx;
  787. }
  788. .btnAdd {
  789. width: 50upx;
  790. height: 50upx;
  791. line-height: 50upx;
  792. border-radius: 25upx;
  793. padding: 0upx;
  794. font-size: 50upx;
  795. }
  796. .leftPop {
  797. width: 80vw;
  798. padding-top: 5vh;
  799. padding-left: 20rpx;
  800. padding-right: 40rpx;
  801. }
  802. .addPop {
  803. height: 200rpx;
  804. padding: 20rpx;
  805. }
  806. .detail {
  807. padding-top: 5vh;
  808. padding-left: 20rpx;
  809. padding-right: 20rpx;
  810. }
  811. </style>