diff --git a/.env.production b/.env.production index 8b0b51b..f42162e 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,4 @@ ENV = 'production' -VUE_APP_BASE_API = 'http://www.xbzt.cc' \ No newline at end of file +#VUE_APP_BASE_API = 'http://www.xbzt.cc' +VUE_APP_BASE_API = 'http://local.medical-record.host' \ No newline at end of file diff --git a/public/.htaccess b/public/.htaccess index 06c7d29..032454f 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,8 +1,8 @@ RewriteEngine On - RewriteBase /h5/ + RewriteBase /client/ RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule . /h5/index.html [L] + RewriteRule . /client/index.html [L] \ No newline at end of file diff --git a/public/nginx.conf b/public/nginx.conf index 5dd0c44..a19267d 100644 --- a/public/nginx.conf +++ b/public/nginx.conf @@ -1,3 +1,3 @@ -location /h5 { - try_files $uri $uri/h5 /h5/index.html?$query_string; +location /client { + try_files $uri $uri/client /client/index.html?$query_string; } \ No newline at end of file diff --git a/src/enums/gender.js b/src/enums/gender.js index d522ea7..d3f36b9 100644 --- a/src/enums/gender.js +++ b/src/enums/gender.js @@ -1,5 +1,5 @@ const gender = { - none: { value: 0, text: '未知' }, + none: { value: 0, text: '无' }, male: { value: 1, text: '男' }, female: { value: 2, text: '女' }, } diff --git a/src/pages.json b/src/pages.json index 7af1051..ecca73b 100644 --- a/src/pages.json +++ b/src/pages.json @@ -13,35 +13,21 @@ } }, { - "path": "pages/login/login", + "path": "pages/login/index", "style": { "navigationBarTitleText": "登录" } }, { - "path": "pages/patient/index", + "path": "pages/register/index", "style": { - "navigationBarTitleText": "病人管理", - "enablePullDownRefresh": true + "navigationBarTitleText": "注册" } }, { - "path": "pages/patient/detail", + "path": "pages/user/index", "style": { - "navigationBarTitleText": "病人详细", - "enablePullDownRefresh": true - } - }, - { - "path": "pages/patient/form", - "style": { - "navigationBarTitleText": "病人表单" - } - }, - { - "path": "pages/record/form", - "style": { - "navigationBarTitleText": "病历表单" + "navigationBarTitleText": "账户信息" } }, { diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index fb03801..9ad7ace 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -2,7 +2,7 @@ - + @@ -16,7 +16,7 @@ :icon="item.image" :text="item.name" size="large" - @click="itemClick(item.id)" + @click="itemClick(item.patient_id)" /> @@ -39,21 +39,24 @@ }, methods: { init() { - this.$ajax.get('/admin-api/api/category/permission-list', {custom: { loading: true }}).then(res => { - if (res.status == 0) { - this.list = res.data.items - } - }) - this.$ajax.get('/admin-api/current-user').then(res => { + this.$ajax.get('/api/client/user/profile').then(res => { if (res.status == 0) { this.info = res.data } }) + this.$ajax.get('/api/client/patient').then(res => { + if (res.status == 0) { + this.list = res.data.map(item => { + const type = item.type + type.patient_id = item.id + return type + }) + } + }) }, itemClick(e) { - uni.setStorageSync('medical_record_treat_type_id', e) uni.navigateTo({ - url: '/pages/patient/index' + url: `/pages/record/index?type_id=${e}` }) }, logout() { @@ -62,10 +65,10 @@ content: '是否确定?', success: (e) => { if (e.confirm) { - this.$ajax.get('/admin-api/logout').then(res => { + this.$ajax.get('/api/client/logout').then(res => { if (res.status == 0) { uni.removeStorageSync('medical_record_client_auth_token') - uni.reLaunch({ url: '/pages/login/login' }) + uni.reLaunch({ url: '/pages/login/index' }) } }) } diff --git a/src/pages/index/welcome.vue b/src/pages/index/welcome.vue index 5ed4757..f70f7f5 100644 --- a/src/pages/index/welcome.vue +++ b/src/pages/index/welcome.vue @@ -18,7 +18,7 @@ export default { }) } else { uni.reLaunch({ - url: '/pages/login/login' + url: '/pages/login/index' }) } }, diff --git a/src/pages/login/login.vue b/src/pages/login/index.vue similarity index 71% rename from src/pages/login/login.vue rename to src/pages/login/index.vue index 09e4cdd..0a43407 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/index.vue @@ -12,22 +12,18 @@ - - + + - - - - - - - - + + + + @@ -43,15 +39,13 @@ export default { user: { username: '', password: '', - captcha: '', - sys_captcha: '', openid: '', open_type: '', }, rules: { username: { required: true, - message: '用户名必填', + message: '手机号必填', trigger: ['blur', 'change'] }, password: { @@ -59,17 +53,8 @@ export default { message: '密码必填', trigger: ['blur', 'change'] }, - captcha: { - required: false, - message: '验证码必填', - trigger: ['blur', 'change'] - } }, - setting: { - login_captcha: false, - web_icp: '' - }, - captcha: '', + setting: {}, logo: '', appName: '', @@ -88,10 +73,6 @@ export default { 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() - } } }) }, @@ -99,7 +80,7 @@ export default { submit() { this.$refs['form'].validate().then(res => { uni.showLoading() - this.$ajax.post('/admin-api/login', this.user).then(res => { + this.$ajax.post('/api/client/login', this.user).then(res => { uni.hideLoading() if (res.status == 0) { uni.showToast({ @@ -114,18 +95,13 @@ export default { }) }).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 - } - }) - }, handleIcp() { // #ifdef H5 window.open('https://beian.miit.gov.cn', '_blank') // #endif + }, + register() { + uni.navigateTo({ url: `/pages/register/index?openid=${this.user.openid}&open_type=${this.user.open_type}` }) } } } diff --git a/src/pages/patient/detail.vue b/src/pages/patient/detail.vue deleted file mode 100644 index c1ccac8..0000000 --- a/src/pages/patient/detail.vue +++ /dev/null @@ -1,356 +0,0 @@ - - - - - diff --git a/src/pages/patient/form.vue b/src/pages/patient/form.vue deleted file mode 100644 index c88c783..0000000 --- a/src/pages/patient/form.vue +++ /dev/null @@ -1,326 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/pages/patient/index.vue b/src/pages/patient/index.vue deleted file mode 100644 index 1280c85..0000000 --- a/src/pages/patient/index.vue +++ /dev/null @@ -1,202 +0,0 @@ - - - - diff --git a/src/pages/record/detail.vue b/src/pages/record/detail.vue index fc1fc7c..525541f 100644 --- a/src/pages/record/detail.vue +++ b/src/pages/record/detail.vue @@ -1,73 +1,15 @@ diff --git a/src/pages/record/index.vue b/src/pages/record/index.vue index e16367c..84e8855 100644 --- a/src/pages/record/index.vue +++ b/src/pages/record/index.vue @@ -1,41 +1,26 @@ @@ -43,9 +28,8 @@ export default { data() { return { - patient_id: '', - patient: {}, - typeIndex: 0, + type: '', + page: 1, perPage: 20, typeList: [], list: [], @@ -66,43 +50,26 @@ export default { } }, onLoad(e) { - this.patient_id = e.patient + this.type = e.type uni.getSystemInfo({ success: (res) => { this.listHeight = res.safeArea.height - 20 } }) - this.init() + this.loadData(true) }, onPullDownRefresh() { this.loadData(true) }, methods: { - async init() { - let res - res = await this.$ajax.get(`/admin-api/patient/${this.patient_id}`, { params: {_action: 'getData'}}) - if (res.status == 0) { - this.patient = res.data - uni.setNavigationBarTitle({ title: `${this.patient.name}-病历记录` }) - } - // res = await this.$ajax.get('/admin-api/category', { params: {_action: 'getData'}}) - // if (res.status == 0) { - // this.typeList = res.data.items - // } - this.loadData(true) - }, - changeType(e) { - this.typeIndex = e - this.loadData(true) - }, loadData(refresh) { if (refresh) { this.list = [] this.page = 1 } uni.showLoading() - const params = { _action: 'getData', page: this.page, perPage: this.perPage, patient_id: this.patient_id } - this.$ajax.get('/admin-api/record', { params }).then(res => { + const params = { page: this.page, perPage: this.perPage, type_id: this.type } + this.$ajax.get('/api/client/record', { params }).then(res => { uni.stopPullDownRefresh() if (res.status == 0) { this.list = this.list.concat(res.data.items) @@ -118,55 +85,6 @@ export default { this.loadData() } }, - openOption(index) { - const item = this.list[index] - this.option.title = item.name - this.option.id = item.id - this.option.show = true - }, - closeOption() { - this.option.show = false - }, - chooseOption(e) { - const id = this.option.id - if (e.action == 'detail') { - return uni.navigateTo({ url: `/pages/record/detail?id=${id}` }) - } - if (e.action == 'edit') { - return uni.navigateTo({ url: `/pages/record/form?id=${id}&patient=${this.patient_id}` }) - } - }, - swipeClick(e) { - const action = e.index - if (action == 0) { - return uni.showModal({ - title: '删除病历记录', - content: '是否确定?', - success: (result) => { - if (result.confirm) { - this.handleDelete(e.name) - } - } - }) - } - }, - handleDelete(id) { - uni.showLoading() - this.$ajax.delete(`/admin-api/record/${id}`).then(res => { - if (res.status == 0) { - uni.showToast({ - title: '删除成功', - icon: 'success' - }) - setTimeout(() => { - this.loadData(true) - }, 1000) - } - }) - }, - add() { - return uni.navigateTo({ url: `/pages/record/form?patient=${this.patient_id}` }) - } } } diff --git a/src/pages/register/index.vue b/src/pages/register/index.vue new file mode 100644 index 0000000..9a8c8aa --- /dev/null +++ b/src/pages/register/index.vue @@ -0,0 +1,224 @@ + + + + + \ No newline at end of file diff --git a/src/pages/user/index.vue b/src/pages/user/index.vue new file mode 100644 index 0000000..fe4152d --- /dev/null +++ b/src/pages/user/index.vue @@ -0,0 +1,166 @@ + + + + + \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 08300eb..f5bd18b 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -14,7 +14,7 @@ module.exports = () => { // 请求拦截 uni.$u.http.interceptors.request.use( (config) => { - const token = uni.getStorageSync('medical_record_auth_token') + const token = uni.getStorageSync('medical_record_client_auth_token') if (token) { config.header['Authorization'] = `Bearer ${token}` } @@ -33,7 +33,7 @@ module.exports = () => { uni.$u.http.interceptors.response.use( (response) => { uni.hideLoading() - + const res = response.data if (response.config.custom.toast && res.status != 0 && res.doNotDisplayToast != 1) { uni.showModal({ @@ -41,9 +41,9 @@ module.exports = () => { showCancel: false }) } - if (res.code == 401) { + if (res.status == 401) { uni.reLaunch({ - url: '/pages/login/login' + url: '/pages/login/index' }) }