浏览代码

增加 游戏入口

XSXS 2 月之前
父节点
当前提交
a7ea6a037f
共有 3 个文件被更改,包括 212 次插入53 次删除
  1. 65 9
      components/tabbar/tabbar.vue
  2. 0 5
      pages.json
  3. 147 39
      pages/my/myStar.vue

+ 65 - 9
components/tabbar/tabbar.vue

@@ -3,7 +3,8 @@
 		<view class="tabbar-bottom" :style="{ backgroundColor: backgroundColor, height: tabbarHeight + 'px' }">
 			<view class="tabbar-bottom-item" ref="tabbarItem" v-for="(item, index) in tabbars" :key="index"
 				@click="switchTab(item, index)">
-				<image v-if="item.type!='midButton'" :src="currentIndex == index ? item.selectedIconPath : item.iconPath"
+				<image v-if="item.type != 'midButton'"
+					:src="currentIndex == index ? item.selectedIconPath : item.iconPath"
 					:class="['tabbar-bottom-item-icon']"></image>
 				<text class="tabbar-bottom-item-text"
 					:style="{ color: currentIndex == index ? textActiveColor : textColor }">{{ item.text }}</text>
@@ -64,7 +65,7 @@ export default {
 
 	methods: {
 		switchTab(item, index) {
-			if (!item.pagePath) return;  
+			if (!item.pagePath) return;
 			if (item.pagePath == '/pages/message/mailMessage') {
 				uni.$emit('check_login', () => {
 					uni.switchTab({
@@ -78,13 +79,68 @@ export default {
 			});
 			// this.payAnimation()
 		},
-		midButtonGo(item, index) {
-			if (!item.pagePath) return;
-			console.log();
-			// uni.switchTab({
-			// 	url: item.pagePath,
-			// });
-			// this.payAnimation()
+		midButtonGo() {
+			console.log('点击了中间按钮');
+			// 判断登录
+			uni.$emit('check_login', () => {
+				// 先读取本地缓存
+				const isJoiningThePlanet = uni.getStorageSync('isJoiningThePlanet');
+				
+				if (isJoiningThePlanet === true) {
+					// 如果缓存为true,直接跳转到星球页面
+					uni.navigateTo({
+						url: '/pages/isLand/homeLand'
+					});
+					return;
+				}
+				
+				// 如果缓存不为true,则请求接口
+				uni.request({
+					url: this.$apiHost + "/AIpipei/getinfo",
+					data: {
+						uuid: getApp().globalData.uuid,
+					},
+					header: {
+						"content-type": "application/json",
+						sign: getApp().globalData.headerSign,
+					},
+					timeout: 60000,
+					success: (res) => {
+						if (res && res.data && res.data.info) {
+							if (res.data.info.image && res.data.info.status == 1) {
+								// 设置本地缓存
+								uni.setStorageSync('isJoiningThePlanet', true);
+								// 跳转到星球页面
+								uni.navigateTo({
+									url: '/pages/isLand/homeLand'
+								});
+							} else {
+								// 设置本地缓存
+								uni.setStorageSync('isJoiningThePlanet', false);
+								// 跳转到我的星球页面
+								uni.navigateTo({
+									url: '/pages/my/myStar'
+								});
+							}
+						} else {
+							// 设置本地缓存
+							uni.setStorageSync('isJoiningThePlanet', false);
+							// 跳转到我的星球页面
+							uni.navigateTo({
+								url: '/pages/my/myStar'
+							});
+						}
+					},
+					fail: (err) => {
+						// 请求失败时也跳转到我的星球页面
+						uni.navigateTo({
+							url: '/pages/my/myStar'
+						});
+					},
+					complete: () => {
+					}
+				});
+			})
 		},
 		async payAnimation() {
 			const active = [{

+ 0 - 5
pages.json

@@ -339,11 +339,6 @@
 				"navigationBarTitleText": "我的星灵",
 				"navigationStyle": "custom"
 			}
-		}, {
-			"path": "pages/isLand/test",
-			"style": {
-				"navigationBarTitleText": "测试"
-			}
 		}, {
 			"path": "pages/isLand/mainLand",
 			"style": {

+ 147 - 39
pages/my/myStar.vue

@@ -133,7 +133,8 @@
 				<!-- 角色信息板块 -->
 				<view class="info-section">
 					<view class="character-name">
-						{{ starInfo.nickname }}
+						<uv-input v-if="state == 5" v-model="starInfo.nickname" placeholder="请输入昵称" border="none" />
+						<text v-else>{{ starInfo.nickname }}</text>
 						<image class="male" v-if="starInfo.sex == 0" src="../../static/me/wd_icon_nan.png"
 							mode="aspectFit">
 						</image>
@@ -141,18 +142,19 @@
 							mode="aspectFit">
 						</image>
 						<image class="other" v-else src="../../static/me/wd_icon_qita.png" mode="aspectFit"></image>
-
 					</view>
-					<!-- <view class="section-title">关于Ta</view> -->
 
 					<!-- 人物简介 -->
 					<view class="description-box">
 						<view class="description-title">
 							<view>Ta的设定</view>
-							<view v-if="false" class="edit-button">编辑<text class="fa fa-angle-right"
-									style="color: #000;"></text></view>
+							<view v-if="state == 5" class="edit-button" @click="showEditPopup">
+								编辑<text class="fa fa-angle-right" style="color: #000;"></text>
+							</view>
+						</view>
+						<view class="description-text">
+							<text>{{ starInfo.content }}</text>
 						</view>
-						<view class="description-text"> <text>{{ starInfo.content }}</text> </view>
 					</view>
 
 					<!-- 标签展示 -->
@@ -174,6 +176,21 @@
 			<view class="join-button" @tap="handleJoin(0)" v-if="state == 6"> 已驻星球 </view>
 		</view>
 
+		<!-- 编辑弹窗 -->
+		<uni-popup ref="editPopup" type="center">
+			<view class="edit-popup">
+				<view class="popup-title">修改设定</view>
+				<view class="popup-content">
+					<uv-textarea v-model="editContent" :maxlength="500" count autoHeight placeholder="输入Ta的设定"
+						class="edit-textarea" />
+				</view>
+				<view class="popup-buttons">
+					<view class="cancel-btn" @click="closeEditPopup">再考虑一下</view>
+					<view class="confirm-btn" @click="saveEdit">确认添加</view>
+				</view>
+			</view>
+		</uni-popup>
+
 		<SharePopup :visible="showShare" :share-url="shareUrl" :share-title="shareTitle" :share-desc="shareDesc"
 			:share-img="shareImg" @close="showShare = false" />
 	</view>
@@ -239,6 +256,7 @@ export default {
 			maxRetries: 10, // 最大重试次数
 			retryCount: 0,  // 当前重试次数
 			pollingInterval: 30000, // 轮询间隔时间(毫秒)
+			editContent: '',
 		};
 	},
 	onLoad() {
@@ -273,33 +291,31 @@ export default {
 				this.formData.tags.push(tag);
 			}
 		},
-		handleJoin() {
-			console.log("入驻星球");
-			// 处理入驻逻辑
-			uni.request({
-				url: this.$apiHost + "/AIpipei/gogogo",
-				data: {
-					uuid: getApp().globalData.uuid,
-				},
-				header: {
-					"content-type": "application/x-www-form-urlencoded",
-					sign: getApp().globalData.headerSign,
-				},
-				method: "POST",
-				// 设置60秒超时
-				timeout: 60000,
-				success: (res) => {
-					this.aIpipeiGetinfo({ polling: false })
-
-				},
-				fail: (err) => {
-
-				},
-				complete: () => {
-
-				},
-			});
-
+		handleJoin(type) {
+			if (type === 1) {
+				// 保存修改后的信息到服务器
+				uni.request({
+					url: this.$apiHost + "/AIpipei/gogogo",
+					data: {
+						uuid: getApp().globalData.uuid,
+						nickname: this.starInfo.nickname,
+						content: this.starInfo.content,
+					},
+					header: {
+						"content-type": "application/x-www-form-urlencoded",
+						sign: getApp().globalData.headerSign,
+					},
+					method: "POST",
+					success: (res) => {
+						this.aIpipeiGetinfo({ polling: false });
+					}
+				});
+			} else {
+				// 已入驻状态,直接跳转
+				uni.navigateTo({
+					url: '/pages/isLand/homeLand'
+				});
+			}
 		},
 
 		// 提交用户 开始创建的命令
@@ -398,11 +414,11 @@ export default {
 					console.log("查询到生成信息", res.data);
 					// 重置重试计数
 					this.retryCount = 0;
-					
+
 					if (res && res.data && res.data.info) {
 						if (res.data.info && res.data.info.tags != "") {
 							res.data.info.tags = res.data.info.tags.split(",");
-							this.predefinedTags = res.data.info.tags.map(tag => { return { text: tag, value: tag } }) 
+							this.predefinedTags = res.data.info.tags.map(tag => { return { text: tag, value: tag } })
 							console.log(666, res);
 
 						} else {
@@ -440,7 +456,7 @@ export default {
 					console.error("请求失败:", err);
 					// 增加重试计数
 					this.retryCount++;
-					
+
 					// 显示错误提示
 					uni.showToast({
 						title: `网络请求失败,第${this.retryCount}次重试`,
@@ -463,7 +479,7 @@ export default {
 							this.aIpipeiGetinfo({ polling: true });
 						}, this.pollingInterval);
 					}
-				} 
+				}
 			});
 		},
 		// 保存表单信息
@@ -563,7 +579,23 @@ export default {
 				case 'other':
 					return 2
 			}
-		}
+		},
+		// 显示编辑弹窗
+		showEditPopup() {
+			this.editContent = this.starInfo.content;
+			this.$refs.editPopup.open();
+		},
+
+		// 关闭编辑弹窗
+		closeEditPopup() {
+			this.$refs.editPopup.close();
+		},
+
+		// 保存编辑内容
+		saveEdit() {
+			this.starInfo.content = this.editContent;
+			this.closeEditPopup();
+		},
 	},
 };
 </script>
@@ -637,7 +669,7 @@ export default {
 		align-items: center;
 		justify-content: space-between;
 		width: 100%;
-		height: calc( 90rpx + var(--status-bar-height));
+		height: calc(90rpx + var(--status-bar-height));
 		padding: 0 20rpx;
 		padding-top: var(--status-bar-height);
 		background-color: transparent;
@@ -686,4 +718,80 @@ export default {
 	}
 
 }
+
+.edit-popup {
+	width: 600rpx;
+	background: #fff;
+	border-radius: 24rpx;
+	padding: 40rpx 32rpx;
+
+	.popup-title {
+		font-size: 32rpx;
+		font-weight: bold;
+		text-align: center;
+		margin-bottom: 32rpx;
+		color: #000;
+	}
+
+	.popup-content {
+		margin-bottom: 32rpx;
+
+		.edit-textarea {
+			background: #F7F7F7;
+			border-radius: 16rpx;
+			padding: 24rpx;
+			min-height: 160rpx;
+
+			::v-deep .uv-textarea__field {
+				font-size: 28rpx;
+				color: #333;
+			}
+		}
+	}
+
+	.popup-buttons {
+		display: flex;
+		justify-content: space-between;
+		gap: 24rpx;
+
+		.cancel-btn,
+		.confirm-btn {
+			flex: 1;
+			height: 88rpx;
+			line-height: 88rpx;
+			text-align: center;
+			border-radius: 44rpx;
+			font-size: 32rpx;
+			font-weight: 500;
+		}
+
+		.cancel-btn {
+			background: #fff;
+			color: #333;
+			border: 2rpx solid #E5E5E5;
+		}
+
+		.confirm-btn {
+			background: #000;
+			color: #fff;
+		}
+	}
+}
+
+.description-title {
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+
+	.edit-button {
+		color: #7ebc00;
+		font-size: 28rpx;
+		display: flex;
+		align-items: center;
+
+		.fa-angle-right {
+			margin-left: 10rpx;
+		}
+	}
+}
 </style>