11.5修改
This commit is contained in:
@@ -8,10 +8,19 @@
|
||||
import api from '@/api/index.js'
|
||||
import util from "@/utils/index.js"
|
||||
import {useStore} from '@/store/index.js'
|
||||
// import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
import ccNewsTabs from '@/uni_modules/cc-newsTabs/components/cc-newsTabs/cc-newsTabs.vue'
|
||||
const store = useStore()
|
||||
// 生命周期
|
||||
onLoad((e) => {
|
||||
// console.log(e)
|
||||
c_index.value = parseInt(e.state_index)
|
||||
list_box.value[c_index.value].queryParams.isFinish = c_index.value?0:1
|
||||
// console.log(store.systemInfo)
|
||||
if(store.systemInfo) {
|
||||
swiper_h.value = store.systemInfo.windowHeight
|
||||
// console.log(swiper_h.value)
|
||||
}
|
||||
getList()
|
||||
})
|
||||
onPullDownRefresh(()=> { // 下拉刷新
|
||||
@@ -19,54 +28,192 @@
|
||||
getList()
|
||||
})
|
||||
onReachBottom(() => { // 上滑触底
|
||||
queryParams.value.page++
|
||||
list_box.value[c_index.value].queryParams.page++
|
||||
getList()
|
||||
})
|
||||
// 变量
|
||||
const inputDialog = ref()
|
||||
const state_index = ref(0)
|
||||
const swiper_h = ref(0)
|
||||
const list = ref([])
|
||||
const list_box = ref([
|
||||
{
|
||||
show_index:0,
|
||||
state:1,
|
||||
list:[],
|
||||
queryParams:{
|
||||
page:1,
|
||||
pageSize:10,
|
||||
isFinish:1
|
||||
}
|
||||
},
|
||||
{
|
||||
show_index:1,
|
||||
state:0,
|
||||
list:[],
|
||||
queryParams:{
|
||||
page:1,
|
||||
pageSize:10,
|
||||
isFinish:1
|
||||
}
|
||||
}
|
||||
])
|
||||
const queryParams = ref({
|
||||
page:1,
|
||||
pageSize:10,
|
||||
isFinish:1
|
||||
})
|
||||
const c_index = ref(-1)
|
||||
const tabArr = ref([
|
||||
{
|
||||
name: '已完成',
|
||||
id: '1',
|
||||
},
|
||||
{
|
||||
name: '待完成',
|
||||
id: '2',
|
||||
}
|
||||
])
|
||||
// 函数
|
||||
function init(){
|
||||
list.value = []
|
||||
queryParams.value.page = 1
|
||||
queryParams.value.pageSize = 10
|
||||
// list.value = []
|
||||
list_box.value[c_index.value].list = []
|
||||
list_box.value[c_index.value].queryParams.page = 1
|
||||
list_box.value[c_index.value].queryParams.pageSize = 10
|
||||
}
|
||||
function queryStateInitFunc() {
|
||||
list_box.value[c_index.value].queryParams.isFinish = c_index.value?0:1
|
||||
}
|
||||
async function getList() {
|
||||
const res = await api.getTodoist(queryParams.value)
|
||||
uni.showLoading({
|
||||
mask:true
|
||||
})
|
||||
const res = await api.getTodoist(list_box.value[c_index.value].queryParams)
|
||||
uni.hideLoading();
|
||||
if(res.code === 0) {
|
||||
if(res.data && res.data.length > 0) {
|
||||
list.value.push(...res.data)
|
||||
// list.value.push(...res.data)
|
||||
list_box.value[c_index.value].list.push(...res.data)
|
||||
}
|
||||
else{
|
||||
queryParams.value.page--
|
||||
list_box.value[c_index.value].queryParams.page--
|
||||
}
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:"获取失败",
|
||||
title:res.msg,
|
||||
icon:"error",
|
||||
duration:2000
|
||||
duration:2000,
|
||||
mask:true,
|
||||
success() {
|
||||
if(res.code === 7) // 登录失败
|
||||
{
|
||||
store.afterFailLogin(2000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function tabChange(currentIndex) {
|
||||
c_index.value = currentIndex
|
||||
console.log('tabChange is done!!!!!!!')
|
||||
// if(list_box.value[c_index.value].list.length === 0) {
|
||||
// queryStateInitFunc()
|
||||
// getList()
|
||||
// }
|
||||
|
||||
}
|
||||
function scroll_func(e) {
|
||||
c_index.value = e.detail.current
|
||||
console.log('scroll_func is done!!!!!!!')
|
||||
if(list_box.value[c_index.value].list.length === 0) {
|
||||
queryStateInitFunc()
|
||||
getList()
|
||||
}
|
||||
}
|
||||
const handle_info = ref(null)
|
||||
const handle_info_index = ref(0)
|
||||
function handle_func(item,i) {
|
||||
handle_info.value = item
|
||||
handle_info_index.value = i
|
||||
inputDialog.value.open()
|
||||
}
|
||||
function finishFunc() {
|
||||
// api.todoFinished
|
||||
uni.showModal({
|
||||
title:'温馨提示',
|
||||
content:"确定要完成该事务吗?",
|
||||
success:async function(res) {
|
||||
// console.log(res)
|
||||
if(res.confirm) {
|
||||
// console.log(handle_info.value)
|
||||
const res_ = await api.todoFinished({
|
||||
id:handle_info.value.ID,
|
||||
isFinish:1
|
||||
})
|
||||
uni.showToast({
|
||||
title:res_.msg,
|
||||
icon:"error",
|
||||
duration:2000,
|
||||
mask:true,
|
||||
success() {
|
||||
console.log(res_)
|
||||
if(res_.code === 0) {
|
||||
list_box.value[c_index.value].list.splice(handle_info_index.value,1)
|
||||
list_box.value[0].list = []
|
||||
inputDialog.value.close()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="todoBox page-box">
|
||||
<view class="td-item" v-for="(item,i) in list">
|
||||
<view class="td-content text-ellipsis-2">
|
||||
{{item.content}}
|
||||
<cc-newsTabs :tabArr="tabArr" :o_index="c_index" @tabChange="tabChange"></cc-newsTabs>
|
||||
<swiper :current="c_index" @change="scroll_func" :style="{'--size':swiper_h+'px'}" class="swiper" circular :indicator-dots="false" :autoplay="false" >
|
||||
<swiper-item v-for="(item1,i1) in list_box">
|
||||
<view class="todoBox">
|
||||
<view v-for="(item,i) in item1.list" @tap="handle_func(item,i)" class="td-item swiper-item uni-bg-green">
|
||||
<view class="td-content text-ellipsis-2">
|
||||
{{item.content}}
|
||||
</view>
|
||||
<view class="td-info small-text">
|
||||
{{util.timestampToDate(item.CreatedAt)}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<uni-popup ref="inputDialog" >
|
||||
<view class="pop-box">
|
||||
<view class="pb-title">完善手术信息</view>
|
||||
<view class="pb-content">
|
||||
<view class="pb-item">
|
||||
<view class="pb-item-left">事项说明</view>
|
||||
<view class="pb-item-right">
|
||||
{{handle_info?.content}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="pb-item">
|
||||
<view class="pb-item-left">创建时间</view>
|
||||
<view class="pb-item-right">
|
||||
{{util.timestampToDate(handle_info?.CreatedAt)}}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="!handle_info?.isFinish" class="pb-item pb-item-btn" @tap="finishFunc">完成</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="td-info small-text">
|
||||
{{util.timestampToDate(item.CreatedAt)}}
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.swiper{
|
||||
height: var(--size);
|
||||
}
|
||||
.todoBox{
|
||||
padding: 20rpx;
|
||||
.td-item{
|
||||
@@ -80,5 +227,46 @@
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
.pb-item-btn{
|
||||
padding: 20rpx 0;
|
||||
text-align: center;
|
||||
color: white;
|
||||
background: #26758d;
|
||||
justify-content: center;
|
||||
width: 66%;
|
||||
margin: 0 auto;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.pop-box{
|
||||
.pb-title{
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
background-color: white;
|
||||
padding: 20rpx;
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.pb-item{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 40rpx;
|
||||
// justify-content: space-between;
|
||||
.pb-item-left{
|
||||
width: 30%;
|
||||
color: gray;
|
||||
}
|
||||
.pb-item-right{
|
||||
position: relative;
|
||||
margin-left: 10rpx;
|
||||
width: 75%;
|
||||
}
|
||||
}
|
||||
:deep(){
|
||||
.uni-popup__wrapper{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -2,14 +2,14 @@
|
||||
// 引入依赖
|
||||
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
|
||||
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import { onLoad,onShow } from "@dcloudio/uni-app"
|
||||
import mySwiper from "@/components/mySwiper.vue"
|
||||
import {ref,onMounted,nextTick,watch} from "vue"
|
||||
import api from '@/api/index.js'
|
||||
import {useStore} from '@/store/index.js'
|
||||
// import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
|
||||
const store = useStore()
|
||||
onLoad((e) => {
|
||||
onShow((e) => {
|
||||
getLbtList()
|
||||
if(store.userInfo && !store.operation_info) { //登录过 且 未填写手术信息
|
||||
// getHospitalList()
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
const hValue = ref('') // 医院
|
||||
const hValueId = ref('') // 医院id
|
||||
function onClickH(e) {
|
||||
function onClickH() {
|
||||
h_queryParams.value.key = hValue.value
|
||||
getHospitalList()
|
||||
|
||||
@@ -78,9 +78,10 @@
|
||||
})
|
||||
}
|
||||
function toChooseH(item) {
|
||||
// console.log(item)
|
||||
choosed_h.value = item
|
||||
hValue.value = item.name
|
||||
hospitals.value = null
|
||||
// hospitals.value = null
|
||||
}
|
||||
// function blurFunc() {
|
||||
// blur_h.value = 1
|
||||
@@ -104,7 +105,7 @@
|
||||
}
|
||||
let user_info = JSON.parse(uni.getStorageSync('userInfo'))
|
||||
let h_query = {
|
||||
isSurgery:isSurgery.value,
|
||||
isSurgery:parseInt(isSurgery.value),
|
||||
surgery_time:surgery_time.value,
|
||||
userId:user_info.userId,
|
||||
hospitalId:choosed_h.value?.ID
|
||||
@@ -122,17 +123,31 @@
|
||||
}
|
||||
else{
|
||||
uni.showToast({
|
||||
title:"操作失败",
|
||||
title:res.msg,
|
||||
icon:"error",
|
||||
duration:2000
|
||||
duration:2000,
|
||||
success() {
|
||||
if(res.code === 7) // 登录失败
|
||||
{
|
||||
// // 清空缓存
|
||||
// uni.removeStorageSync('userInfo');
|
||||
// uni.removeStorageSync('access_token');
|
||||
// uni.removeStorageSync('avatarUrl');
|
||||
// uni.switchTab({
|
||||
// url:'/pages/user/index'
|
||||
// })
|
||||
store.afterFailLogin()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function todoFunc(state) {
|
||||
function todoFunc(state_index) {
|
||||
let url = '/pages/index/todo'
|
||||
if(state === 2) {
|
||||
url = '/pages/index/done'
|
||||
}
|
||||
url = '/pages/index/done?state_index='+state_index
|
||||
// if(state_index === 0) {
|
||||
// url = '/pages/index/done?state_index='+state_index
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
@@ -170,7 +185,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="main-cards">
|
||||
<view @tap="todoFunc(2)" class="mc-part" style="margin-left: 0;">
|
||||
<view @tap="todoFunc(0)" class="mc-part" style="margin-left: 0;">
|
||||
<view class="mc-part-text">已完成事项</view>
|
||||
<image src="../../static/done.png" mode="widthFix"></image>
|
||||
</view>
|
||||
@@ -221,12 +236,13 @@
|
||||
<view class="pb-item">
|
||||
<view class="pb-item-left">医院名称</view>
|
||||
<view class="pb-item-right">
|
||||
<uniEasyinput @tap.stop="focusFunc" suffixIcon="search" v-model="hValue" focus placeholder="请输入内容" @iconClick="onClickH"></uniEasyinput>
|
||||
<!-- <uniEasyinput @tap.stop="focusFunc" suffixIcon="search" v-model="hValue" focus placeholder="请输入内容" @iconClick="onClickH"></uniEasyinput>
|
||||
<view class="h_res_show_aprt" v-if="hospitals">
|
||||
<view v-for="(item,i) in hospitals" @tap.stop="toChooseH(item)" class="h_res_show_aprt_row text-ellipsis-1">
|
||||
{{item.name}}
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<uni-combox @input="onClickH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="hValue"></uni-combox>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pb-item pb-item-btn" @tap="toSave">提交</view>
|
||||
@@ -294,6 +310,7 @@
|
||||
// justify-content: space-between;
|
||||
.pb-item-left{
|
||||
width: 30%;
|
||||
color: gray;
|
||||
}
|
||||
.pb-item-right{
|
||||
position: relative;
|
||||
|
@@ -5,45 +5,47 @@
|
||||
import {useStore} from '@/store/index.js'
|
||||
import api from "@/api/index.js"
|
||||
const store = useStore()
|
||||
import emptyCard from "@/components/emptyCard.vue"
|
||||
// 生命周期
|
||||
onLoad((e) => {
|
||||
let userinfo = JSON.parse(store.userInfo)
|
||||
// console.log(userinfo)
|
||||
queryParams.value.userId = userinfo.userId
|
||||
|
||||
getList()
|
||||
})
|
||||
onPullDownRefresh(()=> { // 下拉刷新
|
||||
init()
|
||||
getList()
|
||||
})
|
||||
onReachBottom(() => { // 上滑触底
|
||||
queryParams.value.page ++
|
||||
getList()
|
||||
})
|
||||
// 变量
|
||||
// const user_info = ref(null)
|
||||
const list = ref([
|
||||
{
|
||||
id:1,
|
||||
cover_img:'https://gwjxb.oss-cn-chengdu.aliyuncs.com/logo.png',
|
||||
title:'金秋相逢 共叙合作',
|
||||
reading_num:100,
|
||||
content:`
|
||||
新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
春发其华,秋收其实。
|
||||
共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
`
|
||||
},
|
||||
{
|
||||
id:2,
|
||||
cover_img:'https://ms.bdimg.com/pacific/0/pic/1083217647_-478899572.png?x=0&y=0&h=340&w=510&vh=340.00&vw=510.00&oh=340.00&ow=510.00',
|
||||
title:'金秋相逢 共叙合作',
|
||||
reading_num:100,
|
||||
content:`
|
||||
新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
春发其华,秋收其实。
|
||||
共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
`
|
||||
}
|
||||
// {
|
||||
// id:1,
|
||||
// cover_img:'https://gwjxb.oss-cn-chengdu.aliyuncs.com/logo.png',
|
||||
// title:'金秋相逢 共叙合作',
|
||||
// reading_num:100,
|
||||
// content:`
|
||||
// 新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
// 春发其华,秋收其实。
|
||||
// 共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
// `
|
||||
// },
|
||||
// {
|
||||
// id:2,
|
||||
// cover_img:'https://ms.bdimg.com/pacific/0/pic/1083217647_-478899572.png?x=0&y=0&h=340&w=510&vh=340.00&vw=510.00&oh=340.00&ow=510.00',
|
||||
// title:'金秋相逢 共叙合作',
|
||||
// reading_num:100,
|
||||
// content:`
|
||||
// 新华社北京10月18日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
|
||||
// 春发其华,秋收其实。
|
||||
// 共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
|
||||
// `
|
||||
// }
|
||||
])
|
||||
const queryParams = ref({
|
||||
page:1,
|
||||
@@ -51,9 +53,21 @@
|
||||
userId:0
|
||||
})
|
||||
// 方法
|
||||
function init() {
|
||||
queryParams.page = 1
|
||||
queryParams.pageSize = 10
|
||||
list.value = []
|
||||
}
|
||||
async function getList() {
|
||||
const res = await api.getStarList(queryParams.value)
|
||||
|
||||
if(res.code === 0) {
|
||||
if( res.data.list.length>0) {
|
||||
list.value.push(...res.data.list)
|
||||
}
|
||||
else{
|
||||
queryParams.page-=1
|
||||
}
|
||||
}
|
||||
}
|
||||
function toDetail(item) {
|
||||
let info = encodeURIComponent(JSON.stringify(item))
|
||||
@@ -66,7 +80,7 @@
|
||||
<template>
|
||||
<view class="starBox page-box page-bg-gray">
|
||||
<view class="list-box">
|
||||
<view class="lb-card" v-for="(item,i) in list" @tap="toDetail(item)">
|
||||
<view class="lb-card" v-if="list.length > 0" v-for="(item,i) in list" @tap="toDetail(item)">
|
||||
<view class="lb-left">
|
||||
<image :src="item.cover_img" mode="aspectFill"></image>
|
||||
</view>
|
||||
@@ -75,7 +89,9 @@
|
||||
<view class="lb-content text-ellipsis-1 small-text">{{item.content}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<emptyCard v-else></emptyCard>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
|
Reference in New Issue
Block a user