test.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <!-- <view>
  7. <l-painter isRenderImage :width="'686rpx'" :height="'930rpx'"
  8. custom-style="position: fixed; top:10px; left: 500%;" ref="painter" @success="poster($event)" />
  9. </view> -->
  10. </view>
  11. </template>
  12. <script>
  13. import mvBar from "@/components/mys_navBar/mysNavBar";
  14. // import lPainter from "@/components/lime-painter/index.vue"
  15. // import lPainter from '@/utils/painter'
  16. export default {
  17. components: {
  18. mvBar,
  19. // 'l-painter': lPainter
  20. },
  21. data() {
  22. return {
  23. navH: getApp().globalData.navHeight,
  24. mysNavConfig: {
  25. /* 开启单页显示首页图标 */
  26. isHome: true,
  27. /* 固定导航 */
  28. navFixed: true,
  29. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  30. navTitle: {
  31. text: "我的收益",
  32. color: "",
  33. fontSize: "32rpx", // px upx rpx
  34. fontWeight: "normal", // 100 - 700
  35. },
  36. btnType: "type2",
  37. onLeftClick: "/pages/mycenter/mycenter",
  38. /* type2 按钮 */
  39. type2Config: {
  40. // 左图标
  41. leftPath: "/static/img/png2.png",
  42. // 右图标
  43. rightPath: "/static/img/png4.png",
  44. // 圆角
  45. radius: "40rpx",
  46. },
  47. },
  48. }
  49. },
  50. onLoad(){
  51. this.onShareLoad();
  52. },
  53. methods: {
  54. onShareLoad() {
  55. let that = this;
  56. let base = {
  57. width: '686rpx',
  58. height: '950rpx',
  59. views: [{
  60. css: {
  61. width: '686rpx',
  62. height: '500rpx',
  63. display: "inline-block",
  64. },
  65. views: [{
  66. type: 'image',
  67. src: '../../static/home.png',
  68. mode: 'scaleToFill',
  69. css: {
  70. radius: '32rpx 32rpx 0rpx 0rpx',
  71. left: '0rpx',
  72. top: '0rpx',
  73. width: '686rpx',
  74. height: '500rpx',
  75. }
  76. }],
  77. type: "view"
  78. },
  79. {
  80. css: {
  81. width: '686rpx',
  82. height: '190rpx',
  83. display: "inline-block",
  84. background: '#ffffff',
  85. },
  86. views: [{
  87. type: 'text',
  88. text: '¥',
  89. css: {
  90. color: '#FE4F02',
  91. left: '30rpx',
  92. top: '550rpx',
  93. fontSize: '26rpx',
  94. lineHeight: '45rpx'
  95. }
  96. },
  97. {
  98. type: 'text',
  99. text: '1688.00',
  100. css: {
  101. color: '#FE4F02',
  102. left: '60rpx',
  103. top: '550rpx',
  104. fontWerght: 'bold',
  105. fontSize: '52rpx',
  106. lineHeight: '45rpx'
  107. }
  108. },
  109. {
  110. type: 'text',
  111. text: 'uniapp使用l-painter画板,海报uniapp使用l-painter画板,海报',
  112. css: {
  113. maxLines: 1,
  114. width: '630rpx',
  115. color: '#1A1A1A',
  116. left: '32rpx',
  117. top: '620rpx',
  118. fontSize: '32rpx',
  119. fontWerght: 'bold',
  120. lineHeight: '45rpx'
  121. }
  122. }
  123. ],
  124. type: "view"
  125. }, {
  126. css: {
  127. width: '686rpx',
  128. height: '52rpx',
  129. display: "inline-block",
  130. },
  131. views: [{
  132. type: 'image',
  133. src: '../../static/img/aimg1.png',
  134. mode: 'scaleToFill',
  135. css: {
  136. left: '0rpx',
  137. top: '690rpx',
  138. width: '686rpx',
  139. height: '52rpx',
  140. }
  141. }],
  142. type: "view"
  143. }, {
  144. css: {
  145. width: '686rpx',
  146. height: '180rpx',
  147. display: "inline-block",
  148. background: '#ffffff',
  149. radius: '0rpx 0rpx 32rpx 32rpx',
  150. },
  151. views: [{
  152. type: 'text',
  153. text: '购买热线',
  154. css: {
  155. left: '40rpx',
  156. top: '770rpx',
  157. fontSize: '28rpx',
  158. color: '#999999'
  159. }
  160. },
  161. {
  162. type: 'image',
  163. src: '../../static/img/icon4.png',
  164. mode: 'widthFix',
  165. css: {
  166. left: '184rpx',
  167. top: '770rpx',
  168. width: '36rpx',
  169. height: '36rpx',
  170. }
  171. },
  172. {
  173. type: 'text',
  174. text: '手机号码',
  175. css: {
  176. left: '240rpx',
  177. top: '770rpx',
  178. fontSize: '28rpx',
  179. fontWerght: 'bold',
  180. }
  181. },
  182. {
  183. type: 'text',
  184. text: '150-1234-4567',
  185. css: {
  186. left: '360rpx',
  187. top: '770rpx',
  188. fontSize: '28rpx',
  189. fontWerght: 'bold',
  190. }
  191. },
  192. {
  193. type: 'image',
  194. src: '../../static/img/sucess.png',
  195. mode: 'widthFix',
  196. css: {
  197. left: '184rpx',
  198. top: '840rpx',
  199. width: '36rpx',
  200. height: '36rpx',
  201. }
  202. },
  203. {
  204. type: 'text',
  205. text: '微信号码',
  206. css: {
  207. left: '240rpx',
  208. top: '840rpx',
  209. fontSize: '28rpx',
  210. fontWerght: 'bold',
  211. }
  212. },
  213. {
  214. type: 'text',
  215. text: 'csc1234',
  216. css: {
  217. left: '360rpx',
  218. top: '840rpx',
  219. fontSize: '28rpx',
  220. fontWerght: 'bold',
  221. }
  222. },
  223. ],
  224. type: "view"
  225. },
  226. {
  227. css: {
  228. top: '360rpx',
  229. left: '480rpx',
  230. width: '170rpx',
  231. height: '220rpx',
  232. display: "inline-block",
  233. background: '#ffffff',
  234. borderRadius: '16rpx',
  235. boxShadow: "0 20rpx 58rpx rgba(0,0,0,.15)"
  236. },
  237. views: [{
  238. type: 'text',
  239. text: '产品详情二维码',
  240. css: {
  241. width: '280rpx',
  242. top: '540rpx',
  243. left: '488rpx',
  244. fontSize: '22rpx',
  245. color: '#1A1A1A'
  246. }
  247. },
  248. {
  249. type: 'image',
  250. src: '../../static/img/deng2.png',
  251. mode: 'widthFix',
  252. css: {
  253. top: '370rpx',
  254. left: '484rpx',
  255. width: '160rpx',
  256. height: '160rpx',
  257. borderRadius: '50%'
  258. }
  259. }
  260. ],
  261. type: "view"
  262. }
  263. ]
  264. }
  265. const painter = that.$refs.painter;
  266. painter.render(base);
  267. },
  268. poster(event) {
  269. console.info(event)
  270. let path = event;
  271. let that = this;
  272. // #ifdef H5
  273. var eleLink = document.createElement('a');
  274. eleLink.download = "filename";
  275. eleLink.style.display = 'none';
  276. eleLink.href = path;
  277. document.body.appendChild(eleLink);
  278. eleLink.click();
  279. // 然后移除
  280. document.body.removeChild(eleLink);
  281. // #endif
  282. // #ifndef H5
  283. uni.saveImageToPhotosAlbum({
  284. filePath: path,
  285. success(res) {
  286. that.painterShow = false;
  287. that.show = false;
  288. uni.showToast({
  289. title: '已保存到相册',
  290. icon: 'success',
  291. duration: 2000
  292. })
  293. }
  294. })
  295. // #endif
  296. },
  297. }
  298. }
  299. </script>
  300. <style>
  301. </style>