推广小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

285 lines
6.5 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
5 months ago
5 months ago
7 months ago
7 months ago
7 months ago
7 months ago
5 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. <template>
  2. <view class="cardList">
  3. <view class="container">
  4. <view class="content">
  5. <view class="left">
  6. <image :src="imgArr[0]"></image>
  7. </view>
  8. <view class="right">
  9. <view class="detailed">
  10. <view class="title">{{$ot(item, 'active', 'title')}}</view>
  11. <view class="date">{{item.startTime}}</view>
  12. <view class="address">
  13. <view class="img-box">
  14. <image src="@/static/image/cart/addressIcon.png" mode=""></image>
  15. </view>
  16. <view>{{$ot(item, 'active', 'address')}}</view>
  17. </view>
  18. </view>
  19. <view class="tips-box">
  20. <view class="tips-box-item" v-for="(val,i) in iconTextArr" :key="i">{{val}}</view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="bottom-box">
  25. <view class="bottom-box-l">
  26. <!-- <uv-avatar-group :urls="urls" keyName="headImage" size="45rpx" gap="0.1"></uv-avatar-group>
  27. <view class="num">{{item.num}}人参加</view> -->
  28. </view>
  29. <view class="bottom-box-r" v-if="!item.openState" @click="toZhaomu(item)">
  30. {{$t('components.zhaomu.zhaomuItem.joinRecruit')}}
  31. </view>
  32. <view class="bottom-box-r" v-else-if="item.openState == 3" @click="toZhaomu(item)">
  33. {{$t('components.zhaomu.zhaomuItem.rejected')}}
  34. </view>
  35. <view class="bottom-box-r" v-else>
  36. {{ [$t('components.zhaomu.zhaomuItem.reviewing'), $t('components.zhaomu.zhaomuItem.joined')][item.openState - 1] }}
  37. </view>
  38. </view>
  39. <view class="tabs-box" :class="item == 1? 'bzcx-item' : 'ycx-item'">
  40. {{item == 1? $t('components.zhaomu.zhaomuItem.guaranteed') : $t('components.zhaomu.zhaomuItem.confirmed')}}
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. props: {
  48. item: {
  49. type: Object,
  50. default: () => {}
  51. },
  52. },
  53. data() {
  54. return {
  55. iconTextArr: [],
  56. imgArr: [],
  57. urls: [
  58. 'https://cdn.uviewui.com/uview/album/1.jpg',
  59. 'https://cdn.uviewui.com/uview/album/2.jpg',
  60. 'https://cdn.uviewui.com/uview/album/3.jpg',
  61. ]
  62. };
  63. },
  64. watch: {
  65. item: {
  66. handler(val) {
  67. this.iconTextArr = val.iconText ? val.iconText.split(",") : [];
  68. this.imgArr = val.image ? val.image.split(",") : []
  69. this.urls = val.popularizeRecruitLogList;
  70. },
  71. immediate: true
  72. }
  73. },
  74. mounted() {},
  75. methods: {
  76. //订阅模版消息
  77. onSubscribeMessageTap(fn) {
  78. let templateIds = [
  79. 'SQd2axWZD7KCw3jkw--tumMz9-cmP_R2FUhJzByxrP8',
  80. ];
  81. wx.requestSubscribeMessage({
  82. tmplIds: templateIds, // 需要订阅的模板ID列表
  83. success(res) {
  84. fn && fn(res)
  85. console.log('订阅消息调用成功', res);
  86. // res[tmplId] 表示用户是否同意订阅该模板ID对应的消息
  87. // 例如:res['your_template_id_1'] === 'accept' 表示用户同意订阅
  88. templateIds.forEach(tmplId => {
  89. if (res[tmplId] === 'accept') {
  90. console.log(`用户同意订阅模板ID:${tmplId}`);
  91. // 这里可以添加用户同意后的逻辑,比如发送消息等(注意:发送消息需要在后端进行)
  92. } else if (res[tmplId] === 'reject') {
  93. console.log(`用户拒绝订阅模板ID:${tmplId}`);
  94. } else {
  95. console.log(`用户对该模板ID的订阅请求:${res[tmplId]}`); // 'ban' 表示用户被禁止订阅该模板
  96. }
  97. });
  98. },
  99. fail(err) {
  100. console.error('订阅消息调用失败', err);
  101. }
  102. });
  103. },
  104. skip(val) {
  105. uni.navigateTo({
  106. url: '/pages_order/orderDetails'
  107. })
  108. },
  109. toZhaomu(item) {
  110. let params = {
  111. recruitId: item.id,
  112. }
  113. this.onSubscribeMessageTap(res => {
  114. this.$api('shopUserAuth', params, res => {
  115. this.$emit('getData')
  116. if (res.code == 200) {
  117. this.$Toast(this.$t('components.zhaomu.zhaomuItem.joinSuccess'))
  118. }
  119. })
  120. })
  121. }
  122. }
  123. };
  124. </script>
  125. <style scoped lang="scss">
  126. .cardList {
  127. .container {
  128. margin-bottom: 30rpx;
  129. border-radius: 20rpx;
  130. background: #1B1713;
  131. position: relative;
  132. .content {
  133. display: flex;
  134. padding: 24rpx 35rpx;
  135. border-bottom: 1px solid #2A2A2A;
  136. .left {
  137. image {
  138. width: 228rpx;
  139. height: 228rpx;
  140. border-radius: 20rpx;
  141. }
  142. }
  143. .right {
  144. display: flex;
  145. flex-direction: column;
  146. justify-content: space-between;
  147. flex: 1;
  148. margin-left: 23rpx;
  149. color: $uni-text-color-grey;
  150. font-size: 24rpx;
  151. .detailed {
  152. .title {
  153. font-size: 32rpx;
  154. color: #fff;
  155. padding-top: 11rpx;
  156. }
  157. .date {
  158. padding: 25rpx 0 19rpx;
  159. display: flex;
  160. align-items: center;
  161. &::before {
  162. content: '';
  163. display: block;
  164. background: url('@/static/image/cart/timeIcon.png') no-repeat;
  165. background-size: 100% 100%;
  166. width: 24rpx;
  167. height: 24rpx;
  168. margin-right: 10rpx;
  169. }
  170. }
  171. .address {
  172. display: flex;
  173. margin-bottom: 10rpx;
  174. .img-box {
  175. width: 22rpx;
  176. height: 26rpx;
  177. margin-right: 10rpx;
  178. flex-shrink: 0;
  179. image {
  180. width: 100%;
  181. height: 100%;
  182. }
  183. }
  184. }
  185. }
  186. .tips-box {
  187. display: flex;
  188. align-items: center;
  189. flex-wrap: wrap;
  190. .tips-box-item {
  191. padding: 0 24rpx;
  192. height: 38rpx;
  193. line-height: 38rpx;
  194. background: #282421;
  195. border-radius: 7rpx;
  196. font-size: 20rpx;
  197. color: #999999;
  198. margin-right: 14rpx;
  199. margin-bottom: 5px;
  200. &:last-child {
  201. margin-right: 0;
  202. }
  203. }
  204. }
  205. }
  206. }
  207. .bottom-box {
  208. display: flex;
  209. align-items: center;
  210. justify-content: space-between;
  211. height: 104rpx;
  212. padding: 0 21rpx;
  213. &-l {
  214. display: flex;
  215. align-items: center;
  216. .num {
  217. font-weight: 500;
  218. font-size: 25rpx;
  219. color: #999999;
  220. margin-left: 20rpx;
  221. }
  222. }
  223. &-r {
  224. width: 180rpx;
  225. height: 53rpx;
  226. background: url('@/static/image/member/canyu-bg.png') no-repeat;
  227. background-size: 100% 100%;
  228. font-weight: 500;
  229. font-size: 23rpx;
  230. color: #FFFFFF;
  231. text-align: center;
  232. line-height: 53rpx;
  233. }
  234. }
  235. .tabs-box {
  236. position: absolute;
  237. top: 0;
  238. right: 0;
  239. width: 117rpx;
  240. height: 40rpx;
  241. font-weight: 500;
  242. font-size: 21rpx;
  243. text-align: center;
  244. line-height: 40rpx;
  245. }
  246. .bzcx-item {
  247. background: url('@/static/image/member/bzcx-bg.png') no-repeat;
  248. background-size: 100% 100%;
  249. color: #FF9000;
  250. }
  251. .ycx-item {
  252. background: url('@/static/image/member/ycx-bg.png') no-repeat;
  253. background-size: 100% 100%;
  254. color: #FF3B47;
  255. }
  256. }
  257. }
  258. </style>