mytask.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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="padding-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" style="padding-top: 100rpx;">
  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" style="padding-top: 100rpx;">
  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" style="padding-top: 100rpx;">
  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. export default {
  117. components: {
  118. mvBar,
  119. },
  120. data() {
  121. return {
  122. navH: getApp().globalData.navHeight,
  123. loading: true,
  124. tab: '',
  125. allList: [],
  126. applyList: [],
  127. goingList: [],
  128. endList: [],
  129. taskStageList: [],
  130. list: [{
  131. account: {
  132. platform: "https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/lQLPDhrXwll1_MsjI7CSK_6e62AG2AGOvh1HgAcA_35_35.png",
  133. nickname: "丸子在成都",
  134. },
  135. status: "待确认",
  136. mainphoto: "https://static1.paizi.com/uploadfile/2018/1013/20181013013207465.png",
  137. taskname: "醉码头火锅太古里店",
  138. }, {
  139. account: {
  140. platform: "https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/pingtai2.png",
  141. nickname: "成都的一颗丸子",
  142. },
  143. status: "待确认",
  144. 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",
  145. taskname: "奥运吉祥物冰墩墩盲盒",
  146. }, ],
  147. mysNavConfig: {
  148. /* 开启单页显示首页图标 */
  149. isHome: true,
  150. /* 固定导航 */
  151. navFixed: true,
  152. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  153. navTitle: {
  154. text: "我的任务",
  155. color: "",
  156. fontSize: "32rpx", // px upx rpx
  157. fontWeight: "normal", // 100 - 700
  158. },
  159. btnType: "type2",
  160. onLeftClick: "/pages/mycenter/mycenter",
  161. /* type2 按钮 */
  162. type2Config: {
  163. // 左图标
  164. leftPath: "/static/img/png2.png",
  165. // 右图标
  166. rightPath: "/static/img/png4.png",
  167. // 圆角
  168. radius: "40rpx",
  169. },
  170. },
  171. }
  172. },
  173. async onLoad(options) {
  174. // 判断登录
  175. await this.isLogin();
  176. if (this.token === '') {
  177. uni.showModal({
  178. content: '请先登录',
  179. success: function(res) {
  180. if (res.confirm) {
  181. uni.navigateTo({
  182. url: '/pages/login/login'
  183. });
  184. } else if (res.cancel) {
  185. uni.navigateBack();
  186. }
  187. }
  188. });
  189. }
  190. let data = options.textObj.replace(/""/g, "");
  191. data = JSON.parse(decodeURIComponent(data))
  192. this.tab = data.tab
  193. },
  194. async onShow() {
  195. this.loading = true;
  196. uni.showLoading({
  197. title: '加载中'
  198. });
  199. await this.getInfoTable();
  200. await this.getList();
  201. uni.hideLoading();
  202. this.loading = false;
  203. },
  204. methods: {
  205. // 判断登陆是否过期
  206. isLogin() {
  207. return this.$https.get('/youngee/c/t/g/is-login')
  208. .then(res => {
  209. if (res.data.code === 403) {
  210. // 登陆已失效
  211. this.token = ""
  212. uni.clearStorage();
  213. } else {
  214. this.token = uni.getStorageSync('token')
  215. }
  216. })
  217. },
  218. getInfoTable() {
  219. return this.$https.get('/youngee/c/g/get-info-tables')
  220. .then(res => {
  221. console.log(res)
  222. this.taskStageList = res.data.data.TaskStage
  223. })
  224. },
  225. getList() {
  226. return this.$https.get('/youngee/c/t/g/get-task-brief-list').then(res => {
  227. console.log(res)
  228. this.allList = res.data.data.all_Task_info_list
  229. if (this.allList != null) {
  230. for (let i = 0; i < this.allList.length; ++i) {
  231. let productPhoto = JSON.parse(this.allList[i].product_photo_snap);
  232. for (let j = 0; j < productPhoto.length; j++) {
  233. if (productPhoto[j].Symbol == 1) {
  234. this.allList[i].product_img_url = productPhoto[j].PhotoUrl
  235. }
  236. }
  237. if ((this.allList[i].task_stage == 7 && this.allList[i].script_status == 3) ||
  238. (this.allList[i].task_stage == 9 && this.allList[i].sketch_status == 3) ||
  239. (this.allList[i].task_stage == 11 && this.allList[i].link_status == 3) ||
  240. (this.allList[i].task_stage == 13 && this.allList[i].data_status == 3)) {
  241. this.allList[i].isShowModify = true
  242. } else {
  243. this.allList[i].isShowModify = false
  244. }
  245. for (let j = 0; j < this.taskStageList.length; ++j) {
  246. if (this.allList[i].task_stage == this.taskStageList[j].task_stage_id)
  247. this.allList[i].task_stage_txt = this.taskStageList[j].task_stage
  248. }
  249. }
  250. }
  251. this.applyList = res.data.data.sgin_up_Task_info_list
  252. if (this.applyList != null) {
  253. for (let i = 0; i < this.applyList.length; ++i) {
  254. let productPhoto = JSON.parse(this.applyList[i].product_photo_snap);
  255. for (let j = 0; j < productPhoto.length; j++) {
  256. if (productPhoto[j].Symbol == 1) {
  257. this.applyList[i].product_img_url = productPhoto[j].PhotoUrl
  258. }
  259. }
  260. for (let j = 0; j < this.taskStageList.length; ++j) {
  261. if (this.applyList[i].task_stage == this.taskStageList[j].task_stage_id)
  262. this.applyList[i].task_stage_txt = this.taskStageList[j].task_stage
  263. }
  264. }
  265. }
  266. this.goingList = res.data.data.going_on_Task_info_list
  267. if (this.goingList != null) {
  268. for (let i = 0; i < this.goingList.length; ++i) {
  269. let productPhoto = JSON.parse(this.goingList[i].product_photo_snap);
  270. for (let j = 0; j < productPhoto.length; j++) {
  271. if (productPhoto[j].Symbol == 1) {
  272. this.goingList[i].product_img_url = productPhoto[j].PhotoUrl
  273. }
  274. }
  275. if ((this.goingList[i].task_stage == 7 && this.goingList[i].script_status == 3) ||
  276. (this.goingList[i].task_stage == 9 && this.goingList[i].sketch_status == 3) ||
  277. (this.goingList[i].task_stage == 11 && this.goingList[i].link_status == 3) ||
  278. (this.goingList[i].task_stage == 13 && this.goingList[i].data_status == 3)) {
  279. this.goingList[i].isShowModify = true
  280. } else {
  281. this.goingList[i].isShowModify = false
  282. }
  283. for (let j = 0; j < this.taskStageList.length; ++j) {
  284. if (this.goingList[i].task_stage == this.taskStageList[j].task_stage_id)
  285. this.goingList[i].task_stage_txt = this.taskStageList[j].task_stage
  286. }
  287. }
  288. }
  289. this.endList = res.data.data.completed_Task_info_list
  290. if (this.endList != null) {
  291. for (let i = 0; i < this.endList.length; ++i) {
  292. let productPhoto = JSON.parse(this.endList[i].product_photo_snap);
  293. for (let j = 0; j < productPhoto.length; j++) {
  294. if (productPhoto[j].Symbol == 1) {
  295. this.endList[i].product_img_url = productPhoto[j].PhotoUrl
  296. }
  297. }
  298. for (let j = 0; j < this.taskStageList.length; ++j) {
  299. if (this.endList[i].task_stage == this.taskStageList[j].task_stage_id)
  300. this.endList[i].task_stage_txt = this.taskStageList[j].task_stage
  301. }
  302. }
  303. }
  304. })
  305. },
  306. async toAll() {
  307. this.tab = 'all'
  308. uni.showLoading({
  309. title: '加载中'
  310. });
  311. await this.getList()
  312. uni.hideLoading()
  313. },
  314. async toApply() {
  315. this.tab = 'apply'
  316. uni.showLoading({
  317. title: '加载中'
  318. });
  319. await this.getList()
  320. uni.hideLoading()
  321. },
  322. async toexecute() {
  323. this.tab = 'execute'
  324. uni.showLoading({
  325. title: '加载中'
  326. });
  327. await this.getList()
  328. uni.hideLoading()
  329. },
  330. async toEnd() {
  331. this.tab = 'end'
  332. uni.showLoading({
  333. title: '加载中'
  334. });
  335. await this.getList()
  336. uni.hideLoading()
  337. },
  338. toDetail(item) {
  339. console.log("func toDetail running")
  340. uni.navigateTo({
  341. url: '/pages/workspace/taskdetail?taskId=' + item.task_id,
  342. success(res) {
  343. console.log(res);
  344. },
  345. fail(err) {
  346. console.log(err);
  347. }
  348. });
  349. console.log("func toDetail end")
  350. },
  351. }
  352. }
  353. </script>
  354. <style lang="scss" scoped>
  355. view {
  356. font-size: 14px;
  357. line-height: inherit;
  358. }
  359. .menu {
  360. position: fixed;
  361. border-bottom: #FCCF41;
  362. background-color: #FFFFFF;
  363. justify-content: space-around;
  364. height: 5%;
  365. width: 100%;
  366. display: flex;
  367. z-index: 10;
  368. }
  369. .menu-item p {
  370. font-weight: 600;
  371. &.lor {
  372. border-bottom: 5rpx solid #F0D232;
  373. color: #F0D232;
  374. padding-bottom: 15rpx;
  375. }
  376. &.unlor {
  377. border-bottom: 5rpx solid #fff;
  378. color: #81838f;
  379. padding-bottom: 15rpx;
  380. }
  381. }
  382. .home {
  383. margin-top: 100rpx;
  384. }
  385. .task {
  386. margin-bottom: 20rpx;
  387. border-bottom: 1rpx #d7d7d7 solid;
  388. .task-head {
  389. display: flex;
  390. justify-content: space-between;
  391. align-items: center;
  392. padding: 10rpx 20rpx;
  393. .task-head-account {
  394. display: flex;
  395. }
  396. .task-head-status {
  397. color: red;
  398. }
  399. }
  400. .task-info {
  401. display: flex;
  402. align-items: center;
  403. justify-content: space-between;
  404. padding: 10rpx 20rpx;
  405. .task-info-left {
  406. display: flex;
  407. align-items: center;
  408. }
  409. .task-info-right {
  410. width: 100rpx;
  411. height: 100rpx;
  412. border-radius: 50%;
  413. border: #ffcb41 2rpx solid;
  414. display: flex;
  415. align-items: center;
  416. justify-content: center;
  417. }
  418. }
  419. }
  420. .line {
  421. border-bottom: 1rpx #AAAAAA solid;
  422. }
  423. </style>