1
0
Fork 0

patient index

master
panliang 2023-08-30 17:40:59 +08:00
parent b9ebec4106
commit e36a4223ff
16 changed files with 439 additions and 59 deletions

3
.env.development 100644
View File

@ -0,0 +1,3 @@
ENV = 'development'
VUE_APP_BASE_API = 'https://yipin.peidikeji.cn'

3
.env.production 100644
View File

@ -0,0 +1,3 @@
ENV = 'production'
VUE_APP_BASE_API = 'https://yipin-master.peidikeji.cn'

View File

@ -1,19 +1,6 @@
# uniapp
# 宝芝堂-Uniapp
## Project setup
```
pnpm install
```
## dependencies
### Compiles and hot-reloads for development
```
pnpm run serve
```
### Compiles and minifies for production
```
pnpm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
- [uni-ajax](https://uniajax.ponjs.com)
- [uview-ui](https://v1.uviewui.com)

View File

@ -70,6 +70,8 @@
"@vue/shared": "^3.0.0",
"core-js": "^3.8.3",
"flyio": "^0.6.2",
"uni-ajax": "^2.5.1",
"uview-ui": "^2.0.36",
"vue": ">= 2.6.14 < 2.7",
"vuex": "^3.2.0"
},
@ -92,6 +94,8 @@
"cross-env": "^7.0.2",
"jest": "^25.4.0",
"postcss-comment": "^2.0.0",
"sass": "^1.66.1",
"sass-loader": "10",
"vue-template-compiler": ">= 2.6.14 < 2.7"
},
"browserslist": [

View File

@ -71,6 +71,12 @@ dependencies:
flyio:
specifier: ^0.6.2
version: 0.6.2
uni-ajax:
specifier: ^2.5.1
version: 2.5.1
uview-ui:
specifier: ^2.0.36
version: 2.0.36
vue:
specifier: '>= 2.6.14 < 2.7'
version: 2.6.14
@ -120,7 +126,7 @@ devDependencies:
version: 5.0.0(@vue/cli-service@5.0.1)(core-js@3.8.3)(vue@2.6.14)
'@vue/cli-service':
specifier: ~5.0.0
version: 5.0.1(vue-template-compiler@2.6.14)(vue@2.6.14)
version: 5.0.1(sass-loader@10.4.1)(vue-template-compiler@2.6.14)(vue@2.6.14)
babel-plugin-import:
specifier: ^1.11.0
version: 1.11.0
@ -133,6 +139,12 @@ devDependencies:
postcss-comment:
specifier: ^2.0.0
version: 2.0.0
sass:
specifier: ^1.66.1
version: 1.66.1
sass-loader:
specifier: '10'
version: 10.4.1(sass@1.66.1)(webpack@4.46.0)
vue-template-compiler:
specifier: '>= 2.6.14 < 2.7'
version: 2.6.14
@ -2896,7 +2908,7 @@ packages:
dependencies:
'@babel/core': 7.22.11
'@vue/babel-preset-app': 5.0.8(@babel/core@7.22.11)(core-js@3.8.3)(vue@2.6.14)
'@vue/cli-service': 5.0.1(vue-template-compiler@2.6.14)(vue@2.6.14)
'@vue/cli-service': 5.0.1(sass-loader@10.4.1)(vue-template-compiler@2.6.14)(vue@2.6.14)
'@vue/cli-shared-utils': 5.0.8
babel-loader: 8.3.0(@babel/core@7.22.11)(webpack@5.88.2)
thread-loader: 3.0.4(webpack@5.88.2)
@ -2917,7 +2929,7 @@ packages:
peerDependencies:
'@vue/cli-service': ^3.0.0 || ^4.0.0 || ^5.0.0-0
dependencies:
'@vue/cli-service': 5.0.1(vue-template-compiler@2.6.14)(vue@2.6.14)
'@vue/cli-service': 5.0.1(sass-loader@10.4.1)(vue-template-compiler@2.6.14)(vue@2.6.14)
'@vue/cli-shared-utils': 5.0.8
transitivePeerDependencies:
- encoding
@ -2928,10 +2940,10 @@ packages:
peerDependencies:
'@vue/cli-service': ^3.0.0 || ^4.0.0 || ^5.0.0-0
dependencies:
'@vue/cli-service': 5.0.1(vue-template-compiler@2.6.14)(vue@2.6.14)
'@vue/cli-service': 5.0.1(sass-loader@10.4.1)(vue-template-compiler@2.6.14)(vue@2.6.14)
dev: true
/@vue/cli-service@5.0.1(vue-template-compiler@2.6.14)(vue@2.6.14):
/@vue/cli-service@5.0.1(sass-loader@10.4.1)(vue-template-compiler@2.6.14)(vue@2.6.14):
resolution: {integrity: sha512-lhTW1d8waZv1VaRSvhE5pWWfkdmAgRTRSluDfyxkehZHMAWi//rd7a9zppN3k9Zr4X3oYVii+u7wR/RcTlr9cQ==}
engines: {node: ^12.0.0 || >= 14.0.0}
hasBin: true
@ -3005,6 +3017,7 @@ packages:
postcss: 8.4.29
postcss-loader: 6.2.1(postcss@8.4.29)(webpack@5.88.2)
progress-webpack-plugin: 1.0.16(webpack@5.88.2)
sass-loader: 10.4.1(sass@1.66.1)(webpack@4.46.0)
ssri: 8.0.1
terser-webpack-plugin: 5.3.9(webpack@5.88.2)
thread-loader: 3.0.4(webpack@5.88.2)
@ -4035,6 +4048,7 @@ packages:
/binary-extensions@2.2.0:
resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==}
engines: {node: '>=8'}
requiresBuild: true
/bindings@1.5.0:
resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==}
@ -6759,6 +6773,10 @@ packages:
resolution: {integrity: sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==}
dev: false
/immutable@4.3.4:
resolution: {integrity: sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==}
dev: true
/import-fresh@3.3.0:
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
engines: {node: '>=6'}
@ -6879,6 +6897,7 @@ packages:
/is-binary-path@2.1.0:
resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==}
engines: {node: '>=8'}
requiresBuild: true
dependencies:
binary-extensions: 2.2.0
@ -6949,6 +6968,7 @@ packages:
/is-extglob@2.1.1:
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
engines: {node: '>=0.10.0'}
requiresBuild: true
/is-file-esm@1.0.0:
resolution: {integrity: sha512-rZlaNKb4Mr8WlRu2A9XdeoKgnO5aA53XdPHgCKVyCrQ/rWi89RET1+bq37Ru46obaQXeiX4vmFIm1vks41hoSA==}
@ -8561,6 +8581,7 @@ packages:
/normalize-path@2.1.1:
resolution: {integrity: sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==}
engines: {node: '>=0.10.0'}
requiresBuild: true
dependencies:
remove-trailing-separator: 1.1.0
@ -9774,6 +9795,7 @@ packages:
/readdirp@3.6.0:
resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==}
engines: {node: '>=8.10.0'}
requiresBuild: true
dependencies:
picomatch: 2.3.1
@ -9866,6 +9888,7 @@ packages:
/remove-trailing-separator@1.1.0:
resolution: {integrity: sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==}
requiresBuild: true
/renderkid@3.0.0:
resolution: {integrity: sha512-q/7VIQA8lmM1hF+jn+sFSPWGlMkSAeNYcPLmDQx2zzuiDfaLrOmumR8iaUKlenFgh0XRPIUeSPlH3A+AW3Z5pg==}
@ -10095,6 +10118,41 @@ packages:
- supports-color
dev: true
/sass-loader@10.4.1(sass@1.66.1)(webpack@4.46.0):
resolution: {integrity: sha512-aX/iJZTTpNUNx/OSYzo2KsjIUQHqvWsAhhUijFjAPdZTEhstjZI9zTNvkTTwsx+uNUJqUwOw5gacxQMx4hJxGQ==}
engines: {node: '>= 10.13.0'}
peerDependencies:
fibers: '>= 3.1.0'
node-sass: ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0
sass: ^1.3.0
webpack: ^4.36.0 || ^5.0.0
peerDependenciesMeta:
fibers:
optional: true
node-sass:
optional: true
sass:
optional: true
dependencies:
klona: 2.0.6
loader-utils: 2.0.4
neo-async: 2.6.2
sass: 1.66.1
schema-utils: 3.3.0
semver: 7.5.4
webpack: 4.46.0
dev: true
/sass@1.66.1:
resolution: {integrity: sha512-50c+zTsZOJVgFfTgwwEzkjA3/QACgdNsKueWPyAR0mRINIvLAStVQBbPg14iuqEQ74NPDbXzJARJ/O4SI1zftA==}
engines: {node: '>=14.0.0'}
hasBin: true
dependencies:
chokidar: 3.5.3
immutable: 4.3.4
source-map-js: 1.0.2
dev: true
/sax@1.2.4:
resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==}
dev: true
@ -11114,6 +11172,10 @@ packages:
through: 2.3.8
dev: true
/uni-ajax@2.5.1:
resolution: {integrity: sha512-xmJY/yl5eRAb0b2qujTS1XNYhkSRWGL4PwkYqQrLpH2BMa2v/2zCJtqcTVUmqn4qQtdP3vLoFL86vaH3ABYAZA==}
dev: false
/unicode-canonical-property-names-ecmascript@2.0.0:
resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==}
engines: {node: '>=4'}
@ -11285,6 +11347,11 @@ packages:
hasBin: true
dev: true
/uview-ui@2.0.36:
resolution: {integrity: sha512-ASSZT6M8w3GTO1eFPbsgEFV0U5UujK+8pTNr+MSUbRNcRMC1u63DDTLJVeArV91kWM0bfAexK3SK9pnTqF9TtA==}
engines: {HBuilderX: ^3.1.0}
dev: false
/v8-to-istanbul@4.1.4:
resolution: {integrity: sha512-Rw6vJHj1mbdK8edjR7+zuJrpDtKIgNdAvTSAcpYfgMIw+u2dPDntD3dgN4XQFLU2/fvFQdzj+EeSGfd/jnY5fQ==}
engines: {node: 8.x.x || >=10.10.0}

View File

@ -1,3 +1,7 @@
<style lang="scss">
/* 注意要写在第一行同时给style标签加入lang="scss"属性 */
@import "uview-ui/index.scss";
</style>
<script>
export default {
onLaunch: function() {
@ -12,6 +16,8 @@
}
</script>
<style>
/*每个页面公共css */
<style lang="scss">
body {
background-color: $u-bg-color;
}
</style>

View File

@ -1,9 +1,15 @@
import Vue from 'vue'
import App from './App'
import './uni.promisify.adaptor'
import ajax from '@/utils/ajax'
import uView from "uview-ui"
Vue.config.productionTip = false
Vue.prototype.$ajax = ajax
Vue.use(uView);
App.mpType = 'app'
const app = new Vue({

View File

@ -1,16 +1,38 @@
{
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
"navigationBarTitleText": "宝芝堂"
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/patient/index",
"style": {
"navigationBarTitleText": "病人管理",
"enablePullDownRefresh": true
}
},
{
"path": "pages/patient/detail",
"style": {
"navigationBarTitleText": "病人详细"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarTitleText": "宝芝堂",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
}
}

View File

@ -1,9 +1,11 @@
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view>
<text class="title">{{title}}</text>
</view>
<view class="page">
<u-grid align="center" :border="true" :col="2">
<u-grid-item v-for="item in list" :key="item.id" :name="item.id" @click="itemClick">
<u-image :src="`/static/${item.key}.png`" width="40" height="40" />
<text class="grid-text">{{item.name}}</text>
</u-grid-item>
</u-grid>
</view>
</template>
@ -11,39 +13,29 @@
export default {
data() {
return {
title: 'Hello'
list: [
]
}
},
onLoad() {
onReady() {
this.$ajax.get('/admin-api/category', {_action: 'getData'}).then(res => {
if (res.status == 0) {
this.list = res.data.items
}
})
},
methods: {
itemClick(key) {
uni.setStorageSync('medical_record_treat_type', key)
uni.navigateTo({
url: '/pages/patient/index'
})
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin: 200rpx auto 50rpx auto;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
<style lang="scss" scoped>
.page {
margin-top: 200px
}
</style>

View File

@ -0,0 +1,146 @@
<template>
<view class="page">
<view class="form">
<view class="title">
<u-row justify="space-between">
<u-col span="6">
<u--image :src="logo" width="40" height="40" />
</u-col>
<u-col span="6" textAlign="right">
<text class="app-name">{{ appName }}</text>
</u-col>
</u-row>
</view>
<u--form :model="user" ref="form" labelWidth="70">
<u-form-item label="用户名" prop="username" ref="username" :required="true">
<u--input v-model="user.username" :focus="true" border="bottom" placeholder="请填写用户名" />
</u-form-item>
<u-form-item label="密码" prop="password" ref="password" :required="true">
<u--input v-model="user.password" border="bottom" placeholder="请填写密码" password />
</u-form-item>
<u-form-item v-if="setting.login_captcha" label="验证码" prop="captcha" ref="captcha" :required="true">
<u-input v-model="user.captcha" border="bottom" placeholder="请填写验证码">
<view slot="suffix">
<u--image :src="captcha" width="100" height="40" @click="getCaptcha" />
</view>
</u-input>
</u-form-item>
</u--form>
<view class="button">
<u-button text="登录" type="primary" @click="submit"></u-button>
</view>
</view>
<svg class="buttom-image" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto"><defs><path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z"></path></defs><g class="_parallax_1d8xe_24"><use xlink:href="#gentle-wave" x="48" y="0" fill="rgba(255, 255, 255, 0.7)"></use><use xlink:href="#gentle-wave" x="48" y="3" fill="rgba(255, 255, 255, 0.5)"></use><use xlink:href="#gentle-wave" x="48" y="5" fill="rgba(255, 255, 255, 0.3)"></use><use xlink:href="#gentle-wave" x="48" y="7" fill="rgba(255, 255, 255, 1)"></use></g></svg>
</view>
</template>
<script>
export default {
data() {
return {
user: {
username: '',
password: '',
captcha: '',
sys_captcha: ''
},
rules: {
username: {
required: true,
message: '用户名必填',
trigger: ['blur', 'change']
},
password: {
required: true,
message: '密码必填',
trigger: ['blur', 'change']
},
captcha: {
required: false,
message: '验证码必填',
trigger: ['blur', 'change']
}
},
setting: {
login_captcha: false
},
captcha: '',
logo: '',
appName: '',
}
},
onReady() {
this.$refs['form'].setRules(this.rules)
this.$ajax.get('/admin-api/_settings').then(res => {
if (res.status == 0) {
this.setting = res.data
this.logo = this.setting.logo
this.appName = this.setting.app_name
if (this.setting.login_captcha) {
this.rules.captcha.required = true
this.getCaptcha()
}
}
})
},
methods: {
submit() {
this.$refs['form'].validate().then(res => {
uni.showLoading()
this.$ajax.post('/admin-api/login', this.user).then(res => {
uni.hideLoading()
if (res.status == 0) {
uni.showToast({
title: '登录成功',
icon: 'success'
})
uni.setStorageSync('medical_record_auth_token', res.data.token)
uni.redirectTo({
url: '/pages/index/index'
})
}
})
}).catch(error => {})
},
getCaptcha() {
this.$ajax.get('/admin-api/captcha').then(res => {
if (res.status == 0) {
this.captcha = res.data.captcha_img
this.user.sys_captcha = res.data.sys_captcha
}
})
}
}
}
</script>
<style lang="scss" scoped>
.page {
background: linear-gradient(200deg, rgb(198, 225, 255) 0%, rgb(64, 128, 255) 100%);
position: absolute;
width: 100%;
height: 100%;
}
.buttom-image {
position: absolute;
width: 100%;
height: 200px;
bottom: 0;
}
.form {
padding: 10px 20px;
background-color: white;
margin: 0 10px;
border-radius: 10px;
margin-top: 200px;
}
.title {
margin: 10px 0;
}
.button {
margin-top: 10px
}
.app-name {
font-size: 20px;
}
</style>

View File

@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
}
</script>
<style>
</style>

View File

@ -0,0 +1,81 @@
<template>
<view class="page">
<u-sticky>
<u-search
v-model="search"
bgColor="white"
:showAction="false"
margin="10px 0"
placeholder="姓名/联系方式"
@search="loadData(true)"
@clear="loadData(true)"
@change="changeSearch"
/>
</u-sticky>
<u-list>
<u-list-item v-for="item in list" :key="item.id">
<u-cell
:title="`${item.name}(${item.age})`"
:label="item.phone"
:url="`/pages/patient/detail?id=${item.id}`"
:clickable="true"
:isLink="true"
/>
</u-list-item>
</u-list>
</view>
</template>
<script>
export default {
data() {
return {
list: [],
page: 1,
perPage: 10,
total: 0,
search: ''
}
},
onReady() {
this.loadData(true)
},
onPullDownRefresh() {
this.loadData(true)
},
onReachBottom() {
if (this.list.length < this.total) {
this.page++
this.loadData()
}
},
methods: {
loadData(refresh) {
if (refresh) {
this.list = []
this.page = 1
}
uni.showLoading()
this.$ajax.get('/admin-api/patient?', {_action: 'getData', page: this.page, perPage: this.perPage, keyword: this.search}).then(res => {
uni.stopPullDownRefresh()
if (res.status == 0) {
this.list = this.list.concat(res.data.items)
this.total = res.data.total
}
}).catch(error => {
uni.stopPullDownRefresh()
})
},
changeSearch(value) {
if (!value) {
this.loadData(true)
}
}
}
}
</script>
<style scoped lang="scss">
.u-list {
background-color: white;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -5,6 +5,7 @@
* 使scss使 import 便App
*
*/
@import 'uview-ui/theme.scss';
/**
* App使

49
src/utils/ajax.js 100644
View File

@ -0,0 +1,49 @@
import ajax from 'uni-ajax'
// 创建请求实例
const instance = ajax.create({
// 初始配置
baseURL: process.env.VUE_APP_BASE_API
})
instance.interceptors.request.use(
config => {
const token = uni.getStorageSync('medical_record_auth_token')
if (token) {
config.header['Authorization'] = `Bearer ${token}`
}
return config
},
error => {
// 对请求错误做些什么
return Promise.reject(error)
}
)
// 添加响应拦截器
instance.interceptors.response.use(
response => {
uni.hideLoading()
const res = response.data
if (res.status != 0 && res.doNotDisplayToast == 0) {
uni.showModal({
title: res.message
})
}
if (res.code == 401) {
uni.reLaunch({
url: '/pages/login/login'
})
}
// 对响应数据做些什么
return res
},
error => {
uni.hideLoading()
// 对响应错误做些什么
return Promise.reject(error)
}
)
// 导出 create 创建后的实例
export default instance