Ver código fonte

更新登录接口

master
Eddie 3 anos atrás
pai
commit
86741def1c
15 arquivos alterados com 87 adições e 48 exclusões
  1. +1
    -1
      src/api/admin.js
  2. +17
    -2
      src/api/user.js
  3. +2
    -2
      src/components/AdminInfoDialog/index.vue
  4. +1
    -1
      src/permission.js
  5. +1
    -1
      src/router/modules/books-management.js
  6. +1
    -1
      src/router/modules/member-management.js
  7. +1
    -1
      src/router/modules/sort-management.js
  8. +12
    -13
      src/store/modules/user.js
  9. +1
    -1
      src/utils/auth.js
  10. +9
    -4
      src/utils/request.js
  11. +2
    -4
      src/views/books-management/ShuYuan-page/index.vue
  12. +1
    -0
      src/views/login/index.vue
  13. +21
    -10
      src/views/member-management/components/memberDialog.vue
  14. +17
    -6
      src/views/member-management/components/otherSettingsDialog/otherSettingsDialog.vue
  15. +0
    -1
      src/views/sort-management/components/check-books-dialog.vue

+ 1
- 1
src/api/admin.js Ver arquivo

@@ -6,7 +6,7 @@ import request from '@/utils/request'
*/
export function getAdminInfo() {
return request({
url: '/admin/Index/userInfo',
url: '/user/info',
method: 'get'
})
}


+ 17
- 2
src/api/user.js Ver arquivo

@@ -1,13 +1,28 @@
import request from '@/utils/request'

export function login(data) {
export function login(params) {
return request({
url: '/Login/login',
url: 'user/login',
method: 'POST',
params: params
})
}


export function loginRegister(data) {
return request({
url: '/user/register',
method: 'post',
data
})
}







export function sendCode(data) {
return request({
url: '/Login/loginSms',


+ 2
- 2
src/components/AdminInfoDialog/index.vue Ver arquivo

@@ -37,12 +37,12 @@
<div class="form-box flex-column">
<el-form ref="passForm" class="flex-column" label-width="82px" :model="passForm" :rules="rules">
<el-form-item label="Team ID:">
<el-input :value="adminInfo.teamId"
<el-input :value="adminInfo.id"
size="mini"
class="form-input-2"
disabled />
<FNButton
v-clipboard:copy="adminInfo.teamId"
v-clipboard:copy="adminInfo.id"
v-clipboard:success="clipboardSuccess"
v-clipboard:error="clipboardError"
size="mini"


+ 1
- 1
src/permission.js Ver arquivo

@@ -22,7 +22,7 @@ router.beforeEach(async (to, from, next) => {

console.log(hasToken)

if (!hasToken) {
if ( hasToken) {
if (to.path === '/login') {
// if is logged in, redirect to the home page
next({ path: '/' })


+ 1
- 1
src/router/modules/books-management.js Ver arquivo

@@ -3,7 +3,7 @@
import Layout from '@/layout'

const booksManagement = {
path: '/',
path: '/books',
component: Layout,
redirect: '/books',
name: 'booksManagement',


+ 1
- 1
src/router/modules/member-management.js Ver arquivo

@@ -3,7 +3,7 @@
import Layout from '@/layout'

const memberManagement = {
path: '/',
path: '/member',
component: Layout,
redirect: '/member',
name: 'memberManagement',


+ 1
- 1
src/router/modules/sort-management.js Ver arquivo

@@ -3,7 +3,7 @@
import Layout from '@/layout'

const sortManagement = {
path: '/',
path: '/sort',
component: Layout,
redirect: '/sort',
name: 'memberManagement',


+ 12
- 13
src/store/modules/user.js Ver arquivo

@@ -46,24 +46,23 @@ const actions = {

// user login
login({ commit }, userInfo) {
const { phone, password, code, type } = userInfo
const { phone, password } = userInfo
return new Promise((resolve, reject) => {
// commit('SET_TOKEN', 'admin-token')
// setToken('admin-token')
// resolve()
login({
phone: phone,
pwd: password,
loginType: type,
code: code
username: phone,
password: password,
})
.then(response => {
const { code } = response
if (code === 0) {
commit('SET_TOKEN', 'admin-token')
setToken('admin-token')
const { error_code , data} = response

console.log(error_code)
if (error_code === 0) {
commit('SET_TOKEN', )
setToken(data)
}
resolve(code)
resolve(error_code)
})
.catch(error => {
reject(error)


+ 1
- 1
src/utils/auth.js Ver arquivo

@@ -1,6 +1,6 @@
import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'
const TokenKey = 'api-token'

export function getToken() {
return Cookies.get(TokenKey)


+ 9
- 4
src/utils/request.js Ver arquivo

@@ -11,16 +11,20 @@ const service = axios.create({
withCredentials: true
})


// request interceptor
service.interceptors.request.use(
config => {
// do something before request is sent

config.headers['Content-Type'] = 'application/x-www-form-urlencoded';
if (store.getters.token) {

console.log(getToken())
// let each request carry token
// ['X-Token'] is a custom headers key
// please modify it according to the actual situation
config.headers['X-Token'] = getToken()
config.headers['api-token'] = getToken()
}
return config
},
@@ -45,8 +49,9 @@ service.interceptors.response.use(
*/
response => {
const res = response.data
console.log(res)
// if the custom code is not 20000, it is judged as an error.
if (res.code !== 0) {
if (res.error_code !== 0) {
Message({
message: res.message || 'Error',
type: 'error',
@@ -59,7 +64,7 @@ service.interceptors.response.use(
},
error => {
const errorMsg = error.response.data.msg
console.log(error.response.data)
// 特殊处理401,需要验证手机号
if (error.response.data.code === 401) {
return error.response.data


+ 2
- 4
src/views/books-management/ShuYuan-page/index.vue Ver arquivo

@@ -89,7 +89,7 @@
border
fit
tooltip-effect="dark"
@selection-change="handleSelectionChange"
>
<el-table-column
type="index"
@@ -226,9 +226,7 @@ export default {
// }
// })
},
handleSelectionChange(val) {
this.multipleSelection = val
},
// 更新操作
refreshData() {
this._baseRequest(true)


+ 1
- 0
src/views/login/index.vue Ver arquivo

@@ -213,6 +213,7 @@ export default {
this.$store
.dispatch("user/login", this.loginForm)
.then((code) => {
console.log( code ,9989)
if (code === 401) {
this.needSendCode = true;
this.$message.warning("为了您的账户安全,请输入手机验证码校验");


+ 21
- 10
src/views/member-management/components/memberDialog.vue Ver arquivo

@@ -79,7 +79,7 @@
<div class="item-list">
<span class="itemSpan1">邀请码</span>
<span class="itemSpan2" style="color: #178cf8">YT23694</span>
<el-button @click="setInvitationCode" type="primary" size="mini" icon="el-icon-edit" plain
<el-button @click="setInvitation('设置邀请码')" type="primary" size="mini" icon="el-icon-edit" plain
>自定义邀请码</el-button
>
</div>
@@ -87,7 +87,7 @@
<div class="item-list">
<span class="itemSpan1">支付宝账号</span>
<span class="itemSpan2">******</span>
<el-button type="danger" size="mini" icon="el-icon-bank-card" plain
<el-button @click="setInvitation('修改绑定的支付宝')" type="danger" size="mini" icon="el-icon-bank-card" plain
>更改绑定账号</el-button
>
</div>
@@ -95,7 +95,7 @@
<div class="item-list">
<span class="itemSpan1">会员等级</span>
<span class="itemSpan2" style="color: #178cf8">普通会员</span>
<el-button type="primary" size="mini" icon="el-icon-edit" plain
<el-button @click="setInvitation('设置等级')" type="primary" size="mini" icon="el-icon-edit" plain
>设置等级</el-button
>
</div>
@@ -104,7 +104,7 @@
<div class="item-list">
<span class="itemSpan1">余额变动</span>
<span class="itemSpan2" style="color: #ff4242">0.0000</span>
<el-button type="primary" size="mini" icon="el-icon-edit" plain
<el-button @click="setInvitation('调整余额')" type="primary" size="mini" icon="el-icon-edit" plain
>调整</el-button
>
</div>
@@ -112,7 +112,7 @@
<div class="item-list">
<span class="itemSpan1">积分变动</span>
<span class="itemSpan2" style="color: #ff4242">0.0000</span>
<el-button type="primary" size="mini" icon="el-icon-edit" plain
<el-button @click="setInvitation('调整积分')" type="primary" size="mini" icon="el-icon-edit" plain
>调整</el-button
>
</div>
@@ -130,8 +130,10 @@
</el-footer>

<OtherSettingsDialog
:showDialog="true"
:dialogTitle="'设置等级'"
:showDialog="isOtherSettings"
:dialogTitle="othoerItem.title"
:selectItem="othoerItem.data"
@handle-close="OtherClose"
></OtherSettingsDialog>
</Dialog>
</template>
@@ -174,6 +176,8 @@ export default {
rules: {},

//
isOtherSettings: false,
othoerItem: {},

options: [
{
@@ -235,12 +239,19 @@ export default {
},

// 自定义邀请码
setInvitationCode(){
this.setItemData = {
title: '自定义邀请码',
setInvitation(title){
this.othoerItem = {
title: title,
data: []
}
this.isOtherSettings = true
},

OtherClose(){
console.log(123)
this.isOtherSettings = false
}
},
};
</script>


+ 17
- 6
src/views/member-management/components/otherSettingsDialog/otherSettingsDialog.vue Ver arquivo

@@ -16,7 +16,7 @@
<span style="margin-bottom: 20px; color: #333333; font-size: 14px"
>15326713918</span
>
<el-form-item label="等级">
<el-form-item label="等级" v-if="dialogTitle === '设置等级'">
<el-select style="width: 360px" v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
@@ -28,22 +28,29 @@
</el-select>
</el-form-item>

<el-form-item label="支付宝提现账号">
<el-form-item label="支付宝提现账号" v-if="dialogTitle === '修改绑定的支付宝'">
<el-input
style="width: 360px"
placeholder="请输入支付宝提现账号"
></el-input>
</el-form-item>

<el-form-item label="真实姓名">
<el-form-item label="真实姓名" v-if="dialogTitle === '修改绑定的支付宝'">
<el-input style="width: 360px" placeholder="请输入真实姓名"></el-input>
</el-form-item>

<el-form-item label="可提现余额">
<el-form-item label="邀请码" v-if="dialogTitle === '设置邀请码'">
<el-input style="width: 360px" placeholder="请输入邀请码"></el-input>
</el-form-item>


<el-form-item label="可提现余额" v-if="dialogTitle === '调整余额'">
<el-input style="width: 360px" placeholder="0.00"></el-input>
</el-form-item>
<el-form-item label="积分变动">
<el-form-item label="积分变动" v-if="dialogTitle === '调整积分'">
<el-input style="width: 360px" placeholder="0.00"></el-input>
</el-form-item>
</div>
@@ -72,7 +79,7 @@ export default {
},
// 选中的数据
selectItem: {
type: Object,
type: Array,
default: () => {},
},
dialogTitle: {
@@ -82,6 +89,9 @@ export default {
},
},
},
mounted(){
console.log(this.selectItem)
},
data() {
return {
// dialog样式
@@ -131,6 +141,7 @@ export default {
methods: {
// 关闭弹窗
handleClose() {
console.log(123)
this.$emit("handle-close");
},
// 提交弹窗


+ 0
- 1
src/views/sort-management/components/check-books-dialog.vue Ver arquivo

@@ -80,7 +80,6 @@
border
fit
tooltip-effect="dark"
@selection-change="handleSelectionChange"
>
<el-table-column
type="index"


Carregando…
Cancelar
Salvar