分包医生
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
import { API } from '../../../../utils/network/api'
|
||||
import Toast from 'tdesign-miniprogram/toast/index';
|
||||
const api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
data: {
|
||||
navbarData: {
|
||||
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
||||
title: '常用语', //导航栏 中间的标题
|
||||
},
|
||||
height: app.globalData.height,
|
||||
stickyProps: {
|
||||
offsetTop: (app.globalData.height * 2),
|
||||
zIndex: 99
|
||||
},
|
||||
list_1: [],
|
||||
list_2: [],
|
||||
show: false,
|
||||
add_message: "",
|
||||
current_words_type: 1,
|
||||
focus: false,
|
||||
words_css: "border-radius: 20rpx;margin-bottom: 20rpx;",
|
||||
from: "",
|
||||
open: false
|
||||
},
|
||||
onLoad(options){
|
||||
let from = options.from;
|
||||
if(from) {
|
||||
this.setData({
|
||||
from: from
|
||||
})
|
||||
}
|
||||
},
|
||||
onTabChange(e){
|
||||
this.setData({
|
||||
current_words_type: e.detail.value
|
||||
})
|
||||
},
|
||||
onShow(){
|
||||
this.getList(1);
|
||||
this.getList(2);
|
||||
},
|
||||
getList(words_type){
|
||||
api.getDoctorWords({words_type: words_type}).then(response => {
|
||||
console.log(response);
|
||||
let list_name = "list_" + words_type;
|
||||
console.log(list_name);
|
||||
this.setData({
|
||||
[list_name]: response.data,
|
||||
})
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
add(e){
|
||||
let words_type = this.data.current_words_type;
|
||||
let words = this.data.add_message;
|
||||
|
||||
api.postDoctorWords({words_type: words_type, words: words}).then(response => {
|
||||
console.log(response);
|
||||
this.setData({
|
||||
add_message: "",
|
||||
show: false
|
||||
})
|
||||
}).then(()=>{
|
||||
this.getList(words_type)
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
delWords(e){
|
||||
console.log(e);
|
||||
let words_type = this.data.current_words_type;
|
||||
let doctor_words_id = e.currentTarget.dataset.doctor_words_id;
|
||||
if(doctor_words_id == ""){
|
||||
Toast({
|
||||
context: this,
|
||||
selector: '#t-toast',
|
||||
message: '系统常用语,无法删除',
|
||||
theme: 'warning',
|
||||
direction: 'column',
|
||||
});
|
||||
return
|
||||
}
|
||||
api.delDoctorWords({doctor_words_id: doctor_words_id}).then(response => {
|
||||
console.log(response);
|
||||
this.setData({
|
||||
open: false
|
||||
})
|
||||
}).then(()=>{
|
||||
this.getList(words_type)
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
showAdd(){
|
||||
this.setData({
|
||||
show: true,
|
||||
});
|
||||
},
|
||||
onClose() {
|
||||
this.setData({
|
||||
show: false,
|
||||
});
|
||||
},
|
||||
onInput(){
|
||||
this.setData({
|
||||
focus: true
|
||||
})
|
||||
},
|
||||
wordsClose(e){
|
||||
console.log(e);
|
||||
const { position, instance } = e.detail;
|
||||
console.log(position)
|
||||
console.log(instance)
|
||||
switch (position) {
|
||||
case 'left':
|
||||
case 'cell':
|
||||
instance.close();
|
||||
break;
|
||||
case 'right':
|
||||
Dialog.confirm({
|
||||
message: '确定删除吗?',
|
||||
}).then(() => {
|
||||
instance.close();
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
wordsOpen(e){
|
||||
console.log("open")
|
||||
console.log(e);
|
||||
this.setData({
|
||||
open: true
|
||||
})
|
||||
},
|
||||
wordsClick(e){
|
||||
console.log("click")
|
||||
console.log(e);
|
||||
if(this.data.open){
|
||||
return
|
||||
}
|
||||
let words = e.currentTarget.dataset.words;
|
||||
let from = this.data.from;
|
||||
if(from){
|
||||
wx.setStorageSync('words', words);
|
||||
wx.navigateBack()
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"te-nav-bar": "../../../../commpents/te_navbar/index",
|
||||
"van-cell": "@vant/weapp/cell/index",
|
||||
"t-tabs": "tdesign-miniprogram/tabs/tabs",
|
||||
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-popup": "@vant/weapp/popup/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-swipe-cell": "@vant/weapp/swipe-cell/index",
|
||||
"t-toast": "tdesign-miniprogram/toast/toast"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<view class="container">
|
||||
|
||||
<t-tabs
|
||||
defaultValue="{{ current_words_type }}"
|
||||
swipeable="{{false}}"
|
||||
t-class="custom-tabs"
|
||||
bind:change="onTabChange"
|
||||
theme="line"
|
||||
custom-style="font-size: 32rpx"
|
||||
>
|
||||
<t-tab-panel label="问诊" value="1">
|
||||
<view class="item_list1">
|
||||
<van-swipe-cell right-width="{{ 65 }}"
|
||||
bind:close="wordsClose"
|
||||
bind:open="wordsOpen"
|
||||
bind:click="wordsClick"
|
||||
data-words="{{item.words}}"
|
||||
wx:for="{{list_1}}">
|
||||
<van-cell-group>
|
||||
<van-cell custom-style="{{words_css}}" title="{{index + 1}}、{{item.words}}" />
|
||||
</van-cell-group>
|
||||
<view slot="right" class="delWords" bindtap="delWords" data-doctor_words_id="{{item.doctor_words_id}}">删除</view>
|
||||
</van-swipe-cell>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<van-button bind:click="showAdd" class="addbtn" custom-style="border-radius: 10rpx;margin: 0 auto;width: 92%;position: relative;top: 50%; transform: translateY(-50%);font-size: 34rpx;" type="primary" color="#3CC7C0" block>添加常用语</van-button>
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
<t-tab-panel label="处方" value="2">
|
||||
<view class="item_list2">
|
||||
<van-swipe-cell right-width="{{ 65 }}"
|
||||
bind:close="wordsClose"
|
||||
bind:open="wordsOpen"
|
||||
bind:click="wordsClick"
|
||||
data-words="{{item.words}}"
|
||||
wx:for="{{list_2}}">
|
||||
<van-cell-group>
|
||||
<van-cell custom-style="{{words_css}}" title="{{index + 1}}、{{item.words}}" />
|
||||
</van-cell-group>
|
||||
<view slot="right" class="delWords" catchtap="delWords" data-doctor_words_id="{{item.doctor_words_id}}">删除</view>
|
||||
</van-swipe-cell>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<van-button bind:click="showAdd" class="addbtn" custom-style="border-radius: 10rpx;margin: 0 auto;width: 92%;position: relative;top: 50%; transform: translateY(-50%);font-size: 34rpx;" type="primary" color="#3CC7C0" block>添加常用语</van-button>
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
</t-tabs>
|
||||
|
||||
|
||||
<van-popup show="{{ show }}" round position="bottom" bind:close="onClose">
|
||||
<view class="popup_box">
|
||||
<view class="popup_box_title">
|
||||
<view class="cancle" bindtap="onClose">取消</view>
|
||||
<view class="title">添加常用语</view>
|
||||
<view class="confirm" bindtap="add">确认</view>
|
||||
</view>
|
||||
<view class="popup_box_content">
|
||||
<van-field
|
||||
model:value="{{ add_message }}"
|
||||
type="textarea"
|
||||
placeholder="请输入文字"
|
||||
placeholder-style="font-size: 32rpx;font-weight: 400;"
|
||||
autosize
|
||||
maxlength="500"
|
||||
custom-style="height: 100%;"
|
||||
border="{{ false }}"
|
||||
focus="{{focus}}"
|
||||
bindtap="onInput"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</van-popup>
|
||||
<!-- <view class="item_list">
|
||||
<van-cell url="/Pages/yishi/quickreply_data/index?title=在线问诊快捷回复" custom-style="border-radius: 20rpx;margin-bottom: 20rpx;" title="1、设置问诊的快捷回复" is-link />
|
||||
<van-cell url="/Pages/yishi/quickreply_data/index?title=快速问诊快捷回复" custom-style="border-radius: 20rpx;margin-bottom: 20rpx;" title="2、设置处方的快捷回复" is-link />
|
||||
<van-cell url="/Pages/yishi/quickreply_data/index?title=义诊快捷回复" custom-style="border-radius: 20rpx;margin-bottom: 20rpx;" title="3、设置处方的快捷回复" is-link />
|
||||
</view> -->
|
||||
</view>
|
||||
<t-toast id="t-toast" />
|
||||
@@ -0,0 +1,95 @@
|
||||
page{
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.container{
|
||||
width: 100vw;
|
||||
}
|
||||
.item_list1{
|
||||
width: 92vw;
|
||||
margin: 40rpx auto 180rpx auto;
|
||||
}
|
||||
.item_list2{
|
||||
width: 92vw;
|
||||
margin: 40rpx auto;
|
||||
}
|
||||
.t-tab-panel,.t-tabs__content {
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.t-tabs__item--active{
|
||||
color: #49B9AD !important;
|
||||
font-size: 36rpx !important;
|
||||
}
|
||||
.t-tabs__item-inner--line{
|
||||
font-size: 32rpx !important;
|
||||
}
|
||||
.t-tabs__track{
|
||||
background-color: var(--td-tab-track-color, var(--td-primary-color, #49B9AD)) !important;
|
||||
}
|
||||
.btn{
|
||||
height: 130rpx;
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
.popup_box{
|
||||
height: 500rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.popup_box_title{
|
||||
flex: 1;
|
||||
display: flex;
|
||||
border-bottom: 1px solid #E7E7E7;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.cancle{
|
||||
font-size: 32rpx;
|
||||
color: rgba(0,0,0,0.6);
|
||||
flex: 1;
|
||||
height: 100rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.title{
|
||||
font-size: 32rpx;
|
||||
color: rgba(0,0,0,0.9);
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100rpx;
|
||||
}
|
||||
.confirm{
|
||||
font-size: 32rpx;
|
||||
color: #3CC7C0;
|
||||
flex: 1;
|
||||
height: 100rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.popup_box_content{
|
||||
flex: 5;
|
||||
}
|
||||
.delWords{
|
||||
background-color: red;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 65px;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
}
|
||||
.van-cell {
|
||||
padding: 32rpx !important;
|
||||
font-size: 34rpx !important;
|
||||
color: #333 !important;
|
||||
word-wrap: break-word;
|
||||
word-break: normal;
|
||||
word-break:break-all;
|
||||
}
|
||||
Reference in New Issue
Block a user