فهرست منبع

我的首页加按钮

Lijy 2 سال پیش
والد
کامیت
9afddcf671

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 8373 - 6185
fhKeeper/formulahousekeeper/timesheet_h5/package-lock.json


+ 1 - 0
fhKeeper/formulahousekeeper/timesheet_h5/package.json

@@ -19,6 +19,7 @@
     "echarts": "^4.9.0",
     "font-awesome": "^4.7.0",
     "jquery": "^3.6.1",
+    "pdfh5": "^1.4.2",
     "style-loader": "^1.3.0",
     "vue": "^2.6.12",
     "vuex-persistedstate": "^2.7.1",

BIN
fhKeeper/formulahousekeeper/timesheet_h5/src/assets/img/qwcode.png


+ 7 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/router/index.js

@@ -245,6 +245,13 @@ const router = new Router({
             title: "成本"
         }
     },
+    {
+        path: "/pdf",
+        meta: {
+            title: "PDF"
+        },
+        component: () => import("@/views/pdf/ppd")
+    },
     {
         path: "*",
         component: () => import("@/components/NotFound")

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

@@ -212,7 +212,7 @@
                                         timestamp: res.data.timestamp, // 必填,生成签名的时间戳
                                         nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
                                         signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-                                        jsApiList: ['selectExternalContact','openThirdAppServiceChat'], //必填,传入需要使用的接口名称
+                                        jsApiList: ['selectExternalContact','openThirdAppServiceChat', 'openAppManage'], //必填,传入需要使用的接口名称
                                         success: function (result) {
                                             // console.log(result, '请求微信成功')
                                             // console.log(window, 'window')

+ 102 - 3
fhKeeper/formulahousekeeper/timesheet_h5/src/views/my/children/center.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="center">
+    <div class="center myCenter">
         <!-- 头部 -->
         <header>
             <div class="beijin"></div>
@@ -13,9 +13,23 @@
         <!-- 主体 -->
         <main class="mt-10">
             <div class="bg-fff">
+                <van-cell title="当前版本" :title-style="'flex: 0.5;'" :value="version"></van-cell>
+
+                <div style="height: 20px;background: #f4f4f4"></div>
+
                 <van-cell title="账号" v-if="userInfo.userNameNeedTranslate != '1'" :title-style="'flex: 0.5;'" :value="userInfo.phone"></van-cell>
                 <van-cell title="工号" v-if="userInfo.jobNumber" :title-style="'flex: 0.5;'" :value="userInfo.jobNumber"></van-cell>
+
+                <div style="height: 20px;background: #f4f4f4"></div>
+                
                 <van-cell title="公司" :title-style="'flex: 0.5;'" :value="userInfo.companyName"></van-cell>
+                <van-cell title="有效日期" :title-style="'flex: 0.5;'" :value="expirationDate"></van-cell>
+
+                <div style="height: 20px;background: #f4f4f4"></div>
+
+                <van-cell title="使用说明" :title-style="'flex: 1;'" is-link @click="instructions()"></van-cell>
+                <van-cell title="在线客服" :title-style="'flex: 1;'" is-link @click="tokefu()" v-if="isCorpWX"></van-cell>
+                <van-cell title="添加员工" :title-style="'flex: 1;'" is-link @click="addEmployee()" v-if="isCorpWX"></van-cell>
                 <!-- <van-cell title="修改密码" isLink to="/my/set"></van-cell> -->
             </div>
             <van-cell :title="'绑定'+(isCorpWX?'企业':'')+'微信'" v-if="userInfo.userNameNeedTranslate != '1' && (isCorpWX || isWX)" @click="bindWeiXin" style="margin-top:10px;" :title-style="'flex: 2.5;'" label="绑定微信后可接收工时填报提醒">
@@ -49,6 +63,9 @@
                 userInfo: JSON.parse(localStorage.userInfo),
                 isCorpWX:false,
                 isWX:false,
+                expirationDate: '', // 有效日期
+                version: '', // 版本
+                show: false
             }
         },
 
@@ -76,9 +93,63 @@
                 var weixinUrl="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+encodeURI(url)+"&response_type=code&scope=snsapi_base&state=0#wechat_redirect";
                 window.location.href = weixinUrl;
             },
+            // 使用说明
+            instructions() {
+                console.log('当前版本')
+                let url = 'https://www.ttkuaiban.com/download/%E5%B7%A5%E6%97%B6%E7%AE%A1%E5%AE%B6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E%E4%B9%A6.pdf'
+                let name = '使用说明书'
+                this.previewPDF(url, name)
+            },
+            // 预览pdf
+            previewPDF(url, name) {
+                this.$router.push({
+                    path:  '/pdf',
+                    query: {
+                        url: url,
+                        name: name
+                    }
+                })
+                // this.$refs.previewPdfh5.openPdf('http://celiang.oss-cn-hangzhou.aliyuncs.com/measurement/2022-01/18/75it6phpocqYFV1642488558220118.pdf')
+            },
+            // 添加员工
+            addEmployee() {
+                wx.invoke('openAppManage', {}, function(res){
+                    if(res.err_msg == "openAppManage:ok") {
+                        // 调用成功              
+                    }
+                    if(res.err_msg == "openAppManage:fail:no permission") {
+                        // 调用人身份不符合                 
+                        this.$message({message: '调用人身份不符合',type: "error"});
+                    }
+                    if(res.err_msg == "openAppManage:fail:unknown app") {
+                        // 应用信息获取失败
+                        this.$message({message: '应用信息获取失败',type: "error"});
+                    }
+                    if(res.err_msg == "openAppManage:fail:unsupported app type") {
+                        // 应用类型不符合要求
+                        this.$message({message: '应用类型不符合要求',type: "error"});
+                    }
+                    if(res.err_msg == "openAppManage:fail") {
+                        // 其它错误                  
+                        this.$message({message: '其它错误',type: "error"});
+                    }      
+                })
+            },
+            // 跳转客服
+            tokefu(){
+                wx.invoke('openThirdAppServiceChat', {
+                    }, function(res) {
+                        console.log('invoke',res);
+                        if (res.err_msg == "openThirdAppServiceChat:ok" || res.err_msg == "openThirdAppServiceChat:cancel") {
+                        }else{
+                            this.$toast.fail('请联系管理员添加客服');
+                        }
+                        
+                    }
+                );
+            },
         },
         create() {
-            
         },
         mounted() {
             var ua = navigator.userAgent.toLowerCase();
@@ -87,11 +158,31 @@
             } else if (ua.indexOf("micromessenger") > 0) {
                 this.isWX = true;
             }
+            
+            // 拼接有效日期 和 版本
+            if(localStorage.userInfo) {
+                // 日期
+                let userss = JSON.parse(localStorage.userInfo)
+                userss.createTime[1] >= 10 ? userss.createTime[1] : userss.createTime[1] = '0' + userss.createTime[1]
+                userss.createTime[2] >= 10 ? userss.createTime[2] : userss.createTime[1] = '0' + userss.createTime[2]
+                userss.company.expirationDate[2] >= 10 ? userss.company.expirationDate[2] : userss.company.expirationDate[1] = '0' + userss.company.expirationDate[2]
+                userss.company.expirationDate[1] >= 10 ? userss.company.expirationDate[1] : userss.company.expirationDate[1] = '0' + userss.company.expirationDate[1]
+                this.expirationDate = userss.createTime[0] + '-' + userss.createTime[1] + '-' + userss.createTime[2] + ' 至 ' + userss.company.expirationDate[0] + '-' + userss.company.expirationDate[1] + '-' + userss.company.expirationDate[2]
+
+                // 版本
+                userss.company.packageOa = 1 ? this.version = '旗舰版' : ''
+                userss.company.packageEngineering = 1 ? this.version = '建筑工程版' : ''
+                userss.company.packageProject = 1 ? this.version = '专业版' : ''
+                userss.company.packageWorktime = 1 ? this.version = '基础版' : ''
+            }
         }
     };
 </script>
 
 <style lang="less" scoped>
+    .myCenter {
+        padding-bottom: 50px;
+    }
     /* 本页公共样式 */
     .gray {
         color: #797d82;
@@ -153,7 +244,7 @@
 
     .logout {
         width: 80%;
-        margin: 50px auto 0;
+        margin: 50px auto;
     }
 
     // 主体
@@ -176,4 +267,12 @@
     .footer {
         height: 50px;
     }
+
+    // 扫码 
+    .scanCode {
+        padding: 10px;
+    }
+    .scanCode_img img {
+        width: 100%;
+    }
 </style>

+ 44 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/pdf/pdf.vue

@@ -0,0 +1,44 @@
+<template>
+  <div class="pdfBox">
+    <div id="previewPdf"></div>
+  </div>
+</template>
+<script>
+import pdfh5 from 'pdfh5';
+import 'pdfh5/css/pdfh5.css'
+export default {
+  name: 'pdfh5',
+  data () {
+    return {
+      pdfh5: null,
+    }
+  },
+  methods: {
+    openPdf(url){     //url:PDF文件地址
+      this.pdfh5 = new pdfh5('#previewPdf', {
+        pdfurl: url
+      });
+      this.pdfh5.on('success', ()=>{
+        console.log('pdf渲染成功');
+      });
+    }
+  }
+}
+</script>
+<style scoped>
+.pdfBox {
+  position: relative;
+  top: 0;
+  left: 0;
+  width: 100vw;
+  height: 94vh;
+  background: #000;
+  overflow: hidden;
+  z-index: 99;
+  box-sizing: border-box;
+  margin-top: 1.22667rem;
+}
+#previewPdf {
+    height: 100%;
+  }
+</style>

+ 45 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/pdf/ppd.vue

@@ -0,0 +1,45 @@
+<template>
+  <div class="home">
+    <van-nav-bar :title="title" @click-left="back" left-text="返回" fixed left-arrow style="z-index: 20"/>
+    <div style="margin-top: 1.22667rem"></div>
+    <div style="box-sizing: border-box;">
+        <preview-pdf ref="previewPdfh5"></preview-pdf>
+    </div>
+  </div>
+</template>
+ 
+<script>
+import PreviewPdf from './pdf.vue';
+export default {
+  name: 'Home',
+  components: {
+    PreviewPdf
+  },
+  data () {
+    return {
+        title: ''
+    }
+  },
+  mounted () {
+    const urls = this.$route.query.url
+    const name = this.$route.query.name
+    let namess = name.split('.')[0]
+    let titless = ''
+    if(namess.length > 6) {
+        titless = namess.substring(0, 6) + '...'
+    } else {
+        titless = namess
+    }
+    this.title = titless
+    console.log(urls)
+    // this.$refs.previewPdfh5.openPdf('http://celiang.oss-cn-hangzhou.aliyuncs.com/measurement/2022-01/18/75it6phpocqYFV1642488558220118.pdf')
+    this.$refs.previewPdfh5.openPdf(urls)
+  },
+  methods: {
+    // 返回
+    back() { 
+        history.back();
+    },
+  } 
+}
+</script>