diff --git a/src/api/login.js b/src/api/login.js index 786abd7..d92e87f 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -11,15 +11,23 @@ export function loginIn(data) { data }) } -// 企业登录 -export function Wxlogin(data) { +// 企业微信登录获取code 构造网页授权链接 +export function Wxlogin(query) { return request({ url: 'system/auth/social-auth-redirect', method: 'get', headers: { isToken: false }, - params: data + params: query + }) +} +// 通过code 后端获取访问用户身份 +export function sendCode(query) { + return request({ + url: '', + method: 'get', + params: query }) } diff --git a/src/components/ConnectInvoice/index.vue b/src/components/ConnectInvoice/index.vue index 0d41c6f..2f6c63b 100644 --- a/src/components/ConnectInvoice/index.vue +++ b/src/components/ConnectInvoice/index.vue @@ -42,7 +42,11 @@ :key="index" >
- +
arr.includes(item.id)) || []).map(item => item.invoiceCode)).join('、') - this.$set( + /* this.$set( this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'invoiceIds', arr @@ -1139,13 +1139,33 @@ export default { this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], 'invoiceName', '已关联发票' + ) */ + this.$set( + this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], + 'invoiceIds', + arr + ) + this.$set( + this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], + 'show', + false + ) + this.$set( + this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], + 'invoiceCount', + this.totalCount(arr) == 0 ? '' : this.totalCount(arr) + ) + this.$set( + this.form.expenseClaimTrips[index].expenseClaimDetails[nIndex], + 'invoiceName', + this.totalCount(arr) == 0 ? '请关联' : '已关联发票' ) }, handleConfirmIe1(arr, nIndex) { // let nameArr = ((this.ieList.filter(item => arr.includes(item.id)) || []).map(item => item.invoiceCode)).join('、') this.$set(this.form.expenseClaimDetails[nIndex], 'invoiceIds', arr) this.$set(this.form.expenseClaimDetails[nIndex], 'show', false) - this.$set( + /* this.$set( this.form.expenseClaimDetails[nIndex], 'invoiceCount', this.totalCount(arr) @@ -1154,6 +1174,16 @@ export default { this.form.expenseClaimDetails[nIndex], 'invoiceName', '已关联发票' + ) */ + this.$set( + this.form.expenseClaimDetails[nIndex], + 'invoiceCount', + this.totalCount(arr) == 0 ? '' : this.totalCount(arr) + ) + this.$set( + this.form.expenseClaimDetails[nIndex], + 'invoiceName', + this.totalCount(arr) == 0 ? '请关联' : '已关联发票' ) }, diff --git a/src/views/login/index.vue b/src/views/login/index.vue index ee8d8cb..a0cf137 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -59,7 +59,7 @@ import { mapGetters, mapActions } from 'vuex' import { getCaptchaEnable, getTenantEnable } from '@/utils/ruoyi' import { getTenantIdByName } from '@/api/system/tenant' -import { Wxlogin } from '@/api/login' +import { Wxlogin, sendCode } from '@/api/login' import { setTenantId } from '@/utils/auth' export default { data() { @@ -104,9 +104,24 @@ export default { }, methods: { handleWxLogin() { - Wxlogin({ type: 30, redirectUri: '/home' }).then((res) => { + // 发起授权定向 + Wxlogin({ + appid: 'ww844f700e3bdef940', + response_type: 'code', + scope: 'snsapi_privateinfo', + agentid: '1000002', + type: 30, + redirectUri: encodeURIComponent('http://expense-h5.lyrfp.com/#/login'), + }).then((res) => { console.log(res) - window.location.href = res.data + // window.location.href = res.data + // let urlParams = new URLSearchParams(window.location.href.split('?')[1]) + // let code = urlParams.get('code') + // // 发送code获取成员信息 + // sendCode({ code }).then((res) => { + // //访问用户敏感信息 + // console.log(res) + // }) }) }, handleSetLoginInfo() { diff --git a/vue.config.js b/vue.config.js index 3ff59b4..38a80a2 100644 --- a/vue.config.js +++ b/vue.config.js @@ -23,8 +23,8 @@ module.exports = { // detail: https://cli.vuejs.org/config/#devserver-proxy ['/proxy-api']: { // target: `http://localhost:48080`, - // target: `http://192.168.3.81:48080`, - target: `http://192.168.3.243:48080`, + target: `http://192.168.3.81:48080`, + // target: `http://192.168.3.243:48080`, // target: `http://api-dashboard.yudao.iocoder.cn`, changeOrigin: true, pathRewrite: {