소스 검색

修改合并

huangxw 2 주 전
부모
커밋
75b3f45d6b
41개의 변경된 파일776개의 추가작업 그리고 68개의 파일을 삭제
  1. 12 2
      src/assets/styles/public.scss
  2. 116 0
      src/components/ut-suspension/ut-suspension.vue
  3. 46 0
      src/components/ut-tabar/ut-tabar.vue
  4. 1 0
      src/main.ts
  5. 25 5
      src/pages.json
  6. 14 1
      src/pages/index/index.vue
  7. 199 35
      src/pages/login/login.vue
  8. 36 13
      src/pages/plant/base/index.vue
  9. 58 0
      src/pages/plant/port/index.vue
  10. 30 0
      src/pages/switch/index1.vue
  11. 30 0
      src/pages/switch/index2.vue
  12. BIN
      src/static/images/plant/QuickLogin.png
  13. BIN
      src/static/images/plant/SZYYLogo.png
  14. BIN
      src/static/images/plant/accountNumber.png
  15. 0 0
      src/static/images/plant/addBase.png
  16. 0 0
      src/static/images/plant/bottomBase.png
  17. 0 0
      src/static/images/plant/bottomBaseActive.png
  18. 0 0
      src/static/images/plant/bottomMore.png
  19. 0 0
      src/static/images/plant/bottomMoreActive.png
  20. 0 0
      src/static/images/plant/bottomPlantingBreeding.png
  21. 0 0
      src/static/images/plant/bottomPlantingBreedingActive.png
  22. 0 0
      src/static/images/plant/bottomProcessingPackaging.png
  23. 0 0
      src/static/images/plant/bottomProcessingPackagingActive.png
  24. 0 0
      src/static/images/plant/bottomWarehouse.png
  25. 0 0
      src/static/images/plant/bottomWarehouseActive.png
  26. 0 0
      src/static/images/plant/bottombg.png
  27. BIN
      src/static/images/plant/cxlmLogo.png
  28. BIN
      src/static/images/plant/loginBottomBg.png
  29. BIN
      src/static/images/plant/loginMidBg.png
  30. BIN
      src/static/images/plant/loginTopBg.png
  31. BIN
      src/static/images/plant/一键登录.png
  32. BIN
      src/static/images/plant/手机号码.png
  33. BIN
      src/static/images/plant/组培实验室.png
  34. BIN
      src/static/images/plant/药材养殖.png
  35. BIN
      src/static/images/plant/药材种植.png
  36. BIN
      src/static/images/plant/验证码.png
  37. 1 0
      src/store/index.ts
  38. 143 0
      src/store/modules/switch.ts
  39. 2 2
      src/utils/dict.ts
  40. 60 8
      src/utils/public.ts
  41. 3 2
      src/utils/request.ts

+ 12 - 2
src/assets/styles/public.scss

@@ -20,6 +20,9 @@
 .j-ed {
     justify-content: flex-end;
 }
+.j-sa {
+    justify-content: space-around;
+}
 .a-ed {
     align-items: flex-end;
 }
@@ -145,10 +148,11 @@ $colors: (
 .radius-10 {
     border-radius: 10rpx;
 }
-.home_icon{
+.home_icon {
     width: 40rpx;
     height: 40rpx;
 }
+<<<<<<< HEAD
 .startline-title {
     line-height: 1;
     padding-left: 30rpx;
@@ -156,4 +160,10 @@ $colors: (
     color: #333;
     font-weight: 600;
     border-left: 4rpx solid $u-primary;
-}
+}
+=======
+.small-icon {
+    width: 38rpx;
+    height: 38rpx;
+}
+>>>>>>> 3db11cc1713a57d781f7396310d9529d33bd6b0c

+ 116 - 0
src/components/ut-suspension/ut-suspension.vue

@@ -0,0 +1,116 @@
+<template>
+    <movable-area class="suspension-area" :style="areaStyle">
+        <movable-view
+            class="suspension-view"
+            direction="all"
+            :x="x"
+            :y="y"
+            :inertia="props.inertia"
+            :out-of-bounds="true"
+            :disabled="false"
+            :scale="false"
+            :style="{
+                width: `${props.imageWidth}px`,
+                height: `${props.imageHeight}px`,
+            }"
+            @change="onChange"
+            @click="handleClick">
+            <slot />
+        </movable-view>
+    </movable-area>
+</template>
+
+<script setup lang="ts">
+import { ref, onMounted, computed } from 'vue';
+
+// 定义props
+interface Props {
+    imageSrc?: string;
+    imageWidth?: number; // 使用px单位,不再支持rpx
+    imageHeight?: number; // 使用px单位,不再支持rpx
+    x?: number; // x坐标(距离屏幕左边的距离,px单位)
+    y?: number; // y坐标(距离屏幕顶部的距离,px单位)
+    inertia?: boolean;
+    snapThreshold?: number;
+    bgColor?: string;
+    borderRadius?: string;
+}
+
+const props = withDefaults(defineProps<Props>(), {
+    imageSrc: '/static/logo.png',
+    imageWidth: 50, // 默认宽度 50px
+    imageHeight: 50, // 默认高度 50px
+    x: 10, // 默认距离左边 10px
+    y: 200, // 默认距离顶部 200px
+    inertia: false,
+    snapThreshold: 30,
+    bgColor: 'transparent',
+    borderRadius: '0',
+});
+
+// 响应式状态
+const x = ref<number>(props.x); // movable-view的x坐标(距离左边)
+const y = ref<number>(props.y); // movable-view的y坐标(距离顶部)
+
+// 屏幕尺寸
+const screenWidth = ref<number>(0);
+const screenHeight = ref<number>(0);
+
+// movable-area 样式
+const areaStyle = computed(() => {
+    return {
+        width: `${screenWidth.value}px`,
+        height: `${screenHeight.value}px`,
+        position: 'fixed',
+        top: '0',
+        left: '0',
+        zIndex: '999',
+    };
+});
+
+// 初始化时获取屏幕尺寸
+onMounted(() => {
+    const systemInfo = uni.getSystemInfoSync();
+    screenWidth.value = systemInfo.windowWidth;
+    screenHeight.value = systemInfo.windowHeight;
+});
+// movable-view 位置变化事件
+const onChange = (e: any) => {
+    // if (e.detail) {
+    //     // 直接更新位置
+    //     x.value = e.detail.x;
+    //     y.value = e.detail.y;
+    //     console.log(x.value, y.value);
+    // 标记为正在拖动
+    // isDragging.value = true;
+    // }
+};
+
+// 触摸结束事件(拖动结束)
+const onTouchEnd = () => {
+    // 拖动结束后进行边界检查和吸附
+    // applyBoundaryAndSnap();
+    // isDragging.value = false;
+};
+
+// 点击事件
+const handleClick = () => {
+    // 触发点击事件
+    console.log('悬浮按钮被点击', { x: x.value, y: y.value });
+};
+</script>
+
+<style>
+.suspension-area {
+    /* 移除 pointer-events: none,确保可以正常接收拖动事件 */
+}
+
+.suspension-view {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    overflow: hidden;
+    background-color: v-bind('props.bgColor');
+    border-radius: v-bind('props.borderRadius');
+}
+</style>

+ 46 - 0
src/components/ut-tabar/ut-tabar.vue

@@ -0,0 +1,46 @@
+<template>
+    <view class="w-100%" style="position: fixed; bottom: 0; left: 0">
+        <view class="p-rtv" style="height: 210rpx">
+            <image class="w-100%" src="/static/images/plant/bottombg.png" mode="widthFix" style="position: absolute; bottom: 0; left: 0; z-index: -1" />
+            <view class="d-flex h-140 w-100% j-sa" style="position: absolute; bottom: 0; left: 0">
+                <view class="d-flex a-c flex1 j-sa">
+                    <view class="c-#999 f-s-24 d-flex flex-cln">
+                        <image v-if="activeTab !== 'base'" class="w-80" src="/static/images/plant/bottomBase.png" mode="widthFix" />
+                        <image v-if="activeTab === 'base'" class="w-80" src="/static/images/plant/bottomBaseActive.png" mode="widthFix" />
+                        <view class="text-center" :class="activeTab === 'base' ? 'c-primary f-w-5' : ''">基地</view>
+                    </view>
+                    <view class="c-#999 f-s-24 d-flex flex-cln">
+                        <image v-if="activeTab !== 'planting'" class="w-80" src="/static/images/plant/bottomPlantingBreeding.png" mode="widthFix" />
+                        <image v-if="activeTab === 'planting'" class="w-80" src="/static/images/plant/bottomPlantingBreedingActive.png" mode="widthFix" />
+                        <view class="text-center" :class="activeTab === 'planting' ? 'c-primary f-w-5' : ''">种养殖</view>
+                    </view>
+                </view>
+                <view class="w-126 d-flex a-c j-c p-rtv">
+                    <image v-if="activeTab !== 'warehouse'" class="w-80" src="/static/images/plant/bottomWarehouse.png" mode="widthFix" style="position: absolute; top: -40rpx" />
+                    <image v-if="activeTab === 'warehouse'" class="w-80" src="/static/images/plant/bottomWarehouseActive.png" mode="widthFix" style="position: absolute; top: -40rpx" />
+                </view>
+                <view class="d-flex a-c flex1 j-sa">
+                    <view class="c-#999 f-s-24 d-flex flex-cln">
+                        <image v-if="activeTab !== 'processing'" class="w-80" src="/static/images/plant/bottomProcessingPackaging.png" mode="widthFix" />
+                        <image v-if="activeTab === 'processing'" class="w-80" src="/static/images/plant/bottomProcessingPackagingActive.png" mode="widthFix" />
+                        <view class="text-center" :class="activeTab === 'processing' ? 'c-primary f-w-5' : ''">加工包装</view>
+                    </view>
+                    <view class="c-#999 f-s-24 d-flex flex-cln">
+                        <image v-if="activeTab !== 'more'" class="w-80" src="/static/images/plant/bottomMore.png" mode="widthFix" />
+                        <image v-if="activeTab === 'more'" class="w-80" src="/static/images/plant/bottomMoreActive.png" mode="widthFix" />
+                        <view class="text-center" :class="activeTab === 'more' ? 'c-primary f-w-5' : ''">更多</view>
+                    </view>
+                </view>
+            </view>
+        </view>
+        <view class="bg-#fff" :style="{ height: `${safeAreaBottom}px` }"></view>
+    </view>
+</template>
+
+<script setup lang="ts">
+defineProps<{
+    activeTab?: string; // 当前活跃的tab标识符:'base' | 'planting' | 'warehouse' | 'processing' | 'more'
+}>();
+const windowInfo = uni.getWindowInfo();
+const safeAreaBottom = windowInfo.safeAreaInsets.bottom;
+</script>

+ 1 - 0
src/main.ts

@@ -57,6 +57,7 @@ export function createApp() {
         whiteList: [
             '/pages/login/login', // 登录页
             '/pages/plant/index',
+            '/pages/switch/index1',
             '/tools/map-draw-area/index',
             '/plant/species/config/index',
             '/plant/base/gap-base-info/index',

+ 25 - 5
src/pages.json

@@ -23,17 +23,37 @@
                 "navigationBarTitleText": "用户登录"
             }
         },
+        //开发完成后需要删除的页面
         {
-            "path": "pages/plant/index",
+            "path": "pages/plant/base/index",
             "style": {
-                "navigationBarTitleText": "种植端"
+                "navigationBarTitleText": "种植端基地"
             }
         },
+        {
+            "path": "pages/plant/port/index",
+            "style": {
+                "navigationBarTitleText": "种植端种养殖"
+            }
+        },
+        //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
         {
             "path": "pages/production/index",
             "style": {
                 "navigationBarTitleText": "生产端"
             }
+        },
+        {
+            "path": "pages/switch/index1",
+            "style": {
+                "navigationBarTitleText": "switch页面1"
+            }
+        },
+        {
+            "path": "pages/switch/index2",
+            "style": {
+                "navigationBarTitleText": "switch页面2"
+            }
         }
     ],
     "subPackages": [
@@ -102,7 +122,7 @@
                         "navigationBarTitleText": "地图绘制面积图",
                         "disableScroll": true,
                         "enablePullDownRefresh": false,
-                         "navigationStyle": "default"
+                        "navigationStyle": "default"
                     }
                 },
                 {
@@ -138,10 +158,10 @@
                 "pagePath": "pages/index/index"
             },
             {
-                "pagePath": "pages/plant/index"
+                "pagePath": "pages/switch/index1"
             },
             {
-                "pagePath": "pages/production/index"
+                "pagePath": "pages/switch/index2"
             }
         ]
     },

+ 14 - 1
src/pages/index/index.vue

@@ -24,7 +24,9 @@
             </view>
             <!-- <view class="mb-80">{{ selectDictLabel(class_type, 1) }}</view> -->
             <view class="bg-blue-500 c-primary p-4 rounded">Hello UnoCSS!</view>
-            <up-button @click="$u.route({ type: 'switchTab', url: '/pages/plant/index' })" text="plant" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
+            <up-button @click="goToSwitchWithParams('/pages/switch/index1', { type: 'plant', title: '种植端基地', path: '/pages/plant/base/index' })" text="index1" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
+            <up-button @click="goToSwitchWithParams('/pages/switch/index2', { type: 'port', title: '种植端种养殖', path: '/pages/plant/port/index' })" text="plantport" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
+            <up-button @click="$u.route({ type: 'navigateTo', url: '/pages/plant/base/index' })" text="plant" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
             <up-button @click="$u.route({ type: 'switchTab', url: '/pages/production/index' })" text="production" color="linear-gradient(to right, rgb(66, 83, 216), rgb(213, 51, 186))" />
         </view>
     </z-paging>
@@ -33,7 +35,9 @@
 import { computed } from 'vue';
 import { useAuthStore } from '@/store/modules/auth';
 import { useUserStore } from '@/store/modules/user';
+import { useSwitchStore } from '@/store';
 import { checkAuth, logoutAndRedirect } from '@/utils/routeGuard';
+import { goToSwitchPage } from '@/utils/public';
 // const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 // const { class_type } = toRefs<any>(proxy?.useDict('class_type'));
 const title = ref('Hello');
@@ -42,6 +46,7 @@ const paging = ref<any>(null);
 // Store
 const authStore = useAuthStore();
 const userStore = useUserStore();
+const switchStore = useSwitchStore();
 
 // 计算属性
 const userInfo = computed(() => userStore.userInfo);
@@ -85,6 +90,14 @@ const onRefresh = () => {
     }
 };
 
+/**
+ * 跳转到switch页面并传递参数
+ */
+const goToSwitchWithParams = (pages: string, data: unknown): void => {
+    // 使用公共函数跳转到switch页面并传递参数
+    goToSwitchPage(pages, data);
+};
+
 /**
  * 前往登录页
  */

+ 199 - 35
src/pages/login/login.vue

@@ -1,28 +1,18 @@
 <template>
-    <z-paging ref="paging" bgColor="rgba(0,0,0,0)">
+    <z-paging ref="paging" bgColor="#fff">
         <template #top>
-            <up-navbar :fixed="false" title="登录注册">
+            <up-navbar :fixed="true" title="登录注册" bgColor="transparent">
                 <template #left>
-                    <!-- <image @click="$u.route({ type: 'switchTab', url: '/pages/list/index' })" class="home_icon" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/common/home.png" mode="widthFix" /> -->
                     <up-icon @click="homeBack()" name="arrow-left" color="#333" size="40rpx"></up-icon>
                 </template>
             </up-navbar>
         </template>
+        <view class="h-620 w-100%" style="background: url('/static/images/plant/loginTopBg.png'); background-size: auto 100%; background-repeat: no-repeat; position: absolute; top: 0; left: 0; z-index: -1"> </view>
         <view class="login-centent">
-            <view class="login-logo-wrap p-rtv d-flex j-c a-c">
-                <image class="bg-circle" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/login/bg_circle.png" mode="aspectFit" />
-                <image class="login-logo" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/login/logo.png" mode="aspectFit" />
-            </view>
-            <view class="login-form pl-20 pd-25">
-                <up-button type="primary" shape="circle" @click="$u.route({ url: '/pages/login/phone/phone', params: { redirect: encodeURIComponent(redirect) } })">
-                    <view class="d-flex a-c j-c">
-                        <!-- <image class="base-icon mr-20"
-                            src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/login-phone/phone.png"
-                            mode="widthFix" /> -->
-                        手机号验证码登录
-                    </view>
-                </up-button>
-                <view class="pd-20"></view>
+            <view class="login-logo-wrap p-rtv d-flex j-c a-c b-radius"></view>
+            <view v-if="!isShowPhoneLogin" class="login-form pl-20 pd-25 b-radius p-rtv">
+                <image class="w-100%" src="/static/images/plant/loginMidBg.png" mode="widthFix" style="position: absolute; top: 0; left: 0" />
+                <view class="pd-40"></view>
                 <template v-if="isBindPhone">
                     <up-button class="mb-40" @click="handleLogin" color="#28A94B" type="primary" shape="circle">
                         <view class="d-flex a-c j-c">
@@ -44,25 +34,93 @@
                     <view class="d-flex a-c f-s-24">
                         <text class="c-999">我已阅读并同意</text>
                         <text class="c-primary" @click="$u.route({ url: '/views/tool/agreement/agreement' })">《用户协议》</text>
-                        <text class="c-666"></text>
+                        <text class="c-666"></text>
                         <text class="c-primary" @click="$u.route({ url: '/views/tool/privacy/privacy' })">《隐私政策》</text>
                     </view>
                 </view>
                 <official-account></official-account>
             </view>
+            <view v-if="isShowPhoneLogin" class="login-form pl-20 pd-25 b-radius">
+                <up-form :model="forms" :rules="rules" ref="upFormRef" labelWidth="auto" labelPosition="top">
+                    <up-form-item prop="phonenumber">
+                        <up-input v-model="forms.phonenumber" fontSize="28rpx" :prefixIconStyle="prefixIconStyle" placeholderClass="placeholder" :customStyle="customStyle" maxlength="11" placeholder="请输入您的手机号" border="none" clearable shape="circle">
+                            <template #prefix>
+                                <view class="d-flex a-c mr-20">
+                                    <image class="small-icon" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/login-phone/tel_icon.png" mode="widthFix" />
+                                </view>
+                            </template>
+                        </up-input>
+                    </up-form-item>
+                    <up-form-item prop="smsCode">
+                        <up-input v-model="forms.smsCode" fontSize="28rpx" :prefixIconStyle="prefixIconStyle" placeholderClass="placeholder" :customStyle="customStyle" placeholder="请输入验证码" border="none" clearable shape="circle">
+                            <template #prefix>
+                                <view class="d-flex a-c mr-20">
+                                    <image class="small-icon" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/login-phone/sms_code_icon.png" mode="widthFix" />
+                                </view>
+                            </template>
+                            <template #suffix>
+                                <up-button :disabled="disabled" @click="sendCode" style="color: #2a6d52" type="primary" color="#F6F6F6">
+                                    <up-count-down ref="countDown" @change="onChange" :autoStart="false" :time="60 * 1000" format="(ss)" millisecond @finish="finish">
+                                        <text>{{ codeText }}</text>
+                                    </up-count-down>
+                                </up-button>
+                            </template>
+                        </up-input>
+                    </up-form-item>
+                    <view class="pd-40"></view>
+                    <up-button type="primary" @click="save" shape="circle">登录</up-button>
+                    <up-form-item prop="aloneChecked">
+                        <view class="d-flex a-c pd-10" @click="clickAgrees">
+                            <up-checkbox activeColor="#2A6D52" size="32rpx" name="agree" usedAlone v-model:checked="forms.aloneChecked"></up-checkbox>
+                            <view class="d-flex a-c f-s-24">
+                                <text class="c-999">我已阅读并同意</text>
+                                <text class="c-primary" @click="$u.route({ url: '/views/tool/agreement/agreement' })">《用户协议》</text>
+                                <text class="c-666">、</text>
+                                <text class="c-primary" @click="$u.route({ url: '/views/tool/privacy/privacy' })">《隐私政策》</text>
+                            </view>
+                        </view>
+                    </up-form-item>
+                </up-form>
+            </view>
+            <up-divider text="更多登录方式" class="pd-30"></up-divider>
+            <view class="d-flex j-sa pl-20 pr-20">
+                <view v-if="!isShowPhoneLogin" class="d-flex flex-cln j-c a-c" @click="isShowPhoneLogin = true">
+                    <view class="bc-#f2f2f2 d-flex j-c a-c">
+                        <image class="w-95" src="/static/images/plant/accountNumber.png" mode="widthFix" />
+                    </view>
+                    <view class="c-#ccc f-s-24 pt-10">账号密码</view>
+                </view>
+                <view v-if="isShowPhoneLogin" class="d-flex flex-cln j-c a-c" @click="isShowPhoneLogin = false">
+                    <view class="bc-#f2f2f2 d-flex j-c a-c">
+                        <image class="w-95" src="/static/images/plant/QuickLogin.png" mode="widthFix" />
+                    </view>
+                    <view class="c-#ccc f-s-24 pt-10">一键登录</view>
+                </view>
+                <view class="d-flex flex-cln j-c a-c">
+                    <view class="bc-#f2f2f2 d-flex j-c a-c">
+                        <image class="w-95" src="/static/images/plant/SZYYLogo.png" mode="widthFix" />
+                    </view>
+                    <view class="c-#ccc f-s-24 pt-10">数字云药</view>
+                </view>
+                <view class="d-flex flex-cln j-c a-c">
+                    <view class="bc-#f2f2f2 d-flex j-c a-c">
+                        <image class="w-95" src="/static/images/plant/cxlmLogo.png" mode="widthFix" />
+                    </view>
+                    <view class="c-#ccc f-s-24 pt-10">中药材创新联盟</view>
+                </view>
+            </view>
         </view>
-        <image class="login-bttom-bg" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images/login/bg_bottom.png" mode="widthFix" />
+        <image class="login-bttom-bg" src="/static/images/plant/loginBottomBg.png" mode="widthFix" />
     </z-paging>
 </template>
 
 <script setup>
 import { ref, getCurrentInstance } from 'vue';
-import { useInfoStore } from '@/store';
+import { useInfoStore, useSwitchStore } from '@/store';
 import config from '@/config';
-import { useRouter } from 'vue-router';
-import { getCurrentPage } from '@/utils/public';
+import { debounce } from 'uview-plus';
 import { onLoad } from '@dcloudio/uni-app';
-import { updateUserInfo } from '@/utils/common';
+import { goToSwitchPage } from '@/utils/public';
 import { recursiveDecodeURIComponent } from '@/utils/ruoyi';
 import { useClientRequest } from '@/utils/request';
 const pages = ref(getCurrentPages());
@@ -71,6 +129,8 @@ const paging = ref(null);
 const redirect = ref('');
 // 判断是否绑定手机号
 const isBindPhone = ref(0);
+// 判断是否展示手机号登录
+const isShowPhoneLogin = ref(false);
 const form = ref({
     aloneChecked: false,
     phoneCode: '',
@@ -137,7 +197,15 @@ const weixinLogin = async () => {
             title: '登录中...',
             mask: true,
         });
-        await infoStore.wxLogin(form.value);
+        //判断是什么类型的登录
+        if (isShowPhoneLogin) {
+            console.log(form.value, 'form.value');
+
+            await infoStore.wxLogin(form.value);
+        } else {
+            await infoStore.wxLogin(forms.value);
+        }
+
         // 调用获取用户信息接口
         infoStore.getUserInfo();
         console.log('调用获取用户信息接口');
@@ -146,14 +214,15 @@ const weixinLogin = async () => {
         uni.hideLoading();
         // 重定向或跳转首页
         // 获取redirect参数
-        const redirectUrl = redirect.value || '/pages/plant/index';
+        const redirectUrl = redirect.value || '/pages/switch/index1';
         // switchTab 页面
-        const switchTabs = ['/pages/plant/index'];
+        const switchTabs = ['/pages/switch/index1'];
         if (switchTabs.includes(redirectUrl)) {
-            uni.$u.route({
-                type: 'switchTab',
-                url: redirectUrl,
-            });
+            //从缓存中获取参数,然后跳转
+            const switchStore = useSwitchStore();
+            const params = switchStore.getAndClearParamsForPage(redirectUrl);
+            // 使用公共函数跳转到switch页面并传递参数
+            goToSwitchPage(redirectUrl, params);
             return;
         }
         uni.$u.route({
@@ -161,8 +230,9 @@ const weixinLogin = async () => {
             url: redirectUrl,
         });
     } catch (error) {
+        console.log(error);
         uni.showToast({
-            title: error.message || '登录失败,请稍后重试',
+            title: error.msg || '登录失败,请稍后重试',
             icon: 'none',
         });
     }
@@ -209,10 +279,101 @@ const homeBack = () => {
         }
     }
 };
+//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+const codeText = ref('获取验证码');
+const countDown = ref(null);
+const upFormRef = ref(null);
+const timeData = ref({});
+const disabled = ref(false);
+const finish = (e) => {
+    disabled.value = false;
+    codeText.value = '重新发送';
+};
+const forms = ref({
+    phonenumber: '',
+    smsCode: '',
+    clientId: config.clientId,
+    grantType: 'app_sms',
+    aloneChecked: false,
+    mverify: false,
+});
+const rules = reactive({
+    phonenumber: [
+        { required: true, message: '请输入手机号', trigger: 'blur' },
+        { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' },
+    ],
+    smsCode: [
+        { required: true, message: '请输入验证码', trigger: 'blur' },
+        { pattern: /^[0-9]*$/, message: '验证码格式不正确', trigger: 'blur' },
+    ],
+});
+const onChange = (e) => {
+    timeData.value = e;
+    if (+e.seconds) {
+        codeText.value = `重新发送(${e.seconds + 1})`;
+    }
+};
+const customStyle = reactive({
+    padding: '0 50rpx',
+    backgroundColor: '#F6F6F6',
+    height: '98rpx',
+});
+const prefixIconStyle = reactive({
+    // flex上下居中
+    display: 'flex',
+    alignItems: 'center',
+    marginRight: '20rpx',
+});
+const clickAgrees = () => {
+    forms.value.aloneChecked = !forms.value.aloneChecked;
+};
+const sendCode = () => {
+    debounce(async () => {
+        upFormRef.value?.validateField('phonenumber', (errorsRes) => {
+            if (!errorsRes.length) {
+                getCode();
+            }
+        });
+    }, 500);
+};
+// 获取验证码
+const getCode = async () => {
+    const res = await useClientRequest.get('/app/auth/sendVercode', { phone: forms.value.phonenumber }, false);
+    if (res.code === 200) {
+        uni.showToast({
+            title: '验证码发送成功',
+            icon: 'none',
+        });
+        countDown.value?.start();
+        disabled.value = true;
+    }
+};
+const save = () => {
+    debounce(async () => {
+        upFormRef.value
+            ?.validate()
+            .then((res) => {
+                if (res) {
+                    // 判断是否勾选隐私协议
+                    if (!forms.value.aloneChecked) {
+                        uni.showToast({
+                            title: '请阅读并同意用户协议和隐私政策',
+                            icon: 'none',
+                        });
+                        return;
+                    }
+                    weixinLogin();
+                }
+            })
+            .catch((error) => {});
+    }, 500);
+};
+//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
 onLoad((options) => {
     // 获取redirect参数
     const redirectStr = options.redirect ? recursiveDecodeURIComponent(options.redirect) : '';
-    console.log(redirectStr);
+    console.log(redirectStr, 'redirectStr');
     redirect.value = redirectStr;
     // 判断用户是否绑定手机号
     hasBindPhone();
@@ -222,7 +383,7 @@ onLoad((options) => {
 <style lang="scss" scoped>
 .login-logo-wrap {
     width: 750rpx;
-    height: 750rpx;
+    height: 550rpx;
     margin: auto;
     box-sizing: border-box;
 }
@@ -237,7 +398,7 @@ onLoad((options) => {
     width: 770rpx;
     height: 770rpx;
     // 360度旋转
-    animation: rotate 10s linear infinite;
+    // animation: rotate 10s linear infinite;
 }
 
 @keyframes rotate {
@@ -254,7 +415,10 @@ onLoad((options) => {
     width: 493rpx;
     height: 284rpx;
 }
-
+.login-form {
+    // background: linear-gradient(to bottom, #d5f7d6 0%, #daf7da 5px, #def7e0 15px, #fff 20px, #fff 100%);
+    background-color: #fff;
+}
 .login-bttom-bg {
     position: absolute;
     left: 0;

+ 36 - 13
src/pages/plant/index.vue → src/pages/plant/base/index.vue

@@ -1,5 +1,5 @@
 <template>
-    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" @scroll="onPageScroll">
+    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" @scroll="onPageScroll" safe-area-inset-bottom>
         <template #top>
             <up-navbar :fixed="true" :bgColor="navBarBgColor">
                 <template #left>
@@ -117,12 +117,19 @@
             </view>
         </template>
         <template #empty>
-            <ut-empty class="mg-at" color="#ccc" size="28rpx" image="/static/images/plant/noEmptyBase.png">尚未添加绘制种养殖基地信息~</ut-empty>
-            <view class="b-radius c-#fff f-s-36 bg-#37A954 h-78 w-382 d-flex a-c j-c mg-at" @click="showDeleteDialog = true">
-                <img class="w-38 h-36 mr-10" src="/static/images/plant/chooseGAP.png" alt="" mode="widthFix" />
-                <text>去添加基地</text>
+            <view class="" style="margin-top: -200rpx">
+                <ut-empty class="mg-at" color="#ccc" size="28rpx" image="/static/images/plant/noEmptyBase.png">尚未添加绘制种养殖基地信息~</ut-empty>
+                <view class="b-radius c-#fff f-s-36 bg-#37A954 h-78 w-382 d-flex a-c j-c mg-at" @click="showDeleteDialog = true">
+                    <img class="w-38 h-36 mr-10" src="/static/images/plant/chooseGAP.png" alt="" mode="widthFix" />
+                    <text>去添加基地</text>
+                </view>
             </view>
         </template>
+        <view class="h-210" v-if="list?.length"></view>
+        <view v-if="list?.length" :style="{ height: `${safeAreaBottom}px` }"></view>
+        <template #bottom>
+            <ut-tabar activeTab="base"></ut-tabar>
+        </template>
     </z-paging>
     <ut-confirm-dialog v-model:show="showDeleteDialog" width="80vw" title="请选择要添加到基地类型" :confirmText="'确认选择'" :cancelText="'取消'" @confirm="handlechoseConfirm" @cancel="handleDeleteCancel">
         <view class="" v-for="item in pt_base_type" :key="item?.value">
@@ -140,6 +147,9 @@
             </view>
         </view>
     </ut-confirm-dialog>
+    <ut-suspension v-if="sus?.left" :imageWidth="60" :imageHeight="60" :x="sus?.left" :y="sus?.bottom" :inertia="false" :snap-threshold="40">
+        <image src="/static/images/plant/addBase.png" mode="widthFix" class="w-120 h-120" @click="showDeleteDialog = true"></image>
+    </ut-suspension>
 </template>
 <script setup lang="ts">
 import { useClientRequest } from '@/utils/request';
@@ -154,6 +164,8 @@ const avatar = computed(() => infoStore.userInfo?.avatar || '');
 const name = computed(() => infoStore.userInfo?.name || '');
 const phone = computed(() => infoStore.userInfo?.phone || '');
 const currentCpyName = computed(() => infoStore.userInfo?.currentCpyName || '');
+const windowInfo = uni.getWindowInfo();
+const safeAreaBottom = windowInfo.safeAreaInsets.bottom;
 // 证书文件类型
 interface CertFile {
     fileName: string;
@@ -233,6 +245,13 @@ const form = ref({ queryType: '', keyword: '' });
 const speciesArray = ref([]);
 const navBarBgColor = ref('transparent');
 const stickyTop = ref(0);
+const systemInfo = uni.getSystemInfoSync();
+const sus = ref({
+    left: 0,
+    bottom: 0,
+});
+sus.value.left = systemInfo.windowWidth - 10;
+sus.value.bottom = systemInfo.windowHeight - 200;
 const changeSeach = () => {
     paging.value.reload();
 };
@@ -254,14 +273,17 @@ const query = async (pageNum: number, pageSize: number) => {
         ...form.value,
     };
     const res = await useClientRequest.get('/plt-api/app/base/pageList', params);
-    const { rows } = res;
-    paging.value.complete(rows);
+    console.log(res, 'res');
+    if (res) {
+        const { rows } = res;
+        paging.value.complete(rows);
+    }
 };
 // 查询企业的种植品种
 const getSpecies = async () => {
     const res = await useClientRequest.get('/plt-api/app/cpyVariety/list');
-    if (res.code === 200) {
-        speciesArray.value = res.data.map((item: any) => item.medicineName);
+    if (res?.code === 200) {
+        speciesArray.value = res.data?.map((item: any) => item.medicineName);
     }
 };
 const showDeleteDialog = ref(false);
@@ -284,15 +306,16 @@ onMounted(() => {
     querys
         .select('#topup-navbar')
         .boundingClientRect((data: any) => {
+            console.log(data);
+
             stickyTop.value = data.top + data.height;
         })
         .exec();
     getSpecies();
 });
-
-// setTimeout(() => {
-//     useClientRequest.get('/time');
-// }, 2000);
+onShow(() => {
+    getSpecies();
+});
 </script>
 <style lang="scss" scoped>
 // @import '@/assets/styles/theme.scss';

+ 58 - 0
src/pages/plant/port/index.vue

@@ -0,0 +1,58 @@
+<template>
+    <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" safe-area-inset-bottom>
+        <template #top>
+            <up-navbar title="种养殖任务" :fixed="false">
+                <template #left><view class=""></view></template>
+            </up-navbar>
+        </template>
+        <view class="b-radius pt-0 bg-#f7f7f7">
+            <up-sticky :offset-top="10">
+                <view class="d-flex a-c pd-16 bg-#f7f7f7">
+                    <view class="min-w-170 flex1">
+                        <ut-action-sheet v-model="form.queryType" :tabs="[{ label: '全部', value: '' }]" @change="onRefresh" title="选择原料类型">
+                            <view class="d-flex search-select-item a-c">
+                                <view class="flex1 ov-hd f-s-28 c-333 text-center f-w-5 w-s-no">{{ '全部' }} </view>
+                                <up-icon size="24rpx" color="#333" name="arrow-down-fill" class="mr-5"></up-icon>
+                            </view>
+                        </ut-action-sheet>
+                    </view>
+                    <view class="h-86 pl-20 w-100%">
+                        <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" margin="0" :border="false" placeholder="搜基地名称、编号、地址、负责人" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
+                    </view>
+                </view>
+            </up-sticky>
+            <view class="pd-16"></view>
+        </view>
+        <view class="h-210" v-if="list?.length"></view>
+        <view v-if="list?.length" :style="{ height: `${safeAreaBottom}px` }"></view>
+        <template #bottom>
+            <ut-tabar activeTab="base"></ut-tabar>
+        </template>
+    </z-paging>
+</template>
+<script setup lang="ts">
+const list = ref<unknown[]>([]);
+const form = ref({ queryType: '', keyword: '' });
+const paging = ref();
+const windowInfo = uni.getWindowInfo();
+const safeAreaBottom = windowInfo.safeAreaInsets.bottom;
+const changeSeach = () => {
+    paging.value.reload();
+};
+const onRefresh = () => {
+    paging.value.reload();
+};
+</script>
+<style lang="scss" scoped>
+// @import '@/assets/styles/theme.scss';
+.search-select-item {
+    height: 86rpx;
+    background-color: #fff;
+    border-radius: 10rpx;
+    box-sizing: border-box;
+    padding-left: 16rpx;
+    padding-right: 16rpx;
+    padding-top: 14rpx;
+    padding-bottom: 14rpx;
+}
+</style>

+ 30 - 0
src/pages/switch/index1.vue

@@ -0,0 +1,30 @@
+<template>
+    <Plant1 v-if="switchType == 'plant'" />
+</template>
+<script setup lang="ts">
+import { onLoad } from '@dcloudio/uni-app';
+import { getSwitchPageParams } from '@/utils/public';
+import Plant1 from '../plant/base/index.vue';
+const switchType = ref('');
+onLoad(() => {
+    // 使用公共函数获取参数
+    const params = getSwitchPageParams();
+    if (params) {
+        console.log('从store获取的参数:', params);
+        // 示例:如果params包含用户信息
+        if (params.type) {
+            switchType.value = params.type;
+        }
+
+        // 示例:如果params包含跳转信息
+        if (params.title) {
+            console.log('页面标题:', params.title);
+        }
+        if (params.path) {
+            console.log('目标路径:', params.path);
+        }
+    } else {
+        console.log('未找到参数或参数已过期');
+    }
+});
+</script>

+ 30 - 0
src/pages/switch/index2.vue

@@ -0,0 +1,30 @@
+<template>
+    <Port1 v-if="switchType == 'port'" />
+</template>
+<script setup lang="ts">
+import { onLoad } from '@dcloudio/uni-app';
+import { getSwitchPageParams } from '@/utils/public';
+import Port1 from '../plant/port/index.vue';
+const switchType = ref('');
+onLoad(() => {
+    // 使用公共函数获取参数
+    const params = getSwitchPageParams();
+    if (params) {
+        console.log('从store获取的参数:', params);
+        // 示例:如果params包含用户信息
+        if (params.type) {
+            switchType.value = params.type;
+        }
+
+        // 示例:如果params包含跳转信息
+        if (params.title) {
+            console.log('页面标题:', params.title);
+        }
+        if (params.path) {
+            console.log('目标路径:', params.path);
+        }
+    } else {
+        console.log('未找到参数或参数已过期');
+    }
+});
+</script>

BIN
src/static/images/plant/QuickLogin.png


BIN
src/static/images/plant/SZYYLogo.png


BIN
src/static/images/plant/accountNumber.png


+ 0 - 0
src/static/images/plant/添加基地.png → src/static/images/plant/addBase.png


+ 0 - 0
src/static/images/plant/底部-基地.png → src/static/images/plant/bottomBase.png


+ 0 - 0
src/static/images/plant/底部-基地-选中.png → src/static/images/plant/bottomBaseActive.png


+ 0 - 0
src/static/images/plant/底部-更多.png → src/static/images/plant/bottomMore.png


+ 0 - 0
src/static/images/plant/底部-更多-选中.png → src/static/images/plant/bottomMoreActive.png


+ 0 - 0
src/static/images/plant/底部-种养殖.png → src/static/images/plant/bottomPlantingBreeding.png


+ 0 - 0
src/static/images/plant/底部-种养殖-选中.png → src/static/images/plant/bottomPlantingBreedingActive.png


+ 0 - 0
src/static/images/plant/底部-加工包装.png → src/static/images/plant/bottomProcessingPackaging.png


+ 0 - 0
src/static/images/plant/底部-加工包装-选中.png → src/static/images/plant/bottomProcessingPackagingActive.png


+ 0 - 0
src/static/images/plant/底部-仓储.png → src/static/images/plant/bottomWarehouse.png


+ 0 - 0
src/static/images/plant/底部-仓储-选中.png → src/static/images/plant/bottomWarehouseActive.png


+ 0 - 0
src/static/images/plant/底部bg.png → src/static/images/plant/bottombg.png


BIN
src/static/images/plant/cxlmLogo.png


BIN
src/static/images/plant/loginBottomBg.png


BIN
src/static/images/plant/loginMidBg.png


BIN
src/static/images/plant/loginTopBg.png


BIN
src/static/images/plant/一键登录.png


BIN
src/static/images/plant/手机号码.png


BIN
src/static/images/plant/组培实验室.png


BIN
src/static/images/plant/药材养殖.png


BIN
src/static/images/plant/药材种植.png


BIN
src/static/images/plant/验证码.png


+ 1 - 0
src/store/index.ts

@@ -10,3 +10,4 @@ export { useDictStore } from './modules/dict';
 export { useUserStore, type UserInfo as UserInfoType, type UserProfile } from './modules/user';
 export { useAuthStore, type LoginForm, type LoginResponse } from './modules/auth';
 export { useInfoStore } from './modules/info';
+export { useSwitchStore, type SwitchPageParams } from './modules/switch';

+ 143 - 0
src/store/modules/switch.ts

@@ -0,0 +1,143 @@
+import { defineStore } from 'pinia';
+import { ref } from 'vue';
+import type { StorageLike } from 'pinia-plugin-persistedstate';
+
+// 为 UniApp 创建适配的 storage(与 store/index.ts 保持一致)
+const uniStorage: StorageLike = {
+    getItem: (key: string): string | null => {
+        try {
+            return uni.getStorageSync(key);
+        } catch (error) {
+            console.error('读取存储失败:', error);
+            return null;
+        }
+    },
+    setItem: (key: string, value: string): void => {
+        try {
+            uni.setStorageSync(key, value);
+        } catch (error) {
+            console.error('写入存储失败:', error);
+        }
+    },
+};
+
+// 判断当前是测试版还是正式版
+const accountInfo = uni.getAccountInfoSync();
+const prefixMap = {
+    release: 'prod_', // production的缩写
+    trial: 'beta_', // beta测试版
+    develop: 'dev_', // development的缩写
+};
+
+const SWITCH_STORE_KEY = `${prefixMap[accountInfo?.miniProgram?.envVersion] || 'dev_'}switch_store`;
+
+/**
+ * Switch页面跳转参数存储接口
+ */
+export interface SwitchPageParams {
+    [key: string]: {
+        data: any; // 存储的参数数据
+        timestamp: number; // 存储时间戳
+        expire?: number; // 过期时间(毫秒),可选
+    };
+}
+
+/**
+ * Switch页面跳转参数存储Store
+ * 用于在小程序switch页面跳转时传递参数
+ * 简化版:只保留基于页面路径的方法,获取数据后自动清除
+ */
+export const useSwitchStore = defineStore(
+    'switch',
+    () => {
+        // 存储所有switch页面跳转参数
+        const switchParams = ref<SwitchPageParams>({});
+
+        /**
+         * 为指定页面路径设置参数
+         * @param pagePath 目标页面路径(如:'/pages/switch/index1')
+         * @param data 要存储的参数数据
+         * @param expire 过期时间(毫秒),默认1分钟
+         */
+        const setParamsForPage = (pagePath: string, data: any, expire: number = 1 * 60 * 1000): void => {
+            const params = {
+                data,
+                timestamp: Date.now(),
+                expire,
+            };
+
+            // 使用页面路径作为键存储
+            switchParams.value[pagePath] = params;
+        };
+
+        /**
+         * 获取指定页面路径的参数
+         * @param pagePath 目标页面路径(如:'/pages/switch/index1')
+         * @returns 存储的参数数据,如果不存在或已过期则返回null
+         */
+        const getAndClearParamsForPage = (pagePath: string): any => {
+            // 从内存中获取
+            const params = switchParams.value[pagePath];
+
+            // 检查参数是否存在
+            if (!params) {
+                return null;
+            }
+
+            // 检查是否过期
+            const { data, timestamp, expire } = params;
+            // if (expire && Date.now() - timestamp > expire) {
+            //     // 清理过期数据
+            //     delete switchParams.value[pagePath];
+            //     return null;
+            // }
+
+            // // 获取数据后清理
+            // delete switchParams.value[pagePath];
+
+            return data;
+        };
+
+        /**
+         * 清除指定页面路径的参数
+         * @param pagePath 目标页面路径(如:'/pages/switch/index1')
+         */
+        const clearParamsForPage = (pagePath: string): void => {
+            // 从内存中删除
+            delete switchParams.value[pagePath];
+        };
+
+        /**
+         * 清理所有过期的switch页面跳转参数
+         */
+        const cleanupExpiredParams = (): void => {
+            const now = Date.now();
+
+            // 清理内存中的过期参数
+            Object.keys(switchParams.value).forEach((key) => {
+                const params = switchParams.value[key];
+                if (params.expire && now - params.timestamp > params.expire) {
+                    delete switchParams.value[key];
+                }
+            });
+        };
+
+        return {
+            // 状态
+            switchParams,
+
+            // 方法
+            setParamsForPage,
+            getAndClearParamsForPage,
+            clearParamsForPage,
+            cleanupExpiredParams,
+        };
+    },
+    {
+        // 启用持久化
+        persist: {
+            key: SWITCH_STORE_KEY,
+            storage: uniStorage,
+        },
+    }
+);

+ 2 - 2
src/utils/dict.ts

@@ -15,8 +15,8 @@ export const useDict = (...args: string[]): { [key: string]: DictDataOption[] }
             if (dicts) {
                 res.value[dictType] = dicts;
             } else {
-                const resp: any = await useClientRequest.get(`/system/dict/data/type/${dictType}`);
-                res.value[dictType] = resp.data.map((p): DictDataOption => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass }));
+                const resp: any = await useClientRequest.get(`/system/dict/data/type/${dictType}`, null, false);
+                res.value[dictType] = resp?.data?.map((p): DictDataOption => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass }));
                 useDictStore().setDict(dictType, res.value[dictType]);
             }
         });

+ 60 - 8
src/utils/public.ts

@@ -1,3 +1,5 @@
+import { useSwitchStore } from '@/store';
+
 // 全局uni对象
 export function debounce<T extends (...args: any[]) => any>(fn: T, delay: number = 500): (...args: Parameters<T>) => void {
     let timer: number | null = null;
@@ -39,13 +41,13 @@ export function copyText(text: string): void {
             uni.showToast({
                 title: '复制成功',
                 icon: 'success',
-                duration: 2000
+                duration: 2000,
             });
         },
         fail: function () {
             console.log('复制失败');
             // 可以添加错误处理或用户友好的提示
-        }
+        },
     });
 }
 
@@ -55,8 +57,8 @@ export function goLogin(): void {
         type: 'reLaunch',
         url: '/pages/login/login',
         params: {
-            redirect: getCurrentPage()?.route
-        }
+            redirect: getCurrentPage()?.route,
+        },
     });
 }
 
@@ -82,7 +84,7 @@ export const handleContact = (): void => {
                 },
                 fail: (err: any) => {
                     console.error('打开客服会话失败', err);
-                }
+                },
             });
         } catch (error) {
             console.error('客服功能不可用', error);
@@ -95,7 +97,7 @@ export const makePhoneCall = (phoneNumber: string): void => {
     if (!phoneNumber) {
         uni.showToast({
             title: '电话号码不能为空',
-            icon: 'none'
+            icon: 'none',
         });
         return;
     }
@@ -106,13 +108,63 @@ export const makePhoneCall = (phoneNumber: string): void => {
         },
         fail: (err) => {
             console.error('拨打电话失败', err);
-        }
+        },
     });
 };
 
+// Switch页面跳转选项接口
+export interface SwitchPageOptions {
+    expire?: number; // 过期时间(毫秒),默认5分钟
+}
+
+/**
+ * 跳转到switch页面并传递参数(只能使用switchTab跳转)
+ * @param pagePath 目标页面路径(如:'/pages/switch/index1')
+ * @param data 要传递的参数数据
+ * @param options 跳转选项
+ */
+export function goToSwitchPage(pagePath: string, data?: any, options: SwitchPageOptions = {}): void {
+    const switchStore = useSwitchStore();
+    const { expire = 5 * 60 * 1000 } = options;
+
+    // 设置参数
+    if (data !== undefined) {
+        switchStore.setParamsForPage(pagePath, data, expire);
+        console.log(`已为页面 ${pagePath} 设置参数`);
+    }
+
+    // 执行跳转(只能使用switchTab)
+    uni.switchTab({ url: pagePath });
+}
+
+/**
+ * 获取当前页面的switch跳转参数
+ * @returns 存储的参数数据,如果不存在或已过期则返回null
+ */
+export function getSwitchPageParams(): any {
+    const switchStore = useSwitchStore();
+
+    // 获取当前页面路径
+    const pages = getCurrentPages();
+    if (!pages || pages.length === 0) {
+        console.warn('无法获取当前页面路径');
+        return null;
+    }
+
+    const currentPage = pages[pages.length - 1];
+    const pagePath = `/${currentPage.route}`;
+
+    // 获取参数
+    const params = switchStore.getAndClearParamsForPage(pagePath);
+
+    // 清理过期参数
+    switchStore.cleanupExpiredParams();
+
+    return params;
+}
 // 生成一个随机id并且唯一
 export function generateUniqueId(): string {
     const timestamp = Date.now().toString(36); // 将当前时间戳转换为36进制字符串
     const randomNum = Math.floor(Math.random() * 1e8).toString(36); // 生成一个随机数并转换为36进制字符串
     return `${timestamp}-${randomNum}`; // 拼接时间戳和随机数,形成唯一ID
-}
+}

+ 3 - 2
src/utils/request.ts

@@ -25,12 +25,13 @@ export const request = ({ url, method = 'GET', data = {}, isToken = true, header
         uni.hideLoading();
         useInfoStore().removeToken();
         let fullPath = recursiveDecodeURIComponent(getCurrentPage()?.$page?.fullPath);
-        const isLoginPage = recursiveDecodeURIComponent(fullPath).indexOf('/pages/login/login') !== -1;
+        const isLoginPage = recursiveDecodeURIComponent(fullPath)?.indexOf('/pages/login/login') !== -1;
         if (isLoginPage) {
             return;
         }
         const fulllpathParams = fullPath.split('?');
         const fullpathstr = fulllpathParams.length > 1 ? `${fulllpathParams[0]}?${fulllpathParams[fulllpathParams.length - 1]}` : fulllpathParams[0];
+        console.log(isToken, '?????', url, fullpathstr);
         // 获取当前页面路径
         uni.$u.route({
             type: 'redirect',
@@ -95,7 +96,7 @@ export const request = ({ url, method = 'GET', data = {}, isToken = true, header
                             icon: 'none',
                         });
                     }
-                    return reject('500');
+                    return reject(data);
                 } else if (code !== 200) {
                     uni.hideLoading();
                     uni.showToast({