tudo editor
parent
0a7ce9cbf7
commit
1fc837b08f
|
|
@ -1,3 +1,3 @@
|
|||
ENV = 'production'
|
||||
|
||||
VUE_APP_BASE_API = 'hhttp://local.medical-record.host'
|
||||
VUE_APP_BASE_API = 'http://local.medical-record.host'
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
# 宝芝堂-Uniapp
|
||||
# 宝芝堂-uniapp
|
||||
|
||||
## dependencies
|
||||
|
||||
- [uni-ajax](https://uniajax.ponjs.com)
|
||||
- [uview-ui](https://v1.uviewui.com)
|
||||
- `pnpm install`
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@
|
|||
"@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"
|
||||
|
|
|
|||
|
|
@ -71,9 +71,6 @@ 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
|
||||
|
|
@ -11177,10 +11174,6 @@ 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'}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteBase /h5/
|
||||
RewriteRule ^index\.html$ - [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /h5/index.html [L]
|
||||
</IfModule>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
location ^~ /h5/ {
|
||||
root h5
|
||||
try_files $uri $uri/ /index.html
|
||||
}
|
||||
|
|
@ -1,12 +1,82 @@
|
|||
<template>
|
||||
<u-modal
|
||||
:show="show"
|
||||
showCancelButton
|
||||
@confirm="confirm"
|
||||
@cancel="close"
|
||||
>
|
||||
<editor id="editor" :placeholder="placeholder" @ready="onEditorReady" />
|
||||
</u-modal>
|
||||
<view class="cu-editor">
|
||||
<u-modal
|
||||
:show="show"
|
||||
showCancelButton
|
||||
@confirm="confirm"
|
||||
@cancel="close"
|
||||
>
|
||||
<view class="editor-wrapper">
|
||||
<view class="btn-content">
|
||||
<view v-for="(group, groupIndex) in btns" :key="groupIndex" class="btn-group">
|
||||
<view v-for="item in group" :key="item.action" class="btn-item" @click="handleBtn(item)">
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="btn-group">
|
||||
<view class="btn-item">
|
||||
<text>标题</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>列表</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>图片</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-group">
|
||||
<view class="btn-item">
|
||||
<text>字体颜色</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>背景色</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>字体大小</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>缩进</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-group">
|
||||
<view class="btn-item">
|
||||
<text>粗体</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>斜体</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>下划线</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>删除线</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-group">
|
||||
<view class="btn-item">
|
||||
<text>左对齐</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>居中</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>右对齐</text>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<text>两端对齐</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view v-if="btn && options" class="btn-option">
|
||||
<view class="title">{{ btn.name }}</view>
|
||||
<view class="options">
|
||||
<view v-for="item in options" :key="item.value" class="option" :style="item.style" @click="handleOption(item)">{{ item.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<editor id="editor" :placeholder="placeholder" @ready="onEditorReady" />
|
||||
</view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -20,8 +90,43 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
btns: [
|
||||
[
|
||||
{ name: '标题', type: 'format', action: 'header', options: [
|
||||
{ name: 'H1', value: 'H1' },
|
||||
{ name: 'H2', value: 'H2' },
|
||||
{ name: 'H3', value: 'H3' },
|
||||
]},
|
||||
{ name: '列表', type: 'format', action: 'list', options: [
|
||||
{ name: '有序列表', value: 'ordered' },
|
||||
{ name: '无序列表', value: 'bullet ' },
|
||||
]},
|
||||
{ name: '图片', type: 'image', action: 'insert'},
|
||||
],
|
||||
[
|
||||
{ name: '字体颜色', type: 'format', action: 'color', options: [
|
||||
{ name: '黑色', value: '#000000', style: { color: '#000000' } },
|
||||
{ name: '红色', value: '#FF0000', style: { color: '#FF0000' } },
|
||||
{ name: '绿色', value: '#008000', style: { color: '#008000' } },
|
||||
{ name: '白色', value: '#ffffff', style: { color: '#ffffff', background: 'grey' } },
|
||||
]},
|
||||
{ name: '背景色', type: 'format', action: 'backgroundColor', options: [
|
||||
{ name: '黑色', value: '#000000', style: { background: '#000000', color: '#ffffff' } },
|
||||
{ name: '红色', value: '#FF0000', style: { background: '#FF0000', color: '#ffffff' } },
|
||||
{ name: '绿色', value: '#008000', style: { background: '#008000', color: '#ffffff' } },
|
||||
{ name: '白色', value: '#ffffff', style: { background: '#ffffff', color: '#ffffff' } },
|
||||
]},
|
||||
{ name: '缩进', type: 'format', action: 'indent', options: [
|
||||
{ name: '增加缩进', value: '+1' },
|
||||
{ name: '减少缩进', value: '-1' },
|
||||
]},
|
||||
],
|
||||
],
|
||||
options: [],
|
||||
btn: '',
|
||||
option: '',
|
||||
value: '',
|
||||
show: false,
|
||||
show: true,
|
||||
editor: ''
|
||||
}
|
||||
},
|
||||
|
|
@ -34,6 +139,35 @@ export default {
|
|||
}
|
||||
}).exec()
|
||||
},
|
||||
handleBtn(e) {
|
||||
if (e.type == 'image') {
|
||||
return uni.chooseImage({
|
||||
success: (res) => {
|
||||
res.tempFilePaths.forEach(item => this.editorAction('image', { width: '100%', height: '100%', alt: '无法显示图片' }, item))
|
||||
// const files = res.tempFiles
|
||||
}
|
||||
})
|
||||
}
|
||||
if (!e.options) {
|
||||
this.editorAction(e.type, e.action)
|
||||
} else {
|
||||
this.btn = e
|
||||
this.options = e.options
|
||||
}
|
||||
},
|
||||
handleOption(e) {
|
||||
const value = e.value
|
||||
this.editorAction(this.btn.type, this.btn.action, value)
|
||||
},
|
||||
editorAction(type, action, value) {
|
||||
if (type == 'format') {
|
||||
this.editor.format(action, value)
|
||||
} else if (type == 'image') {
|
||||
this.editor.insertImage({ src: value, action })
|
||||
} else if (action == 'removeFormat') {
|
||||
this.editor.removeFormat()
|
||||
}
|
||||
},
|
||||
open(value) {
|
||||
this.value = value
|
||||
this.show = true
|
||||
|
|
@ -50,12 +184,62 @@ export default {
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.cu-editor ::v-deep .u-modal__content {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
.editor-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
overflow: scroll;
|
||||
}
|
||||
.btn-content {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.btn-group {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
margin-top: 5px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.btn-item {
|
||||
margin-right: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.btn-item:active {
|
||||
background: grey;
|
||||
color: white;
|
||||
}
|
||||
.btn-option {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.btn-option .title {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.btn-option .options {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.btn-option .option {
|
||||
padding: 0 10px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.btn-option .option:active {
|
||||
background: grey;
|
||||
color: white;
|
||||
}
|
||||
#editor {
|
||||
height: 50vh;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -65,7 +65,8 @@ export default {
|
|||
this.loading = true
|
||||
this.status = 'loading'
|
||||
// uni.showLoading()
|
||||
this.$ajax.get('/admin-api/system/admin_users', {_action: 'getData', page: this.page, perPage: this.perPage, keyword: this.search}).then(res => {
|
||||
const params = {_action: 'getData', page: this.page, perPage: this.perPage, keyword: this.search}
|
||||
this.$ajax.get('/admin-api/system/admin_users', { params }).then(res => {
|
||||
this.loading = false
|
||||
if (res.status == 0) {
|
||||
this.list = this.list.concat(res.data.items)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
import Vue from 'vue'
|
||||
import App from './App'
|
||||
import './uni.promisify.adaptor'
|
||||
import ajax from '@/utils/ajax'
|
||||
import uView from "uview-ui"
|
||||
import { formatDate } from './utils/index'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
Vue.prototype.$ajax = ajax
|
||||
|
||||
Vue.use(uView);
|
||||
Vue.filter('date', function (value, format) {
|
||||
if (!format) {
|
||||
|
|
@ -17,9 +14,15 @@ Vue.filter('date', function (value, format) {
|
|||
return formatDate(value, format)
|
||||
})
|
||||
|
||||
Vue.config.productionTip = false
|
||||
App.mpType = 'app'
|
||||
|
||||
const app = new Vue({
|
||||
...App
|
||||
})
|
||||
|
||||
require('@/utils/request.js')()
|
||||
|
||||
Vue.prototype.$ajax = uni.$u.http
|
||||
|
||||
app.$mount()
|
||||
|
|
|
|||
|
|
@ -1,66 +1,67 @@
|
|||
{
|
||||
"name": "",
|
||||
"appid": "",
|
||||
"description": "",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
"app-plus": { /* 5+App特有相关 */
|
||||
"usingComponents": true,
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
"delay": 0
|
||||
},
|
||||
"modules": { /* 模块配置 */
|
||||
|
||||
},
|
||||
"distribute": { /* 应用发布信息 */
|
||||
"android": { /* android打包配置 */
|
||||
"permissions": ["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
"ios": { /* ios打包配置 */
|
||||
|
||||
},
|
||||
"sdkConfigs": { /* SDK配置 */
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"quickapp": { /* 快应用特有相关 */
|
||||
|
||||
},
|
||||
"mp-weixin": { /* 微信小程序特有相关 */
|
||||
"appid": "",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
},
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"name" : "宝芝堂",
|
||||
"appid" : "__UNI__828F200",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
/* 5+App特有相关 */
|
||||
"usingComponents" : true,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
"modules" : {},
|
||||
/* 模块配置 */
|
||||
"distribute" : {
|
||||
/* 应用发布信息 */
|
||||
"android" : {
|
||||
/* android打包配置 */
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
"ios" : {},
|
||||
/* ios打包配置 */
|
||||
"sdkConfigs" : {}
|
||||
}
|
||||
},
|
||||
/* SDK配置 */
|
||||
"quickapp" : {},
|
||||
/* 快应用特有相关 */
|
||||
"mp-weixin" : {
|
||||
/* 微信小程序特有相关 */
|
||||
"appid" : "",
|
||||
"setting" : {
|
||||
"urlCheck" : false
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
|
|
@ -71,5 +72,15 @@
|
|||
},
|
||||
"mp-qq" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"h5" : {
|
||||
"title" : "宝芝堂",
|
||||
"router" : {
|
||||
"mode" : "history",
|
||||
"base" : "/h5/"
|
||||
},
|
||||
"devServer" : {
|
||||
"https" : false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@
|
|||
list: []
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
this.$ajax.get('/admin-api/category', {_action: 'getData'}).then(res => {
|
||||
onLoad() {
|
||||
const params = {_action: 'getData'}
|
||||
this.$ajax.get('/admin-api/category', { params }).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.list = res.data.items
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<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>
|
||||
<!-- <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>
|
||||
|
||||
|
|
@ -117,22 +117,23 @@ export default {
|
|||
<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%;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
.buttom-image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
bottom: 0;
|
||||
top: 80%;
|
||||
}
|
||||
.form {
|
||||
padding: 10px 20px;
|
||||
background-color: white;
|
||||
margin: 0 10px;
|
||||
border-radius: 10px;
|
||||
margin-top: 200px;
|
||||
}
|
||||
.title {
|
||||
margin: 10px 0;
|
||||
|
|
|
|||
|
|
@ -149,7 +149,8 @@ export default {
|
|||
return
|
||||
}
|
||||
uni.showLoading()
|
||||
this.$ajax.get(`/admin-api/patient/${this.id}`, {_action: 'getData'}).then(res => {
|
||||
const params = {_action: 'getData'}
|
||||
this.$ajax.get(`/admin-api/patient/${this.id}`, { params }).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.info = res.data
|
||||
uni.setNavigationBarTitle({ title: this.info.name })
|
||||
|
|
|
|||
|
|
@ -120,7 +120,8 @@ export default {
|
|||
} else {
|
||||
this.id = e.id
|
||||
uni.showLoading()
|
||||
this.$ajax.get(`/admin-api/patient/${e.id}`, {_action: 'getData'}).then(res => {
|
||||
const params = {_action: 'getData'}
|
||||
this.$ajax.get(`/admin-api/patient/${e.id}`, { params }).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.form = {
|
||||
id: res.data.id,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,10 @@ export default {
|
|||
this.page = 1
|
||||
}
|
||||
uni.showLoading()
|
||||
this.$ajax.get('/admin-api/patient?', {_action: 'getData', page: this.page, perPage: this.perPage, keyword: this.search}).then(res => {
|
||||
const params = {
|
||||
_action: 'getData', page: this.page, perPage: this.perPage, keyword: this.search
|
||||
}
|
||||
this.$ajax.get('/admin-api/patient?', { params }).then(res => {
|
||||
uni.stopPullDownRefresh()
|
||||
if (res.status == 0) {
|
||||
this.list = this.list.concat(res.data.items)
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@ export default {
|
|||
onLoad(e) {
|
||||
this.id = e.id
|
||||
this.loadData()
|
||||
this.$ajax.get('/admin-api/category', {_action: 'getData'}).then(res => {
|
||||
const params = { _action: 'getData' }
|
||||
this.$ajax.get('/admin-api/category', { params }).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.type.options = res.data.items
|
||||
}
|
||||
|
|
@ -206,7 +207,8 @@ export default {
|
|||
return
|
||||
}
|
||||
uni.showLoading()
|
||||
this.$ajax.get(`/admin-api/record/${this.id}`, {_action: 'getData'}).then(res => {
|
||||
const params = { _action: 'getData' }
|
||||
this.$ajax.get(`/admin-api/record/${this.id}`, { params }).then(res => {
|
||||
uni.stopPullDownRefresh()
|
||||
if (res.status == 0) {
|
||||
this.info = res.data
|
||||
|
|
|
|||
|
|
@ -182,7 +182,8 @@ export default {
|
|||
}
|
||||
})
|
||||
}
|
||||
this.$ajax.get(`/admin-api/patient/${e.patient}`, {_action: 'getData'}).then(res => {
|
||||
const params = { _action: 'getData' }
|
||||
this.$ajax.get(`/admin-api/patient/${e.patient}`, { params }).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.patient = res.data
|
||||
this.form.patient_id = this.patient.id
|
||||
|
|
@ -193,7 +194,7 @@ export default {
|
|||
title: '修改病历'
|
||||
})
|
||||
|
||||
this.$ajax.get(`/admin-api/record/${e.id}`, {_action: 'getData'}).then(res => {
|
||||
this.$ajax.get(`/admin-api/record/${e.id}`, { params: {_action: 'getData'}}).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.info = res.data
|
||||
this.patient = res.data.patient
|
||||
|
|
@ -214,7 +215,7 @@ export default {
|
|||
}
|
||||
})
|
||||
}
|
||||
this.$ajax.get('/admin-api/category', {_action: 'getData'}).then(res => {
|
||||
this.$ajax.get('/admin-api/category', { params: {_action: 'getData'}}).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.typeList = res.data.items
|
||||
let type_id = e.type_id
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export default {
|
|||
},
|
||||
onLoad(e) {
|
||||
this.patient_id = e.patient
|
||||
this.$ajax.get(`/admin-api/patient/${this.patient_id}`, {_action: 'getData'}).then(res => {
|
||||
this.$ajax.get(`/admin-api/patient/${this.patient_id}`, { params: {_action: 'getData'}}).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.patient = res.data
|
||||
uni.setNavigationBarTitle({ title: this.patient.name })
|
||||
|
|
@ -85,7 +85,7 @@ export default {
|
|||
this.loadData(true)
|
||||
},
|
||||
onReady() {
|
||||
this.$ajax.get('/admin-api/category', {_action: 'getData'}).then(res => {
|
||||
this.$ajax.get('/admin-api/category', { params: {_action: 'getData'}}).then(res => {
|
||||
if (res.status == 0) {
|
||||
this.typeList = res.data.items
|
||||
this.loadData()
|
||||
|
|
@ -108,7 +108,8 @@ export default {
|
|||
}
|
||||
uni.showLoading()
|
||||
const type = this.typeList[this.typeIndex]
|
||||
this.$ajax.get('/admin-api/record?', {_action: 'getData', page: this.page, perPage: this.perPage, type_id: type.id, patient_id: this.patient_id}).then(res => {
|
||||
const params = {_action: 'getData', page: this.page, perPage: this.perPage, type_id: type.id, patient_id: this.patient_id}
|
||||
this.$ajax.get('/admin-api/record?', { params }).then(res => {
|
||||
uni.stopPullDownRefresh()
|
||||
if (res.status == 0) {
|
||||
this.list = this.list.concat(res.data.items)
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
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}`
|
||||
}
|
||||
config.header['Accept'] = 'application/json'
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
// 对请求错误做些什么
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
// 添加响应拦截器
|
||||
instance.interceptors.response.use(
|
||||
response => {
|
||||
uni.hideLoading()
|
||||
const res = response.data
|
||||
if (res.status != 0 && res.doNotDisplayToast != 1) {
|
||||
uni.showModal({
|
||||
title: res.msg,
|
||||
showCancel: false
|
||||
})
|
||||
}
|
||||
if (res.code == 401) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
// 对响应数据做些什么
|
||||
return res
|
||||
},
|
||||
error => {
|
||||
uni.hideLoading()
|
||||
// 对响应错误做些什么
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
// 导出 create 创建后的实例
|
||||
export default instance
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
// http 网络请求
|
||||
|
||||
module.exports = () => {
|
||||
// 全局配置
|
||||
uni.$u.http.setConfig((config) => {
|
||||
config.baseURL = process.env.VUE_APP_BASE_API
|
||||
return config
|
||||
})
|
||||
|
||||
// 请求拦截
|
||||
uni.$u.http.interceptors.request.use(
|
||||
(config) => {
|
||||
const token = uni.getStorageSync('medical_record_auth_token')
|
||||
if (token) {
|
||||
config.header['Authorization'] = `Bearer ${token}`
|
||||
}
|
||||
config.header['Accept'] = 'application/json'
|
||||
return config
|
||||
},
|
||||
config => {
|
||||
return Promise.reject(config)
|
||||
}
|
||||
)
|
||||
|
||||
// 响应拦截
|
||||
uni.$u.http.interceptors.response.use(
|
||||
(response) => {
|
||||
uni.hideLoading()
|
||||
|
||||
const res = response.data
|
||||
if (res.status != 0 && res.doNotDisplayToast != 1) {
|
||||
uni.showModal({
|
||||
title: res.msg,
|
||||
showCancel: false
|
||||
})
|
||||
}
|
||||
if (res.code == 401) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
|
||||
return res
|
||||
},
|
||||
(response) => {
|
||||
uni.hideLoading()
|
||||
return Promise.reject(response)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue