提交 c4606328 authored 作者: 王鹏飞's avatar 王鹏飞

国际化项目增加header

上级 72b8d3b3
import httpRequest from '@/utils/axios'
// 登录
export function login(data) {
return httpRequest.post('/api/passport/rest/login', data)
export function login(data, options) {
return httpRequest.post('/api/passport/rest/login', data, options)
}
// 绑定微信
export function bindWechat(data) {
return httpRequest.post('/api/passport/rest/wechat/bind-unionid', data)
export function bindWechat(data, options) {
return httpRequest.post('/api/passport/rest/wechat/bind-unionid', data, options)
}
// 登出
export function logout() {
return httpRequest.get('/api/passport/rest/logout')
export function logout(options) {
return httpRequest.get('/api/passport/rest/logout', options)
}
// 获取用户信息
export function getUser() {
return httpRequest.get('/api/passport/account/get-user-info')
export function getUser(options) {
return httpRequest.get('/api/passport/account/get-user-info', options)
}
// 注册
export function register(data) {
return httpRequest.post('/api/usercenter/user/register', data)
export function register(data, options) {
return httpRequest.post('/api/usercenter/user/register', data, options)
}
// 发送验证码
export function sendCode(data) {
return httpRequest.post('/api/usercenter/user/send-code', data)
export function sendCode(data, options) {
return httpRequest.post('/api/usercenter/user/send-code', data, options)
}
// 重置密码
export function resetPassword(data) {
return httpRequest.post('/api/usercenter/user/update-pwd', data)
export function resetPassword(data, options) {
return httpRequest.post('/api/usercenter/user/update-pwd', data, options)
}
......@@ -37,6 +37,9 @@ import * as api from '@/api/account'
export default {
name: 'LoginAccount',
props: {
headers: { type: Object, default: () => ({}) }
},
data() {
return {
ruleForm: { type: 1, account: '', password: '', RememberMe: false, service: 'https://h5.ezijing.com' },
......@@ -62,7 +65,7 @@ export default {
// 接口请求
handleRequest() {
this.loading = true
api.login(this.ruleForm).then(response => {
api.login(this.ruleForm, { headers: this.headers }).then(response => {
response.code === 0 ? this.handleSuccess(response) : this.$message.error(response.msg)
this.loading = false
})
......
......@@ -43,7 +43,8 @@ import countdown from './countdown.vue'
export default {
name: 'LoginCode',
props: {
sendcode: { type: Object, default: () => ({}) }
sendcode: { type: Object, default: () => ({}) },
headers: { type: Object, default: () => ({}) }
},
components: { countdown },
data() {
......@@ -74,7 +75,7 @@ export default {
// 登录
handleRequest() {
this.loading = true
api.login(this.ruleForm).then(response => {
api.login(this.ruleForm, { headers: this.headers }).then(response => {
response.code === 0 ? this.handleSuccess(response) : this.$message.error(response.msg)
this.loading = false
})
......@@ -92,7 +93,7 @@ export default {
sendCodeRequest() {
const params = Object.assign({}, this.sendcode, { account: this.ruleForm.account })
api
.sendCode(params)
.sendCode(params, { headers: this.headers })
.then(response => {
console.log(response)
if (response.code === 0) {
......
......@@ -46,7 +46,8 @@ import countdown from './countdown.vue'
export default {
name: 'Password',
props: {
sendcode: { type: Object, default: () => ({}) }
sendcode: { type: Object, default: () => ({}) },
headers: { type: Object, default: () => ({}) }
},
components: { countdown },
data() {
......@@ -90,7 +91,7 @@ export default {
// 接口请求
handleRequest() {
this.loading = true
api.resetPassword(this.ruleForm).then(response => {
api.resetPassword(this.ruleForm, { headers: this.headers }).then(response => {
response.code === 0 ? this.handleSuccess(response) : this.$message.error(response.msg)
this.loading = false
})
......@@ -109,7 +110,7 @@ export default {
sendCodeRequest() {
const params = Object.assign({}, this.sendcode, { account: this.ruleForm.account })
api
.sendCode(params)
.sendCode(params, { headers: this.headers })
.then(response => {
console.log(response)
if (response.code === 0) {
......
......@@ -33,7 +33,8 @@ import countdown from './countdown.vue'
export default {
name: 'Register',
props: {
sendcode: { type: Object, default: () => ({}) }
sendcode: { type: Object, default: () => ({}) },
headers: { type: Object, default: () => ({}) }
},
components: { countdown },
data() {
......@@ -65,7 +66,7 @@ export default {
// 接口请求
handleRequest() {
this.loading = true
api.register(this.ruleForm).then(response => {
api.register(this.ruleForm, { headers: this.headers }).then(response => {
response.code === 0 ? this.handleSuccess(response) : this.$message.error(response.msg)
this.loading = false
})
......@@ -84,7 +85,7 @@ export default {
sendCodeRequest() {
const params = Object.assign({}, this.sendcode, { account: this.ruleForm.account })
api
.sendCode(params)
.sendCode(params, { headers: this.headers })
.then(response => {
console.log(response)
if (response.code === 0) {
......
<template>
<router-view @success="handleSuccess"></router-view>
<router-view :headers="{ x_app: 'nbd' }" @success="handleSuccess"></router-view>
</template>
<script>
......
......@@ -6,7 +6,7 @@
:content="$t('password.title')"
></el-page-header>
<div class="password-form">
<router-view></router-view>
<router-view :headers="{ x_app: 'nbd' }"></router-view>
</div>
</div>
</template>
......
<template>
<router-view @success="handleSuccess"></router-view>
<router-view :headers="{ x_app: 'nbd' }" @success="handleSuccess"></router-view>
</template>
<script>
......
......@@ -6,7 +6,7 @@
:content="$t('password.title')"
></el-page-header>
<div class="password-form">
<router-view></router-view>
<router-view :headers="{ x_app: 'nbd' }"></router-view>
</div>
</div>
</template>
......
<template>
<router-view @success="handleSuccess"></router-view>
<router-view :headers="{ x_app: 'nbd' }" @success="handleSuccess"></router-view>
</template>
<script>
......
......@@ -6,7 +6,7 @@
:content="$t('password.title')"
></el-page-header>
<div class="password-form">
<router-view></router-view>
<router-view :headers="{ x_app: 'nbd' }"></router-view>
</div>
</div>
</template>
......
<template>
<router-view @success="handleSuccess"></router-view>
<router-view :headers="{ x_app: 'nbd' }" @success="handleSuccess"></router-view>
</template>
<script>
......
......@@ -6,7 +6,7 @@
:content="$t('password.title')"
></el-page-header>
<div class="password-form">
<router-view></router-view>
<router-view :headers="{ x_app: 'nbd' }"></router-view>
</div>
</div>
</template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论