Преглед изворни кода

Merge remote-tracking branch 'origin/test_dev' into test_dev

wangwenju пре 1 месец
родитељ
комит
b7527a837c

+ 105 - 104
LiangZhiYUMao/pages/matchmaker-workbench/edit-profile.vue

@@ -1,126 +1,127 @@
 <template>
   <view class="edit-profile">
-    <!-- 顶部导航栏 -->
-    <view class="header">
-      <view class="back-btn" @click="handleBack">
-        <text class="back-icon">←</text>
-      </view>
-      <text class="header-title">编辑资料</text>
-      <view class="right-empty"></view>
+  <!-- 顶部导航栏 -->
+  <view class="header">
+    <view class="back-btn" @click="handleBack">
+      <text class="back-icon">←</text>
     </view>
+    <text class="header-title">编辑资料</text>
+    <view class="right-empty"></view>
+  </view>
 
-    <scroll-view scroll-y class="content">
-      <!-- 头像上传区域 -->
-      <view class="avatar-section">
-        <view class="avatar-container">
-          <image class="avatar" :src="userInfo.avatar || defaultAvatar" mode="aspectFill"></image>
-          <view class="avatar-upload-btn" @click="handleAvatarUpload">
-            <text class="upload-icon">📷</text>
-          </view>
+  <scroll-view scroll-y class="content">
+    <!-- 头像上传区域 -->
+    <view class="avatar-section">
+      <view class="avatar-container">
+        <image class="avatar" :src="userInfo.avatar || defaultAvatar" mode="aspectFill"></image>
+        <view class="avatar-upload-btn" @click="handleAvatarUpload">
+          <text class="upload-icon">📷</text>
         </view>
-        <text class="avatar-text">更换头像</text>
       </view>
+      <text class="avatar-text">更换头像</text>
+    </view>
 
-      <!-- 表单区域 -->
-      <view class="form-section">
-        <!-- 姓名 -->
-        <view class="form-item">
-          <view class="form-label">
-            <text class="label-icon">👤</text>
-            <text class="label-text">姓名</text>
-          </view>
-          <input
-              class="form-input"
-              v-model="userInfo.name"
-              placeholder="请输入姓名"
-              placeholder-style="color: #999"
-          >
+    <!-- 表单区域 -->
+    <view class="form-section">
+      <!-- 姓名 -->
+      <view class="form-item">
+        <view class="form-label">
+          <text class="label-icon">👤</text>
+          <text class="label-text">姓名</text>
         </view>
+        <input
+            class="form-input"
+            v-model="userInfo.name"
+            placeholder="请输入姓名"
+            placeholder-style="color: #999"
+        >
+      </view>
 
-        <!-- 性别 -->
-        <view class="form-item">
-          <view class="form-label">
-            <text class="label-icon">⚧️</text>
-            <text class="label-text">性别</text>
-          </view>
-          <picker class="form-picker gender-picker" @change="handleGenderChange" :value="genderIndex" :range="genderOptions">
-            <view class="picker-content">
-              {{ userInfo.gender || '请选择性别' }}
-            </view>
-          </picker>
+      <!-- 性别 -->
+      <view class="form-item">
+        <view class="form-label">
+          <text class="label-icon">⚧️</text>
+          <text class="label-text">性别</text>
         </view>
-
-        <!-- 个人简介 -->
-        <view class="form-item">
-          <view class="form-label">
-            <text class="label-icon">📝</text>
-            <text class="label-text">个人简介</text>
+        <picker class="form-picker gender-picker" @change="handleGenderChange" :value="genderIndex"
+                :range="genderOptions">
+          <view class="picker-content">
+            {{ userInfo.gender || '请选择性别' }}
           </view>
-          <textarea
-              class="form-textarea"
-              v-model="userInfo.bio"
-              placeholder="请输入个人简介"
-              placeholder-style="color: #999"
-              maxlength="200"
-              auto-height
-          ></textarea>
-        </view>
+        </picker>
+      </view>
 
-        <!-- 邮箱 -->
-        <view class="form-item">
-          <view class="form-label">
-            <text class="label-icon">📧</text>
-            <text class="label-text">邮箱</text>
-          </view>
-          <input
-              class="form-input"
-              v-model="userInfo.email"
-              placeholder="请输入邮箱"
-              placeholder-style="color: #999"
-              type="email"
-          >
+      <!-- 个人简介 -->
+      <view class="form-item">
+        <view class="form-label">
+          <text class="label-icon">📝</text>
+          <text class="label-text">个人简介</text>
         </view>
+        <textarea
+            class="form-textarea"
+            v-model="userInfo.bio"
+            placeholder="请输入个人简介"
+            placeholder-style="color: #999"
+            maxlength="200"
+            auto-height
+        ></textarea>
+      </view>
 
-        <!-- 省市区选择 -->
-        <view class="form-item">
-          <view class="form-label">
-            <text class="label-icon">📍</text>
-            <text class="label-text">所在地区</text>
-          </view>
-          <picker
-              class="form-picker"
-              mode="multiSelector"
-              :value="multiIndex"
-              :range="multiArray"
-              @columnchange="handleColumnChange"
-              @change="handleMultiPickerChange"
-          >
-            <view class="picker-content">{{ selectedArea || '请选择地区' }}</view>
-          </picker>
+      <!-- 邮箱 -->
+      <view class="form-item">
+        <view class="form-label">
+          <text class="label-icon">📧</text>
+          <text class="label-text">邮箱</text>
         </view>
+        <input
+            class="form-input"
+            v-model="userInfo.email"
+            placeholder="请输入邮箱"
+            placeholder-style="color: #999"
+            type="email"
+        >
+      </view>
 
-        <!-- 详细地址 -->
-        <view class="form-item">
-          <view class="form-label">
-            <text class="label-icon">🏠</text>
-            <text class="label-text">详细地址</text>
-          </view>
-          <textarea
-              class="form-textarea"
-              v-model="userInfo.address_detail"
-              placeholder="请输入详细地址"
-              placeholder-style="color: #999"
-              maxlength="255"
-              auto-height
-          ></textarea>
+      <!-- 省市区选择 -->
+      <view class="form-item">
+        <view class="form-label">
+          <text class="label-icon">📍</text>
+          <text class="label-text">所在地区</text>
         </view>
+        <picker
+            class="form-picker"
+            mode="multiSelector"
+            :value="multiIndex"
+            :range="multiArray"
+            @columnchange="handleColumnChange"
+            @change="handleMultiPickerChange"
+        >
+          <view class="picker-content">{{ selectedArea || '请选择地区' }}</view>
+        </picker>
       </view>
 
-      <!-- 保存按钮 -->
-      <view class="save-btn-section">
-        <button class="save-btn" @click="handleSave">保存</button>
+      <!-- 详细地址 -->
+      <view class="form-item">
+        <view class="form-label">
+          <text class="label-icon">🏠</text>
+          <text class="label-text">详细地址</text>
+        </view>
+        <textarea
+            class="form-textarea"
+            v-model="userInfo.address_detail"
+            placeholder="请输入详细地址"
+            placeholder-style="color: #999"
+            maxlength="255"
+            auto-height
+        ></textarea>
       </view>
-    </scroll-view>
+    </view>
+
+    <!-- 保存按钮 -->
+    <view class="save-btn-section">
+      <button class="save-btn" @click="handleSave">保存</button>
+    </view>
+  </scroll-view>
   </view>
 </template>
 
@@ -500,7 +501,7 @@ export default {
 
     /* 性别选择器特定样式 */
     .gender-picker {
-      width: 10%;
+      width: 25%;
     }
 
     .form-textarea {

+ 32 - 19
LiangZhiYUMao/pages/part-time-matchmaker/index.vue

@@ -150,6 +150,7 @@
 
 <script>
 	import api from '@/utils/api.js'
+	import userAuth from '@/utils/userAuth.js'
 	
 	export default {
 		data() {
@@ -159,7 +160,7 @@
 					phone: '',
 					email: '',
 					age: '',
-					gender: 2, // 默认女
+					gender: '',
 					provinceId: null,
 					cityId: null,
 					areaId: null,
@@ -445,6 +446,14 @@
 					return
 				}
 				
+				if (!this.formData.gender) {
+					uni.showToast({
+						title: '请选择性别',
+						icon: 'none'
+					})
+					return
+				}
+				
 				if (!this.formData.provinceId || !this.formData.cityId || !this.formData.areaId) {
 					uni.showToast({
 						title: '请选择所在地区',
@@ -477,6 +486,21 @@
 					return
 				}
 				
+				// 检查登录状态并获取用户ID
+				console.log('=== 开始检查登录状态 ===')
+				const userId = await userAuth.checkLoginStatus({
+					requireLogin: true,
+					allowTestUser: false,
+					redirectUrl: '/pages/part-time-matchmaker/index'
+				})
+				
+				console.log('获取到的userId:', userId)
+				
+				if (!userId) {
+					console.log('用户未登录或登录信息异常')
+					return
+				}
+				
 				uni.showModal({
 					title: '提交申请',
 					content: '确认提交兼职红娘申请吗?',
@@ -487,25 +511,9 @@
 							})
 							
 							try {
-								// 获取当前登录用户ID
-								const userInfo = uni.getStorageSync('userInfo')
-								if (!userInfo || !userInfo.userId) {
-									uni.hideLoading()
-									uni.showToast({
-										title: '请先登录',
-										icon: 'none'
-									})
-									setTimeout(() => {
-										uni.navigateTo({
-											url: '/pages/page3/page3'
-										})
-									}, 1500)
-									return
-								}
-								
 								// 组装提交数据
 								const submitData = {
-									userId: userInfo.userId,
+									userId: userId,
 									name: this.formData.name,
 									phone: this.formData.phone,
 									email: this.formData.email,
@@ -517,6 +525,11 @@
 									introduction: this.formData.introduction
 								}
 								
+								console.log('=== 提交红娘申请 ===')
+								console.log('userId类型:', typeof userId)
+								console.log('userId值:', userId)
+								console.log('完整提交数据:', JSON.stringify(submitData, null, 2))
+								
 								// 调用后端接口提交申请
 								await api.matchmaker.submitApply(submitData)
 								
@@ -532,7 +545,7 @@
 											phone: '',
 											email: '',
 											age: '',
-											gender: 2,
+											gender: '',
 											provinceId: null,
 											cityId: null,
 											areaId: null,

+ 2 - 2
common/src/main/java/com/zhentao/pojo/MatchmakerApply.java

@@ -15,13 +15,13 @@ import java.time.LocalDateTime;
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
-@TableName("matchmaker_apply")
+@TableName("marr_apply")
 public class MatchmakerApply {
     
     @TableId(type = IdType.AUTO)
     private Long applyId;
     
-    private Integer userId;
+    private Long userId;  // 修改为Long类型,与数据库bigint对应
     
     private String name;
     

+ 4 - 0
common/src/main/java/com/zhentao/service/impl/MatchmakerApplyServiceImpl.java

@@ -20,6 +20,10 @@ public class MatchmakerApplyServiceImpl extends ServiceImpl<MatchmakerApplyMappe
         // 设置创建时间
         matchmakerApply.setCreateTime(LocalDateTime.now());
         matchmakerApply.setUpdateTime(LocalDateTime.now());
+
+        // 更新人创建人
+        matchmakerApply.setCreateMan("系统管理员");
+        matchmakerApply.setUpdateMan("系统管理员");
         
         // 设置默认状态为正常
         if (matchmakerApply.getStatus() == null) {

+ 4 - 0
gateway/src/main/java/com/zhentao/filter/GatewayRoutes.java

@@ -23,6 +23,10 @@ public class GatewayRoutes {
                 // 首页服务路由 - 红娘相关接口(端口8081)
                 .route("homepage_matchmaker_route", r -> r.path("/api/matchmaker/**")
                         .uri("http://localhost:8081"))
+                
+                // 首页服务路由 - 红娘申请接口(端口8081)
+                .route("homepage_matchmaker_apply_route", r -> r.path("/api/matchmaker-apply/**")
+                        .uri("http://localhost:8081"))
 
                 // 首页服务路由 - 其他首页接口(端口8081)
                 .route("homepage_route", r -> r.path("/api/home/**")

+ 1 - 1
service/admin/src/main/java/com/zhentao/entity/MarrApply.java

@@ -63,7 +63,7 @@ public class MarrApply {
     /**
      * 可服务时间
      */
-    private Date serverTime;
+    private String serverTime;
 
     /**
      * 个人简介

+ 17 - 0
service/homePage/pom.xml

@@ -15,6 +15,7 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <jackson.version>2.15.2</jackson.version>
     </properties>
 
     <dependencies>
@@ -61,5 +62,21 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
     </dependencies>
 </project>

+ 25 - 1
service/homePage/src/main/java/com/zhentao/controller/MatchmakerApplyController.java

@@ -1,11 +1,16 @@
 package com.zhentao.controller;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.zhentao.common.Result;
 import com.zhentao.pojo.MatchmakerApply;
 import com.zhentao.service.MatchmakerApplyService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
+import java.io.BufferedReader;
+import java.util.Map;
+
 /**
  * 红娘申请控制器
  */
@@ -22,11 +27,30 @@ public class MatchmakerApplyController {
      * @param matchmakerApply 申请信息(包含userId和表单数据)
      * @return 申请结果
      */
+    /**
+     * 提交红娘申请 - 使用Map接收原始数据
+     */
     @PostMapping("/submit")
-    public Result<String> submitApply(@RequestBody MatchmakerApply matchmakerApply) {
+    public Result<String> submitApply(@RequestBody Map<String, Object> requestData, HttpServletRequest request) {
         try {
+            // 打印接收到的原始数据
+            System.out.println("========== 红娘申请提交 ==========");
+            System.out.println("原始请求数据: " + requestData);
+            System.out.println("userId字段: " + requestData.get("userId"));
+            System.out.println("userId类型: " + (requestData.get("userId") != null ? requestData.get("userId").getClass().getName() : "null"));
+            System.out.println("==================================");
+            
+            // 手动转换为 MatchmakerApply 对象
+            ObjectMapper mapper = new ObjectMapper();
+            MatchmakerApply matchmakerApply = mapper.convertValue(requestData, MatchmakerApply.class);
+            
+            System.out.println("转换后的对象: " + matchmakerApply);
+            System.out.println("转换后userId: " + matchmakerApply.getUserId());
+            System.out.println("==================================");
+            
             // 验证必填字段
             if (matchmakerApply.getUserId() == null) {
+                System.err.println("❌ 用户ID为空!");
                 return Result.error("用户ID不能为空");
             }
             

+ 5 - 0
service/homePage/src/main/java/com/zhentao/entity/Matchmaker.java

@@ -25,6 +25,11 @@ public class Matchmaker implements Serializable {
      */
     @TableId(value = "matchmaker_id", type = IdType.AUTO)
     private Integer matchmakerId;
+
+    /**
+     * 红娘对应的用户ID
+     */
+    private Long userId;
     
     /**
      * 红娘登录账号