From 22c039a8eb658cea9b57939c1a51c1d4c0f5e022 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=98=BF=E6=80=AA?= <690927457@qq.com>
Date: Wed, 1 Nov 2023 00:33:57 +0800
Subject: [PATCH] =?UTF-8?q?2023.11.1=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 13 +++-
api/index.js | 13 ++--
api/request.js | 12 +++-
components/mySwiper.vue | 4 +-
config/index.js | 2 +-
pages.json | 21 +++++++
pages/index/done.vue | 84 +++++++++++++++++++++++++
pages/index/index.vue | 108 +++++++++++++++++++++------------
pages/index/todo.vue | 84 +++++++++++++++++++++++++
pages/index/visionList.vue | 104 +++++++++++++++++++++++++++++++
pages/index/visionTest.vue | 17 +++++-
pages/user/index.vue | 13 +++-
pages/user/star.vue | 22 ++++++-
pages/wikipedia/detail.vue | 42 +++++++++++--
pages/wikipedia/index.vue | 45 ++++++--------
static/default_icon.png | Bin 0 -> 7641 bytes
static/default_search_icon.png | Bin 0 -> 16401 bytes
store/index.js | 1 +
18 files changed, 497 insertions(+), 88 deletions(-)
create mode 100644 pages/index/done.vue
create mode 100644 pages/index/todo.vue
create mode 100644 pages/index/visionList.vue
create mode 100644 static/default_icon.png
create mode 100644 static/default_search_icon.png
diff --git a/App.vue b/App.vue
index 0fe4984..e8346d4 100644
--- a/App.vue
+++ b/App.vue
@@ -20,10 +20,13 @@
onLaunch((e) => {
console.log('App onLaunch')
let userInfo = uni.getStorageSync('userInfo')
+ let operation_info = uni.getStorageSync('operation_info')
if(userInfo) { // 已经登录过
-
store.userInfo = userInfo
}
+ if(operation_info) {
+ store.operation_info = operation_info
+ }
})
\ No newline at end of file
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 1755bab..716d171 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -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"
+ })
}
@@ -139,12 +153,28 @@
+
+
+ 测试记录
+
+
+
+ 视力测试记录
+
+
+
+
+
+
+ 事务处理
+
+
-
+
已完成事项
-
+
待完成事项
diff --git a/pages/index/todo.vue b/pages/index/todo.vue
new file mode 100644
index 0000000..fe3dea4
--- /dev/null
+++ b/pages/index/todo.vue
@@ -0,0 +1,84 @@
+
+
+
+
+
+ {{item.content}}
+
+
+ {{util.timestampToDate(item.CreatedAt)}}
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/visionList.vue b/pages/index/visionList.vue
new file mode 100644
index 0000000..f9f92b7
--- /dev/null
+++ b/pages/index/visionList.vue
@@ -0,0 +1,104 @@
+
+
+
+
+
+ {{util.timestampToDate(item.CreatedAt)}}
+
+
+ 右眼
+ {{item.rightEyeVision}}
+
+
+ 左眼
+ {{item.leftEyeVision}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/visionTest.vue b/pages/index/visionTest.vue
index ec01011..ce90e14 100644
--- a/pages/index/visionTest.vue
+++ b/pages/index/visionTest.vue
@@ -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()
}
}
diff --git a/pages/user/index.vue b/pages/user/index.vue
index 96ae389..4606910 100644
--- a/pages/user/index.vue
+++ b/pages/user/index.vue
@@ -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()
diff --git a/pages/user/star.vue b/pages/user/star.vue
index 346b70c..e1e335a 100644
--- a/pages/user/star.vue
+++ b/pages/user/star.vue
@@ -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)
diff --git a/pages/wikipedia/detail.vue b/pages/wikipedia/detail.vue
index db77796..3f72111 100644
--- a/pages/wikipedia/detail.vue
+++ b/pages/wikipedia/detail.vue
@@ -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
}
@@ -34,11 +48,31 @@
{{a_info?.title}}
- 2023-10-5
+ {{util.timestampToDate(a_info?.CreatedAt)}}
+
+
+
+ {{a_info?.reading_num}}
+
+
+
+
+
+