Compare commits
7 Commits
166bf82b3f
...
c05a448e05
| Author | SHA1 | Date |
|---|---|---|
|
|
c05a448e05 | |
|
|
1d51fdf078 | |
|
|
1a40b0ad77 | |
|
|
23b0c51460 | |
|
|
99cdc25e80 | |
|
|
82ca8b7b3d | |
|
|
9227d2383d |
152
CHANGELOG.md
152
CHANGELOG.md
|
|
@ -1,152 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
## [2.5.5](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.5.4...v2.5.5) (2023-10-18)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 🚀 修复在 app 端环境下路由插件系统使用异常的问题 ([894ca30](https://github.com/viarotel-org/vite-uniapp-template/commit/894ca308d236fce5846e8348590cfbe1c01838c6))
|
|
||||||
|
|
||||||
## [2.5.4](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.5.3...v2.5.4) (2023-09-21)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 🔧 修复小程序端某些样式不生效的问题 ([e532395](https://github.com/viarotel-org/vite-uniapp-template/commit/e5323955809cf57d733064dfa2ebc14cc6f8f37f))
|
|
||||||
|
|
||||||
## [2.5.3](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.5.2...v2.5.3) (2023-09-14)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 🐛 修复小程序环境打包失败的问题 ([14c9645](https://github.com/viarotel-org/vite-uniapp-template/commit/14c9645d3c4b3abd248816087b3edd16e9973fc1))
|
|
||||||
|
|
||||||
## [2.5.2](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.5.1...v2.5.2) (2023-09-09)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 🔧 修复 uni-network 格式化参数的行为与 axios不一致的问题 ([00af3bf](https://github.com/viarotel-org/vite-uniapp-template/commit/00af3bfc50844ae45d5e860d86bf9aeabf3791d1))
|
|
||||||
* 🔧 修复打包后由于方法名混淆导致路由中间件无法匹配触发的问题 ([37515aa](https://github.com/viarotel-org/vite-uniapp-template/commit/37515aa0f526ae3810a979a347cc997443061fe4))
|
|
||||||
* 🔧 固定 qs 版本以解决不兼容微信小程序的问题 ([95f733e](https://github.com/viarotel-org/vite-uniapp-template/commit/95f733e8492e13688054739e6144b4fb39544696))
|
|
||||||
|
|
||||||
## [2.5.1](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.5.0...v2.5.1) (2023-09-09)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 🗑️ 去除登录页面冗余的空白顶栏 ([25bc3bd](https://github.com/viarotel-org/vite-uniapp-template/commit/25bc3bda88e8da69f8122e7b3e75422560f0b23e))
|
|
||||||
|
|
||||||
## [2.5.0](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.4.0...v2.5.0) (2023-09-09)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* 🚀 添加跳转外部网页功能 ([8d062a9](https://github.com/viarotel-org/vite-uniapp-template/commit/8d062a9d86126980181fb6e9ab0ca289f93b8c66))
|
|
||||||
|
|
||||||
## [2.4.0](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.3.3...v2.4.0) (2023-09-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* 🚀 对部分页面样式进行改进并去除冗余的控制台输出 ([e73ba19](https://github.com/viarotel-org/vite-uniapp-template/commit/e73ba1933c594ecc5e8ad0317d6d35345f9e972f))
|
|
||||||
|
|
||||||
## [2.3.3](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.3.2...v2.3.3) (2023-09-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 📈 修复入口页面模块引用格式不统一的问题 ([bd72731](https://github.com/viarotel-org/vite-uniapp-template/commit/bd72731cf866940aa4a4e1d84795bc035be05b8c))
|
|
||||||
|
|
||||||
## [2.3.2](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.3.1...v2.3.2) (2023-09-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 🔧 修复同步脚本错误的问题 ([73d802a](https://github.com/viarotel-org/vite-uniapp-template/commit/73d802abf100f853ae1c1f41a650090a483bfa3c))
|
|
||||||
|
|
||||||
## [2.3.1](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.3.0...v2.3.1) (2023-09-07)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 📝 修复文档描述错误 ([3325235](https://github.com/viarotel-org/vite-uniapp-template/commit/3325235dac5f0dac5301cbbafff111c1509548de))
|
|
||||||
|
|
||||||
## [2.3.0](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.2.1...v2.3.0) (2023-09-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* 🎨 主题色定制相关配置功能更新 ([bcadbfa](https://github.com/viarotel-org/vite-uniapp-template/commit/bcadbfaf583a283804bd1ebdd6b5846ae11f0fb0))
|
|
||||||
|
|
||||||
## [2.2.1](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.2.0...v2.2.1) (2023-09-01)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 🔧 修复使用 yarn 作为包管理器时启动项目报错的问题 ([1778bb9](https://github.com/viarotel-org/vite-uniapp-template/commit/1778bb9c4b56e097ba5cadc1ae6e37fd89357ca8))
|
|
||||||
|
|
||||||
## [2.2.0](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.1.1...v2.2.0) (2023-08-29)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* 🚀 登录示例页面调整 ([a0c1688](https://github.com/viarotel-org/vite-uniapp-template/commit/a0c16881e36e836ee7d9215dfec4615e1984a2bb))
|
|
||||||
|
|
||||||
## [2.1.1](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.1.0...v2.1.1) (2023-08-29)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* bugfix ([9757722](https://github.com/viarotel-org/vite-uniapp-template/commit/97577229d7999f10a9efdcb3ef08efa8a3328cde))
|
|
||||||
|
|
||||||
|
|
||||||
### Performance Improvements
|
|
||||||
|
|
||||||
* 🚀 去除冗余的默认导出以降低生产包大小 ([88a529a](https://github.com/viarotel-org/vite-uniapp-template/commit/88a529a51541210c6a030fbb56ebc044173c0c28))
|
|
||||||
|
|
||||||
## [2.1.0](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.0.1...v2.1.0) (2023-08-28)
|
|
||||||
|
|
||||||
|
|
||||||
### Miscellaneous Chores
|
|
||||||
|
|
||||||
* release 2.1.0 ([ccc4cb1](https://github.com/viarotel-org/vite-uniapp-template/commit/ccc4cb19295420b632f61ae4e5424809e55dc7b8))
|
|
||||||
|
|
||||||
## [2.0.1](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.0.0...v2.0.1) (2023-08-14)
|
|
||||||
|
|
||||||
|
|
||||||
### Performance Improvements
|
|
||||||
|
|
||||||
* 🔧 调整路由导出方式以简化路由中间件定义方式 ([d0f9015](https://github.com/viarotel-org/vite-uniapp-template/commit/d0f901526adeed8ab60898a18d5ade046f14ceeb))
|
|
||||||
|
|
||||||
## [2.0.0](https://github.com/viarotel-org/vite-uniapp-template/compare/v2.0.0...v2.0.0) (2023-08-09)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* ✨ 样式优化及调整 ([c3d4a56](https://github.com/viarotel-org/vite-uniapp-template/commit/c3d4a56e836f4af4cc1d929d16f9b46319c69617))
|
|
||||||
* feat ([19894dc](https://github.com/viarotel-org/vite-uniapp-template/commit/19894dcbd075ba5181372df19c4e6c2387afa120))
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* :bug: bugfix ([2bf4391](https://github.com/viarotel-org/vite-uniapp-template/commit/2bf4391b96bd0b2e94acfcf7ee36a757d02808aa))
|
|
||||||
* :bug: 修复 uni-vite-plugin-h5-prod-effect 导致 h5 打包后无法正常运行的问题 ([cfe09f6](https://github.com/viarotel-org/vite-uniapp-template/commit/cfe09f65eecc4d9e1f7867a4280e2a54feb10158))
|
|
||||||
* 🐛 bugfix ([deaa1ec](https://github.com/viarotel-org/vite-uniapp-template/commit/deaa1ec2f283d9d54eb63e852ae1e30edb454dc1))
|
|
||||||
* 📝 bugfix ([91ed0eb](https://github.com/viarotel-org/vite-uniapp-template/commit/91ed0eb09ee84dd62769a00293667ea9d6ce5622))
|
|
||||||
* 📝 修复路由文件缺失导致报错的问题 ([4d51094](https://github.com/viarotel-org/vite-uniapp-template/commit/4d5109473f16c24530b797cd9aa6e48f36d862e9))
|
|
||||||
|
|
||||||
### Performance Improvements
|
|
||||||
|
|
||||||
* :ambulance: 减少生产环境下包大小 ([e1b67c6](https://github.com/viarotel-org/vite-uniapp-template/commit/e1b67c6fff1a2add11f498a0eba7bff70f794e4c))
|
|
||||||
* :memo: ([dd8dcf5](https://github.com/viarotel-org/vite-uniapp-template/commit/dd8dcf598dec5721e27c3e953535f33af1a627c1))
|
|
||||||
* 🎉 路由相关代码逻辑优化 ([101f828](https://github.com/viarotel-org/vite-uniapp-template/commit/101f828fcfdc8cdb04e29f6320d775fe84a2bfac))
|
|
||||||
* 📝 去除冗余代码 ([6cc02e9](https://github.com/viarotel-org/vite-uniapp-template/commit/6cc02e9baa3933695215a11457253b9cdcf2e2bd))
|
|
||||||
* 📝 去除冗余依赖 ([c98f33e](https://github.com/viarotel-org/vite-uniapp-template/commit/c98f33ef7e897640fa0b08fd1fda9dc9d5ed61e1))
|
|
||||||
* perf ([a48a7fc](https://github.com/viarotel-org/vite-uniapp-template/commit/a48a7fc7875f81a1e4d299004c69b7dafde29b99))
|
|
||||||
* 图标组件性能优化 ([1d2d89d](https://github.com/viarotel-org/vite-uniapp-template/commit/1d2d89d3708a72989a7fb4795a7c10d4ea076987))
|
|
||||||
|
|
||||||
|
|
||||||
### Miscellaneous Chores
|
|
||||||
|
|
||||||
* release 2.0.0 ([9990344](https://github.com/viarotel-org/vite-uniapp-template/commit/9990344751ab75dc77d2a1d7b00873b02148e656))
|
|
||||||
21
LICENSE
21
LICENSE
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2023 viarotel
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
274
README.md
274
README.md
|
|
@ -1,274 +0,0 @@
|
||||||
## 特点
|
|
||||||
|
|
||||||
- 💪 Assets: 提供了全局静态资源加载工具,无感切换加载本地静态资源/远程静态资源,解决小程序环境下包大小限制问题。
|
|
||||||
- 📦 SubPackages: 符合心智模型的分包风格,合理的 pages 目录结构,与分包配置轻松实现功能分包。
|
|
||||||
- 🛣 Router: 使用 [uniapp-router-next](https://gitee.com/wen-jason/uni-router/tree/main/packages/uniapp-router-next),并通过优化封装,API 同 VueRouter 类似,扩展了拦截器、中间件、路由别名功能。
|
|
||||||
- 📊 Store: 使用 [Pinia](https://pinia.vuejs.org/zh/) 强力驱动,轻松实现应用状态管理。
|
|
||||||
- ⚡️ Request: 请求库使用 [uni-network](https://github.com/uni-helper/uni-network) 完全基于 uniapp API 编写的高性能请求库, API 同 axios。
|
|
||||||
- 👇 Z-paging: 内置了高性能且易于使用的业务常用下拉分页组件模块,轻松实现下拉刷新、上拉加载等功能。
|
|
||||||
- 💅 Unocss: 使用原子化 CSS 引擎,小程序环境下依然完美支持原子化的 class 命名书写规则。
|
|
||||||
- 🎨 UI-libs: 预设了 [uivew-plus](https://uiadmin.net/uview-plus/) 和 [uni-ui](https://uniapp.dcloud.net.cn/component/uniui/uni-ui.html) 两者相辅相成,轻松满足绝大多数业务场景,并支持主题色定制功能。
|
|
||||||
- 📝 NoTs: 只使用 JavaScript,在常规业务场景或人员水平差距过大情况下,TypeScript 并不会提升开发体验。
|
|
||||||
|
|
||||||
## 使用方法
|
|
||||||
|
|
||||||
### 安装项目依赖
|
|
||||||
|
|
||||||
> 打开并进入克隆的项目根目录下执行以下命令
|
|
||||||
> 以下命令推荐 使用 pnpm 进行操作 不过你依然可以使用 npm/yarn
|
|
||||||
|
|
||||||
```shell
|
|
||||||
pnpm install
|
|
||||||
```
|
|
||||||
|
|
||||||
### 运行项目
|
|
||||||
|
|
||||||
#### 任意编辑器直接运行本项目
|
|
||||||
|
|
||||||
```shell
|
|
||||||
# h5端
|
|
||||||
pnpm dev:h5
|
|
||||||
# 微信小程序端
|
|
||||||
pnpm dev:mp-weixin
|
|
||||||
# 安卓端
|
|
||||||
pnpm dev:app-android
|
|
||||||
#... 更多端请参阅 package.json/script
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 在 HBuilder 中运行本项目
|
|
||||||
|
|
||||||
1. 将项目拖动到 HBuilder 中
|
|
||||||
2. 使用 pnpm install 安装好依赖
|
|
||||||
3. 点击项目 /src 目录中的任意文件
|
|
||||||
4. 点击编辑器上方点击运行选择需要运行的环境
|
|
||||||
|
|
||||||
### 功能示例
|
|
||||||
|
|
||||||
#### 静态资源处理
|
|
||||||
|
|
||||||
```js
|
|
||||||
// 使用远程静态资源
|
|
||||||
import { useAssets } from './utils/assets/remote'
|
|
||||||
|
|
||||||
// 使用本地静态资源
|
|
||||||
import { useAssets } from './utils/assets/local'
|
|
||||||
|
|
||||||
// 全局挂载
|
|
||||||
app.config.globalProperties.$assets = useAssets
|
|
||||||
|
|
||||||
// template中使用
|
|
||||||
// <img :src="$assets('/temp.png')" />
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 全局主题色定制
|
|
||||||
|
|
||||||
> 由 [unocss-preset-shades](https://github.com/viarotel-org/packages/tree/main/packages/unocss-preset-shades#readme) 提供支持
|
|
||||||
|
|
||||||
```html
|
|
||||||
<!-- 设置文本色为主题色色调为 500 -->
|
|
||||||
<div class="text-primary-500"></div>
|
|
||||||
<!-- 设置背景色为主题色色调为 500 -->
|
|
||||||
<div class="bg-primary-500"></div>
|
|
||||||
<!-- 设置边框色为主题色色调为 500 -->
|
|
||||||
<div class="border border-primary-500"></div>
|
|
||||||
<!-- 更多使用方式请参阅 https://tailwindcss.com/docs -->
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 路由间功能跳转
|
|
||||||
|
|
||||||
```js
|
|
||||||
// 跳转页面
|
|
||||||
const methods = {
|
|
||||||
routerDemo() {
|
|
||||||
this.$Router.push({
|
|
||||||
path: '/login',
|
|
||||||
query: {
|
|
||||||
id: 'id'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// 获取页面参数
|
|
||||||
this.$Route.query.id
|
|
||||||
|
|
||||||
// 关闭当前页面跳转到某个页面
|
|
||||||
this.$Router.replace('/login')
|
|
||||||
// 关闭所有打开的页面跳转到某个页面
|
|
||||||
this.$Router.replaceAll('/login')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 为路由设置别名
|
|
||||||
// pages.config.js 中
|
|
||||||
const aliasConfig = {
|
|
||||||
path: 'pages/login/index',
|
|
||||||
// 通过添加 aliasPath 字段
|
|
||||||
aliasPath: '/login'
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 使用路由守卫
|
|
||||||
|
|
||||||
> 位于 router/guards 中
|
|
||||||
|
|
||||||
```js
|
|
||||||
import store from '@/store/index.js'
|
|
||||||
|
|
||||||
const homePath = '/pages/index/index'
|
|
||||||
const loginPath = '/pages/login/index'
|
|
||||||
|
|
||||||
const whiteList = [loginPath]
|
|
||||||
|
|
||||||
export default (router) => {
|
|
||||||
const userStore = store.useUserStore()
|
|
||||||
|
|
||||||
const loginRoute = (to) => ({
|
|
||||||
path: loginPath,
|
|
||||||
navType: 'reLaunch',
|
|
||||||
force: true,
|
|
||||||
query: {
|
|
||||||
redirect: {
|
|
||||||
path: to.path,
|
|
||||||
query: to.query
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
|
||||||
// console.log('permission.beforeEach.to', to)
|
|
||||||
// console.log('permission.beforeEach.from', from)
|
|
||||||
|
|
||||||
const token = userStore.token
|
|
||||||
const userId = userStore.userId
|
|
||||||
|
|
||||||
console.log('token', token)
|
|
||||||
console.log('userId', userId)
|
|
||||||
|
|
||||||
if (token) {
|
|
||||||
if (to.path === loginPath) {
|
|
||||||
next(homePath)
|
|
||||||
} else if (userId) {
|
|
||||||
next()
|
|
||||||
} else {
|
|
||||||
userStore
|
|
||||||
.getUserInfo()
|
|
||||||
.then(() => {
|
|
||||||
next()
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.warn(error)
|
|
||||||
userStore.logout({ silenced: true })
|
|
||||||
next(loginRoute(to))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else if (whiteList.includes(to.path)) {
|
|
||||||
next()
|
|
||||||
} else {
|
|
||||||
next(loginRoute(to))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
router.afterEach(() => {})
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 使用基于路由的中间件
|
|
||||||
|
|
||||||
> pages.config.js 中
|
|
||||||
|
|
||||||
```js
|
|
||||||
// 使用名为 realname 的中间件
|
|
||||||
const pageConfig = {
|
|
||||||
path: '/pages/personal/index',
|
|
||||||
aliasPath: '/personal',
|
|
||||||
meta: {
|
|
||||||
middleware: ['realname']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
定义中间件
|
|
||||||
|
|
||||||
> router/guards/index.js 中
|
|
||||||
|
|
||||||
```js
|
|
||||||
// 使用 defineMiddleware 定义并包装为中间件
|
|
||||||
import realname from './realname/index.js'
|
|
||||||
import { defineMiddleware } from '$uni-router/middleware'
|
|
||||||
|
|
||||||
export default (app, router) => {
|
|
||||||
// 使用 defineMiddleware 定义了路由中间件
|
|
||||||
defineMiddleware(realname, { router, app })
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
编写路由中间件代码
|
|
||||||
|
|
||||||
> router/guards/realname/index.js 中
|
|
||||||
|
|
||||||
```js
|
|
||||||
import store from '@/store/index.js'
|
|
||||||
import { useDialog, useToast } from '@/utils/modals'
|
|
||||||
|
|
||||||
export default (router) => {
|
|
||||||
const userStore = store.useUserStore()
|
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
|
||||||
console.log('realname.beforeEach.to', to)
|
|
||||||
console.log('realname.beforeEach.from', from)
|
|
||||||
|
|
||||||
const realStatus = userStore.userInfo.realStatus
|
|
||||||
|
|
||||||
switch (realStatus) {
|
|
||||||
case 3:
|
|
||||||
next()
|
|
||||||
break
|
|
||||||
case 2:
|
|
||||||
useToast('实名审核中, 请稍后再试').then(() => {
|
|
||||||
next(false)
|
|
||||||
})
|
|
||||||
break
|
|
||||||
case 4:
|
|
||||||
useDialog(`${userStore.userInfo.auditResult || '提交的实名信息不符'}`, {
|
|
||||||
title: '实名失败',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmText: '重新认证'
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
next({ path: '/pages/realname/index' })
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
next(false)
|
|
||||||
})
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
useDialog('请先进行实名认证', { showCancelButton: true })
|
|
||||||
.then(() => {
|
|
||||||
next({ path: '/pages/realname/index' })
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
next(false)
|
|
||||||
})
|
|
||||||
break
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// router.afterEach(() => {})
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 主要使用的包
|
|
||||||
|
|
||||||
- vitejs
|
|
||||||
- uniapp
|
|
||||||
- pinia
|
|
||||||
- uview-plus
|
|
||||||
- uni-ui
|
|
||||||
- @uni-helper/uni-network
|
|
||||||
- uniapp-router-next
|
|
||||||
- z-paging
|
|
||||||
- unocss
|
|
||||||
- unocss-applet
|
|
||||||
|
|
||||||
### 常见问题
|
|
||||||
|
|
||||||
#### 无法正常安装依赖/无法启动
|
|
||||||
|
|
||||||
删除 pnpm-lock.yaml / yarn.lock / package-lock.json 文件后重新安装依赖
|
|
||||||
|
|
@ -146,7 +146,7 @@ export default defineUniPages({
|
||||||
path: 'index',
|
path: 'index',
|
||||||
aliasPath: '/statement',
|
aliasPath: '/statement',
|
||||||
style: {
|
style: {
|
||||||
navigationBarTitleText: '产品服务协议',
|
navigationBarTitleText: '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,8 @@
|
||||||
class="text-#FF8CA6 active:text-primary-700"
|
class="text-#FF8CA6 active:text-primary-700"
|
||||||
@click.stop="handleAgree"
|
@click.stop="handleAgree"
|
||||||
>
|
>
|
||||||
《服务条款》
|
《陪诊服务风险告知及免责协议》
|
||||||
</text>
|
</text>
|
||||||
同意书
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -50,7 +49,7 @@ watchEffect(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleAgree = () => {
|
const handleAgree = () => {
|
||||||
$Router.push({ path: '/pages/statement/index' })
|
$Router.push({ path: '/pages/statement/index', query: { type: 3 } })
|
||||||
}
|
}
|
||||||
const handleAgreeCheck = () => {
|
const handleAgreeCheck = () => {
|
||||||
if (prop.disabled) return
|
if (prop.disabled) return
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { isH5 } from '@uni-helper/uni-env'
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === 'production'
|
const isProduction = process.env.NODE_ENV === 'production'
|
||||||
|
|
||||||
export const appName = 'Escort'
|
export const appName = '护医达'
|
||||||
|
|
||||||
// 项目主题色
|
// 项目主题色
|
||||||
export const primaryColor = '#FF8CA6'
|
export const primaryColor = '#FF8CA6'
|
||||||
|
|
@ -11,7 +11,7 @@ export const primaryColor = '#FF8CA6'
|
||||||
export const appBasePath = isProduction ? './' : './'
|
export const appBasePath = isProduction ? './' : './'
|
||||||
// 请求地址
|
// 请求地址
|
||||||
// export const requestURL = 'http://192.168.2.121:7788/hospital/app'
|
// export const requestURL = 'http://192.168.2.121:7788/hospital/app'
|
||||||
export const requestURL = 'https://peizhen.flameby.com/hospital/app'
|
export const requestURL = 'https://api.shpeizhen.com/hospital/app'
|
||||||
export const requestPath = ''
|
export const requestPath = ''
|
||||||
export const requestFilePath = '/file'
|
export const requestFilePath = '/file'
|
||||||
// 是否开启代理
|
// 是否开启代理
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "vite-uniapp-template",
|
"name": "Escort",
|
||||||
"appid": "",
|
"appid": "",
|
||||||
"description": "",
|
"description": "",
|
||||||
"versionName": "2.0.0",
|
"versionName": "1.0.0",
|
||||||
"versionCode": "100",
|
"versionCode": "100",
|
||||||
"transformPx": false,
|
"transformPx": false,
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
},
|
},
|
||||||
"quickapp": {},
|
"quickapp": {},
|
||||||
"mp-weixin": {
|
"mp-weixin": {
|
||||||
"appid": "wx55ff808ba0e28b1d",
|
"appid": "wx4be85f90b677d4cf",
|
||||||
"libVersion": "3.1.5",
|
"libVersion": "3.1.5",
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false,
|
"urlCheck": false,
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,22 @@
|
||||||
import { appName } from '@/configs/index'
|
import { appName } from '@/configs/index'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data () {
|
||||||
return {
|
return {
|
||||||
shareAppMessageProps: {},
|
shareAppMessageProps: {
|
||||||
|
imageUrl: 'https://pei-zhen.oss-cn-shanghai.aliyuncs.com/5531711684145_.pic.jpg',
|
||||||
|
},
|
||||||
shareTimelineProps: {},
|
shareTimelineProps: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShareAppMessage() {
|
onShareAppMessage () {
|
||||||
return {
|
return {
|
||||||
title: appName,
|
title: appName,
|
||||||
path: '/pages/index/index',
|
path: '/pages/index/home/index',
|
||||||
...this.shareAppMessageProps,
|
...this.shareAppMessageProps,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShareTimeline() {
|
onShareTimeline () {
|
||||||
return {
|
return {
|
||||||
title: appName,
|
title: appName,
|
||||||
query: '',
|
query: '',
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
"path": "index",
|
"path": "index",
|
||||||
"aliasPath": "/statement",
|
"aliasPath": "/statement",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "产品服务协议"
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -629,7 +629,7 @@ const onSubmit = () => {
|
||||||
}
|
}
|
||||||
if (!agreed.value) {
|
if (!agreed.value) {
|
||||||
try {
|
try {
|
||||||
await $dialog('是否已阅读并同意《服务条款》?', {
|
await $dialog('是否已阅读并同意《陪诊服务风险告知及免责协议》?', {
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: '同意',
|
confirmButtonText: '同意',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
width="100rpx"
|
width="100rpx"
|
||||||
height="100rpx"
|
height="100rpx"
|
||||||
:duration="100"
|
:duration="100"
|
||||||
:src="$assets(listItem.icon)"
|
:src="listItem.iconPath || $assets(listItem.icon)"
|
||||||
/>
|
/>
|
||||||
<text class="text-28rpx !font-normal mt-12rpx mb-34rpx text-#333">{{
|
<text class="text-28rpx !font-normal mt-12rpx mb-34rpx text-#333">{{
|
||||||
listItem.title
|
listItem.title
|
||||||
|
|
@ -91,22 +91,11 @@
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
import Order from '../order/index.vue'
|
import Order from '../order/index.vue'
|
||||||
|
|
||||||
const { $Router, $api, $store } = getCurrentInstance().proxy
|
const { $Router, $api, $store, $dialog } = getCurrentInstance().proxy
|
||||||
const userRole = computed(() => $store.user.userInfo.roleName ?? 'simple')
|
const userRole = computed(() => $store.user.userInfo.roleName ?? 'simple')
|
||||||
|
const isLogin = computed(() => !!$store.user.token)
|
||||||
const searchVal = ref('')
|
const searchVal = ref('')
|
||||||
const swiperList = ref([])
|
const swiperList = ref([])
|
||||||
// {
|
|
||||||
// images: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
|
|
||||||
// title: '昨夜西风凋碧树'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// images: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
|
|
||||||
// title: '行色匆匆'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// images: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
|
|
||||||
// title: '更上一层楼'
|
|
||||||
// }
|
|
||||||
// 半天陪诊 全天陪诊 遵享服务 代办约号 取送报告 代取送药 上门检测护理 在线咨询
|
// 半天陪诊 全天陪诊 遵享服务 代办约号 取送报告 代取送药 上门检测护理 在线咨询
|
||||||
const gridList = ref([
|
const gridList = ref([
|
||||||
{
|
{
|
||||||
|
|
@ -169,10 +158,29 @@ const gridList = ref([
|
||||||
title: '在线咨询',
|
title: '在线咨询',
|
||||||
icon: '/home-icon/h-icon-8.png',
|
icon: '/home-icon/h-icon-8.png',
|
||||||
path: ''
|
path: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '成为陪诊师',
|
||||||
|
// icon: '/personal/qiehuan.png',
|
||||||
|
iconPath: 'https://pei-zhen.oss-cn-shanghai.aliyuncs.com/h-icon-11.png',
|
||||||
|
path: '/pages/other/switch'
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
const handleGridClick = (path, query = {}) => {
|
const handleGridClick = (path, query = {}) => {
|
||||||
|
if (!isLogin.value) {
|
||||||
|
$dialog('请先登录', {
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: '去登录',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
confirmColor: '#FF8CA6'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
$Router.push('/personal')
|
||||||
|
})
|
||||||
|
.catch(() => '')
|
||||||
|
return
|
||||||
|
}
|
||||||
if (path) {
|
if (path) {
|
||||||
$Router.push({
|
$Router.push({
|
||||||
path,
|
path,
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ onShow(() => {
|
||||||
confirmColor: '#FF8CA6'
|
confirmColor: '#FF8CA6'
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// $Router.push('/personal')
|
return $Router.push('/personal')
|
||||||
$store.user.login().then((user) => {
|
$store.user.login().then((user) => {
|
||||||
// $store.user.setUserInfo(user)
|
// $store.user.setUserInfo(user)
|
||||||
!user.nickName
|
!user.nickName
|
||||||
|
|
|
||||||
|
|
@ -1,71 +1,84 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="px-44rpx">
|
<view class="px-44rpx">
|
||||||
<view class="flex items-center pt-80rpx pl-16rpx" @click="handleLogin">
|
<view>
|
||||||
<view class="overflow-hidden rounded-full w-20 h-20">
|
<view
|
||||||
<image
|
class="flex items-center pt-80rpx pl-16rpx min-h-240rpx"
|
||||||
:src="userInfo.avatar ? userInfo.avatar : defaultAvatar"
|
@click="handleLogin"
|
||||||
alt=""
|
>
|
||||||
class="w-full h-full"
|
<view class="overflow-hidden rounded-full w-20 h-20">
|
||||||
/>
|
<image
|
||||||
</view>
|
:class="loading ? 'overflow-hidden' : ' '"
|
||||||
|
:src="userInfo.avatar ? userInfo.avatar : defaultAvatar"
|
||||||
|
alt=""
|
||||||
|
class="w-full h-full"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="ml-4">
|
<view class="ml-4">
|
||||||
<block v-if="isLogin">
|
<block v-if="isLogin">
|
||||||
<view class="text-34rpx"> {{ userInfo.nickName }}</view>
|
<view class="text-34rpx"> {{ userInfo.nickName }}</view>
|
||||||
<view class="text-24rpx text-primary-500 mt-20rpx flex items-center">
|
<view
|
||||||
<image
|
class="text-24rpx text-primary-500 mt-20rpx flex items-center h-30rpx overflow-hidden"
|
||||||
class="w-28rpx mr-4rpx"
|
>
|
||||||
:src="$assets('/personal/edit.jpg')"
|
<image
|
||||||
mode="widthFix"
|
class="w-28rpx mr-4rpx"
|
||||||
></image>
|
:src="$assets('/personal/edit.jpg')"
|
||||||
<text>编辑资料</text></view
|
mode="widthFix"
|
||||||
>
|
></image>
|
||||||
</block>
|
<text>编辑资料</text></view
|
||||||
<view v-else claas="text-34rpx text-primary">登录</view>
|
>
|
||||||
</view>
|
</block>
|
||||||
</view>
|
<view v-else claas="text-34rpx text-primary">登录</view>
|
||||||
<view class="flex items-center pl-16rpx my-40rpx" v-if="userInfo.roleName ==='common'">
|
|
||||||
<view class="flex flex-1 flex-col">
|
|
||||||
<text class="text-34rpx">{{ orderTodayIncome.count || 0 }}</text>
|
|
||||||
<text class="text-28rpx text-#999">累计接单</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex flex-1 flex-col">
|
|
||||||
<text class="text-34rpx">{{ orderTodayIncome.doctorPrice || 0 }}</text>
|
|
||||||
<text class="text-28rpx text-#999">累计收入</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex flex-1 flex-col">
|
|
||||||
<text class="text-34rpx">{{ orderTodayIncome.cashPrice || 0 }}</text>
|
|
||||||
<text class="text-28rpx text-#999">可提现</text>
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
@click="showWithdraw = true"
|
|
||||||
class="w-120rpx text-primary-500 text-30rpx"
|
|
||||||
>
|
|
||||||
立即提现
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="relative mt-40rpx">
|
|
||||||
<view
|
|
||||||
v-for="(item, index) of menuList"
|
|
||||||
:key="index"
|
|
||||||
class="flex items-center py-4"
|
|
||||||
@click="handleInfo(item)"
|
|
||||||
>
|
|
||||||
<!-- <view class="w-10 flex-none truncate text-primary-500 text-2xl">
|
|
||||||
<via-icon :name="item.icon"></via-icon>
|
|
||||||
</view> -->
|
|
||||||
<view class="flex-1 flex items-center">
|
|
||||||
<image :src="$assets(item.icon)" alt="" class="w-42rpx h-42rpx" />
|
|
||||||
<text class="ml-40rpx">{{ item.text }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex-none w-10 text-right text-gray-500">
|
|
||||||
<via-icon name="arrow-right-bold"></via-icon>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<button
|
<view
|
||||||
class="absolute bottom-224rpx bg-transparent border-transparent z-2 w-660rpx h-90rpx"
|
class="flex items-center pl-16rpx my-40rpx"
|
||||||
open-type="contact"
|
v-if="userInfo.roleName === 'common'"
|
||||||
></button>
|
>
|
||||||
|
<view class="flex flex-1 flex-col">
|
||||||
|
<text class="text-34rpx">{{ orderTodayIncome.count || 0 }}</text>
|
||||||
|
<text class="text-28rpx text-#999">累计接单</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex flex-1 flex-col">
|
||||||
|
<text class="text-34rpx">{{
|
||||||
|
orderTodayIncome.doctorPrice || 0
|
||||||
|
}}</text>
|
||||||
|
<text class="text-28rpx text-#999">累计收入</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex flex-1 flex-col">
|
||||||
|
<text class="text-34rpx">{{ orderTodayIncome.cashPrice || 0 }}</text>
|
||||||
|
<text class="text-28rpx text-#999">可提现</text>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
@click="showWithdraw = true"
|
||||||
|
class="w-120rpx text-primary-500 text-30rpx"
|
||||||
|
>
|
||||||
|
立即提现
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="relative mt-40rpx min-h-[50vh]">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) of menuList"
|
||||||
|
:key="index"
|
||||||
|
class="flex items-center py-4"
|
||||||
|
@click="handleInfo(item)"
|
||||||
|
>
|
||||||
|
<!-- <view class="w-10 flex-none truncate text-primary-500 text-2xl">
|
||||||
|
<via-icon :name="item.icon"></via-icon>
|
||||||
|
</view> -->
|
||||||
|
<view class="flex-1 flex items-center">
|
||||||
|
<image :src="$assets(item.icon)" alt="" class="w-42rpx h-42rpx" />
|
||||||
|
<text class="ml-40rpx">{{ item.text }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex-none w-10 text-right text-gray-500">
|
||||||
|
<via-icon name="arrow-right-bold"></via-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<button
|
||||||
|
class="absolute top-224rpx bg-transparent :hover:bg-transparent border-transparent z-2 w-660rpx h-100rpx"
|
||||||
|
open-type="contact"
|
||||||
|
></button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<u-modal
|
<u-modal
|
||||||
|
|
@ -100,16 +113,18 @@
|
||||||
:customStyle="{ height: '80rpx' }"
|
:customStyle="{ height: '80rpx' }"
|
||||||
v-model="cashModel[item.key]"
|
v-model="cashModel[item.key]"
|
||||||
:type="item.key === 'price' ? 'number' : 'text'"
|
:type="item.key === 'price' ? 'number' : 'text'"
|
||||||
:placeholder="`请输入${item.key ==='wxNumber' ? '收款账户' : item.text}`"
|
:placeholder="`请输入${
|
||||||
|
item.key === 'wxNumber' ? '收款账户' : item.text
|
||||||
|
}`"
|
||||||
fontSize="28rpx"
|
fontSize="28rpx"
|
||||||
border="bottom"
|
border="bottom"
|
||||||
:focus="false"
|
:focus="false"
|
||||||
>
|
>
|
||||||
<!-- :border="item.key !== 'price' ? 'bottom' : 'none'" -->
|
<!-- :border="item.key !== 'price' ? 'bottom' : 'none'" -->
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<u-text
|
<u-text
|
||||||
:text="item.text"
|
:text="item.text"
|
||||||
:margin="item.key ==='price' ? '0 5px':'0 5px 0 0'"
|
:margin="item.key === 'price' ? '0 5px' : '0 5px 0 0'"
|
||||||
type="tips"
|
type="tips"
|
||||||
color="#000000"
|
color="#000000"
|
||||||
></u-text>
|
></u-text>
|
||||||
|
|
@ -123,6 +138,49 @@
|
||||||
</view>
|
</view>
|
||||||
</u-modal>
|
</u-modal>
|
||||||
</view>
|
</view>
|
||||||
|
<u-popup
|
||||||
|
:show="show"
|
||||||
|
:round="10"
|
||||||
|
mode="center"
|
||||||
|
:safeAreaInsetBottom="false"
|
||||||
|
:customStyle="{ width: '86%' }"
|
||||||
|
>
|
||||||
|
<view class="w-full px-30rpx py-50rpx">
|
||||||
|
<view class="mb-4"></view>
|
||||||
|
<!-- <text>出淤泥而不染,濯清涟而不妖</text> -->
|
||||||
|
<view class="flex items-start">
|
||||||
|
<u-checkbox-group v-model="checked" @change="checkboxChange">
|
||||||
|
<u-checkbox activeColor="#FF8CA6" :name="true"> </u-checkbox>
|
||||||
|
</u-checkbox-group>
|
||||||
|
<view class="pt-6rpx">
|
||||||
|
<text @click="checked[0] = !checked[0]">我已阅读并同意</text>
|
||||||
|
<text class="text-#FF8CA6" @click="goStatement(1)">《用户协议》</text>
|
||||||
|
<text>、</text>
|
||||||
|
<text class="text-#FF8CA6" @click="goStatement(2)">《隐私协议》</text>
|
||||||
|
<!-- <text>、</text>
|
||||||
|
<text class="text-#FF8CA6" @click="goStatement(3)"
|
||||||
|
>《风险告知及免责协议》</text> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex justify-between px-50rpx mt-50rpx">
|
||||||
|
<u-button
|
||||||
|
customStyle="width: 200rpx;border-radius:24rpx;"
|
||||||
|
type="primary"
|
||||||
|
:plain="true"
|
||||||
|
text="取消"
|
||||||
|
@click="show = false"
|
||||||
|
></u-button>
|
||||||
|
<u-button
|
||||||
|
customStyle="width: 200rpx;border-radius:24rpx;"
|
||||||
|
class="!w-80rpx"
|
||||||
|
type="primary"
|
||||||
|
:disabled="checked[0] === false"
|
||||||
|
text="登录"
|
||||||
|
@click="login"
|
||||||
|
></u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
<tabbar />
|
<tabbar />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -133,6 +191,8 @@ import { onShow } from '@dcloudio/uni-app'
|
||||||
const instance = getCurrentInstance()
|
const instance = getCurrentInstance()
|
||||||
const { $api, $store, $Router, $loading, $dialog, $toast, $u } = instance.proxy
|
const { $api, $store, $Router, $loading, $dialog, $toast, $u } = instance.proxy
|
||||||
|
|
||||||
|
const show = ref(false)
|
||||||
|
const checked = ref([false])
|
||||||
const userStore = $store.user
|
const userStore = $store.user
|
||||||
const isLogin = computed(() => !!$store.user.token)
|
const isLogin = computed(() => !!$store.user.token)
|
||||||
const userInfo = computed(() => $store.user.userInfo)
|
const userInfo = computed(() => $store.user.userInfo)
|
||||||
|
|
@ -178,13 +238,17 @@ const listConst = [
|
||||||
{
|
{
|
||||||
icon: '/personal/guanyu.png',
|
icon: '/personal/guanyu.png',
|
||||||
text: '关于我们',
|
text: '关于我们',
|
||||||
path: '/pages/contact/index'
|
// path: '/pages/contact/index'
|
||||||
},
|
path: '/pages/statement/index',
|
||||||
{
|
query: {
|
||||||
icon: '/personal/lianxi.png',
|
type: 100
|
||||||
text: '帮助中心',
|
}
|
||||||
path: '/pages/contact/index'
|
|
||||||
}
|
}
|
||||||
|
// {
|
||||||
|
// icon: '/personal/lianxi.png',
|
||||||
|
// text: '帮助中心',
|
||||||
|
// path: '/pages/contact/index'
|
||||||
|
// }
|
||||||
]
|
]
|
||||||
const menuList = ref([])
|
const menuList = ref([])
|
||||||
const cashModel = ref({
|
const cashModel = ref({
|
||||||
|
|
@ -217,6 +281,10 @@ const cashItemList = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const checkboxChange = (n) => {
|
||||||
|
console.log('🚀 ~ file: index.vue:294 ~ n:', n)
|
||||||
|
checked.value = n
|
||||||
|
}
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const { roleName, roleList = [] } = userInfo.value
|
const { roleName, roleList = [] } = userInfo.value
|
||||||
list.simple[1].text = roleList.includes('common') ? '切换身份' : '成为陪诊师'
|
list.simple[1].text = roleList.includes('common') ? '切换身份' : '成为陪诊师'
|
||||||
|
|
@ -225,6 +293,27 @@ watchEffect(() => {
|
||||||
|
|
||||||
const handleInfo = async (item) => {
|
const handleInfo = async (item) => {
|
||||||
const { roleName, roleList = [] } = userInfo.value
|
const { roleName, roleList = [] } = userInfo.value
|
||||||
|
if (
|
||||||
|
!isLogin.value &&
|
||||||
|
['/pages/other/switch', '/pages/other/income-details', '/order'].includes(
|
||||||
|
item.path
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
// $dialog('请先登录', {
|
||||||
|
// showCancelButton: true,
|
||||||
|
// confirmButtonText: '去登录',
|
||||||
|
// cancelButtonText: '取消',
|
||||||
|
// confirmColor: '#FF8CA6'
|
||||||
|
// })
|
||||||
|
// .then(() => {})
|
||||||
|
// .catch(() => '')
|
||||||
|
uni.showToast({
|
||||||
|
title: '请先登录',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
!item.path ||
|
!item.path ||
|
||||||
(item.path === '/pages/other/switch' && roleList.includes('common'))
|
(item.path === '/pages/other/switch' && roleList.includes('common'))
|
||||||
|
|
@ -289,22 +378,31 @@ const handleWithdraw = async () => {
|
||||||
|
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
if (!isLogin.value) {
|
if (!isLogin.value) {
|
||||||
$loading(true)
|
show.value = true
|
||||||
userStore.login().then((user) => {
|
|
||||||
$loading(false)
|
|
||||||
!user.nickName
|
|
||||||
? $Router.push({
|
|
||||||
path: '/pages/other/edit-userinfo'
|
|
||||||
})
|
|
||||||
: userStore.setUserInfo(user)
|
|
||||||
})
|
|
||||||
} else
|
} else
|
||||||
$Router.push({
|
$Router.push({
|
||||||
path: '/pages/other/edit-userinfo'
|
path: '/pages/other/edit-userinfo'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const login = () => {
|
||||||
|
$loading(true)
|
||||||
|
userStore.login().then((user) => {
|
||||||
|
$loading(false)
|
||||||
|
show.value = false
|
||||||
|
!user.nickName
|
||||||
|
? $Router.push({
|
||||||
|
path: '/pages/other/edit-userinfo'
|
||||||
|
})
|
||||||
|
: userStore.setUserInfo(user)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const loading = ref(true)
|
||||||
const getUserInfo = async () => {
|
const getUserInfo = async () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
loading.value = false
|
||||||
|
}, 250)
|
||||||
if (isLogin.value) {
|
if (isLogin.value) {
|
||||||
const res = await $api.getUser()
|
const res = await $api.getUser()
|
||||||
if (res?.success) {
|
if (res?.success) {
|
||||||
|
|
@ -316,9 +414,19 @@ const getUserInfo = async () => {
|
||||||
} else userStore.logout()
|
} else userStore.logout()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const goStatement = (type) => {
|
||||||
|
$Router.push('/pages/statement/index?type=' + type)
|
||||||
|
}
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getUserInfo()
|
getUserInfo()
|
||||||
})
|
})
|
||||||
|
// const loading = ref(true)
|
||||||
|
onMounted(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
loading.value = false
|
||||||
|
}, 250)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
>昵称 <text class="text-#999 text-24rpx">建议改为真实姓名</text></view
|
>昵称 <text class="text-#999 text-24rpx">建议改为真实姓名</text></view
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
v-model="userInfo.nickName"
|
v-model="userInfo.nickName"
|
||||||
@change="handleNickName"
|
@change="handleNickName"
|
||||||
type="nickname"
|
type="nickname"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
inputAlign="right"
|
inputAlign="right"
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
class="h-130rpx flex justify-between items-center border-b-#E5E5E5 border-b-1px"
|
class="h-130rpx flex justify-between items-center border-b-#E5E5E5 border-b-1px"
|
||||||
>
|
>
|
||||||
<view>性别</view>
|
<view>性别</view>
|
||||||
<view>{{ columns[0][userInfo.gender] }}</view>
|
<view>{{ columns[0][userInfo.gender || 0] }}</view>
|
||||||
</view>
|
</view>
|
||||||
<u-picker
|
<u-picker
|
||||||
:show="show"
|
:show="show"
|
||||||
|
|
@ -75,11 +75,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { toRaw } from 'vue'
|
||||||
|
|
||||||
const instance = getCurrentInstance()
|
const instance = getCurrentInstance()
|
||||||
const { $api, $store, $Router, $u,$toast } = instance.proxy
|
const { $api, $store, $Router, $u, $toast } = instance.proxy
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
const columns = ref([['男', '女']])
|
const columns = ref([['男', '女']])
|
||||||
const userInfo = ref(...$store.user.userInfo)
|
const _userInfo = toRaw($store.user.userInfo)
|
||||||
|
const userInfo = ref(_userInfo || {})
|
||||||
const isEdit = ref($Router.query?.edit || false)
|
const isEdit = ref($Router.query?.edit || false)
|
||||||
|
|
||||||
const hadleConfirm = ({ indexs: [index] }) => {
|
const hadleConfirm = ({ indexs: [index] }) => {
|
||||||
|
|
@ -96,16 +99,27 @@ const getPhoneNumber = async (e) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleNickName = (e) => {
|
const handleNickName = (e) => {
|
||||||
userInfo.value.nickName = e.detail.value
|
userInfo.value.nickName = e.detail.value
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
|
const { phone, nickName } = userInfo.value
|
||||||
|
// 1. 校验
|
||||||
|
const reg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/
|
||||||
|
if (!phone || !reg.test(phone)) {
|
||||||
|
$toast('请输入正确的手机号')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!nickName || !nickName.trim()) {
|
||||||
|
$toast('请输入昵称')
|
||||||
|
return
|
||||||
|
}
|
||||||
const res = await $api.userSave(userInfo.value)
|
const res = await $api.userSave(userInfo.value)
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
$store.user.setUserInfo(userInfo.value)
|
$store.user.setUserInfo(userInfo.value)
|
||||||
$toast('保存成功').then(()=>{
|
$toast('保存成功').then(() => {
|
||||||
$Router.back()
|
$Router.back()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -114,8 +128,8 @@ const handleSave = async () => {
|
||||||
page {
|
page {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
input{
|
input {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
padding-right: 6rpx;
|
padding-right: 6rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
activeColor="#FF8CA6"
|
activeColor="#FF8CA6"
|
||||||
shape="square"
|
shape="square"
|
||||||
placement="row"
|
placement="row"
|
||||||
:disabled="model.status === 0"
|
:disabled="model.status === 0"
|
||||||
>
|
>
|
||||||
<u-radio name="0" label="男"></u-radio>
|
<u-radio name="0" label="男"></u-radio>
|
||||||
<u-radio name="1" label="女" class="ml-50rpx"></u-radio>
|
<u-radio name="1" label="女" class="ml-50rpx"></u-radio>
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
placeholder=""
|
placeholder=""
|
||||||
maxlength="300"
|
maxlength="300"
|
||||||
:autoHeight="false"
|
:autoHeight="false"
|
||||||
:disabled="model.status === 0"
|
:disabled="model.status === 0"
|
||||||
/>
|
/>
|
||||||
<view class="mt-32rpx mb-20rpx text-28rpx">
|
<view class="mt-32rpx mb-20rpx text-28rpx">
|
||||||
<view class=""
|
<view class=""
|
||||||
|
|
@ -119,9 +119,9 @@
|
||||||
class="fixed bg-#fff bottom-0 pb-8 left-0 right-0 text-white pt-12rpx border-t-1px border-solid border-#E5E5E5"
|
class="fixed bg-#fff bottom-0 pb-8 left-0 right-0 text-white pt-12rpx border-t-1px border-solid border-#E5E5E5"
|
||||||
><view
|
><view
|
||||||
@click="$u.throttle(handleSubmit, 1000)"
|
@click="$u.throttle(handleSubmit, 1000)"
|
||||||
class=" rounded-24rpx w-660rpx h-80rpx text-center leading-80rpx hover:shadow-md mx-auto"
|
class="rounded-24rpx w-660rpx h-80rpx text-center leading-80rpx hover:shadow-md mx-auto"
|
||||||
:class="model.status === 0 ? 'bg-#ccc' : 'bg-#FF8CA6'"
|
:class="model.status === 0 ? 'bg-#ccc' : 'bg-#FF8CA6'"
|
||||||
>{{model.status === 0 ? '申请中' : '提交申请'}}</view
|
>{{ model.status === 0 ? '申请中' : '提交申请' }}</view
|
||||||
></view
|
></view
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -261,13 +261,13 @@ const init = async () => {
|
||||||
const images = res.doctor.images.split(',')
|
const images = res.doctor.images.split(',')
|
||||||
imageObj.value.ren = images[0]
|
imageObj.value.ren = images[0]
|
||||||
imageObj.value.fan = images[1]
|
imageObj.value.fan = images[1]
|
||||||
agreed.value = true
|
agreed.value = true
|
||||||
}
|
}
|
||||||
$loading(false)
|
$loading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleChooseImage = async (key) => {
|
const handleChooseImage = async (key) => {
|
||||||
if(model.value.status === 0) return
|
if (model.value.status === 0) return
|
||||||
let filePath = ''
|
let filePath = ''
|
||||||
try {
|
try {
|
||||||
const ret = await chooseImage({
|
const ret = await chooseImage({
|
||||||
|
|
@ -298,7 +298,7 @@ const handleSubmit = async () => {
|
||||||
} else {
|
} else {
|
||||||
if (!agreed.value) {
|
if (!agreed.value) {
|
||||||
try {
|
try {
|
||||||
await $dialog('是否已阅读并同意《服务条款》?', {
|
await $dialog('是否已阅读并同意《陪诊服务风险告知及免责协议》?', {
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonText: '同意',
|
confirmButtonText: '同意',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
|
|
@ -345,7 +345,7 @@ onShow(() => {
|
||||||
})
|
})
|
||||||
.catch(() => '')
|
.catch(() => '')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
init()
|
init()
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,41 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="h-full p-4">
|
<view class="h-full p-4">
|
||||||
<view class="space-y-4">
|
<view class="space-y-4 pb-8">
|
||||||
<view class=""> 项目 </view>
|
<u-parse :content="content"></u-parse>
|
||||||
<view class=""> 使用本项目的用户需要遵守如下条款: </view>
|
|
||||||
<view class="">
|
|
||||||
特此授权,免费得以任何目的的使用、复制、修改、合并、出版、发行、散布、再授权及贩售软件及软件的副本,及授予前述权利的许可,无论是否为商业目的。
|
|
||||||
</view>
|
|
||||||
<view class="">
|
|
||||||
上述软件是按「原样」提供,作者不作任何明示或暗示的保证,包括但不限于对适销性和特定目的的适用性的保证。在任何情况下,无论是在合同诉讼、侵权行为或其它方面,作者都不对因使用本软件或其中所包含的内容所产生的任何直接、间接、偶然、特殊及后果性损害(包括但不限于替代商品或服务的采购、使用、数据或利润损失、或业务中断)承担责任。
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {}
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import request from '@uni-helper/uni-network'
|
||||||
|
const content = ref('')
|
||||||
|
|
||||||
|
const getConter = (type) => {
|
||||||
|
request({
|
||||||
|
url:
|
||||||
|
`https://pei-zhen.oss-cn-shanghai.aliyuncs.com/protocol/${type}.txt?t=` +
|
||||||
|
Date.now(),
|
||||||
|
method: 'GET',
|
||||||
|
dataType: 'text',
|
||||||
|
responseType: 'text'
|
||||||
|
}).then((res) => {
|
||||||
|
content.value = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const titObj = {
|
||||||
|
1: '用户协议',
|
||||||
|
2: '隐私协议',
|
||||||
|
3: '风险告知及免责协议',
|
||||||
|
100: '关于我们'
|
||||||
|
}
|
||||||
|
onLoad(({ type = 1 }) => {
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: titObj[type]
|
||||||
|
})
|
||||||
|
getConter(type)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue