Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-06-17 22:45:54 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bb93f95a2db41780f101950cb3d1e7c9d28347a4
bb93f95a
1 parent
1dbb8904
✨ feat(B端页面): 登录模块和我的模块API形式调整
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
59 deletions
src/api/B/kg.js
src/api/B/login.js
src/views/business/login.vue
src/views/business/me.vue
src/api/B/kg.js
View file @
bb93f95
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-06-09 02:25:31
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-
09 02:26:54
* @LastEditTime: 2022-06-
17 22:32:59
* @FilePath: /tswj/src/api/B/kg.js
* @Description: 幼儿园主页接口
*/
...
...
@@ -10,6 +10,7 @@ import { fn, fetch } from '@/api/fn';
const
Api
=
{
KG_INFO
:
'/srv/?a=kg_info'
,
MY_KG
:
'/srv/?a=my_kg'
,
}
/**
...
...
@@ -17,3 +18,9 @@ const Api = {
* @returns {*} data
*/
export
const
kgInfoAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
KG_INFO
,
params
));
/**
* @description 我的幼儿园详情
* @returns {*} data
*/
export
const
myKgAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
MY_KG
,
params
));
...
...
src/api/B/login.js
View file @
bb93f95
/*
* @Date: 2022-06-17 15:03:03
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-17
15:05:04
* @LastEditTime: 2022-06-17
22:44:30
* @FilePath: /tswj/src/api/B/login.js
* @Description: 文件描述
*/
...
...
@@ -9,6 +9,7 @@ import { fn, fetch } from '@/api/fn';
const
Api
=
{
B_LOGIN
:
'/srv/?a=b_login'
,
B_LOGOUT
:
'/srv/?a=b_logout'
,
}
/**
...
...
@@ -16,4 +17,9 @@ const Api = {
* @param {*} phone 手机号
* @param {*} pin 验证码
*/
export
const
b_LoginAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
B_LOGIN
,
params
));
export
const
bLoginAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
B_LOGIN
,
params
));
/**
* @description 登出接口
*/
export
const
bLogoutAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
B_LOGOUT
,
params
));
...
...
src/views/business/login.vue
View file @
bb93f95
...
...
@@ -53,7 +53,7 @@ import { wxInfo } from '@/utils/tools';
import { useCountDown } from '@vant/use';
import { smsAPI } from '@/api/common'
import { b
_
LoginAPI } from '@/api/B/login'
import { bLoginAPI } from '@/api/B/login'
const $router = useRouter();
...
...
@@ -177,7 +177,7 @@ const formatter = (value) => value.substring(0, 4);
*/
const onSubmit = async (values) => {
const { code } = await b
_
LoginAPI({ phone: values.phone, pin: values.code })
const { code } = await bLoginAPI({ phone: values.phone, pin: values.code })
if (code === 1) {
$router.push({
path: '/business/index'
...
...
src/views/business/me.vue
View file @
bb93f95
...
...
@@ -28,46 +28,36 @@
import ShortcutFixed from '@/components/ShortcutFixed/index.vue'
import { icon_logo } from '@/utils/generateIcons';
import { USER_ROLE } from '@/constant'
import { ref} from 'vue'
import {
onMounted,
ref} from 'vue'
import { useRouter } from 'vue-router'
import axios from '@/utils/axios';
import { Toast } from 'vant';
import { myKgAPI } from '@/api/B/kg'
import { bLogoutAPI } from '@/api/B/login'
const $router = useRouter();
const myKgInfo = ref({});
let itemList = ref([])
axios.get('/srv/?a=my_kg')
.then(res => {
if (res.data.code === 1) {
myKgInfo.value = res.data.data;
// 有空格分割name
if (myKgInfo.value.name.indexOf(' ') > -1) {
myKgInfo.value.multi_name = myKgInfo.value.name.split(' ');
}
itemList.value = [
{
name: '幼儿园上传视频',
sum: res.data.data.mission_num,
to: '/business/myVideo'
},
{
name: '家长上传视频',
sum: res.data.data.prod_num,
tag: true,
to: '/business/auditVideo'
},
]
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
icon: 'close',
message: res.data.msg
});
let itemList = ref([]);
onMounted(async () => {
const { data } = await myKgAPI();
myKgInfo.value = data;
// 有空格分割name
if (myKgInfo.value.name.indexOf(' ') > -1) {
myKgInfo.value.multi_name = myKgInfo.value.name.split(' ');
}
})
.catch(err => {
console.error(err);
itemList.value = [
{
name: '幼儿园上传视频',
sum: data.mission_num,
to: '/business/myVideo'
},
{
name: '家长上传视频',
sum: data.prod_num,
tag: true,
to: '/business/auditVideo'
},
]
})
const goTo = (path) => { // 跳转作品详情页
...
...
@@ -77,25 +67,13 @@ const goTo = (path) => { // 跳转作品详情页
}
// 退出登录
const exitLogin = () => {
axios.post('/srv/?a=b_logout')
.then(res => {
if (res.data.code === 1) {
$router.replace({
path: '/business/login'
});
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
})
const exitLogin = async () => {
const { code } = await bLogoutAPI()
if (code === 1) {
$router.replace({
path: '/business/login'
});
}
}
</script>
...
...
Please
register
or
login
to post a comment