|
|
|
@ -15,26 +15,28 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import {Api_url} from '@/common/config.js' |
|
|
|
import apiRoute from '@/api/apiRoute.js' |
|
|
|
import { |
|
|
|
Api_url |
|
|
|
} from '@/common/config.js' |
|
|
|
import apiRoute from '@/api/apiRoute.js' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
|
|
|
|
userInfo:{} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//退出登陆 |
|
|
|
loginOut(){ |
|
|
|
loginOut() { |
|
|
|
this.$util.loginOut() |
|
|
|
}, |
|
|
|
|
|
|
|
privacy_agreement(type){ |
|
|
|
privacy_agreement(type) { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages-common/privacy_agreement?type='+type |
|
|
|
url: '/pages-common/privacy_agreement?type=' + type |
|
|
|
}) |
|
|
|
}, |
|
|
|
update_pass(){ |
|
|
|
update_pass() { |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages-market/my/update_pass' |
|
|
|
}) |
|
|
|
@ -87,7 +89,8 @@ import apiRoute from '@/api/apiRoute.js' |
|
|
|
} |
|
|
|
}, |
|
|
|
//绑定微信 |
|
|
|
async buildwx(){ |
|
|
|
async buildwx() { |
|
|
|
await this.getUserInfo()//获取用户详情 |
|
|
|
try { |
|
|
|
console.log('开始微信绑定流程') |
|
|
|
|
|
|
|
@ -98,7 +101,7 @@ import apiRoute from '@/api/apiRoute.js' |
|
|
|
// #endif |
|
|
|
|
|
|
|
// #ifdef H5 |
|
|
|
console.log('H5环境') |
|
|
|
// await this.bindWeixinInH5() |
|
|
|
if (this.isWeixinBrowser()) { |
|
|
|
console.log('微信浏览器环境') |
|
|
|
await this.bindWeixinInH5() |
|
|
|
@ -176,6 +179,7 @@ import apiRoute from '@/api/apiRoute.js' |
|
|
|
|
|
|
|
// H5微信浏览器环境绑定流程 |
|
|
|
async bindWeixinInH5() { |
|
|
|
|
|
|
|
uni.showLoading({ |
|
|
|
title: '正在跳转微信授权...' |
|
|
|
}) |
|
|
|
@ -185,11 +189,13 @@ import apiRoute from '@/api/apiRoute.js' |
|
|
|
const baseUrl = Api_url |
|
|
|
const redirectUri = encodeURIComponent(`${baseUrl}/personnel/wechatCallback`) |
|
|
|
const state = encodeURIComponent(JSON.stringify({ |
|
|
|
personnel_id: this.$store.state.userInfo.id, |
|
|
|
personnel_id: this.userInfo?.id, |
|
|
|
from: 'h5', |
|
|
|
timestamp: Date.now() |
|
|
|
})) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const authUrl = `${baseUrl}/personnel/wechatAuthorize?redirect_uri=${redirectUri}&state=${state}` |
|
|
|
console.log('H5授权URL:', authUrl) |
|
|
|
|
|
|
|
@ -207,7 +213,28 @@ import apiRoute from '@/api/apiRoute.js' |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
async getUserInfo() { |
|
|
|
let data = {} |
|
|
|
let res = await apiRoute.getPersonnelInfo(data); |
|
|
|
if (res.code != 1) { |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
res.data.cameus_dept_arr.forEach((v, k) => { |
|
|
|
let d_arr = [] |
|
|
|
v.dept_arr.forEach((dv, dk) => { |
|
|
|
d_arr.push(dv.dept_name) |
|
|
|
}) |
|
|
|
//数组转字符串 |
|
|
|
v.dept_name_str = d_arr.join(',') |
|
|
|
}) |
|
|
|
|
|
|
|
this.userInfo = res.data |
|
|
|
}, |
|
|
|
// 获取小程序openid |
|
|
|
getMiniProgramOpenid() { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
@ -338,7 +365,7 @@ import apiRoute from '@/api/apiRoute.js' |
|
|
|
const redirectUri = encodeURIComponent(`${baseUrl}/personnel/wechatCallback`) |
|
|
|
const state = encodeURIComponent(JSON.stringify({ |
|
|
|
mini_openid: miniOpenid, |
|
|
|
personnel_id: this.$store.state.userInfo.id, |
|
|
|
personnel_id: this.userInfo?.id, |
|
|
|
from: 'miniprogram', |
|
|
|
timestamp: Date.now() |
|
|
|
})) |
|
|
|
@ -358,12 +385,13 @@ import apiRoute from '@/api/apiRoute.js' |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="less" scoped> |
|
|
|
.assemble{ |
|
|
|
.assemble { |
|
|
|
width: 100%; |
|
|
|
height: 100vh; |
|
|
|
background: #333333; |
|
|
|
} |
|
|
|
.option{ |
|
|
|
|
|
|
|
.option { |
|
|
|
margin-bottom: 20rpx; |
|
|
|
background: #404045; |
|
|
|
width: 100%; |
|
|
|
|