add file
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import { API } from './../../../utils/network/api'
|
||||
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 + 20,
|
||||
zIndex: 99
|
||||
},
|
||||
list_1: [],
|
||||
list_2: [],
|
||||
show: false,
|
||||
add_message: "",
|
||||
current_words_type: 1
|
||||
},
|
||||
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);
|
||||
let list_name = "list_" + words_type;
|
||||
let list = this.data[list_name];
|
||||
let obj = {};
|
||||
obj.words = words;
|
||||
list.push(obj);
|
||||
console.log(list_name);
|
||||
this.setData({
|
||||
[list_name]: list,
|
||||
add_message: "",
|
||||
show: false
|
||||
})
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
showAdd(){
|
||||
this.setData({
|
||||
show: true,
|
||||
});
|
||||
},
|
||||
|
||||
onClose() {
|
||||
this.setData({
|
||||
show: false,
|
||||
});
|
||||
},
|
||||
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"te-nav-bar": "/commpents/te_navbar",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<view class="container" style="height: calc(100vh - 96rpx - {{height}}px);">
|
||||
|
||||
<t-tabs
|
||||
defaultValue="{{ current_words_type }}"
|
||||
sticky
|
||||
stickyProps="{{stickyProps}}"
|
||||
t-class="custom-tabs"
|
||||
bind:change="onTabChange"
|
||||
theme="line"
|
||||
custom-style="font-size: 32rpx"
|
||||
>
|
||||
<t-tab-panel label="问诊" value="1">
|
||||
<view class="item_list">
|
||||
<van-cell custom-style="border-radius: 20rpx;margin-bottom: 20rpx;" title="{{index + 1}}、{{item.words}}" wx:for="{{list_1}}" />
|
||||
</view>
|
||||
<view class="btn">
|
||||
<van-button bind:click="showAdd" class="addbtn" custom-style="border-radius: 20rpx;margin: 0 auto;width: 92%;position: relative;top: 50%; transform: translateY(-50%);" type="primary" color="#3CC7C0" block>添加常用语</van-button>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</t-tab-panel>
|
||||
<t-tab-panel label="处方" value="2">
|
||||
<view class="item_list">
|
||||
<van-cell custom-style="border-radius: 20rpx;margin-bottom: 20rpx;" title="{{index+1}}、{{item.words}}" wx:for="{{list_2}}" />
|
||||
</view>
|
||||
<view class="btn">
|
||||
<van-button bind:click="showAdd" class="addbtn" custom-style="border-radius: 20rpx;margin: 0 auto;width: 92%;position: relative;top: 50%; transform: translateY(-50%);" 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="请输入文字"
|
||||
autosize
|
||||
border="{{ false }}"
|
||||
/>
|
||||
</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>
|
||||
@@ -0,0 +1,57 @@
|
||||
.container{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.item_list{
|
||||
width: 92vw;
|
||||
margin: 40rpx auto;
|
||||
}
|
||||
.t-tab-panel,.t-tabs__content {
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.t-tabs__item--active{
|
||||
color: #49B9AD !important;
|
||||
font-size: 32rpx !important;
|
||||
}
|
||||
.t-tabs__item-inner--line{
|
||||
font-size: 28rpx !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%;
|
||||
}
|
||||
.popup_box{
|
||||
height: 500rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.popup_box_title{
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
border-bottom: 1px solid #E7E7E7;
|
||||
}
|
||||
.cancle{
|
||||
font-size: 32rpx;
|
||||
color: rgba(0,0,0,0.6);
|
||||
}
|
||||
.title{
|
||||
font-size: 32rpx;
|
||||
color: rgba(0,0,0,0.9);
|
||||
}
|
||||
.confirm{
|
||||
font-size: 32rpx;
|
||||
color: #3CC7C0;
|
||||
}
|
||||
.popup_box_content{
|
||||
flex: 5;
|
||||
}
|
||||
Reference in New Issue
Block a user