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-05-11 22:28:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
67af5544466846a293b855868126cb2a0076e7b6
67af5544
1 parent
b91ddf4d
✨ feat(B端首页): API联调
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
22 deletions
src/utils/axios.js
src/views/business/index.vue
src/utils/axios.js
View file @
67af554
...
...
@@ -39,6 +39,12 @@ axios.interceptors.response.use(
}
});
}
// TEMP: 临时拦截B端未登录情况
if
(
response
.
data
.
msg
===
'老师请先登录!'
||
response
.
data
.
msg
===
'老师不存在!'
)
{
router
.
replace
({
path
:
'/business/login'
});
}
return
response
;
},
error
=>
{
...
...
src/views/business/index.vue
View file @
67af554
...
...
@@ -2,10 +2,10 @@
<div class="all-book-page content-bg">
<div class="modify-top"></div>
<div class="belong-school">
<van-image round width="2rem" height="2rem" lazy-load
src="https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPngcff89d3955421a988f983d312e970e4f07e08045b33c0505e52c65bb63ac35a9
" style="vertical-align: text-bottom;" >
<van-image round width="2rem" height="2rem" lazy-load
:src="kgInfo.logo
" style="vertical-align: text-bottom;" >
<template v-slot:error>加载失败</template>
</van-image>
<p class="title">
杨浦民办科技幼稚园
</p>
<p class="title">
{{ kgInfo.name }}
</p>
</div>
<div class="summary">
<div class="ding left"></div>
...
...
@@ -13,18 +13,18 @@
<div class="content-box" style="">
<van-row class="van-hairline--bottom">
<van-col span="12" class="van-hairline--right">
<div class="text-box"><span class="text">视频上传</span>
24<span style="color: #888888;">/30
</span></div>
<div class="text-box"><span class="text">视频上传</span>
{{ kgInfo.mission_num }}<span style="color: #888888;">/{{ kgInfo.mission_target }}
</span></div>
</van-col>
<van-col span="12">
<div class="text-box"><span class="text">作品总数</span>
436
</div>
<div class="text-box"><span class="text">作品总数</span>
{{ kgInfo.prod_num }}
</div>
</van-col>
</van-row>
<van-row>
<van-col span="12" class="van-hairline--right">
<div class="text-box"><span class="text">捐书金额</span> 
¥ 235
</div>
<div class="text-box"><span class="text">捐书金额</span> 
;¥ {{ kgInfo.donate_amt }}
</div>
</van-col>
<van-col span="12">
<div class="text-box"><span class="text">参与人数</span>
876
</div>
<div class="text-box"><span class="text">参与人数</span>
{{ kgInfo.perf_num }}
</div>
</van-col>
</van-row>
</div>
...
...
@@ -40,11 +40,11 @@
<van-col span="8"></van-col>
<van-col span="8" class="right">
<van-icon :name="icon_book" size="0.8rem" style="vertical-align: middle;" />
<span style="vertical-align: middle;">共
15
种</span>
<span style="vertical-align: middle;">共
{{ kgInfo.book_num }}
种</span>
</van-col>
</van-row>
</div>
<template v-for="(item, key) in
items
" :key="key">
<template v-for="(item, key) in
kgInfo.book
" :key="key">
<book-card :item="item" type="B" @on-click="onClick(item)"></book-card>
</template>
</div>
...
...
@@ -55,14 +55,12 @@
<script setup>
import icon_book from '@images/shu@2x.png'
import MyButton from '@/components/MyButton/index.vue'
import BookCard from '@/components/BookCard/index.vue'
import ShortcutFixed from '@/components/ShortcutFixed/index.vue'
import { ref, reactive, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from '@/utils/axios';
import $ from 'jquery'
import { Toast } from 'vant';
const $route = useRoute();
const $router = useRouter();
...
...
@@ -77,17 +75,24 @@ const onClick = (item) => {
}
});
}
const gotoMe = () => {
console.warn('跳转我的地址');
}
onMounted(() => {
for (let index = 0; index < 20; index++) {
items.push({
id: index,
avatar: 'https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng4bb07576e7df209c1f91dd67e0c2671bd5704366605bc720b56d20b38602c2b7'
})
}
})
// TODO: 后端要给我个确切的判断,没有登录,中文太坑了
const kgInfo = ref({});
axios.get('/srv/?a=kg_info')
.then(res => {
if (res.data.code === 1) {
kgInfo.value = res.data.data;
} else {
console.warn(res);
Toast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
})
</script>
<script>
...
...
@@ -181,4 +186,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
...
...
Please
register
or
login
to post a comment