|
@@ -1,76 +1,76 @@
|
|
|
-import { postHttps, getHttps } from './api/index'
|
|
|
-import vm from './main'
|
|
|
-import Cookie from 'js-cookie'
|
|
|
-import { setTimeout } from 'core-js'
|
|
|
+// import { postHttps, getHttps } from './api/index'
|
|
|
+// import vm from './main'
|
|
|
+// import Cookie from 'js-cookie'
|
|
|
+// import { setTimeout } from 'core-js'
|
|
|
|
|
|
-function strToObj (val) {
|
|
|
- let obj = {}
|
|
|
- let str = val.substr(1)
|
|
|
- let arr = str.split('&')
|
|
|
- for (let i = 0; i < arr.length; i++) {
|
|
|
- let newArr = arr[i].split('=')
|
|
|
- obj[newArr[0]] = newArr[1]
|
|
|
- }
|
|
|
- return obj
|
|
|
-}
|
|
|
+// function strToObj (val) {
|
|
|
+// let obj = {}
|
|
|
+// let str = val.substr(1)
|
|
|
+// let arr = str.split('&')
|
|
|
+// for (let i = 0; i < arr.length; i++) {
|
|
|
+// let newArr = arr[i].split('=')
|
|
|
+// obj[newArr[0]] = newArr[1]
|
|
|
+// }
|
|
|
+// return obj
|
|
|
+// }
|
|
|
|
|
|
-alert('123')
|
|
|
-if (location.search && strToObj(location.search).code) {
|
|
|
- let reqdata = {
|
|
|
- url: location.href,
|
|
|
- type: 1
|
|
|
- }
|
|
|
- alert(JSON.stringify(reqdata))
|
|
|
- setTimeout(() => {
|
|
|
- postHttps('manage/wx/getWxConfig', { reqdata }).then(r => {
|
|
|
- alert(JSON.stringify(r))
|
|
|
- let { object: {
|
|
|
- agentId: agentid,
|
|
|
- appId: corpid,
|
|
|
- nonceStr,
|
|
|
- signature,
|
|
|
- timestamp
|
|
|
- } } = r
|
|
|
- window.wx.agentConfig({
|
|
|
- corpid,
|
|
|
- timestamp,
|
|
|
- nonceStr,
|
|
|
- signature,
|
|
|
- agentid,
|
|
|
- jsApiList: ['openUserProfile', 'selectEnterpriseContact', 'openEnterpriseChat', 'hideOptionMenu', 'hideMenuItems'],
|
|
|
- success: async function () {
|
|
|
- // 回调
|
|
|
- alert('success')
|
|
|
- let { code } = strToObj(location.search)
|
|
|
- let reqdata = {
|
|
|
- code,
|
|
|
- type: 1,
|
|
|
- loginType: window.screen.width > 1000 ? 2 : 1
|
|
|
- }
|
|
|
- // let {object:{userId}} = await postHttps('manage/wx/getWxUserInfo',{reqdata})
|
|
|
- // globalUserId = userId
|
|
|
- // app.username = username
|
|
|
- // app.avatar = avatar
|
|
|
- postHttps('manage/wx/getWxUserInfo', { reqdata }).then(r => {
|
|
|
- let { object: { userId } } = r
|
|
|
- Cookie.set('userId', userId)
|
|
|
- window.screen.width > 1000 ? vm.$router.push('/pc-list') : vm.$router.push('/home')
|
|
|
- })
|
|
|
- // window.screen.width>1000? location.href=location.href.split('?')[0] + '/pc' : app.page=11
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- alert(JSON.stringify(res))
|
|
|
- if (res.errMsg.indexOf('function not exist') > -1) {
|
|
|
- alert('版本过低请升级')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(r => {
|
|
|
- alert(r)
|
|
|
- })
|
|
|
- }, 1000)
|
|
|
-} else {
|
|
|
- getHttps('/manage/wx/getUrl/1').then(() => {
|
|
|
- // location.href = r.object
|
|
|
- })
|
|
|
-}
|
|
|
+// alert('123')
|
|
|
+// if (location.search && strToObj(location.search).code) {
|
|
|
+// let reqdata = {
|
|
|
+// url: location.href,
|
|
|
+// type: 1
|
|
|
+// }
|
|
|
+// alert(JSON.stringify(reqdata))
|
|
|
+// setTimeout(() => {
|
|
|
+// postHttps('manage/wx/getWxConfig', { reqdata }).then(r => {
|
|
|
+// alert(JSON.stringify(r))
|
|
|
+// let { object: {
|
|
|
+// agentId: agentid,
|
|
|
+// appId: corpid,
|
|
|
+// nonceStr,
|
|
|
+// signature,
|
|
|
+// timestamp
|
|
|
+// } } = r
|
|
|
+// window.wx.agentConfig({
|
|
|
+// corpid,
|
|
|
+// timestamp,
|
|
|
+// nonceStr,
|
|
|
+// signature,
|
|
|
+// agentid,
|
|
|
+// jsApiList: ['openUserProfile', 'selectEnterpriseContact', 'openEnterpriseChat', 'hideOptionMenu', 'hideMenuItems'],
|
|
|
+// success: async function () {
|
|
|
+// // 回调
|
|
|
+// alert('success')
|
|
|
+// let { code } = strToObj(location.search)
|
|
|
+// let reqdata = {
|
|
|
+// code,
|
|
|
+// type: 1,
|
|
|
+// loginType: window.screen.width > 1000 ? 2 : 1
|
|
|
+// }
|
|
|
+// // let {object:{userId}} = await postHttps('manage/wx/getWxUserInfo',{reqdata})
|
|
|
+// // globalUserId = userId
|
|
|
+// // app.username = username
|
|
|
+// // app.avatar = avatar
|
|
|
+// postHttps('manage/wx/getWxUserInfo', { reqdata }).then(r => {
|
|
|
+// let { object: { userId } } = r
|
|
|
+// Cookie.set('userId', userId)
|
|
|
+// window.screen.width > 1000 ? vm.$router.push('/pc-list') : vm.$router.push('/home')
|
|
|
+// })
|
|
|
+// // window.screen.width>1000? location.href=location.href.split('?')[0] + '/pc' : app.page=11
|
|
|
+// },
|
|
|
+// fail: function (res) {
|
|
|
+// alert(JSON.stringify(res))
|
|
|
+// if (res.errMsg.indexOf('function not exist') > -1) {
|
|
|
+// alert('版本过低请升级')
|
|
|
+// }
|
|
|
+// }
|
|
|
+// })
|
|
|
+// }).catch(r => {
|
|
|
+// alert(r)
|
|
|
+// })
|
|
|
+// }, 1000)
|
|
|
+// } else {
|
|
|
+// getHttps('/manage/wx/getUrl/1').then(() => {
|
|
|
+// // location.href = r.object
|
|
|
+// })
|
|
|
+// }
|