| <template> | 
|     <view class="index" v-if="userInfo"> | 
|         <view class="index_t"> | 
|             <text>办公室安全上报</text> | 
|             <image src="/static/img_egg@2x.png" mode="widthFix"></image> | 
|         </view> | 
|         <view class="index_list"> | 
|             <view class="index_list_item" @click="jump(1)"> | 
|                 <view class="index_list_item_info"> | 
|                     <text>SHE事件上报</text> | 
|                     <text>FAC/NM</text> | 
|                 </view> | 
|                 <image src="/static/bg_a.png" mode="widthFix"></image> | 
|             </view> | 
|             <view class="index_list_item" @click="jump(2)"> | 
|                 <view class="index_list_item_info"> | 
|                     <text>跌绊滑风险上报</text> | 
|                     <text>TAG</text> | 
|                 </view> | 
|                 <image src="/static/bg_b.png" mode="widthFix"></image> | 
|             </view> | 
|             <view class="index_list_item" @click="jump(3)" v-if="userInfo.dcaButton === 1"> | 
|                 <view class="index_list_item_info"> | 
|                     <text>深度符合性审查DCA</text> | 
|                     <text>DCA</text> | 
|                 </view> | 
|                 <image src="/static/bg_c.png" mode="widthFix"></image> | 
|             </view> | 
|         </view> | 
|     </view> | 
| </template> | 
|   | 
| <script> | 
|     import { | 
|         mapState | 
|     } from 'vuex' | 
|     export default { | 
|         computed: { | 
|             ...mapState(['userInfo']) | 
|         }, | 
|         data() { | 
|             return { | 
|                 serverIds: [] | 
|             } | 
|         }, | 
|         onLoad() { | 
|             this.init() | 
|         }, | 
|         methods: { | 
|             jump(type) { | 
|                 switch (type) { | 
|                     case 1: | 
|                         uni.navigateTo({ | 
|                             url: '/pages/reporting_she/reporting_she' | 
|                         }) | 
|                         break; | 
|                     case 2: | 
|                         uni.navigateTo({ | 
|                             url: '/pages/riskReporting/riskReporting' | 
|                         }) | 
|                         break; | 
|                     case 3: | 
|                         uni.navigateTo({ | 
|                             url: '/pages/report_dca/report_dca' | 
|                         }) | 
|                         break; | 
|                 } | 
|             }, | 
|             async init() { | 
|                 // ShiXuHui GuoJiWenWu | 
|                 // if (!this.$store.state.userInfo) { | 
|                 //     let res = await this.$u.api.login({ code: 'GuoJiWenWu' }) | 
|                 //     if (res.code === 200) { | 
|                 //         this.$store.commit('setUserInfo', res.data) | 
|                 //     } | 
|                 // } | 
|                 // return | 
|                 let code = this.getQueryVariable('code') | 
|                 if (code) { | 
|                     if (!uni.getStorageSync('code')) { | 
|                         uni.setStorageSync('code', code); | 
|                          | 
|                         let res = await this.$u.api.login({ code: code }) | 
|                         if (res.code === 200) { | 
|                             this.$store.commit('setUserInfo', res.data) | 
|                             // this.initRegister() | 
|                              | 
|                             // 判断是否跳转详情 | 
|                             let url = window.location.href | 
|                             if (url.indexOf('state=') !== -1 && url.indexOf('#') !== -1) { | 
|                                 let value = url.substring(url.indexOf('state=') + 6, url.indexOf('#')).split('_') | 
|                                 console.log(value) | 
|                                 if (value[0] !== '' && value[0] != 'p') { | 
|                                     if (value[0] == 0) { | 
|                                         uni.navigateTo({ | 
|                                             url: `/pages/details_she/details_she?id=${value[1]}` | 
|                                         }) | 
|                                     } else if (value[0] == 1) { | 
|                                         uni.navigateTo({ | 
|                                             url: `/pages/details_dca/details_dca?id=${value[1]}&isShow=true` | 
|                                         }) | 
|                                     } else if (value[0] == 3) { | 
|                                         uni.navigateTo({ | 
|                                             url: `/pages/workOrder_she/workOrder_she?id=${value[1]}` | 
|                                         }) | 
|                                     } | 
|                                 } else if (value[0] !== '' && value[0] == 'p') { | 
|                                     uni.navigateTo({ | 
|                                         url: value[1] | 
|                                     }) | 
|                                 } | 
|                             } | 
|                         } | 
|                     } else if (uni.getStorageSync('code') !== code) { | 
|                          | 
|                         uni.setStorageSync('code', code); | 
|                          | 
|                         let res = await this.$u.api.login({ code: code }) | 
|                         if (res.code === 200) { | 
|                             this.$store.commit('setUserInfo', res.data) | 
|                             // this.initRegister() | 
|                              | 
|                             // 判断是否跳转详情 | 
|                             let url = window.location.href | 
|                             if (url.indexOf('state=') !== -1 && url.indexOf('#') !== -1) { | 
|                                 let value = url.substring(url.indexOf('state=') + 6, url.indexOf('#')).split('_') | 
|                                 console.log(value) | 
|                                 if (value[0] !== '' && value[0] != 'p') { | 
|                                     if (value[0] == 0) { | 
|                                         uni.navigateTo({ | 
|                                             url: `/pages/details_she/details_she?id=${value[1]}` | 
|                                         }) | 
|                                     } else if (value[0] == 1) { | 
|                                         uni.navigateTo({ | 
|                                             url: `/pages/details_dca/details_dca?id=${value[1]}&isShow=true` | 
|                                         }) | 
|                                     } else if (value[0] == 3) { | 
|                                         uni.navigateTo({ | 
|                                             url: `/pages/workOrder_she/workOrder_she?id=${value[1]}` | 
|                                         }) | 
|                                     } | 
|                                 } else if (value[0] !== '' && value[0] == 'p') { | 
|                                     uni.navigateTo({ | 
|                                         url: value[1] | 
|                                     }) | 
|                                 } | 
|                             } | 
|                         } | 
|              | 
|                     } else { | 
|                         // test.doumee.cn | 
|                         // dmtest.ahapp.net | 
|                         let loc_href = encodeURIComponent("https://lkshereporting.unilever-china.com/lianhelihua_web/") | 
|                          | 
|                         let corpId = 'ww08b163f924524474'; | 
|                         let agentId = '1000165'; | 
|                                      | 
|                         let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=#wechat_redirect` | 
|                          | 
|                         location.href = wxUrl; | 
|                     } | 
|                 } else { | 
|                     let loc_href = encodeURIComponent("https://lkshereporting.unilever-china.com/lianhelihua_web/") | 
|                      | 
|                     let corpId = 'ww08b163f924524474'; | 
|                     let agentId = '1000165'; | 
|                                  | 
|                     let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=#wechat_redirect` | 
|                      | 
|                     location.href = wxUrl; | 
|                 } | 
|             }, | 
|             // 获取url参数 | 
|             getQueryVariable(variable) { | 
|                 var query = window.location.search.substring(1); | 
|                 var vars = query.split("&"); | 
|                 for (var i = 0; i < vars.length; i++) { | 
|                     var pair = vars[i].split("="); | 
|                     if (pair[0] == variable) { | 
|                         return pair[1]; | 
|                     } | 
|                 } | 
|                 return (false); | 
|             }, | 
|             async initRegister() { | 
|                 let fullURL = window.location.href.substring(0, window.location.href.lastIndexOf('#')) | 
|                 console.log(fullURL) | 
|                 let resData = await this.$u.api.getQwSignature({ url: fullURL }) | 
|                 if (resData.code === 200) { | 
|                     this.$ww.register({ | 
|                         corpId: 'ww08b163f924524474', | 
|                         agentId: '1000165', | 
|                         jsApiList: [ | 
|                             'initOpenData', | 
|                             'selectEnterpriseContact', | 
|                             'chooseImage', | 
|                             'uploadImage' | 
|                         ], | 
|                         getConfigSignature: (url) => { | 
|                             console.log(this.$ww.getSignature(resData.data.ticket)) | 
|                             return this.$ww.getSignature(resData.data.ticket) | 
|                         } | 
|                     }) | 
|                     console.log(this.$ww) | 
|                     this.$ww.initOpenData({ | 
|                         success: (res) => { | 
|                             console.log('success', res) | 
|                         }, | 
|                         fail: (err) => { | 
|                             console.log('fail', err) | 
|                         } | 
|                     }) | 
|                 } | 
|             } | 
|         } | 
|     } | 
| </script> | 
|   | 
| <style lang="scss" scoped> | 
|     .index { | 
|         width: 100vw; | 
|         padding: 30rpx; | 
|         box-sizing: border-box; | 
|         height: calc(100vh - 44px - 50px); | 
|         background: linear-gradient(180deg, #B5D2FF 0%, #FFFFFF 100%); | 
|   | 
|         .index_t { | 
|             width: 100%; | 
|             height: 196rpx; | 
|             display: flex; | 
|             align-items: center; | 
|             justify-content: space-between; | 
|   | 
|             text { | 
|                 font-weight: 900; | 
|                 font-size: 52rpx; | 
|                 color: #222222; | 
|             } | 
|   | 
|             image { | 
|                 width: 290rpx; | 
|                 height: 100%; | 
|             } | 
|         } | 
|   | 
|         .index_list { | 
|             width: 100%; | 
|             display: flex; | 
|             flex-direction: column; | 
|             margin-top: 12rpx; | 
|   | 
|             .index_list_item { | 
|                 width: 100%; | 
|                 height: 200rpx; | 
|                 margin-bottom: 30rpx; | 
|                 position: relative; | 
|   | 
|                 .index_list_item_info { | 
|                     width: 100%; | 
|                     height: 100%; | 
|                     padding: 0 48rpx; | 
|                     box-sizing: border-box; | 
|                     display: flex; | 
|                     justify-content: center; | 
|                     flex-direction: column; | 
|                     position: relative; | 
|                     z-index: 99; | 
|   | 
|                     text { | 
|                         &:nth-child(1) { | 
|                             font-weight: bold; | 
|                             font-size: 34rpx; | 
|                             color: #FFFFFF; | 
|                         } | 
|   | 
|                         &:nth-child(2) { | 
|                             font-weight: 400; | 
|                             font-size: 26rpx; | 
|                             color: rgba(255, 255, 255, 0.6); | 
|                             margin-top: 10rpx; | 
|                         } | 
|                     } | 
|                 } | 
|   | 
|                 image { | 
|                     width: 100%; | 
|                     height: 100%; | 
|                     position: absolute; | 
|                     top: 0; | 
|                     left: 0; | 
|                 } | 
|             } | 
|         } | 
|     } | 
| </style> |