Jelajahi Sumber

chore: clear

windyeasy 2 bulan lalu
induk
melakukan
50dad73173

+ 1 - 2
src/main.ts

@@ -1,7 +1,7 @@
 import { createSSRApp } from 'vue'
 import App from './App.vue'
 import store from './store'
-import { routeInterceptor, requestInterceptor, prototypeInterceptor } from './interceptors'
+import { routeInterceptor, prototypeInterceptor } from './interceptors'
 import 'virtual:uno.css'
 import '@/style/index.scss'
 
@@ -9,7 +9,6 @@ export function createApp() {
   const app = createSSRApp(App)
   app.use(store)
   app.use(routeInterceptor)
-  app.use(requestInterceptor)
   app.use(prototypeInterceptor)
   return {
     app,

+ 1 - 1
src/manifest.json

@@ -108,4 +108,4 @@
       "base": "/hospital-mobile/"
     }
   }
-}
+}

+ 0 - 20
src/pages-sub/demo/index.vue

@@ -1,20 +0,0 @@
-<route lang="json5" type="page">
-{
-  style: { navigationBarTitleText: '分包页面 标题' },
-}
-</route>
-
-<template>
-  <view class="text-center">
-    <view class="m-8">http://localhost:9000/#/pages-sub/demo/index</view>
-    <view class="text-green-500">分包页面demo</view>
-  </view>
-</template>
-
-<script lang="ts" setup>
-// code here
-</script>
-
-<style lang="scss" scoped>
-//
-</style>

+ 4 - 3
src/pages.json

@@ -32,7 +32,7 @@
       {
         "iconPath": "static/tabbar/example.png",
         "selectedIconPath": "static/tabbar/exampleHL.png",
-        "pagePath": "pages/about/about",
+        "pagePath": "pages/about/index",
         "text": "关于"
       }
     ]
@@ -47,9 +47,10 @@
       }
     },
     {
-      "path": "pages/about/about",
-      "type": "page",
+      "path": "pages/about/index",
+      "type": "home",
       "style": {
+        "navigationStyle": "custom",
         "navigationBarTitleText": "关于"
       }
     }

+ 0 - 36
src/pages/about/about.vue

@@ -1,36 +0,0 @@
-<route lang="json5">
-{
-  style: {
-    navigationBarTitleText: '关于',
-  },
-}
-</route>
-
-<template>
-  <view
-    class="bg-white overflow-hidden pt-2 px-4"
-    :style="{ marginTop: safeAreaInsets?.top + 'px' }"
-  >
-    <view class="text-center text-3xl mt-8">
-      鸽友们好,我是
-      <text class="text-red-500">菲鸽</text>
-    </view>
-    <RequestComp />
-    <UploadComp />
-  </view>
-</template>
-
-<script lang="ts" setup>
-import RequestComp from './components/request.vue'
-import UploadComp from './components/upload.vue'
-
-// 获取屏幕边界到安全区域距离
-const { safeAreaInsets } = uni.getSystemInfoSync()
-</script>
-
-<style lang="scss" scoped>
-.test-css {
-  // mt-4=>1rem=>16px;
-  margin-top: 16px;
-}
-</style>

+ 0 - 56
src/pages/about/components/request.vue

@@ -1,56 +0,0 @@
-<route lang="json5">
-{
-  layout: 'demo',
-  style: {
-    navigationBarTitleText: '请求',
-  },
-}
-</route>
-
-<template>
-  <view class="p-6 text-center">
-    <view class="my-2">使用的是 laf 云后台</view>
-    <view class="text-green-400">我的推荐码,可以获得佣金</view>
-
-    <!-- #ifdef H5 -->
-    <view class="my-2">
-      <a class="my-2" :href="recommendUrl" target="_blank">{{ recommendUrl }}</a>
-    </view>
-    <!-- #endif -->
-
-    <!-- #ifndef H5 -->
-    <view class="my-2 text-left text-sm">{{ recommendUrl }}</view>
-    <!-- #endif -->
-
-    <!-- http://localhost:9000/#/pages/index/request -->
-    <wd-button @click="run" class="my-6">发送请求</wd-button>
-    <view class="h-12">
-      <view v-if="loading">loading...</view>
-      <block v-else>
-        <view class="text-xl">请求数据如下</view>
-        <view class="text-green leading-8">{{ JSON.stringify(data) }}</view>
-      </block>
-    </view>
-    <wd-button type="error" @click="reset" class="my-6" :disabled="!data">重置数据</wd-button>
-  </view>
-</template>
-
-<script lang="ts" setup>
-import { getFooAPI, postFooAPI, IFooItem } from '@/service/index/foo'
-
-const recommendUrl = ref('http://laf.run/signup?code=ohaOgIX')
-
-// const initialData = {
-//   name: 'initialData',
-//   id: '1234',
-// }
-const initialData = undefined
-// 适合少部分全局性的接口————多个页面都需要的请求接口,额外编写一个 Service 层
-const { loading, error, data, run } = useRequest<IFooItem>(() => getFooAPI('菲鸽'), {
-  immediate: true,
-  initialData,
-})
-const reset = () => {
-  data.value = initialData
-}
-</script>

+ 0 - 30
src/pages/about/components/upload.vue

@@ -1,30 +0,0 @@
-<route lang="json5" type="page">
-{
-  layout: 'default',
-  style: {
-    navigationBarTitleText: '上传-状态一体化',
-  },
-}
-</route>
-
-<template>
-  <view class="p-4 text-center">
-    <wd-button @click="run">选择图片并上传</wd-button>
-    <view v-if="loading" class="text-blue h-10">上传...</view>
-    <template v-else>
-      <view class="m-2">上传后返回的接口数据:</view>
-      <view class="m-2">{{ data }}</view>
-      <view class="h-80 w-full">
-        <image v-if="data" :src="data || data" mode="scaleToFill" />
-      </view>
-    </template>
-  </view>
-</template>
-
-<script lang="ts" setup>
-const { loading, data, run } = useUpload({ user: '菲鸽' })
-</script>
-
-<style lang="scss" scoped>
-//
-</style>

+ 16 - 0
src/pages/about/index.vue

@@ -0,0 +1,16 @@
+<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page;推荐使用json5,更强大,且允许注释 -->
+<route lang="json5" type="home">
+{
+  style: {
+    navigationStyle: 'custom',
+    navigationBarTitleText: '关于',
+  },
+}
+</route>
+<template>
+  <view>关于</view>
+</template>
+
+<script lang="ts" setup></script>
+
+<style></style>

+ 3 - 43
src/pages/index/index.vue

@@ -8,49 +8,9 @@
 }
 </route>
 <template>
-  <view
-    class="bg-white overflow-hidden pt-2 px-4"
-    :style="{ marginTop: safeAreaInsets?.top + 'px' }"
-  >
-    <view class="mt-12">
-      <image src="/static/logo.svg" alt="" class="w-28 h-28 block mx-auto" />
-    </view>
-    <view class="text-center text-4xl main-title-color mt-4">hospital-mobile</view>
-    <view class="text-center text-2xl mt-2 mb-8">最好用的 uniapp 开发模板</view>
-
-    <view class="text-justify max-w-100 m-auto text-4 indent mb-2">{{ description }}</view>
-    <view class="text-center mt-8">
-      当前平台是:
-      <text class="text-green-500">{{ PLATFORM.platform }}</text>
-    </view>
-    <view class="text-center mt-4">
-      模板分支是:
-      <text class="text-green-500">base</text>
-    </view>
-  </view>
+  <view>Home</view>
 </template>
 
-<script lang="ts" setup>
-import PLATFORM from '@/utils/platform'
-
-defineOptions({
-  name: 'Home',
-})
+<script lang="ts" setup></script>
 
-// 获取屏幕边界到安全区域距离
-const { safeAreaInsets } = uni.getSystemInfoSync()
-const author = ref('菲鸽')
-const description = ref(
-  'hospital-mobile 是一个集成了多种工具和技术的 uniapp 开发模板,由 uniapp + Vue3 + Ts + Vite4 + UnoCss + UniUI + VSCode 构建,模板具有代码提示、自动格式化、统一配置、代码片段等功能,并内置了许多常用的基本组件和基本功能,让你编写 uniapp 拥有 best 体验。',
-)
-// 测试 uni API 自动引入
-onLoad(() => {
-  console.log(author)
-})
-</script>
-
-<style>
-.main-title-color {
-  color: #d14328;
-}
-</style>
+<style></style>

+ 0 - 15
src/service/index/foo.ts

@@ -1,15 +0,0 @@
-import { http } from '@/utils/http'
-export interface IFooItem {
-  id: string
-  name: string
-}
-
-/** 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 })
-}

+ 1 - 1
src/types/uni-pages.d.ts

@@ -5,7 +5,7 @@
 
 interface NavigateToOptions {
   url: "/pages/index/index" |
-       "/pages/about/about";
+       "/pages/about/index";
 }
 interface RedirectToOptions extends NavigateToOptions {}