项目初始化
This commit is contained in:
commit
6059ed81f6
|
|
@ -0,0 +1,3 @@
|
|||
# eslint检验排除的文件
|
||||
/public
|
||||
**/index.js
|
||||
|
|
@ -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,9 @@
|
|||
{
|
||||
"version" : "1.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"playground" : "standard",
|
||||
"type" : "uni-app:app-android"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"tabWidth": 4,
|
||||
"singleQuote": true,
|
||||
"semi": false,
|
||||
"printWidth": 100,
|
||||
"trailingComma": "all",
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
# uni-app-temp
|
||||
|
||||
#### Description
|
||||
h5、小程序、app多端兼容框架 vue3+uView-Plus组件库
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# uni-app-temp
|
||||
|
||||
#### 介绍
|
||||
|
||||
h5、小程序、app多端兼容 vue3+uView-Plus组件库
|
||||
|
||||
#### 软件架构
|
||||
|
||||
软件架构说明
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. 切换 node 版本 18+
|
||||
2. npm install
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. npm run dev
|
||||
2. npm run build:h5 //h5打包
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
// import globals from "globals";
|
||||
// import pluginJs from "@eslint/js";
|
||||
// import pluginVue from "eslint-plugin-vue";
|
||||
|
||||
// /** @type {import('eslint').Linter.Config[]} */
|
||||
// export default [
|
||||
// {files: ["**/*.{js,mjs,cjs,vue}"]},
|
||||
// {languageOptions: { globals: {...globals.browser, ...globals.node} }},
|
||||
// pluginJs.configs.recommended,
|
||||
// ...pluginVue.configs["flat/essential"],
|
||||
// ];
|
||||
|
||||
/* 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,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<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.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
"name": "uni-preset-vue",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"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: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-4050720250324001",
|
||||
"@dcloudio/uni-app-harmony": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-app-plus": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-components": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-h5": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-mp-alipay": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-mp-baidu": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-mp-jd": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-mp-lark": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-mp-qq": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-mp-xhs": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4050720250324001",
|
||||
"clipboard": "^2.0.11",
|
||||
"dayjs": "^1.11.13",
|
||||
"pinia": "^2.3.0",
|
||||
"pinia-plugin-persistedstate": "^4.2.0",
|
||||
"uview-plus": "^3.3.62",
|
||||
"vue": "3.5.13",
|
||||
"vue-i18n": "9.14.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dcloudio/types": "3.4.14",
|
||||
"@dcloudio/uni-automator": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-4050720250324001",
|
||||
"@dcloudio/uni-stacktracey": "3.0.0-4050720250324001",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-4050720250324001",
|
||||
"@eslint/js": "^9.17.0",
|
||||
"@vue/runtime-core": "3.5.13",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-vue": "^9.32.0",
|
||||
"globals": "^15.14.0",
|
||||
"prettier": "^3.4.2",
|
||||
"sass": "^1.63.2",
|
||||
"sass-loader": "^10.4.1",
|
||||
"vite": "5.2.8",
|
||||
"vite-plugin-eslint": "^1.8.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"appid": "wxac5c134e590200bf",
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "3.7.4",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"coverView": true,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"enhance": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"packNpmRelationList": [],
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||
"projectname": "my-vue3-project",
|
||||
"setting": {
|
||||
"compileHotReLoad": true
|
||||
}
|
||||
}
|
||||
|
|
@ -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">
|
||||
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
|
||||
@import 'uview-plus/index.scss';
|
||||
|
||||
page {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { createSSRApp } from 'vue'
|
||||
import pinia from './stores/index'
|
||||
import uviewPlus from 'uview-plus'
|
||||
import App from './App.vue'
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(pinia)
|
||||
app.use(uviewPlus)
|
||||
return {
|
||||
app,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"name": "项目全过程影像管理工具",
|
||||
"appid": "",
|
||||
"description": "",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"compatible": {
|
||||
"ignoreVersion": true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
|
||||
},
|
||||
"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,
|
||||
"mergeVirtualHostAttributes": true
|
||||
},
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true,
|
||||
"mergeVirtualHostAttributes": true
|
||||
},
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
},
|
||||
"vueVersion": "3",
|
||||
"h5": {
|
||||
"title": ""
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
// 注意一定要放在custom里,否则无效,https://ask.dcloud.net.cn/question/131175
|
||||
"custom": {
|
||||
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
|
||||
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
|
||||
}
|
||||
},
|
||||
"pages": [
|
||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/login/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "项目全过程影像管理工具"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/workbenches/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "工作台"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/my/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "#333",
|
||||
"navigationBarTitleText": "项目全过程影像管理工具",
|
||||
"navigationBarBackgroundColor": "#F5F4F5",
|
||||
"backgroundColor": "#F5F4F5"
|
||||
},
|
||||
"tabBar": {
|
||||
"color": "#999", // 未选中时的文字颜色
|
||||
"selectedColor": "#2878ff", // 选中时的文字颜色
|
||||
"backgroundColor": "#FFF", // TabBar 背景色
|
||||
"borderStyle": "black", // 上边框颜色(可选)
|
||||
"list": [
|
||||
{
|
||||
"pagePath": "pages/workbenches/index", // 页面路径(必须已在 pages 中定义)
|
||||
"text": "工作台", // 显示的文字
|
||||
"iconPath": "static/image/workbenches.png", // 未选中时的图标
|
||||
"selectedIconPath": "static/image/workbenchesSelected.png" // 选中时的图标
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/my/index",
|
||||
"text": "我的",
|
||||
"iconPath": "static/image/my.png",
|
||||
"selectedIconPath": "static/image/mySelected.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
<template>
|
||||
<!-- 登录页面 -->
|
||||
<view class="login-container">
|
||||
<!-- 背景图 -->
|
||||
<up-image
|
||||
src="../../static/image/bg_new.png"
|
||||
height="240"
|
||||
width="335"
|
||||
mode="scaleToFill"
|
||||
style="margin-top: 30rpx"
|
||||
/>
|
||||
<!-- 表单 -->
|
||||
<up-form
|
||||
:model="opinionModel"
|
||||
ref="loginModelRef"
|
||||
:rules="opinionRules"
|
||||
labelWidth="auto"
|
||||
class="opinion-form"
|
||||
>
|
||||
<up-form-item prop="username">
|
||||
<up-input
|
||||
clearable
|
||||
prefixIcon="account"
|
||||
placeholder="填输入登录手机号"
|
||||
v-model="opinionModel.username"
|
||||
/>
|
||||
</up-form-item>
|
||||
<up-form-item prop="password">
|
||||
<up-input
|
||||
clearable
|
||||
prefixIcon="lock"
|
||||
placeholder="填输入密码"
|
||||
v-model="opinionModel.password"
|
||||
/>
|
||||
</up-form-item>
|
||||
|
||||
<up-form-item>
|
||||
<up-button type="primary" text="登录" @tap="onSubmitLogin" shape="circle" />
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { loginApi } from '@/services/login.js'
|
||||
|
||||
// 表单数据源
|
||||
const opinionModel = ref({
|
||||
userName: '',
|
||||
password: '',
|
||||
})
|
||||
|
||||
const opinionRules = ref({
|
||||
username: [
|
||||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写登录手机号',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
// {
|
||||
// pattern: /^[\u4e00-\u9fa5]{2,6}$/,
|
||||
// // 正则检验前先将值转为字符串
|
||||
// transform(value) {
|
||||
// return String(value)
|
||||
// },
|
||||
// message: '请填写正确的姓名',
|
||||
// },
|
||||
],
|
||||
password: [
|
||||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写登录密码',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
// 表单实例
|
||||
const loginModelRef = ref(null)
|
||||
|
||||
// 是否提交成功
|
||||
const isSuccess = ref(false)
|
||||
|
||||
// 提示弹框
|
||||
const showModal = ref(false)
|
||||
|
||||
// 提交按钮
|
||||
const onSubmitLogin = () => {
|
||||
loginModelRef.value
|
||||
.validate()
|
||||
.then(async (valid) => {
|
||||
if (valid) {
|
||||
uni.$u.toast('登录成功')
|
||||
setTimeout(() => {
|
||||
// uni.switchTab({ url: '/pages/workbenches/index' })
|
||||
uni.switchTab({ url: '/pages/workbenches/index' })
|
||||
}, 500)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 处理验证错误
|
||||
})
|
||||
}
|
||||
|
||||
// 继续填写
|
||||
const onContinueFill = () => {
|
||||
isSuccess.value = false
|
||||
}
|
||||
// 退出
|
||||
const onExit = () => {
|
||||
showModal.value = true
|
||||
}
|
||||
|
||||
// 确认退出
|
||||
const onConfirm = () => {
|
||||
uni.redirectTo({ url: '/pages/index/index' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.login-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.opinion-form {
|
||||
width: 90%;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .u-form-item__body__right__message {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<template>
|
||||
<!-- 我的 -->
|
||||
<view class="my-container">
|
||||
<view class="my-info">
|
||||
<up-image
|
||||
width="52"
|
||||
height="52"
|
||||
shape="circle"
|
||||
src="https://fc1tn.baidu.com/it/u=1461702690,89837040&fm=202&mola=new&crop=v1"
|
||||
/>
|
||||
|
||||
<view class="my-info-right">
|
||||
<view class="my-info-name">
|
||||
<text>用户名</text>
|
||||
<text class="my-info-name-job">项目经理</text>
|
||||
</view>
|
||||
<view style="color: #999"> 139****5213 </view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<up-cell-group>
|
||||
<up-cell size="large" title="修改密码" isLink />
|
||||
</up-cell-group>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.my-container {
|
||||
height: 100%;
|
||||
background-color: #f0f2f5;
|
||||
.my-info {
|
||||
padding: 42rpx 0 42rpx 42rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
|
||||
.my-info-right {
|
||||
margin-left: 12rpx;
|
||||
font-size: 14px;
|
||||
.my-info-name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.my-info-name-job {
|
||||
padding: 0 20rpx;
|
||||
height: 40rpx;
|
||||
margin-left: 12rpx;
|
||||
line-height: 40rpx;
|
||||
background-color: #fff7eb;
|
||||
border: 1px solid #fe9400;
|
||||
font-size: 12px;
|
||||
color: #fe9400;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
& text {
|
||||
color: #333030;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<template>
|
||||
<view class="workbenches-container"> </view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #f5f5f5;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { http } from '@/utils/http'
|
||||
|
||||
// 登录接口
|
||||
export const loginApi = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/***',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -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: 41 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
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,77 @@
|
|||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export const useMemberStore = defineStore(
|
||||
'member',
|
||||
() => {
|
||||
// 定义用户信息
|
||||
const userInfo = ref({})
|
||||
const token = ref('')
|
||||
const userType = ref(1)
|
||||
const companyList = ref([])
|
||||
const userCompanyName = ref()
|
||||
|
||||
// 存储用户信息
|
||||
const setUserInfo = (val) => {
|
||||
userInfo.value = val
|
||||
}
|
||||
// 清除用户信息
|
||||
const clearUserInfo = () => {
|
||||
userInfo.value = undefined
|
||||
token.value = ''
|
||||
userType.value = 1
|
||||
companyList.value = []
|
||||
userCompanyName.value = ''
|
||||
}
|
||||
// 存储 token
|
||||
const setToken = (val) => {
|
||||
token.value = val
|
||||
}
|
||||
// 清除 token
|
||||
const clearToken = (val) => {
|
||||
token.value = undefined
|
||||
}
|
||||
// 切换用户角色
|
||||
const editUserType = (val) => {
|
||||
userType.value = val
|
||||
}
|
||||
// 存储公司列表
|
||||
const setCompanyList = (list) => {
|
||||
companyList.value = list
|
||||
}
|
||||
// 存储公司名称
|
||||
const setCompanyName = (name) => {
|
||||
userCompanyName.value = name
|
||||
}
|
||||
|
||||
// 把数据和方法 return 出去
|
||||
return {
|
||||
userInfo,
|
||||
token,
|
||||
userType,
|
||||
companyList,
|
||||
userCompanyName,
|
||||
setToken,
|
||||
clearToken,
|
||||
setUserInfo,
|
||||
editUserType,
|
||||
setCompanyName,
|
||||
clearUserInfo,
|
||||
setCompanyList,
|
||||
}
|
||||
},
|
||||
|
||||
// 用户信息持久化处理
|
||||
{
|
||||
persist: {
|
||||
storage: {
|
||||
getItem(key) {
|
||||
return uni.getStorageSync(key)
|
||||
},
|
||||
setItem(key, value) {
|
||||
uni.setStorageSync(key, value)
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
|
||||
/* 颜色变量 */
|
||||
|
||||
/* uni.scss */
|
||||
@import 'uview-plus/theme.scss';
|
||||
|
||||
/* 行为相关颜色 */
|
||||
$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,101 @@
|
|||
import { useMemberStore } from '@/stores'
|
||||
|
||||
/**
|
||||
* 添加拦截器
|
||||
* 拦截 request 请求
|
||||
* baseURL 设置请求ip地址和端口
|
||||
*/
|
||||
const ENV = process.env.NODE_ENV
|
||||
const baseURL = ENV === 'development' ? '/api' : '/proxyApi'
|
||||
/**
|
||||
* 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
|
||||
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) {
|
||||
// 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,18 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import uni from '@dcloudio/vite-plugin-uni'
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
server: {
|
||||
proxy: {
|
||||
// 在此处编写代理规则
|
||||
'/api': {
|
||||
target: 'http://192.168.0.244:28580', // 测试服务
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => {
|
||||
return path.replace(/\/api/, '')
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
Loading…
Reference in New Issue