index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view class="myContent">
  3. <!-- <image class="myBg" :src="imgObj.myBg" mode="scaleToFill" /> -->
  4. <view class="topTitle" :style="{ marginTop: navTop + 'rpx' }"
  5. >个人中心</view
  6. >
  7. <view class="userBox" :style="{ marginTop: navTop + 125 + 'rpx' }">
  8. <image class="avatar" :src="imgObj.user" mode="scaleToFill" />
  9. <view class="nickName">
  10. <text class="name">{{ phone || mobile || "用户昵称" }}</text>
  11. <text v-if="!phone && !mobile" class="login" @click="onLogin"
  12. >点击登录</text
  13. >
  14. </view>
  15. </view>
  16. <view class="dataBox" :style="{ marginTop: navTop + 290 + 'rpx' }">
  17. <view class="dataItem" v-for="(item, index) in list" :key="index">
  18. <view class="inside">
  19. <text class="label">{{ item.label }}</text
  20. ><br />
  21. <text>0</text>
  22. </view>
  23. <image :src="item.src" mode="scaleToFill" />
  24. </view>
  25. </view>
  26. <view class="content">
  27. <view style="margin: 26rpx 32rpx 0">
  28. <nearly-store-box></nearly-store-box>
  29. </view>
  30. <view class="toolBox">
  31. <view class="title"> 常用工具 </view>
  32. <view class="tools">
  33. <wd-cell is-link title="奖励记录" @click="toWinner">
  34. <template #icon>
  35. <image :src="imgObj.gift" mode="scaleToFill" />
  36. </template>
  37. <image
  38. style="width: 128rpx; height: 48rpx"
  39. :src="imgObj.with"
  40. mode="scaleToFill"
  41. class="custom-text"
  42. />
  43. </wd-cell>
  44. <wd-cell border is-link title="上传记录" @click="toUpLoad">
  45. <template #icon>
  46. <image :src="imgObj.page" mode="scaleToFill" />
  47. </template>
  48. </wd-cell>
  49. </view>
  50. </view>
  51. </view>
  52. <user-login-popup
  53. ref="loginRef"
  54. :path="path"
  55. @getPhone="getPhone"
  56. ></user-login-popup>
  57. </view>
  58. </template>
  59. <script setup lang="ts">
  60. import { onLoad, onShow } from "@dcloudio/uni-app";
  61. import { ref } from "vue";
  62. import { getNavTop } from "@/utils/system";
  63. import { paymentAPI } from "@/services/ams";
  64. import { getActivityData, isGetPhone, getMobile } from "@/utils/system";
  65. import UserLoginPopup from "@/components/userLoginPopup.vue";
  66. import NearlyStoreBox from "./components/nearlyStoreBox.vue";
  67. const imgObj = {
  68. user: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/user.png",
  69. int: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/int.png",
  70. coupon: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/coupon.png",
  71. gift: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/gift.png",
  72. page: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/page.png",
  73. with: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/with.png",
  74. myBg: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/myBg.png",
  75. };
  76. const list = [
  77. {
  78. label: "可用积分",
  79. src: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/int.png",
  80. num: 0,
  81. },
  82. {
  83. label: "优惠券",
  84. src: "https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/coupon.png",
  85. num: 0,
  86. },
  87. ];
  88. const navTop = ref<number>(0);
  89. const loginRef = <any>ref(null);
  90. const path = ref<string>("");
  91. const phone = uni.getStorageSync("phone");
  92. const toWinner = () => {
  93. path.value = "/pagesOne/record/winnerList";
  94. if (!isGetPhone()) {
  95. loginRef.value.show = true;
  96. } else {
  97. uni.navigateTo({
  98. url: "/pagesOne/record/winnerList",
  99. });
  100. }
  101. };
  102. const toUpLoad = () => {
  103. path.value = "/pagesOne/record/uploadList";
  104. if (!isGetPhone()) {
  105. loginRef.value.show = true;
  106. } else {
  107. uni.navigateTo({
  108. url: "/pagesOne/record/uploadList",
  109. });
  110. }
  111. };
  112. const mobile = ref<string>("");
  113. const onLogin = async (e: any) => {
  114. path.value = "";
  115. if (!isGetPhone()) {
  116. loginRef.value.show = true;
  117. }
  118. // setTimeout(() => {
  119. // mobile.value = uni.getStorageSync("phone");
  120. // console.log("--------------------", mobile.value);
  121. // }, 2000);
  122. // const data = await getMobile(e.detail.code, "");
  123. // console.log(data);
  124. };
  125. const getPhone = (res: string) => {
  126. mobile.value = res;
  127. };
  128. onLoad(() => {
  129. navTop.value = getNavTop();
  130. });
  131. onShow(() => {
  132. getActivityData();
  133. });
  134. // const onLogin = async () => {
  135. // let form = {
  136. // mobile: "18927563000",
  137. // password: "123456",
  138. // };
  139. // let res: any = await postLoginAPI(form);
  140. // if (res.code == 200) {
  141. // } else {
  142. // return uni.showToast({
  143. // title: res.msg,
  144. // icon: "none",
  145. // });
  146. // }
  147. // };
  148. </script>
  149. <style lang="scss" scoped>
  150. .myContent {
  151. font-family: PingFang SC;
  152. width: 100%;
  153. height: 100vh;
  154. background: url("https://qiuyu-daodian.oss-cn-beijing.aliyuncs.com/images/myBg.png")
  155. no-repeat top center;
  156. background-size: 100% 452rpx;
  157. // no-repeat center center / 100% 100%;
  158. overflow: hidden;
  159. // position: relative;
  160. // .myBg {
  161. // width: 100%;
  162. // height: 450rpx;
  163. // // position: absolute;
  164. // // top: 0;
  165. // // z-index: -1;
  166. // }
  167. view {
  168. box-sizing: border-box;
  169. }
  170. .content {
  171. background: #f7f8f9;
  172. width: 100%;
  173. height: 100vh;
  174. overflow: hidden;
  175. // margin-top: -150rpx;
  176. // position: relative;
  177. // z-index: -1;
  178. }
  179. .topTitle {
  180. color: #fff;
  181. font-size: 32rpx;
  182. font-weight: 500;
  183. width: 100%;
  184. height: 80rpx;
  185. line-height: 80rpx;
  186. text-align: center;
  187. position: fixed;
  188. top: 0;
  189. left: 0;
  190. }
  191. .userBox {
  192. padding: 0 50rpx;
  193. display: flex;
  194. color: #fff;
  195. align-items: center;
  196. position: absolute;
  197. top: 0;
  198. .avatar {
  199. width: 120rpx;
  200. height: 120rpx;
  201. margin-right: 32rpx;
  202. }
  203. .nickName {
  204. display: flex;
  205. flex-direction: column;
  206. justify-content: flex-start;
  207. font-size: 28rpx;
  208. }
  209. .name {
  210. font-weight: 500;
  211. font-size: 36rpx;
  212. margin-bottom: 20rpx;
  213. }
  214. }
  215. .dataBox {
  216. // margin: 64rpx 32rpx 26rpx;
  217. height: 192rpx;
  218. padding: 0 24rpx;
  219. border-radius: 24rpx;
  220. background: linear-gradient(
  221. 90deg,
  222. #ffd67a 0%,
  223. #ffedb0 45.92%,
  224. #fec669 100%
  225. );
  226. display: flex;
  227. justify-content: space-between;
  228. align-items: center;
  229. margin: auto 32rpx;
  230. // position: absolute;
  231. // left: 32rpx;
  232. // right: 32rpx;
  233. .dataItem {
  234. height: 144rpx;
  235. width: 49%;
  236. display: flex;
  237. justify-content: space-between;
  238. background: linear-gradient(180deg, #e5fff6 0%, #ffffff 100%);
  239. border-radius: 24rpx;
  240. padding: 26rpx 32rpx;
  241. color: #296041;
  242. font-size: 24rpx;
  243. font-weight: 500;
  244. .label {
  245. font-size: 32rpx;
  246. margin-bottom: 8rpx;
  247. }
  248. image {
  249. width: 92rpx;
  250. height: 92rpx;
  251. }
  252. }
  253. }
  254. .toolBox {
  255. margin: 26rpx 32rpx 0;
  256. background: #fff;
  257. border-radius: 16rpx;
  258. background: #fff;
  259. position: relative;
  260. .title {
  261. color: #000;
  262. font-weight: bold;
  263. font-size: 28rpx;
  264. padding: 24rpx 0 22rpx 24rpx;
  265. }
  266. image {
  267. height: 48rpx;
  268. width: 48rpx;
  269. margin-right: 24rpx;
  270. }
  271. ::v-deep .wd-cell__wrapper {
  272. display: flex;
  273. align-items: center;
  274. }
  275. ::v-deep .wd-cell__value {
  276. display: flex;
  277. align-items: center;
  278. justify-content: flex-end;
  279. }
  280. ::v-deep .wd-icon-arrow-right {
  281. margin-left: 0;
  282. }
  283. ::v-deep .wd-cell__title {
  284. color: #666;
  285. font-size: 28rpx;
  286. }
  287. .custom-text {
  288. // border: 2rpx solid;
  289. // margin-top: 5rpx;
  290. }
  291. }
  292. }
  293. </style>