Compare commits

...

21 Commits
prod ... main

@ -34,6 +34,8 @@
// sHeight.value = res.screenHeight // sHeight.value = res.screenHeight
} }
}) })
//
store.getBgList()
}) })
</script> </script>
<style lang="scss"> <style lang="scss">

@ -16,12 +16,16 @@ const API = {
getLbtList:data => net.GET("/banner/list",data),// 获取轮播图 getLbtList:data => net.GET("/banner/list",data),// 获取轮播图
hospital:data => net.PUT("/user/hospital",data),// 修改医院信息 hospital:data => net.PUT("/user/hospital",data),// 修改医院信息
getHospitalInfo:id => net.GET("/hospital/"+id),// 根据ID获取医院信息 getHospitalInfo:id => net.GET("/hospital/"+id),// 根据ID获取医院信息
getTodoist:data => net.GET("/user/todo",data),// 获取待办事项 getHospitalInfo2:data => net.GET("/hospital/notes",data),// 根据ID获取医院信息222
getTodoist:(data,userId) => net.GET("/user/todo",data,true,{"userId":userId}),// 获取待办事项
getVisionList:data => net.GET("/vision/list",data),// 获取测试记录 getVisionList:data => net.GET("/vision/list",data),// 获取测试记录
todoFinished:data => net.PUT("/user/todo",data),// 修改待办列表状态 todoFinished:data => net.PUT("/user/todo",data),// 修改待办列表状态
todayTodoList:data => net.GET("/user/todo/today",data),// 今天待办列表
// 百科 // 百科
getArticleList:data => net.GET("/article/list",data),// 百科列表 getArticleList:data => net.GET("/article/list",data),// 百科列表
getArticleDetail:data => net.GET("/article/"+data.id),// 文章详情 getArticleDetail:(data,userId) => net.GET("/article/"+data.id,null,true,{"userId":userId}),// 文章详情
getArticleFavorite:(data,userId) => net.POST("/favorite",data,true,{"userId":userId}),// 收藏文章
delArticleFavorite:(data,userId) => net.DELETE("/favorite",data,true,{"userId":userId}),// 取消收藏文章
// 我的 // 我的
getStarList:data => net.GET("/favorite/list",data),// 收藏列表 getStarList:data => net.GET("/favorite/list",data),// 收藏列表
/* /*
@ -40,6 +44,7 @@ const API = {
getCategoryList:data => net.GET('/api/goods_category/lists'), // 获取商品分类 getCategoryList:data => net.GET('/api/goods_category/lists'), // 获取商品分类
getCategory:data => net.GET('/api/goods/category',data), // 根据分类Id获取分类商品 getCategory:data => net.GET('/api/goods/category',data), // 根据分类Id获取分类商品
getCartList:data => net.GET('/api/cart/lists',data), // 获取购物车列表 getCartList:data => net.GET('/api/cart/lists',data), // 获取购物车列表
getBgList:data => net.GET('/poster/list',data), // 获取测试结果背景图列表
addCart:data => net.POST('/api/cart/add',data), // 加入购物车 addCart:data => net.POST('/api/cart/add',data), // 加入购物车
delCart:data => net.POST('/api/cart/delete',data), // 删除购物车 delCart:data => net.POST('/api/cart/delete',data), // 删除购物车
updateCart:data => net.POST('/api/cart/edit',data), // 更新购物车 updateCart:data => net.POST('/api/cart/edit',data), // 更新购物车

@ -1,6 +1,5 @@
import config from '../config' import config from '../config'
import { useStore} from '@/store/index.js'
// import store from '../store'
const loginUrl = 'pages/user/login'; const loginUrl = 'pages/user/login';
// function JSON_to_URLEncoded(element,key,list){ // function JSON_to_URLEncoded(element,key,list){
@ -75,6 +74,20 @@ export default {
}); });
} }
} }
if(res.data.code === 7) { // 登录失败
const store = useStore()
store.afterFailLogin(2000)
uni.showToast({
title:res.msg,
icon:"error",
duration:2000,
mask:true,
// success() {
// console.log(1212121)
// store.afterFailLogin(2000)
// }
})
}
return res.data; return res.data;
} else { } else {
const reg = /abort/; const reg = /abort/;

@ -3,9 +3,9 @@
<!-- 这是ai客服!!!! --> <!-- 这是ai客服!!!! -->
<unFab ref="fab" :pattern="pattern" horizontal="left" vertical="bottom" <unFab ref="fab" :pattern="pattern" horizontal="left" vertical="bottom"
direction="horizontal" @fabClick="fabClick" /> direction="horizontal" @fabClick="fabClick" />
</view> </view>
</template> </template>
<script setup> <script setup>
import unFab from '@/uni_modules/uni-fab/components/uni-fab/uni-fab.vue' import unFab from '@/uni_modules/uni-fab/components/uni-fab/uni-fab.vue'
import { onLoad } from "@dcloudio/uni-app" import { onLoad } from "@dcloudio/uni-app"
@ -23,11 +23,11 @@
iconColor: '#fff', iconColor: '#fff',
icon:'headphones' icon:'headphones'
}) })
// const content = ref([{ // const content = ref([{
// iconPath: '/static/image.png', // iconPath: '/static/image.png',
// selectedIconPath: '/static/image-active.png', // selectedIconPath: '/static/image-active.png',
// text: '', // text: '',
// active: false // active: false
// }]) // }])
function fabClick() { function fabClick() {
// uni.showToast({ // uni.showToast({
@ -37,11 +37,11 @@
uni.navigateTo({ uni.navigateTo({
url:"/pages/index/aikefu" url:"/pages/index/aikefu"
}) })
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.aikefuBox{ .aikefuBox{
margin-top: 200rpx; // margin-top: 200rpx;
} }
</style> </style>

@ -1,6 +1,8 @@
// isdev 为 true 表示开发环境 false 表示发布环境 // isdev 为 true 表示开发环境 false 表示发布环境
const isdev = true; const isdev = false;
const baseUrl = isdev ? 'http://47.116.50.126:8888' : 'http://eb467b6.r19.cpolar.top';// 办公室接口 & 测试环境 const baseUrl = isdev ? 'https://367a21fd.r12.cpolar.top' : 'https://api.jimingyiliao.com';// 办公室接口 & 测试环境
// const baseUrl = isdev ? 'https://api.jimingyiliao.com' : 'http://eb467b6.r19.cpolar.top';// 办公室接口 & 测试环境
// const baseUrl = isdev ? 'http://707788f2.r1.cpolar.top' : 'http://eb467b6.r19.cpolar.top';// 办公室接口 & 测试环境
// const baseUrl = isdev ? 'http://192.168.1.133:8899' : 'https://api.gwkjxb.com';// 办公室接口 & 正式环境 // const baseUrl = isdev ? 'http://192.168.1.133:8899' : 'https://api.gwkjxb.com';// 办公室接口 & 正式环境
// const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服) // const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服)

@ -52,10 +52,11 @@
"mp-weixin" : { "mp-weixin" : {
"appid" : "wxaaf66dbb5c3983b3", "appid" : "wxaaf66dbb5c3983b3",
"setting" : { "setting" : {
"urlCheck" : false "urlCheck" : false,
// "ignoreDevUnusedFiles": false , "minified" : true
// "ignoreUploadUnusedFiles": false
}, },
// "ignoreDevUnusedFiles": false ,
// "ignoreUploadUnusedFiles": false
"usingComponents" : true "usingComponents" : true
}, },
"mp-alipay" : { "mp-alipay" : {

@ -3,7 +3,9 @@
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "首页" "navigationBar":"custom",
"navigationBarTitleText":"",
"navigationStyle":"custom"
} }
}, },
{ {

@ -84,8 +84,8 @@
} }
// console.log(res.height,w_h.value) // console.log(res.height,w_h.value)
}).exec() }).exec()
} }
</script> </script>
<template> <template>
<view class="aikefuBox page-box page-bg-gray" style="height: 100%;"> <view class="aikefuBox page-box page-bg-gray" style="height: 100%;">
<!-- 信息展示区域 --> <!-- 信息展示区域 -->
@ -118,8 +118,8 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.aikefuBox{ .aikefuBox{
height: 100%; height: 100%;
@ -164,6 +164,7 @@
position: fixed; position: fixed;
bottom: 0px; bottom: 0px;
width: 100%; width: 100%;
box-shadow: 0px -10px 20px 1px #eaeaea;
.input-box{ .input-box{
padding: 20rpx; padding: 20rpx;
display: flex; display: flex;
@ -199,5 +200,5 @@
.ac-part{ .ac-part{
} }
} }
</style> </style>

@ -11,8 +11,12 @@
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' import ccNewsTabs from '@/uni_modules/cc-newsTabs/components/cc-newsTabs/cc-newsTabs.vue'
const store = useStore() const store = useStore()
import emptyCard from "@/components/emptyCard.vue"
// //
onLoad((e) => { onLoad((e) => {
if(uni.getStorageSync('userInfo')) {
user_info.value = JSON.parse(uni.getStorageSync('userInfo'))
}
c_index.value = parseInt(e.state_index) c_index.value = parseInt(e.state_index)
list_box.value[c_index.value].queryParams.isFinish = c_index.value?0:1 list_box.value[c_index.value].queryParams.isFinish = c_index.value?0:1
if(store.systemInfo) { if(store.systemInfo) {
@ -29,6 +33,7 @@
getList() getList()
}) })
// //
const user_info = ref(null)
const inputDialog = ref() const inputDialog = ref()
const state_index = ref(0) const state_index = ref(0)
const swiper_h = ref(0) const swiper_h = ref(0)
@ -72,6 +77,17 @@
} }
]) ])
// //
function subscribeFunc() {
uni.requestSubscribeMessage({
         tmplIds: ['BKyIwkt7HHEQoQ9ByrHqnHaGO5jq8d-MCp9YYGK23TE'],
         success: (res) => {
             console.log(res);
        },
fail(res) {
 console.log(res);
}
    })
}
function init(){ function init(){
// list.value = [] // list.value = []
list_box.value[c_index.value].list = [] list_box.value[c_index.value].list = []
@ -85,12 +101,13 @@
uni.showLoading({ uni.showLoading({
mask:true mask:true
}) })
const res = await api.getTodoist(list_box.value[c_index.value].queryParams) list_box.value[c_index.value].queryParams.userId = user_info.value?.userId || 0
const res = await api.getTodoist(list_box.value[c_index.value].queryParams,user_info.value?.userId || 0)
uni.hideLoading(); uni.hideLoading();
if(res.code === 0) { if(res.code === 0) {
if(res.data && res.data.length > 0) { if(res.data && res.data.length > 0) {
// list.value.push(...res.data) // list_box.value[c_index.value].list.push(...res.data)
list_box.value[c_index.value].list.push(...res.data) list_box.value[c_index.value].list = res.data
} }
else{ else{
list_box.value[c_index.value].queryParams.page-- list_box.value[c_index.value].queryParams.page--
@ -132,6 +149,7 @@
handle_info.value = item handle_info.value = item
handle_info_index.value = i handle_info_index.value = i
inputDialog.value.open() inputDialog.value.open()
subscribeFunc()
} }
function finishFunc() { function finishFunc() {
// api.todoFinished // api.todoFinished
@ -146,7 +164,7 @@
}) })
uni.showToast({ uni.showToast({
title:res_.msg, title:res_.msg,
icon:"error", icon:"success",
duration:2000, duration:2000,
mask:true, mask:true,
success() { success() {
@ -168,14 +186,16 @@
<swiper :current="c_index" @change="scroll_func" :style="{'--size':swiper_h+'px'}" class="swiper" circular :indicator-dots="false" :autoplay="false" > <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"> <swiper-item v-for="(item1,i1) in list_box">
<view class="todoBox"> <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 v-for="(item,i) in item1.list" v-if="item1.list.length>0" @tap="handle_func(item,i)" class="td-item swiper-item uni-bg-green">
<view class="td-content text-ellipsis-2"> <view class="td-content text-ellipsis-2">
{{item.content}} {{item.content}}
</view> </view>
<view class="td-info small-text"> <view class="td-info small-text">
{{util.timestampToDate(item.CreatedAt)}} <!-- {{util.timestampToDate(item.CreatedAt)}} -->
{{item.remindDay + " " +item.remindTime}}
</view> </view>
</view> </view>
<emptyCard v-else></emptyCard>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
@ -189,6 +209,24 @@
{{handle_info?.content}} {{handle_info?.content}}
</view> </view>
</view> </view>
<view class="pb-item">
<view class="pb-item-left">待办状态</view>
<view class="pb-item-right">
{{handle_info?.remindPeriod?'手术前':'手术后'}}
</view>
</view>
<view class="pb-item">
<view class="pb-item-left">用药频率</view>
<view class="pb-item-right">
{{handle_info?.frequency}}
</view>
</view>
<view class="pb-item">
<view class="pb-item-left">提醒时间</view>
<view class="pb-item-right">
{{handle_info?.remindTime}}
</view>
</view>
<view class="pb-item"> <view class="pb-item">
<view class="pb-item-left">创建时间</view> <view class="pb-item-left">创建时间</view>
<view class="pb-item-right"> <view class="pb-item-right">

@ -11,18 +11,25 @@
import {useStore} from '@/store/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'
const store = useStore() const store = useStore()
const h_index = ref(0)
onShow((e) => { onShow((e) => {
getLbtList() getLbtList()
if(store.userInfo && !store.operation_info) { // // if(!store.userInfo && !store.operation_info) { //
if(!store.userInfo) { //
// getHospitalList() // getHospitalList()
setTimeout(()=>{ // setTimeout(()=>{
inputDialog.value.open() // inputDialog.value.open()
},0) // },0)
} else {
// setTimeout(()=>{
// inputDialog.value.close()
// },0)
getTodayTodoList()
} }
}) })
// //
const hospitals = ref(null) const hospitals = ref([])
// const hospitals_show = ref(false) // const hospitals_show = ref(false)
const inputDialog = ref() const inputDialog = ref()
const inputClose = ref() const inputClose = ref()
@ -43,11 +50,64 @@
pageSize:1000, pageSize:1000,
key:'' key:''
}) })
const todayTodoList = ref([])
const todayTodoListShow = ref({})
// //
async function getTodayTodoList() {
const userInfo = uni.getStorageSync('userInfo')
if(userInfo) {
let user_info = JSON.parse(userInfo)
if(user_info.userId) {
const res = await api.todayTodoList({userId:user_info.userId})
if(res.code == 0) {
todayTodoList.value = res.data
//
// let o = [
// {
// remindTime: '2024.1.1',
// content: ''
// },
// {
// remindTime: '2024.1.1',
// content: '343232423'
// },
// ]
// console.log(o)
// todayTodoList.value.push(...o)
//
if(todayTodoList.value.length > 0) {
showTodo()
}
}
}
}
}
function showTodo() {
let start_num = 0
setInterval(() => {
if(!(start_num < todayTodoList.value.length)) {
start_num = 0
}
todayTodoListShow.value = todayTodoList.value[start_num]
start_num++
}, 2000)
}
function subscribeFunc() {
uni.requestSubscribeMessage({
         tmplIds: ['PgxoZOOSDgBcmIGd_EVLDnYUmL3eu6NQTAZCsHQeuWY'],
         success: (res) => {
             console.log(res);
        },
fail(res) {
 console.log(res);
}
    })
}
async function getHospitalList() { async function getHospitalList() {
const res = await api.getHospitalList(h_queryParams.value) const res = await api.getHospitalList(h_queryParams.value)
if(res.code == 0) { if(res.code == 0) {
hospitals.value = res.data.list hospitals.value = res.data.list
console.log(hospitals.value )
} }
} }
async function getLbtList() { // async function getLbtList() { //
@ -65,7 +125,7 @@
isSurgery.value = e.detail.value isSurgery.value = e.detail.value
} }
const single = ref('') const single = ref('')
function maskClick(e){ function maskClick(e){
} }
const hValue = ref('') // const hValue = ref('') //
const hValueId = ref('') // id const hValueId = ref('') // id
@ -93,7 +153,7 @@
// blur_h.value = 0 // blur_h.value = 0
} }
function toBlur(){ function toBlur(){
hospitals.value = null // hospitals.value = null
} }
async function toSave() { async function toSave() {
if(isSurgery.value == -1) { if(isSurgery.value == -1) {
@ -102,15 +162,17 @@
if(!surgery_time.value) { if(!surgery_time.value) {
return return
} }
if(!choosed_h.value || !choosed_h.value.ID) { // if(!choosed_h.value || !choosed_h.value.ID) {
return // return
} // }
let user_info = JSON.parse(uni.getStorageSync('userInfo')) let user_info = JSON.parse(uni.getStorageSync('userInfo'))
let h_query = { let h_query = {
isSurgery:parseInt(isSurgery.value), isSurgery:parseInt(isSurgery.value),
surgery_time:surgery_time.value, surgery_time:surgery_time.value,
userId:user_info.userId, userId:user_info.userId,
hospitalId:choosed_h.value?.ID // hospitalId:choosed_h.value?.ID
hospitalId:hospitals.value[h_index.value]?.ID
} }
// console.log(h_query);return // console.log(h_query);return
const res = await api.hospital(h_query) const res = await api.hospital(h_query)
@ -151,6 +213,7 @@
// if(state_index === 0) { // if(state_index === 0) {
// url = '/pages/index/done?state_index='+state_index // url = '/pages/index/done?state_index='+state_index
// } // }
subscribeFunc()
uni.navigateTo({ uni.navigateTo({
url url
}) })
@ -165,67 +228,109 @@
url:"/pages/index/note_list?index="+index url:"/pages/index/note_list?index="+index
}) })
} }
function bindPickerChange(e) {
h_index.value = e.detail.value
}
//
async function getPhoneNumber (e) {
await store.getAccess_token({code:e.detail.code})
toClose()
}
</script> </script>
<template> <template>
<view class="content page-box"> <view class="content page-box">
<!-- 背景图 -->
<view class="bg-imgs-card">
<image src="https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/bg.png" mode="aspectFill"></image>
</view>
<!-- 轮播图 --> <!-- 轮播图 -->
<mySwiper :indicatorDots="true" :isRadius="true" height="160" class="index-siwper margin-b-card" :lbt_list="lbt_list" style="width: 100%;" /> <mySwiper :indicatorDots="true" :isRadius="true" height="160" class="index-siwper margin-b-card" :lbt_list="lbt_list" style="width: 100%;" />
<view class="main-cards" @tap="toExam"> <!-- <view class="main-cards" @tap="toExam">
<view class="mc-row"> <view class="mc-row">
<view>视力测试</view> <view>视力测试</view>
<uni-icons type="forward" color="#9bc027" size="20"></uni-icons> <uni-icons type="forward" color="#9bc027" size="20"></uni-icons>
</view> </view>
</view> </view> -->
<!-- 提示弹幕 -->
<!-- <view class="todayTodoListBox" v-if="todayTodoList.length>0">
<uni-icons type="sound-filled" color="#fc9467" size="30"></uni-icons>
<view class="tlb-item-box">
<view class="tlb-item" @tap="todoFunc(1)">
<view class="tlb-content ">{{todayTodoListShow.remindTime}}: &nbsp;{{todayTodoListShow.content}}</view>
</view>
</view>
</view> -->
<view class="attention-card"> <view class="attention-card">
<view class="part-title"> <!-- <view class="part-title">
测试记录 测试记录
</view> </view> -->
<view class="ac-parts"> <!-- <view class="ac-parts">
<view @tap="toVisionList" class="ac-part" style="color: gray;" > <view @tap="toVisionList" class="ac-part" style="color: gray;" >
视力测试记录 视力测试记录
<uni-icons type="forward" color="gray" size="20"></uni-icons> <uni-icons type="forward" color="gray" size="20"></uni-icons>
</view> </view>
</view> </view> -->
</view> </view>
<view class="attention-card"> <!-- <view class="attention-card">
<view class="part-title"> <view class="part-title">
事务处理 事务处理
</view> </view>
</view> </view> -->
<view class="main-cards"> <view class="main-cards">
<view @tap="todoFunc(0)" class="mc-part" style="margin-left: 0;"> <view @tap="todoFunc(0)" class="mc-part" style="margin-left: 0;">
<image class="mc-bg-card" src="../../static/style/done.png" mode=""></image>
<view class="mc-part-text">已完成事项</view> <view class="mc-part-text">已完成事项</view>
<image src="../../static/done.png" mode="widthFix"></image> <!-- <image src="../../static/done.png" mode="widthFix"></image> -->
</view> </view>
<view @tap="todoFunc(1)" class="mc-part mc-part2" style="margin-right: 0;"> <view @tap="todoFunc(1)" class="mc-part mc-part2" style="margin-right: 0;">
<image class="mc-bg-card" src="../../static/style/undone.png" mode=""></image>
<view class="mc-part-text">待完成事项</view> <view class="mc-part-text">待完成事项</view>
<image style="transform: rotate(0deg);" src="../../static/undone.png" mode="widthFix"></image> <!-- <image style="transform: rotate(0deg);" src="../../static/undone.png" mode="widthFix"></image> -->
</view> </view>
</view> </view>
<view class="attention-card"> <view class="attention-card">
<view class="part-title"> <!-- <view class="part-title">
注意事项 注意事项
</view> </view> -->
<view class="ac-parts"> <view class="ac-parts">
<view @tap="toNote(0)" class="ac-part" style="background: linear-gradient(45deg, #ffa2a2,#ffd3d3, #ffffff00);"> <!-- <view @tap="toNote(0)" class="ac-part" style="background: linear-gradient(45deg, #ffa2a2,#ffd3d3, #ffffff00);">
术前注意事项 术前注意事项
<uni-icons type="forward" color="#ffa2a2" size="20"></uni-icons> <uni-icons type="forward" color="#ffa2a2" size="20"></uni-icons>
</view> -->
<view @tap="toNote(0)" class="ac-part" >
<view class="note-text">术前注意事项</view>
<image class="note-bg" src="../../static/style/note1.png" mode=""></image>
</view> </view>
<view @tap="toNote(1)" class="ac-part" style="background: linear-gradient(45deg, #f9b275,#fff3e9, #ffffff00);"> <view @tap="toNote(1)" class="ac-part" >
术中注意事项 <view class="note-text">术中注意事项</view>
<uni-icons type="forward" color="#f9b275" size="20"></uni-icons> <image class="note-bg" src="../../static/style/note3.png" mode=""></image>
</view> </view>
<view @tap="toNote(2)" class="ac-part" style="background: linear-gradient(45deg, #8fdc8a,#fdfdfd, #ffffff00);"> <view @tap="toNote(2)" class="ac-part" >
术后注意事项 <view class="note-text">术后注意事项</view>
<uni-icons type="forward" color="#8fdc8a" size="20"></uni-icons> <image class="note-bg" src="../../static/style/note2.png" mode=""></image>
</view>
</view>
</view>
<view class="test-card" @tap="toExam">
<view class="test-text">视力自测小助手</view>
<image class="test-img" src="../../static/style/test.png" mode=""></image>
</view>
<aikefu />
<!-- 提示弹幕 -->
<view class="todayTodoListBox" v-if="todayTodoList.length>0">
<uni-icons type="sound-filled" color="#fc9467" size="30" style="margin-right: 5px;"></uni-icons>
<view class="tlb-item-box">
<view class="tlb-item" @tap="todoFunc(1)">
<view class="tlb-content ">{{todayTodoListShow.remindTime}}: &nbsp;{{todayTodoListShow.content}}</view>
</view> </view>
</view> </view>
</view> </view>
<uni-popup ref="inputDialog" @tap="toBlur" :is-mask-click='false'> <uni-popup ref="inputDialog" @tap="toBlur" :is-mask-click='false'>
<view class="pop-box"> <view class="pop-box">
<view class="pb-title">完善手术信息</view> <view class="pb-title">您好, 请先登录</view>
<view class="pb-content"> <view class="pb-content">
<view class="pb-item"> <!-- <view class="pb-item">
<view class="pb-item-left">已经手术</view> <view class="pb-item-left">已经手术</view>
<view class="pb-item-right"> <view class="pb-item-right">
<radio-group @change="radioChange"> <radio-group @change="radioChange">
@ -237,35 +342,89 @@
<view class="pb-item"> <view class="pb-item">
<view class="pb-item-left">手术时间</view> <view class="pb-item-left">手术时间</view>
<view class="pb-item-right"> <view class="pb-item-right">
<!-- <uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" /> -->
<uniDatetimePicker type="date" :clear-icon="false" v-model="surgery_time" @maskClick="maskClick" ></uniDatetimePicker> <uniDatetimePicker type="date" :clear-icon="false" v-model="surgery_time" @maskClick="maskClick" ></uniDatetimePicker>
</view> </view>
</view> </view>
<view class="pb-item"> <view class="pb-item">
<view class="pb-item-left">医院名称</view> <view class="pb-item-left">医院名称</view>
<view class="pb-item-right"> <view class="pb-item-right">
<!-- <uniEasyinput @tap.stop="focusFunc" suffixIcon="search" v-model="hValue" focus placeholder="请输入内容" @iconClick="onClickH"></uniEasyinput> <picker @change="bindPickerChange" :value="h_index" :range="hospitals" range-key="name">
<view class="h_res_show_aprt" v-if="hospitals"> <view class="uni-input">{{hospitals[h_index]?.name}}</view>
<view v-for="(item,i) in hospitals" @tap.stop="toChooseH(item)" class="h_res_show_aprt_row text-ellipsis-1"> </picker>
{{item.name}}
</view>
</view> -->
<uni-combox @input="onClickH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="hValue"></uni-combox>
</view> </view>
</view> </view> -->
<view class="pb-item pb-item-btn" @tap="toSave"></view> <!-- <view class="pb-item pb-item-btn" @tap="toSave"></view> -->
<!-- <view class="pb-item pb-item-btn" @tap="toSave"></view> -->
<button class="buy-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"></button>
</view> </view>
</view> </view>
<view class="pop-close" @tap="toClose"> <!-- <view class="pop-close" @tap="toClose">
关闭 关闭
</view> </view> -->
<!-- <uni-popup-dialog ref="inputClose" mode="input" title="输入内容" value="对话框预置提示内容!"
placeholder="请输入内容" @confirm="dialogInputConfirm"></uni-popup-dialog> -->
</uni-popup> </uni-popup>
<aikefu />
</view> </view>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.todayTodoListBox{
display: flex;
// align-items: center;
margin-top: 1vh;
.tlb-item-box{
color: #f97a44;
font-weight: 900;
font-size: 4.2vw;
display: flex;
align-items: center;
.tlb-item{
display: flex;
align-items: center;
}
}
}
.buy-btn{
display: block;
margin-top:1rem;
background-color: #26758d;
color: white;
border-radius: 50rpx;
font-weight: 200;
font-size: 24rpx;
width: 80%;
padding: 10rpx 0;
margin: 0 auto;
}
.test-card{
padding: 30rpx 20rpx;
margin: 20rpx 0;
margin-top: 60rpx;
position: relative;
width: 50%;
.test-text{
position: relative;
z-index: 2;
}
.test-img{
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: 1;
}
}
.bg-imgs-card{
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
image{
width: 100%;
height: 100%;
}
z-index: -1;
}
.pb-item-btn{ .pb-item-btn{
padding: 20rpx 0; padding: 20rpx 0;
text-align: center; text-align: center;
@ -338,17 +497,31 @@
font-weight: 900; font-weight: 900;
} }
.attention-card{ .attention-card{
margin-top: 20rpx; // margin-top: 20rpx;
width: 100%; width: 100%;
.ac-parts{ .ac-parts{
margin-top: 20rpx; margin-top: 20rpx;
.ac-part{ .ac-part{
display: flex; // display: flex;
align-items: center; // align-items: center;
justify-content: space-between; // justify-content: space-between;
padding:30rpx 20rpx; padding:30rpx 20rpx;
color: white; // color: white;
margin: 20rpx 0; margin: 20rpx 0;
position: relative;
.note-text{
position: relative;
z-index: 2;
}
.note-bg{
position: absolute;
/* z-index: 1; */
height: 100%;
width: 100%;
right: 0px;
top: 0px;
z-index: 1;
}
} }
} }
} }
@ -357,13 +530,17 @@
.mc-part-text{ .mc-part-text{
position: relative; position: relative;
z-index: 10; z-index: 10;
font-size: 36rpx; font-size: 28rpx;
font-weight: 900; font-weight: 900;
display: flex;
align-items: center;
height: 100%;
} }
width: 50%; width: 50%;
/* text-align: center; */ /* text-align: center; */
background: linear-gradient(200deg, #82d8f2, #ddecf0); background: linear-gradient(220deg, #9cd2bc, #fff);
color: white; // color: white;
color: #484848;
padding: 40rpx 20rpx; padding: 40rpx 20rpx;
margin: 0 20rpx; margin: 0 20rpx;
border-radius: 20rpx; border-radius: 20rpx;
@ -372,16 +549,20 @@
overflow: hidden; overflow: hidden;
image{ image{
position: absolute; position: absolute;
width: 66%; left: 0;
right: 0; top: 0px;
bottom: -20%; width: 100%;
z-index: 1; height: 100%;
// transform: rotate(315deg); // position: absolute;
transform: rotate(45deg); // width: 66%;
// right: 0;
// bottom: -20%;
// z-index: 1;
// transform: rotate(45deg);
} }
} }
.mc-part2{ .mc-part2{
background: linear-gradient(200deg,#bbf4d5, #50c053); background: linear-gradient(220deg, #9cd2bc, #fff);
// text-align: right; // text-align: right;
} }
display: flex; display: flex;
@ -407,14 +588,16 @@
margin-top: 20rpx; margin-top: 20rpx;
} }
.page-box{ .page-box{
padding: 20rpx; padding: 0 20rpx;
min-height: unset; min-height: unset;
} }
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; // align-items: center;
justify-content: center; justify-content: center;
position: relative;
height: 100%;
} }
.logo { .logo {
@ -435,6 +618,7 @@
font-size: 36rpx; font-size: 36rpx;
color: #8f8f94; color: #8f8f94;
} }
</style> image{will-change: transform}
</style>

@ -99,31 +99,69 @@
uni.showLoading({ uni.showLoading({
mask:true mask:true
}) })
const res = await api.getTodoist(list_box.value[c_index.value].queryParams) //
uni.hideLoading(); let is_login = util.checkLogin()
if(res.code === 0) { if(!is_login) {
if(res.data && res.data.length > 0) { uni.showToast({
// list.value.push(...res.data) title:'请先登录',
list_box.value[c_index.value].list.push(...res.data) icon:"error",
duration:2000,
mask:true,
success() {
store.afterFailLogin(2000)
}
})
return
}
//
let operation_info = null
if(uni.getStorageSync('operation_info')) {
operation_info = JSON.parse(uni.getStorageSync('operation_info'))
}
if(operation_info && operation_info.hospitalId) {
const res = await api.getHospitalInfo2({
hospitalId:operation_info.hospitalId,
timeNum:list_box.value[c_index.value].queryParams.statet
})
// return
// const res = await api.getTodoist(list_box.value[c_index.value].queryParams)
if(res.code === 0) {
if(res.data && res.data.length > 0) {
// list_box.value[c_index.value].list.push(...res.data)
list_box.value[c_index.value].list = res.data
}
else{
list_box.value[c_index.value].queryParams.page--
}
} }
else{ else{
list_box.value[c_index.value].queryParams.page-- uni.showToast({
title:res.msg,
icon:"error",
duration:2000,
mask:true,
success() {
if(res.code === 7) //
{
store.afterFailLogin(2000)
}
}
})
} }
} } else {
else{
uni.showToast({ uni.showToast({
title:res.msg, title:'请填写手术信息',
icon:"error", icon:"error",
duration:2000, duration:2000,
mask:true, mask:true,
success() { success() {
if(res.code === 7) // setTimeout(() => {
{ store.toProfile()
store.afterFailLogin(2000) },2000)
}
} }
}) })
} }
uni.hideLoading();
} }
function tabChange(currentIndex) { function tabChange(currentIndex) {
c_index.value = currentIndex c_index.value = currentIndex
@ -143,9 +181,9 @@
const handle_info = ref(null) const handle_info = ref(null)
const handle_info_index = ref(0) const handle_info_index = ref(0)
function handle_func(item,i) { function handle_func(item,i) {
handle_info.value = item // handle_info.value = item
handle_info_index.value = i // handle_info_index.value = i
inputDialog.value.open() // inputDialog.value.open()
} }
function finishFunc() { function finishFunc() {
// api.todoFinished // api.todoFinished
@ -174,22 +212,33 @@
} }
} }
}) })
} }
</script> </script>
<template> <template>
<view class="todoBox page-box"> <view class="todoBox page-box">
<cc-newsTabs :tabArr="tabArr" :o_index="c_index" @tabChange="tabChange"></cc-newsTabs> <cc-newsTabs class="ccTabs" style="position: fixed;top: 0px;" :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 :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"> <swiper-item v-for="(item1) in list_box" :key="item1" style="overflow: auto;">
<view class="todoBox"> <view class="todoBox">
<view v-for="(item,i) in item1.list" @tap="handle_func(item,i)" class="td-item swiper-item uni-bg-green"> <template v-if="item1.list.length>0" >
<view class="td-content text-ellipsis-2"> <view v-for="(item,i) in item1.list" @tap="handle_func(item,i)" :key="i" class="td-item swiper-item uni-bg-green">
{{item.content}} <view class="td-content text-ellipsis-2">
</view> <!-- {{item.content}} -->
<view class="td-info small-text"> <image
{{util.timestampToDate(item.CreatedAt)}} style="width: 100%;"
:src="item.content"
mode="widthFix"
/>
</view>
<view class="td-info small-text">
{{util.timestampToDate(item.CreatedAt)}}
</view>
</view> </view>
</view> </template>
<template v-else>
<emptyCard />
</template>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
@ -214,11 +263,18 @@
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.ccTabs{
position: fixed;
top: 0px;
width: 100%;
z-index: 100;
}
.swiper{ .swiper{
height: var(--size); height: var(--size);
margin-top: 80rpx;
} }
.todoBox{ .todoBox{
padding: 20rpx; padding: 20rpx;
@ -277,5 +333,5 @@
.uni-popup__wrapper{ .uni-popup__wrapper{
width: 100%; width: 100%;
} }
} }
</style> </style>

@ -10,38 +10,68 @@
const store = useStore() const store = useStore()
onLoad((e) => { onLoad((e) => {
res_.value = JSON.parse(decodeURIComponent(e.res)) res_.value = JSON.parse(decodeURIComponent(e.res))
console.log(res_.value) // console.log(res_.value)
// console.log(store.bgList)
// if(store.bgList.length>0) {
// bg_imgs.value = store.bgList
// }
randomFunc() randomFunc()
}) })
// //
const res_ = ref(null) const res_ = ref(null)
const userInfo = ref(null) const userInfo = ref(null)
const bg_imgs = ref([ const bg_imgs = ref([
'/static/result1.jpg', // {url:'/static/result1.jpg'},
'/static/result2.jpg', // {url:'/static/result2.jpg'},
'/static/result3.jpg', // {url:'/static/result3.jpg'},
]) ])
const bg_index = ref(0) const bg_index = ref(0)
const avatarUrl = ref(null) const avatarUrl = ref(null)
const info = ref({left:'',right:''}) const info = ref({left:'',right:''})
const show_ = ref(false) const show_ = ref(false)
const bg_list = ref([
"https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/result/result1.jpg",
"https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/result/result2.jpg",
"https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/result/result3.jpg"
])
const bg_list_index = ref(0)
// //
function randomFunc() { function randomFunc() {
bg_index.value = parseInt((Math.random()*3)) info.value.left = parseFloat(res_.value.leftEyeVision)
info.value.right = parseFloat(res_.value.rightEyeVision)
//
if ((info.value.left + info.value.right) / 2 > 5) {
bg_list_index.value = 0
} else if ((info.value.left + info.value.right) / 2 < 4.9 && (info.value.left + info.value.right) / 2 > 4.5) {
bg_list_index.value = 1
} else if ((info.value.left + info.value.right) / 2 < 4.5) {
bg_list_index.value = 2
}
// bg_index.value = parseInt((Math.random()*store.bgList.length))
uni.getImageInfo({ uni.getImageInfo({
src:bg_imgs.value[bg_index.value], // src:bg_imgs.value[bg_index.value],
src: bg_list.value[bg_list_index.value],
success:function(res) { success:function(res) {
avatarUrl.value = uni.getStorageSync('avatarUrl') avatarUrl.value = uni.getStorageSync('avatarUrl')
info.value.left = res_.value.leftEyeVision // info.value.left = parseFloat(res_.value.leftEyeVision)
info.value.right = res_.value.rightEyeVision // info.value.right = parseFloat(res_.value.rightEyeVision)
show_.value = true show_.value = true
//
info.value.left = getRightNum(info.value.left)
info.value.right = getRightNum(info.value.right)
}, },
fail(err) { fail(err) {
console.log(err) console.log(err)
} }
}) })
} }
</script> function getRightNum(num) {
if((num+'').length === 1) {
num = num+'.0'
}
return num
}
</script>
<template> <template>
<view class="visionTestBox page-box"> <view class="visionTestBox page-box">
<!-- <view class="actionBox" :style="{background:`url(${bg_imgs[bg_index]})`}"> <!-- <view class="actionBox" :style="{background:`url(${bg_imgs[bg_index]})`}">
@ -49,7 +79,7 @@
</view> --> </view> -->
<view class="actionBox"> <view class="actionBox">
<view class="img-box"> <view class="img-box">
<image style="width: 100%;" :src="bg_imgs[bg_index]" mode="widthFix"></image> <image style="width: 100%;" :src="bg_list[bg_list_index]" mode="widthFix"></image>
<view v-if="show_" class="avatar-box"> <view v-if="show_" class="avatar-box">
<image :src="avatarUrl" mode="widthFix"></image> <image :src="avatarUrl" mode="widthFix"></image>
</view> </view>
@ -59,8 +89,8 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.avatar-box{ .avatar-box{
width: 100%; width: 100%;
@ -159,5 +189,5 @@
width: 80%; width: 80%;
margin: 0 auto; margin: 0 auto;
border-radius: 20rpx; border-radius: 20rpx;
} }
</style> </style>

@ -56,21 +56,28 @@
duration:2000 duration:2000
}) })
} }
} }
function toResult(params) {
console.log(params)
uni.redirectTo({
url:"/pages/index/result?res="+encodeURIComponent(JSON.stringify(params))
})
}
// encodeURIComponent(JSON.stringify(params))
</script> </script>
<template> <template>
<view class="visinoListBox page-box"> <view class="visinoListBox page-box">
<view class="vl-item-box" v-if="list.length > 0"> <view class="vl-item-box" v-if="list.length > 0">
<view class="vl-item" v-for="(item,i) in list"> <view class="vl-item" v-for="(item,i) in list" @tap="toResult(item)">
<view class="vl-title">{{util.timestampToDate(item.CreatedAt)}}</view> <view class="vl-title">{{util.timestampToDate(item.CreatedAt)}}</view>
<view class="vl-row-box"> <view class="vl-row-box">
<view class="vl-row"> <view class="vl-row">
<view class="vlr-left">右眼</view> <view class="vlr-left">右眼</view>
<view class="vlr-left">{{item.rightEyeVision}}</view> <view class="vlr-right">{{item.rightEyeVision}}</view>
</view> </view>
<view class="vl-row"> <view class="vl-row">
<view class="vlr-left">左眼</view> <view class="vlr-left">左眼</view>
<view class="vlr-left">{{item.leftEyeVision}}</view> <view class="vlr-right">{{item.leftEyeVision}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -83,15 +90,23 @@
.vl-item-box{ .vl-item-box{
padding: 20rpx; padding: 20rpx;
.vl-item{ .vl-item{
margin-bottom: 20rpx;
padding: 20rpx;
/* border: 1px solid #eaeaea; */
border-radius: 20rpx;
box-shadow: 5px 5px 5px #f3f3f3;
.vl-title{ .vl-title{
border-left: 4rpx solid red; border-left: 10rpx solid #26758d;
padding-left: 5px;
margin-bottom: 10px;
} }
.vl-row-box{ .vl-row-box{
.vl-row{ .vl-row{
display: flex; display: flex;
align-items: center; align-items: center;
.vlr-left{ .vlr-left{
margin-right:20rpx
;color: gray;
} }
.vlr-right{ .vlr-right{
margin-left: 20rpx; margin-left: 20rpx;

@ -149,7 +149,7 @@
const params = { const params = {
leftEyeVision:vision_info.value.left+'', leftEyeVision:vision_info.value.left+'',
rightEyeVision:vision_info.value.right+'', rightEyeVision:vision_info.value.right+'',
userId:userInfo.value.userId userId:userInfo.value?.userId || 0
} }
const res = await api.saveVision(params) const res = await api.saveVision(params)
uni.hideLoading() uni.hideLoading()

@ -1,6 +1,6 @@
<script setup> <script setup>
// //
import { onLoad } from "@dcloudio/uni-app" import { onLoad, onBackPress } from "@dcloudio/uni-app"
// import mySwiper from "@/components/mySwiper.vue" // import mySwiper from "@/components/mySwiper.vue"
import {ref,onMounted,nextTick,watch} from "vue" import {ref,onMounted,nextTick,watch} from "vue"
import {useStore} from '@/store/index.js' import {useStore} from '@/store/index.js'
@ -9,116 +9,37 @@
import custom from "@/utils/index.js" import custom from "@/utils/index.js"
onLoad((e) => { onLoad((e) => {
token_info.value = JSON.parse(decodeURIComponent(e.token_info)) token_info.value = JSON.parse(decodeURIComponent(e.token_info))
// is_login.value = custom.checkLogin()
// console.log(is_login.value)
}) })
onBackPress(() => {
return false
})
// //
const token_info = ref(null) const token_info = ref(null)
const avatarUrl = ref(null) const avatarUrl = ref(null)
const nickname = ref('') const nickname = ref('')
const res_form = ref(null) var isOperation = ref([ //
watch(nickname,(v1,v2)=> { {
console.log("watch",v1) index:0,
}) name:"否"
},
{
index: 1,
name: "是"
}
])
// //
function onChooseAvatar(e) { function onChooseAvatar(e) {
// const { avatarUrl } = e.detail
// console.log(avatarUrl)
avatarUrl.value = e.detail.avatarUrl avatarUrl.value = e.detail.avatarUrl
}
function getPhoneNumber (e) {
// tel_code.value = e.detail.code
// console.log(e)
getAccess_token({code:e.detail.code})
// console.log(e.detail.code) //
// console.log(e.detail.errMsg) //
// console.log(e.detail.errno) //
}
async function getAccess_token(code){//
//token
// wx.clearStorageSync();
if(!avatarUrl.value) {
uni.showToast({
title:"请选择头像!",
icon:"error",
duration:1500
})
return
}
if(!nickname.value) {
uni.showToast({
title:"请填写昵称!",
icon:"error",
duration:1500
})
return
}
//访
// console.log(code.value);return
// const data={
// username:code,//code
// type:'wechat_mini_app',
// identity:'user',
// password:'111',
// avatarUrl:avatarUrl.value,
// nickName:nickname.value
// }
// console.log(':',data);return;
// const res = await api.getToken(data)
// if(res.code === 200) {
// uni.setStorageSync('avatarUrl', avatarUrl.value);//avatarUrl
// res_form.value = res.data
// res_form.value.access_token = 'Bearer '+res.data.access_token
// let userId = res.data.userId
// uni.setStorageSync('access_token',res_form.value.access_token);// token
// wx_login(userId)
// }
uni.setStorageSync('avatarUrl', avatarUrl.value);//avatarUrl
wx_login(userId)
}
async function wx_login(userId){
let res=await new Promise(resolve=>{
uni.login({
provider: 'weixin', //使
success: function (loginRes) {
resolve(loginRes);
console.log(loginRes,'微信登录返回信息');
}
});
});
let res2=await api.wx_login({code:res.code},userId);
if(res2.code === 0) {
// for(let prop in res_form.value) {
// uni.setStorageSync(prop,res_form.value[prop])
// }
uni.setStorageSync('userInfo',JSON.stringify(res_form.value))
custom.uploadImage(avatarUrl.value,async (file)=>{
avatarUrl.value = file.data.file.url
uni.setStorageSync('avatarUrl', file.data.file.url);//
const up_res = await updateFunc() //
// isInfo // 使
uni.switchTab({
url:"/pages/user/index"
})
})
}
else{
uni.clearStorage();
}
} }
async function updateFunc(){ // , async function updateFunc(){ // ,
let user_info = JSON.parse(uni.getStorageSync('userInfo')) let user_info = JSON.parse(uni.getStorageSync('userInfo'))
user_info.avatar = avatarUrl.value user_info.avatar = avatarUrl.value
user_info.id =user_info.userId user_info.id =user_info.userId
// console.log(user_info)
return await api.userinfoUpdae(user_info) return await api.userinfoUpdae(user_info)
} }
function nameInput(e) { function nameInput(e) {
nickname.value = e.detail.value nickname.value = e.detail.value
// console.log('',e)
// console.log('nickname:',nickname.value)
} }
async function updateInfoFunc() { async function updateInfoFunc() {
if(!avatarUrl.value) { if(!avatarUrl.value) {
@ -137,23 +58,25 @@
}) })
return return
} }
// let user_info = JSON.parse(uni.getStorageSync('userInfo'))
await custom.uploadImage(avatarUrl.value,async (file)=>{ await custom.uploadImage(avatarUrl.value,async (file)=>{
avatarUrl.value = file.data.file.url avatarUrl.value = file.data.file.url
uni.setStorageSync('avatarUrl', file.data.file.url);// uni.setStorageSync('avatarUrl', file.data.file.url);//
token_info.value.nickname = nickname.value token_info.value.nickname = nickname.value
token_info.value.avatar = avatarUrl.value token_info.value.avatar = avatarUrl.value
uni.setStorageSync('userInfo',JSON.stringify(token_info.value)) uni.setStorageSync('userInfo',JSON.stringify(token_info.value))
uni.setStorageSync('access_token','Bearer '+token_info.value.access_token);// ,token
const up_res = await updateFunc() // const up_res = await updateFunc() //
store.checkLogin() //
uni.setStorageSync('access_token','Bearer '+token_info.value.access_token);// token
uni.switchTab({ uni.switchTab({
url:"/pages/user/index" url:"/pages/user/index"
}) })
}) })
} }
</script> function bindOperationPickerChange(e) {
token_info.value.IsSurgery = e.detail.value
}
</script>
<template> <template>
<view class="loginBox page-box img-part card-part" style="text-align:center"> <view class="loginBox page-box img-part card-part" style="text-align:center">
<view class="base-info"> <view class="base-info">
@ -163,13 +86,60 @@
</button> </button>
<input type="nickname" @blur="nameInput" class="weui-input" placeholder="请输入昵称" v-model="nickname" /> <input type="nickname" @blur="nameInput" class="weui-input" placeholder="请输入昵称" v-model="nickname" />
</view> </view>
<!-- <view class="row-box">
<view class="rb-card" @tap="toDetail(5)">
<view class="rbc-content">
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
<uni-icons type="paperplane" color="gray" size="26"></uni-icons>
已经手术</view>
<view class="rbc-content-row rbc-content-right">
<picker @change="bindOperationPickerChange" :value="token_info?.IsSurgery" :range="isOperation" range-key="name" >
<view class="rbc-content-row rbc-content-right rbc-content-right-box">
<view class="uni-input">{{ isOperation[token_info?.IsSurgery]?.name }}</view>
<uni-icons type="forward" color="gray" size="20"></uni-icons>
</view>
</picker>
</view>
</view>
</view>
</view> -->
<view class="btn-part"> <view class="btn-part">
<!-- <button class="buy-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"></button> -->
<button class="buy-btn" @tap="updateInfoFunc"></button> <button class="buy-btn" @tap="updateInfoFunc"></button>
</view> </view>
</view> </view>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.rbc-content-right-box,.rbc-content-left-box{
display: flex;
align-items: center;
justify-content: center;
}
.row-box{
padding: 20rpx 0;
.rb-card{
padding: 20rpx;
background: white;
margin-bottom: 2rpx;
.rbc-title{
}
.rbc-content-box{
margin-top: 10rpx;
.rbc-content-row{
width: 50%;
text-align: center;
// padding: 40rpx 20rpx;
// box-shadow: 10rpx 10rpx 10rpx #cdcdcd;
border-radius: 10rpx;
}
}
.rbc-content{
display: flex;
align-items: center;
justify-content: space-between;
}
}
}
.base-info{ .base-info{
padding: 50rpx 0; padding: 50rpx 0;
} }
@ -200,7 +170,7 @@
border-radius: 50rpx; border-radius: 50rpx;
font-weight: 200; font-weight: 200;
font-size: 24rpx; font-size: 24rpx;
width: 50%; width: 80%;
padding: 10rpx 0; padding: 10rpx 0;
} }
.title-part{ .title-part{
@ -225,5 +195,5 @@
} }
.weui-input{ .weui-input{
} }
</style> </style>

@ -66,7 +66,7 @@
} }
function getPhoneNumber (e) { function getPhoneNumber (e) {
// tel_code.value = e.detail.code // tel_code.value = e.detail.code
console.log(e) // console.log(e)
getAccess_token({code:e.detail.code}) getAccess_token({code:e.detail.code})
// console.log(e.detail.code) // // console.log(e.detail.code) //
// console.log(e.detail.errMsg) // // console.log(e.detail.errMsg) //
@ -74,7 +74,7 @@
} }
async function getAccess_token(params={}){//token async function getAccess_token(params={}){//token
//token //token
// wx.clearStorageSync(); wx.clearStorageSync();
//访 //访
const data={ const data={
username:params.code,//code username:params.code,//code
@ -86,6 +86,7 @@
const res = await api.getToken(data) const res = await api.getToken(data)
if(res.code === 200) { if(res.code === 200) {
// newUser.value = res.data.newUser // newUser.value = res.data.newUser
// res.data.newUser = true //
if(res.data.newUser) { // if(res.data.newUser) { //
let userId = res.data.userId let userId = res.data.userId
let res_p=await new Promise(resolve=>{ let res_p=await new Promise(resolve=>{
@ -93,15 +94,17 @@
provider: 'weixin', //使 provider: 'weixin', //使
success: function (loginRes) { success: function (loginRes) {
resolve(loginRes); resolve(loginRes);
console.log(loginRes,'微信登录返回信息'); // console.log(loginRes,'');
} }
}); });
}); });
//
uni.setStorageSync('access_token','Bearer '+res.data.access_token);// token uni.setStorageSync('access_token','Bearer '+res.data.access_token);// token
let res2=await api.wx_login({code:res_p.code},userId); let res2=await api.wx_login({code:res_p.code},userId);
if(res2.code === 0) { if(res2.code === 0) {
store.checkLogin() store.checkLogin()
toLogin(encodeURIComponent(JSON.stringify(res.data))) // toLogin(encodeURIComponent(JSON.stringify(res.data)))
store.toProfile(encodeURIComponent(JSON.stringify(res.data)))
} }
} }
else{ else{
@ -145,7 +148,7 @@
uni.clearStorage(); uni.clearStorage();
} }
} }
</script> </script>
<template> <template>
<view class="user-box page-box"> <view class="user-box page-box">
<view class="userinfo-box" @tap="toUserInfo"> <view class="userinfo-box" @tap="toUserInfo">
@ -163,7 +166,7 @@
</view> </view>
</view> </view>
<view class="row-box" v-else> <view class="row-box" v-else>
<view class="rb-card" @tap="toDetail(1)" style="margin-bottom: 10px;"> <view class="rb-card" @tap="toDetail(1)" style="margin-bottom: 10px;display: none;">
<!-- <view class="rbc-title">手术历程</view> --> <!-- <view class="rbc-title">手术历程</view> -->
<view class="rbc-content rbc-content-box"> <view class="rbc-content rbc-content-box">
<view class="rbc-content-row rbc-content-left"> <view class="rbc-content-row rbc-content-left">
@ -207,8 +210,8 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.buy-btn{ .buy-btn{
display: inline-block; display: inline-block;
@ -282,5 +285,5 @@
} }
.user-box{ .user-box{
background: #f6f6f6; background: #f6f6f6;
} }
</style> </style>

@ -71,9 +71,9 @@
} }
function toDetail(item) { function toDetail(item) {
let info = encodeURIComponent(JSON.stringify(item)) let info = encodeURIComponent(JSON.stringify(item))
// console.log(info) console.log(item)
uni.navigateTo({ uni.navigateTo({
url:"/pages/wikipedia/detail?info="+info+"&id="+item.id url:"/pages/wikipedia/detail?info="+info+"&id="+item.ID
}) })
} }
</script> </script>
@ -82,11 +82,11 @@
<view class="list-box"> <view class="list-box">
<view class="lb-card" v-if="list.length > 0" 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"> <view class="lb-left">
<image :src="item.cover_img" mode="aspectFill"></image> <image :src="item.cover" mode="aspectFill"></image>
</view> </view>
<view class="lb-right"> <view class="lb-right">
<view class="lb-title">{{item.title}}</view> <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">{{item.introduction}}</view>
</view> </view>
</view> </view>
<emptyCard v-else></emptyCard> <emptyCard v-else></emptyCard>

@ -6,26 +6,34 @@
import {useStore} from '@/store/index.js' import {useStore} from '@/store/index.js'
const store = useStore() const store = useStore()
import api from "@/api/index.js" import api from "@/api/index.js"
onLoad(() => { import custom from "@/utils/index.js"
// console.log(useStore.userInfo) const h_index = ref(0)
userinfo.value = JSON.parse(uni.getStorageSync('userInfo')) onLoad(async (e) => {
console.log(userinfo.value) await getHospitalList()
avatar.value = uni.getStorageSync('avatarUrl') is_login.value = custom.checkLogin()
if(uni.getStorageSync('operation_info')) { if(!is_login.value) { //
h_info.value = JSON.parse(uni.getStorageSync('operation_info')) userinfo.value = JSON.parse(decodeURIComponent(e.token_info))
if(h_info.value) { } else { //
// console.log(h_info.value) userinfo.value = JSON.parse(uni.getStorageSync('userInfo'))
getHospital(h_info.value.hospitalId) h_info.value = userinfo.value
h_info.value.surgery_time = h_info.value.SurgeryTime
userinfo.value.avatar = uni.getStorageSync('avatarUrl')
h_index.value = hospitals.value.findIndex((item,i) => {
return item.ID == userinfo.value.HospitalId
})
if(userinfo.value.HospitalId) {
getHospital(userinfo.value.HospitalId)
} }
} }
}) })
// //
const is_login = ref(false)
const h_queryParams = ref({ const h_queryParams = ref({
page:1, page:1,
pageSize:1000, pageSize:1000,
key:'' key:''
}) })
const hospitals = ref(null) const hospitals = ref([])
const userinfo = ref({}) const userinfo = ref({})
const avatar = ref(null) const avatar = ref(null)
const h_info = ref({}) const h_info = ref({})
@ -42,7 +50,7 @@
hospitals.value = res.data.list hospitals.value = res.data.list
} }
} }
function onClickH() { function onInputH() {
h_queryParams.value.key = hValue.value h_queryParams.value.key = hValue.value
getHospitalList() getHospitalList()
@ -102,28 +110,42 @@
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`;
} }
function bindDateChange(e) { function bindDateChange(e) {
console.log(e) // console.log(e)
h_info.value.surgery_time = e.detail.value h_info.value.surgery_time = e.detail.value
} }
function toChooseH(item) { function toChooseH(item) {
console.log(item) // console.log(item)
choosed_h.value = item choosed_h.value = item
hValue.value = item.name hValue.value = item.name
// hospitals.value = null // hospitals.value = null
} }
async function sumbmitFunc() { async function sumbmitFunc() {
// console.log(choosed_h.value,h_info.value,userinfo.value) await custom.uploadImage(userinfo.value.avatar, async (file) => {
userinfo.value.avatar = file.data.file.url
})
let obj = { let obj = {
id: userinfo.value.userId, id: userinfo.value.userId,
// isSurgery: 1, // 01 // isSurgery: userinfo.value.isSurgery,// 0 - 1 -
surgery_time: h_info.value?.surgery_time, // surgery_time: h_info.value?.surgery_time, //
nickname: userinfo.value.nickname, nickname: userinfo.value.nickname,
// avatar: '', avatar: userinfo.value.avatar,
phone: userinfo.value.phone, phone: userinfo.value.phone,
hospitalId:choosed_h.value?.ID hospitalId:hospitals.value[h_index.value]?.ID
}
if(!obj.hospitalId) {
uni.showToast({
title: "请选择医院",
icon: "error",
duration: 2000
})
return
} }
const res = await api.userinfoUpdae(obj) obj.isSurgery = parseInt(userinfo.value.IsSurgery)
// console.log('res is ',res) // if(!is_login.value) { // -
// }
userinfo.value.SurgeryTime = obj.surgery_time
const res = await api.userinfoUpdae(obj) //
if(res.code === 0) { if(res.code === 0) {
uni.showToast({ uni.showToast({
title:res.msg, title:res.msg,
@ -149,25 +171,54 @@
provider: 'weixin', //使 provider: 'weixin', //使
success: function (loginRes) { success: function (loginRes) {
resolve(loginRes); resolve(loginRes);
console.log(loginRes,'微信登录返回信息');
} }
}); });
}); });
let res2=await api.wx_login({code:res.code},userId); let res2=await api.wx_login({code:res.code},userId);
if(res2.code === 0) { if(res2.code === 0) {
userinfo.value.HospitalId = hospitals.value[h_index.value]?.ID
h_info.value.hospitalId = userinfo.value.HospitalId
uni.setStorageSync('avatarUrl', userinfo.value.avatar);//avatarUrl
uni.setStorageSync('userInfo',JSON.stringify(userinfo.value)) uni.setStorageSync('userInfo',JSON.stringify(userinfo.value))
uni.setStorageSync('operation_info', JSON.stringify(h_info.value))
// is_login.value = custom.checkLogin() // is_login.value = custom.checkLogin()
store.checkLogin() store.checkLogin()
} }
else{ else{
uni.clearStorage(); uni.clearStorage();
} }
} }
</script> function bindPickerChange(e) {
// console.log(hospitals.value )
h_index.value = e.detail.value
}
function onChooseAvatar(e) {
// const { avatarUrl } = e.detail
// console.log(avatarUrl)
userinfo.value.avatar = e.detail.avatarUrl
}
var isOperation = ref([
{
index:0,
name:"否"
},
{
index: 1,
name: "是"
}
])
function bindOperationPickerChange(e) {
userinfo.value.IsSurgery = e.detail.value
// console.log("userinfo.value.IsSurgery is :",userinfo.value.IsSurgery)
}
</script>
<template> <template>
<view class="userInfoBox page-box page-bg-gray"> <view class="userInfoBox page-box page-bg-gray">
<view class="avatar-box"> <view class="avatar-box">
<image :src="avatar" mode="aspectFill"></image> <!-- <image :src="avatar" mode="aspectFill"></image> -->
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar" style="border-radius: 50%;">
<image :src="userinfo?.avatar" mode="aspectFill"></image>
</button>
</view> </view>
<view class="row-box"> <view class="row-box">
<view class="rb-card" @tap="toDetail(1)"> <view class="rb-card" @tap="toDetail(1)">
@ -192,34 +243,57 @@
</view> </view>
</view> </view>
</view> </view>
<view class="rb-card" @tap="toDetail(3)"> <view class="rb-card" @tap="toDetail(5)">
<view class="rbc-content"> <view class="rbc-content">
<view class="rbc-content-row rbc-content-left rbc-content-left-box"> <view class="rbc-content-row rbc-content-left rbc-content-left-box">
<uni-icons type="calendar" color="gray" size="26"></uni-icons> <uni-icons type="paperplane" color="gray" size="26"></uni-icons>
手术时间</view> 已经手术</view>
<view class="rbc-content-row rbc-content-right"> <view class="rbc-content-row rbc-content-right">
<!-- {{h_info?.surgery_time}} --> <picker @change="bindOperationPickerChange" :value="userinfo.IsSurgery" :range="isOperation" range-key="name" >
<picker mode="date" :value="h_info?.surgery_time" :start="startDate" :end="endDate" @change="bindDateChange"> <view class="rbc-content-row rbc-content-right">
<view class="rbc-content-row rbc-content-right"> <view class="uni-input">{{ isOperation[userinfo.IsSurgery]?.name }}</view>
<view class="uni-input"> {{h_info?.surgery_time}}</view> <uni-icons type="forward" color="gray" size="20"></uni-icons>
<uni-icons type="forward" color="gray" size="20"></uni-icons> </view>
</view> </picker>
</picker> </view>
</view>
</view>
</view>
<view class="rb-card" @tap="toDetail(4)">
<view class="rbc-content">
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
<uni-icons type="paperplane" color="gray" size="26"></uni-icons>
手术医院</view>
<view class="rbc-content-row rbc-content-right">
<!-- {{h_info?.name}} -->
<uni-combox @input="onClickH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="hValue"></uni-combox>
<uni-icons type="forward" color="gray" size="20"></uni-icons>
</view> </view>
</view>
</view> </view>
<template>
<view class="rb-card" @tap="toDetail(3)">
<view class="rbc-content">
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
<uni-icons type="calendar" color="gray" size="26"></uni-icons>
手术时间</view>
<view class="rbc-content-row rbc-content-right">
<!-- {{h_info?.surgery_time}} -->
<picker mode="date" :value="h_info?.surgery_time" :start="startDate" :end="endDate" @change="bindDateChange">
<view class="rbc-content-row rbc-content-right">
<view class="uni-input"> {{h_info?.surgery_time}}</view>
<uni-icons type="forward" color="gray" size="20"></uni-icons>
</view>
</picker>
</view>
</view>
</view>
<view class="rb-card" @tap="toDetail(4)">
<view class="rbc-content">
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
<uni-icons type="paperplane" color="gray" size="26"></uni-icons>
手术医院</view>
<view class="rbc-content-row rbc-content-right">
<!-- {{h_info?.name}} -->
<!-- <uni-combox :border="false" @input="onInputH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="userinfo.HospitalId"></uni-combox> -->
<!-- <uni-icons type="forward" color="gray" size="20"></uni-icons> -->
<picker @change="bindPickerChange" :value="h_index" :range="hospitals" range-key="name">
<view class="rbc-content-row rbc-content-right">
<view class="uni-input">{{hospitals[h_index]?.name}}</view>
<uni-icons type="forward" color="gray" size="20"></uni-icons>
</view>
</picker>
</view>
</view>
</view>
</template>
</view> </view>
<!--修改姓名/电话 弹窗 --> <!--修改姓名/电话 弹窗 -->
<uni-popup ref="inputDialog" > <uni-popup ref="inputDialog" >
@ -240,9 +314,22 @@
</view> </view>
</uni-popup> </uni-popup>
<view class="pb-item pb-item-btn" style="margin-top: 40rpx;" @tap="sumbmitFunc"></view> <view class="pb-item pb-item-btn" style="margin-top: 40rpx;" @tap="sumbmitFunc"></view>
</view> </view>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.avatar-wrapper{
width: 160rpx !important;
height: 160rpx;
padding: 0px;
margin: 0 auto;
overflow: hidden;
margin-bottom: 40rpx;
// border: 1px solid #26758d;
background: #ececec;
display: flex;
align-items: center;
justify-content: center;
}
.avatar-box{ .avatar-box{
display: flex; display: flex;
align-items: center; align-items: center;
@ -250,6 +337,14 @@
width: 100%; width: 100%;
padding: 20rpx 0; padding: 20rpx 0;
background: #26758d; background: #26758d;
button{
image{
width: 160rpx;
height: 160rpx;
background-color: white;
border-radius: 50%;
}
}
image{ image{
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
@ -369,5 +464,5 @@
.uni-popup__wrapper{ .uni-popup__wrapper{
width: 100%; width: 100%;
} }
} }
</style> </style>

@ -9,7 +9,11 @@
import emptyCard from "@/components/emptyCard.vue" import emptyCard from "@/components/emptyCard.vue"
import api from "@/api/index.js" import api from "@/api/index.js"
import util from "@/utils" import util from "@/utils"
const store = useStore()
onLoad((e) => { onLoad((e) => {
if(uni.getStorageSync('userInfo')) {
userInfo.value = JSON.parse( uni.getStorageSync('userInfo'))
}
// console.log(e) // console.log(e)
// a_info.value = JSON.parse(decodeURIComponent(e.info)) // a_info.value = JSON.parse(decodeURIComponent(e.info))
if(!e.id) { if(!e.id) {
@ -24,6 +28,12 @@
getDetail(e.id) getDetail(e.id)
}) })
// //
let strings = `<div style="text-align: center; "><p>&nbsp;测试内容222sdadd&nbsp;</p><figure class="image"><img src="https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/uploads/2024-02-24/undone.png"/></figure></div>`
// `<p>&nbsp;222sdadd&nbsp;</p><figure class="image"><img src="https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/uploads/2024-02-24/undone.png"></figure>`
// strings = strings.replaceAll("figure", "div");
// strings = strings.replaceAll("<img", "<img style='width:100%'");
console.log(strings)
const userInfo = ref(null)
// const content = ref(null) // const content = ref(null)
const a_info = ref(null) const a_info = ref(null)
// //
@ -31,6 +41,10 @@
const res = await api.getArticleDetail({id}) const res = await api.getArticleDetail({id})
if(res.code == 0) { if(res.code == 0) {
a_info.value = res.data a_info.value = res.data
if(a_info.value.content) {
a_info.value.content = a_info.value.content.replaceAll("figure", "div");
a_info.value.content = a_info.value.content.replaceAll("<img", "<img style='width:100%'");
}
} }
else{ else{
uni.showToast({ uni.showToast({
@ -41,29 +55,53 @@
} }
} }
async function starFunc(type) { // async function starFunc(type) { //
a_info.value.isStar = type if(!userInfo.value) {
} store.afterFailLogin(2000)
</script> return
}
console.log(a_info.value)
if(type) { //
const res = await api.getArticleFavorite({
wz_id:a_info.value.ID,
userId:userInfo.value.userId,
cover:a_info.value.cover_img,
title:a_info.value.title,
introductions:''
},userInfo.value.userId)
}
else{ //
const res = await api.delArticleFavorite({
id:a_info.value.ID,
},userInfo.value.userId)
}
a_info.value.is_favorite = type
}
</script>
<template> <template>
<view class="detailBox"> <view class="detailBox">
<view class="title"> <view class="title">
{{a_info?.title}} {{a_info?.title}}
</view> </view>
<view v-if="a_info" class="more-info small-text">{{util.timestampToDate(a_info?.CreatedAt)}}</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="d-content">
<rich-text :nodes="a_info?.content"></rich-text>
</view> -->
<view v-if="a_info" class="d-content" v-html="a_info.content">
</view>
<view class="action-box" v-if="a_info"> <view class="action-box" v-if="a_info">
<view class="ab-item"> <view class="ab-item">
<uni-icons color="gray" type="eye" size="30"></uni-icons> <uni-icons color="gray" type="eye" size="30"></uni-icons>
<view style="color: gray;">{{a_info?.reading_num}}</view> <view style="color: gray;">{{a_info?.reading_num}}</view>
</view> </view>
<view class="ab-item"> <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="#26758d" @tap="starFunc(0)" v-if="a_info?.is_favorite" type="star-filled" size="30"></uni-icons>
<uni-icons color="gray" @tap="starFunc(1)" v-else type="star" size="30"></uni-icons> <uni-icons color="gray" @tap="starFunc(1)" v-else type="star" size="30"></uni-icons>
</view> </view>
</view> </view>
<emptyCard title="暂无内容" v-if="!a_info"></emptyCard> <emptyCard title="暂无内容" v-if="!a_info"></emptyCard>
</view> </view>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.action-box{ .action-box{
margin-top: 20px; margin-top: 20px;
@ -90,5 +128,5 @@
.d-content{ .d-content{
line-height: 50rpx; line-height: 50rpx;
} }
} }
</style> </style>

@ -56,7 +56,7 @@
} }
} }
function toDetail(item) { function toDetail(item) {
let info = encodeURIComponent(JSON.stringify(item)) // let info = encodeURIComponent(JSON.stringify(item))
// console.log(info) // console.log(info)
uni.navigateTo({ uni.navigateTo({
url:"./detail?id="+item.ID url:"./detail?id="+item.ID

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

@ -25,6 +25,7 @@ export const useStore = defineStore('main2', {
remark_text:'', remark_text:'',
address:'', address:'',
operation_info:null, // 手术信息 operation_info:null, // 手术信息
bgList:[], // 测试结果背景图
} }
}, },
actions:{ actions:{
@ -56,11 +57,11 @@ export const useStore = defineStore('main2', {
}); });
}, },
checkLogin(){ // 检查是否登录 checkLogin(){ // 检查是否登录
let access_token = uni.getStorageSync('access_token') // let access_token = uni.getStorageSync('access_token')
// let visitState = uni.getStorageSync('visitState') let u_info = uni.getStorageSync('userInfo')
console.log(access_token) // console.log("u_info is ",u_info)
if(access_token) { if(u_info) {
this.access_token = access_token this.access_token = uni.getStorageSync('access_token')
this.isLogin = true this.isLogin = true
this.userInfo = uni.getStorageSync('userInfo') this.userInfo = uni.getStorageSync('userInfo')
this.operation_info = uni.getStorageSync('operation_info') this.operation_info = uni.getStorageSync('operation_info')
@ -158,6 +159,16 @@ export const useStore = defineStore('main2', {
// } // }
} }
}, },
async getBgList(){
const res = await api.getBgList({page:1,pageSize:100})
// console.log(res)
if(res.code == 0) {
if(res.data && res.data.list && res.data.list.length>0 ) {
this.bgList = res.data.list
// console.log(this.bgList)
}
}
},
afterFailLogin(duration){ afterFailLogin(duration){
setTimeout(()=>{ setTimeout(()=>{
uni.removeStorageSync('userInfo'); uni.removeStorageSync('userInfo');
@ -170,6 +181,87 @@ export const useStore = defineStore('main2', {
}) })
},duration) },duration)
},
async getAccess_token(params={}) {
//清除token缓存
wx.clearStorageSync();
//访问接口
const data={
username:params.code,//手机号按钮获取的code
type:'wechat_mini_app',
identity:'user',
password:'111'
}
// console.log('登录参数:',data);return;
const res = await api.getToken(data)
if(res.code === 200) {
// newUser.value = res.data.newUser
// res.data.newUser = true // 开发阶段专用,正式版请删除或注释
if(res.data.newUser) { // 新用户,不做任何缓存动作,跳转登录页
let userId = res.data.userId
let res_p=await new Promise(resolve=>{
uni.login({
provider: 'weixin', //使用微信登录
success: function (loginRes) {
resolve(loginRes);
// console.log(loginRes,'微信登录返回信息');
}
});
});
// 正式版记住放开下面这行注释掉的代码
uni.setStorageSync('access_token','Bearer '+res.data.access_token);// 为了wx登录成功,必须token单独缓存一次
let res2= await api.wx_login({code:res_p.code},userId);
if(res2.code === 0) {
// this.checkLogin()
// this.toLogin(encodeURIComponent(JSON.stringify(res.data))) // 跳转登录页,但是我不想这么做
this.toProfile(encodeURIComponent(JSON.stringify(res.data)))
}
}
else{
let res_form = {}
uni.setStorageSync('avatarUrl', res.data.avatar);//avatarUrl
res_form = res.data
res_form.access_token = 'Bearer '+res.data.access_token
let userId = res.data.userId
uni.setStorageSync('access_token',res_form.access_token);// token单独缓存一次
this.wx_login(userId, res_form)
}
}
else{
uni.showToast({
icon:"error",
title:res.msg,
duration:2000
})
}
},
async wx_login(userId, res_form) {
let res=await new Promise(resolve=>{
uni.login({
provider: 'weixin', //使用微信登录
success: function (loginRes) {
resolve(loginRes);
}
});
});
let res2 = await api.wx_login({code:res.code},userId);
if(res2.code === 0) {
uni.setStorageSync('userInfo',JSON.stringify(res_form))
this.checkLogin()
}
else{
uni.clearStorage();
}
},
toLogin(token_info) {
uni.navigateTo({
url:"/pages/login/login?token_info="+token_info
})
},
toProfile(token_info = null) {
uni.navigateTo({
url:"/pages/user/userInfo?token_info="+token_info
})
} }
} }
}) })

@ -103,9 +103,20 @@ export default {
return { m: s * 1000, km: Number(s.toFixed(2)) } return { m: s * 1000, km: Number(s.toFixed(2)) }
}, },
checkLogin(){ checkLogin(){
let token = uni.getStorageSync('access_token') // let token = uni.getStorageSync('access_token')
console.log(token) let u_info = uni.getStorageSync('userInfo')
if(token){ if(u_info){
return true
}
else{
return false
}
},
// 有缓存信息,就访问登录接口,没有缓存就直接返回未登录
checkLoginPro(){
// let token = uni.getStorageSync('access_token')
let u_info = uni.getStorageSync('userInfo')
if(u_info){ // 有缓存信息,访问登录接口
return true return true
} }
else{ else{

Loading…
Cancel
Save