项目初始化
This commit is contained in:
commit
bccee09f4f
|
|
@ -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,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,37 @@
|
|||
# uni-app-temp
|
||||
|
||||
#### 介绍
|
||||
h5、小程序、app多端兼容框架 vue3+uView-Plus组件库
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
|
@ -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-4040520250104002",
|
||||
"@dcloudio/uni-app-harmony": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-app-plus": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-components": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-h5": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-mp-alipay": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-mp-baidu": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-mp-jd": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-mp-lark": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-mp-qq": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-mp-xhs": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4040520250104002",
|
||||
"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.11",
|
||||
"vue-i18n": "^9.1.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dcloudio/types": "^3.4.8",
|
||||
"@dcloudio/uni-automator": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-4040520250104002",
|
||||
"@dcloudio/uni-stacktracey": "3.0.0-4040520250104002",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-4040520250104002",
|
||||
"@eslint/js": "^9.17.0",
|
||||
"@vue/runtime-core": "^3.4.21",
|
||||
"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,18 @@
|
|||
<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';
|
||||
</style>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { createSSRApp } from 'vue'
|
||||
import uviewPlus from 'uview-plus'
|
||||
import pinia from './stores/index'
|
||||
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,
|
||||
"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" : {
|
||||
"router" : {
|
||||
"mode" : "history",
|
||||
"base" : "/option/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"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/index/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "意见收集"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/opinion/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "意见收集"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "uni-app",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,216 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<!-- 意见收集 -->
|
||||
<template v-if="!isSuccess">
|
||||
<up-form
|
||||
labelPosition="top"
|
||||
:model="opinionModel"
|
||||
ref="opinionModelRef"
|
||||
:rules="opinionRules"
|
||||
labelWidth="auto"
|
||||
class="opinion-form"
|
||||
>
|
||||
<up-form-item label="姓名" prop="userName" required>
|
||||
<up-input
|
||||
v-model="opinionModel.userName"
|
||||
class="input-content"
|
||||
placeholder="填写姓名"
|
||||
/>
|
||||
</up-form-item>
|
||||
<up-form-item label="电话" prop="userPhone" required>
|
||||
<up-input
|
||||
v-model="opinionModel.userPhone"
|
||||
class="input-content"
|
||||
placeholder="填写电话"
|
||||
/>
|
||||
</up-form-item>
|
||||
<up-form-item label="意见归属单位/部门" prop="userCompany">
|
||||
<up-input
|
||||
v-model="opinionModel.unit"
|
||||
class="input-content"
|
||||
placeholder="填写归属单位/部门"
|
||||
/>
|
||||
</up-form-item>
|
||||
<up-form-item label="意见" prop="options" required>
|
||||
<up-textarea
|
||||
v-model="opinionModel.options"
|
||||
placeholder="请输入内容"
|
||||
class="input-content"
|
||||
style="min-height: 30vh"
|
||||
/>
|
||||
</up-form-item>
|
||||
|
||||
<up-button
|
||||
type="primary"
|
||||
text="提交意见"
|
||||
style="margin-top: 30rpx"
|
||||
@tap="onSubmitOptions"
|
||||
/>
|
||||
</up-form>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<view class="success-container">
|
||||
<up-icon name="checkbox-mark" color="#2979ff" size="80" bold="true"></up-icon>
|
||||
<text class="success">提交成功</text>
|
||||
<text class="thanks">感谢您宝贵的意见</text>
|
||||
</view>
|
||||
<view style="width: 100vw">
|
||||
<up-button
|
||||
type="primary"
|
||||
text="返回"
|
||||
@tap="onContinueFill"
|
||||
style="width: 95%; margin: 30rpx auto"
|
||||
/>
|
||||
<!-- <up-button
|
||||
text="退出"
|
||||
:plain="true"
|
||||
type="primary"
|
||||
@tap="onExit"
|
||||
style="width: 95%; margin: 0 auto"
|
||||
/> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<up-modal
|
||||
:show="showModal"
|
||||
title="温馨提示"
|
||||
content="是否确认退出?"
|
||||
showCancelButton
|
||||
@confirm="onConfirm"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { submitOptionsApi } from '@/services/options.js'
|
||||
import { ref } from 'vue'
|
||||
|
||||
// 表单数据源
|
||||
const opinionModel = ref({
|
||||
userName: '',
|
||||
userPhone: '',
|
||||
unit: '',
|
||||
options: '',
|
||||
})
|
||||
const opinionRules = ref({
|
||||
userName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写姓名',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
userPhone: [
|
||||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写电话',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
|
||||
{
|
||||
pattern: /^1[3-9]\d{9}$/,
|
||||
// 正则检验前先将值转为字符串
|
||||
transform(value) {
|
||||
return String(value)
|
||||
},
|
||||
message: '请填写正确的手机号码',
|
||||
},
|
||||
],
|
||||
options: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写意见',
|
||||
trigger: ['blur', 'change'],
|
||||
max: 500,
|
||||
},
|
||||
})
|
||||
|
||||
// 表单实例
|
||||
const opinionModelRef = ref(null)
|
||||
|
||||
// 是否提交成功
|
||||
const isSuccess = ref(false)
|
||||
|
||||
// 提示弹框
|
||||
const showModal = ref(false)
|
||||
|
||||
// 提交按钮
|
||||
const onSubmitOptions = () => {
|
||||
opinionModelRef.value
|
||||
.validate()
|
||||
.then(async (valid) => {
|
||||
if (valid) {
|
||||
console.log('opinionModel.value', opinionModel.value)
|
||||
const res = await submitOptionsApi(opinionModel.value)
|
||||
|
||||
if (res.code === 0) {
|
||||
uni.$u.toast('提交成功')
|
||||
isSuccess.value = true
|
||||
opinionModel.value.options = ''
|
||||
opinionModel.value.userPhone = ''
|
||||
opinionModel.value.userName = ''
|
||||
opinionModel.value.unit = ''
|
||||
} else {
|
||||
uni.$u.toast(res.msg + '提交失败')
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 处理验证错误
|
||||
})
|
||||
}
|
||||
|
||||
// 继续填写
|
||||
const onContinueFill = () => {
|
||||
isSuccess.value = false
|
||||
}
|
||||
// 退出
|
||||
const onExit = () => {
|
||||
showModal.value = true
|
||||
}
|
||||
|
||||
// 确认退出
|
||||
const onConfirm = () => {
|
||||
uni.redirectTo({ url: '/pages/index/index' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
::v-deep .opinion-form {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.input-content {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.success-container {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 120rpx 0;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
|
||||
.success {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.thanks {
|
||||
font-size: 13px;
|
||||
padding: 10rpx 0;
|
||||
color: #848181;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<!-- 意见收集 -->
|
||||
<template v-if="!isSuccess">
|
||||
<up-form
|
||||
labelPosition="top"
|
||||
:model="opinionModel"
|
||||
ref="opinionModelRef"
|
||||
:rules="opinionRules"
|
||||
labelWidth="auto"
|
||||
class="opinion-form"
|
||||
>
|
||||
<up-form-item label="姓名" prop="userName" required>
|
||||
<up-input
|
||||
v-model="opinionModel.userName"
|
||||
class="input-content"
|
||||
placeholder="填写姓名"
|
||||
/>
|
||||
</up-form-item>
|
||||
<up-form-item label="电话" prop="userPhone" required>
|
||||
<up-input
|
||||
v-model="opinionModel.userPhone"
|
||||
class="input-content"
|
||||
placeholder="填写电话"
|
||||
/>
|
||||
</up-form-item>
|
||||
<up-form-item label="意见归属单位/部门" prop="userCompany">
|
||||
<up-input
|
||||
v-model="opinionModel.unit"
|
||||
class="input-content"
|
||||
placeholder="填写归属单位/部门"
|
||||
/>
|
||||
</up-form-item>
|
||||
<up-form-item label="意见" prop="options" required>
|
||||
<up-textarea
|
||||
v-model="opinionModel.options"
|
||||
placeholder="请输入内容"
|
||||
class="input-content"
|
||||
style="min-height: 30vh"
|
||||
/>
|
||||
</up-form-item>
|
||||
|
||||
<up-button
|
||||
type="primary"
|
||||
text="提交意见"
|
||||
style="margin-top: 30rpx"
|
||||
@tap="onSubmitOptions"
|
||||
></up-button>
|
||||
</up-form>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<view class="success-container">
|
||||
<up-icon name="checkbox-mark" color="#2979ff" size="80" bold="true"></up-icon>
|
||||
<text class="success">提交成功</text>
|
||||
<text class="thanks">感谢您宝贵的意见</text>
|
||||
</view>
|
||||
<view style="width: 100vw">
|
||||
<up-button
|
||||
type="primary"
|
||||
text="继续填写"
|
||||
@tap="onContinueFill"
|
||||
style="width: 95%; margin: 30rpx auto"
|
||||
/>
|
||||
<up-button
|
||||
text="退出"
|
||||
:plain="true"
|
||||
type="primary"
|
||||
@tap="onExit"
|
||||
style="width: 95%; margin: 0 auto"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<up-modal
|
||||
:show="showModal"
|
||||
title="温馨提示"
|
||||
content="是否确认退出?"
|
||||
showCancelButton
|
||||
@confirm="onConfirm"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { submitOptionsApi } from '@/services/options.js'
|
||||
import { ref } from 'vue'
|
||||
|
||||
console.log('submitOptionsApi', submitOptionsApi)
|
||||
|
||||
// 表单数据源
|
||||
const opinionModel = ref({
|
||||
userName: '',
|
||||
userPhone: '',
|
||||
unit: '',
|
||||
options: '',
|
||||
})
|
||||
const opinionRules = ref({
|
||||
userName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写姓名',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
userPhone: [
|
||||
{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写电话',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
|
||||
{
|
||||
pattern: /^1[3-9]\d{9}$/,
|
||||
// 正则检验前先将值转为字符串
|
||||
transform(value) {
|
||||
return String(value)
|
||||
},
|
||||
message: '请填写正确的手机号码',
|
||||
},
|
||||
],
|
||||
options: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写意见',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
})
|
||||
|
||||
// 表单实例
|
||||
const opinionModelRef = ref(null)
|
||||
|
||||
// 是否提交成功
|
||||
const isSuccess = ref(false)
|
||||
|
||||
// 提示弹框
|
||||
const showModal = ref(false)
|
||||
|
||||
// 提交按钮
|
||||
const onSubmitOptions = () => {
|
||||
opinionModelRef.value
|
||||
.validate()
|
||||
.then(async (valid) => {
|
||||
if (valid) {
|
||||
console.log('opinionModel.value', opinionModel.value)
|
||||
const res = await submitOptionsApi(opinionModel.value)
|
||||
|
||||
if (res.code === 0) {
|
||||
uni.$u.toast('提交成功')
|
||||
isSuccess.value = true
|
||||
opinionModel.value.options = ''
|
||||
opinionModel.value.userPhone = ''
|
||||
opinionModel.value.userName = ''
|
||||
opinionModel.value.unit = ''
|
||||
} else {
|
||||
uni.$u.toast(res.msg + '提交失败')
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 处理验证错误
|
||||
})
|
||||
}
|
||||
|
||||
// 继续填写
|
||||
const onContinueFill = () => {
|
||||
isSuccess.value = false
|
||||
}
|
||||
// 退出
|
||||
const onExit = () => {
|
||||
showModal.value = true
|
||||
}
|
||||
|
||||
// 确认退出
|
||||
const onConfirm = () => {
|
||||
uni.redirectTo({ url: '/pages/index/index' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
::v-deep .opinion-form {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.input-content {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.success-container {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 120rpx 0;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
|
||||
.success {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.thanks {
|
||||
font-size: 13px;
|
||||
padding: 10rpx 0;
|
||||
color: #848181;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { http } from '@/utils/http'
|
||||
|
||||
// 提交意见接口
|
||||
export const submitOptionsApi = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/manager/option/addOption',
|
||||
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: 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,105 @@
|
|||
import { useMemberStore } from '@/stores'
|
||||
|
||||
console.log('useMemberStore()', useMemberStore())
|
||||
|
||||
/**
|
||||
* 添加拦截器
|
||||
* 拦截 request 请求
|
||||
* baseURL 设置请求ip地址和端口
|
||||
*/
|
||||
const ENV = process.env.NODE_ENV
|
||||
const baseURL = ENV === 'development' ? 'http://192.168.0.38:8080' : 'http://192.168.0.14:21666'
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
resolve(res.data)
|
||||
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.38:8080', // 测试服务
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => {
|
||||
return path.replace(/\/api/, '')
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
Loading…
Reference in New Issue