index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <view class="pages">
  3. <view class="task_top">
  4. <!-- 用户信息 -->
  5. <view class="task_top_infor">
  6. <view class="task_top_user">
  7. <view class="task_top_user_le">
  8. <image :src="avatar?avatar:'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'" mode=""></image>
  9. </view>
  10. <view class="task_top_user_ce">
  11. {{userName?userName:'匿名'}}
  12. </view>
  13. <!-- <view class="task_top_user_ri">
  14. <image src="../static/task/level.png" mode=""></image>
  15. <view>LV.1</view>
  16. </view> -->
  17. </view>
  18. <!-- <view class="task_top_text">经验值:0/299</view> -->
  19. <view class="task_top_text">当前积分:{{integral}}</view>
  20. </view>
  21. <!-- 周期任务 -->
  22. <view class="task_top_task">
  23. <view class="task_top_text2">每日任务</view>
  24. <view class="task_top_task_sty">
  25. <view class="task_top_task_sty_le">
  26. <view class="task_top_task_sty_le_to">
  27. <view class="task_top_task_sty_le_to_le">
  28. 每日签到
  29. </view>
  30. <view class="task_top_task_sty_le_to_ri">+{{todayIntegral}}</view>
  31. <view class="task_top_task_img">
  32. <image src="../static/task/goldcoins.png" mode=""></image>
  33. </view>
  34. </view>
  35. <view class="task_top_text3">已连续签到{{today.dayNum}}天</view>
  36. </view>
  37. <view class="task_top_task_sty_ri" v-if="isSignIn">
  38. 已签到
  39. </view>
  40. <view class="task_top_task_sty_ri2" v-else @click="check">
  41. 签到
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="bg-white margin-lr margin-top padding-sm radius" style="text-align: left;padding-bottom: 10rpx;"
  47. v-if="list.length">
  48. <view v-for="(item, index) in list" :key="index" class="item">
  49. <view>
  50. <view style="color: #999999;font-size: 28upx;">
  51. <view style="margin-bottom: 8upx">{{item.title}}</view>
  52. <view style="margin-bottom: 8upx">{{item.content}}</view>
  53. <view style="margin-bottom: 8upx"> 创建时间:{{item.createTime}}</view>
  54. <view style="margin-bottom: 8upx;text-align: right;">
  55. <text v-if="item.type == 1" style="color: #ecd4b4;font-size: 32upx;font-weight: 600"><text
  56. class="text-olive">+</text>{{item.num}}积分</text>
  57. <text v-if="item.type == 2" style="color: #ecd4b4;font-size: 32upx;font-weight: 600"><text
  58. class="text-red">-</text>{{item.num}}积分</text>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <empty v-if="list.length == 0" content="暂无明细"></empty>
  65. <!-- 成长任务 -->
  66. <!-- <view class="task_top">
  67. <view class="task_top_task">
  68. <view class="task_top_text2">成长任务</view>
  69. <view class="task_top_task_sty">
  70. <view class="task_top_task_sty_le">
  71. <view class="task_top_task_sty_le_to">
  72. <view class="task_top_task_sty_le_to_le">
  73. 每日签到
  74. </view>
  75. <view class="task_top_task_sty_le_to_ri">+75</view>
  76. <view class="task_top_task_img">
  77. <image src="../static/task/goldcoins.png" mode=""></image>
  78. </view>
  79. </view>
  80. <view class="task_top_text3">完成0/10</view>
  81. </view>
  82. <view class="task_top_task_sty_ri2">
  83. 未完成
  84. </view>
  85. </view>
  86. </view>
  87. </view> -->
  88. </view>
  89. </template>
  90. <script>
  91. import empty from '@/components/empty';
  92. export default {
  93. components: {
  94. empty
  95. },
  96. data() {
  97. return {
  98. userName: '匿名',
  99. avatar: '',
  100. isSignIn: false,
  101. integral: 0,
  102. todayIntegral: 0, //今日签到应得分数
  103. list: [],
  104. page: 1,
  105. limit: 10,
  106. today: {},
  107. totalCount: ''
  108. }
  109. },
  110. onLoad() {
  111. this.getUserInfo()
  112. this.getIsSignIn()
  113. this.getIntegral()
  114. this.getTodayIntegral()
  115. this.getToday()
  116. this.getList()
  117. },
  118. methods: {
  119. getUserInfo() {
  120. this.$Request.get("/app/user/selectUserMessage").then(res => {
  121. if (res.code == 0) {
  122. this.userName = res.data.userName?res.data.userName:res.data.nickName
  123. this.avatar = res.data.avatar
  124. }
  125. });
  126. },
  127. // 我的积分
  128. getIntegral() {
  129. this.$Request.get("/app/userintegral/findUserMessage").then(res => {
  130. if (res.code == 0) {
  131. this.integral = res.data.userIntegral
  132. }
  133. });
  134. },
  135. // 是否签到
  136. getIsSignIn() {
  137. this.$Request.get("/app/userintegral/isSignIn").then(res => {
  138. if (res.code == 0) {
  139. this.isSignIn = res.data == '今日未签到' ? false : true
  140. }
  141. });
  142. },
  143. // 获取今日签到应得分数
  144. getTodayIntegral() {
  145. this.$Request.get("/app/userintegral/todayIntegral").then(res => {
  146. if (res.code == 0) {
  147. this.todayIntegral = res.data
  148. }
  149. });
  150. },
  151. // 获取今日签到天数
  152. getToday() {
  153. this.$Request.get("/app/userintegral/continuousDay").then(res => {
  154. if (res.code == 0) {
  155. this.today = res.data
  156. }
  157. });
  158. },
  159. // 签到
  160. check() {
  161. this.$Request.get("/app/userintegral/signIn").then(res => {
  162. if (res.code == 0) {
  163. // this.todayIntegral = res.data
  164. this.isSignIn = true
  165. uni.showToast({
  166. title: '签到成功',
  167. icon: 'none'
  168. })
  169. this.getIntegral()
  170. this.getList()
  171. this.getToday()
  172. }
  173. });
  174. },
  175. getList() {
  176. let data = {
  177. page: this.page,
  178. limit: this.limit,
  179. classify: 1
  180. }
  181. this.$Request.getT('/app/userintegraldetails/selectIntegraldetailsList', data).then(res => {
  182. if (res.code === 0) {
  183. this.totalCount = res.data.totalCount
  184. if (this.page === 1) {
  185. this.list = res.data.list;
  186. } else {
  187. this.list = [...this.list, ...res.data.list];
  188. }
  189. }
  190. uni.stopPullDownRefresh();
  191. uni.hideLoading();
  192. });
  193. }
  194. },
  195. onReachBottom: function() {
  196. // this.page = this.page + 1;
  197. // this.getList();
  198. if(this.list.length<this.totalCount) {
  199. this.page = this.page + 1;
  200. this.getList()
  201. } else {
  202. uni.showToast({
  203. title: '已经到底了',
  204. icon: 'none'
  205. })
  206. }
  207. },
  208. }
  209. </script>
  210. <style scoped>
  211. .task_top {
  212. width: 100%;
  213. overflow: hidden;
  214. /* margin: 3% 0; */
  215. background-color: #FFFFFF;
  216. }
  217. /* 用户信息 */
  218. .task_top_infor {
  219. width: 94%;
  220. overflow: hidden;
  221. margin: 4% auto 0;
  222. padding: 2% 3%;
  223. background: linear-gradient(90deg, #F4DAA7 0%, #E2BC7E 100%);
  224. border-radius: 18rpx;
  225. }
  226. .task_top_user {
  227. display: flex;
  228. }
  229. .task_top_user_le image {
  230. width: 80rpx;
  231. height: 80rpx;
  232. border-radius: 50%;
  233. }
  234. .task_top_user_ce {
  235. padding-left: 2%;
  236. font-size: 38rpx;
  237. font-weight: 500;
  238. color: #333333;
  239. line-height: 2;
  240. }
  241. .task_top_user_ri {
  242. margin: 3% 0 0 2%;
  243. }
  244. .task_top_user_ri image {
  245. width: 118rpx;
  246. height: 34rpx;
  247. }
  248. .task_top_user_ri view {
  249. position: relative;
  250. bottom: 43rpx;
  251. left: 45rpx;
  252. font-size: 24rpx;
  253. font-weight: 800;
  254. color: #D3B17B;
  255. }
  256. .task_top_text {
  257. color: #FFFFFF;
  258. line-height: 2;
  259. }
  260. /* 周期任务 */
  261. .task_top_task {
  262. width: 94%;
  263. overflow: hidden;
  264. margin: 3% auto 0;
  265. }
  266. .task_top_text2 {
  267. font-size: 34rpx;
  268. font-weight: bold;
  269. color: #333333;
  270. /* margin-bottom: 2%; */
  271. /* line-height: 32rpx; */
  272. }
  273. .task_top_task_sty {
  274. width: 100%;
  275. overflow: hidden;
  276. background: #FCFBF5;
  277. border-radius: 18rpx;
  278. display: flex;
  279. padding: 4% 3%;
  280. margin: 3% 0;
  281. }
  282. .task_top_task_sty_le {
  283. width: 80%;
  284. }
  285. .task_top_task_sty_le_to {
  286. display: flex;
  287. margin: 2% 0;
  288. }
  289. .task_top_task_sty_le_to_le {
  290. width: 150rpx;
  291. font-family: PingFang SC;
  292. font-weight: bold;
  293. color: #333333;
  294. }
  295. .task_top_task_sty_le_to_ri {
  296. width: 110rpx;
  297. height: 40rpx;
  298. background: rgba(255, 247, 226, 0.5);
  299. border: 2rpx solid #FFA800;
  300. /* border-right: 2rpx solid #FFA800; */
  301. border-radius: 50rpx;
  302. text-align: right;
  303. color: #FFA800;
  304. padding-right: 2%;
  305. }
  306. .task_top_task_img image {
  307. width: 36rpx;
  308. height: 36rpx;
  309. position: relative;
  310. right: 110rpx;
  311. top: 2rpx;
  312. }
  313. .task_top_text3 {
  314. font-size: 26upx;
  315. /* font-family: PingFang SC; */
  316. font-weight: 500;
  317. color: #999999;
  318. }
  319. .task_top_text3 text {
  320. color: #FF130A;
  321. }
  322. .task_top_task_sty_ri {
  323. width: 20%;
  324. border: 2rpx solid #999999;
  325. height: 50rpx;
  326. line-height: 50rpx;
  327. color: #999999;
  328. text-align: center;
  329. font-size: 28upx;
  330. border-radius: 18rpx;
  331. /* margin: 6% 0; */
  332. }
  333. .task_top_task_sty_ri2 {
  334. width: 20%;
  335. border: 2rpx solid #FF130A;
  336. height: 50rpx;
  337. color: #FF130A;
  338. text-align: center;
  339. line-height: 50rpx;
  340. font-size: 28upx;
  341. border-radius: 8px;
  342. /* margin: 6% 0; */
  343. }
  344. </style>