index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <app-layout>
  3. <view class="container">
  4. <view class="header">
  5. <view class="bg"></view>
  6. <view class="info main-left cross-center">
  7. <view class="head-img">
  8. <u-image
  9. width="150"
  10. height="150"
  11. :src="vuex_user_data.head_img"
  12. shape="circle"></u-image>
  13. </view>
  14. <view class="share-box dir-top-wrap">
  15. <view class="nickname">{{vuex_user_data.nickname}}</view>
  16. <view class="recommend" v-if="userData.parent">推荐人:{{userData.parent.nickname}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="item-group dir-left-wrap">
  21. <view class="item-box dir-top-wrap cross-center main-center"
  22. v-for="(item,index) in shareTool"
  23. @click="handleItemClick(index)"
  24. >
  25. <u-button type="primary" open-type="share" v-if="item.share"
  26. :custom-style="{backgroundColor: 'transparent',borderColor: 'unset'}"
  27. hover-class="none"
  28. >
  29. <u-image
  30. width="90"
  31. height="90"
  32. mode="aspectFit"
  33. :src="item.icon"></u-image>
  34. </u-button>
  35. <view class="icon" v-else>
  36. <u-image
  37. width="90"
  38. height="90"
  39. mode="aspectFit"
  40. :src="item.icon"></u-image>
  41. </view>
  42. <view class="title">{{item.title}}</view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="qrcode-modal" :class="{show:qrCodeModal.show}">
  47. <view class="content">
  48. <view class="qrcode-modal-content dir-top-wrap cross-center">
  49. <view class="head-img">
  50. <u-image
  51. width="150"
  52. height="150"
  53. :src="userData.head_img"
  54. shape="circle"></u-image>
  55. </view>
  56. <view class="nickname">{{userData.nickname}}</view>
  57. <u-line class="u-line" border-style="dashed" length="90%"></u-line>
  58. <view class="qrcode">
  59. <u-image
  60. width="320"
  61. height="320"
  62. :src="userData.share_qrcode"
  63. ></u-image>
  64. </view>
  65. </view>
  66. <u-button shape="circle"
  67. @click="handleSave"
  68. hover-class="none"
  69. :custom-style="{
  70. background:'linear-gradient(90deg, rgba(4,153,140,1) 0%, rgba(4,153,128,1) 100%, rgba(14,175,160,.5) 100%)',
  71. boxShadow: '0 0 20rpx rgba(13,239,250,.3)',
  72. borderColor:'none',
  73. color: '#ffffff',
  74. marginTop: '50rpx'}">确定</u-button>
  75. </view>
  76. </view>
  77. </app-layout>
  78. </template>
  79. <script>
  80. import appLayout from "@/components/app-layout"
  81. export default {
  82. components:{
  83. appLayout,
  84. },
  85. data() {
  86. return {
  87. shareTool: [
  88. {icon:'/static/images/price.png',title:'佣金',url:'/pages/price/index'},
  89. {icon:'/static/images/withdraw.png',title:'佣金提现明细',url:'/pages/withdraw/index'},
  90. {icon:'/static/images/list.png',title:'推广列表',url:'/pages/share/list'},
  91. {icon:'/static/images/income.png',title:'收益列表',url:'/pages/income/index'},
  92. {icon:'/static/images/share.png',title:'推广分享',method: this.handleShare,share: true},
  93. {icon:'/static/images/qrcode.png',title:'推广二维码',url:'',method: this.handleQrCode},
  94. ],
  95. qrCodeModal:{
  96. show: false
  97. },
  98. userData: {}
  99. }
  100. },
  101. methods: {
  102. handleItemClick(index){
  103. let item = this.shareTool[index];
  104. if(typeof item.method === "function"){
  105. item.method();
  106. }else{
  107. this.$jump({url:item.url,type:'to'});
  108. }
  109. },
  110. handleQrCode(){
  111. this.qrCodeModal.show = true
  112. },
  113. handleShare(){
  114. this.$util.share(this.vuex_user_data);
  115. // this.$u.toast('推广分享')
  116. },
  117. getUser(){
  118. this.$u.api.userGet().then(data => {
  119. this.userData = data;
  120. })
  121. },
  122. handleSave(){
  123. this.$util.saveImage(this.userData.share_qrcode).then(res => {
  124. this.qrCodeModal.show = false
  125. })
  126. }
  127. },
  128. onLoad(){
  129. this.getUser();
  130. },
  131. onShareAppMessage() {
  132. return this.$util.shareMessage(this.vuex_user_data);
  133. },
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .container{
  138. padding: 0;
  139. .header{
  140. position: relative;
  141. padding: 0 30rpx;
  142. .bg{
  143. position: absolute;
  144. background: url("@/static/images/share-bg.png") no-repeat top;
  145. background-size: 100% 120%;
  146. background-position: 0 -10rpx;
  147. height: 240rpx;
  148. left: 0;
  149. top: 0;
  150. width: 750rpx;
  151. z-index: 0;
  152. }
  153. .info{
  154. height: 240rpx;
  155. position: relative;
  156. color: #ffffff;
  157. z-index: 1;
  158. }
  159. .share-box{
  160. padding: 0 30rpx;
  161. .nickname{
  162. font-size: 36rpx;
  163. padding: 6rpx 0;
  164. }
  165. }
  166. }
  167. .item-group{
  168. margin: 30rpx 0;
  169. .item-box{
  170. width: 330rpx;
  171. background: #ffffff;
  172. border-radius: 16rpx;
  173. margin-bottom: 30rpx;
  174. margin-left: 30rpx;
  175. height: 260rpx;
  176. .title{
  177. color: #455150;
  178. font-size: 28rpx;
  179. font-weight: bold;
  180. padding: 16rpx 0;
  181. }
  182. }
  183. }
  184. }
  185. .qrcode-modal{
  186. position: fixed;
  187. top: 0;
  188. left: 0;
  189. width: 750rpx;
  190. height: 100vh;
  191. background: rgba(0,0,0,.35);
  192. z-index: 999;
  193. display: none;
  194. animation: show-modal linear .5s;
  195. &.show{
  196. display: block;
  197. }
  198. .content{
  199. position: absolute;
  200. width: 600rpx;
  201. top: 50%;
  202. left: 50%;
  203. transform: translate(-50%,-50%);
  204. .qrcode-modal-content{
  205. position: relative;
  206. width: 100%;
  207. height: 50vh;
  208. background: url("@/static/images/share-qrcode-bg.png") no-repeat center;
  209. background-size: 100% 100%;
  210. .head-img{
  211. position: absolute;
  212. top: -75rpx;
  213. }
  214. .nickname{
  215. position: absolute;
  216. color: #ffffff;
  217. top: 15%;
  218. font-size: 34rpx;
  219. }
  220. .u-line{
  221. position: absolute;
  222. top: 28.55%;
  223. }
  224. .qrcode{
  225. position: absolute;
  226. top: 35%;
  227. }
  228. }
  229. }
  230. }
  231. @keyframes show-modal {
  232. 0%{opacity: 0;}
  233. 100%{opacity: 1;}
  234. }
  235. </style>