2023.11.1修改

This commit is contained in:
2023-11-01 00:33:57 +08:00
parent 11cecc737f
commit 22c039a8eb
18 changed files with 497 additions and 88 deletions

84
pages/index/done.vue Normal file
View File

@@ -0,0 +1,84 @@
<script setup>
// 引入依赖
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,onPullDownRefresh,onReachBottom } from "@dcloudio/uni-app"
// import mySwiper from "@/components/mySwiper.vue"
import {ref,onMounted,nextTick,watch} from "vue"
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'
const store = useStore()
// 生命周期
onLoad((e) => {
getList()
})
onPullDownRefresh(()=> { // 下拉刷新
init()
getList()
})
onReachBottom(() => { // 上滑触底
queryParams.value.page++
getList()
})
// 变量
const list = ref([])
const queryParams = ref({
page:1,
pageSize:10,
isFinish:1
})
// 函数
function init(){
list.value = []
queryParams.value.page = 1
queryParams.value.pageSize = 10
}
async function getList() {
const res = await api.getTodoist(queryParams.value)
if(res.code === 0) {
if(res.data && res.data.length > 0) {
list.value.push(...res.data)
}
else{
queryParams.value.page--
}
}
else{
uni.showToast({
title:"获取失败",
icon:"error",
duration:2000
})
}
}
</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}}
</view>
<view class="td-info small-text">
{{util.timestampToDate(item.CreatedAt)}}
</view>
</view>
</view>
</template>
<style scoped lang="scss">
.todoBox{
padding: 20rpx;
.td-item{
padding: 20rpx 0;
border-bottom: 2rpx solid #eaeaea;
margin-bottom: 20rpx;
.td-content{
padding-bottom:20rpx;
}
.td-info{
text-align: right;
}
}
}
</style>

View File

@@ -14,7 +14,6 @@
if(store.userInfo && !store.operation_info) { //登录过 且 未填写手术信息
// getHospitalList()
setTimeout(()=>{
// console.log(inputDialog.value)
inputDialog.value.open()
},0)
}
@@ -29,40 +28,22 @@
const blur_h = ref(0)
const surgery_time = ref(null) // 手术时间
const isSurgery = ref(-1) //是否已经手术 0为手术1已经手术
const lbt_list = ref([
{
banner_name: "首页轮播2",
createtime: 1694851490,
deletetime: null,
id: 6,
image: "http://niunai.zhitou1688.com/uploads/20230922/ea3b3348df5d2b41eb49ddbf86b83516.png",
is_show: 1,
type: "index",
url: "",
weigh: 6,
},{
banner_name: "首页轮播2",
createtime: 1694851490,
deletetime: null,
id: 6,
image: "/static/vip2.png",
is_show: 1,
type: "index",
url: "",
weigh: 6,
}
])
const lbt_list = ref([])
// 失去焦点的监听
// watch(blur_h,(val1,val2) => {
// // hospitals.value = null
// console.log('监听 ',choosed_h.value)
// if(!choosed_h) { // 未选择值
// }
// })
const h_queryParams = ref({
page:1,
pageSize:1000,
key:''
})
// 函数
async function getHospitalList() {
const res = await api.getHospitalList()
const res = await api.getHospitalList(h_queryParams.value)
if(res.code == 0) {
hospitals.value = res.data.list
}
@@ -70,24 +51,24 @@
async function getLbtList() { // 获取轮播图
const res = await api.getLbtList()
if(res.code == 0) {
if(res.data.list) {
lbt_list.value = res.data.list
}
}
}
function toClose() {
inputDialog.value.close()
}
function radioChange(e) {
console.log(e)
isSurgery.value = e.detail.value
}
const single = ref('')
function maskClick(e){
console.log('maskClick事件:', e);
}
const hValue = ref('') // 医院
const hValueId = ref('') // 医院id
function onClickH(e) {
// console.log(hValue.value)
h_queryParams.value.key = hValue.value
getHospitalList()
}
@@ -97,7 +78,6 @@
})
}
function toChooseH(item) {
console.log(item)
choosed_h.value = item
hValue.value = item.name
hospitals.value = null
@@ -105,28 +85,62 @@
// function blurFunc() {
// blur_h.value = 1
// hospitals.value = null
// // console.log('blurFunc!!',blur_h.value)
// }
function focusFunc() {
// blur_h.value = 0
console.log('focusFunc')
}
function toBlur(){
// console.log('toBlur')
hospitals.value = null
}
async function toSave() {
if(isSurgery.value == -1) {
return
}
if(!surgery_time.value) {
return
}
if(!choosed_h.value || !choosed_h.value.ID) {
return
}
let user_info = JSON.parse(uni.getStorageSync('userInfo'))
const res = await api.hospital({
let h_query = {
isSurgery:isSurgery.value,
surgery_time:surgery_time.value,
userId:user_info.userId,
hospitalId:choosed_h.value?.ID
})
console.log(res)
}
const res = await api.hospital(h_query)
if(res.code == 0) {
uni.showToast({
title:"保存成功",
icon:"success",
duration:2000
})
uni.setStorageSync('operation_info',JSON.stringify(h_query))
store.operation_info = JSON.stringify(h_query)
toClose()
}
else{
uni.showToast({
title:"操作失败",
icon:"error",
duration:2000
})
}
}
function todoFunc(state) {
let url = '/pages/index/todo'
if(state === 2) {
url = '/pages/index/done'
}
uni.navigateTo({
url
})
}
function toVisionList() {
uni.navigateTo({
url:"/pages/index/visionList"
})
}
</script>
<template>
@@ -139,12 +153,28 @@
<uni-icons type="forward" color="#9bc027" size="20"></uni-icons>
</view>
</view>
<view class="attention-card">
<view class="part-title">
测试记录
</view>
<view class="ac-parts">
<view @tap="toVisionList" class="ac-part" style="color: gray;" >
视力测试记录
<uni-icons type="forward" color="gray" size="20"></uni-icons>
</view>
</view>
</view>
<view class="attention-card">
<view class="part-title">
事务处理
</view>
</view>
<view class="main-cards">
<view class="mc-part" style="margin-left: 0;">
<view @tap="todoFunc(2)" class="mc-part" style="margin-left: 0;">
<view class="mc-part-text">已完成事项</view>
<image src="../../static/done.png" mode="widthFix"></image>
</view>
<view class="mc-part mc-part2" style="margin-right: 0;">
<view @tap="todoFunc(1)" class="mc-part mc-part2" style="margin-right: 0;">
<view class="mc-part-text">待完成事项</view>
<image style="transform: rotate(0deg);" src="../../static/undone.png" mode="widthFix"></image>
</view>

84
pages/index/todo.vue Normal file
View File

@@ -0,0 +1,84 @@
<script setup>
// 引入依赖
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,onPullDownRefresh,onReachBottom } from "@dcloudio/uni-app"
// import mySwiper from "@/components/mySwiper.vue"
import {ref,onMounted,nextTick,watch} from "vue"
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'
const store = useStore()
// 生命周期
onLoad((e) => {
getList()
})
onPullDownRefresh(()=> { // 下拉刷新
init()
getList()
})
onReachBottom(() => { // 上滑触底
queryParams.value.page++
getList()
})
// 变量
const list = ref([])
const queryParams = ref({
page:1,
pageSize:10,
isFinish:0
})
// 函数
function init(){
list.value = []
queryParams.value.page = 1
queryParams.value.pageSize = 10
}
async function getList() {
const res = await api.getTodoist(queryParams.value)
if(res.code === 0) {
if(res.data && res.data.length > 0) {
list.value.push(...res.data)
}
else{
queryParams.value.page--
}
}
else{
uni.showToast({
title:"获取失败",
icon:"error",
duration:2000
})
}
}
</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}}
</view>
<view class="td-info small-text">
{{util.timestampToDate(item.CreatedAt)}}
</view>
</view>
</view>
</template>
<style scoped lang="scss">
.todoBox{
padding: 20rpx;
.td-item{
padding: 20rpx 0;
border-bottom: 2rpx solid #eaeaea;
margin-bottom: 20rpx;
.td-content{
padding-bottom:20rpx;
}
.td-info{
text-align: right;
}
}
}
</style>

104
pages/index/visionList.vue Normal file
View File

@@ -0,0 +1,104 @@
<script setup>
// 引入依赖
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,onPullDownRefresh,onReachBottom } from "@dcloudio/uni-app"
import emptyCard from "@/components/emptyCard.vue"
import {ref,onMounted,nextTick,watch} from "vue"
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'
const store = useStore()
// 生命周期
onLoad((e) => {
if(store.userInfo){
let user_info = JSON.parse(store.userInfo)
queryParams.value.userId = user_info.userId
}
getList()
})
onPullDownRefresh(()=> { // 下拉刷新
init()
getList()
})
onReachBottom(() => { // 上滑触底
queryParams.value.page++
getList()
})
// 变量
const list = ref([])
const queryParams = ref({
page:1,
pageSize:10,
userId:0
})
// 函数
function init(){
list.value = []
queryParams.value.page = 1
queryParams.value.pageSize = 10
}
async function getList() {
const res = await api.getVisionList(queryParams.value)
if(res.code === 0) {
if(res.data.list && res.data.list.length > 0) {
list.value.push(...res.data.list)
}
else{
queryParams.value.page--
}
}
else{
uni.showToast({
title:"获取失败",
icon:"error",
duration:2000
})
}
}
</script>
<template>
<view class="visinoListBox page-box">
<view class="vl-item-box" v-if="list.length > 0">
<view class="vl-item" v-for="(item,i) in list">
<view class="vl-title">{{util.timestampToDate(item.CreatedAt)}}</view>
<view class="vl-row-box">
<view class="vl-row">
<view class="vlr-left">右眼</view>
<view class="vlr-left">{{item.rightEyeVision}}</view>
</view>
<view class="vl-row">
<view class="vlr-left">左眼</view>
<view class="vlr-left">{{item.leftEyeVision}}</view>
</view>
</view>
</view>
</view>
<emptyCard v-else></emptyCard>
</view>
</template>
<style scoped lang="scss">
.visinoListBox{
.vl-item-box{
padding: 20rpx;
.vl-item{
.vl-title{
border-left: 4rpx solid red;
}
.vl-row-box{
.vl-row{
display: flex;
align-items: center;
.vlr-left{
}
.vlr-right{
margin-left: 20rpx;
}
}
}
}
}
}
</style>

View File

@@ -138,14 +138,25 @@
}
async function okFunc() { // 结束测试
// inputDialog3.value.open()
uni.showLoading({
mask:true
})
const res = await api.saveVision({
leftEyeVision:vision_info.value.left,
rightEyeVision:vision_info.value.right,
leftEyeVision:vision_info.value.left+'',
rightEyeVision:vision_info.value.right+'',
userId:userInfo.value.userId
})
uni.hideLoading()
if(res.code == 0) {
uni.showToast({
title:"保存成功",
icon:"success",
duration:2000,
success: function (res){
uni.navigateBack()
}
})
uni.navigateBack()
}
}
</script>

View File

@@ -21,6 +21,7 @@
// 函数
function getInfo(){
is_login.value = custom.checkLogin()
// store.checkLogin()
// console.log(is_login.value)
if(is_login.value) {
avatar.value = uni.getStorageSync('avatarUrl')
@@ -65,7 +66,7 @@
}
function getPhoneNumber (e) {
// tel_code.value = e.detail.code
// console.log(e)
console.log(e)
getAccess_token({code:e.detail.code})
// console.log(e.detail.code) // 动态令牌
// console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
@@ -99,7 +100,7 @@
uni.setStorageSync('access_token','Bearer '+res.data.access_token);// token单独缓存一次
let res2=await api.wx_login({code:res_p.code},userId);
if(res2.code === 0) {
store.checkLogin()
toLogin(encodeURIComponent(JSON.stringify(res.data)))
}
}
@@ -112,6 +113,13 @@
wx_login(userId)
}
}
else{
uni.showToast({
icon:"error",
title:res.msg,
duration:2000
})
}
}
async function wx_login(userId){
let res=await new Promise(resolve=>{
@@ -127,6 +135,7 @@
if(res2.code === 0) {
uni.setStorageSync('userInfo',JSON.stringify(res_form.value))
// is_login.value = custom.checkLogin()
store.checkLogin()
getInfo()
// if(newUser.value) {
// toLogin()

View File

@@ -4,14 +4,23 @@
import {ref,onMounted,nextTick} from "vue"
import {useStore} from '@/store/index.js'
import api from "@/api/index.js"
const store = useStore()
// 生命周期
onPullDownRefresh(()=> { // 下拉刷新
onLoad((e) => {
let userinfo = JSON.parse(store.userInfo)
// console.log(userinfo)
queryParams.value.userId = userinfo.userId
getList()
})
onPullDownRefresh(()=> { // 下拉刷新
getList()
})
onReachBottom(() => { // 上滑触底
getList()
})
// 变量
// const user_info = ref(null)
const list = ref([
{
id:1,
@@ -36,7 +45,16 @@
`
}
])
const queryParams = ref({
page:1,
pageSize:10,
userId:0
})
// 方法
async function getList() {
const res = await api.getStarList(queryParams.value)
}
function toDetail(item) {
let info = encodeURIComponent(JSON.stringify(item))
// console.log(info)

View File

@@ -7,16 +7,17 @@
import {ref,onMounted,nextTick} from "vue"
import {useStore} from '@/store/index.js'
import api from "@/api/index.js"
import util from "@/utils"
onLoad((e) => {
console.log(e)
a_info.value = JSON.parse(decodeURIComponent(e.info))
// console.log(e)
// a_info.value = JSON.parse(decodeURIComponent(e.info))
if(!e.id) {
uni.showToast({
icon:"error",
title:"错误",
duration:2000
})
a_info.value = null
// a_info.value = null
return
}
getDetail(e.id)
@@ -27,6 +28,19 @@
// 函数
async function getDetail(id) {
const res = await api.getArticleDetail({id})
if(res.code == 0) {
a_info.value = res.data
}
else{
uni.showToast({
title:'获取失败',
icon:"error",
duration:2000
})
}
}
async function starFunc(type) { // 点击收藏
a_info.value.isStar = type
}
</script>
<template>
@@ -34,11 +48,31 @@
<view class="title">
{{a_info?.title}}
</view>
<view class="more-info small-text">2023-10-5</view>
<view v-if="a_info" class="more-info small-text">{{util.timestampToDate(a_info?.CreatedAt)}}</view>
<view class="d-content" v-html="a_info?.content"></view>
<view class="action-box" v-if="a_info">
<view class="ab-item">
<uni-icons color="gray" type="eye" size="30"></uni-icons>
<view style="color: gray;">{{a_info?.reading_num}}</view>
</view>
<view class="ab-item">
<uni-icons color="#26758d" @tap="starFunc(0)" v-if="a_info?.isStar" type="star-filled" size="30"></uni-icons>
<uni-icons color="gray" @tap="starFunc(1)" v-else type="star" size="30"></uni-icons>
</view>
</view>
</view>
</template>
<style scoped lang="scss">
.action-box{
margin-top: 20px;
display: flex;
justify-content: flex-end;
.ab-item{
display: flex;
align-items: center;
margin: 0 20rpx;
}
}
.detailBox{
.more-info{
text-align: right;

View File

@@ -29,43 +29,36 @@
page:1,
pageSize:10
})
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日电 金秋时节,北京再迎盛会:第三届“一带一路”国际合作高峰论坛隆重举行。
春发其华,秋收其实。
共建“一带一路”走过了第一个蓬勃十年,正值风华正茂,务当昂扬奋进,奔向下一个金色十年!
`
}
])
const list = ref([])
// 方法
function init() {
queryParams.page = 1
queryParams.pageSize = 10
list.value = []
}
async function getList(){
const res = await api.getArticleList(queryParams.value)
if(res.code == 0) {
if( res.data.list.length>0) {
list.value.push(...res.data.list)
}
else{
queryParams.page-=1
}
}
else{
uni.showToast({
title:'获取失败',
icon:"error",
duration:2000
})
}
}
function toDetail(item) {
let info = encodeURIComponent(JSON.stringify(item))
// console.log(info)
uni.navigateTo({
url:"./detail?info="+info+"&id="+item.id
url:"./detail?id="+item.ID
})
}
</script>
@@ -81,7 +74,7 @@
</view>
<view class="lb-right">
<view class="lb-title">{{item.title}}</view>
<view class="lb-content text-ellipsis-1 small-text">{{item.content}}</view>
<view class="lb-content text-ellipsis-1 small-text" v-html="item.content"></view>
</view>
</view>
</view>