test.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view>
  7. <image></image>
  8. <p>
  9. 2301.12023.pdf
  10. </p>
  11. <button @tap="downloadFile('https://arxiv.org/pdf/2301.12023.pdf')">下载附件</button>
  12. </view>
  13. <view class="pipline">
  14. <p>报名任务&nbsp;>&nbsp;商家反选&nbsp;>&nbsp;商家支付&nbsp;>&nbsp;报名成功&nbsp;>&nbsp;寄样&探店约档</p>
  15. <p>签收返稿&nbsp;>&nbsp;商家审核&nbsp;>&nbsp;作品发布&nbsp;>&nbsp;返回数据&nbsp;>&nbsp;结案&结算打款</p>
  16. <!-- <image :src="picture.icon_whole_pipline"></image> -->
  17. </view>
  18. <view class="pipline">
  19. <p>报名任务&nbsp;>&nbsp;商家反选&nbsp;>&nbsp;商家支付&nbsp;>&nbsp;报名成功&nbsp;>&nbsp;寄样&探店约档</p>
  20. <p>签收返稿&nbsp;>&nbsp;商家审核&nbsp;>&nbsp;作品发布&nbsp;>&nbsp;返回数据&nbsp;>&nbsp;结案&结算打款</p>
  21. <!-- <image :src="picture.icon_special_pipline"></image> -->
  22. </view>
  23. <!-- <view>
  24. <l-painter isRenderImage :width="'686rpx'" :height="'930rpx'"
  25. custom-style="position: fixed; top:10px; left: 500%;" ref="painter" @success="poster($event)" />
  26. </view> -->
  27. </view>
  28. </template>
  29. <script>
  30. import mvBar from "@/components/mys_navBar/mysNavBar";
  31. // import lPainter from "@/components/lime-painter/index.vue"
  32. // import lPainter from '@/utils/painter'
  33. export default {
  34. components: {
  35. mvBar,
  36. // 'l-painter': lPainter
  37. },
  38. data() {
  39. return {
  40. navH: getApp().globalData.navHeight,
  41. mysNavConfig: {
  42. /* 开启单页显示首页图标 */
  43. isHome: true,
  44. /* 固定导航 */
  45. navFixed: true,
  46. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  47. navTitle: {
  48. text: "测试页面",
  49. color: "",
  50. fontSize: "32rpx", // px upx rpx
  51. fontWeight: "normal", // 100 - 700
  52. },
  53. btnType: "type2",
  54. onLeftClick: "/pages/mycenter/mycenter",
  55. /* type2 按钮 */
  56. type2Config: {
  57. // 左图标
  58. leftPath: "/static/img/png2.png",
  59. // 右图标
  60. rightPath: "/static/img/png4.png",
  61. // 圆角
  62. radius: "40rpx",
  63. },
  64. },
  65. picture: {
  66. icon_whole_pipline: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent_upload/icon-whole-pipline.png',
  67. icon_special_pipline: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent_upload/icon-special-pipline.png',
  68. }
  69. }
  70. },
  71. onLoad() {
  72. // this.onShareLoad();
  73. },
  74. methods: {
  75. /**
  76. * 下载文件并预览
  77. */
  78. // 删除本地文件
  79. deletContract() {
  80. try {
  81. let file = wx.getFileSystemManager();
  82. file.readdir({
  83. dirPath: `${wx.env.USER_DATA_PATH}/younggee_brief`,
  84. success: res => {
  85. console.log(res);
  86. if (res.files.length > 2) {
  87. file.unlink({
  88. filePath: `${wx.env.USER_DATA_PATH}/${res.files[0]}`,
  89. complete: res => {
  90. }
  91. })
  92. }
  93. }
  94. })
  95. } catch (error) {
  96. }
  97. },
  98. downloadFile(url) {
  99. let that = this
  100. console.log(url)
  101. const fileName = url.split('/').pop()
  102. const newPath = `${wx.env.USER_DATA_PATH}/younggee_brief/${fileName}`;
  103. console.log("new path: ", newPath);
  104. // that.deletContract();
  105. wx.downloadFile({
  106. url: url,
  107. filePath: newPath,
  108. header: {},
  109. success: function(res) {
  110. var filePath = res.filePath;
  111. console.log(filePath);
  112. wx.showLoading({
  113. title: '正在打开',
  114. mask: true
  115. })
  116. wx.openDocument({
  117. filePath: filePath,
  118. showMenu: true,
  119. success: function(res) {
  120. console.log('打开文档成功')
  121. wx.hideLoading()
  122. },
  123. fail: function(res) {
  124. console.log(res);
  125. wx.hideLoading()
  126. },
  127. complete: function(res) {
  128. console.log(res);
  129. }
  130. })
  131. },
  132. fail: function(res) {
  133. console.log('文件下载失败');
  134. console.log(res)
  135. },
  136. complete: function(res) {},
  137. })
  138. },
  139. onShareLoad() {
  140. let that = this;
  141. let base = {
  142. width: '686rpx',
  143. height: '950rpx',
  144. views: [{
  145. css: {
  146. width: '686rpx',
  147. height: '500rpx',
  148. display: "inline-block",
  149. },
  150. views: [{
  151. type: 'image',
  152. src: '../../static/home.png',
  153. mode: 'scaleToFill',
  154. css: {
  155. radius: '32rpx 32rpx 0rpx 0rpx',
  156. left: '0rpx',
  157. top: '0rpx',
  158. width: '686rpx',
  159. height: '500rpx',
  160. }
  161. }],
  162. type: "view"
  163. },
  164. {
  165. css: {
  166. width: '686rpx',
  167. height: '190rpx',
  168. display: "inline-block",
  169. background: '#ffffff',
  170. },
  171. views: [{
  172. type: 'text',
  173. text: '¥',
  174. css: {
  175. color: '#FE4F02',
  176. left: '30rpx',
  177. top: '550rpx',
  178. fontSize: '26rpx',
  179. lineHeight: '45rpx'
  180. }
  181. },
  182. {
  183. type: 'text',
  184. text: '1688.00',
  185. css: {
  186. color: '#FE4F02',
  187. left: '60rpx',
  188. top: '550rpx',
  189. fontWerght: 'bold',
  190. fontSize: '52rpx',
  191. lineHeight: '45rpx'
  192. }
  193. },
  194. {
  195. type: 'text',
  196. text: 'uniapp使用l-painter画板,海报uniapp使用l-painter画板,海报',
  197. css: {
  198. maxLines: 1,
  199. width: '630rpx',
  200. color: '#1A1A1A',
  201. left: '32rpx',
  202. top: '620rpx',
  203. fontSize: '32rpx',
  204. fontWerght: 'bold',
  205. lineHeight: '45rpx'
  206. }
  207. }
  208. ],
  209. type: "view"
  210. }, {
  211. css: {
  212. width: '686rpx',
  213. height: '52rpx',
  214. display: "inline-block",
  215. },
  216. views: [{
  217. type: 'image',
  218. src: '../../static/img/aimg1.png',
  219. mode: 'scaleToFill',
  220. css: {
  221. left: '0rpx',
  222. top: '690rpx',
  223. width: '686rpx',
  224. height: '52rpx',
  225. }
  226. }],
  227. type: "view"
  228. }, {
  229. css: {
  230. width: '686rpx',
  231. height: '180rpx',
  232. display: "inline-block",
  233. background: '#ffffff',
  234. radius: '0rpx 0rpx 32rpx 32rpx',
  235. },
  236. views: [{
  237. type: 'text',
  238. text: '购买热线',
  239. css: {
  240. left: '40rpx',
  241. top: '770rpx',
  242. fontSize: '28rpx',
  243. color: '#999999'
  244. }
  245. },
  246. {
  247. type: 'image',
  248. src: '../../static/img/icon4.png',
  249. mode: 'widthFix',
  250. css: {
  251. left: '184rpx',
  252. top: '770rpx',
  253. width: '36rpx',
  254. height: '36rpx',
  255. }
  256. },
  257. {
  258. type: 'text',
  259. text: '手机号码',
  260. css: {
  261. left: '240rpx',
  262. top: '770rpx',
  263. fontSize: '28rpx',
  264. fontWerght: 'bold',
  265. }
  266. },
  267. {
  268. type: 'text',
  269. text: '150-1234-4567',
  270. css: {
  271. left: '360rpx',
  272. top: '770rpx',
  273. fontSize: '28rpx',
  274. fontWerght: 'bold',
  275. }
  276. },
  277. {
  278. type: 'image',
  279. src: '../../static/img/sucess.png',
  280. mode: 'widthFix',
  281. css: {
  282. left: '184rpx',
  283. top: '840rpx',
  284. width: '36rpx',
  285. height: '36rpx',
  286. }
  287. },
  288. {
  289. type: 'text',
  290. text: '微信号码',
  291. css: {
  292. left: '240rpx',
  293. top: '840rpx',
  294. fontSize: '28rpx',
  295. fontWerght: 'bold',
  296. }
  297. },
  298. {
  299. type: 'text',
  300. text: 'csc1234',
  301. css: {
  302. left: '360rpx',
  303. top: '840rpx',
  304. fontSize: '28rpx',
  305. fontWerght: 'bold',
  306. }
  307. },
  308. ],
  309. type: "view"
  310. },
  311. {
  312. css: {
  313. top: '360rpx',
  314. left: '480rpx',
  315. width: '170rpx',
  316. height: '220rpx',
  317. display: "inline-block",
  318. background: '#ffffff',
  319. borderRadius: '16rpx',
  320. boxShadow: "0 20rpx 58rpx rgba(0,0,0,.15)"
  321. },
  322. views: [{
  323. type: 'text',
  324. text: '产品详情二维码',
  325. css: {
  326. width: '280rpx',
  327. top: '540rpx',
  328. left: '488rpx',
  329. fontSize: '22rpx',
  330. color: '#1A1A1A'
  331. }
  332. },
  333. {
  334. type: 'image',
  335. src: '../../static/img/deng2.png',
  336. mode: 'widthFix',
  337. css: {
  338. top: '370rpx',
  339. left: '484rpx',
  340. width: '160rpx',
  341. height: '160rpx',
  342. borderRadius: '50%'
  343. }
  344. }
  345. ],
  346. type: "view"
  347. }
  348. ]
  349. }
  350. const painter = that.$refs.painter;
  351. painter.render(base);
  352. },
  353. poster(event) {
  354. console.info(event)
  355. let path = event;
  356. let that = this;
  357. // #ifdef H5
  358. var eleLink = document.createElement('a');
  359. eleLink.download = "filename";
  360. eleLink.style.display = 'none';
  361. eleLink.href = path;
  362. document.body.appendChild(eleLink);
  363. eleLink.click();
  364. // 然后移除
  365. document.body.removeChild(eleLink);
  366. // #endif
  367. // #ifndef H5
  368. uni.saveImageToPhotosAlbum({
  369. filePath: path,
  370. success(res) {
  371. that.painterShow = false;
  372. that.show = false;
  373. uni.showToast({
  374. title: '已保存到相册',
  375. icon: 'success',
  376. duration: 2000
  377. })
  378. }
  379. })
  380. // #endif
  381. },
  382. }
  383. }
  384. </script>
  385. <style>
  386. .pipline{
  387. display: flex;
  388. flex-direction: column;
  389. align-items: center;
  390. justify-content: center;
  391. margin: 20rpx;
  392. border: #FCCF41 2rpx dashed;
  393. }
  394. .pipline p{
  395. font-size: 24rpx;
  396. height: 60rpx;
  397. line-height: 60rpx;
  398. transform: scale(1, 1.5);
  399. /* box-shadow: 10px 10px 5px #FCCF41; */
  400. }
  401. .pipline image{
  402. /* width: 600rpx; */
  403. height: 150rpx;
  404. }
  405. </style>