signIn.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <common-wrapper :config="configData">
  3. <view class="signIn" :style="[signStyle]">
  4. <view
  5. v-if="dataConfig.styleConfig.tabVal"
  6. class="text-wrap acea-row row-middle"
  7. >
  8. <image
  9. src="@/static/images/sign-icon-04.png"
  10. mode="widthFix"
  11. class="image"
  12. ></image>
  13. <view class="text">
  14. <view class="name-wrap acea-row row-middle">
  15. <view class="name">{{ $t(`签到立即获取`) }}</view>
  16. <view class="num acea-row row-middle" :style="[numStyle]">
  17. <view
  18. class="inner acea-row row-middle"
  19. :class="{ opacity: !dataConfig.toneConfig.tabVal }"
  20. >
  21. <image
  22. src="@/static/images/sign-icon-01.png"
  23. mode="widthFix"
  24. class="icon"
  25. ></image>
  26. +{{ sign_give_point }}
  27. </view>
  28. </view>
  29. </view>
  30. <view
  31. >{{ $t(`连续签到`) }} {{ continuousSignDays || 0
  32. }}{{ $t(`天`) }}</view
  33. >
  34. </view>
  35. <view class="button" :style="[buttonStyle]" @click="goUserSgin">{{
  36. $t(`立即签到`)
  37. }}</view>
  38. </view>
  39. <view v-else class="week-wrap acea-row row-middle">
  40. <view class="week acea-row">
  41. <view
  42. v-for="(item, index) in signList"
  43. :key="index"
  44. class="item acea-row row-column row-center-wrapper"
  45. >
  46. <image
  47. v-if="item.is_sign"
  48. src="@/static/images/sign-icon-03.png"
  49. mode="widthFix"
  50. class="image"
  51. ></image>
  52. <image
  53. v-else-if="item.type == 1"
  54. src="@/static/images/sign-icon-01.png"
  55. mode="widthFix"
  56. class="image"
  57. ></image>
  58. <image
  59. v-else-if="item.type == 2"
  60. src="@/static/images/sign-icon-02.png"
  61. mode="widthFix"
  62. class="image"
  63. ></image>
  64. <view>{{ $t(`周`) }}{{ index | weekFormat }}</view>
  65. </view>
  66. </view>
  67. <view class="button" :style="[buttonStyle]" @click="goUserSgin">{{
  68. $t(`签到`)
  69. }}</view>
  70. </view>
  71. </view>
  72. </common-wrapper>
  73. </template>
  74. <script>
  75. import commonWrapper from "./commonWrapper.vue";
  76. import { getSign } from "@/api/api.js";
  77. export default {
  78. components: { commonWrapper },
  79. props: {
  80. dataConfig: {
  81. type: Object,
  82. default: () => {},
  83. },
  84. isSortType: {
  85. type: String | Number,
  86. default: 0,
  87. },
  88. },
  89. filters: {
  90. weekFormat: function (value) {
  91. return ["一", "二", "三", "四", "五", "六", "日"][value];
  92. },
  93. },
  94. data() {
  95. return {
  96. today: 0,
  97. signList: [],
  98. sign_give_point: 0,
  99. continuousSignDays: 0,
  100. nextContinuousSignRewardList: {},
  101. };
  102. },
  103. computed: {
  104. configData() {
  105. return {
  106. ...this.dataConfig,
  107. paddingConfig: this.dataConfig.paddingConfig || {
  108. isAll: false,
  109. valList: [
  110. {
  111. val: this.dataConfig.topConfig
  112. ? this.dataConfig.topConfig.val
  113. : 0,
  114. },
  115. {
  116. val: this.dataConfig.prConfig ? this.dataConfig.prConfig.val : 0,
  117. },
  118. {
  119. val: this.dataConfig.bottomConfig
  120. ? this.dataConfig.bottomConfig.val
  121. : 0,
  122. },
  123. {
  124. val: this.dataConfig.prConfig ? this.dataConfig.prConfig.val : 0,
  125. },
  126. ],
  127. },
  128. marginConfig: this.dataConfig.marginConfig || {
  129. isAll: false,
  130. valList: [
  131. {
  132. val: this.dataConfig.mbConfig ? this.dataConfig.mbConfig.val : 0,
  133. },
  134. {
  135. val: 0,
  136. },
  137. {
  138. val: 0,
  139. },
  140. {
  141. val: 0,
  142. },
  143. ],
  144. },
  145. };
  146. },
  147. buttonStyle() {
  148. let styleObject = {};
  149. if (this.dataConfig.toneConfig.tabVal) {
  150. styleObject[
  151. "background"
  152. ] = `linear-gradient(90deg, ${this.dataConfig.bntBgColor.color[0].item} 0%, ${this.dataConfig.bntBgColor.color[1].item} 100%)`;
  153. styleObject["color"] = this.dataConfig.bntTxtColor.color[0].item;
  154. }
  155. return styleObject;
  156. },
  157. signStyle() {
  158. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  159. if (this.dataConfig.fillet.type) {
  160. borderRadius = `${this.dataConfig.fillet.valList[0].val * 2}rpx ${
  161. this.dataConfig.fillet.valList[1].val * 2
  162. }rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx ${
  163. this.dataConfig.fillet.valList[2].val * 2
  164. }rpx`;
  165. }
  166. return {
  167. "border-radius": borderRadius,
  168. };
  169. },
  170. // signWrapStyle() {
  171. // return {
  172. // padding: `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.prConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
  173. // 'margin-top': `${this.dataConfig.mbConfig.val * 2}rpx`,
  174. // background: this.dataConfig.bottomBgColor.color[0].item
  175. // };
  176. // },
  177. numStyle() {
  178. let styleObject = {};
  179. if (this.dataConfig.toneConfig.tabVal) {
  180. styleObject["background"] = this.dataConfig.labelBgColor.color[0].item;
  181. styleObject["color"] = this.dataConfig.labelTxtColor.color[0].item;
  182. }
  183. return styleObject;
  184. },
  185. },
  186. mounted() {
  187. const t = new Date();
  188. const d = t.getDay();
  189. this.today = d;
  190. this.getSign();
  191. },
  192. methods: {
  193. goUserSgin() {
  194. uni.navigateTo({
  195. url: "/pages/users/user_sgin/index",
  196. });
  197. },
  198. getSign() {
  199. getSign().then((res) => {
  200. this.continuousSignDays = res.data.continuousSignDays;
  201. this.sign_give_point = res.data.signGivePoint;
  202. this.signList = res.data.signList[0];
  203. });
  204. },
  205. },
  206. };
  207. </script>
  208. <style lang="scss" scoped>
  209. .signIn {
  210. // padding: 24rpx;
  211. // border-radius: 0rpx 0rpx 16rpx 16rpx;
  212. // background: #ffffff;
  213. .week-wrap {
  214. height: 156rpx;
  215. // border-radius: 16rpx;
  216. // background: linear-gradient(to right, #ffe8f5, #f1fbfd);
  217. .week {
  218. flex: 1;
  219. font-weight: 500;
  220. font-size: 22rpx;
  221. line-height: 30rpx;
  222. color: #999999;
  223. .item {
  224. flex: 1;
  225. }
  226. .image {
  227. width: 48rpx;
  228. margin-bottom: 16rpx;
  229. }
  230. }
  231. .button {
  232. width: 88rpx;
  233. height: 48rpx;
  234. border-radius: 24rpx;
  235. margin: 0 20rpx;
  236. background: linear-gradient(
  237. 90deg,
  238. var(--view-theme) 0%,
  239. var(--view-gradient) 100%
  240. );
  241. text-align: center;
  242. font-size: 24rpx;
  243. line-height: 48rpx;
  244. color: #ffffff;
  245. }
  246. }
  247. .text-wrap {
  248. height: 140rpx;
  249. border-radius: 16rpx;
  250. background: #ffffff;
  251. .image {
  252. width: 88rpx;
  253. height: 88rpx;
  254. margin-left: 20rpx;
  255. }
  256. .text {
  257. flex: 1;
  258. padding: 0 20rpx;
  259. font-size: 24rpx;
  260. color: #999999;
  261. }
  262. .name-wrap {
  263. margin-bottom: 14rpx;
  264. }
  265. .name {
  266. font-weight: 500;
  267. font-size: 30rpx;
  268. color: #282828;
  269. }
  270. .num {
  271. border-radius: 16rpx;
  272. margin-left: 4rpx;
  273. background: var(--view-theme);
  274. font-size: 20rpx;
  275. line-height: 32rpx;
  276. color: var(--view-theme);
  277. .inner {
  278. height: 32rpx;
  279. padding: 0 6rpx 0 8rpx;
  280. border-radius: 16rpx;
  281. }
  282. .opacity {
  283. background: rgba(255, 255, 255, 0.9);
  284. }
  285. }
  286. .icon {
  287. width: 24rpx;
  288. height: 24rpx;
  289. }
  290. .button {
  291. width: 140rpx;
  292. height: 52rpx;
  293. border-radius: 26rpx;
  294. margin: 0 20rpx;
  295. background: linear-gradient(
  296. 90deg,
  297. var(--view-theme) 0%,
  298. var(--view-gradient) 100%
  299. );
  300. text-align: center;
  301. font-size: 24rpx;
  302. line-height: 52rpx;
  303. color: #ffffff;
  304. }
  305. }
  306. }
  307. </style>