ソースを参照

feat: 删除demo文件

liangan 3 週間 前
コミット
dd7d884ea3

+ 0 - 12
src/pages.json

@@ -62,18 +62,6 @@
         "navigationStyle": "custom"
       }
     },
-    {
-      "path": "pages/demo/about",
-      "type": "page"
-    },
-    {
-      "path": "pages/demo/alova",
-      "type": "page"
-    },
-    {
-      "path": "pages/demo/i18n",
-      "type": "page"
-    },
     {
       "path": "pages/forgotPassword/forgotPassword",
       "type": "page",

+ 0 - 54
src/pages/demo/about.vue

@@ -1,54 +0,0 @@
-<script lang="ts" setup>
-import RequestComp from './components/request.vue'
-import UploadComp from './components/upload.vue'
-
-// 获取屏幕边界到安全区域距离
-const { safeAreaInsets } = uni.getSystemInfoSync()
-
-function gotoI18nPage() {
-  uni.navigateTo({
-    url: '/pages/about/i18n',
-  })
-}
-
-// 奇怪:同样的代码放在 vue 里面不会校验到错误,放在 .ts 文件里面会校验到错误
-// const testOxlint = (name: string) => {
-//   console.log('oxlint')
-// }
-// testOxlint('oxlint')
-console.log('about')
-
-function gotoAlova() {
-  uni.navigateTo({
-    url: '/pages/about/alova',
-  })
-}
-</script>
-
-<template>
-  <view>
-    <view class="mt-8 text-center text-3xl">
-      鸽友们好,我是
-      <text class="text-red-500">
-        菲鸽
-      </text>
-    </view>
-    <RequestComp />
-    <UploadComp />
-    <view class="text-center">
-      <wd-button @click="gotoI18nPage()">
-        去I18n页面
-      </wd-button>
-    </view>
-    <button class="w-200px text-green" @click="gotoAlova">
-      前往 alova 页面
-    </button>
-  </view>
-</template>
-
-<style lang="scss" scoped>
-.test-css {
-  // mt-4=>1rem=>16px;
-  margin-top: 16px;
-}
-</style>

+ 0 - 47
src/pages/demo/alova.vue

@@ -1,47 +0,0 @@
-<script lang="ts" setup>
-import { useRequest } from 'alova/client'
-import { foo } from '@/api/alova-foo'
-
-const initialData = undefined
-
-const { loading, data, send } = useRequest(foo, {
-  initialData,
-  immediate: true,
-})
-console.log(data)
-function reset() {
-  data.value = initialData
-}
-</script>
-
-<template>
-  <view class="p-6 text-center">
-    <button class="my-6 w-200px text-green" @click="send">
-      发送请求
-    </button>
-    <view class="h-16">
-      <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 class="text-red">
-        {{ data?.id }}
-      </view>
-    </view>
-    <button class="my-6 w-200px text-red" :disabled="!data" @click="reset">
-      重置数据
-    </button>
-  </view>
-</template>
-
-<style lang="scss" scoped>
-//
-</style>

+ 0 - 75
src/pages/demo/components/request.vue

@@ -1,75 +0,0 @@
-<script lang="ts" setup>
-import type { IFooItem } from '@/service/index/foo'
-import { getFooAPI } from '@/service/index/foo'
-// import { findPetsByStatusQueryOptions } from '@/service/app'
-// import { useQuery } from '@tanstack/vue-query'
-
-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,
-})
-
-// 使用 vue-query 的 useQuery 来请求数据,只做参考,是否使用请根据实际情况而定
-// const {
-//   data: data2,
-//   error: error2,
-//   isLoading: isLoading2,
-//   refetch,
-// } = useQuery(findPetsByStatusQueryOptions({ params: { status: ['available'] } }))
-
-function reset() {
-  data.value = initialData
-}
-</script>
-
-<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 class="my-6" @click="run">
-      发送请求
-    </wd-button>
-    <view class="h-16">
-      <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" class="my-6" :disabled="!data" @click="reset">
-      重置数据
-    </wd-button>
-  </view>
-</template>

+ 0 - 29
src/pages/demo/components/upload.vue

@@ -1,29 +0,0 @@
-<script lang="ts" setup>
-const { loading, data, run } = useUpload()
-</script>
-
-<template>
-  <view class="p-4 text-center">
-    <wd-button @click="run">
-      选择图片并上传
-    </wd-button>
-    <view v-if="loading" class="h-10 text-blue">
-      上传...
-    </view>
-    <template v-else>
-      <view class="m-2">
-        上传后返回的接口数据:
-      </view>
-      <view class="m-2">
-        {{ data }}
-      </view>
-      <view v-if="data" class="h-80 w-full">
-        <image :src="data.url" mode="scaleToFill" />
-      </view>
-    </template>
-  </view>
-</template>
-
-<style lang="scss" scoped>
-//
-</style>

+ 0 - 132
src/pages/demo/i18n.vue

@@ -1,132 +0,0 @@
-<!-- <route lang="json">
-{
-  "style": {
-    "navigationBarTitleText": "%app.name%"
-  }
-}
-</route>
- -->
-<script lang="ts" setup>
-import i18n, { t } from '@/locale/index'
-import { testI18n } from '@/utils/i18n'
-
-const current = ref(uni.getLocale())
-const user = { name: '张三', detail: { height: 178, weight: '75kg' } }
-const languages = [
-  {
-    value: 'en',
-    name: 'English',
-    checked: 'true',
-  },
-  {
-    value: 'bn',
-    name: 'Bengali',
-  },
-  {
-    value: 'zh-Hans',
-    name: '中文简体',
-  },
-]
-
-function radioChange(evt) {
-  // console.log(evt)
-  current.value = evt.detail.value
-  // 下面2句缺一不可!!!
-  uni.setLocale(evt.detail.value)
-  i18n.global.locale = evt.detail.value
-}
-</script>
-
-<template>
-  <view class="mt-6 center flex-col">
-    <view class="p-4 text-red-500 leading-6">
-      经过我的测试发现,小程序里面会有2处BUG:
-      <view>
-        <text class="line-through">
-          1. 页面标题多语言不生效
-        </text>
-        <text class="ml-2 text-green-500">
-          已解决
-        </text>
-      </view>
-      <view>
-        <text class="line-through">
-          2. 多语言传递的参数不生效,如下 heavy
-        </text>
-        <text class="ml-2 text-green-500">
-          已解决
-        </text>
-        <view class="ml-2 text-green-500">
-          把 $t 改为自定义的 t 即可
-        </view>
-      </view>
-    </view>
-    <view class="text-green-500">
-      多语言测试
-    </view>
-    <view class="m-4">
-      {{ $t('app.name') }}
-    </view>
-    <view class="text-gray-500 italic">
-      使用$t: {{ $t('weight', { heavy: 100 }) }}
-    </view>
-    <view class="m-4">
-      {{ $t('weight', { heavy: 100 }) }}
-    </view>
-    <view class="text-gray-500 italic">
-      使用t: {{ t('weight', { heavy: 100 }) }}
-    </view>
-    <view class="m-4">
-      {{ t('weight', { heavy: 100 }) }}
-    </view>
-    <view class="m-4">
-      {{ t('introduction', user) }}
-    </view>
-
-    <view class="mt-12 text-green-500">
-      切换语言
-    </view>
-    <view class="uni-list">
-      <radio-group class="radio-group" @change="radioChange">
-        <label v-for="item in languages" :key="item.value" class="uni-list-cell uni-list-cell-pd">
-          <view>
-            <radio :value="item.value" :checked="item.value === current" />
-          </view>
-          <view>{{ item.name }}</view>
-        </label>
-      </radio-group>
-    </view>
-
-    <!-- http://localhost:9000/#/pages/index/i18n -->
-    <button class="mb-44 mt-20" @click="testI18n">
-      测试弹窗
-    </button>
-  </view>
-</template>
-
-<style lang="scss">
-.uni-list {
-  position: relative;
-  display: flex;
-  flex-direction: column;
-  width: 100%;
-  background-color: #fff;
-  border-radius: 12px;
-}
-
-.radio-group {
-  width: 200px;
-  margin: 10px auto;
-  border-radius: 12px;
-}
-
-.uni-list-cell {
-  position: relative;
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  justify-content: space-between;
-  padding: 10px;
-  background-color: #bcecd1;
-}
-</style>