doum
2025-08-19 4ca832919612bf2fc4d13b73df135680ac391b24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<script>
    export default {
        onLaunch: function() {
            // this.init()
            this.goException()             
            this.initRegister()
        },
        onShow: function() {
            //this.goException()             
            console.log('App Show')
        },
        onHide: function() {
            console.log('App Hide')
        },
        methods: {
            goException(){
                try {
                  const res = wx.getSystemInfoSync() 
                  if!res.environment  || res.environment !=='wxwork' ){
                      uni.reLaunch({
                          url:'/pages/exception/exception'
                      })
                  } 
                } catch (e) {
                  uni.reLaunch({
                      url:'/pages/exception/exception'
                  })
                } 
            },
            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)
                        }
                    })
                }
            }
            // 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] !== '') {
            //                         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 (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] !== '') {
            //                         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 {
            //             // test.doumee.cn
            //             // dmtest.ahapp.net
            //             let loc_href = encodeURIComponent("https://test.doumee.cn/lianhelihua_web/")
                        
            //             let corpId = 'wweea8f71b54e3b835';
            //             let agentId = '1000095';
                                    
            //             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://test.doumee.cn/lianhelihua_web/")
                    
            //         let corpId = 'wweea8f71b54e3b835';
            //         let agentId = '1000095';
                                
            //         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: 'wweea8f71b54e3b835',
            //             agentId: '1000095',
            //             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">
    @import "uview-ui/index.scss";
</style>