Compare commits

...

7 Commits

Author SHA1 Message Date
wwl c05a448e05 fix bug 2024-04-17 11:52:11 +08:00
wwl 1d51fdf078 fix bug 2024-04-16 18:09:24 +08:00
wwl 1a40b0ad77 fix bug 2024-04-16 18:04:37 +08:00
wwl 23b0c51460 fix bug 2024-04-16 18:03:34 +08:00
wwl 99cdc25e80 fix bug 2024-03-28 16:56:23 +08:00
wwl 82ca8b7b3d fix bug 2024-03-28 16:39:03 +08:00
wwl 9227d2383d fix bug 2024-03-27 14:31:17 +08:00
17 changed files with 297 additions and 592 deletions

View File

@ -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
View File

@ -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
View File

@ -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 文件后重新安装依赖

View File

@ -146,7 +146,7 @@ export default defineUniPages({
path: 'index',
aliasPath: '/statement',
style: {
navigationBarTitleText: '产品服务协议',
navigationBarTitleText: '',
},
},
],

View File

@ -23,9 +23,8 @@
class="text-#FF8CA6 active:text-primary-700"
@click.stop="handleAgree"
>
服务条款
陪诊服务风险告知及免责协议
</text>
同意书
</view>
</view>
</template>
@ -50,7 +49,7 @@ watchEffect(() => {
})
const handleAgree = () => {
$Router.push({ path: '/pages/statement/index' })
$Router.push({ path: '/pages/statement/index', query: { type: 3 } })
}
const handleAgreeCheck = () => {
if (prop.disabled) return

View File

@ -2,7 +2,7 @@ import { isH5 } from '@uni-helper/uni-env'
const isProduction = process.env.NODE_ENV === 'production'
export const appName = 'Escort'
export const appName = '护医达'
// 项目主题色
export const primaryColor = '#FF8CA6'
@ -11,7 +11,7 @@ export const primaryColor = '#FF8CA6'
export const appBasePath = isProduction ? './' : './'
// 请求地址
// 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 requestFilePath = '/file'
// 是否开启代理

View File

@ -1,8 +1,8 @@
{
"name": "vite-uniapp-template",
"name": "Escort",
"appid": "",
"description": "",
"versionName": "2.0.0",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
"app-plus": {
@ -42,7 +42,7 @@
},
"quickapp": {},
"mp-weixin": {
"appid": "wx55ff808ba0e28b1d",
"appid": "wx4be85f90b677d4cf",
"libVersion": "3.1.5",
"setting": {
"urlCheck": false,

View File

@ -3,14 +3,16 @@ import { appName } from '@/configs/index'
export default {
data () {
return {
shareAppMessageProps: {},
shareAppMessageProps: {
imageUrl: 'https://pei-zhen.oss-cn-shanghai.aliyuncs.com/5531711684145_.pic.jpg',
},
shareTimelineProps: {},
}
},
onShareAppMessage () {
return {
title: appName,
path: '/pages/index/index',
path: '/pages/index/home/index',
...this.shareAppMessageProps,
}
},

View File

@ -126,7 +126,7 @@
"path": "index",
"aliasPath": "/statement",
"style": {
"navigationBarTitleText": "产品服务协议"
"navigationBarTitleText": ""
}
}
]

View File

@ -629,7 +629,7 @@ const onSubmit = () => {
}
if (!agreed.value) {
try {
await $dialog('是否已阅读并同意《服务条款》?', {
await $dialog('是否已阅读并同意《陪诊服务风险告知及免责协议》?', {
showCancelButton: true,
confirmButtonText: '同意',
cancelButtonText: '取消',

View File

@ -35,7 +35,7 @@
width="100rpx"
height="100rpx"
:duration="100"
:src="$assets(listItem.icon)"
:src="listItem.iconPath || $assets(listItem.icon)"
/>
<text class="text-28rpx !font-normal mt-12rpx mb-34rpx text-#333">{{
listItem.title
@ -91,22 +91,11 @@
import { onShow } from '@dcloudio/uni-app'
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 isLogin = computed(() => !!$store.user.token)
const searchVal = 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([
{
@ -169,10 +158,29 @@ const gridList = ref([
title: '在线咨询',
icon: '/home-icon/h-icon-8.png',
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 = {}) => {
if (!isLogin.value) {
$dialog('请先登录', {
showCancelButton: true,
confirmButtonText: '去登录',
cancelButtonText: '取消',
confirmColor: '#FF8CA6'
})
.then(() => {
$Router.push('/personal')
})
.catch(() => '')
return
}
if (path) {
$Router.push({
path,

View File

@ -302,7 +302,7 @@ onShow(() => {
confirmColor: '#FF8CA6'
})
.then(() => {
// $Router.push('/personal')
return $Router.push('/personal')
$store.user.login().then((user) => {
// $store.user.setUserInfo(user)
!user.nickName

View File

@ -1,8 +1,13 @@
<template>
<view class="px-44rpx">
<view class="flex items-center pt-80rpx pl-16rpx" @click="handleLogin">
<view>
<view
class="flex items-center pt-80rpx pl-16rpx min-h-240rpx"
@click="handleLogin"
>
<view class="overflow-hidden rounded-full w-20 h-20">
<image
:class="loading ? 'overflow-hidden' : ' '"
:src="userInfo.avatar ? userInfo.avatar : defaultAvatar"
alt=""
class="w-full h-full"
@ -12,7 +17,9 @@
<view class="ml-4">
<block v-if="isLogin">
<view class="text-34rpx"> {{ userInfo.nickName }}</view>
<view class="text-24rpx text-primary-500 mt-20rpx flex items-center">
<view
class="text-24rpx text-primary-500 mt-20rpx flex items-center h-30rpx overflow-hidden"
>
<image
class="w-28rpx mr-4rpx"
:src="$assets('/personal/edit.jpg')"
@ -24,13 +31,18 @@
<view v-else claas="text-34rpx text-primary">登录</view>
</view>
</view>
<view class="flex items-center pl-16rpx my-40rpx" v-if="userInfo.roleName ==='common'">
<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-34rpx">{{
orderTodayIncome.doctorPrice || 0
}}</text>
<text class="text-28rpx text-#999">累计收入</text>
</view>
<view class="flex flex-1 flex-col">
@ -44,7 +56,7 @@
立即提现
</view>
</view>
<view class="relative mt-40rpx">
<view class="relative mt-40rpx min-h-[50vh]">
<view
v-for="(item, index) of menuList"
:key="index"
@ -63,10 +75,11 @@
</view>
</view>
<button
class="absolute bottom-224rpx bg-transparent border-transparent z-2 w-660rpx h-90rpx"
class="absolute top-224rpx bg-transparent :hover:bg-transparent border-transparent z-2 w-660rpx h-100rpx"
open-type="contact"
></button>
</view>
</view>
<u-modal
v-model:show="showWithdraw"
@ -100,7 +113,9 @@
:customStyle="{ height: '80rpx' }"
v-model="cashModel[item.key]"
:type="item.key === 'price' ? 'number' : 'text'"
:placeholder="`请输入${item.key ==='wxNumber' ? '收款账户' : item.text}`"
:placeholder="`请输入${
item.key === 'wxNumber' ? '收款账户' : item.text
}`"
fontSize="28rpx"
border="bottom"
:focus="false"
@ -123,6 +138,49 @@
</view>
</u-modal>
</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 />
</template>
@ -133,6 +191,8 @@ import { onShow } from '@dcloudio/uni-app'
const instance = getCurrentInstance()
const { $api, $store, $Router, $loading, $dialog, $toast, $u } = instance.proxy
const show = ref(false)
const checked = ref([false])
const userStore = $store.user
const isLogin = computed(() => !!$store.user.token)
const userInfo = computed(() => $store.user.userInfo)
@ -178,13 +238,17 @@ const listConst = [
{
icon: '/personal/guanyu.png',
text: '关于我们',
path: '/pages/contact/index'
},
{
icon: '/personal/lianxi.png',
text: '帮助中心',
path: '/pages/contact/index'
// path: '/pages/contact/index'
path: '/pages/statement/index',
query: {
type: 100
}
}
// {
// icon: '/personal/lianxi.png',
// text: '',
// path: '/pages/contact/index'
// }
]
const menuList = 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(() => {
const { roleName, roleList = [] } = userInfo.value
list.simple[1].text = roleList.includes('common') ? '切换身份' : '成为陪诊师'
@ -225,6 +293,27 @@ watchEffect(() => {
const handleInfo = async (item) => {
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 (
!item.path ||
(item.path === '/pages/other/switch' && roleList.includes('common'))
@ -289,22 +378,31 @@ const handleWithdraw = async () => {
const handleLogin = async () => {
if (!isLogin.value) {
$loading(true)
userStore.login().then((user) => {
$loading(false)
!user.nickName
? $Router.push({
path: '/pages/other/edit-userinfo'
})
: userStore.setUserInfo(user)
})
show.value = true
} else
$Router.push({
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 () => {
setTimeout(() => {
loading.value = false
}, 250)
if (isLogin.value) {
const res = await $api.getUser()
if (res?.success) {
@ -316,9 +414,19 @@ const getUserInfo = async () => {
} else userStore.logout()
}
const goStatement = (type) => {
$Router.push('/pages/statement/index?type=' + type)
}
onShow(() => {
getUserInfo()
})
// const loading = ref(true)
onMounted(() => {
setTimeout(() => {
loading.value = false
}, 250)
})
</script>
<style lang="scss" scoped>

View File

@ -52,7 +52,7 @@
class="h-130rpx flex justify-between items-center border-b-#E5E5E5 border-b-1px"
>
<view>性别</view>
<view>{{ columns[0][userInfo.gender] }}</view>
<view>{{ columns[0][userInfo.gender || 0] }}</view>
</view>
<u-picker
:show="show"
@ -75,11 +75,14 @@
</template>
<script setup>
import { toRaw } from 'vue'
const instance = getCurrentInstance()
const { $api, $store, $Router, $u, $toast } = instance.proxy
const show = ref(false)
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 hadleConfirm = ({ indexs: [index] }) => {
@ -100,6 +103,17 @@ const handleNickName = (e) => {
}
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)
if (res.success) {
$store.user.setUserInfo(userInfo.value)

View File

@ -298,7 +298,7 @@ const handleSubmit = async () => {
} else {
if (!agreed.value) {
try {
await $dialog('是否已阅读并同意《服务条款》?', {
await $dialog('是否已阅读并同意《陪诊服务风险告知及免责协议》?', {
showCancelButton: true,
confirmButtonText: '同意',
cancelButtonText: '取消',

View File

@ -1,20 +1,41 @@
<template>
<view class="h-full p-4">
<view class="space-y-4">
<view class=""> 项目 </view>
<view class=""> 使用本项目的用户需要遵守如下条款 </view>
<view class="">
特此授权免费得以任何目的的使用复制修改合并出版发行散布再授权及贩售软件及软件的副本及授予前述权利的许可无论是否为商业目的
</view>
<view class="">
上述软件是按原样提供作者不作任何明示或暗示的保证包括但不限于对适销性和特定目的的适用性的保证在任何情况下无论是在合同诉讼侵权行为或其它方面作者都不对因使用本软件或其中所包含的内容所产生的任何直接间接偶然特殊及后果性损害包括但不限于替代商品或服务的采购使用数据或利润损失或业务中断承担责任
</view>
<view class="space-y-4 pb-8">
<u-parse :content="content"></u-parse>
</view>
</view>
</template>
<script>
export default {}
<script setup>
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>
<style></style>

View File