猫妈狗爸伴宠师小程序前端代码
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.

197 lines
4.2 KiB

2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="box w-100 h100">
  3. <view class="header-info">
  4. <view class="base flex-rowl">
  5. <up-image width="120rpx" height="120rpx" :src="state.baseInfo.upgrade_image" shape="circle"></up-image>
  6. <view class="flex-colt">
  7. <view class="size-32 mb16">
  8. {{state.baseInfo.info.userName}}
  9. </view>
  10. <view class="title size-22 color-fff">
  11. {{state.baseInfo.partner_level}}
  12. </view>
  13. <view class="color-a55 size-24 mt16" v-html="state.baseInfo.level_details">
  14. </view>
  15. </view>
  16. </view>
  17. <view class="tips flex-between">
  18. <view class="flex-between tips-item">
  19. <view class="flex-colc item">
  20. <view class="size-30 color-a55 fw700">
  21. 推广攻略
  22. </view>
  23. <view class="size-22 color-a55 mt20">
  24. 快速定位宠友群体
  25. </view>
  26. </view>
  27. <image :src="icon1" mode=""></image>
  28. </view>
  29. <view class="flex-between tips-item">
  30. <view class="flex-colc item">
  31. <view class="size-30 color-a55 fw700">
  32. 推广教程
  33. </view>
  34. <view class="size-22 color-a55 mt20">
  35. 快速定位宠友群体
  36. </view>
  37. </view>
  38. <image :src="icon2" mode=""></image>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="cards bg-fff">
  43. <YCard :data="state.code" @emitCopy="copyCode" />
  44. <YCard :data="cardData1" @emitShare="shareHandle" @savePoster="savePoster" />
  45. <YCard :data="cardData2" @emitCopy="copyCode" />
  46. </view>
  47. </view>
  48. </template>
  49. <script setup>
  50. import {
  51. binBaseInfo,
  52. bindCode
  53. } from "@/api/home.js"
  54. import {
  55. onMounted,
  56. reactive,
  57. ref
  58. } from "vue"
  59. import YCard from "../components/y-card.vue"
  60. const icon1 = ref('/static/images/levelImage/gl.png')
  61. const icon2 = ref('/static/images/levelImage/jc.png')
  62. const shareRef = ref('share')
  63. const cardData = {
  64. methodNum: "方法一",
  65. title: "邀请码邀请",
  66. des: "用户输入邀请码,直接完成绑定。",
  67. inputBg: "#FDD6CE",
  68. titleColour: "#BC796C",
  69. copy: true,
  70. bgUrl: '/static/images/levelImage/bg1.png',
  71. code: 'jsk6623'
  72. }
  73. const cardData1 = {
  74. methodNum: "方法二",
  75. title: "分享海报邀请码",
  76. des: "扫码进去猫妈狗爸完成绑定",
  77. titleColour: "#5D81A4",
  78. copy: false,
  79. bgUrl: '/static/images/levelImage/bg2.png'
  80. }
  81. const cardData2 = {
  82. methodNum: "方法三",
  83. title: "分享链接邀请码",
  84. des: "复制链接给好友,进入直接绑定。",
  85. inputBg: "#FDD69A",
  86. titleColour: "#B36F3C",
  87. copy: true,
  88. bgUrl: '/static/images/levelImage/bg3.png',
  89. code: 'https://fanyi.baidu.com/mtpe-individual/multimodal?query=%E6%94%BB%E7%95%A5%0A&lang=zh2en&ext_channel=Aldtype'
  90. }
  91. const state = reactive({
  92. info: {},
  93. baseInfo: {},
  94. code: {},
  95. posterUrl: ""
  96. })
  97. onMounted(() => {
  98. const info = uni.getStorageSync("baseInfo")
  99. if (info) {
  100. const baseInfo = JSON.parse(info)
  101. state.info = baseInfo
  102. }
  103. getBaseInfo()
  104. })
  105. // 获取基本信息
  106. const getBaseInfo = () => {
  107. binBaseInfo(state.info.userId).then(res => {
  108. state.baseInfo = res.data
  109. })
  110. bindCode(state.info.userId).then(res => {
  111. state.code = {
  112. ...cardData,
  113. code: res.data.code
  114. }
  115. state.posterUrl = res.data.url
  116. })
  117. }
  118. // 保存海报
  119. const savePoster = () => {
  120. uni.navigateTo({
  121. url: "/otherPages/binding/share/index?url=" + state.posterUrl
  122. })
  123. }
  124. const copyCode = (v) => {
  125. console.log(v, "ppp");
  126. }
  127. const shareHandle = () => {
  128. console.log("分享海报");
  129. }
  130. </script>
  131. <style scoped lang="scss">
  132. .box {
  133. background: linear-gradient(180deg, #ffbf60, #f3b962 50%, #ffe6bf);
  134. .header-info {
  135. padding: 23rpx 36rpx;
  136. .base {
  137. image {
  138. width: 139rpx;
  139. height: 139rpx;
  140. background-color: red;
  141. border-radius: 50%;
  142. margin-right: 20rpx;
  143. }
  144. }
  145. .title {
  146. border: 4rpx solid #fff;
  147. border-radius: 30rpx;
  148. padding: 0 10rpx;
  149. background-color: #FFA848;
  150. }
  151. .tips {
  152. margin-top: 45rpx;
  153. .tips-item {
  154. width: 309rpx;
  155. background-color: #FFF4E6;
  156. border-radius: 16rpx;
  157. padding: 12rpx 0;
  158. .item {
  159. width: 176rpx;
  160. padding-left: 17rpx;
  161. }
  162. }
  163. image {
  164. width: 72rpx;
  165. height: 78rpx;
  166. margin: 0 30rpx 0 0;
  167. // background-color: red;
  168. }
  169. }
  170. }
  171. .cards {
  172. border-radius: 16rpx;
  173. width: 750rpx;
  174. padding: 26rpx 33rpx;
  175. height: 100vh;
  176. }
  177. }
  178. </style>