Просмотр исходного кода

feature_20260316_日报分享内容自定义配置

zhujindu недель назад: 4
Родитель
Сommit
429879a606
2 измененных файлов с 28 добавлено и 6 удалено
  1. 9 0
      src/api/index.js
  2. 19 6
      src/components/share.vue

+ 9 - 0
src/api/index.js

@@ -1151,3 +1151,12 @@ export function addCollectionAnswerBatch(data) {
     data,
     data,
   });
   });
 }
 }
+
+//分享日报入记录表
+export function shareReportMobile(data) {
+  return request({
+    url: '/mobile/reportMobile/share',
+    method: 'post',
+    data,
+  });
+}

+ 19 - 6
src/components/share.vue

@@ -136,7 +136,7 @@
 </template>
 </template>
 <script>
 <script>
 import html2canvas from 'html2canvas';
 import html2canvas from 'html2canvas';
-import { imgToBase64 } from '@/api/index';
+import { imgToBase64, shareReportMobile } from '@/api/index';
 import VueQr from 'vue-qr';
 import VueQr from 'vue-qr';
 import ShareAtarget from './shareAtarget.vue';
 import ShareAtarget from './shareAtarget.vue';
 import shareBtarget from './shareBtarget.vue';
 import shareBtarget from './shareBtarget.vue';
@@ -205,9 +205,15 @@ export default {
       qrcode: null,
       qrcode: null,
       vueQrText: '',
       vueQrText: '',
       heightFlag: 'start', //图片高度不足,居中显示
       heightFlag: 'start', //图片高度不足,居中显示
+      shareDuration: 0, //分享时间
+      shareInterval: null,
     };
     };
   },
   },
   created() {
   created() {
+    this.shareDuration = 0;
+    this.shareInterval = setInterval(() => {
+      this.shareDuration++;
+    }, 1000);
     this.zIndex = -1;
     this.zIndex = -1;
     this.canvasImageUrl = '';
     this.canvasImageUrl = '';
     let links = process.env.NODE_ENV == 'production' ? 'http://1.npz.cn/3/' : 'http://1.npz.cn/2/';
     let links = process.env.NODE_ENV == 'production' ? 'http://1.npz.cn/3/' : 'http://1.npz.cn/2/';
@@ -344,11 +350,18 @@ export default {
           // 图片名称:用户名-时间戳
           // 图片名称:用户名-时间戳
           let username = this.reportTarget.nickName;
           let username = this.reportTarget.nickName;
           let imgName = username + '-' + new Date().getTime();
           let imgName = username + '-' + new Date().getTime();
-          // uploadAliOss(imageUrl, imgName).then((res) => {
-          //   if (res.url && res.url.indexOf('http') != -1) {
-          //     console.log(res.url);
-          //   }
-          // });
+          uploadAliOss(imageUrl, imgName).then((res) => {
+            if (res.url && res.url.indexOf('http') != -1) {
+              console.log(res.url);
+              shareReportMobile({
+                reportId: this.reportId, //	long	汇报主键id
+                imageUrl: res.url, //	String	分享日报的图片的URL
+                shareDuration: this.shareDuration, //	long	分享用时(秒)
+              }).then((res) => {
+                if (this.shareInterval) clearInterval(this.shareInterval);
+              });
+            }
+          });
         })
         })
         .catch((error) => {
         .catch((error) => {
           this.toastLoading().clear();
           this.toastLoading().clear();