DomData.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**
  2. *
  3. *
  4. * @param {*} number 第几位
  5. * @param {*} src 名片头像
  6. * @param {*} name 名片名字
  7. * @param {*} qrCodeUrl 小程序codeURL图片
  8. */
  9. const wxml = (name, pic, c1, c2) => `
  10. <view class="container">
  11. <text class="name">wodecesss</text>
  12. <text class="content">asdsadad</text>
  13. <text class="content">cccccc</text>
  14. <view class="bottom">
  15. <text class="msg">扫码一起加入学习吧</text>
  16. </view>
  17. </view>
  18. `
  19. /**
  20. *
  21. *
  22. * @param {*} screenWidth 屏幕宽度
  23. * @param {*} canvasWidth 画布宽度
  24. * @param {*} canvasHeight 画布高度
  25. * @param {*} numberWidth 数字宽度,动态设置
  26. * @return {*}
  27. */
  28. const style = (screenWidth, canvasWidth, canvasHeight) => {
  29. return {
  30. "container": {
  31. width: canvasWidth,
  32. height: canvasHeight,
  33. position: 'relative',
  34. overflow: 'hidden',
  35. backgroundColor: '#ffffff',
  36. },
  37. "name": {
  38. fontSize: 20,
  39. color: '#333',
  40. marginLeft: canvasWidth * 0.08,
  41. width: canvasWidth * 0.84,
  42. height: screenWidth * 0.18,
  43. textAlign: 'center',
  44. },
  45. "content": {
  46. fontSize: 14,
  47. color: '#333',
  48. width: canvasWidth * 0.84,
  49. height: screenWidth * 0.15,
  50. marginLeft: canvasWidth * 0.08,
  51. },
  52. "pic": {
  53. width: canvasWidth * 0.3,
  54. height: screenWidth * 0.28,
  55. marginTop: canvasWidth * 0.1,
  56. marginLeft: canvasWidth * 0.35,
  57. marginBottom: canvasWidth * 0.05,
  58. borderRadius: screenWidth * 0.14,
  59. overflow: 'hidden',
  60. },
  61. "bottom": {
  62. width: canvasWidth,
  63. height: screenWidth * 0.2,
  64. flexDirection: 'row',
  65. justifyContent: 'self-start',
  66. alignItems: 'center',
  67. backgroundColor: '#fafafa',
  68. position: 'absolute',
  69. bottom: 0,
  70. left: 0,
  71. },
  72. "qr": {
  73. width: canvasWidth * 0.14,
  74. height: screenWidth * 0.14,
  75. marginLeft: canvasWidth * 0.04,
  76. marginRight: canvasWidth * 0.04,
  77. },
  78. "msg": {
  79. fontSize: 14,
  80. color: '#a1a1a1',
  81. width: canvasWidth * 0.74,
  82. height: 14,
  83. textAlign: 'left'
  84. },
  85. }
  86. }
  87. module.exports = {
  88. wxml,
  89. style
  90. }