index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <view class="app-page">
  3. <u-sticky offset-top="0" customStyle="width:100%">
  4. <view class="top-view"
  5. :style="'height:' + topData.height + 'px;' + 'padding-top:' + topData.top + 'px;padding-bottom:20rpx'">
  6. <u-icon name="arrow-left" color="#000000" size="34rpx" customStyle="padding: 16rpx" @click="toBack()">
  7. </u-icon>
  8. <u-search class="serchTitle" placeholder="请输入关键词搜索任务" v-model="keyWord" bg-color="#dfdfdf"
  9. border-color="#ffffff" margin="0 200rpx 0 0" placeholder-color="#959595" :show-action="false"
  10. @search="toSearchKeyWord" @clear="toSearchKeyWord"></u-search>
  11. </view>
  12. </u-sticky>
  13. <view class="good-list">
  14. <template v-for="(item,index) in mList">
  15. <view class="good-item" @click="toDetails(item.code)">
  16. <u--image width='196rpx' height='196rpx' radius="10rpx" mode="widthFix" :src="item.cover"
  17. :fade="true" duration="450" customStyle="margin-top:32rpx;margin-bottom:32rpx;" />
  18. <view class="good-item-content">
  19. <view class="good-name-box">
  20. <!-- <image mode="heightFix" :src="`${$getImgBaseUrl()}tiktok-log.png`"></image> -->
  21. <text>{{item.task_name}}</text>
  22. </view>
  23. <text class="good-desc">{{item.remark}}</text>
  24. <view class="good-tags">
  25. <text class="good-tag1">{{item.task_model}}</text>
  26. <text class="good-tag2">粉丝{{item.fans_require}}起</text>
  27. <text class="good-tag2">{{item.show_form}}</text>
  28. </view>
  29. <view class="good-bottom">
  30. <text class="good-time">{{item.update_at}}</text>
  31. <view class="good-view-box">
  32. <image :src="`${$getImgBaseUrl()}ic-view.png`" mode="heightFix"></image>
  33. <text>{{item.num_read}}</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <u-line :color="index !== mList.length - 1 ? '#E9E9E9' : '#00000000'" length="calc(100%)"
  39. customStyle="margin-bottom:4rpx;"></u-line>
  40. </template>
  41. </view>
  42. <Empty v-if="mList && mList.length == 0"></Empty>
  43. </view>
  44. </template>
  45. <script>
  46. import Empty from "@/components/Empty/index.vue"
  47. import {
  48. getTaskList,
  49. } from "@/common/api/task.js";
  50. export default {
  51. components: {
  52. Empty
  53. },
  54. data() {
  55. return {
  56. topData: {
  57. top: 0,
  58. height: 0
  59. },
  60. keyWord: '',
  61. page: 1,
  62. mList: undefined
  63. }
  64. },
  65. computed: {
  66. searchData() {
  67. return {
  68. limit: 20,
  69. page: this.page,
  70. task_name: this.keyWord
  71. }
  72. }
  73. },
  74. created() {
  75. const topData = uni.getMenuButtonBoundingClientRect()
  76. this.topData.top = topData.top
  77. this.topData.height = topData.height
  78. },
  79. onLoad(options) {},
  80. onReachBottom() {
  81. this.page++;
  82. this.getTaskList()
  83. },
  84. methods: {
  85. toBack() {
  86. uni.navigateBack()
  87. },
  88. toSearchKeyWord(val) {
  89. console.log(val);
  90. this.page = 1;
  91. if (this.keyWord != '') {
  92. this.mList = [];
  93. this.getTaskList();
  94. } else {
  95. this.mList = [];
  96. this.mList = undefined;
  97. }
  98. },
  99. toDetails(code) {
  100. uni.navigateTo({
  101. url: '/pages/goodDetails/index?code=' + code
  102. })
  103. },
  104. getTaskList(cateids) {
  105. uni.showLoading({
  106. })
  107. const data = this.searchData;
  108. getTaskList(data)
  109. .then((res) => {
  110. uni.hideLoading();
  111. console.log("getTaskList==>", res.data)
  112. if (res.data) {
  113. if (this.page === 1) {
  114. this.mList = res.data.list;
  115. } else {
  116. this.mList = this.mList.concat(res.data.list);
  117. }
  118. } else {
  119. if (this.page != 1) {
  120. this.page;
  121. } else {
  122. this.mList = []
  123. }
  124. }
  125. })
  126. .catch(() => {
  127. if (this.page != 1) {
  128. this.page--;
  129. }
  130. uni.hideLoading();
  131. });
  132. },
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .app-page {
  138. width: 100vw;
  139. display: flex;
  140. background: white;
  141. align-items: center;
  142. flex-direction: column;
  143. }
  144. .top-view {
  145. display: flex;
  146. width: 100%;
  147. flex-direction: row;
  148. align-items: flex-end;
  149. }
  150. .top-view image {
  151. height: 60rpx;
  152. margin-left: 30rpx;
  153. width: 80rpx;
  154. }
  155. .top-view text {
  156. font-size: 26rpx;
  157. margin-bottom: 10rpx;
  158. margin-left: 10rpx;
  159. }
  160. .good-list {
  161. background: white;
  162. display: flex;
  163. flex-basis: 0;
  164. flex-direction: column;
  165. width: 100%;
  166. align-items: center;
  167. }
  168. .good-item {
  169. width: calc(100% - 40rpx);
  170. display: flex;
  171. flex-direction: row;
  172. }
  173. .good-item-content {
  174. flex: 1;
  175. margin-left: 20rpx;
  176. display: flex;
  177. flex-direction: column;
  178. }
  179. .good-name-box {
  180. display: flex;
  181. margin-top: 28rpx;
  182. flex-direction: row;
  183. align-items: center;
  184. image {
  185. width: 30rpx;
  186. height: 30rpx;
  187. display: block;
  188. }
  189. text {
  190. font-size: 32rpx;
  191. font-family: PingFang SC-Bold, PingFang SC;
  192. font-weight: bold;
  193. color: #1D161F;
  194. // margin-left: 10rpx;
  195. overflow: hidden;
  196. text-overflow: ellipsis;
  197. -webkit-line-clamp: 1;
  198. display: -webkit-box;
  199. -webkit-box-orient: vertical;
  200. }
  201. }
  202. .good-desc {
  203. font-size: 22rpx;
  204. font-family: PingFang SC-Medium, PingFang SC;
  205. font-weight: 500;
  206. color: #2C2C2C;
  207. margin-top: 8rpx;
  208. }
  209. .good-tags {
  210. display: flex;
  211. flex-direction: row;
  212. margin-top: 15rpx;
  213. align-items: center;
  214. .good-tag1 {
  215. font-size: 22rpx;
  216. font-family: PingFang SC-Medium, PingFang SC;
  217. font-weight: 500;
  218. margin-right: 10rpx;
  219. color: #765AEE;
  220. padding: 3rpx 12rpx;
  221. background: #F3F1FF;
  222. border-radius: 5rpx 5rpx 5rpx 5rpx;
  223. opacity: 1;
  224. }
  225. .good-tag2 {
  226. font-size: 22rpx;
  227. font-family: PingFang SC-Medium, PingFang SC;
  228. font-weight: 500;
  229. color: #5E5E5E;
  230. margin-right: 10rpx;
  231. padding: 3rpx 12rpx;
  232. background: #F8F8F8;
  233. border-radius: 5rpx 5rpx 5rpx 5rpx;
  234. opacity: 1;
  235. }
  236. }
  237. .good-bottom {
  238. display: flex;
  239. flex-direction: row;
  240. align-items: center;
  241. margin-top: 32rpx;
  242. justify-content: space-between;
  243. .good-time {
  244. font-size: 22rpx;
  245. font-family: PingFang SC-Medium, PingFang SC;
  246. font-weight: 500;
  247. color: #B7B7B7;
  248. }
  249. .good-view-box {
  250. display: flex;
  251. flex-direction: row;
  252. align-items: center;
  253. image {
  254. height: 16rpx;
  255. width: 22rpx;
  256. display: block;
  257. }
  258. text {
  259. font-size: 22rpx;
  260. font-family: PingFang SC-Medium, PingFang SC;
  261. font-weight: 500;
  262. color: #B7B7B7;
  263. margin-left: 6rpx;
  264. }
  265. }
  266. }
  267. </style>