Browse Source

Merge branch 'jyb_20250506_dev' into hotfix-1.2.1

jiayubo 3 months ago
parent
commit
944c434f37

+ 2 - 1
api/login.js

@@ -12,7 +12,8 @@ export function login(username, password, code, uuid, referrerType, referrerId,
 		code,
 		uuid,
 		referrerType,
-		referrerId,
+    referrerId,
+    referrerQrCodeVersion,
 		latitude: lat,
 		longitude: lng
 	}

+ 2 - 2
api/qrcode.js

@@ -5,7 +5,7 @@ export function getUnlimitedQRCode(data = {}) {
   // 从本地存储获取用户类型和用户ID
   const userType = 1;
   const userId = uni.getStorageSync('userId') || '';
-  
+  const referrerQrCodeVersion = data.referrerQrCodeVersion;
   
   return request({
     url: '/core/InviteUser/getInviteQrCode',
@@ -22,7 +22,7 @@ export function getUnlimitedQRCode(data = {}) {
       referrerType: userType,
       referrerId: userId, // 使用本地存储的 userId
       page:'pages/login',
-      scene: data.scene || `${userType}:${userId}`, // 同样使用本地存储的值生成 scene
+      scene: data.scene || `${userType}:${userId}:${referrerQrCodeVersion}`, // 同样使用本地存储的值生成 scene
     },
     responseType: 'arraybuffer', // 设置响应类型为arraybuffer,因为返回的是图片二进制内容
   })

+ 33 - 1
components/QRCode/index.vue

@@ -51,18 +51,50 @@ const qrCodeUrl = ref('')
 const userType = 1 //默认为1
 const userId = uni.getStorageSync('userId')// 读取本地存储
 
+// 获取小程序版本号作为二维码版本号
+const getAppVersion = () => {
+  try {
+    // 调用微信API获取账号信息
+    const accountInfo = wx.getAccountInfoSync();
+    console.log(accountInfo,'accountInfoaccountInfoaccountInfoaccountInfo');
+    
+    // 获取环境类型
+    const envVersion = accountInfo.miniProgram.envVersion; // develop, trial, release
+    console.log(envVersion,'envVersionenvVersionenvVersionenvVersion');
+    // 根据不同环境返回不同的版本号
+    if (envVersion === 'release') {
+      // 正式环境,尝试获取真实版本号,获取不到则使用固定版本号
+      return accountInfo.miniProgram.version || '1.0.0';
+    } else if (envVersion === 'trial') {
+      // 体验版环境
+      return 'beta_1.0.0'; // 或其他自定义的体验版版本号
+    } else {
+      // 开发环境或其他环境
+      return 'dev_1.0.0'; // 自定义的开发版版本号
+    }
+  } catch (error) {
+    console.error('获取小程序版本号失败:', error);
+    return 'default_1.0.0'; // 默认版本号
+  }
+}
+
+// 初始化二维码版本号
+const referrerQrCodeVersion = ref(getAppVersion())
+
 // 打印用户信息,方便查看
 console.log('=== QRCode组件读取到的用户信息 ===')
 console.log('userType:', userType)
 console.log('userId:', userId)
-
+console.log('referrerQrCodeVersion:', referrerQrCodeVersion.value)
 
 const generateQRCode = async () => {
   try {
+    console.log('正在生成二维码,版本号:', referrerQrCodeVersion.value)
     const response = await getUnlimitedQRCode({
       page: props.page,
       referrerType: userType,
       referrerId: userId,
+      referrerQrCodeVersion: referrerQrCodeVersion.value,
     })
     
     // 处理返回的二进制数据

+ 11 - 4
components/Services/services.vue

@@ -11,7 +11,7 @@
           </view>
 
           <template v-else>
-            <up-lazy-load threshold="50" border-radius="10" :image="item.volunteerPicture" :index="index"
+            <up-lazy-load threshold="50" border-radius="10" :image="getVolunteerPicture(item)" :index="index"
               mode="aspectFill"></up-lazy-load>
             <view class="demo-skillDescribe">
               {{ item.businessDescribe }}
@@ -25,7 +25,7 @@
 
             <view class="demo-PriceDome">
               <view class="demo-price">
-                <image :src="item.volunteerPicture" class="name-image"></image>
+                <image :src="getVolunteerPicture(item)" class="name-image"></image>
                 <text class="name-text">{{ item.name }}</text>
               </view>
               <view class="demo-price">
@@ -46,7 +46,7 @@
 
       <template #right>
         <view class=" demo-warter" v-for="(item, index) in props.rightList" :key="index" @click="goToDetail(item)">
-          <up-lazy-load threshold="50" border-radius="10" :image="item.volunteerPicture" :index="index"
+          <up-lazy-load threshold="50" border-radius="10" :image="getVolunteerPicture(item)" :index="index"
             mode="aspectFill"></up-lazy-load>
           <view class="demo-skillDescribe">
             {{ item.businessDescribe }}
@@ -59,7 +59,7 @@
 
           <view class="demo-PriceDome">
             <view class="demo-price">
-              <image :src="item.volunteerPicture" class="name-image"></image>
+              <image :src="getVolunteerPicture(item)" class="name-image"></image>
               <text class="name-text">{{ item.name }}</text>
             </view>
             <view class="demo-price">
@@ -96,6 +96,13 @@ const props = defineProps({
   }
 });
 
+// 获取志愿者图片
+const getVolunteerPicture = (item) => {
+  // volunteerPicture是用逗号拼接的多张图片,取第一张
+  const pictures = item.volunteerPicture.split(',');
+  return pictures[0];
+};
+
 // 轮播图点击事件
 const handleSwiperClick = (item) => {
   console.log('轮播图点击', item);

+ 17 - 23
pages_home/pages/Volunteerside/detiles.vue

@@ -11,34 +11,28 @@
 </template>
 
 <script setup>
-import { ref } from 'vue';
-import {
-  slideshow,
-} from '@/api/home.js'
-import {
-  onShow
-} from "@dcloudio/uni-app";
-
+import { ref, watch } from 'vue';
+import { onShow } from "@dcloudio/uni-app";
+
+// 接收volunteerPicture属性
+const props = defineProps({
+  volunteerPicture: {
+    type: String,
+    default: ''
+  }
+});
 
 const list3 = ref([]);//轮播图数据
 
-
-const getBanners = async () => {
-  try {
-    const res = await slideshow(19);
-    if (res.code === 200 && res.data.picture) {
-      list3.value = res.data.picture.split(',');
-    }
-  } catch (error) {
-    console.log('error', error);
-
+// 监听volunteerPicture变化并更新轮播图数据
+watch(() => props.volunteerPicture, (newVal) => {
+  if (newVal) {
+    list3.value = newVal.split(',');
+  } else {
+    list3.value = [];
   }
-}
-
+}, { immediate: true });
 
-onShow(() => {
-  getBanners();
-})
 </script>
 
 <style scoped lang="scss">

+ 32 - 26
pages_home/pages/Volunteerside/goodsDetails.vue

@@ -1,10 +1,10 @@
 <template>
   <view>
 
-      <!-- 顶部轮播图 -->
-      <view>
-        <Detiles></Detiles>
-      </view>
+    <!-- 顶部轮播图 -->
+    <view>
+      <Detiles :volunteerPicture="listData.volunteerPicture"></Detiles>
+    </view>
 
     <!-- 页面背景整体定位 -->
     <view class="service-description-position">
@@ -41,7 +41,7 @@
         <!-- 主体内容 -->
         <view class="volunteer-main-content">
           <!-- 头像 -->
-          <image class="volunteer-image" :src="listData.volunteerPicture" mode="aspectFill"></image>
+          <image class="volunteer-image" :src="firstVolunteerPicture" mode="aspectFill"></image>
           <!-- 个人信息 -->
           <view class="volunteer-info">
             <view class="name-row">
@@ -135,12 +135,12 @@
       </view>
     </view>
 
-  <!-- 底部第一层弹框 -->
-  <view>
-    <up-popup :show="show" @close="close" @open="open"> </up-popup>
-    <up-popup :show="show" @open="upPopupOpen" :custom-style="popupStyle">
-      <scroll-view scroll-y class="popup-scroll-content">
-        <!-- <view>
+    <!-- 底部第一层弹框 -->
+    <view>
+      <up-popup :show="show" @close="close" @open="open"> </up-popup>
+      <up-popup :show="show" @open="upPopupOpen" :custom-style="popupStyle">
+        <scroll-view scroll-y class="popup-scroll-content">
+          <!-- <view>
             <view class="Wrapper">
               <image src="/static/img/Location.png" class="Wrapper-img" />
               <span class="Wrapper-content">李四</span>
@@ -235,17 +235,17 @@
         </up-cell-group>
       </view>
 
-    <view class="Wrap-Payment">
-      <!-- 支付金额 -->
-      <view class="payment-header">
-        <text class="payment-title">现在支付</text>
-        <text class="payment-amount">¥{{ computeMoney }}</text>
-      </view>
+      <view class="Wrap-Payment">
+        <!-- 支付金额 -->
+        <view class="payment-header">
+          <text class="payment-title">现在支付</text>
+          <text class="payment-amount">¥{{ computeMoney }}</text>
+        </view>
 
-      <up-line></up-line>
+        <up-line></up-line>
 
-      <!-- 钱包支付选项 -->
-      <!-- <view class="payment-option">
+        <!-- 钱包支付选项 -->
+        <!-- <view class="payment-option">
           <view class="option-left">
             <image src="/static/钱包.png" class="payment-icon"></image>
             <text class="option-text">钱包</text>
@@ -269,13 +269,13 @@
           </up-radio-group>
         </view>
 
-      <up-line></up-line>
+        <up-line></up-line>
 
-      <!-- 其他支付方式 -->
-      <view class="other-payment">
-        <text class="other-payment-text">其他方式支付</text>
-        <up-icon name="arrow-right" size="14" color="#1890ff"></up-icon>
-      </view>
+        <!-- 其他支付方式 -->
+        <view class="other-payment">
+          <text class="other-payment-text">其他方式支付</text>
+          <up-icon name="arrow-right" size="14" color="#1890ff"></up-icon>
+        </view>
 
         <!-- 条款说明 -->
         <view class="terms-of-service">
@@ -839,6 +839,12 @@ const changeMinQuantityMax = (val = 99999) => {
   minQuantityMax.value = val
 }
 
+// 计算属性:获取志愿者第一张图片
+const firstVolunteerPicture = computed(() => {
+  const pictures = listData.value.volunteerPicture.split(',');
+  return pictures[0];
+});
+
 onMounted(async () => {
   await getListTime()
 })

+ 2 - 2
store/modules/user.ts

@@ -80,7 +80,7 @@ const user: Module<UserState, UserState> = {
       const uuid = userInfo.uuid
       const referrerType = userInfo.referrerType
       const referrerId = userInfo.referrerId
-      
+      const referrerQrCodeVersion = userInfo.referrerQrCodeVersion
       // 确保经纬度保留6位小数 - 直接使用字符串格式
       const latitude = typeof userInfo.latitude === 'number' ? 
         userInfo.latitude.toFixed(6) : 
@@ -93,7 +93,7 @@ const user: Module<UserState, UserState> = {
       console.log('Store发送经纬度字符串格式:', latitude, longitude)
       
       return new Promise((resolve, reject) => {
-        login(username, password, code, uuid, referrerType, referrerId, latitude, longitude).then((res: any) => {
+        login(username, password, code, uuid, referrerType, referrerId, latitude, longitude,referrerQrCodeVersion).then((res: any) => {
           setToken(res.token)
           commit('SET_TOKEN', res.token)
           

+ 17 - 16
types/store.ts

@@ -1,23 +1,24 @@
 export interface UserState {
-    token: string,
-    name: string,
-    avatar: string,
-    roles: Array<string>
-    permissions: Array<string>
-	userOrWorker: any,
-    userId:any,
-    nickName:any
+  token: string,
+  name: string,
+  avatar: string,
+  roles: Array<string>
+  permissions: Array<string>
+  userOrWorker: any,
+  userId: any,
+  nickName: any
 }
 
 export interface UserForm {
-    username: string
-    password: string
-    code: string
-    uuid: string
-    referrerType: number
-    referrerId: number
-    latitude: number | string
-    longitude: number | string
+  username: string
+  password: string
+  code: string
+  uuid: string
+  referrerType: number
+  referrerId: number
+  referrerQrCodeVersion: number
+  latitude: number | string
+  longitude: number | string
 }