Browse Source

更新登录接口

master
Eddie 3 years ago
parent
commit
86741def1c
15 changed files with 87 additions and 48 deletions
  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 View File

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


+ 17
- 2
src/api/user.js View File

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


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


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








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


+ 2
- 2
src/components/AdminInfoDialog/index.vue View File

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


+ 1
- 1
src/permission.js View File

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


console.log(hasToken) console.log(hasToken)


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


+ 1
- 1
src/router/modules/books-management.js View File

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


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


+ 1
- 1
src/router/modules/member-management.js View File

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


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


+ 1
- 1
src/router/modules/sort-management.js View File

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


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


+ 12
- 13
src/store/modules/user.js View File

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


// user login // user login
login({ commit }, userInfo) { login({ commit }, userInfo) {
const { phone, password, code, type } = userInfo
const { phone, password } = userInfo
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// commit('SET_TOKEN', 'admin-token')
// setToken('admin-token')
// resolve()
login({ login({
phone: phone,
pwd: password,
loginType: type,
code: code
username: phone,
password: password,
}) })
.then(response => { .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 => { .catch(error => {
reject(error) reject(error)


+ 1
- 1
src/utils/auth.js View File

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


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


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


+ 9
- 4
src/utils/request.js View File

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



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

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

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


+ 2
- 4
src/views/books-management/ShuYuan-page/index.vue View File

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


+ 1
- 0
src/views/login/index.vue View File

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


+ 21
- 10
src/views/member-management/components/memberDialog.vue View File

@@ -79,7 +79,7 @@
<div class="item-list"> <div class="item-list">
<span class="itemSpan1">邀请码</span> <span class="itemSpan1">邀请码</span>
<span class="itemSpan2" style="color: #178cf8">YT23694</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 >自定义邀请码</el-button
> >
</div> </div>
@@ -87,7 +87,7 @@
<div class="item-list"> <div class="item-list">
<span class="itemSpan1">支付宝账号</span> <span class="itemSpan1">支付宝账号</span>
<span class="itemSpan2">******</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 >更改绑定账号</el-button
> >
</div> </div>
@@ -95,7 +95,7 @@
<div class="item-list"> <div class="item-list">
<span class="itemSpan1">会员等级</span> <span class="itemSpan1">会员等级</span>
<span class="itemSpan2" style="color: #178cf8">普通会员</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 >设置等级</el-button
> >
</div> </div>
@@ -104,7 +104,7 @@
<div class="item-list"> <div class="item-list">
<span class="itemSpan1">余额变动</span> <span class="itemSpan1">余额变动</span>
<span class="itemSpan2" style="color: #ff4242">0.0000</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 >调整</el-button
> >
</div> </div>
@@ -112,7 +112,7 @@
<div class="item-list"> <div class="item-list">
<span class="itemSpan1">积分变动</span> <span class="itemSpan1">积分变动</span>
<span class="itemSpan2" style="color: #ff4242">0.0000</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 >调整</el-button
> >
</div> </div>
@@ -130,8 +130,10 @@
</el-footer> </el-footer>


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


// //
isOtherSettings: false,
othoerItem: {},


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


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

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


+ 17
- 6
src/views/member-management/components/otherSettingsDialog/otherSettingsDialog.vue View File

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


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


<el-form-item label="真实姓名">
<el-form-item label="真实姓名" v-if="dialogTitle === '修改绑定的支付宝'">
<el-input style="width: 360px" placeholder="请输入真实姓名"></el-input> <el-input style="width: 360px" placeholder="请输入真实姓名"></el-input>
</el-form-item> </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-input style="width: 360px" placeholder="0.00"></el-input>
</el-form-item> </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-input style="width: 360px" placeholder="0.00"></el-input>
</el-form-item> </el-form-item>
</div> </div>
@@ -72,7 +79,7 @@ export default {
}, },
// 选中的数据 // 选中的数据
selectItem: { selectItem: {
type: Object,
type: Array,
default: () => {}, default: () => {},
}, },
dialogTitle: { dialogTitle: {
@@ -82,6 +89,9 @@ export default {
}, },
}, },
}, },
mounted(){
console.log(this.selectItem)
},
data() { data() {
return { return {
// dialog样式 // dialog样式
@@ -131,6 +141,7 @@ export default {
methods: { methods: {
// 关闭弹窗 // 关闭弹窗
handleClose() { handleClose() {
console.log(123)
this.$emit("handle-close"); this.$emit("handle-close");
}, },
// 提交弹窗 // 提交弹窗


+ 0
- 1
src/views/sort-management/components/check-books-dialog.vue View File

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


Loading…
Cancel
Save