test.vue 6.6 KB

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