Bladeren bron

修改首页

st 2 maanden geleden
bovenliggende
commit
b51cd62b2a
5 gewijzigde bestanden met toevoegingen van 350 en 180 verwijderingen
  1. 1 1
      src/main.ts
  2. 323 36
      src/pages/index/index.vue
  3. 17 50
      src/service/index/foo.ts
  4. 5 88
      src/types/auto-import.d.ts
  5. 4 5
      src/utils/http.ts

+ 1 - 1
src/main.ts

@@ -7,7 +7,7 @@ import { routeInterceptor, requestInterceptor, prototypeInterceptor } from './in
 import 'virtual:uno.css'
 import '@/style/index.scss'
 
-// import '@/utils/vConsole'
+import '@/utils/vConsole'
 
 export function createApp() {
   const app = createSSRApp(App)

+ 323 - 36
src/pages/index/index.vue

@@ -56,19 +56,21 @@
     </view>
     <view class="w-690rpx mt-15rpx h-90rpx w-full flex items-center justify-center text-white">
       <image src="@/static/images/trophy/jinbi.png" class="w-60rpx h-60rpx mr-10rpx"></image>
-      <text class="text-[60rpx] font-700 mr-10rpx" ref="goldCoinEl">111</text>
+      <text class="text-[60rpx] font-700 mr-10rpx" ref="goldCoinEl">
+        {{ currentLibaoData.currentValue }}
+      </text>
       <text class="text-24rpx font-400 pt-20rpx">BHCoin</text>
     </view>
     <view
       id="lottieContainer"
       class="w-690rpx flex items-center justify-center mt-30rpx h-557rpx"
-      @click="tishishow = true"
+      @click="tishiShow = true"
     >
       <!--      <image src="@/static/images/production/cat.png" class="w-250rpx h-557rpx"></image>-->
     </view>
     <view class="w-full flex items-center justify-center mt-20rpx">
       <view class="custrom-bg w-650rpx flex text-white items-center">
-        <wd-progress :percentage="10" hide-text :duration="0.1" />
+        <wd-progress :percentage="percentage" hide-text :duration="0.1" />
       </view>
     </view>
     <view class="w-650rpx flex items-center justify-between mt-20rpx">
@@ -79,20 +81,23 @@
       </view>
       <view class="flex items-center justify-center">
         <image src="@/static/images/trophy/jinbi.png" class="w-30rpx h-30rpx mr-10rpx"></image>
-        <text class="text-26rpx font-400 text-white">+0.1/s</text>
+        <text class="text-26rpx font-400 text-white">+{{ currentLibaoData.currentRate }}/s</text>
       </view>
     </view>
     <view class="w-650rpx flex items-center mt-20rpx justify-between">
+      <!--      @click="goPage('/pages/play/index')"-->
       <view
-        @click="goPage('/pages/play/index')"
+        @click="startGame"
         class="w-310rpx h-80rpx flex items-center justify-center relative bg-#111 rounded-20rpx"
       >
         <image src="@/static/images/production/btn.png" class="w-310rpx h-80rpx absolute"></image>
         <image src="@/static/images/production/liwu.png" class="w-36rpx h-36rpx mr-10rpx"></image>
-        <text class="text-white text-28rpx font-700">Play</text>
+        <text class="text-white text-28rpx font-700" :class="{ 'libao-scale': isAnimating }">
+          Play
+        </text>
       </view>
       <view
-        @click="shengjishow = true"
+        @click="shengjiShow = true"
         class="w-310rpx h-80rpx flex items-center justify-center relative bg-#111 rounded-20rpx"
       >
         <image src="@/static/images/production/btn.png" class="w-310rpx h-80rpx absolute"></image>
@@ -148,7 +153,7 @@
       </view>
     </view>
   </wd-popup>
-  <Dialog v-model:show-value="shengjishow" position="bottom" width="690rpx" height="672rpx">
+  <Dialog v-model:show-value="shengjiShow" position="bottom" width="690rpx" height="672rpx">
     <view class="w-full flex flex-col items-center">
       <text class="text-white mt-90rpx text-36rpx font-700">Speed up the process!</text>
       <view
@@ -204,7 +209,7 @@
       </view>
     </view>
   </Dialog>
-  <Dialog v-model:show-value="tishishow" width="690rpx" height="577rpx">
+  <Dialog v-model:show-value="tishiShow" width="690rpx" height="577rpx">
     <view class="w-full flex flex-col items-center">
       <image src="@/static/images/production/time.png" class="w-90rpx h-90rpx mt-90rpx"></image>
       <view class="w-630rpx flex items-center">
@@ -213,9 +218,10 @@
         </text>
       </view>
       <view class="w-630rpx flex items-center justify-center mt-30rpx">
-        <text class="text-26rpx font-400 text-primary text-center">10h 13m 26s</text>
+        <text class="text-26rpx font-400 text-primary text-center">{{ displayTime }}</text>
       </view>
       <view
+        @click="tishiShow = false"
         class="w-630rpx bg-primary h-100rpx flex items-center justify-center rounded-20rpx mt-30rpx"
       >
         <text class="text-28rpx font-700 text-textc">Got it</text>
@@ -238,7 +244,7 @@
       </view>
     </view>
   </Dialog>
-  <Dialog v-model:show-value="lingqushow" width="690rpx" height="577rpx">
+  <Dialog v-model:show-value="lingquShow" width="690rpx" height="577rpx">
     <view class="w-full flex flex-col items-center">
       <image src="@/static/images/trophy/jinbi.png" class="w-90rpx h-90rpx mt-90rpx"></image>
       <view class="w-630rpx flex items-center">
@@ -247,9 +253,12 @@
         </text>
       </view>
       <view class="w-630rpx flex items-center justify-center mt-30rpx">
-        <text class="text-26rpx font-400 text-primary text-center">+ 12000</text>
+        <text class="text-26rpx font-400 text-primary text-center">
+          + {{ currentLibaoData.currentValue }}
+        </text>
       </view>
       <view
+        @click="lingqu"
         class="w-630rpx bg-primary h-100rpx flex items-center justify-center rounded-20rpx mt-30rpx"
       >
         <text class="text-28rpx font-700 text-textc">Got it</text>
@@ -281,31 +290,262 @@ import lottie from 'lottie-web'
 import animationData from '@/static/Animation.json'
 import Dialog from '@/components/common/Dialog/index.vue'
 import { useUserStore } from '@/store/user'
-import { getShareCode } from '@/service/team'
 import tabbar from '@/components/TabBar/index.vue'
 import { useNotify } from 'wot-design-uni'
 import { useImgPath } from '@/hooks/useImgPath'
-
+import {
+  getGoldCoinProductState,
+  stageCoinAdd,
+  startCoinGame,
+  UserCenter,
+} from '@/service/index/foo'
 const { getAssetsImages } = useImgPath()
 const { showNotify } = useNotify()
 
+// 用户信息
 const pl = useLaunchParams()
 const useStore = useUserStore()
-
 const initUser = async (user: any, shareCode: string) => {
   const data = await useStore.setUserInfo(user, shareCode)
 }
 
-const value1 = ref('en')
-onShow(async () => {
-  generateStars()
-  addStarsGradually()
-  // await initUser(pl.initData.user, uni.getStorageSync('shareCode') || '')
-  // const { data } = await getShareCode()
-  nextTick(() => {
-    initLott()
-  })
+// 获取当前礼包数据
+const currentLibaoData = ref<UserCenter>({} as UserCenter)
+const getGoldCoinProduct = async () => {
+  const { data } = await getGoldCoinProductState()
+  currentLibaoData.value = data
+}
+const isAnimating = ref(false)
+// 是否有动画
+const libaoShow = computed(() => {
+  return currentLibaoData.value.status === 0 || currentLibaoData.value.status === 2
 })
+watch(
+  () => libaoShow.value,
+  (newValue) => {
+    isAnimating.value = newValue
+  },
+)
+const formatDisplayTime = (seconds: number): string => {
+  if (!seconds || isNaN(seconds)) {
+    return '00h 00m 00s'
+  }
+  if (currentLibaoData.value.status === 0 || currentLibaoData.value.status === 2) {
+    return '00h 00m 00s'
+  }
+  // 限制最大时间为12小时
+  seconds = Math.min(seconds, TWELVE_HOURS)
+  // 如果小于0,返回0
+  seconds = Math.max(0, seconds)
+  const hours = Math.floor(seconds / 3600)
+  const minutes = Math.floor((seconds % 3600) / 60)
+  const remainingSecs = seconds % 60
+  return `${hours.toString().padStart(2, '0')}h ${minutes.toString().padStart(2, '0')}m ${remainingSecs.toString().padStart(2, '0')}s`
+}
+const percentage = ref(0) // 进度条
+const TWELVE_HOURS = 12 * 60 * 60 // 12小时的秒数
+const remainingSeconds = ref(0)
+const lastRefreshTime = ref(0)
+const REFRESH_INTERVAL = 10000
+const progressTimer = ref<number | null>(null)
+const initDisplayTime = () => {
+  if (currentLibaoData.value?.status === 1 && currentLibaoData.value?.startTimestamp) {
+    const currentTimestamp = Math.floor(Date.now() / 1000)
+    const startTime = currentLibaoData.value.startTimestamp
+    // 计算已经过去的时间
+    let elapsedTime: number
+    // 如果服务器返回的 endTimestamp 不为 0,优先使用服务器时间
+    if (currentLibaoData.value.endTimestamp) {
+      elapsedTime = currentLibaoData.value.endTimestamp - startTime
+    } else {
+      // 使用本地时间计算,但需要校验
+      elapsedTime = currentTimestamp - startTime
+    }
+    // 检查是否超过12小时
+    if (elapsedTime >= TWELVE_HOURS) {
+      // 如果超过12小时,说明游戏应该已经结束
+      remainingSeconds.value = 0
+      displayTime.value = '00h 00m 00s'
+
+      // 停止所有计时器并刷新状态
+      stopAllTimers()
+      // refreshData()
+    } else if (elapsedTime < 0) {
+      // 如果出现负数时间(比如服务器时间与本地时间不同步)
+      // 使用服务器时间或重置为0
+      remainingSeconds.value = TWELVE_HOURS
+      displayTime.value = formatDisplayTime(TWELVE_HOURS)
+    } else {
+      // 正常情况:计算剩余时间
+      remainingSeconds.value = TWELVE_HOURS - elapsedTime
+      displayTime.value = formatDisplayTime(remainingSeconds.value)
+    }
+  } else {
+    // 游戏未开始或已结束
+    remainingSeconds.value = 0
+    displayTime.value = '00h 00m 00s'
+  }
+}
+// 开始游戏
+const startGame = async () => {
+  if (currentLibaoData.value.status === 2) {
+    lingquShow.value = true
+  } else {
+    // stopAllTimers()
+
+    try {
+      if (currentLibaoData.value.status === 0) {
+        await startCoinGame()
+        await getGoldCoinProduct()
+        percentage.value = 0
+        // // 初始化显示时间
+        initDisplayTime()
+        //
+        // // 启动动画和计时器
+        isAnimating.value = false
+        startCountdown()
+        // startProgressAnimation()
+      } else {
+        tishiShow.value = true
+      }
+    } catch (error) {
+      console.error('Failed to start game:', error)
+      setTimeout(() => startGame(), 5000)
+    }
+  }
+}
+const lingqu = async () => {
+  const { code, msg } = await stageCoinAdd()
+  if (code === 1) {
+    showNotify({ type: 'success', message: msg })
+  } else {
+    showNotify({ type: 'warning', message: msg })
+  }
+  lingquShow.value = false
+  await startCoinGame()
+  await getGoldCoinProduct()
+  if (currentLibaoData.value.status === 1) {
+    // 先停止所有计时器
+    stopAllTimers()
+    // 重新初始化显示时间
+    initDisplayTime()
+    // 重新启动动画和计时器
+    isAnimating.value = true
+    startCountdown()
+    startProgressAnimation()
+    // 更新最后刷新时间
+    lastRefreshTime.value = Date.now()
+  }
+}
+watch(
+  () => currentLibaoData.value.status,
+  (newStatus) => {
+    console.info('🚀 ~ file:index method: line:443 -----', 11)
+    // 确保进度条状态正确
+    percentage.value = getProgressPercentage()
+    // 如果变成了进行中状态,启动动画
+    if (newStatus === 1) {
+      // isAnimating.value = false
+      startCountdown()
+      // startProgressAnimation()
+    } else {
+      // 其他状态停止动画
+      stopAllTimers()
+    }
+  },
+)
+const startProgressAnimation = () => {
+  if (progressTimer.value) {
+    cancelAnimationFrame(progressTimer.value)
+  }
+
+  const updateProgress = async () => {
+    percentage.value = getProgressPercentage()
+
+    // 每10秒刷新一次数据
+    const now = Date.now()
+    if (now - lastRefreshTime.value >= REFRESH_INTERVAL) {
+      lastRefreshTime.value = now
+      await refreshData()
+    }
+
+    // 只有在游戏进行中状态才继续动画
+    if (currentLibaoData.value.status === 1) {
+      progressTimer.value = requestAnimationFrame(updateProgress)
+    }
+  }
+
+  updateProgress()
+}
+const refreshData = async () => {
+  const now = Date.now()
+  try {
+    // 更新最后刷新时间
+    lastRefreshTime.value = now
+    await getGoldCoinProduct()
+    // // 根据状态显示音符动画
+    // if (currentLibaoData.value.status === 1) {
+    //   showNote.value = true
+    //   setTimeout(() => {
+    //     showNote.value = false
+    //   }, 800)
+    // }
+    // 不再在这里停止计时器,让外部控制
+  } catch (error) {
+    console.error('Refresh failed:', error)
+    throw error // 向上传递错误
+  }
+}
+// countdown
+const countdownTimer = ref<number | null>(null)
+const startCountdown = () => {
+  if (countdownTimer.value) {
+    clearInterval(countdownTimer.value)
+  }
+  const updateCountdown = () => {
+    if (currentLibaoData.value.status !== 1) {
+      stopAllTimers()
+      return
+    }
+    if (remainingSeconds.value > 0) {
+      remainingSeconds.value--
+      displayTime.value = formatDisplayTime(remainingSeconds.value)
+      // 每次时间更新时也更新进度条
+      const progress = ((TWELVE_HOURS - remainingSeconds.value) / TWELVE_HOURS) * 100
+      percentage.value = Math.min(Math.max(0, progress), 100)
+    } else {
+      stopAllTimers()
+      refreshData()
+    }
+  }
+  // 确保初始时间正确
+  if (!remainingSeconds.value) {
+    initDisplayTime()
+  }
+  // 立即执行一次更新
+  updateCountdown()
+  // 启动定时器
+  countdownTimer.value = setInterval(updateCountdown, 1000)
+}
+const stopAllTimers = () => {
+  if (countdownTimer.value) {
+    clearInterval(countdownTimer.value)
+    countdownTimer.value = null
+  }
+  // if (progressTimer.value) {
+  //   cancelAnimationFrame(progressTimer.value)
+  //   progressTimer.value = null
+  // }
+  //
+  // if (timerInterval.value) {
+  //   clearInterval(timerInterval.value)
+  //   timerInterval.value = null
+  // }
+  percentage.value = 0
+  isAnimating.value = false
+  // showNote.value = false
+}
+// Lott
 const initLott = () => {
   const query = uni.createSelectorQuery()
   query
@@ -326,17 +566,56 @@ const initLott = () => {
     })
     .exec()
 }
+// 添加一个统一的检查和启动函数
+const checkAndStartTimers = async () => {
+  try {
+    await getGoldCoinProduct()
+    // 设置初始进度
+    percentage.value = getProgressPercentage()
+    if (currentLibaoData.value.status === 1) {
+      initDisplayTime()
+    }
+  } catch (error) {
+    console.error('Failed to check and start timers:', error)
+    setTimeout(() => checkAndStartTimers(), 5000)
+  }
+}
+const getProgressPercentage = (): number => {
+  // 如果状态为0且有金币可以领取,返回100%
+  if (currentLibaoData.value.status === 2 && currentLibaoData.value.currentValue > 0) {
+    return 100
+  }
+
+  // 如果是游戏进行中状态,根据剩余时间计算进度
+  if (currentLibaoData.value.status === 1) {
+    const progress = ((TWELVE_HOURS - remainingSeconds.value) / TWELVE_HOURS) * 100
+    return Math.min(Math.max(0, progress), 100)
+  }
+  return 0
+}
+onShow(async () => {
+  generateStars()
+  addStarsGradually()
+  await initUser(pl.initData.user, uni.getStorageSync('shareCode') || '')
+  await checkAndStartTimers()
+  nextTick(() => {
+    initLott()
+  })
+})
 onHide(() => {
   if (addStarTimer) {
     clearInterval(addStarTimer)
   }
   lottie.destroy()
 })
+
 const goPage = async (url: string) => {
   await uni.navigateTo({
     url,
   })
 }
+// 语言
+const value1 = ref('en')
 const languages = [
   { value: 'en', label: 'English' },
   { value: 'vi', label: 'Tiếng Việt' },
@@ -356,19 +635,17 @@ const changeLocale = async (item) => {
   // await postCheckLang(item.value)
 }
 const show = ref(false)
-
 const displayTime = ref('00h 00m 00s')
-
-const shengjishow = ref(false)
-const tishishow = ref(false)
-const lingqushow = ref(false)
+const shengjiShow = ref(false)
+const tishiShow = ref(false)
+const lingquShow = ref(false)
 
 // 星星
 const stars = ref([])
 const visibleStars = ref([])
 const totalStars = 50
 const addInterval = 100 // 每100ms添加一颗星星
-let addStarTimer
+let addStarTimer = null
 
 const generateStar = (index) => ({
   id: index,
@@ -400,12 +677,6 @@ const addStarsGradually = () => {
 </script>
 
 <style lang="scss" scoped>
-//.box {
-//  width: 690rpx;
-//  height: 500rpx;
-//  overflow: hidden; /* 如果动画超出容器大小,确保它不会溢出 */
-//}
-
 .langboder {
   border: 1px solid #3d537c;
 }
@@ -472,4 +743,20 @@ const addStarsGradually = () => {
     opacity: 0;
   }
 }
+.libao-scale {
+  transform-origin: center center;
+  animation: libaoGuitar 1s ease-out infinite;
+}
+
+@keyframes libaoGuitar {
+  0% {
+    transform: scale(0.95);
+  }
+  50% {
+    transform: scale(1.32);
+  }
+  100% {
+    transform: scale(0.95);
+  }
+}
 </style>

+ 17 - 50
src/service/index/foo.ts

@@ -21,26 +21,15 @@ export interface LoginI {
 }
 
 export interface UserCenter {
-  id: number
-  sn: number
-  account: string
-  nickname: string
-  real_name: string
-  avatar: string
-  create_time: string
-  gold_coin: number
-  key: number
-  development_gold_coin: number
-  history_gold_coin: number
-  history_key: number
-  usdt: number
-  total_development_gold: number
-  stamina: number
-  total_share_reward: number
-  total_task_reward: number
-  total_team_reward: number
-  total_development_reward: number
-  total_resource_reward: number
+  userId: number
+  currentValue: number
+  startTimestamp: number
+  endTimestamp: number
+  residueTimestamp: number
+  currentRate: string
+  durableRate: string
+  temporaryRate: string
+  status: number
 }
 interface LoginCheck {
   show: number
@@ -76,55 +65,33 @@ export interface ProductionIncreaseInterface {
   image: string
   upgrades: boolean
 }
-/** GET 请求 */
-export const getFooAPI = (name: string) => {
-  return http.get<IFooItem>('/foo', { name })
-}
 
-/** POST 请求 */
-export const postFooAPI = (name: string) => {
-  return http.post<IFooItem>('/foo', { name }, { name })
-}
 // 登录接口
 export const coinLoginApi = (data: LoginI) => {
   return httpPost<UserT>('/app/login/coinLogin', data)
 }
 
 // 获取当前登录用户金币数量
-export const getUserCoinApi = () => {
-  return httpGet<UserCenter>('/app/development/center')
+export const getGoldCoinProductState = () => {
+  return httpPost<UserCenter>('/app/gold/coin/product/getGoldCoinProductState')
+}
+// 开始金币活动
+export const startCoinGame = () => {
+  return http.post<LoginCheck>('/app/gold/coin/product/start')
 }
-
 // 统计用户在线时长
 export const updateOnlineTime = (onlineTime: number) => {
   return http.post<UserCenter>('/app/user/updateOnlineTime', { online_time: onlineTime })
 }
-// 设置金币
-export const updateClikckAddCoin = (goldCoin: number) => {
-  return http.post<any>('/app/user/clikckAddCoin', { gold_coin: goldCoin })
-}
-// 设置体力
-export const updateStamina = (stamina: number) => {
-  return http.post<any>('/app/user/updateStamina', { stamina })
-}
 
 // 检查是否注册过
 export const coinLoginCheck = (id: number) => {
   return http.get<LoginCheck>('/app/login/coinLoginCheck', { terminal: 3, id })
 }
 
-// 开始金币活动
-export const startCoinGame = (startTime: string) => {
-  return http.post<LoginCheck>('/app/user/startCoinGame', { start_time: startTime })
-}
-
-// 获取当前金币数量改版
-export const getDevelopmentCenter = () => {
-  return http.get<JinbiT>('/app/development/center')
-}
-// 设置金币
+// 收取金币
 export const stageCoinAdd = () => {
-  return http.post<any>('/app/user/stageCoinAdd')
+  return http.post<any>('/app/gold/coin/product/collectGoldCoin')
 }
 
 // 获取推进器信息

+ 5 - 88
src/types/auto-import.d.ts

@@ -97,7 +97,7 @@ declare global {
 // for type re-export
 declare global {
   // @ts-ignore
-  export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
+  export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
   import('vue')
 }
 // for vue template auto import
@@ -161,6 +161,7 @@ declare module 'vue' {
     readonly onUnload: UnwrapRef<typeof import('@dcloudio/uni-app')['onUnload']>
     readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
     readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
+    readonly onWatcherCleanup: UnwrapRef<typeof import('vue')['onWatcherCleanup']>
     readonly provide: UnwrapRef<typeof import('vue')['provide']>
     readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
     readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
@@ -178,97 +179,13 @@ declare module 'vue' {
     readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
     readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
     readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
+    readonly useId: UnwrapRef<typeof import('vue')['useId']>
     readonly useImgPath: UnwrapRef<typeof import('../hooks/useImgPath')['useImgPath']>
+    readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
     readonly useRequest: UnwrapRef<typeof import('../hooks/useRequest')['default']>
     readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
     readonly useTelegramBackButton: UnwrapRef<typeof import('../hooks/useTelegramBackButton')['useTelegramBackButton']>
-    readonly useUpload: UnwrapRef<typeof import('../hooks/useUpload')['default']>
-    readonly watch: UnwrapRef<typeof import('vue')['watch']>
-    readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>
-    readonly watchPostEffect: UnwrapRef<typeof import('vue')['watchPostEffect']>
-    readonly watchSyncEffect: UnwrapRef<typeof import('vue')['watchSyncEffect']>
-  }
-}
-declare module '@vue/runtime-core' {
-  interface GlobalComponents {}
-  interface ComponentCustomProperties {
-    readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']>
-    readonly computed: UnwrapRef<typeof import('vue')['computed']>
-    readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
-    readonly customRef: UnwrapRef<typeof import('vue')['customRef']>
-    readonly defineAsyncComponent: UnwrapRef<typeof import('vue')['defineAsyncComponent']>
-    readonly defineComponent: UnwrapRef<typeof import('vue')['defineComponent']>
-    readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
-    readonly formatAmount: UnwrapRef<typeof import('../hooks/moneyProcessing')['formatAmount']>
-    readonly formatAmountNoFloat: UnwrapRef<typeof import('../hooks/moneyProcessing')['formatAmountNoFloat']>
-    readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
-    readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
-    readonly h: UnwrapRef<typeof import('vue')['h']>
-    readonly inject: UnwrapRef<typeof import('vue')['inject']>
-    readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
-    readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
-    readonly isReadonly: UnwrapRef<typeof import('vue')['isReadonly']>
-    readonly isRef: UnwrapRef<typeof import('vue')['isRef']>
-    readonly markRaw: UnwrapRef<typeof import('vue')['markRaw']>
-    readonly nextTick: UnwrapRef<typeof import('vue')['nextTick']>
-    readonly onActivated: UnwrapRef<typeof import('vue')['onActivated']>
-    readonly onAddToFavorites: UnwrapRef<typeof import('@dcloudio/uni-app')['onAddToFavorites']>
-    readonly onBackPress: UnwrapRef<typeof import('@dcloudio/uni-app')['onBackPress']>
-    readonly onBeforeMount: UnwrapRef<typeof import('vue')['onBeforeMount']>
-    readonly onBeforeUnmount: UnwrapRef<typeof import('vue')['onBeforeUnmount']>
-    readonly onBeforeUpdate: UnwrapRef<typeof import('vue')['onBeforeUpdate']>
-    readonly onDeactivated: UnwrapRef<typeof import('vue')['onDeactivated']>
-    readonly onError: UnwrapRef<typeof import('@dcloudio/uni-app')['onError']>
-    readonly onErrorCaptured: UnwrapRef<typeof import('vue')['onErrorCaptured']>
-    readonly onHide: UnwrapRef<typeof import('@dcloudio/uni-app')['onHide']>
-    readonly onLaunch: UnwrapRef<typeof import('@dcloudio/uni-app')['onLaunch']>
-    readonly onLoad: UnwrapRef<typeof import('@dcloudio/uni-app')['onLoad']>
-    readonly onMounted: UnwrapRef<typeof import('vue')['onMounted']>
-    readonly onNavigationBarButtonTap: UnwrapRef<typeof import('@dcloudio/uni-app')['onNavigationBarButtonTap']>
-    readonly onNavigationBarSearchInputChanged: UnwrapRef<typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputChanged']>
-    readonly onNavigationBarSearchInputClicked: UnwrapRef<typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputClicked']>
-    readonly onNavigationBarSearchInputConfirmed: UnwrapRef<typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputConfirmed']>
-    readonly onNavigationBarSearchInputFocusChanged: UnwrapRef<typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputFocusChanged']>
-    readonly onPageNotFound: UnwrapRef<typeof import('@dcloudio/uni-app')['onPageNotFound']>
-    readonly onPageScroll: UnwrapRef<typeof import('@dcloudio/uni-app')['onPageScroll']>
-    readonly onPullDownRefresh: UnwrapRef<typeof import('@dcloudio/uni-app')['onPullDownRefresh']>
-    readonly onReachBottom: UnwrapRef<typeof import('@dcloudio/uni-app')['onReachBottom']>
-    readonly onReady: UnwrapRef<typeof import('@dcloudio/uni-app')['onReady']>
-    readonly onRenderTracked: UnwrapRef<typeof import('vue')['onRenderTracked']>
-    readonly onRenderTriggered: UnwrapRef<typeof import('vue')['onRenderTriggered']>
-    readonly onResize: UnwrapRef<typeof import('@dcloudio/uni-app')['onResize']>
-    readonly onScopeDispose: UnwrapRef<typeof import('vue')['onScopeDispose']>
-    readonly onServerPrefetch: UnwrapRef<typeof import('vue')['onServerPrefetch']>
-    readonly onShareAppMessage: UnwrapRef<typeof import('@dcloudio/uni-app')['onShareAppMessage']>
-    readonly onShareTimeline: UnwrapRef<typeof import('@dcloudio/uni-app')['onShareTimeline']>
-    readonly onShow: UnwrapRef<typeof import('@dcloudio/uni-app')['onShow']>
-    readonly onTabItemTap: UnwrapRef<typeof import('@dcloudio/uni-app')['onTabItemTap']>
-    readonly onThemeChange: UnwrapRef<typeof import('@dcloudio/uni-app')['onThemeChange']>
-    readonly onUnhandledRejection: UnwrapRef<typeof import('@dcloudio/uni-app')['onUnhandledRejection']>
-    readonly onUnload: UnwrapRef<typeof import('@dcloudio/uni-app')['onUnload']>
-    readonly onUnmounted: UnwrapRef<typeof import('vue')['onUnmounted']>
-    readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
-    readonly provide: UnwrapRef<typeof import('vue')['provide']>
-    readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
-    readonly readonly: UnwrapRef<typeof import('vue')['readonly']>
-    readonly ref: UnwrapRef<typeof import('vue')['ref']>
-    readonly resolveComponent: UnwrapRef<typeof import('vue')['resolveComponent']>
-    readonly shallowReactive: UnwrapRef<typeof import('vue')['shallowReactive']>
-    readonly shallowReadonly: UnwrapRef<typeof import('vue')['shallowReadonly']>
-    readonly shallowRef: UnwrapRef<typeof import('vue')['shallowRef']>
-    readonly toRaw: UnwrapRef<typeof import('vue')['toRaw']>
-    readonly toRef: UnwrapRef<typeof import('vue')['toRef']>
-    readonly toRefs: UnwrapRef<typeof import('vue')['toRefs']>
-    readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
-    readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
-    readonly unref: UnwrapRef<typeof import('vue')['unref']>
-    readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
-    readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
-    readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
-    readonly useImgPath: UnwrapRef<typeof import('../hooks/useImgPath')['useImgPath']>
-    readonly useRequest: UnwrapRef<typeof import('../hooks/useRequest')['default']>
-    readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
-    readonly useTelegramBackButton: UnwrapRef<typeof import('../hooks/useTelegramBackButton')['useTelegramBackButton']>
+    readonly useTemplateRef: UnwrapRef<typeof import('vue')['useTemplateRef']>
     readonly useUpload: UnwrapRef<typeof import('../hooks/useUpload')['default']>
     readonly watch: UnwrapRef<typeof import('vue')['watch']>
     readonly watchEffect: UnwrapRef<typeof import('vue')['watchEffect']>

+ 4 - 5
src/utils/http.ts

@@ -5,9 +5,9 @@ import { SmCrypto } from '@/utils/crypto'
 
 const smCrypto = new SmCrypto(import.meta.env.VITE_PRIVATE_KEY, import.meta.env.VITE_PUBLIC_KEY)
 export const http = <T>(options: CustomRequestOptions) => {
-  let resdata = options.data
-  console.info('🚀 ~ 请求数据', resdata)
-  options.data = smCrypto.doEncrypt(options.data)
+  // let resdata = options.data
+  // console.info('🚀 ~ 请求数据', resdata)
+  // options.data = smCrypto.doEncrypt(options.data)
   NProgress.start()
   // 1. 返回 Promise 对象
   return new Promise<IResData<T>>((resolve, reject) => {
@@ -26,8 +26,7 @@ export const http = <T>(options: CustomRequestOptions) => {
       // #endif
       // 响应成功
       success(res) {
-        console.log('返回数据', res)
-        res.data = smCrypto.doDecrypt(res.data)
+        // res.data = smCrypto.doDecrypt(res.data)
         NProgress.done()
         // 状态码 2xx,参考 axios 的设计
         if (res.statusCode >= 200 && res.statusCode < 300) {