2023.11.1修改
This commit is contained in:
parent
11cecc737f
commit
22c039a8eb
13
App.vue
13
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
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@ -50,6 +53,14 @@
|
||||
-webkit-box-orient: vertical;
|
||||
/* min-height: 38rpx; */
|
||||
}
|
||||
.text-ellipsis-2{ /*超出部分省略号 双行*/
|
||||
overflow:hidden;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-line-clamp: 2;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
/* min-height: 38rpx; */
|
||||
}
|
||||
.icon-custom{
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
|
13
api/index.js
13
api/index.js
@ -3,19 +3,22 @@ import net from './request.js';
|
||||
// import store from '../store';
|
||||
const API = {
|
||||
//微信登录
|
||||
getToken: data => net.POST('/login/token',data), // 获取token
|
||||
getToken: data => net.POST('/login/token',data,true,{"Content-Type":"application/x-www-form-urlencoded"}), // 获取token
|
||||
wx_login: (data,userId) => net.POST('/user/binding/wechat',data,true,{"userId":userId}), // 微信登录
|
||||
// upload: (data) => net.POST('/user/upload',data), // 文件上传
|
||||
userinfoUpdae:data => net.PUT('/user/info',data), // 更新用户信息
|
||||
userinfoUpdae:data => net.PUT('/user/info',data,true,{"Content-Type":"application/x-www-form-urlencoded"}), // 更新用户信息
|
||||
// 首页
|
||||
getHospitalList:data => net.GET('/hospital/list',data), // 获取医院信息
|
||||
saveVision:data => net.POST("/vision",data),// 保存视力测试结果
|
||||
getLbtList:data => net.GET("/banner/list",data),// 获取轮播图
|
||||
hospital:data => net.PUT("/user/hospital",data),// 修改医院信息
|
||||
getTodoist:data => net.GET("/user/todo",data),// 获取待办事项
|
||||
getVisionList:data => net.GET("/vision",data),// 获取测试记录
|
||||
// 百科
|
||||
getArticleList:data => net.GET("/article/list",data),// 百科列表
|
||||
getArticleDetail:data => net.GET("/article/"+data.id),// 百科列表
|
||||
|
||||
getArticleDetail:data => net.GET("/article/"+data.id),// 文章详情
|
||||
// 我的
|
||||
getStarList:data => net.GET("/favorite/list",data),// 收藏列表
|
||||
/*
|
||||
首页信息
|
||||
*/
|
||||
@ -407,7 +410,7 @@ const API = {
|
||||
transfer: data => net.POST('/api/v1/wxpay/transfer', data),
|
||||
|
||||
// 获取我的收藏分页列表
|
||||
getStarList: data => net.POST('/api/v1/favorite/get', data),
|
||||
// getStarList: data => net.POST('/api/v1/favorite/get', data),
|
||||
// 取消收藏
|
||||
cancelStar: data => net.DELETE('/api/v1/favorite',data),
|
||||
//添加收藏
|
||||
|
@ -19,21 +19,27 @@ export default {
|
||||
let token = uni.getStorageSync('access_token') || 'Basic ZGV2OmRldjEyMw==';
|
||||
const headers = {
|
||||
// "Content-Type": "application/json",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
// "Content-Type": "application/x-www-form-urlencoded",
|
||||
"Authorization": token,
|
||||
"x-token": token,
|
||||
"token":token,
|
||||
// "X-Forwarded-For":'client_ip'
|
||||
// 'Referer':'twzxjy.com'
|
||||
}
|
||||
if(!header) {
|
||||
headers["Content-Type"] = "application/json"
|
||||
}
|
||||
if(header && !header["Content-Type"]) {
|
||||
header["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
}
|
||||
var pages = getCurrentPages();
|
||||
var page = pages[pages.length - 1];
|
||||
return uni.request({
|
||||
url: config.baseUrl + url,
|
||||
method,
|
||||
header: {
|
||||
...header,
|
||||
...headers
|
||||
...headers,
|
||||
...header
|
||||
},
|
||||
data
|
||||
}).then(res => {
|
||||
|
@ -21,7 +21,7 @@
|
||||
function lbtFunc(item) {
|
||||
// 新版数据结构的跳转形式
|
||||
uni.navigateTo({
|
||||
url:item.url
|
||||
url:item.link
|
||||
});
|
||||
return
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
<swiper-item @click="lbtFunc(item)" v-for="(item,i) in lbt_list">
|
||||
<view class="swiper-item uni-bg-red">
|
||||
<!-- <img style="width: 100%;" :src="item.url" alt=""> -->
|
||||
<image :src="item.image" style="width: 100%;" mode="widthFix"></image>
|
||||
<image :src="item.imgUrl" style="width: 100%;" mode="widthFix"></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
@ -1,6 +1,6 @@
|
||||
// isdev 为 true 表示开发环境 false 表示发布环境
|
||||
const isdev = true;
|
||||
const baseUrl = isdev ? 'http://f968894.r2.cpolar.top' : 'http://eb467b6.r19.cpolar.top';// 办公室接口 & 测试环境
|
||||
const baseUrl = isdev ? 'http://410fed99.r6.cpolar.top' : 'http://eb467b6.r19.cpolar.top';// 办公室接口 & 测试环境
|
||||
// const baseUrl = isdev ? 'http://192.168.1.133:8899' : 'https://api.gwkjxb.com';// 办公室接口 & 正式环境
|
||||
// const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服)
|
||||
|
||||
|
21
pages.json
21
pages.json
@ -60,6 +60,27 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "视力测试"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/todo",
|
||||
"style": {
|
||||
"navigationBarTitleText": "待办事项",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/done",
|
||||
"style": {
|
||||
"navigationBarTitleText": "完成事项",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/visionList",
|
||||
"style": {
|
||||
"navigationBarTitleText": "测试记录",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
84
pages/index/done.vue
Normal file
84
pages/index/done.vue
Normal 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>
|
@ -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
84
pages/index/todo.vue
Normal 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
104
pages/index/visionList.vue
Normal 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>
|
@ -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>
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
BIN
static/default_icon.png
Normal file
BIN
static/default_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
BIN
static/default_search_icon.png
Normal file
BIN
static/default_search_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
@ -62,6 +62,7 @@ export const useStore = defineStore('main2', {
|
||||
if(access_token) {
|
||||
this.access_token = access_token
|
||||
this.isLogin = true
|
||||
this.userInfo = uni.getStorageSync('userInfo')
|
||||
// this.getUserInfo()
|
||||
}
|
||||
// else{
|
||||
|
Loading…
Reference in New Issue
Block a user