111
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
// components/tabBar/tabBar.js
|
||||
const app=getApp();
|
||||
import {throttle} from "../utils/util"
|
||||
import {storeBindingsBehavior} from "mobx-miniprogram-bindings"
|
||||
import {store} from '../store/store.js'
|
||||
import {getSign,getProjectStatus} from "../api/api"
|
||||
Component({
|
||||
behaviors:[storeBindingsBehavior],
|
||||
storeBindings:{
|
||||
store,
|
||||
fields:{
|
||||
active:"active"
|
||||
},
|
||||
actions:{
|
||||
updateActive:"updateActive"
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
|
||||
},
|
||||
lifetimes: {
|
||||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
||||
attached: function () {
|
||||
var info=wx.getSystemInfoSync()
|
||||
if(info.platform == 'ios'){
|
||||
this.setData({
|
||||
isIos:true
|
||||
})
|
||||
}
|
||||
},
|
||||
moved: function () { },
|
||||
detached: function () { },
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
isIos:false,
|
||||
showAgree:false,
|
||||
//active:'list',
|
||||
img_host:app.hostConfig().imghost,
|
||||
tabList:[{
|
||||
id:'list',
|
||||
name:'病例列表',
|
||||
normal:app.hostConfig().imghost+'/list.png',
|
||||
active:app.hostConfig().imghost+'/list_on.png'
|
||||
},
|
||||
{
|
||||
id:'center',
|
||||
name:'个人中心',
|
||||
normal:app.hostConfig().imghost+'/center.png',
|
||||
active:app.hostConfig().imghost+'/center_on.png'
|
||||
}
|
||||
],
|
||||
showDraft:false
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
handleGetProjectStatus(){
|
||||
getProjectStatus().then(res=>{
|
||||
this.handleGetSign()
|
||||
}).catch((error)=>{
|
||||
if(error.code==30007){
|
||||
wx.showToast({
|
||||
title: '您未登录',
|
||||
icon:'none',
|
||||
duration:4000
|
||||
})
|
||||
app.method.navigateTo({
|
||||
url: '/case/pages/mobileLogin/mobileLogin',
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onConfirmDraft(){
|
||||
this.setData({
|
||||
showDraft:false
|
||||
})
|
||||
app.method.navigateTo({
|
||||
url: '/case/pages/createCase/createCase',
|
||||
})
|
||||
},
|
||||
onCancelDraft(){
|
||||
this.setData({
|
||||
showDraft:false
|
||||
})
|
||||
},
|
||||
handleGetSign(){
|
||||
getSign().then(res=>{
|
||||
if(res && res.signImg){
|
||||
let caseDraft=wx.getStorageSync('caseDraft');
|
||||
if(caseDraft){
|
||||
this.setData({
|
||||
showDraft:true
|
||||
})
|
||||
}else{
|
||||
app.method.navigateTo({
|
||||
url: '/case/pages/createCase/createCase',
|
||||
})
|
||||
}
|
||||
|
||||
}else{
|
||||
this.setData({
|
||||
showAgree:true
|
||||
})
|
||||
}
|
||||
}).catch(error=>{
|
||||
if(error.code==30007){
|
||||
wx.showToast({
|
||||
title: '您未登录',
|
||||
icon:'none',
|
||||
duration:4000
|
||||
})
|
||||
app.method.navigateTo({
|
||||
url: '/case/pages/mobileLogin/mobileLogin',
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onConfirmAgree(){
|
||||
this.setData({
|
||||
showAgree:false
|
||||
});
|
||||
app.method.navigateTo({
|
||||
url:'/case/pages/agreement/agreement'
|
||||
})
|
||||
},
|
||||
onCancelAgree(){
|
||||
this.setData({
|
||||
showAgree:false
|
||||
})
|
||||
},
|
||||
goCreate:throttle(function(){
|
||||
this.handleGetProjectStatus()
|
||||
}),
|
||||
onChange(event) {
|
||||
this.updateActive(event.detail)
|
||||
// this.setData({
|
||||
// active:event.detail
|
||||
// });
|
||||
|
||||
//console.log(event.detail )
|
||||
let url=event.detail=='list'?'/pages/index/index':'/pages/personCenter/personCenter'
|
||||
console.log(url);
|
||||
let THIS=this;
|
||||
wx.switchTab({
|
||||
url: url,
|
||||
success:function(){
|
||||
// THIS.setData({
|
||||
// active:app.globalData.tabBar_active
|
||||
// })
|
||||
// console.log(app.globalData.tabBar_active);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"dialog":"../components/dialog/dialog",
|
||||
"van-tabbar": "@vant/weapp/tabbar/index",
|
||||
"van-tabbar-item": "@vant/weapp/tabbar-item/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<!--components/tabBar/tabBar.wxml-->
|
||||
<view class="tab">
|
||||
<van-tabbar active="{{ active }}" bind:change="onChange" border="{{false}}" z-index="9999">
|
||||
<van-tabbar-item name="{{item.id}}" wx:for="{{tabList}}" key="id">
|
||||
<image
|
||||
slot="icon"
|
||||
src="{{item.normal }}"
|
||||
mode="aspectFit"
|
||||
style="width:48rpx; height: 48rpx;"
|
||||
/>
|
||||
<image
|
||||
slot="icon-active"
|
||||
src="{{ item.active }}"
|
||||
mode="aspectFit"
|
||||
style="width:48rpx; height: 48rpx;"
|
||||
/>
|
||||
{{item.name}}
|
||||
</van-tabbar-item>
|
||||
|
||||
</van-tabbar>
|
||||
<image src="{{img_host+'/create.png'}}" alt="" class="create {{isIos?'isIos':''}}" bind:tap="goCreate"/>
|
||||
</view>
|
||||
<dialog showDialog="{{showAgree}}" showCancel="{{showCancel}}" bind:confirm="onConfirmAgree" bind:cancel="onCancelAgree" title="项目协议" confirmText="查看" message="创建病例前需签署《人工肝病例登记系统》电子协议书"></dialog>
|
||||
|
||||
<dialog showDialog="{{showDraft}}" title="注意" message="您已有一条草稿,是否去编辑?" confirmText="确定" bind:confirm="onConfirmDraft" bind:cancel="onCancelDraft"></dialog>
|
||||
@@ -0,0 +1,20 @@
|
||||
/* components/tabBar/tabBar.wxss */
|
||||
.tab{
|
||||
position: relative;
|
||||
}
|
||||
.create{
|
||||
position: fixed;
|
||||
left:50%;
|
||||
width: 153rpx;
|
||||
padding:0px;
|
||||
box-shadow: 0 -0.5px 0.5px rgba(0, 0, 0, 0.1);
|
||||
background-color: #fff;
|
||||
height: 153rpx;
|
||||
transform:translateX(-50%) ;
|
||||
bottom:-3rpx;
|
||||
border-radius: 50%;
|
||||
z-index:9999;
|
||||
}
|
||||
.create.isIos{
|
||||
bottom:63rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user