mytask.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <view>
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view class="menu" v-if="!loading">
  7. <view class="menu-item" @click="toAll()">
  8. <p v-bind:class="tab == 'all'?'lor':'unlor'">全部</p>
  9. </view>
  10. <view class="menu-item" @click="toApply()">
  11. <p v-bind:class="tab == 'apply'?'lor':'unlor'">已报名</p>
  12. </view>
  13. <view class="menu-item" @click="toexecute()">
  14. <p v-bind:class="tab == 'execute'?'lor':'unlor'">执行中</p>
  15. </view>
  16. <view class="menu-item" @click="toEnd()">
  17. <p v-bind:class="tab == 'end'?'lor':'unlor'">已结束</p>
  18. </view>
  19. </view>
  20. <view class="home" v-if="tab == 'all' && !loading" style="margin-top: 100rpx;">
  21. <view class="task" v-for="item in allList">
  22. <view @click="toDetail(item)">
  23. <view class="task-head">
  24. <view class="task-head-account">
  25. <image :src="item.platform_icon_url" style="height: 50rpx;width: 50rpx;"></image>
  26. <p style="margin-left: 20rpx;">{{item.platform_nick_name}}</p>
  27. </view>
  28. <view class="task-head-status">
  29. <p>{{item.task_stage_txt}}</p>
  30. </view>
  31. </view>
  32. <view class="task-info">
  33. <view class="task-info-left">
  34. <image :src="item.product_img_url" style="height: 120rpx;width: 120rpx;"></image>
  35. <p style="margin-left: 50rpx;">{{item.project_name}}</p>
  36. </view>
  37. <view class="task-info-right" v-if="item.isShowModify">
  38. <image src="../../../static/img/icon-edit.png" style="height: 60rpx;width: 60rpx;"></image>
  39. <p style="font-size: 32rpx;color: #ffcb41;font-weight: 600">改</p>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="home" v-if="tab == 'apply' && !loading">
  46. <view class="task" v-for="item in applyList">
  47. <view @click="toDetail(item)">
  48. <view class="task-head">
  49. <view class="task-head-account">
  50. <image :src="item.platform_icon_url" style="height: 50rpx;width: 50rpx;"></image>
  51. <p style="margin-left: 20rpx;">{{item.platform_nick_name}}</p>
  52. </view>
  53. <view class="task-head-status">
  54. <p>{{item.task_stage_txt}}</p>
  55. </view>
  56. </view>
  57. <view class="task-info">
  58. <view class="task-info-left">
  59. <image :src="item.product_img_url" style="height: 120rpx;width: 120rpx;"></image>
  60. <p style="margin-left: 50rpx;">{{item.project_name}}</p>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="home" v-if="tab == 'execute' && !loading">
  67. <view class="task" v-for="item in goingList">
  68. <view @click="toDetail(item)">
  69. <view class="task-head">
  70. <view class="task-head-account">
  71. <image :src="item.platform_icon_url" style="height: 50rpx;width: 50rpx;"></image>
  72. <p style="margin-left: 20rpx;">{{item.platform_nick_name}}</p>
  73. </view>
  74. <view class="task-head-status">
  75. <p>{{item.task_stage_txt}}</p>
  76. </view>
  77. </view>
  78. <view class="task-info">
  79. <view class="task-info-left">
  80. <image :src="item.product_img_url" style="height: 120rpx;width: 120rpx;"></image>
  81. <p style="margin-left: 50rpx;">{{item.project_name}}</p>
  82. </view>
  83. <view class="task-info-right" v-if="item.isShowModify">
  84. <image src="../../../static/img/icon-edit.png" style="height: 60rpx;width: 60rpx;"></image>
  85. <p style="font-size: 32rpx;color: #ffcb41;font-weight: 600">改</p>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="home" v-if="tab == 'end' && !loading">
  92. <view class="task" v-for="item in endList">
  93. <view @click="toDetail(item)">
  94. <view class="task-head">
  95. <view class="task-head-account">
  96. <image :src="item.platform_icon_url" style="height: 50rpx;width: 50rpx;"></image>
  97. <p style="margin-left: 20rpx;">{{item.platform_nick_name}}</p>
  98. </view>
  99. <view class="task-head-status">
  100. <p>{{item.task_stage_txt}}</p>
  101. </view>
  102. </view>
  103. <view class="task-info">
  104. <view class="task-info-left">
  105. <image :src="item.product_img_url" style="height: 120rpx;width: 120rpx;"></image>
  106. <p style="margin-left: 50rpx;">{{item.project_name}}</p>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </template>
  114. <script>
  115. import mvBar from "@/components/mys_navBar/mysNavBar";
  116. import getRouter from '@/components/utils.js';
  117. export default {
  118. components: {
  119. mvBar,
  120. },
  121. data() {
  122. return {
  123. navH: getApp().globalData.navHeight,
  124. loading: true,
  125. tab: '',
  126. allList: [],
  127. applyList: [],
  128. goingList: [],
  129. endList: [],
  130. taskStageList: [],
  131. list: [{
  132. account: {
  133. platform: "https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/lQLPDhrXwll1_MsjI7CSK_6e62AG2AGOvh1HgAcA_35_35.png",
  134. nickname: "丸子在成都",
  135. },
  136. status: "待确认",
  137. mainphoto: "https://static1.paizi.com/uploadfile/2018/1013/20181013013207465.png",
  138. taskname: "醉码头火锅太古里店",
  139. }, {
  140. account: {
  141. platform: "https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/pingtai2.png",
  142. nickname: "成都的一颗丸子",
  143. },
  144. status: "待确认",
  145. mainphoto: "https://tse1-mm.cn.bing.net/th/id/R-C.978cb3a3b27875a0cc9d78a254b30b8f?rik=yrP2kNCtfQYEgQ&riu=http%3a%2f%2fnews.southcn.com%2fgd%2fcontent%2fimages%2fattachement%2fpng%2fsite4%2f20190917%2feca86b61fd551eeb23c507.png&ehk=xuWbgLrNmyhNJaByMZPJrX81PrzXrLHqHM%2fdYatFhrs%3d&risl=&pid=ImgRaw&r=0&sres=1&sresct=1",
  146. taskname: "奥运吉祥物冰墩墩盲盒",
  147. }, ],
  148. mysNavConfig: {
  149. /* 开启单页显示首页图标 */
  150. isHome: true,
  151. /* 固定导航 */
  152. navFixed: true,
  153. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  154. navTitle: {
  155. text: "我的任务",
  156. color: "",
  157. fontSize: "32rpx", // px upx rpx
  158. fontWeight: "normal", // 100 - 700
  159. },
  160. btnType: "type2",
  161. onLeftClick: "/pages/mycenter/mycenter",
  162. /* type2 按钮 */
  163. type2Config: {
  164. // 左图标
  165. leftPath: "/static/img/png2.png",
  166. // 右图标
  167. rightPath: "/static/img/png4.png",
  168. // 圆角
  169. radius: "40rpx",
  170. },
  171. },
  172. }
  173. },
  174. async onLoad(options) {
  175. // 判断登录
  176. await this.isLogin();
  177. if (this.token === '') {
  178. uni.showModal({
  179. content: '请先登录',
  180. success: function(res) {
  181. if (res.confirm) {
  182. uni.navigateTo({
  183. url: '/pages/login/login'
  184. });
  185. } else if (res.cancel) {
  186. uni.navigateBack();
  187. }
  188. }
  189. });
  190. }
  191. let data = options.textObj.replace(/""/g, "");
  192. data = JSON.parse(decodeURIComponent(data))
  193. this.tab = data.tab
  194. },
  195. async onShow() {
  196. this.loading = true;
  197. uni.showLoading({
  198. title: '加载中'
  199. });
  200. await this.getInfoTable();
  201. await this.getList();
  202. uni.hideLoading();
  203. this.loading = false;
  204. },
  205. methods: {
  206. // 判断登陆是否过期
  207. isLogin() {
  208. return this.$https.get('/youngee/c/t/g/is-login')
  209. .then(res => {
  210. if (res.data.code === 403) {
  211. // 登陆已失效
  212. this.token = ""
  213. uni.clearStorage();
  214. } else {
  215. this.token = uni.getStorageSync('token')
  216. }
  217. })
  218. },
  219. getInfoTable() {
  220. return this.$https.get('/youngee/c/g/get-info-tables')
  221. .then(res => {
  222. console.log(res)
  223. this.taskStageList = res.data.data.TaskStage
  224. })
  225. },
  226. getList() {
  227. return this.$https.get('/youngee/c/t/g/get-task-brief-list').then(res => {
  228. console.log(res)
  229. this.allList = res.data.data.all_Task_info_list
  230. if (this.allList != null) {
  231. for (let i = 0; i < this.allList.length; ++i) {
  232. let productPhoto = JSON.parse(this.allList[i].product_photo_snap);
  233. for (let j = 0; j < productPhoto.length; j++) {
  234. if (productPhoto[j].Symbol == 1) {
  235. this.allList[i].product_img_url = productPhoto[j].PhotoUrl
  236. }
  237. }
  238. if ((this.allList[i].task_stage == 7 && this.allList[i].script_status == 3) ||
  239. (this.allList[i].task_stage == 9 && this.allList[i].sketch_status == 3) ||
  240. (this.allList[i].task_stage == 11 && this.allList[i].link_status == 3) ||
  241. (this.allList[i].task_stage == 13 && this.allList[i].data_status == 3)) {
  242. this.allList[i].isShowModify = true
  243. } else {
  244. this.allList[i].isShowModify = false
  245. }
  246. for (let j = 0; j < this.taskStageList.length; ++j) {
  247. if (this.allList[i].task_stage == this.taskStageList[j].task_stage_id)
  248. this.allList[i].task_stage_txt = this.taskStageList[j].task_stage
  249. }
  250. }
  251. }
  252. this.applyList = res.data.data.sgin_up_Task_info_list
  253. if (this.applyList != null) {
  254. for (let i = 0; i < this.applyList.length; ++i) {
  255. let productPhoto = JSON.parse(this.applyList[i].product_photo_snap);
  256. for (let j = 0; j < productPhoto.length; j++) {
  257. if (productPhoto[j].Symbol == 1) {
  258. this.applyList[i].product_img_url = productPhoto[j].PhotoUrl
  259. }
  260. }
  261. for (let j = 0; j < this.taskStageList.length; ++j) {
  262. if (this.applyList[i].task_stage == this.taskStageList[j].task_stage_id)
  263. this.applyList[i].task_stage_txt = this.taskStageList[j].task_stage
  264. }
  265. }
  266. }
  267. this.goingList = res.data.data.going_on_Task_info_list
  268. if (this.goingList != null) {
  269. for (let i = 0; i < this.goingList.length; ++i) {
  270. let productPhoto = JSON.parse(this.goingList[i].product_photo_snap);
  271. for (let j = 0; j < productPhoto.length; j++) {
  272. if (productPhoto[j].Symbol == 1) {
  273. this.goingList[i].product_img_url = productPhoto[j].PhotoUrl
  274. }
  275. }
  276. if ((this.goingList[i].task_stage == 7 && this.goingList[i].script_status == 3) ||
  277. (this.goingList[i].task_stage == 9 && this.goingList[i].sketch_status == 3) ||
  278. (this.goingList[i].task_stage == 11 && this.goingList[i].link_status == 3) ||
  279. (this.goingList[i].task_stage == 13 && this.goingList[i].data_status == 3)) {
  280. this.goingList[i].isShowModify = true
  281. } else {
  282. this.goingList[i].isShowModify = false
  283. }
  284. for (let j = 0; j < this.taskStageList.length; ++j) {
  285. if (this.goingList[i].task_stage == this.taskStageList[j].task_stage_id)
  286. this.goingList[i].task_stage_txt = this.taskStageList[j].task_stage
  287. }
  288. }
  289. }
  290. this.endList = res.data.data.completed_Task_info_list
  291. if (this.endList != null) {
  292. for (let i = 0; i < this.endList.length; ++i) {
  293. let productPhoto = JSON.parse(this.endList[i].product_photo_snap);
  294. for (let j = 0; j < productPhoto.length; j++) {
  295. if (productPhoto[j].Symbol == 1) {
  296. this.endList[i].product_img_url = productPhoto[j].PhotoUrl
  297. }
  298. }
  299. for (let j = 0; j < this.taskStageList.length; ++j) {
  300. if (this.endList[i].task_stage == this.taskStageList[j].task_stage_id)
  301. this.endList[i].task_stage_txt = this.taskStageList[j].task_stage
  302. }
  303. }
  304. }
  305. })
  306. },
  307. async toAll() {
  308. this.tab = 'all'
  309. uni.showLoading({
  310. title: '加载中'
  311. });
  312. await this.getList()
  313. uni.hideLoading()
  314. },
  315. async toApply() {
  316. this.tab = 'apply'
  317. uni.showLoading({
  318. title: '加载中'
  319. });
  320. await this.getList()
  321. uni.hideLoading()
  322. },
  323. async toexecute() {
  324. this.tab = 'execute'
  325. uni.showLoading({
  326. title: '加载中'
  327. });
  328. await this.getList()
  329. uni.hideLoading()
  330. },
  331. async toEnd() {
  332. this.tab = 'end'
  333. uni.showLoading({
  334. title: '加载中'
  335. });
  336. await this.getList()
  337. uni.hideLoading()
  338. },
  339. toDetail(item) {
  340. console.log("func toDetail running")
  341. uni.navigateTo({
  342. url: '/pages/workspace/taskdetail?taskId=' + item.task_id,
  343. success(res) {
  344. console.log(res);
  345. },
  346. fail(err) {
  347. console.log(err);
  348. }
  349. });
  350. console.log("func toDetail end")
  351. },
  352. }
  353. }
  354. </script>
  355. <style lang="scss" scoped>
  356. view {
  357. font-size: 14px;
  358. line-height: inherit;
  359. }
  360. .menu {
  361. position: fixed;
  362. border-bottom: #FCCF41;
  363. background-color: #FFFFFF;
  364. justify-content: space-around;
  365. height: 5%;
  366. width: 100%;
  367. display: flex;
  368. z-index: 10;
  369. }
  370. .menu-item p {
  371. font-weight: 600;
  372. &.lor {
  373. border-bottom: 5rpx solid #F0D232;
  374. color: #F0D232;
  375. padding-bottom: 15rpx;
  376. }
  377. &.unlor {
  378. border-bottom: 5rpx solid #fff;
  379. color: #81838f;
  380. padding-bottom: 15rpx;
  381. }
  382. }
  383. .home {
  384. margin-top: 100rpx;
  385. }
  386. .task {
  387. margin-bottom: 20rpx;
  388. border-bottom: 1rpx #d7d7d7 solid;
  389. .task-head {
  390. display: flex;
  391. justify-content: space-between;
  392. align-items: center;
  393. padding: 10rpx 20rpx;
  394. .task-head-account {
  395. display: flex;
  396. }
  397. .task-head-status {
  398. color: red;
  399. }
  400. }
  401. .task-info {
  402. display: flex;
  403. align-items: center;
  404. justify-content: space-between;
  405. padding: 10rpx 20rpx;
  406. .task-info-left {
  407. display: flex;
  408. align-items: center;
  409. }
  410. .task-info-right {
  411. width: 100rpx;
  412. height: 100rpx;
  413. border-radius: 50%;
  414. border: #ffcb41 2rpx solid;
  415. display: flex;
  416. align-items: center;
  417. justify-content: center;
  418. }
  419. }
  420. }
  421. .line {
  422. border-bottom: 1rpx #AAAAAA solid;
  423. }
  424. </style>