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-18 15:07:38 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
785e8c1ede9333a4121e78afa04c8876ec25239d
785e8c1e
1 parent
9251125a
✨ feat(书籍列表页): 上传视频判断条件修改
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
79 deletions
src/composables/useDefaultPerf.js
src/views/client/bookDetail.vue
src/views/client/chooseBook.vue
src/composables/useDefaultPerf.js
View file @
785e8c1
...
...
@@ -24,7 +24,8 @@ export const useDefaultPerf = (bookId) => {
price
:
res
.
data
.
data
.
book_price
,
user_id
:
res
.
data
.
data
.
user_id
,
perf_id
:
res
.
data
.
data
.
perf_id
,
perf_name
:
res
.
data
.
data
.
perf_name
perf_name
:
res
.
data
.
data
.
perf_name
,
can_upload
:
res
.
data
.
data
.
can_upload
,
// can_upload :1=可上传,-1=用户没有实名,-2=用户没有儿童表演者
}
}
else
{
console
.
warn
(
res
);
...
...
src/views/client/bookDetail.vue
View file @
785e8c1
...
...
@@ -81,25 +81,16 @@
<my-button @on-click="toDonate" type="plain">爱心捐书</my-button>
</div>
<div class="button">
<my-button @on-click="
validUpload
" type="primary">上传作品</my-button>
<my-button @on-click="
uploadVideo
" type="primary">上传作品</my-button>
</div>
</div>
<shortcut-fixed type="C" :item="['home', 'me']"></shortcut-fixed>
</div>
<!--
写评论时,
如果没有实名认证提示弹框 -->
<notice-overlay :show="showNotice"
text="前往认证
" @on-submit="onSubmit" @on-close="onClose">
<!--
上传时,如果没有默认儿童提示弹框,
如果没有实名认证提示弹框 -->
<notice-overlay :show="showNotice"
:text="noticeText
" @on-submit="onSubmit" @on-close="onClose">
<div style="color: #333333;">
<p>您还没有实名认证</p>
<p>请前往个人中心进行实名认证</p>
</div>
</notice-overlay>
<!-- 上传时,如果没有默认儿童提示弹框 -->
<notice-overlay :show="showPerfNotice" text="前往新增" @on-submit="onSubmit" @on-close="onPerfClose">
<div style="color: #333333;">
<p>您还没有新增儿童</p>
<p>请前往个人中心进行新增</p>
<div v-html="noticeHtml"></div>
</div>
</notice-overlay>
...
...
@@ -183,45 +174,29 @@ const closeDonate = (v) => {
}
/**********************************/
// 跳转个人中心
const onSubmit = () => {
$router.push({
path: '/me/index'
});
}
/**
* 上传作品回调
*/
//
未实名认证提示
//
不能上传提示原因弹框
const showNotice = ref(false)
const onClose = () => { // 关闭提示框回调
showNotice.value = false;
}
// 未新增儿童提示
const showPerfNotice = ref(false);
const onPerfClose = () => { // 关闭提示框回调
showPerfNotice.value = false;
}
// 上传前检查是否有默认儿童
const validUpload = () => {
if (!donateItem.value.perf_id) {
showPerfNotice.value = true;
} else {
uploadVideo();
}
// 跳转个人中心
const onSubmit = () => {
$router.push({
path: '/me/index'
});
}
const noticeText = ref('')
const noticeHtml = ref('')
const show = ref(false); // 跳转等待提示
const uploadVideo = () => {
if (donateItem.value.can_upload === 1) { // 可以上传
show.value = true;
axios.get('/srv/?a=can_upload')
.then(res => {
if (res.data.code === 1) {
// 实名认证标识
if (res.data.data.can_upload) {
// x_field_1 是金数据表单传入的参数,家长上传的格式为:user_id-book_id-perf_id,perf_id是当前缺省的儿童id
const str = `${donateItem.value.user_id}-${$route.query.id}-${donateItem.value.perf_id}`;
// 已读隐私条例,直接跳转上传页面
...
...
@@ -231,7 +206,7 @@ const uploadVideo = () => {
setTimeout(() => {
show.value = false;
}, 2000);
} else {
} else { // 跳转个人隐私阅读
$router.push({
path: '/client/privacyNotice',
query: {
...
...
@@ -239,22 +214,21 @@ const uploadVideo = () => {
}
})
}
} else {
// 如果没有实名认证需要提示用户实名认证
} else if (donateItem.value.can_upload === -1) { // 未实名认证
showNotice.value = true;
noticeText.value = '前往认证'
noticeHtml.value = `
<p>您还没有实名认证</p>
<p>请前往个人中心进行实名认证</p>
`
} else if (donateItem.value.can_upload === -2) { // 没有默认儿童
showNotice.value = true;
noticeText.value = '前往新增'
noticeHtml.value = `
<p>您还没有新增儿童</p>
<p>请前往个人中心进行新增</p>
`
}
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
})
}
/****************** keepAlive 模块 *******************/
...
...
src/views/client/chooseBook.vue
View file @
785e8c1
...
...
@@ -85,37 +85,12 @@ const styleObject = reactive({
// 跳转书籍详情页
const onClick = (item) => {
/**
* 获取默认儿童信息
* @returns name, perf_id, kg_id
*/
axios.get('/srv/?a=default_perf', {
params: {
book_id: item.id
}
})
.then(res => {
if (res.data.code === 1) {
// 缓存缺省儿童信息
Cookies.set('default_perf', JSON.stringify(res.data.data))
$router.push({
path: '/client/bookDetail',
query: {
id: item.id
}
});
} else {
console.warn(res);
if (!res.data.show) return false;
Toast({
icon: 'close',
message: res.data.msg
});
}
})
.catch(err => {
console.error(err);
});
}
</script>
...
...
Please
register
or
login
to post a comment