fix bug
parent
166bf82b3f
commit
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))
|
||||
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 文件后重新安装依赖
|
||||
|
|
@ -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'
|
||||
// 是否开启代理
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,10 @@
|
|||
<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>
|
||||
|
|
@ -100,16 +103,18 @@
|
|||
: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"
|
||||
border="bottom"
|
||||
:focus="false"
|
||||
>
|
||||
<!-- :border="item.key !== 'price' ? 'bottom' : 'none'" -->
|
||||
<template #prefix>
|
||||
<u-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"
|
||||
color="#000000"
|
||||
></u-text>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
>昵称 <text class="text-#999 text-24rpx">建议改为真实姓名</text></view
|
||||
>
|
||||
<input
|
||||
v-model="userInfo.nickName"
|
||||
@change="handleNickName"
|
||||
v-model="userInfo.nickName"
|
||||
@change="handleNickName"
|
||||
type="nickname"
|
||||
placeholder=""
|
||||
inputAlign="right"
|
||||
|
|
@ -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 { $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] }) => {
|
||||
|
|
@ -96,16 +99,16 @@ const getPhoneNumber = async (e) => {
|
|||
}
|
||||
}
|
||||
const handleNickName = (e) => {
|
||||
userInfo.value.nickName = e.detail.value
|
||||
userInfo.value.nickName = e.detail.value
|
||||
}
|
||||
|
||||
const handleSave = async () => {
|
||||
const res = await $api.userSave(userInfo.value)
|
||||
if (res.success) {
|
||||
$store.user.setUserInfo(userInfo.value)
|
||||
$toast('保存成功').then(()=>{
|
||||
$Router.back()
|
||||
})
|
||||
$store.user.setUserInfo(userInfo.value)
|
||||
$toast('保存成功').then(() => {
|
||||
$Router.back()
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -114,8 +117,8 @@ const handleSave = async () => {
|
|||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
input{
|
||||
text-align: right;
|
||||
padding-right: 6rpx;
|
||||
input {
|
||||
text-align: right;
|
||||
padding-right: 6rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue