From f3ea52bf97e61f6917ccaab904817d74d9d4860c Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期四, 17 七月 2025 09:55:36 +0800
Subject: [PATCH] init
---
pages/home/home.vue | 66 ++-
sub-pages/mine/settings.vue | 105 ++++--
pages/login/login.vue | 264 ++++++++++++----
pages/home/home-main.vue | 9
pages/home/trip-card.vue | 38 +
sub-pages/community/index.vue | 54 +-
pages.json | 7
components/setting/setting-popup copy.vue | 2
plugins/http.js | 18
components/setting/setting-popup.vue | 2
enums/dict.ts | 2
components/comment/comment-popup.vue | 2
components/footer/customer-footer.vue | 6
pages/home/home copy.vue | 4
types/index.ts | 2
sub-pages/film-list/film-detail.vue | 13
sub-pages/film-list/film-list.vue | 34 +
sub-pages/utils/api.ts | 29 +
pages/home/community.vue | 11
package.json | 2
components/tabbar/top-tab-bar.vue | 4
sub-pages/mine/index.vue | 205 +++++++++++--
store/user.ts | 8
23 files changed, 633 insertions(+), 254 deletions(-)
diff --git a/components/comment/comment-popup.vue b/components/comment/comment-popup.vue
index a7eac02..eccefc0 100644
--- a/components/comment/comment-popup.vue
+++ b/components/comment/comment-popup.vue
@@ -200,7 +200,7 @@
// 构建评论数据
const commentData = {
...comment.value,
- parentId: props.parentId || undefined, // 如果有parentId则使用,没有则为undefined
+ parentId: props.parentId || void 0, // 如果有parentId则使用,没有则为undefined
filmId: props.filmId,
content: comment.value.content,
fileList: comment.value.fileList,
diff --git a/components/footer/customer-footer.vue b/components/footer/customer-footer.vue
index f0a56cb..4035861 100644
--- a/components/footer/customer-footer.vue
+++ b/components/footer/customer-footer.vue
@@ -35,9 +35,9 @@
const tabBar = ref<TabItem[]>([
{ text: '首页', pagePath: '/pages/home/home' },
- { text: '影视地图', pagePath: '/sub-pages/film-map/index' },
- { text: '我的种草', pagePath: '/sub-pages/customer/shopping/shopping' },
- { text: '社区', pagePath: '/sub-pages/community/index' },
+ // { text: '影视地图', pagePath: '/sub-pages/film-map/index' },
+ // { text: '我的种草', pagePath: '/sub-pages/customer/shopping/shopping' },
+ { text: '草原', pagePath: '/sub-pages/community/index' },
{ text: '我的', pagePath: '/sub-pages/mine/index' },
])
diff --git a/components/setting/setting-popup copy.vue b/components/setting/setting-popup copy.vue
index 0d6c160..45088ae 100644
--- a/components/setting/setting-popup copy.vue
+++ b/components/setting/setting-popup copy.vue
@@ -64,7 +64,7 @@
</up-cell-group>
<up-cell-group :border="false" :customStyle="cellGroupStyle">
- <up-cell title="社区公约" url="/pages/componentsB/tag/tag" :border="false">
+ <up-cell title="草原公约" url="/pages/componentsB/tag/tag" :border="false">
<template #icon>
<up-icon :size="btnSize" name="/static/common/sqgy.png" />
</template>
diff --git a/components/setting/setting-popup.vue b/components/setting/setting-popup.vue
index 1918164..992946d 100644
--- a/components/setting/setting-popup.vue
+++ b/components/setting/setting-popup.vue
@@ -61,7 +61,7 @@
{ title: "小程序", icon: "/static/common/xcx.png", url: "/pages/componentsB/tag/tag",btnSize: 15 }
],
[
- { title: "社区公约", icon: "/static/common/sqgy.png", url: "/pages/componentsB/tag/tag" ,btnSize: 15}
+ { title: "草原公约", icon: "/static/common/sqgy.png", url: "/pages/componentsB/tag/tag" ,btnSize: 15}
]
];
diff --git a/components/tabbar/top-tab-bar.vue b/components/tabbar/top-tab-bar.vue
index 014447a..4b503fa 100644
--- a/components/tabbar/top-tab-bar.vue
+++ b/components/tabbar/top-tab-bar.vue
@@ -16,7 +16,7 @@
<!-- 左侧图标 + 标题 -->
<view class="left">
<up-icon name="/static/images/tabbar/line-Film.png" size="40rpx" color="#fff" />
- <text class="title">影途</text>
+ <text class="title">影游四方</text>
</view>
<!-- 右侧按钮 -->
@@ -25,7 +25,7 @@
<up-icon name="/static/images/tabbar/user.png" size="30rpx" />
<text class="login-text">登录</text>
</view>
- <up-icon name="list" size="40rpx" color="#fff" @click="openMenu" />
+<!-- <up-icon name="list" size="40rpx" color="#fff" @click="openMenu" />-->
</view>
</view>
</view>
diff --git a/enums/dict.ts b/enums/dict.ts
index 859a70d..bc32c83 100644
--- a/enums/dict.ts
+++ b/enums/dict.ts
@@ -1,6 +1,6 @@
export enum FilmWorksCategory {
CONTENT_SELECTED = '1', // 内容精选
- COMMUNITY = '2', // 社区推荐
+ COMMUNITY = '2', // 草原推荐
}
diff --git a/package.json b/package.json
index a4a8b42..d90c0f4 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"uni-app": {
"scripts": {
"film": {
- "title": "影途",
+ "title": "影游四方",
"BROWSER": "Chrome",
"env": {
"UNI_PLATFORM": "mp-weixin",
diff --git a/pages.json b/pages.json
index 6a19d6c..cd1324f 100644
--- a/pages.json
+++ b/pages.json
@@ -9,10 +9,11 @@
}
},
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+
{
"path": "pages/home/home",
"style": {
- "navigationBarTitleText": "影途",
+ "navigationBarTitleText": "影游四方",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}
@@ -73,7 +74,7 @@
{
"path": "index",
"style": {
- "navigationBarTitleText": "社区",
+ "navigationBarTitleText": "草原",
"enablePullDownRefresh": true
}
}
@@ -149,7 +150,7 @@
],
"globalStyle": {
"navigationBarTextStyle": "black",
- "navigationBarTitleText": "影途",
+ "navigationBarTitleText": "影游四方",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
diff --git a/pages/home/community.vue b/pages/home/community.vue
index f1e4cb8..968fbc3 100644
--- a/pages/home/community.vue
+++ b/pages/home/community.vue
@@ -1,5 +1,5 @@
<template>
- <view class="post-card">
+ <view class="post-card" @click="handleClick">
<!-- 用户信息 -->
<view class="user-info">
<up-avatar :src="avatar" size="80rpx" shape="circle" />
@@ -56,11 +56,20 @@
content?: string;
likeCount?: number | string;
commentCount?: number | string;
+ detailUrl?: string; // 新增跳转链接
}
const props = defineProps<Props>();
const imageHeight = ref(0)
+const handleClick = () => {
+ if (props.detailUrl) {
+ uni.navigateTo({
+ url: props.detailUrl
+ });
+ }
+}; // 注意这里需要分号
+
const computeImageHeight = (src?: string) => {
if (!src) return
uni.getImageInfo({
diff --git a/pages/home/home copy.vue b/pages/home/home copy.vue
index 297a5f4..1ffae44 100644
--- a/pages/home/home copy.vue
+++ b/pages/home/home copy.vue
@@ -38,7 +38,7 @@
<SceneMuseumCard v-for="(item, index) in cardList" :key="index" :image="item.image" :title="item.title"
:subtitle="item.subtitle" :readTime="item.readTime" />
- <SectionTitle title="光影社区" optitle="加入社区" goUrl="/pages/home/home-more" />
+ <SectionTitle title="光影天地" optitle="加入光影" goUrl="/pages/home/home-more" />
<Community v-for="(item, index) in communitys" :key="index" :avatar="item.avatar" :nickname="item.nickname"
:time="item.time" :image="item.image" :content="item.content" :likeCount="item.likeCount"
:commentCount="item.commentCount" />
@@ -163,7 +163,7 @@
},
])
-// 社区帖子数据
+// 数据
const communitys = ref([
{
avatar: 'https://cdn.uviewui.com/uview/common/logo.png',
diff --git a/pages/home/home-main.vue b/pages/home/home-main.vue
index e809a9b..189b16b 100644
--- a/pages/home/home-main.vue
+++ b/pages/home/home-main.vue
@@ -99,10 +99,13 @@
}
function hotRoute() {
- uni.showToast({
- title: '跳转热门路线',
- icon: 'none',
+ uni.navigateTo({
+ url: '/sub-pages/hot-spot/index',
})
+ // uni.showToast({
+ // title: 'sub-pages/hot-spot/index',
+ // icon: 'none',
+ // })
}
onLoad((options: any) => {
diff --git a/pages/home/home.vue b/pages/home/home.vue
index 7095440..80ed122 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -23,7 +23,7 @@
</view>
<view class="trip-card-swiper">
- <swiper :current="currentPage" @change="onSwiperChange" circular style="min-height: 1450rpx;">
+ <swiper :current="currentPage" @change="onSwiperChange" circular style="min-height: 1850rpx;">
<swiper-item v-for="(group, pageIndex) in pagedTripCards" :key="pageIndex">
<TripCard v-for="(item, index) in group" :key="index" :tag="item.tag" :title="item.coverTitle"
:subtitle="item.coverAlt" :score="item.collectCount" :imageUrl="item.coverUrl"
@@ -32,15 +32,15 @@
</swiper>
</view>
- <SectionTitle title="全球影视地标" optitle="查看全部" goUrl="/pages/home/home-more" />
- <GlobalGeo />
+<!-- <SectionTitle title="全球影视地标" optitle="查看全部" goUrl="/pages/home/home-more" />-->
+<!-- <GlobalGeo />-->
<SectionTitle title="场景博物馆" optitle="查看全部" goUrl="/sub-pages/hot-spot/index" />
<SceneMuseumCard v-for="(item, index) in cardList" :key="index" :image="item.image" :title="item.title"
:subtitle="item.subtitle" :readTime="item.readTime" />
- <SectionTitle title="光影社区" optitle="加入社区" goUrl="/pages/home/home-more" />
- <Community v-for="(item, index) in communitys" :key="index" :avatar="item.avatar" :nickname="item.nickname"
+ <SectionTitle title="光影天地" optitle="加入光影" goUrl="/sub-pages/community/index" />
+ <Community v-for="(item, index) in communitys" :key="index" :detailUrl="`${detailUrl}?id=${item.id}`" :avatar="item.avatar" :nickname="item.nickname"
:time="formatRelativeTime(item.createTime)" :image="item.coverUrl" :content="item.coverAlt"
:likeCount="item.likeCount" :commentCount="item.commentCount" />
<up-loadmore :status="communityStatus" :line="true" />
@@ -99,28 +99,15 @@
})
// 场景博物馆卡片数据
-const cardList = ref([
- {
- image: 'https://ai-public.mastergo.com/ai/img_res/6a226f9e9652c51cd535c3490535dfeb.jpg',
- title: '《盗梦空间》巴黎咖啡馆',
- subtitle: '拷素诺兰如何创造这个标志性场景',
- readTime: '12分钟阅读',
- },
- {
- image: 'https://img.yzcdn.cn/vant/cat.jpeg',
- title: '《星际穿越》玉米田',
- subtitle: '诺兰如何还原地球末日场景',
- readTime: '8分钟阅读',
- },
- {
- image: 'https://img.yzcdn.cn/vant/cat.jpeg',
- title: '《星球大战》塔图因星球',
- subtitle: '经典科幻电影中的沙漠设定',
- readTime: '10分钟阅读',
- },
-])
+// 场景博物馆卡片数据
+const cardList = ref<Array<{
+ image: string
+ title: string
+ subtitle: string
+ readTime: string
+}>>([])
-// 社区帖子数据
+// 数据
const communitys = ref<FilmWorks[]>([])
@@ -135,8 +122,11 @@
// 内容精选
getContentSelected()
- // 光影社区
+ // 光影
getCommunitys()
+
+ // 场景博物馆
+ getSceneMuseumData()
});
@@ -144,7 +134,7 @@
console.log('用户下拉刷新了')
// 内容精选
getContentSelected()
- // 光影社区
+ // 光影
communityPage.value = 1
getCommunitys()
uni.stopPullDownRefresh() // 停止下拉刷新动画
@@ -187,6 +177,25 @@
communityStatus.value = 'noMore'
}
}
+
+
+// 获取场景博物馆数据
+const getSceneMuseumData = async () => {
+ try {
+ const { code, data } = await $http.request('get', '/api/filmLocation/getTop3')
+ if (code === 0 && data) {
+ cardList.value = data.map(item => ({
+ image: item.locationUrl,
+ title: item.locationName,
+ subtitle: item.address,
+ readTime: `${item.locationWeight}热度`
+ }))
+ }
+ } catch (error) {
+ console.error('获取场景博物馆数据失败:', error)
+ $message.showToast('获取场景博物馆数据失败')
+ }
+}
// 内容精选
const getFilmWorks = async (type: String, pageSize: Number, currentPage: Number) => {
const {
@@ -195,6 +204,7 @@
params: {
classify: type,
size: pageSize,
+ status: 'published',
current: currentPage
}
})
diff --git a/pages/home/trip-card.vue b/pages/home/trip-card.vue
index 2c57369..74c5154 100644
--- a/pages/home/trip-card.vue
+++ b/pages/home/trip-card.vue
@@ -8,12 +8,14 @@
<view class="title">{{ title }}</view>
<view class="subtitle">{{ subtitle }}</view>
<view class="footer">
- <view class="rating">
- <up-icon class="star" name="star-fill" size="14" color="#FFD700" />
- <text class="score">{{ score }}</text>
- </view>
- <view class="more" @click="goToDetail">
- 查看详情 ->
+ <view class="rating-more">
+ <view class="rating-group"> <!-- 新增包裹层 -->
+ <up-icon class="star" name="star-fill" size="14" color="#FFD700" />
+ <text class="score">{{ score }}</text>
+ </view>
+ <view class="more" @click="goToDetail">
+ 查看详情 ->
+ </view>
</view>
</view>
</view>
@@ -52,7 +54,7 @@
.image-wrapper {
position: relative;
width: 100%;
- height: 260rpx;
+ height: 400rpx; // 从260rpx增加到360rpx
}
.image {
@@ -72,22 +74,23 @@
}
.content {
- padding: 24rpx;
+ padding: 10rpx; // 上下padding从24rpx减到20rpx
background-color: #121212;
}
.title {
- font-size: 16px;
+ font-size: 15px; // 从16px减小
color: #ffffff;
font-weight: 500;
- margin-bottom: 12rpx;
+ margin-bottom: 8rpx; // 从12rpx减小
line-height: 1.4;
}
.subtitle {
- font-size: 14px;
+ font-size: 13px; // 从14px减小
color: rgba(255, 255, 255, 0.8);
- margin-bottom: 20rpx;
+ margin-bottom: 16rpx; // 从20rpx减小
+ line-height: 1.3; // 添加行高控制
}
.footer {
@@ -116,5 +119,16 @@
user-select: none;
cursor: pointer;
}
+ .rating-more {
+ display: flex;
+ align-items: center;
+ width: 100%; // 添加宽度
+ justify-content: space-between; // 改为两端对齐
+ }
+ .rating-group { /* 新增样式 */
+ display: flex;
+ align-items: center;
+ gap: 8rpx; /* 图标和分数之间的间距 */
+ }
</style>
\ No newline at end of file
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 1fae60e..7bf5a9d 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -2,12 +2,12 @@
<view class="login-page">
<view class="top-bar">
<text class="top-left">帮助</text>
- <text class="top-right" @click="skipLogin">跳过</text>
+ <text class="top-right" @click="skipLogin">游客模式</text>
</view>
<view class="logo-container">
- <text class="app-name">影途</text>
- <text class="subtitle">登录后,体验更多功能</text>
+ <text class="app-name">影游四方</text>
+ <text class="subtitle">发现精彩电影世界</text>
</view>
<view class="phone-number">
@@ -18,16 +18,46 @@
<!-- <up-button type="primary" class="login-btn" @click="quickLogin" shape="circle">一键登录</up-button> -->
<!-- <up-button type="info" class="wechat-btn" @click="wechatLogin" icon="weixin-fill" iconColor="#00c800"
text="微信登录" shape="circle"></up-button> -->
- <up-button v-if="wxUser.user" type="info" class="login-btn" @click="wechatLogin" icon="weixin-fill"
- iconColor="#00c800" text="微信登录" shape="circle"></up-button>
- <up-button v-else type="info" class="login-btn" open-type="getPhoneNumber"
- @getphonenumber="handleGetPhoneNumber" icon="weixin-fill" iconColor="#00c800" text="微信登录"
- shape="circle"></up-button>
+ <up-button
+ type="primary"
+ class="guest-btn"
+ @click="skipLogin"
+ text="立即体验"
+ shape="circle"
+ ></up-button>
+<!-- <up-button v-if="wxUser.user" type="info" class="login-btn" @click="wechatLogin" icon="weixin-fill"-->
+<!-- iconColor="#00c800" text="微信登录" shape="circle"></up-button>-->
+<!-- <up-button v-else type="info" class="login-btn" open-type="getPhoneNumber"-->
+<!-- @getphonenumber="handleGetPhoneNumber" icon="weixin-fill" iconColor="#00c800" text="微信登录"-->
+<!-- shape="circle"></up-button>-->
+ <up-button
+ v-if="wxUser && wxUser.user"
+ type="primary"
+ class="login-btn"
+ @click="showWechatLoginConfirm"
+ icon=""
+ iconColor="#00c800"
+ text="手机号快捷登录"
+ shape="circle"
+ custom-style="background: #ff2d4a; color: white;"
+ ></up-button>
+ <up-button
+ v-else
+ type="primary"
+ class="login-btn"
+ open-type="getPhoneNumber"
+ @getphonenumber="handleGetPhoneNumber"
+ icon=""
+ iconColor="#00c800"
+ text="手机号快捷登录"
+ shape="circle"
+ custom-style="background: #ff2d4a; color: white;"
+ ></up-button>
</view>
- <view class="other-login" @click="otherLogin">
- <text>其他登录方式 ></text>
- </view>
+<!-- <view class="other-login" @click="otherLogin">-->
+<!-- <text>其他登录方式 ></text>-->
+<!-- </view>-->
<view class="agreement">
<view @click="toggleCheck">
@@ -61,41 +91,89 @@
isChecked.value = !isChecked.value
}
-const wxUser = ref<WxUser | null>(null)
+const wxUser = ref<WxUser>({
+ user: null,
+ phoneNumber: '',
+ purePhoneNumber: ''
+});
+// const wechatLogin = () => {
+// if (!isChecked.value) {
+// uni.showToast({ title: '请先同意协议', icon: 'none' });
+// return;
+// }
+// // 微信登录
+// uni.login({
+// "provider": "weixin",
+// "onlyAuthorize": true, // 微信登录仅请求授权认证
+// success: async function (event:any) {
+// const { code } = event
+// $message.showLoading();
+// const resp = await userStore.loginwx({ code, phoneNumber: wxUser.value.phoneNumber, purePhoneNumber: wxUser.value.purePhoneNumber })
+// if (resp && resp.data) {
+// // that.$forceUpdate()
+// uni.reLaunch({
+// url: '/pages/home/home'
+// })
+// }
+// $message.hideLoading();
+// },
+// fail: function (err:any) {
+// // 登录授权失败
+// // err.code是错误码
+// }
+// })
+//
+//
+// };
const wechatLogin = () => {
- if (!isChecked.value) {
- uni.showToast({ title: '请先同意协议', icon: 'none' });
- return;
+ uni.login({
+ provider: "weixin",
+ onlyAuthorize: true,
+ success: async function (event:any) {
+ $message.showLoading();
+ const { code } = event;
+ const resp = await userStore.loginwx({
+ code,
+ phoneNumber: wxUser.value?.phoneNumber,
+ purePhoneNumber: wxUser.value?.purePhoneNumber
+ });
+
+ if (resp?.data) {
+ uni.reLaunch({ url: '/pages/home/home' });
+ }
+ $message.hideLoading();
+ },
+ fail: function (err:any) {
+ console.error('登录失败:', err);
}
- // 微信登录
- uni.login({
- "provider": "weixin",
- "onlyAuthorize": true, // 微信登录仅请求授权认证
- success: async function (event:any) {
- const { code } = event
- $message.showLoading();
- const resp = await userStore.loginwx({ code, phoneNumber: wxUser.value.phoneNumber, purePhoneNumber: wxUser.value.purePhoneNumber })
- if (resp && resp.data) {
- // that.$forceUpdate()
- uni.reLaunch({
- url: '/pages/home/home'
- })
- }
- $message.hideLoading();
- },
- fail: function (err:any) {
- // 登录授权失败
- // err.code是错误码
- }
- })
-
-
+ });
};
-onShow(() => {
- console.log('页面显示')
- getOpenId()
-});
+// onShow(() => {
+// console.log('页面显示')
+// getOpenId()
+// });
+
+const showWechatLoginConfirm = () => {
+ if (!isChecked.value) {
+ uni.showToast({ title: '请先同意协议', icon: 'none' });
+ return;
+ }
+
+ uni.showModal({
+ title: '授权提示',
+ content: '需要使用手机号登录才能获得完整服务?',
+ confirmText: '确认登录',
+ cancelText: '暂不需要',
+ success: (res) => {
+ if (res.confirm) {
+ wechatLogin();
+ }
+ }
+ });
+};
+
+
const getOpenId = () => {
uni.login({
"provider": "weixin",
@@ -148,13 +226,19 @@
}
})
if (code == 0) {
-
- // 获取手机号码后,实现微信登录
- const phoneNumber = data.phone_info.phoneNumber;
- const purePhoneNumber = data.phone_info.purePhoneNumber;
- wxUser.value.phoneNumber = phoneNumber
- wxUser.value.purePhoneNumber = purePhoneNumber
- handleWechatClick()
+ wxUser.value = {
+ ...wxUser.value,
+ phoneNumber: data.phone_info.phoneNumber,
+ purePhoneNumber: data.phone_info.purePhoneNumber,
+ user: {} // 确保user不为null
+ };
+ wechatLogin();
+ // // 获取手机号码后,实现微信登录
+ // const phoneNumber = data.phone_info.phoneNumber;
+ // const purePhoneNumber = data.phone_info.purePhoneNumber;
+ // wxUser.value.phoneNumber = phoneNumber
+ // wxUser.value.purePhoneNumber = purePhoneNumber
+ // handleWechatClick()
} else {
}
@@ -163,31 +247,52 @@
}
}
+// const handleWechatClick = () => {
+// uni.login({
+// "provider": "weixin",
+// "onlyAuthorize": true, // 微信登录仅请求授权认证
+// success: async function (event: any) {
+// const { code } = event
+// $message.showLoading();
+// console.log("获取到的微信用户信息是:", wxUser.value)
+// const resp = await userStore.loginwx({ code, phoneNumber: wxUser.value.phoneNumber, purePhoneNumber: wxUser.value.purePhoneNumber })
+// if (resp && resp.data) {
+// // $forceUpdate()
+// uni.reLaunch({
+// url: '/pages/home/home'
+// })
+// }
+// $message.hideLoading();
+// },
+// fail: function (err: any) {
+// // 登录授权失败
+// // err.code是错误码
+// }
+// })
+// }
+
const handleWechatClick = () => {
- uni.login({
- "provider": "weixin",
- "onlyAuthorize": true, // 微信登录仅请求授权认证
- success: async function (event: any) {
- const { code } = event
- $message.showLoading();
- console.log("获取到的微信用户信息是:", wxUser.value)
- const resp = await userStore.loginwx({ code, phoneNumber: wxUser.value.phoneNumber, purePhoneNumber: wxUser.value.purePhoneNumber })
- if (resp && resp.data) {
- // $forceUpdate()
- uni.reLaunch({
- url: '/pages/home/home'
- })
- }
- $message.hideLoading();
- },
- fail: function (err: any) {
- // 登录授权失败
- // err.code是错误码
- }
- })
-}
+ uni.login({
+ provider: "weixin",
+ onlyAuthorize: true,
+ success: async function (event: any) {
+ $message.showLoading();
+ const resp = await userStore.loginwx({
+ code: event.code,
+ phoneNumber: wxUser.value?.phoneNumber,
+ purePhoneNumber: wxUser.value?.purePhoneNumber
+ });
-
+ if (resp?.data) {
+ uni.reLaunch({ url: '/pages/home/home' });
+ }
+ $message.hideLoading();
+ },
+ fail: function (err: any) {
+ console.error('登录失败:', err);
+ }
+ });
+};
const otherLogin = () => {
// 跳转到其他登录方式页面
@@ -195,7 +300,8 @@
};
const skipLogin = () => {
- uni.switchTab({ url: '/pages/home/index' });
+ // uni.switchTab({ url: '/pages/home/home' });gai
+ uni.reLaunch({ url: '/pages/home/home' });
};
@@ -262,6 +368,18 @@
background-color: #1c1c1e;
color: #fff;
}
+
+ .guest-btn {
+ background-color: #ff2d4a;
+ border: none;
+ color: #fff;
+ margin-bottom: 20rpx;
+ }
+
+ .login-btn {
+ background-color: #1c1c1e;
+ color: #fff;
+ }
}
.other-login {
diff --git a/plugins/http.js b/plugins/http.js
index 3ede604..0523cbe 100644
--- a/plugins/http.js
+++ b/plugins/http.js
@@ -113,14 +113,14 @@
await message.showToast('登录信息失效')
// #ifdef PUB_CUSTOMER
- uni.reLaunch({
- url: '/pages/login/login'
- })
+ // uni.reLaunch({
+ // url: '/pages/login/login'
+ // })
// #endif
// #ifndef PUB_CUSTOMER
- uni.reLaunch({
- url: '/pages/login/login'
- })
+ // uni.reLaunch({
+ // url: '/pages/login/login'
+ // })
// #endif
reject({
data: null,
@@ -164,9 +164,9 @@
})
// #endif
// #ifndef PUB_CUSTOMER
- uni.reLaunch({
- url: '/pages/login/login'
- })
+ // uni.reLaunch({
+ // url: '/pages/login/login'
+ // })
// #endif
reject({
data: null,
diff --git a/store/user.ts b/store/user.ts
index e9535f7..bfca100 100644
--- a/store/user.ts
+++ b/store/user.ts
@@ -86,7 +86,12 @@
// 如果你有持久化,这里也同步一下
// storage.setItem('userInfo', userInfo.value)
}
-
+ function $reset() {
+ hasLogin.value = false
+ isBind.value = false
+ userInfo.value = null
+ address.value = null
+ }
return {
hasLogin,
@@ -97,5 +102,6 @@
getCurrentInfo,
initLoginState,
updateAddress,
+ $reset,
}
})
diff --git a/sub-pages/community/index.vue b/sub-pages/community/index.vue
index 4e4684a..4af8465 100644
--- a/sub-pages/community/index.vue
+++ b/sub-pages/community/index.vue
@@ -1,30 +1,30 @@
<template>
<view :class="['app', theme]">
- <up-sticky bgColor="#ffffff">
- <view class="header">
- <up-icon name="list" size="40rpx" color="#333333" @click="onSettingClick" />
- <view>
- <!-- <up-tabs :list="list1"> -->
- <up-tabs v-model:current="parentTabIndex" :list="userTabList" @click="onChangeTab">
- <!-- <template #left>
- <up-icon name="list" size="40rpx" color="#333333" />
- </template> -->
- <!-- <template #right>
- <up-icon name="search" size="48rpx" color="#333333" />
- </template> -->
- </up-tabs>
- </view>
- <up-icon name="search" size="48rpx" color="#333333" @click="toSearchPage()" />
- </view>
- </up-sticky>
+<!-- <up-sticky bgColor="#ffffff">-->
+<!-- <view class="header">-->
+<!--<!– <up-icon name="list" size="40rpx" color="#333333" @click="onSettingClick" />–>-->
+<!-- <view>-->
+<!-- <!– <up-tabs :list="list1"> –>-->
+<!-- <up-tabs v-model:current="parentTabIndex" :list="userTabList" @click="onChangeTab">-->
+<!-- <!– <template #left>-->
+<!-- <up-icon name="list" size="40rpx" color="#333333" />-->
+<!-- </template> –>-->
+<!-- <!– <template #right>-->
+<!-- <up-icon name="search" size="48rpx" color="#333333" />-->
+<!-- </template> –>-->
+<!-- </up-tabs>-->
+<!-- </view>-->
+<!--<!– <up-icon name="search" size="48rpx" color="#333333" @click="toSearchPage()" />–>-->
+<!-- </view>-->
+<!-- </up-sticky>-->
- <view style="margin: 10px 10px 10px 10px; ">
- <up-tabs :list="tabList" :itemStyle="{ padding: '0 16rpx', textAlign: 'center', flex: '1' }">
- <template #right>
- <up-icon name="arrow-down" size="15" color="#333333" />
- </template>
- </up-tabs>
- </view>
+<!-- <view style="margin: 10px 10px 10px 10px; ">-->
+<!-- <up-tabs :list="tabList" :itemStyle="{ padding: '0 16rpx', textAlign: 'center', flex: '1' }">-->
+<!-- <template #right>-->
+<!-- <up-icon name="arrow-down" size="15" color="#333333" />-->
+<!-- </template>-->
+<!-- </up-tabs>-->
+<!-- </view>-->
<view class="content-area">
<up-waterfall v-model="films">
<template #left="{ leftList }">
@@ -129,10 +129,10 @@
filmStatus.value = 'loading'
- // TODO 暂时使用光影社区的类别
+ // TODO 暂时使用光影的类别
const query: FilmWorksQueryDTO = {
- classify: '',
- type: '',
+ classify: FilmWorksCategory.COMMUNITY,
+ status: 'published',
current: filmPage.value,
size: filmSize,
};
diff --git a/sub-pages/film-list/film-detail.vue b/sub-pages/film-list/film-detail.vue
index 2d73253..b20d2c6 100644
--- a/sub-pages/film-list/film-detail.vue
+++ b/sub-pages/film-list/film-detail.vue
@@ -11,7 +11,7 @@
</view>
</view>
<view class="opera-info">
- <button class="custom-btn">关注</button>
+<!-- <button class="custom-btn">关注</button>-->
<up-icon name="/static/common/share2.png" size="40rpx" color="#999" @click="openSharePopup" />
</view>
</view>
@@ -45,14 +45,14 @@
<!-- <view v-html="filmInfo.filmContent||'暂无'" class="rich" style="overflow: scroll;"></view> -->
</view>
<view class="annotation content-item">
- <text>{{ formatRelativeTime(filmInfo?.createTime) }} 美国</text>
+<!-- <text>{{ formatRelativeTime(filmInfo?.createTime) }} 美国</text>-->
</view>
</view>
<up-line></up-line>
<view class="comment">
- <view class="writer-view" @click="showCommentLayer">
+ <view class="writer-view" @click="() => showCommentLayer()">
<up-icon name="chat-fill" size="60rpx" />
<view class="comment-operation">
<up-text size="12px" text="说点什么......" margin="0 0 0 20rpx" color="#B9B9B9" />
@@ -87,7 +87,7 @@
<!-- 固定底部输入框 -->
<view class="comment-box">
<view class="input-row">
- <view class="comment-input" @click="showCommentLayer">
+ <view class="comment-input" @click="() => showCommentLayer()">
<up-text size="12px" text="说点什么......" margin="0 0 0 20rpx" color="#B9B9B9" />
</view>
<!-- <up-icon name="heart" size="60rpx" color="#B9B9B9" label="11" />-->
@@ -256,8 +256,11 @@
}
// film-detail.vue
-const showCommentLayer = (parentId?: number) => {
+const showCommentLayer = (parentId?: number | string) => {
console.log('点击了评论按钮',parentId)
+ if (typeof parentId === 'object') {
+ parentId = ''
+ }
commentShow.value = true
// 如果有parentId,说明是回复评论,需要设置parentId
// 如果没有parentId,说明是直接评论,不需要设置parentId
diff --git a/sub-pages/film-list/film-list.vue b/sub-pages/film-list/film-list.vue
index 3257cd1..4a4e54d 100644
--- a/sub-pages/film-list/film-list.vue
+++ b/sub-pages/film-list/film-list.vue
@@ -38,6 +38,7 @@
const { navigateTo } = useNavigator()
import { getTabList,getFilmWorksBase } from '@/sub-pages/utils/api'
+import { useUserStore } from '@/store/user'
const theme = ref('light')
const search = ref('')
@@ -63,12 +64,35 @@
getfilms() // 重新加载数据
}
-const handleDetailClick = (item: FilmCategoryTree) => {
- const urlOfficicl=`/sub-pages/film-list/film-official-detail?id=${item.id}`;
- const url= `/sub-pages/film-list/film-detail?id=${item.id}`
- navigateTo(url)
+const handleDetailClick = async (item: FilmCategoryTree) => {
+ const userStore = useUserStore()
+ // 尝试获取最新用户信息验证登录状态
+ try {
+ await userStore.getCurrentInfo()
+ if (userStore.hasLogin) {
+ navigateTo(`/sub-pages/film-list/film-detail?id=${item.id}`)
+ } else {
+ showLoginModal()
+ }
+ } catch (err) {
+ console.error('验证登录状态失败:', err)
+ showLoginModal()
+ }
+ // const urlOfficicl=`/sub-pages/film-list/film-official-detail?id=${item.id}`;
+ // const url= `/sub-pages/film-list/film-detail?id=${item.id}`
+ // navigateTo(url)
}
+const showLoginModal = () => {
+ uni.showModal({
+ title: '登录提示',
+ content: '查看详情需要登录,是否前往登录?',
+ confirmText: '去登录',
+ success: (res) => {
+ if(res.confirm) uni.navigateTo({ url: '/pages/login/login' })
+ }
+ })
+}
const showToast = (msg: string) => {
uni.showToast({ title: msg, icon: 'none' })
}
@@ -112,7 +136,7 @@
if (filmStatus.value === 'nomore') return
filmStatus.value = 'loading'
- // TODO 暂时使用光影社区的类别
+ // TODO 暂时使用光影的类别
const query: FilmWorksQueryDTO = {
category: currentCategory.value, // 将当前分类ID加入查询参数
classify: '',
diff --git a/sub-pages/mine/index.vue b/sub-pages/mine/index.vue
index cb9b46d..d761aa9 100644
--- a/sub-pages/mine/index.vue
+++ b/sub-pages/mine/index.vue
@@ -3,9 +3,10 @@
<view class="profile-section" :style="backgroundStyle">
<up-sticky bgColor="#000">
<view class="top-bar">
- <up-icon name="list" size="60rpx" color="#D0E1E9" @click="onSettingClick" />
+ <up-icon name="setting" size="60rpx" color="#D0E1E9" @click="onSettingClick" />
+<!-- <up-icon name="list" size="60rpx" color="#D0E1E9" @click="showUnderDevelopment" />-->
<view class="top-bar-right">
- <up-icon name="share" size="60rpx" color="#D0E1E9" />
+<!-- <up-icon name="share" size="60rpx" color="#D0E1E9" @click="showUnderDevelopment" />-->
</view>
</view>
</up-sticky>
@@ -21,45 +22,45 @@
</view>
</view>
<view class="user-info">
- <view class="username">影途 {{ userStore?.userInfo?.customerDTO?.name }}</view>
- <view class="user-id">影途号:{{ userStore?.userInfo?.customerDTO?.id }}</view>
+ <view class="username">影游四方 {{ userStore?.userInfo?.customerDTO?.name }}</view>
+ <view class="user-id">影游四方号:{{ userStore?.userInfo?.customerDTO?.id }}</view>
<view class="location">IP 属地:{{ userStore.address?.ad_info?.province }}</view>
</view>
</view>
- <view class="edit-profile" >点击这里,填写简介</view>
+<!-- <view class="edit-profile" >点击这里,填写简介</view>-->
<view class="stats">
<view class="stat-row">
- <view class="stat-item">
- <text class="number">0</text>
- <text class="label">关注</text>
- </view>
- <view class="stat-item">
- <text class="number">0</text>
- <text class="label">粉丝</text>
- </view>
- <view class="stat-item">
+<!-- <view class="stat-item">-->
+<!-- <text class="number">0</text>-->
+<!-- <text class="label">关注</text>-->
+<!-- </view>-->
+<!-- <view class="stat-item">-->
+<!-- <text class="number">0</text>-->
+<!-- <text class="label">粉丝</text>-->
+<!-- </view>-->
+<!-- <view class="stat-item">
<text class="number">1</text>
<text class="label">获赞与收藏</text>
- </view>
+ </view> -->
</view>
<view class="action-buttons">
- <up-button text="编辑资料" size="mini" type="info" plain hairline @click="navigateTo('/sub-pages/mine/profile-edit')"
- :custom-style="{ backgroundColor: 'transparent', borderColor: '#B1ABA9' }" />
- <up-icon name="setting" size="40rpx" @click="navigateTo('/sub-pages/mine/settings')" />
+<!-- <up-button text="编辑资料" size="mini" type="info" plain hairline @click="navigateTo('/sub-pages/mine/profile-edit')"-->
+<!-- :custom-style="{ backgroundColor: 'transparent', borderColor: '#B1ABA9' }" />-->
+<!-- <up-icon name="setting" size="40rpx" @click="navigateTo('/sub-pages/mine/settings')" />-->
</view>
</view>
</view>
- <scroll-view class="function-cards" scroll-x show-scrollbar="false">
- <view class="card" v-for="item in cardList" :key="item.title">
- <view class="card-content">
- <text class="card-title">{{ item.title }}</text>
- <text class="card-subtitle">{{ item.subtitle }}</text>
- </view>
- </view>
- </scroll-view>
+<!-- <scroll-view class="function-cards" scroll-x show-scrollbar="false">-->
+<!-- <view class="card" v-for="item in cardList" :key="item.title" @click="showUnderDevelopment">-->
+<!-- <view class="card-content">-->
+<!-- <text class="card-title">{{ item.title }}</text>-->
+<!-- <text class="card-subtitle">{{ item.subtitle }}</text>-->
+<!-- </view>-->
+<!-- </view>-->
+<!-- </scroll-view>-->
</view>
<view class="tab-section">
@@ -68,20 +69,67 @@
activeStyle="color: #2979ff" />
</up-sticky>
+
+<!-- <swiper class="swiper-box" :current="current" @change="onSwiperChange" duration="300">-->
+<!-- <swiper-item v-for="(item, index) in tabList" :key="index">-->
+<!-- <view v-if="!userStore.hasLogin" class="empty-state">-->
+<!-- <text class="empty-text">请登录后查看{{ item.name }}</text>-->
+<!-- </view>-->
+<!-- <view v-else-if="getCurrentList.length === 0" class="empty-state">-->
+<!-- <text class="empty-text">暂无{{ item.name }}内容</text>-->
+<!-- </view>-->
+<!-- <view v-else class="list-view">-->
+<!-- <up-waterfall v-model="getCurrentList">-->
+<!-- <template #left="{ leftList }">-->
+<!-- <FlowCard-->
+<!-- v-for="(item, index) in leftList"-->
+<!-- :key="index"-->
+<!-- :item="item"-->
+<!-- @click="handleDetailClick"-->
+<!-- />-->
+<!-- </template>-->
+<!-- <template #right="{ rightList }">-->
+<!-- <FlowCard-->
+<!-- v-for="(item, index) in rightList"-->
+<!-- :key="index"-->
+<!-- :item="item"-->
+<!-- @click="handleDetailClick"-->
+<!-- />-->
+<!-- </template>-->
+<!-- </up-waterfall>-->
+<!-- <up-loadmore :status="loading ? 'loading' : 'nomore'" :line="true" />-->
+<!-- </view>-->
+<!-- </swiper-item>-->
+<!-- </swiper>-->
<swiper class="swiper-box" :current="current" @change="onSwiperChange" duration="300">
<swiper-item v-for="(item, index) in tabList" :key="index">
- <view class="empty-state">
- <image class="empty-icon"
- src="https://ai-public.mastergo.com/ai/img_res/fc3cb775274ef0f5e58ac01687a9c121.jpg" mode="aspectFit" />
- <text class="empty-text">快去发布你的笔记吧</text>
- <up-button class="publish-btn" size="mini" type="warning" shape="circle">去发布</up-button>
+ <view class="list-view">
+ <up-waterfall v-model="getCurrentList">
+ <template #left="{ leftList }">
+ <FlowCard
+ v-for="(item, index) in leftList"
+ :key="index"
+ :item="item"
+ @click="handleDetailClick"
+ />
+ </template>
+ <template #right="{ rightList }">
+ <FlowCard
+ v-for="(item, index) in rightList"
+ :key="index"
+ :item="item"
+ @click="handleDetailClick"
+ />
+ </template>
+ </up-waterfall>
+ <up-loadmore :status="loading ? 'loading' : 'nomore'" :line="true" />
</view>
</swiper-item>
</swiper>
</view>
<common-footer flg="0" />
- <setting-popup v-model="settingShow" />
+<!-- <setting-popup v-model="settingShow" />-->
</view>
</template>
@@ -93,6 +141,8 @@
import { useUserStore } from '@/store/user'
import { useLocation } from '@/composables/useLocation'
import { useNavigator } from '@/composables/useNavigator'
+import { FilmWorks } from '@/types/index'
+import{ getFilmCollectList, getFilmLikeList} from '@/sub-pages/utils/api'
const { apitype } = usePlatformLoginType()
const userStore = useUserStore()
@@ -104,12 +154,26 @@
() => userStore.userInfo, // 监听 userInfo 这个响应式属性
(newVal, oldVal) => {
console.log('userInfo 发生变化:', newVal)
+ if (newVal && userStore.hasLogin) {
+ fetchList();
+ } else {
+ // 用户未登录,清空列表
+ likeList.value = [];
+ collectList.value = [];
+ }
},
{ deep: true } // 如果 userInfo 是对象,需要深度监听其属性变化
)
onShow(() => {
getLocation()
+ if (userStore.hasLogin) {
+ fetchList();
+ }else {
+ // 用户未登录,清空列表
+ likeList.value = [];
+ collectList.value = [];
+ }
});
@@ -122,9 +186,13 @@
// 控制设置弹窗显示
const settingShow = ref(false);
+const likeList = ref<FilmWorks[]>([]);
+const collectList = ref<FilmWorks[]>([]);
+const loading = ref(false);
+const noMore = ref(false);
// tab 列表
const tabList = ref([
- { name: '笔记' },
+ // { name: '笔记' },
{ name: '收藏' },
{ name: '赞过' },
]);
@@ -146,20 +214,67 @@
// 方法定义
const onSettingClick= ()=> {
- settingShow.value = true;
+ // settingShow.value = true;
+ uni.navigateTo({ url: '/sub-pages/mine/settings' })
}
const onTabChange=(item: { index: number })=> {
current.value = item.index;
+ // 切换tab时检查是否需要加载数据
+ if (userStore.hasLogin &&
+ ((current.value === 0 && collectList.value.length === 0) ||
+ (current.value === 1 && likeList.value.length === 0))) {
+ fetchList();
+ }
}
const onSwiperChange=(e: any) => {
current.value = e.detail.current;
+ onTabChange({ index: e.detail.current });
}
+const handleDetailClick = (item: FilmWorks) => {
+ navigateTo(`/sub-pages/film-list/film-detail?id=${item.id}`);
+};
+const getCurrentList = computed(() => {
+ return current.value === 0 ? collectList.value : likeList.value;
+});
+const fetchList = async () => {
+ if (!userStore.hasLogin || loading.value || noMore.value) return;
+ loading.value = true;
+ try {
+ if (current.value === 0) {
+ // 获取收藏列表
+ collectList.value = [];
+ const res = await getFilmCollectList({
+ userId: userStore.userInfo?.customerDTO?.id
+ });
+ collectList.value = res || [];
+ } else {
+ // 获取点赞列表
+ likeList.value = [];
+ const res = await getFilmLikeList({
+ userId: userStore.userInfo?.customerDTO?.id
+ });
+ likeList.value = res || [];
+ }
+ } catch (error) {
+ console.error('获取列表失败:', error);
+ uni.showToast({ title: '获取数据失败', icon: 'none' });
+ } finally {
+ loading.value = false;
+ }
+};
const goToProfile= ()=> {
navigateTo('/sub-pages/mine/edit-profile');
+};
+
+const showUnderDevelopment = () => {
+ uni.showToast({
+ title: '功能正在开发中',
+ icon: 'none'
+ });
}
</script>
@@ -327,7 +442,7 @@
.card {
display: inline-block;
- width: 180rpx;
+ width: 100%;
height: 80rpx;
margin-left: 20rpx;
background-color: rgba(60, 60, 60, 0.4);
@@ -426,11 +541,21 @@
border-radius: 32rpx !important;
padding: 0 48rpx !important;
}
+.swiper-box {
+ min-height: calc(100vh - 200rpx);
+ /*padding: 20rpx 0;*/
+}
+
+.list-view {
+ /*padding: 0 20rpx;*/
+ background-color: #fff;
+}
</style>
<style lang="scss" scoped>
-.swiper-box {
- // min-height: 600rpx;
- /* 或 100vh,或具体 px */
- min-height: 800px;
-}
+//.swiper-box {
+// // min-height: 600rpx;
+// /* 或 100vh,或具体 px */
+// min-height: 800px;
+//}
+
</style>
\ No newline at end of file
diff --git a/sub-pages/mine/settings.vue b/sub-pages/mine/settings.vue
index 0770cc1..9f2e734 100644
--- a/sub-pages/mine/settings.vue
+++ b/sub-pages/mine/settings.vue
@@ -25,11 +25,11 @@
<!-- 底部操作 -->
<view class="bottom-actions">
<up-cell-group :border="false" class="cell-group">
- <up-cell :border="true" @click="onSwitchAccount">
- <template #title>
- <view class="center-cell-text">切换账号</view>
- </template>
- </up-cell>
+<!-- <up-cell :border="true" @click="onSwitchAccount">-->
+<!-- <template #title>-->
+<!-- <view class="center-cell-text">切换账号</view>-->
+<!-- </template>-->
+<!-- </up-cell>-->
<up-cell :border="true" @click="onLogout">
<template #title>
<view class="center-cell-text">退出登录</view>
@@ -39,22 +39,24 @@
</view>
<!-- 法律文案 -->
- <view class="portotal-actions">
- <view class="action-row">
- <up-text size="10" :bold="true" text="《个人信息收集清单》" @click="toPortotalUni('个人信息收集清单')" color="#38516E" />
- <up-text size="10" :bold="true" text="《第三方信息共享清单》" @click="toPortotalUni('个人信息收集清单')" color="#38516E" />
- </view>
- <view class="action-row">
- <up-text size="10" :bold="true" text="《用户服务协议》" @click="toPortotalUni('用户协议')" color="#38516E" />
- <up-text size="10" :bold="true" text="《用户隐私政策》" @click="toPortotalUni('隐私政策')" color="#38516E" />
- </view>
- </view>
+<!-- <view class="portotal-actions">-->
+<!-- <view class="action-row">-->
+<!-- <up-text size="10" :bold="true" text="《个人信息收集清单》" @click="toPortotalUni('个人信息收集清单')" color="#38516E" />-->
+<!-- <up-text size="10" :bold="true" text="《第三方信息共享清单》" @click="toPortotalUni('个人信息收集清单')" color="#38516E" />-->
+<!-- </view>-->
+<!-- <view class="action-row">-->
+<!-- <up-text size="10" :bold="true" text="《用户服务协议》" @click="toPortotalUni('用户协议')" color="#38516E" />-->
+<!-- <up-text size="10" :bold="true" text="《用户隐私政策》" @click="toPortotalUni('隐私政策')" color="#38516E" />-->
+<!-- </view>-->
+<!-- </view>-->
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useNavigator } from '@/composables/useNavigator'
+ import { useUserStore } from '@/store/user'
+ const userStore = useUserStore()
const { toProtocol } = useNavigator()
@@ -71,23 +73,23 @@
// 设置菜单
const menuList = ref<Array<Array<MenuItem>>>([
- [
- { title: '账号与安全', icon: 'account' },
- { title: '通用设置', icon: 'setting' },
- { title: '通知设置', icon: 'bell' },
- { title: '隐私设置', icon: 'lock' }
- ],
- [
- { title: '存储空间', icon: 'trash', value: '1.12 GB' },
- { title: '内容偏好调节', icon: 'file-text' },
- { title: '收货地址', icon: 'map' },
- { title: '添加小组件', icon: 'grid' },
- { title: '未成年人模式', icon: '/static/common/umbrella.png', value: '未开启' }
- ],
- [
- { title: '帮助与客服', icon: 'kefu-ermai' },
- { title: '关于小红书', icon: 'info-circle' }
- ]
+ // [
+ // { title: '账号与安全', icon: 'account' },
+ // { title: '通用设置', icon: 'setting' },
+ // { title: '通知设置', icon: 'bell' },
+ // { title: '隐私设置', icon: 'lock' }
+ // ],
+ // [
+ // { title: '存储空间', icon: 'trash', value: '1.12 GB' },
+ // { title: '内容偏好调节', icon: 'file-text' },
+ // { title: '收货地址', icon: 'map' },
+ // { title: '添加小组件', icon: 'grid' },
+ // { title: '未成年人模式', icon: '/static/common/umbrella.png', value: '未开启' }
+ // ],
+ // [
+ // { title: '帮助与客服', icon: 'kefu-ermai' },
+ // { title: '关于小红书', icon: 'info-circle' }
+ // ]
])
// 点击菜单项
@@ -114,7 +116,44 @@
content: '确定要退出登录吗?',
success: (res) => {
if (res.confirm) {
- uni.showToast({ title: '已退出登录', icon: 'success' })
+ try {
+ // 显示加载状态
+ uni.showLoading({ title: '正在退出...', mask: true })
+
+ // 1. 调用登出逻辑(如果有后端API)
+ // const result = await http.request('post', '/api/logout')
+ // if (result.code !== 0) throw new Error(result.msg)
+
+ // 2. 清除本地用户状态
+ userStore.$reset() // 重置整个store
+
+ // 3. 清除本地存储
+ uni.removeStorageSync('token')
+ uni.removeStorageSync('userInfo')
+
+ // 4. 显示成功提示
+ uni.showToast({
+ title: '已退出登录',
+ icon: 'success',
+ duration: 1500
+ })
+
+ // 5. 跳转到登录页
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '/pages/login/login' // 根据实际路由调整
+ })
+ }, 1500)
+
+ } catch (error) {
+ uni.showToast({
+ title: '退出登录失败',
+ icon: 'none'
+ })
+ console.error('退出登录失败:', error)
+ } finally {
+ uni.hideLoading()
+ }
}
}
})
diff --git a/sub-pages/utils/api.ts b/sub-pages/utils/api.ts
index 0316dea..5181ed3 100644
--- a/sub-pages/utils/api.ts
+++ b/sub-pages/utils/api.ts
@@ -96,4 +96,31 @@
message.showToast('系统异常,无法获取数据');
return null;
}
-}
\ No newline at end of file
+}
+// 获取用户点赞的电影列表
+export const getFilmLikeList = async (query: { userId: string }) => {
+ const { code, data } = await http.request('get', '/api/filmWorks/like/list', {
+ params: query
+ });
+
+ if (code === 0) {
+ return data.records;
+ } else {
+ message.showToast('系统异常,无法获取数据');
+ return null;
+ }
+};
+
+// 获取用户收藏的电影列表
+export const getFilmCollectList = async (query: { userId: string }) => {
+ const { code, data } = await http.request('get', '/api/filmWorks/collect/list', {
+ params: query
+ });
+
+ if (code === 0) {
+ return data.records;
+ } else {
+ message.showToast('系统异常,无法获取数据');
+ return null;
+ }
+};
\ No newline at end of file
diff --git a/types/index.ts b/types/index.ts
index 7ba6aaa..81be94e 100644
--- a/types/index.ts
+++ b/types/index.ts
@@ -56,7 +56,7 @@
/** 发布状态(COMMON_PUBLISH_STATUS) */
status?: string;
- /** 分类:1-为你精选,2-光影社区 */
+ /** 分类:1-为你精选,2-光影天地 */
classify?: number;
/** 创建日期(yyyy-mm-dd)开始 */
--
Gitblit v1.9.3