金诚优选前端代码
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.

212 lines
4.7 KiB

  1. <template>
  2. <view class="page">
  3. <lf-nav title="会员码" bgColor="transparent" :spreadOut="false" titleColor="#fff" :showIcon="true"></lf-nav>
  4. <view class="bg-viewleft"></view>
  5. <view class="bg-viewright"></view>
  6. <view class="content">
  7. <view class="top">
  8. <view class="lf-flex">
  9. <view class="avatar">
  10. <image src="https://picsum.photos/200"></image>
  11. </view>
  12. <view class="phone">182****5380</view>
  13. </view>
  14. <view class="card">
  15. <text class="lf-iconfont icon--1"></text>
  16. </view>
  17. </view>
  18. <view class="balance">余额 ¥1829.83</view>
  19. <view class="barcode">
  20. <lf-barcode :options="config.bar"></lf-barcode>
  21. </view>
  22. <view class="qrcode">
  23. <lf-qrcode :options="config.qrc"></lf-qrcode>
  24. </view>
  25. <view class="tips">{{ num }}s后自动刷新</view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import lfBarcode from '@/components/lf-code/lf-barcode.vue';
  31. import lfQrcode from '@/components/lf-code/lf-qrcode.vue';
  32. export default {
  33. components: {
  34. lfBarcode,
  35. lfQrcode
  36. },
  37. data(){
  38. return {
  39. config: {
  40. bar: {
  41. code: 'E01181016286106',
  42. color: '#000', // 条形码的颜色
  43. bgColor: '#FFFFFF', // 背景色
  44. width: 586, // 宽度
  45. height: 210 // 高度
  46. },
  47. qrc: {
  48. code: "https://weixin.qq.com/g/AwYAAHO3aO4zlasEij6bLsk4hlZd5XNFkkBmqyS55mLPFxmn5c9PaI1omqLhd24fABCD23333",
  49. size: 352, // 二维码大小
  50. level: 4, //等级 0~4
  51. bgColor: '#FFFFFF', //二维码背景色 默认白色
  52. // border: {
  53. // color: ['#8A2387', '#F27121'], //边框颜色支持渐变色
  54. // lineWidth: 3, //边框宽度
  55. // },
  56. // img: '/static/logo.png', //图片
  57. // iconSize: 40, //二维码图标的大小
  58. color: '#000000', //边框颜色支持渐变色
  59. }
  60. },
  61. timer: null,
  62. num: 90
  63. }
  64. },
  65. onLoad(){
  66. this.refreshCode();
  67. // 设置手机屏幕亮度
  68. uni.getScreenBrightness({
  69. success: (res) => {
  70. this.brightness = res.value;
  71. let value = res.value < 0.7 ? 0.7 : res.value;
  72. uni.setScreenBrightness({
  73. value: value
  74. })
  75. }
  76. })
  77. },
  78. onUnload(){
  79. if(this.timer){
  80. clearInterval(this.timer);
  81. this.timer = null;
  82. }
  83. uni.setScreenBrightness({
  84. value: this.brightness
  85. })
  86. },
  87. methods: {
  88. // rpx 转 px
  89. rpxTransformPx(num){
  90. let systemInfo = uni.getSystemInfoSync();
  91. let pxWidth = num / 750 * systemInfo.windowWidth;
  92. return pxWidth;
  93. },
  94. // 刷新code
  95. refreshCode(){
  96. if(this.timer){
  97. clearInterval(this.timer);
  98. this.timer = null;
  99. }
  100. this.timer = setInterval(() => {
  101. this.num--;
  102. if(this.num <= 0){
  103. clearInterval(this.timer);
  104. this.timer = null;
  105. this.num = 90;
  106. this.refreshCode(); // 重新执行
  107. }
  108. }, 1000);
  109. }
  110. }
  111. }
  112. </script>
  113. <style>
  114. page{
  115. overflow: hidden;
  116. }
  117. </style>
  118. <style lang="scss" scoped="scoped">
  119. .page{
  120. width: 100vw;
  121. height: 100vh;
  122. background: linear-gradient(270deg, #187B7A 0%, #2FAAA7 100%, #22A2A0 100%);
  123. position: relative;
  124. overflow: hidden;
  125. .bg-viewleft{
  126. position: absolute;
  127. left: -100rpx;
  128. top: 59rpx;
  129. width: 585rpx;
  130. height: 585rpx;
  131. border-radius: 50%;
  132. background-color: rgba(255,255,255,0.04);
  133. }
  134. .bg-viewright{
  135. position: absolute;
  136. right: -38rpx;
  137. top: 102rpx;
  138. width: 127rpx;
  139. height: 127rpx;
  140. border-radius: 50%;
  141. background-color: rgba(255,255,255,0.04);
  142. }
  143. .content{
  144. position: absolute;
  145. top: 260rpx;
  146. left: calc(50% - 343rpx);
  147. width: 686rpx;
  148. height: 986rpx;
  149. background: #FFFFFF;
  150. border-radius: 20rpx;
  151. .top{
  152. display: flex;
  153. justify-content: space-between;
  154. padding: 0 40rpx;
  155. width: 100%;
  156. box-sizing: border-box;
  157. align-items: center;
  158. margin-top: -20rpx;
  159. .avatar{
  160. width: 160rpx;
  161. height: 160rpx;
  162. border-radius: 50%;
  163. background-color: #FFFFFF;
  164. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(21, 113, 110, 0.2);
  165. border: 5rpx solid #FFFFFF;
  166. display: flex;
  167. justify-content: center;
  168. align-items: center;
  169. margin-right: 20rpx;
  170. &>image{
  171. width: 148rpx;
  172. height: 148rpx;
  173. border-radius: 50%;
  174. }
  175. }
  176. .phone{
  177. font-size: 36rpx;
  178. font-weight: bold;
  179. color: #15716E;
  180. }
  181. .card{
  182. padding: 10rpx 20rpx;
  183. &>text{
  184. font-size: 40rpx;
  185. color: #15716E;
  186. }
  187. }
  188. }
  189. .balance{
  190. font-size: 32rpx;
  191. color: #555555;
  192. text-align: center;
  193. font-weight: bold;
  194. margin-top: 60rpx;
  195. line-height: 1;
  196. }
  197. .barcode, .qrcode{
  198. display: flex;
  199. justify-content: center;
  200. margin-top: 30rpx;
  201. }
  202. .tips{
  203. font-size: 24rpx;
  204. color: #777777;
  205. text-align: center;
  206. margin-top: 30rpx;
  207. }
  208. }
  209. }
  210. </style>