代码初始化
This commit is contained in:
commit
e783dbbd96
|
|
@ -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,8 @@
|
|||
{
|
||||
"tabWidth": 4,
|
||||
"singleQuote": true,
|
||||
"semi": false,
|
||||
"printWidth": 100,
|
||||
"trailingComma": "all",
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/* eslint-env node */
|
||||
require('@rushstack/eslint-patch/modern-module-resolution')
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/eslint-config-prettier'],
|
||||
// 小程序全局变量
|
||||
globals: {
|
||||
uni: true,
|
||||
wx: true,
|
||||
WechatMiniprogram: true,
|
||||
getCurrentPages: true,
|
||||
getApp: true,
|
||||
UniApp: true,
|
||||
UniHelper: true,
|
||||
App: true,
|
||||
Page: true,
|
||||
Component: true,
|
||||
AnyObject: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
},
|
||||
rules: {
|
||||
'prettier/prettier': [
|
||||
'warn',
|
||||
{
|
||||
tabWidth: 4,
|
||||
singleQuote: true,
|
||||
semi: false,
|
||||
printWidth: 100,
|
||||
trailingComma: 'all',
|
||||
endOfLine: 'auto',
|
||||
},
|
||||
],
|
||||
'vue/multi-word-component-names': ['off'],
|
||||
'vue/no-setup-props-destructure': ['off'],
|
||||
'vue/no-deprecated-html-element-is': ['off'],
|
||||
'@typescript-eslint/no-unused-vars': ['off'],
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
|
||||
<!-- 开启顶部安全区适配 -->
|
||||
<van-nav-bar safe-area-inset-top />
|
||||
<!-- 开启底部安全区适配 -->
|
||||
<van-number-keyboard safe-area-inset-bottom />
|
||||
<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.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,89 @@
|
|||
{
|
||||
"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:app-harmony": "uni -p app-harmony",
|
||||
"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:mp-xhs": "uni -p mp-xhs",
|
||||
"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:app-harmony": "uni build -p app-harmony",
|
||||
"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:mp-xhs": "uni build -p mp-xhs",
|
||||
"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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dcloudio/uni-app": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-app-harmony": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-app-plus": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-components": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-h5": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-mp-alipay": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-mp-baidu": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-mp-jd": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-mp-lark": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-mp-qq": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-mp-xhs": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4020420240722002",
|
||||
"less": "^4.2.1",
|
||||
"less-loader": "^12.2.0",
|
||||
"pinia": "^2.3.0",
|
||||
"pinia-plugin-persistedstate": "^4.1.3",
|
||||
"vant": "^4.9.10",
|
||||
"vue": "^3.4.21",
|
||||
"vue-i18n": "^9.1.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dcloudio/types": "^3.4.8",
|
||||
"@dcloudio/uni-automator": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-4020420240722002",
|
||||
"@dcloudio/uni-stacktracey": "3.0.0-4020420240722002",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-4020420240722002",
|
||||
"@eslint/js": "^9.9.0",
|
||||
"@vant/auto-import-resolver": "^1.2.1",
|
||||
"@vue/runtime-core": "^3.4.21",
|
||||
"eslint": "^9.9.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-vue": "^9.27.0",
|
||||
"globals": "^15.9.0",
|
||||
"postcss-px-to-viewport": "^1.1.1",
|
||||
"postcss-px-to-viewport-8-plugin": "^1.2.5",
|
||||
"sass": "^1.32.13",
|
||||
"sass-loader": "^16.0.4",
|
||||
"unplugin-vue-components": "^0.27.5",
|
||||
"vite": "5.2.8",
|
||||
"vite-plugin-eslint": "^1.8.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
'postcss-px-to-viewport-8-plugin': {
|
||||
unitToConvert: 'px',
|
||||
viewportWidth: 375,
|
||||
unitPrecision: 5,
|
||||
propList: ['*'],
|
||||
viewportUnit: 'vw',
|
||||
fontViewportUnit: 'vw',
|
||||
selectorBlackList: [],
|
||||
minPixelValue: 1,
|
||||
mediaQuery: false,
|
||||
replace: true,
|
||||
exclude: [/node_modules\/vant/i],
|
||||
landscape: false,
|
||||
landscapeUnit: 'vw',
|
||||
landscapeWidth: 568,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
/// <reference types='@dcloudio/types' />
|
||||
import 'vue'
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
type Hooks = App.AppInstance & Page.PageInstance;
|
||||
|
||||
interface ComponentCustomOptions extends Hooks {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<script>
|
||||
export default {
|
||||
onLaunch: function () {
|
||||
console.log('App Launch')
|
||||
},
|
||||
onShow: function () {
|
||||
console.log('App Show')
|
||||
},
|
||||
onHide: function () {
|
||||
console.log('App Hide')
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/*每个页面公共css */
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 14px;
|
||||
background-color: $uni-bg-color-grey;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { createSSRApp } from 'vue'
|
||||
import pinia from './stores/index'
|
||||
import App from './App.vue'
|
||||
import 'vant/lib/index.css'
|
||||
import '@/style/vant.scss'
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(pinia)
|
||||
return {
|
||||
app,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"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
|
||||
},
|
||||
"compatible": {
|
||||
"ignoreVersion": true
|
||||
},
|
||||
/* 模块配置 */
|
||||
"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,76 @@
|
|||
{
|
||||
"pages": [
|
||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/login/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/lease-demand/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "租赁需求"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/cart/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "预约车"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/message/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "消息"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/my/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"color": "#2c2c2c",
|
||||
"selectedColor": "#00ad9d",
|
||||
"borderStyle": "black",
|
||||
"backgroundColor": "#FFFFFF",
|
||||
"iconWidth": "24px",
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/lease-demand/index",
|
||||
"text": "租赁需求"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/cart/index",
|
||||
"text": "预约车"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/message/index",
|
||||
"text": "消息"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/my/index",
|
||||
"text": "我的"
|
||||
}
|
||||
]
|
||||
},
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "#fff",
|
||||
"navigationBarTitleText": "uni-app",
|
||||
"navigationBarBackgroundColor": "#00a288",
|
||||
"backgroundColor": "#00a288"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<template>
|
||||
<!-- 预约车 -->
|
||||
<view class="content">
|
||||
<van-empty description="预约车欢迎您" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<template>
|
||||
<!-- 首页 -->
|
||||
<view class="content">
|
||||
<van-empty description="首页欢迎您" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<template>
|
||||
<!-- 租赁需求 -->
|
||||
<view class="content">
|
||||
<van-empty description="租赁需求欢迎您" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
<template>
|
||||
<!-- 登录页面 -->
|
||||
<view class="login-container flex-col-c">
|
||||
<van-form @submit="onSubmitLogin" class="login-form">
|
||||
<view class="login-title"> 欢迎登录! </view>
|
||||
<van-cell-group>
|
||||
<van-field
|
||||
v-model="username"
|
||||
name="用户名"
|
||||
placeholder="用户名"
|
||||
:rules="[{ required: true, message: '请填写用户名' }]"
|
||||
/>
|
||||
<van-field
|
||||
v-model="password"
|
||||
type="password"
|
||||
name="密码"
|
||||
placeholder="密码"
|
||||
:rules="[{ required: true, message: '请填写密码' }]"
|
||||
/>
|
||||
</van-cell-group>
|
||||
<div style="margin: 16px 0">
|
||||
<van-button
|
||||
block
|
||||
type="primary"
|
||||
size="small"
|
||||
class="primary-lease"
|
||||
native-type="onSubmitLogin"
|
||||
>
|
||||
提交
|
||||
</van-button>
|
||||
</div>
|
||||
</van-form>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
const memberStore = useMemberStore()
|
||||
import { useMemberStore } from '@/stores/index.js'
|
||||
|
||||
const username = ref('')
|
||||
const password = ref('')
|
||||
const onSubmitLogin = () => {
|
||||
uni.switchTab({ url: '/pages/index/index' })
|
||||
memberStore.setUserInfo({ token: '996', userName: username.value })
|
||||
}
|
||||
|
||||
const navBarHeight = ref(0)
|
||||
|
||||
onMounted(() => {
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
console.log(res, '当前设备--')
|
||||
// 获取状态栏高度
|
||||
const statusBarHeight = res.statusBarHeight
|
||||
// // 假设自定义导航栏高度为44px
|
||||
navBarHeight.value = statusBarHeight
|
||||
},
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.login-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
|
||||
.login-form {
|
||||
width: 100%;
|
||||
border: 1px solid #dfd8d8;
|
||||
padding: 10px;
|
||||
border-radius: $uni-border-radius-base;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
|
||||
|
||||
.login-title {
|
||||
padding: 10px 0;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<template>
|
||||
<!-- 消息 -->
|
||||
<view class="content">
|
||||
<van-empty description="消息欢迎您" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<template>
|
||||
<!-- 我的 -->
|
||||
<view class="user-info flex-row-start">
|
||||
<van-image
|
||||
round
|
||||
fit="cover"
|
||||
width="68px"
|
||||
height="68px"
|
||||
src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"
|
||||
/>
|
||||
|
||||
<view class="right-info">
|
||||
<view class="pd-t-b-4">
|
||||
{{ memberStore.userInfo.userName }}
|
||||
</view>
|
||||
<view class="pd-t-b-4"> 18640300 </view>
|
||||
<view class="pd-t-b-4"> 安徽****公司 </view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="van-hairline--top">
|
||||
<van-button type="primary" class="primary-lease" size="small" @click="onLogout">
|
||||
退出登录
|
||||
</van-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useMemberStore } from '@/stores/index.js'
|
||||
const memberStore = useMemberStore()
|
||||
const onLogout = () => {
|
||||
uni.navigateTo({ url: '/pages/login/index' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.user-info {
|
||||
height: 120px;
|
||||
padding: 0 30px;
|
||||
color: #fff;
|
||||
background-color: #00a288;
|
||||
|
||||
.right-info {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.van-hairline--top {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import { http } from '@/utils/http'
|
||||
|
||||
// 退料任务列表接口
|
||||
export const getBackList = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/back_apply_info/list',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
|
||||
// 退料任务详情接口
|
||||
export const getBackInfo = (id) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/back_apply_info/'+id
|
||||
})
|
||||
}
|
||||
|
||||
// 单位下拉选
|
||||
export const getUnitList = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/material/select/getUnitList',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
// 工程下拉选
|
||||
export const getProjectList = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/material/select/getProjectList',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
// 获取协议id
|
||||
export const getAgreementInfoById = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/material/select/getAgreementInfoById',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
|
||||
// 新增退料单
|
||||
export const insertApp = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/material/back_apply_info/insertApp',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import { http } from '@/utils/http'
|
||||
|
||||
/**
|
||||
* 登录接口
|
||||
*/
|
||||
export const appLoginAPI = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/auth/login',
|
||||
data,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
export const getUserInfoAPI = () => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/system/user/getInfo',
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
export {};
|
||||
|
||||
declare module "vue" {
|
||||
type Hooks = App.AppInstance & Page.PageInstance;
|
||||
interface ComponentCustomOptions extends Hooks {}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
|
|
@ -0,0 +1,13 @@
|
|||
import { createPinia } from 'pinia'
|
||||
import persist from 'pinia-plugin-persistedstate'
|
||||
|
||||
// 创建 pinia 实例
|
||||
const pinia = createPinia()
|
||||
// 使用持久化存储插件
|
||||
pinia.use(persist)
|
||||
|
||||
// 默认导出,给 main.js 使用
|
||||
export default pinia
|
||||
|
||||
// 模块统一导出
|
||||
export * from './modules/member'
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export const useMemberStore = defineStore(
|
||||
'member',
|
||||
() => {
|
||||
// 定义用户信息
|
||||
const userInfo = ref({ token: '', userName: '' })
|
||||
const token = ref('')
|
||||
// 存储用户信息
|
||||
const setUserInfo = (val) => {
|
||||
userInfo.value = val
|
||||
}
|
||||
// 清除用户信息
|
||||
const clearUserInfo = () => {
|
||||
userInfo.value = undefined
|
||||
}
|
||||
// 存储 token
|
||||
const setToken = (val) => {
|
||||
token.value = val
|
||||
}
|
||||
// 清除 token
|
||||
const clearToken = (val) => {
|
||||
token.value = undefined
|
||||
}
|
||||
|
||||
// 把数据和方法 return 出去
|
||||
|
||||
return {
|
||||
userInfo,
|
||||
token,
|
||||
setUserInfo,
|
||||
clearUserInfo,
|
||||
setToken,
|
||||
clearToken,
|
||||
}
|
||||
},
|
||||
|
||||
// 用户信息持久化处理
|
||||
{
|
||||
persist: {
|
||||
storage: {
|
||||
getItem(key) {
|
||||
return uni.getStorageSync(key)
|
||||
},
|
||||
setItem(key, value) {
|
||||
uni.setStorageSync(key, value)
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
.primary-lease {
|
||||
--van-button-primary-background:#00a288;
|
||||
--el-color-primary-light-3:#00ad9d;
|
||||
--el-color-primary-dark-2:#00ad9d;
|
||||
--el-color-primary-light-5:#78d3cb;
|
||||
--el-text-color-primary:#00a288;
|
||||
|
||||
}
|
||||
|
||||
.flex-row-start {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.flex-col-c {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.pd-t-b-4 {
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
// :root {
|
||||
// --van-primary-color:#00a288;
|
||||
// }
|
||||
|
|
@ -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;
|
||||
$el-color-primary:#00a288;
|
||||
|
||||
/* 文字基本颜色 */
|
||||
$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: #eeeff6;
|
||||
$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,105 @@
|
|||
import { useMemberStore } from '@/stores'
|
||||
|
||||
/**
|
||||
* 添加拦截器
|
||||
* 拦截 request 请求
|
||||
* baseURL 设置请求ip地址和端口
|
||||
*/
|
||||
const ENV = process.env.NODE_ENV
|
||||
export const baseURL = ENV === 'development' ? 'http://192.168.2.246:18080' : '***'
|
||||
// export const baseURL = ENV === 'development' ? '/api' : '***'
|
||||
/**
|
||||
* httpInterceptor 分别拦截 request 和 uploadFile 请求
|
||||
*/
|
||||
|
||||
// 添加请求拦截
|
||||
const httpInterceptor = {
|
||||
invoke(options) {
|
||||
// 1. 先判断请求 url 是否为完整的 http 请求路径 如果不是则拼接 baseURL
|
||||
if (!options.url.startsWith('http')) {
|
||||
options.url = baseURL + options.url
|
||||
}
|
||||
|
||||
// 2. 设置请求超时时间,默认为60s,设置为 10s
|
||||
options.timeout = 10000
|
||||
|
||||
// 3. 增加小程序端请求头标识
|
||||
options.header = {
|
||||
// 'source-client': 'mini',
|
||||
...options.header,
|
||||
}
|
||||
|
||||
// 4. 增加 token 请求头标识
|
||||
const memberStore = useMemberStore()
|
||||
const token = memberStore.token
|
||||
|
||||
// const token = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjQ2NDdmYjlkLWI5OTItNDRiNy05MTdkLTMwZjg0ZjUxYzM5MCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.9xM5bFhrmHK09-4ZgL5SS8WraNIJjIijuB-1P0lJF-n0KlVM5Bglvyjltk1NQbdqgi1hwRocZS1OU41cLiwuig"
|
||||
if (token) {
|
||||
options.header.Authorization = token
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
uni.addInterceptor('request', httpInterceptor)
|
||||
uni.addInterceptor('uploadFile', httpInterceptor)
|
||||
|
||||
// 设置http请求
|
||||
export const http = (options) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
...options,
|
||||
success(res) {
|
||||
console.log('res', res)
|
||||
// 1. 判断是否请求成功
|
||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||
if (res.data.code >= 200 && res.data.code < 300) {
|
||||
resolve(res.data)
|
||||
} else if (res.data.code === 401) {
|
||||
// 2. 401 表示token过期 去往登录页重新登录
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: `${res.data.msg}`,
|
||||
})
|
||||
const memberStore = useMemberStore()
|
||||
memberStore.clearUserInfo()
|
||||
memberStore.clearToken()
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
reject(res)
|
||||
} else if (res.data.code === 500) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: `${res.data.msg}`,
|
||||
})
|
||||
}
|
||||
} else if (res.statusCode === 401) {
|
||||
// 2. 401 表示token过期 去往登录页重新登录
|
||||
const memberStore = useMemberStore()
|
||||
memberStore.clearUserInfo()
|
||||
memberStore.clearToken()
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/index',
|
||||
})
|
||||
reject(res)
|
||||
} else {
|
||||
// 3. 其他错误
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请求错误',
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
// console.log(res)
|
||||
},
|
||||
fail(err) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请求失败',
|
||||
})
|
||||
console.log(err, '请求失败')
|
||||
reject(err)
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import uni from '@dcloudio/vite-plugin-uni'
|
||||
// import styleImport, { VantResolve } from 'vite-plugin-style-import'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { VantResolver } from '@vant/auto-import-resolver'
|
||||
import postcsspxtoviewport8plugin from 'postcss-px-to-viewport-8-plugin'
|
||||
// import path from 'path'
|
||||
import { resolve } from 'path'
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
uni(),
|
||||
// styleImport({
|
||||
// resolves: [VantResolve()],
|
||||
// }),
|
||||
AutoImport({
|
||||
resolvers: [VantResolver()],
|
||||
}),
|
||||
Components({
|
||||
resolvers: [VantResolver()],
|
||||
}),
|
||||
require('postcss-px-to-viewport'),
|
||||
],
|
||||
resolve: {
|
||||
api: 'modern-compiler',
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src'),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
// 在此处编写代理规则
|
||||
'/api': {
|
||||
// target: 'http://192.168.2.76:18080',
|
||||
// target: 'http://192.168.2.246:18080',
|
||||
target: 'http://localhost:18080',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => {
|
||||
return path.replace(/\/api/, '')
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
css: {
|
||||
postcss: {
|
||||
plugins: [
|
||||
postcsspxtoviewport8plugin({
|
||||
unitToConvert: 'px',
|
||||
viewportWidth: 375,
|
||||
unitPrecision: 5, // 单位转换后保留的精度
|
||||
propList: ['*'], // 能转化为vw的属性列表
|
||||
viewportUnit: 'vw', // 希望使用的视口单位
|
||||
fontViewportUnit: 'vw', // 字体使用的视口单位
|
||||
selectorBlackList: [], // 需要忽略的CSS选择器,不会转为视口单位,使用原有的px等单位。
|
||||
minPixelValue: 1, // 设置最小的转换数值,如果为1的话,只有大于1的值会被转换
|
||||
mediaQuery: true, // 媒体查询里的单位是否需要转换单位
|
||||
replace: true, // 是否直接更换属性值,而不添加备用属性
|
||||
exclude: [/node_modules\/vant/i], // 忽略某些文件夹下的文件或特定文件,例如 'node_modules' 下的文件
|
||||
include: [], // 如果设置了include,那将只有匹配到的文件才会被转换
|
||||
landscape: false, // 是否添加根据 landscapeWidth 生成的媒体查询条件 @media (orientation: landscape)
|
||||
landscapeUnit: 'vw', // 横屏时使用的单位
|
||||
landscapeWidth: 1024, // 横屏时使用的视口宽度
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
Loading…
Reference in New Issue