Commit b5937b1f authored by spc's avatar spc

publish

parent afe547eb
...@@ -169,31 +169,28 @@ ...@@ -169,31 +169,28 @@
} }
}, },
{ {
"path" : "pages/testPage/testPage", "path": "pages/testPage/testPage",
"style" : "style": {
{ "navigationBarTitleText": ""
"navigationBarTitleText" : ""
} }
}, },
{ {
"path" : "pages/thirdJumpMiddlePage/thirdJumpMiddlePage", "path": "pages/thirdJumpMiddlePage/thirdJumpMiddlePage",
"style" : "style": {
{ "navigationBarTitleText": ""
"navigationBarTitleText" : ""
} }
}, },
{ {
"path" : "pages/XingmaLabDetailPage/XingmaLabDetailPage", "path": "pages/XingmaLabDetailPage/XingmaLabDetailPage",
"style" : "style": {
{ "navigationBarTitleText": "",
"navigationBarTitleText" : "" "navigationStyle": "custom"
} }
}, },
{ {
"path" : "pages/XingmaLabPublishPage/XingmaLabPublishPage", "path": "pages/XingmaLabPublishPage/XingmaLabPublishPage",
"style" : "style": {
{ "navigationBarTitleText": ""
"navigationBarTitleText" : ""
} }
} }
], ],
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
position: absolute; position: absolute;
.xingmalabdetailpagebg { .xingmalabdetailpagebg {
width: 750rpx; width: 750rpx;
height: 1624rpx; height: 1624rpx;
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
} }
.xingmalabdetailpagetext { .xingmalabdetailpagetext {
width: 295rpx; width: 295rpx;
height: 31rpx; height: 31rpx;
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
color: rgba(29, 30, 37, 1); color: rgba(29, 30, 37, 1);
text-align: center; text-align: center;
} }
.xingmalabdetailpagepicbg { .xingmalabdetailpagepicbg {
width: 730rpx; width: 730rpx;
height: 1030rpx; height: 1030rpx;
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
} }
.xingmalabdetailpagepic { .xingmalabdetailpagepic {
width: 688rpx; width: 688rpx;
height: 914rpx; height: 914rpx;
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
} }
.xingmalabdetailpagenum { .xingmalabdetailpagenum {
width: 348rpx; width: 348rpx;
height: 26rpx; height: 26rpx;
...@@ -62,14 +62,14 @@ ...@@ -62,14 +62,14 @@
color: rgba(178, 124, 30, 1); color: rgba(178, 124, 30, 1);
text-align: center; text-align: center;
} }
.xingmalabdetailpagebottomcon { .xingmalabdetailpagebottomcon {
width: 750rpx; width: 750rpx;
height: 218rpx; height: 218rpx;
left: 0rpx; left: 0rpx;
top: 1406rpx; top: 1406rpx;
position: absolute; position: absolute;
.xingmalabdetailpagebottomconbg { .xingmalabdetailpagebottomconbg {
width: 750rpx; width: 750rpx;
height: 218rpx; height: 218rpx;
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
} }
.xingmalabdetailpagebottomconlikebtn { .xingmalabdetailpagebottomconlikebtn {
width: 119rpx; width: 119rpx;
height: 44rpx; height: 44rpx;
...@@ -90,14 +90,14 @@ ...@@ -90,14 +90,14 @@
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
&:hover { &:hover {
opacity: 0.8; opacity: 0.8;
} }
} }
.xingmalabdetailpagebottomconsharebtn { .xingmalabdetailpagebottomconsharebtn {
width: 121rpx; width: 121rpx;
height: 42rpx; height: 42rpx;
...@@ -107,15 +107,15 @@ ...@@ -107,15 +107,15 @@
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
&:hover { &:hover {
opacity: 0.8; opacity: 0.8;
} }
} }
} }
.xingmalabdetailpagetime { .xingmalabdetailpagetime {
width: 203rpx; width: 203rpx;
height: 23rpx; height: 23rpx;
...@@ -128,67 +128,6 @@ ...@@ -128,67 +128,6 @@
} }
} }
// 响应式适配
@media screen and (max-width: 750px) {
.xingmalabdetailpage {
width: 100vw;
height: 100vh;
.xingmalabdetailpagebg,
.xingmalabdetailpagepicbg,
.xingmalabdetailpagepic,
.xingmalabdetailpagebottomcon {
width: 100%;
height: auto;
left: 0;
top: 0;
}
.xingmalabdetailpagetext,
.xingmalabdetailpagenum,
.xingmalabdetailpagetime {
position: relative;
left: auto;
top: auto;
margin: 20rpx auto;
text-align: center;
}
}
}
// 动画效果
.xingmalabdetailpage {
animation: fadeIn 0.5s ease-in-out;
.xingmalabdetailpagepic {
animation: slideInUp 0.8s ease-out 0.2s both;
}
.xingmalabdetailpagebottomcon {
animation: slideInUp 0.8s ease-out 0.4s both;
}
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes slideInUp {
from {
opacity: 0;
transform: translateY(50rpx);
}
to {
opacity: 1;
transform: translateY(0);
}
}
// 点赞状态样式 // 点赞状态样式
.xingmalabdetailpage { .xingmalabdetailpage {
.xingmalabdetailpagebottomconlikebtn { .xingmalabdetailpagebottomconlikebtn {
......
...@@ -49,9 +49,7 @@ const currentTime = computed(() => { ...@@ -49,9 +49,7 @@ const currentTime = computed(() => {
// 方法 // 方法
const handleLikeClick = () => { const handleLikeClick = () => {
console.log('点击点赞按钮')
isLiked.value = !isLiked.value isLiked.value = !isLiked.value
// 这里可以添加点赞逻辑
uni.showToast({ uni.showToast({
title: isLiked.value ? '已点赞' : '取消点赞', title: isLiked.value ? '已点赞' : '取消点赞',
icon: 'success' icon: 'success'
...@@ -59,8 +57,6 @@ const handleLikeClick = () => { ...@@ -59,8 +57,6 @@ const handleLikeClick = () => {
} }
const handleShareClick = () => { const handleShareClick = () => {
console.log('点击分享按钮')
// 这里可以添加分享逻辑
uni.showShareMenu({ uni.showShareMenu({
withShareTicket: true, withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline'] menus: ['shareAppMessage', 'shareTimeline']
...@@ -69,7 +65,7 @@ const handleShareClick = () => { ...@@ -69,7 +65,7 @@ const handleShareClick = () => {
// 生命周期 // 生命周期
onMounted(() => { onMounted(() => {
console.log('星妈实验室详情页面已加载') // 页面加载完成
}) })
</script> </script>
......
...@@ -172,12 +172,12 @@ const hasUserInfo = computed(() => { ...@@ -172,12 +172,12 @@ const hasUserInfo = computed(() => {
avatarType: typeof xingmaInfo?.avatar, avatarType: typeof xingmaInfo?.avatar,
nicknameType: typeof xingmaInfo?.nickname nicknameType: typeof xingmaInfo?.nickname
}) })
if (xingmaInfo && xingmaInfo.avatar && xingmaInfo.nickname) { if (xingmaInfo && xingmaInfo.avatar && xingmaInfo.nickname) {
console.log('✅ Store 中有头像昵称信息') console.log('✅ Store 中有头像昵称信息')
return true return true
} }
return false return false
}) })
...@@ -411,9 +411,9 @@ const handleConfirmPublish = async () => { ...@@ -411,9 +411,9 @@ const handleConfirmPublish = async () => {
imgUrl: uploadedImage.value, imgUrl: uploadedImage.value,
content: description.value content: description.value
}) })
// 执行发布 // 执行发布
await performPublish() const publishResult = await performPublish()
// 如果是首次授权发布成功,记录日志 // 如果是首次授权发布成功,记录日志
if (isFirstTimePublish.value) { if (isFirstTimePublish.value) {
...@@ -429,7 +429,8 @@ const handleConfirmPublish = async () => { ...@@ -429,7 +429,8 @@ const handleConfirmPublish = async () => {
// 切换到成功状态 // 切换到成功状态
currentState.value = config.states.SUC currentState.value = config.states.SUC
successMessage.value = getRandomSuccessMessage() successMessage.value = getRandomSuccessMessage()
publishNumber.value = generatePublishNumber() // 使用发布接口返回的 bizNo 作为发布编号
publishNumber.value = publishResult.data?.bizNo
} catch (error) { } catch (error) {
console.error('发布失败:', error) console.error('发布失败:', error)
...@@ -474,36 +475,36 @@ const performPublish = async () => { ...@@ -474,36 +475,36 @@ const performPublish = async () => {
imgUrl: uploadedImage.value, // 初始时是临时文件路径,将在下面上传 imgUrl: uploadedImage.value, // 初始时是临时文件路径,将在下面上传
content: description.value content: description.value
} }
// 上传内容图片 // 上传内容图片
if (uploadedImage.value) { if (uploadedImage.value) {
try { try {
const uploadedUrl = await uploadImageFunc(uploadedImage.value) const uploadedUrl = await uploadImageFunc(uploadedImage.value)
params.imgUrl = uploadedUrl params.imageUrl = uploadedUrl
console.log('✅ 内容图片上传成功,更新 imgUrl:', uploadedUrl) console.log('✅ 内容图片上传成功,更新 imgUrl:', uploadedUrl)
} catch (uploadError) { } catch (uploadError) {
console.error('❌ 内容图片上传失败:', uploadError) console.error('❌ 内容图片上传失败:', uploadError)
throw new Error('内容图片上传失败,请重试') throw new Error('内容图片上传失败,请重试')
} }
} }
// 如果是首次授权,需要传递nickname和avatar // 如果是首次授权,需要传递nickname和avatar
if (isFirstTimePublish.value) { if (isFirstTimePublish.value) {
// 直接从临时用户信息中读取,不存储到本地 // 直接从临时用户信息中读取,不存储到本地
console.log('🔍 检查临时用户信息:', tempUserInfo.value); console.log('🔍 检查临时用户信息:', tempUserInfo.value);
if (tempUserInfo.value && tempUserInfo.value.avatarUrl && tempUserInfo.value.nickName) { if (tempUserInfo.value && tempUserInfo.value.avatarUrl && tempUserInfo.value.nickName) {
params.nickname = tempUserInfo.value.nickName params.nickname = tempUserInfo.value.nickName
// 上传头像到服务器,使用返回的URL // 上传头像到服务器,使用返回的URL
try { try {
console.log('🖼️ 开始上传头像:', tempUserInfo.value.avatarUrl) console.log('🖼️ 开始上传头像:', tempUserInfo.value.avatarUrl)
// 将临时文件路径转换为base64 // 将临时文件路径转换为base64
const fs = uni.getFileSystemManager() const fs = uni.getFileSystemManager()
const avatarBase64 = "data:image/jpeg;base64," + fs.readFileSync(tempUserInfo.value.avatarUrl, "base64") const avatarBase64 = "data:image/jpeg;base64," + fs.readFileSync(tempUserInfo.value.avatarUrl, "base64")
const avatarUploadRes = await uploadImage(avatarBase64) const avatarUploadRes = await uploadImage(avatarBase64)
if (avatarUploadRes.success) { if (avatarUploadRes.success) {
params.avatar = avatarUploadRes.data?.url params.avatar = avatarUploadRes.data?.url
console.log('✅ 头像上传成功,avatar URL:', params.avatar) console.log('✅ 头像上传成功,avatar URL:', params.avatar)
...@@ -518,21 +519,21 @@ const performPublish = async () => { ...@@ -518,21 +519,21 @@ const performPublish = async () => {
console.warn('⚠️ 临时用户信息不完整,无法上传头像:', tempUserInfo.value); console.warn('⚠️ 临时用户信息不完整,无法上传头像:', tempUserInfo.value);
} }
} }
console.log('🚀 发布参数:', params) console.log('🚀 发布参数:', params)
// 使用 fetchRecordPublish 调用发布接口 // 使用 fetchRecordPublish 调用发布接口
const result = await fetchRecordPublish(params) const result = await fetchRecordPublish(params)
console.log('📤 发布接口返回:', result) console.log('📤 发布接口返回:', result)
if (result.success) { if (result.success) {
console.log('✅ 发布成功') console.log('✅ 发布成功')
return result return result
} else { } else {
throw new Error(result.message || '发布失败') throw new Error(result.message || '发布失败')
} }
} catch (error) { } catch (error) {
console.error('❌ 发布失败:', error) console.error('❌ 发布失败:', error)
throw error throw error
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment