longPosterService.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view>
  3. <view class="poster" id="poster">
  4. <!-- 年度理赔账单 -->
  5. <block v-if="type==1">
  6. <image class="poster-pic" :src="posterBg" mode="widthFix"></image>
  7. <view style="position: absolute;top: 912rpx;left: 50%;transform: translateX(-50%);min-width:604rpx;">
  8. <view style="font-size: 36rpx;font-weight: bold;text-align: center;">合计理赔金额(元)</view>
  9. <view style="font-size: 90rpx;font-weight: bold;color: #FF5700;margin-top: 5rpx;line-height: 126rpx;text-align: center;">340895.2</view>
  10. <view style="font-size: 33rpx;font-weight: bold;margin-top: 78rpx;text-align: center;">理赔概况</view>
  11. <view style="width:522rpx;font-size: 26rpx;font-weight: 400;color: #333;line-height: 48rpx;margin: 17rpx auto 0;">
  12. 这里是理赔经过的概况描述文案这里是理赔经过的概况描述文案这里是理赔经过的概况描述文案这里是理赔经过的概况描述文案这里是理赔经过的概况描述文案这里是理赔经过的概况这里是理赔经过的概况描述文案
  13. </view>
  14. <view class="table-th ddflex">
  15. <view class="table-th-item fflex">赔付事件</view>
  16. <view class="table-th-item fflex">赔付金额</view>
  17. </view>
  18. <view>
  19. <view class="table-td" v-for="item,index in 10">
  20. <view class="ddflex">
  21. <view class="table-td-item fflex">L女士 32岁 福建人 甲状腺癌</view>
  22. <view class="table-td-item">14826元</view>
  23. </view>
  24. <view v-if="index!=10-1" class="table-td-item-border"></view>
  25. </view>
  26. </view>
  27. <view class="ddflex" style="margin-top: 40rpx;">
  28. <view class="flex">
  29. <view class="poster-title">杜平 | 18665676418</view>
  30. <view class="poster-note">扫码即可咨询理赔事宜</view>
  31. </view>
  32. <image class="poster-code" src="https://img.zhiqiyun.com/test/2023/08/23/d44ab2b86522a05ee6bd026cf04ec8bd.png"></image>
  33. </view>
  34. </view>
  35. </block>
  36. <!-- 日报 -->
  37. <block v-if="type==2">
  38. <image class="poster-pic" :src="posterBg" mode="widthFix"></image>
  39. <view style="position: absolute;top: 484rpx;left: 50%;transform: translateX(-50%);min-width:604rpx;">
  40. <view style="font-size: 36rpx;font-weight: 400;text-align: left;color: #FFFFFF;">理赔总件数</view>
  41. <view style="font-size: 90rpx;font-weight: bold;text-align: left;color: #FFFFFF;">489</view>
  42. <view style="font-size: 36rpx;font-weight: 400;text-align: left;color: #FFFFFF;margin-top: 30rpx;">理赔总金额(元)</view>
  43. <view style="font-size: 90rpx;font-weight: bold;text-align: left;color: #FFFFFF;">340895.2</view>
  44. <view style="font-size: 36rpx;font-weight: 400;text-align: left;color: #FFFFFF;margin-top: 30rpx;">最高赔付金额(元)</view>
  45. <view style="font-size: 90rpx;font-weight: bold;text-align: left;color: #FFFFFF;">40895.2</view>
  46. <view class="table-th ddflex">
  47. <view class="table-th-item fflex">赔付事件</view>
  48. <view class="table-th-item fflex">理赔件数</view>
  49. <view class="table-th-item fflex">赔付金额</view>
  50. </view>
  51. <view>
  52. <view class="table-td" v-for="item,index in 5">
  53. <view class="ddflex">
  54. <view class="table-td-item fflex">疾病医疗</view>
  55. <view class="table-td-item fflex">35</view>
  56. <view class="table-td-item fflex">14826元</view>
  57. </view>
  58. <view v-if="index!=5-1" class="table-td-item-border"></view>
  59. </view>
  60. </view>
  61. <view class="ddflex" style="margin-top: 40rpx;">
  62. <view class="flex">
  63. <view class="poster-title">杜平 | 18665676418</view>
  64. <view class="poster-note">扫码即可咨询理赔事宜</view>
  65. </view>
  66. <image class="poster-code" src="https://img.zhiqiyun.com/test/2023/08/23/d44ab2b86522a05ee6bd026cf04ec8bd.png"></image>
  67. </view>
  68. </view>
  69. </block>
  70. </view>
  71. <view class="ddflex" style="margin: 30rpx 0 10rpx;justify-content: space-between;">
  72. <view class="ddflex">
  73. <view class="option ddflex" @click="uploadImage">
  74. <image mode="aspectFit" src="../static/images/opt1.png"></image>
  75. 更换背景
  76. </view>
  77. <view class="line"></view>
  78. <view class="option ddflex" @click="jumpUrl('/library/longPosterContent/longPosterContent?type='+type)">
  79. <image mode="aspectFit" src="../static/images/opt2.png"></image>
  80. 编辑内容
  81. </view>
  82. </view>
  83. <view class="option-btn" @click="toImg">发布</view>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. const app = getApp();
  89. const req = require("../../utils/request.js");
  90. import html2canvas from '../static/html2canvas.min.js';
  91. export default {
  92. components: {},
  93. props: {},
  94. data() {
  95. return {
  96. systems: {},
  97. isTop:0,
  98. productLink:'',
  99. posterBg:'',
  100. base64:'',
  101. type:1,
  102. }
  103. },
  104. onLoad(options) {
  105. if(options.type) this.type = options.type
  106. if(this.type == 1){
  107. this.posterBg = 'https://img.zhiqiyun.com/test/2023/08/23/e5705790f7614ebede4c06073b7abd50.png'
  108. }else{
  109. this.posterBg = 'https://img.zhiqiyun.com/test/2023/08/23/d2ae45f898abdb12559da237f3c92188.png'
  110. }
  111. },
  112. onShow() {
  113. },
  114. methods: {
  115. jumpUrl(url){
  116. uni.navigateTo({
  117. url:url
  118. })
  119. },
  120. creatCode(){
  121. },
  122. toImg() {
  123. // 使页面滑到顶部,避免顶部出现白边
  124. uni.pageScrollTo({
  125. scrollTop: 0,
  126. duration: 0
  127. })
  128. var dom = document.querySelector('#poster'); // 获取dom元素
  129. html2canvas(dom, {
  130. width: dom.clientWidth, //dom 原始宽度
  131. height: dom.clientHeight,
  132. scrollY: 0, // html2canvas默认绘制视图内的页面,需要把scrollY,scrollX设置为0
  133. scrollX: 0,
  134. useCORS: true, //支持跨域,但好像没什么用
  135. }).then((canvas) => {
  136. // 将生产的canvas转为base64图片
  137. this.base64 = canvas.toDataURL('image/png')
  138. console.log(this.base64)
  139. uni.downloadFile({
  140. url: this.base64, //仅为示例,并非真实的资源
  141. success: (res) => {
  142. console.log(res)
  143. if (res.statusCode === 200) {
  144. console.log('下载成功');
  145. var oA = document.createElement("a");
  146. oA.download = ''; // 设置下载的文件名,默认是'下载'
  147. oA.href = res.tempFilePath; //临时路径再保存到本地
  148. document.body.appendChild(oA);
  149. oA.click();
  150. oA.remove(); // 下载之后把创建的元素删除
  151. }
  152. }
  153. });
  154. });
  155. },
  156. uploadImage(){
  157. let that = this;
  158. let count = 1
  159. uni.chooseImage({
  160. count: count,
  161. sizeType: ['original', 'compressed'],
  162. sourceType: ['album', 'camera'],
  163. success: function({ tempFilePaths }) {
  164. var promise = Promise.all(
  165. tempFilePaths.map(tempFilePath => {
  166. return new Promise(function(resolve, reject) {
  167. req.uploadFile('/api/nocheck/upload', tempFilePath, res => {
  168. that.posterBg = res.src
  169. });
  170. });
  171. })
  172. );
  173. promise
  174. .then(function(results) {
  175. console.log(results);
  176. })
  177. .catch(function(err) {
  178. console.log(err);
  179. });
  180. }
  181. });
  182. },
  183. },
  184. mounted() {
  185. const systemInfo = uni.getSystemInfoSync();
  186. // px转换到rpx的比例
  187. let pxToRpxScale = 750 / systemInfo.windowWidth;
  188. let systems = {
  189. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  190. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  191. };
  192. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  193. this.systems = systems;
  194. },
  195. onPageScroll: function(e) {
  196. if (e.scrollTop > this.systems.barHeight) {
  197. this.isTop = 1;
  198. } else {
  199. this.isTop = 0;
  200. }
  201. }
  202. }
  203. </script>
  204. <style>
  205. @import "./longPosterService.css";
  206. </style>