commit
5fed074839
@ -0,0 +1,26 @@ |
||||
module.exports = { |
||||
"env": { |
||||
"browser": true, |
||||
"es2021": true |
||||
}, |
||||
"extends": [ |
||||
"plugin:vue/essential", |
||||
"standard" |
||||
], |
||||
"parserOptions": { |
||||
"ecmaVersion": "latest", |
||||
"parser": "@typescript-eslint/parser", |
||||
"sourceType": "module" |
||||
}, |
||||
"plugins": [ |
||||
"vue", |
||||
"@typescript-eslint" |
||||
], |
||||
"rules": {}, |
||||
"globals": { |
||||
"uni": true, |
||||
"UniApp": true, |
||||
"wx": true, |
||||
"ICloud": true |
||||
}, |
||||
} |
@ -0,0 +1,21 @@ |
||||
# Logs |
||||
logs |
||||
*.log |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
pnpm-debug.log* |
||||
lerna-debug.log* |
||||
|
||||
node_modules |
||||
.DS_Store |
||||
dist |
||||
*.local |
||||
|
||||
# Editor directories and files |
||||
.idea |
||||
*.suo |
||||
*.ntvs* |
||||
*.njsproj |
||||
*.sln |
||||
*.sw? |
@ -0,0 +1,20 @@ |
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta charset="UTF-8"/> |
||||
<script> |
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || |
||||
CSS.supports('top: constant(a)')) |
||||
document.write( |
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + |
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />') |
||||
</script> |
||||
<title></title> |
||||
<!--preload-links--> |
||||
<!--app-context--> |
||||
</head> |
||||
<body> |
||||
<div id="app"><!--app-html--></div> |
||||
<script type="module" src="/src/main.ts"></script> |
||||
</body> |
||||
</html> |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,82 @@ |
||||
{ |
||||
"name": "uni-preset-vue", |
||||
"version": "0.0.0", |
||||
"scripts": { |
||||
"dev:app": "uni -p app", |
||||
"dev:app-android": "uni -p app-android", |
||||
"dev:app-ios": "uni -p app-ios", |
||||
"dev:custom": "uni -p", |
||||
"dev:h5": "uni", |
||||
"dev:h5:ssr": "uni --ssr", |
||||
"dev:mp-alipay": "uni -p mp-alipay", |
||||
"dev:mp-baidu": "uni -p mp-baidu", |
||||
"dev:mp-jd": "uni -p mp-jd", |
||||
"dev:mp-kuaishou": "uni -p mp-kuaishou", |
||||
"dev:mp-lark": "uni -p mp-lark", |
||||
"dev:mp-qq": "uni -p mp-qq", |
||||
"dev:mp-toutiao": "uni -p mp-toutiao", |
||||
"dev:mp-weixin": "uni -p mp-weixin", |
||||
"dev:quickapp-webview": "uni -p quickapp-webview", |
||||
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei", |
||||
"dev:quickapp-webview-union": "uni -p quickapp-webview-union", |
||||
"build:app": "uni build -p app", |
||||
"build:app-android": "uni build -p app-android", |
||||
"build:app-ios": "uni build -p app-ios", |
||||
"build:custom": "uni build -p", |
||||
"build:h5": "uni build", |
||||
"build:h5:ssr": "uni build --ssr", |
||||
"build:mp-alipay": "uni build -p mp-alipay", |
||||
"build:mp-baidu": "uni build -p mp-baidu", |
||||
"build:mp-jd": "uni build -p mp-jd", |
||||
"build:mp-kuaishou": "uni build -p mp-kuaishou", |
||||
"build:mp-lark": "uni build -p mp-lark", |
||||
"build:mp-qq": "uni build -p mp-qq", |
||||
"build:mp-toutiao": "uni build -p mp-toutiao", |
||||
"build:mp-weixin": "uni build -p mp-weixin", |
||||
"build:quickapp-webview": "uni build -p quickapp-webview", |
||||
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei", |
||||
"build:quickapp-webview-union": "uni build -p quickapp-webview-union", |
||||
"type-check": "vue-tsc --noEmit" |
||||
}, |
||||
"dependencies": { |
||||
"@dcloudio/uni-app": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-app-plus": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-components": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-h5": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-mp-jd": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3070720230316001", |
||||
"@types/node": "^20.1.0", |
||||
"less": "^4.1.3", |
||||
"less-loader": "^11.1.0", |
||||
"pinia": "^2.0.35", |
||||
"pinia-plugin-persistedstate": "^3.1.0", |
||||
"vue": "^3.2.45" |
||||
}, |
||||
"devDependencies": { |
||||
"@dcloudio/types": "^3.3.2", |
||||
"@dcloudio/uni-automator": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/uni-stacktracey": "3.0.0-alpha-3070720230316001", |
||||
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3070720230316001", |
||||
"@typescript-eslint/eslint-plugin": "^5.59.2", |
||||
"@typescript-eslint/parser": "^5.59.2", |
||||
"@vue/tsconfig": "^0.1.3", |
||||
"autoprefixer": "^10.4.14", |
||||
"eslint": "^8.40.0", |
||||
"eslint-config-standard": "^17.0.0", |
||||
"eslint-plugin-import": "^2.27.5", |
||||
"eslint-plugin-n": "^15.7.0", |
||||
"eslint-plugin-promise": "^6.1.1", |
||||
"eslint-plugin-vue": "^9.11.1", |
||||
"typescript": "^4.9.4", |
||||
"vite": "4.0.4", |
||||
"vue-tsc": "^1.0.24" |
||||
} |
||||
} |
@ -0,0 +1,38 @@ |
||||
<script setup lang="ts"> |
||||
import {onLaunch, onShow} from "@dcloudio/uni-app"; |
||||
import {reactive} from "vue"; |
||||
|
||||
const globalData = reactive<Partial<SystemInfo>>({ |
||||
statusBarHeight: 0, // 状态导航栏高度 |
||||
navHeight: 0, // 总体高度 |
||||
navigationBarHeight: 0, // 导航栏高度(标题栏高度) |
||||
safeAreaTop: 0, //屏幕顶部安全距离 |
||||
safeAreaBottom: 0, //屏幕底部安全距离 |
||||
}) |
||||
|
||||
onLaunch(() => { |
||||
let SysInfo = uni.getSystemInfoSync() |
||||
globalData.statusBarHeight = SysInfo.statusBarHeight |
||||
globalData.safeAreaTop = SysInfo.safeArea?.top |
||||
globalData.safeAreaBottom = SysInfo.safeAreaInsets?.bottom |
||||
}); |
||||
onShow(() => { |
||||
console.log("App Show"); |
||||
}); |
||||
</script> |
||||
<style lang="less"> |
||||
.text-one { |
||||
white-space: nowrap; |
||||
overflow: hidden; |
||||
text-overflow: ellipsis; |
||||
} |
||||
|
||||
.text-two { |
||||
word-break: break-all; |
||||
text-overflow: ellipsis; |
||||
display: -webkit-box; |
||||
-webkit-box-orient: vertical; |
||||
-webkit-line-clamp: 2; |
||||
overflow: hidden; |
||||
} |
||||
</style> |
@ -0,0 +1,4 @@ |
||||
export default { |
||||
baseURL: 'https://api.yaojiankang.top/', |
||||
duration: 3000 |
||||
} |
@ -0,0 +1,59 @@ |
||||
import MinRequest from './request' |
||||
import requestConfig from "./config"; |
||||
import type {RequestConfig} from "@/api/server/type"; |
||||
import {ERROR_STATUS, NETWORK_ERROR_CODE} from "@/api/server/type"; |
||||
|
||||
const minRequest = new MinRequest() |
||||
|
||||
|
||||
// 设置默认配置
|
||||
minRequest.setConfig((config: RequestConfig) => { |
||||
config.baseURL = requestConfig.baseURL |
||||
return config |
||||
}) |
||||
|
||||
|
||||
// 请求拦截器
|
||||
minRequest.interceptors.request((request) => { |
||||
let token = uni.getStorageSync('token') |
||||
if (!token && request.token) { |
||||
uni.navigateTo({url: '/pages/login/index'}).then() |
||||
} |
||||
request.header['x-session-key'] = token |
||||
return request |
||||
}) |
||||
|
||||
minRequest.interceptors.success(async (result) => { |
||||
if (result.statusCode !== 200 || !result?.data?.success) { |
||||
if (result.data?.problems) { |
||||
Object.entries(result.data.problems).forEach(([key, value]) => { |
||||
uni.showToast({title: "错误:" + value?.[0]?.message, icon: 'none', duration: requestConfig.duration}) |
||||
}) |
||||
return false |
||||
} |
||||
|
||||
const error: any = { |
||||
code: result.statusCode, |
||||
message: result.data.message || ERROR_STATUS[result.statusCode], |
||||
} |
||||
|
||||
if (!window.onabort) { |
||||
error.code = NETWORK_ERROR_CODE |
||||
error.message = ERROR_STATUS[NETWORK_ERROR_CODE] |
||||
} |
||||
|
||||
await uni.showToast({title: "错误:" + error.message, icon: 'none', duration: requestConfig.duration}) |
||||
return false |
||||
} |
||||
|
||||
return result.data.data |
||||
}) |
||||
|
||||
minRequest.interceptors.fail((result) => { |
||||
uni.showToast({title: "错误" + result.errMsg, icon: 'none', duration: requestConfig.duration}).then() |
||||
return false |
||||
}) |
||||
|
||||
|
||||
export default minRequest |
||||
|
@ -0,0 +1,139 @@ |
||||
import type { |
||||
GeneralCallbackResult, |
||||
RequestConfig, |
||||
RequestFunction, |
||||
RequestSuccessFunction |
||||
} from "@/api/server/type"; |
||||
|
||||
const config = Symbol('config') |
||||
const isCompleteURL = Symbol('isCompleteURL') |
||||
const requestBefore = Symbol('requestBefore') |
||||
const requestSuccess = Symbol('requestSuccess') |
||||
const requestFail = Symbol('requestFail') |
||||
|
||||
class MinRequest { |
||||
[config]: RequestConfig = { |
||||
baseURL: '', |
||||
header: { |
||||
'Content-Type': 'application/json;charset=UTF-8', |
||||
}, |
||||
method: 'GET', |
||||
dataType: 'json', |
||||
responseType: 'text' |
||||
} as RequestConfig |
||||
|
||||
interceptors = { |
||||
request: (func: RequestFunction) => { |
||||
if (func) { |
||||
MinRequest[requestBefore] = func |
||||
} else { |
||||
MinRequest[requestBefore] = (request) => request |
||||
} |
||||
|
||||
}, |
||||
fail: (func: (result: GeneralCallbackResult) => false) => { |
||||
if (func) { |
||||
MinRequest[requestFail] = func |
||||
} else { |
||||
MinRequest[requestFail] = (response: GeneralCallbackResult) => false |
||||
} |
||||
}, |
||||
success: (func: RequestSuccessFunction<any>) => { |
||||
if (func) { |
||||
MinRequest[requestSuccess] = func |
||||
} else { |
||||
MinRequest[requestSuccess] = (response: UniNamespace.RequestSuccessCallbackResult) => null |
||||
} |
||||
} |
||||
} |
||||
static install: (Vue) => void; |
||||
|
||||
/** 请求前 */ |
||||
static [requestBefore](config: RequestConfig) { |
||||
return config |
||||
} |
||||
|
||||
/** 请求失败 */ |
||||
static [requestFail](response: UniNamespace.GeneralCallbackResult): false { |
||||
return false |
||||
} |
||||
|
||||
/** 请求成功 */ |
||||
static [requestSuccess]<T = unknown>(response: UniNamespace.RequestSuccessCallbackResult): T { |
||||
return null |
||||
} |
||||
|
||||
/** url验证 */ |
||||
static [isCompleteURL](url: string) { |
||||
return /(http|https):\/\/([\w.]+\/?)\S*/.test(url) |
||||
} |
||||
|
||||
setConfig(func: (config: RequestConfig) => RequestConfig) { |
||||
this[config] = func(this[config]) |
||||
} |
||||
|
||||
request<T = unknown>(options = {} as RequestConfig): Promise<T> { |
||||
options.baseURL = options.baseURL || this[config].baseURL |
||||
options.dataType = options.dataType || this[config].dataType |
||||
options.url = MinRequest[isCompleteURL](options.url) ? options.url : (options.baseURL + options.url) |
||||
options.header = {...options.header, ...this[config].header} |
||||
options.method = options.method || this[config].method |
||||
|
||||
options = {...options, ...MinRequest[requestBefore](options)} |
||||
|
||||
return new Promise((resolve, reject) => { |
||||
options.success = function (res) { |
||||
resolve(MinRequest[requestSuccess]<T>(res)) |
||||
} |
||||
options.fail = function (err) { |
||||
reject(MinRequest[requestFail](err)) |
||||
} |
||||
uni.request(options) |
||||
}) |
||||
} |
||||
|
||||
get<T = unknown>(url, data?: Record<string, unknown>, options = {} as RequestConfig): Promise<T> { |
||||
options.url = url |
||||
options.data = data |
||||
options.method = 'GET' |
||||
return this.request<T>(options) |
||||
} |
||||
|
||||
post<T>(url, data?: Record<string, unknown>, options = {} as RequestConfig): Promise<T> { |
||||
options.url = url |
||||
options.data = data |
||||
options.method = 'POST' |
||||
return this.request<T>(options) |
||||
} |
||||
|
||||
del<T>(url, data?: Record<string, unknown>, options = {} as RequestConfig): Promise<T> { |
||||
options.url = url |
||||
options.data = data |
||||
options.method = 'DELETE' |
||||
return this.request<T>(options) |
||||
} |
||||
|
||||
put<T>(url, data?: Record<string, unknown>, options = {} as RequestConfig): Promise<T> { |
||||
options.url = url |
||||
options.data = data |
||||
options.method = 'PUT' |
||||
return this.request<T>(options) |
||||
} |
||||
} |
||||
|
||||
MinRequest.install = function (Vue) { |
||||
Vue.mixin({ |
||||
beforeCreate: function () { |
||||
if (this.$options.minRequest) { |
||||
Vue._minRequest = this.$options.minRequest |
||||
} |
||||
} |
||||
}) |
||||
Object.defineProperty(Vue.prototype, '$minApi', { |
||||
get: function () { |
||||
return Vue._minRequest.apis |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export default MinRequest |
@ -0,0 +1,94 @@ |
||||
/** 请求超时时间 */ |
||||
export const REQUEST_TIMEOUT = 6 * 1000 |
||||
/** 默认的请求错误code */ |
||||
export const DEFAULT_REQUEST_ERROR_CODE = 'DEFAULT' |
||||
/** 默认的请求错误文本 */ |
||||
export const DEFAULT_REQUEST_ERROR_MSG = '请求错误~' |
||||
/** 请求超时的错误code(为固定值:ECONNABORTED) */ |
||||
export const REQUEST_TIMEOUT_CODE = 'ECONNABORTED' |
||||
/** 请求超时的错误文本 */ |
||||
export const REQUEST_TIMEOUT_MSG = '请求超时~' |
||||
/** 网络不可用的code */ |
||||
export const NETWORK_ERROR_CODE = 'NETWORK_ERROR' |
||||
/** 网络不可用的错误文本 */ |
||||
export const NETWORK_ERROR_MSG = '网络不可用~' |
||||
/** 响应的数据错误的code */ |
||||
export const RESPONSE_ERROR_CODE = 'INVALID_DATA' |
||||
/** 响应的数据错误文本 */ |
||||
export const RESPONSE_ERROR_MSG = '服务器响应异常~' |
||||
/** 越界请求接口的错误code */ |
||||
export const API_OVERSTEP_CODE = 'OVERSTEP' |
||||
/** 越界请求接口的错误文本 */ |
||||
export const API_OVERSTEP_MSG = '请求越界~' |
||||
|
||||
export const ERROR_STATUS: Record<number | string, string> = { |
||||
'400': '400: 请求出现语法错误~', |
||||
'401': '401: 用户未授权~', |
||||
'-102': '-102: token失效~', |
||||
'403': '403: 服务器拒绝访问~', |
||||
'404': '404: 请求的资源不存在~', |
||||
'405': '405: 请求方法未允许~', |
||||
'429': '您请求太频繁了,请休息一会~', |
||||
'408': '408: 网络请求超时~', |
||||
'500': '500: 服务器内部错误~', |
||||
'501': '501: 服务器未实现请求功能~', |
||||
'502': '502: 错误网关~', |
||||
'503': '503: 服务不可用~', |
||||
'504': '504: 网关超时~', |
||||
'505': '505: http版本不支持该请求~', |
||||
[DEFAULT_REQUEST_ERROR_CODE]: DEFAULT_REQUEST_ERROR_MSG, |
||||
[NETWORK_ERROR_CODE]: NETWORK_ERROR_MSG, |
||||
[REQUEST_TIMEOUT_CODE]: REQUEST_TIMEOUT_MSG, |
||||
[RESPONSE_ERROR_CODE]: RESPONSE_ERROR_MSG, |
||||
[API_OVERSTEP_CODE]: API_OVERSTEP_MSG, |
||||
} |
||||
|
||||
export type ErrorStatus = keyof typeof ERROR_STATUS |
||||
|
||||
export type RequestConfig = UniNamespace.RequestOptions & { |
||||
baseURL: string |
||||
token: string |
||||
} |
||||
|
||||
|
||||
/** 请求拦截前回调 */ |
||||
export type RequestFunction = (config: RequestConfig) => RequestConfig |
||||
|
||||
|
||||
interface ProblemsData { |
||||
code: number, |
||||
message: string |
||||
} |
||||
|
||||
interface ProblemsObject { |
||||
[key: string]: ProblemsData[] |
||||
} |
||||
|
||||
/** 服务请求错误 */ |
||||
interface ErrorResult { |
||||
code: ErrorStatus |
||||
message: string |
||||
problems?: ProblemsObject |
||||
success: false |
||||
} |
||||
|
||||
export type GeneralCallbackResult = UniNamespace.GeneralCallbackResult & { |
||||
data: ErrorResult |
||||
} |
||||
|
||||
|
||||
/** 服务器请求成功 */ |
||||
export interface SuccessResult<T = unknown> { |
||||
data: T |
||||
message: string |
||||
problems?: ProblemsObject |
||||
success: true |
||||
} |
||||
|
||||
export type RequestSuccessCallbackResult<T = unknown> = UniNamespace.RequestSuccessCallbackResult & { |
||||
data: SuccessResult<T> |
||||
} |
||||
|
||||
/** 请求成功 */ |
||||
export type RequestSuccessFunction<T> = (result: RequestSuccessCallbackResult) => T |
||||
|
@ -0,0 +1,7 @@ |
||||
import minRequest from "@/api/server/interceptors"; |
||||
|
||||
export default { |
||||
login(data: UserType.Login) { |
||||
return minRequest.get('/municipal-manager/auth/staff-login', data) |
||||
} |
||||
} |
@ -0,0 +1,8 @@ |
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' { |
||||
import { DefineComponent } from 'vue' |
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
||||
const component: DefineComponent<{}, {}, any> |
||||
export default component |
||||
} |
@ -0,0 +1,13 @@ |
||||
import {createSSRApp} from "vue"; |
||||
import App from "./App.vue"; |
||||
import {pinia} from '@/store' |
||||
|
||||
import './static/tailwindcss' |
||||
|
||||
export function createApp() { |
||||
const app = createSSRApp(App); |
||||
app.use(pinia) |
||||
return { |
||||
app, |
||||
}; |
||||
} |
@ -0,0 +1,72 @@ |
||||
{ |
||||
"name" : "", |
||||
"appid" : "", |
||||
"description" : "", |
||||
"versionName" : "1.0.0", |
||||
"versionCode" : "100", |
||||
"transformPx" : false, |
||||
/* 5+App特有相关 */ |
||||
"app-plus" : { |
||||
"usingComponents" : true, |
||||
"nvueStyleCompiler" : "uni-app", |
||||
"compilerVersion" : 3, |
||||
"splashscreen" : { |
||||
"alwaysShowBeforeRender" : true, |
||||
"waiting" : true, |
||||
"autoclose" : true, |
||||
"delay" : 0 |
||||
}, |
||||
/* 模块配置 */ |
||||
"modules" : {}, |
||||
/* 应用发布信息 */ |
||||
"distribute" : { |
||||
/* android打包配置 */ |
||||
"android" : { |
||||
"permissions" : [ |
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", |
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", |
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", |
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>", |
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", |
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", |
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", |
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>", |
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", |
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", |
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", |
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", |
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", |
||||
"<uses-feature android:name=\"android.hardware.camera\"/>", |
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" |
||||
] |
||||
}, |
||||
/* ios打包配置 */ |
||||
"ios" : {}, |
||||
/* SDK配置 */ |
||||
"sdkConfigs" : {} |
||||
} |
||||
}, |
||||
/* 快应用特有相关 */ |
||||
"quickapp" : {}, |
||||
/* 小程序特有相关 */ |
||||
"mp-weixin" : { |
||||
"appid" : "", |
||||
"setting" : { |
||||
"urlCheck" : false |
||||
}, |
||||
"usingComponents" : true |
||||
}, |
||||
"mp-alipay" : { |
||||
"usingComponents" : true |
||||
}, |
||||
"mp-baidu" : { |
||||
"usingComponents" : true |
||||
}, |
||||
"mp-toutiao" : { |
||||
"usingComponents" : true |
||||
}, |
||||
"uniStatistics": { |
||||
"enable": false |
||||
}, |
||||
"vueVersion" : "3" |
||||
} |
@ -0,0 +1,27 @@ |
||||
{ |
||||
"easycom": { |
||||
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" |
||||
}, |
||||
"pages": [ |
||||
{ |
||||
"path": "pages/login/index", |
||||
"style": { |
||||
"navigationBarTitleText": "登录", |
||||
"navigationStyle": "custom" |
||||
} |
||||
}, |
||||
{ |
||||
"path": "pages/index/index", |
||||
"style": { |
||||
"navigationBarTitleText": "销售记录", |
||||
"navigationStyle": "custom" |
||||
} |
||||
} |
||||
], |
||||
"globalStyle": { |
||||
"navigationBarTextStyle": "black", |
||||
"navigationBarTitleText": "uni-app", |
||||
"navigationBarBackgroundColor": "#F8F8F8", |
||||
"backgroundColor": "#F8F8F8" |
||||
} |
||||
} |
@ -0,0 +1,37 @@ |
||||
<template> |
||||
<view class="content"> |
||||
|
||||
</view> |
||||
</template> |
||||
|
||||
<script setup lang="ts"> |
||||
|
||||
</script> |
||||
|
||||
<style> |
||||
.content { |
||||
display: flex; |
||||
flex-direction: column; |
||||
align-items: center; |
||||
justify-content: center; |
||||
} |
||||
|
||||
.logo { |
||||
height: 200rpx; |
||||
width: 200rpx; |
||||
margin-top: 200rpx; |
||||
margin-left: auto; |
||||
margin-right: auto; |
||||
margin-bottom: 50rpx; |
||||
} |
||||
|
||||
.text-area { |
||||
display: flex; |
||||
justify-content: center; |
||||
} |
||||
|
||||
.title { |
||||
font-size: 36rpx; |
||||
color: #8f8f94; |
||||
} |
||||
</style> |
@ -0,0 +1,33 @@ |
||||
<template> |
||||
<div class="p-4 pt-32"> |
||||
<input class="pt-10 pb-10 text-base border-b-2 border-gray-100" |
||||
type="number" |
||||
placeholder="请输入手机号" |
||||
v-model="params.phone_number"> |
||||
|
||||
<view class="flex items-center pt-10 pb-5 justify-between border-b-2 border-gray-100"> |
||||
<input type="number" |
||||
class="text-base" |
||||
placeholder="请输入验证码" |
||||
v-model="params.code"> |
||||
<a plain class="text-blue-600">获取验证码</a> |
||||
</view> |
||||
<button class="bg-blue-600 text-white mt-20 font-sans">登录</button> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
import {onMounted, reactive} from "vue"; |
||||
import api from "@/api/user"; |
||||
|
||||
const params = reactive({ |
||||
code: "", |
||||
phone_number: "" |
||||
}) |
||||
|
||||
onMounted(async () => { |
||||
const res = await api.login({}) |
||||
console.log(res) |
||||
|
||||
}) |
||||
</script> |
@ -0,0 +1,6 @@ |
||||
export {} |
||||
|
||||
declare module "vue" { |
||||
type Hooks = App.AppInstance & Page.PageInstance; |
||||
interface ComponentCustomOptions extends Hooks {} |
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,21 @@ |
||||
import useStore from './user/index' |
||||
import {createPinia} from "pinia"; |
||||
import {createPersistedState} from "pinia-plugin-persistedstate"; |
||||
|
||||
export const pinia = createPinia().use( |
||||
createPersistedState({ |
||||
storage: { |
||||
getItem(key: string): string | null { |
||||
return uni.getStorageSync(key) |
||||
}, |
||||
setItem(key: string, value: string) { |
||||
uni.setStorageSync(key, value) |
||||
} |
||||
} |
||||
}) |
||||
) |
||||
|
||||
|
||||
export { |
||||
useStore, |
||||
} |
@ -0,0 +1,18 @@ |
||||
import {defineStore} from 'pinia' |
||||
|
||||
|
||||
export default defineStore('global', { |
||||
persist: { |
||||
key: 'pinia', |
||||
paths: ['user'] |
||||
}, |
||||
state: (): StateType => ({ |
||||
user: undefined |
||||
}), |
||||
actions: { |
||||
setData<T extends keyof StateType>({key, value}: { key: T, value: any }) { |
||||
this[key] = value |
||||
} |
||||
} |
||||
}) |
||||
|
@ -0,0 +1,77 @@ |
||||
/** |
||||
* 这里是uni-app内置的常用样式变量 |
||||
* |
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 |
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App |
||||
* |
||||
*/ |
||||
|
||||
/** |
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 |
||||
* |
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 |
||||
*/ |
||||
|
||||
/* 颜色变量 */ |
||||
|
||||
|
||||
/* 行为相关颜色 */ |
||||
$uni-color-primary: #007aff; |
||||
$uni-color-success: #4cd964; |
||||
$uni-color-warning: #f0ad4e; |
||||
$uni-color-error: #dd524d; |
||||
|
||||
/* 文字基本颜色 */ |
||||
$uni-text-color: #333; // 基本色 |
||||
$uni-text-color-inverse: #fff; // 反色 |
||||
$uni-text-color-grey: #999; // 辅助灰色,如加载更多的提示信息 |
||||
$uni-text-color-placeholder: #808080; |
||||
$uni-text-color-disable: #c0c0c0; |
||||
|
||||
/* 背景颜色 */ |
||||
$uni-bg-color: #fff; |
||||
$uni-bg-color-grey: #f8f8f8; |
||||
$uni-bg-color-hover: #f1f1f1; // 点击状态颜色 |
||||
$uni-bg-color-mask: rgba(0, 0, 0, 0.4); // 遮罩颜色 |
||||
|
||||
/* 边框颜色 */ |
||||
$uni-border-color: #c8c7cc; |
||||
|
||||
/* 尺寸变量 */ |
||||
|
||||
/* 文字尺寸 */ |
||||
$uni-font-size-sm: 12px; |
||||
$uni-font-size-base: 14px; |
||||
$uni-font-size-lg: 16; |
||||
|
||||
/* 图片尺寸 */ |
||||
$uni-img-size-sm: 20px; |
||||
$uni-img-size-base: 26px; |
||||
$uni-img-size-lg: 40px; |
||||
|
||||
/* Border Radius */ |
||||
$uni-border-radius-sm: 2px; |
||||
$uni-border-radius-base: 3px; |
||||
$uni-border-radius-lg: 6px; |
||||
$uni-border-radius-circle: 50%; |
||||
|
||||
/* 水平间距 */ |
||||
$uni-spacing-row-sm: 5px; |
||||
$uni-spacing-row-base: 10px; |
||||
$uni-spacing-row-lg: 15px; |
||||
|
||||
/* 垂直间距 */ |
||||
$uni-spacing-col-sm: 4px; |
||||
$uni-spacing-col-base: 8px; |
||||
$uni-spacing-col-lg: 12px; |
||||
|
||||
/* 透明度 */ |
||||
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 |
||||
|
||||
/* 文章场景相关 */ |
||||
$uni-color-title: #2c405a; // 文章标题颜色 |
||||
$uni-font-size-title: 20px; |
||||
$uni-color-subtitle: #555; // 二级标题颜色 |
||||
$uni-font-size-subtitle: 18px; |
||||
$uni-color-paragraph: #3f536e; // 文章段落颜色 |
||||
$uni-font-size-paragraph: 15px; |
@ -0,0 +1,44 @@ |
||||
{ |
||||
"extends": "@vue/tsconfig/tsconfig.json", |
||||
"compilerOptions": { |
||||
"target": "ES2020", |
||||
"module": "ES2020", |
||||
"strict": true, |
||||
"jsx": "preserve", |
||||
"moduleResolution": "node", |
||||
"experimentalDecorators": true, |
||||
"skipLibCheck": true, |
||||
"esModuleInterop": true, |
||||
"allowJs": true, |
||||
"outDir": ".", |
||||
"allowSyntheticDefaultImports": true, |
||||
"forceConsistentCasingInFileNames": true, |
||||
"useDefineForClassFields": true, |
||||
"sourceMap": true, |
||||
"baseUrl": ".", |
||||
"paths": { |
||||
"@/*": [ |
||||
"./src/*" |
||||
] |
||||
}, |
||||
"lib": [ |
||||
"esnext", |
||||
"es2020", |
||||
"dom" |
||||
], |
||||
"types": [ |
||||
"@dcloudio/types" |
||||
] |
||||
}, |
||||
"include": [ |
||||
"types/**/*.d.ts", |
||||
"src/**/*.ts", |
||||
"src/**/*.d.ts", |
||||
"src/**/*.tsx", |
||||
"src/**/*.vue", |
||||
"src/**/*.js" |
||||
], |
||||
"exclude": [ |
||||
"node_modules" |
||||
] |
||||
} |
@ -0,0 +1,9 @@ |
||||
interface SystemInfo { |
||||
statusBarHeight: number, |
||||
navHeight: number |
||||
navigationBarHeight: number |
||||
safeAreaTop: number, |
||||
safeAreaBottom: number |
||||
} |
||||
|
||||
|
@ -0,0 +1,11 @@ |
||||
interface StateType { |
||||
user?: any |
||||
} |
||||
namespace UserType { |
||||
export interface Login { |
||||
mobile: string |
||||
business: string |
||||
|
||||
[key: string]: string |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
import {defineConfig} from "vite"; |
||||
import uni from "@dcloudio/vite-plugin-uni"; |
||||
import path from 'path' |
||||
|
||||
export default defineConfig({ |
||||
plugins: [uni()], |
||||
resolve: { |
||||
alias: { |
||||
'@': path.resolve(__dirname, 'src') |
||||
} |
||||
} |
||||
}); |
Loading…
Reference in new issue