Skip to content

Commit 4547cf0

Browse files
committed
接口封装简易版
1 parent cf96425 commit 4547cf0

17 files changed

+6064
-0
lines changed

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,25 @@ dist
104104
.tern-port
105105
/.vs
106106
/uniapp/.hbuilderx
107+
108+
# Logs
109+
logs
110+
*.log
111+
npm-debug.log*
112+
yarn-debug.log*
113+
yarn-error.log*
114+
pnpm-debug.log*
115+
lerna-debug.log*
116+
117+
node_modules
118+
.DS_Store
119+
dist
120+
*.local
121+
122+
# Editor directories and files
123+
.idea
124+
*.suo
125+
*.ntvs*
126+
*.njsproj
127+
*.sln
128+
*.sw?

index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<script>
6+
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
7+
CSS.supports('top: constant(a)'))
8+
document.write(
9+
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
10+
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
11+
</script>
12+
<title></title>
13+
<!--preload-links-->
14+
<!--app-context-->
15+
</head>
16+
<body>
17+
<div id="app"><!--app-html--></div>
18+
<script type="module" src="/src/main.ts"></script>
19+
</body>
20+
</html>

package.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "uni-preset-vue",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"dev:app": "uni -p app",
6+
"dev:app-android": "uni -p app-android",
7+
"dev:app-ios": "uni -p app-ios",
8+
"dev:custom": "uni -p",
9+
"dev:h5": "uni",
10+
"dev:h5:ssr": "uni --ssr",
11+
"dev:mp-alipay": "uni -p mp-alipay",
12+
"dev:mp-baidu": "uni -p mp-baidu",
13+
"dev:mp-jd": "uni -p mp-jd",
14+
"dev:mp-kuaishou": "uni -p mp-kuaishou",
15+
"dev:mp-lark": "uni -p mp-lark",
16+
"dev:mp-qq": "uni -p mp-qq",
17+
"dev:mp-toutiao": "uni -p mp-toutiao",
18+
"dev:mp-weixin": "uni -p mp-weixin",
19+
"dev:quickapp-webview": "uni -p quickapp-webview",
20+
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
21+
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
22+
"build:app": "uni build -p app",
23+
"build:app-android": "uni build -p app-android",
24+
"build:app-ios": "uni build -p app-ios",
25+
"build:custom": "uni build -p",
26+
"build:h5": "uni build",
27+
"build:h5:ssr": "uni build --ssr",
28+
"build:mp-alipay": "uni build -p mp-alipay",
29+
"build:mp-baidu": "uni build -p mp-baidu",
30+
"build:mp-jd": "uni build -p mp-jd",
31+
"build:mp-kuaishou": "uni build -p mp-kuaishou",
32+
"build:mp-lark": "uni build -p mp-lark",
33+
"build:mp-qq": "uni build -p mp-qq",
34+
"build:mp-toutiao": "uni build -p mp-toutiao",
35+
"build:mp-weixin": "uni build -p mp-weixin",
36+
"build:quickapp-webview": "uni build -p quickapp-webview",
37+
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
38+
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
39+
"type-check": "vue-tsc --noEmit"
40+
},
41+
"dependencies": {
42+
"@dcloudio/uni-app": "3.0.0-alpha-3070720230316001",
43+
"@dcloudio/uni-app-plus": "3.0.0-alpha-3070720230316001",
44+
"@dcloudio/uni-components": "3.0.0-alpha-3070720230316001",
45+
"@dcloudio/uni-h5": "3.0.0-alpha-3070720230316001",
46+
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3070720230316001",
47+
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3070720230316001",
48+
"@dcloudio/uni-mp-jd": "3.0.0-alpha-3070720230316001",
49+
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3070720230316001",
50+
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3070720230316001",
51+
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3070720230316001",
52+
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3070720230316001",
53+
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3070720230316001",
54+
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3070720230316001",
55+
"vue": "^3.2.45",
56+
"vue-i18n": "^9.1.9"
57+
},
58+
"devDependencies": {
59+
"@dcloudio/types": "^3.3.2",
60+
"@dcloudio/uni-automator": "3.0.0-alpha-3070720230316001",
61+
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3070720230316001",
62+
"@dcloudio/uni-stacktracey": "3.0.0-alpha-3070720230316001",
63+
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3070720230316001",
64+
"@vue/tsconfig": "^0.1.3",
65+
"typescript": "^4.9.4",
66+
"vite": "4.0.4",
67+
"vue-tsc": "^1.0.24"
68+
}
69+
}

pnpm-lock.yaml

Lines changed: 5646 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script setup lang="ts">
2+
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
3+
onLaunch(() => {
4+
console.log("App Launch");
5+
});
6+
onShow(() => {
7+
console.log("App Show");
8+
});
9+
onHide(() => {
10+
console.log("App Hide");
11+
});
12+
</script>
13+
<style></style>

src/api/login/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import http from "@/utils/http";
2+
3+
export const login = (params:any) => {
4+
return http.post('/app/py/user/login', params);
5+
}

src/env.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference types="vite/client" />
2+
3+
declare module '*.vue' {
4+
import { DefineComponent } from 'vue'
5+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
6+
const component: DefineComponent<{}, {}, any>
7+
export default component
8+
}

src/main.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { createSSRApp } from "vue";
2+
import App from "./App.vue";
3+
export function createApp() {
4+
const app = createSSRApp(App);
5+
return {
6+
app,
7+
};
8+
}

src/manifest.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"name" : "",
3+
"appid" : "",
4+
"description" : "",
5+
"versionName" : "1.0.0",
6+
"versionCode" : "100",
7+
"transformPx" : false,
8+
/* 5+App特有相关 */
9+
"app-plus" : {
10+
"usingComponents" : true,
11+
"nvueStyleCompiler" : "uni-app",
12+
"compilerVersion" : 3,
13+
"splashscreen" : {
14+
"alwaysShowBeforeRender" : true,
15+
"waiting" : true,
16+
"autoclose" : true,
17+
"delay" : 0
18+
},
19+
/* 模块配置 */
20+
"modules" : {},
21+
/* 应用发布信息 */
22+
"distribute" : {
23+
/* android打包配置 */
24+
"android" : {
25+
"permissions" : [
26+
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
27+
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
28+
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
29+
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
30+
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
31+
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
32+
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
33+
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
34+
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
35+
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
36+
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
37+
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
38+
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
39+
"<uses-feature android:name=\"android.hardware.camera\"/>",
40+
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
41+
]
42+
},
43+
/* ios打包配置 */
44+
"ios" : {},
45+
/* SDK配置 */
46+
"sdkConfigs" : {}
47+
}
48+
},
49+
/* 快应用特有相关 */
50+
"quickapp" : {},
51+
/* 小程序特有相关 */
52+
"mp-weixin" : {
53+
"appid" : "",
54+
"setting" : {
55+
"urlCheck" : false
56+
},
57+
"usingComponents" : true
58+
},
59+
"mp-alipay" : {
60+
"usingComponents" : true
61+
},
62+
"mp-baidu" : {
63+
"usingComponents" : true
64+
},
65+
"mp-toutiao" : {
66+
"usingComponents" : true
67+
},
68+
"uniStatistics": {
69+
"enable": false
70+
},
71+
"vueVersion" : "3"
72+
}

src/pages.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
3+
{
4+
"path": "pages/index/index",
5+
"style": {
6+
"navigationBarTitleText": "uni-app"
7+
}
8+
}
9+
],
10+
"globalStyle": {
11+
"navigationBarTextStyle": "black",
12+
"navigationBarTitleText": "uni-app",
13+
"navigationBarBackgroundColor": "#F8F8F8",
14+
"backgroundColor": "#F8F8F8"
15+
}
16+
}

src/pages/index/index.vue

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template>
2+
<view class="content">
3+
<image class="logo" src="/static/logo.png" />
4+
<view class="text-area">
5+
<text class="title">{{ title }}</text>
6+
</view>
7+
</view>
8+
</template>
9+
10+
<script setup lang="ts">
11+
import { ref } from 'vue'
12+
const title = ref('Hello')
13+
</script>
14+
15+
<style>
16+
.content {
17+
display: flex;
18+
flex-direction: column;
19+
align-items: center;
20+
justify-content: center;
21+
}
22+
23+
.logo {
24+
height: 200rpx;
25+
width: 200rpx;
26+
margin-top: 200rpx;
27+
margin-left: auto;
28+
margin-right: auto;
29+
margin-bottom: 50rpx;
30+
}
31+
32+
.text-area {
33+
display: flex;
34+
justify-content: center;
35+
}
36+
37+
.title {
38+
font-size: 36rpx;
39+
color: #8f8f94;
40+
}
41+
</style>

src/shime-uni.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export {}
2+
3+
declare module "vue" {
4+
type Hooks = App.AppInstance & Page.PageInstance;
5+
interface ComponentCustomOptions extends Hooks {}
6+
}

src/static/logo.png

3.93 KB
Loading

src/uni.scss

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* 这里是uni-app内置的常用样式变量
3+
*
4+
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
5+
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
6+
*
7+
*/
8+
9+
/**
10+
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
11+
*
12+
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
13+
*/
14+
15+
/* 颜色变量 */
16+
17+
/* 行为相关颜色 */
18+
$uni-color-primary: #007aff;
19+
$uni-color-success: #4cd964;
20+
$uni-color-warning: #f0ad4e;
21+
$uni-color-error: #dd524d;
22+
23+
/* 文字基本颜色 */
24+
$uni-text-color: #333; // 基本色
25+
$uni-text-color-inverse: #fff; // 反色
26+
$uni-text-color-grey: #999; // 辅助灰色,如加载更多的提示信息
27+
$uni-text-color-placeholder: #808080;
28+
$uni-text-color-disable: #c0c0c0;
29+
30+
/* 背景颜色 */
31+
$uni-bg-color: #fff;
32+
$uni-bg-color-grey: #f8f8f8;
33+
$uni-bg-color-hover: #f1f1f1; // 点击状态颜色
34+
$uni-bg-color-mask: rgba(0, 0, 0, 0.4); // 遮罩颜色
35+
36+
/* 边框颜色 */
37+
$uni-border-color: #c8c7cc;
38+
39+
/* 尺寸变量 */
40+
41+
/* 文字尺寸 */
42+
$uni-font-size-sm: 12px;
43+
$uni-font-size-base: 14px;
44+
$uni-font-size-lg: 16;
45+
46+
/* 图片尺寸 */
47+
$uni-img-size-sm: 20px;
48+
$uni-img-size-base: 26px;
49+
$uni-img-size-lg: 40px;
50+
51+
/* Border Radius */
52+
$uni-border-radius-sm: 2px;
53+
$uni-border-radius-base: 3px;
54+
$uni-border-radius-lg: 6px;
55+
$uni-border-radius-circle: 50%;
56+
57+
/* 水平间距 */
58+
$uni-spacing-row-sm: 5px;
59+
$uni-spacing-row-base: 10px;
60+
$uni-spacing-row-lg: 15px;
61+
62+
/* 垂直间距 */
63+
$uni-spacing-col-sm: 4px;
64+
$uni-spacing-col-base: 8px;
65+
$uni-spacing-col-lg: 12px;
66+
67+
/* 透明度 */
68+
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
69+
70+
/* 文章场景相关 */
71+
$uni-color-title: #2c405a; // 文章标题颜色
72+
$uni-font-size-title: 20px;
73+
$uni-color-subtitle: #555; // 二级标题颜色
74+
$uni-font-size-subtitle: 18px;
75+
$uni-color-paragraph: #3f536e; // 文章段落颜色
76+
$uni-font-size-paragraph: 15px;

0 commit comments

Comments
 (0)