2023.11.1修改

prod
阿怪 11 months ago
parent 11cecc737f
commit 22c039a8eb

@ -20,10 +20,13 @@
onLaunch((e) => { onLaunch((e) => {
console.log('App onLaunch') console.log('App onLaunch')
let userInfo = uni.getStorageSync('userInfo') let userInfo = uni.getStorageSync('userInfo')
let operation_info = uni.getStorageSync('operation_info')
if(userInfo) { // if(userInfo) { //
store.userInfo = userInfo store.userInfo = userInfo
} }
if(operation_info) {
store.operation_info = operation_info
}
}) })
</script> </script>
<style lang="scss"> <style lang="scss">
@ -50,6 +53,14 @@
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
/* min-height: 38rpx; */ /* 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{ .icon-custom{
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;

@ -3,19 +3,22 @@ import net from './request.js';
// import store from '../store'; // import store from '../store';
const API = { 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}), // 微信登录 wx_login: (data,userId) => net.POST('/user/binding/wechat',data,true,{"userId":userId}), // 微信登录
// upload: (data) => net.POST('/user/upload',data), // 文件上传 // 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), // 获取医院信息 getHospitalList:data => net.GET('/hospital/list',data), // 获取医院信息
saveVision:data => net.POST("/vision",data),// 保存视力测试结果 saveVision:data => net.POST("/vision",data),// 保存视力测试结果
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),// 修改医院信息
getTodoist:data => net.GET("/user/todo",data),// 获取待办事项
getVisionList:data => net.GET("/vision",data),// 获取测试记录
// 百科 // 百科
getArticleList:data => net.GET("/article/list",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), 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), cancelStar: data => net.DELETE('/api/v1/favorite',data),
//添加收藏 //添加收藏

@ -19,21 +19,27 @@ export default {
let token = uni.getStorageSync('access_token') || 'Basic ZGV2OmRldjEyMw=='; let token = uni.getStorageSync('access_token') || 'Basic ZGV2OmRldjEyMw==';
const headers = { const headers = {
// "Content-Type": "application/json", // "Content-Type": "application/json",
"Content-Type": "application/x-www-form-urlencoded", // "Content-Type": "application/x-www-form-urlencoded",
"Authorization": token, "Authorization": token,
"x-token": token, "x-token": token,
"token":token, "token":token,
// "X-Forwarded-For":'client_ip' // "X-Forwarded-For":'client_ip'
// 'Referer':'twzxjy.com' // '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 pages = getCurrentPages();
var page = pages[pages.length - 1]; var page = pages[pages.length - 1];
return uni.request({ return uni.request({
url: config.baseUrl + url, url: config.baseUrl + url,
method, method,
header: { header: {
...header, ...headers,
...headers ...header
}, },
data data
}).then(res => { }).then(res => {

@ -21,7 +21,7 @@
function lbtFunc(item) { function lbtFunc(item) {
// //
uni.navigateTo({ uni.navigateTo({
url:item.url url:item.link
}); });
return return
@ -47,7 +47,7 @@
<swiper-item @click="lbtFunc(item)" v-for="(item,i) in lbt_list"> <swiper-item @click="lbtFunc(item)" v-for="(item,i) in lbt_list">
<view class="swiper-item uni-bg-red"> <view class="swiper-item uni-bg-red">
<!-- <img style="width: 100%;" :src="item.url" alt=""> --> <!-- <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> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>

@ -1,6 +1,6 @@
// isdev 为 true 表示开发环境 false 表示发布环境 // isdev 为 true 表示开发环境 false 表示发布环境
const isdev = true; 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 = isdev ? 'http://192.168.1.133:8899' : 'https://api.gwkjxb.com';// 办公室接口 & 正式环境
// const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服) // const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服)

@ -60,6 +60,27 @@
"style": { "style": {
"navigationBarTitleText": "视力测试" "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": { "globalStyle": {

@ -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) { // if(store.userInfo && !store.operation_info) { //
// getHospitalList() // getHospitalList()
setTimeout(()=>{ setTimeout(()=>{
// console.log(inputDialog.value)
inputDialog.value.open() inputDialog.value.open()
},0) },0)
} }
@ -29,40 +28,22 @@
const blur_h = ref(0) const blur_h = ref(0)
const surgery_time = ref(null) // const surgery_time = ref(null) //
const isSurgery = ref(-1) // 01 const isSurgery = ref(-1) // 01
const lbt_list = ref([ 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,
}
])
// //
// watch(blur_h,(val1,val2) => { // watch(blur_h,(val1,val2) => {
// // hospitals.value = null // // hospitals.value = null
// console.log(' ',choosed_h.value)
// if(!choosed_h) { // // if(!choosed_h) { //
// } // }
// }) // })
const h_queryParams = ref({
page:1,
pageSize:1000,
key:''
})
// //
async function getHospitalList() { async function getHospitalList() {
const res = await api.getHospitalList() 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
} }
@ -70,24 +51,24 @@
async function getLbtList() { // async function getLbtList() { //
const res = await api.getLbtList() const res = await api.getLbtList()
if(res.code == 0) { if(res.code == 0) {
if(res.data.list) {
lbt_list.value = res.data.list
}
} }
} }
function toClose() { function toClose() {
inputDialog.value.close() inputDialog.value.close()
} }
function radioChange(e) { function radioChange(e) {
console.log(e)
isSurgery.value = e.detail.value isSurgery.value = e.detail.value
} }
const single = ref('') const single = ref('')
function maskClick(e){ function maskClick(e){
console.log('maskClick事件:', e);
} }
const hValue = ref('') // const hValue = ref('') //
const hValueId = ref('') // id const hValueId = ref('') // id
function onClickH(e) { function onClickH(e) {
// console.log(hValue.value) h_queryParams.value.key = hValue.value
getHospitalList() getHospitalList()
} }
@ -97,7 +78,6 @@
}) })
} }
function toChooseH(item) { function toChooseH(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
@ -105,28 +85,62 @@
// function blurFunc() { // function blurFunc() {
// blur_h.value = 1 // blur_h.value = 1
// hospitals.value = null // hospitals.value = null
// // console.log('blurFunc!!',blur_h.value)
// } // }
function focusFunc() { function focusFunc() {
// blur_h.value = 0 // blur_h.value = 0
console.log('focusFunc')
} }
function toBlur(){ function toBlur(){
// console.log('toBlur')
hospitals.value = null hospitals.value = null
} }
async function toSave() { 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')) let user_info = JSON.parse(uni.getStorageSync('userInfo'))
const res = await api.hospital({ let h_query = {
isSurgery:isSurgery.value, isSurgery: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
}) }
console.log(res) const res = await api.hospital(h_query)
if(res.code == 0) { 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() 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> </script>
<template> <template>
@ -139,12 +153,28 @@
<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="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="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> <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 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> <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>

@ -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>

@ -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() { // async function okFunc() { //
// inputDialog3.value.open() // inputDialog3.value.open()
uni.showLoading({
mask:true
})
const res = await api.saveVision({ const res = await api.saveVision({
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
}) })
uni.hideLoading()
if(res.code == 0) { if(res.code == 0) {
uni.showToast({
title:"保存成功",
icon:"success",
duration:2000,
success: function (res){
uni.navigateBack()
}
})
uni.navigateBack()
} }
} }
</script> </script>

@ -21,6 +21,7 @@
// //
function getInfo(){ function getInfo(){
is_login.value = custom.checkLogin() is_login.value = custom.checkLogin()
// store.checkLogin()
// console.log(is_login.value) // console.log(is_login.value)
if(is_login.value) { if(is_login.value) {
avatar.value = uni.getStorageSync('avatarUrl') avatar.value = uni.getStorageSync('avatarUrl')
@ -65,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) //
@ -99,7 +100,7 @@
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()
toLogin(encodeURIComponent(JSON.stringify(res.data))) toLogin(encodeURIComponent(JSON.stringify(res.data)))
} }
} }
@ -112,6 +113,13 @@
wx_login(userId) wx_login(userId)
} }
} }
else{
uni.showToast({
icon:"error",
title:res.msg,
duration:2000
})
}
} }
async function wx_login(userId){ async function wx_login(userId){
let res=await new Promise(resolve=>{ let res=await new Promise(resolve=>{
@ -127,6 +135,7 @@
if(res2.code === 0) { if(res2.code === 0) {
uni.setStorageSync('userInfo',JSON.stringify(res_form.value)) uni.setStorageSync('userInfo',JSON.stringify(res_form.value))
// is_login.value = custom.checkLogin() // is_login.value = custom.checkLogin()
store.checkLogin()
getInfo() getInfo()
// if(newUser.value) { // if(newUser.value) {
// toLogin() // toLogin()

@ -4,14 +4,23 @@
import {ref,onMounted,nextTick} from "vue" import {ref,onMounted,nextTick} from "vue"
import {useStore} from '@/store/index.js' import {useStore} from '@/store/index.js'
import api from "@/api/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(() => { // onReachBottom(() => { //
getList()
}) })
// //
// const user_info = ref(null)
const list = ref([ const list = ref([
{ {
id:1, 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) { function toDetail(item) {
let info = encodeURIComponent(JSON.stringify(item)) let info = encodeURIComponent(JSON.stringify(item))
// console.log(info) // console.log(info)

@ -7,16 +7,17 @@
import {ref,onMounted,nextTick} from "vue" import {ref,onMounted,nextTick} from "vue"
import {useStore} from '@/store/index.js' import {useStore} from '@/store/index.js'
import api from "@/api/index.js" import api from "@/api/index.js"
import util from "@/utils"
onLoad((e) => { onLoad((e) => {
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) {
uni.showToast({ uni.showToast({
icon:"error", icon:"error",
title:"错误", title:"错误",
duration:2000 duration:2000
}) })
a_info.value = null // a_info.value = null
return return
} }
getDetail(e.id) getDetail(e.id)
@ -27,6 +28,19 @@
// //
async function getDetail(id) { async function getDetail(id) {
const res = await api.getArticleDetail({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> </script>
<template> <template>
@ -34,11 +48,31 @@
<view class="title"> <view class="title">
{{a_info?.title}} {{a_info?.title}}
</view> </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="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> </view>
</template> </template>
<style scoped lang="scss"> <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{ .detailBox{
.more-info{ .more-info{
text-align: right; text-align: right;

@ -29,43 +29,36 @@
page:1, page:1,
pageSize:10 pageSize:10
}) })
const list = ref([ 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日电 金秋时节北京再迎盛会第三届一带一路国际合作高峰论坛隆重举行
春发其华秋收其实
共建一带一路走过了第一个蓬勃十年正值风华正茂务当昂扬奋进奔向下一个金色十年
`
}
])
// //
function init() { function init() {
queryParams.page = 1 queryParams.page = 1
queryParams.pageSize = 10 queryParams.pageSize = 10
list.value = []
} }
async function getList(){ async function getList(){
const res = await api.getArticleList(queryParams.value) 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) { 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?info="+info+"&id="+item.id url:"./detail?id="+item.ID
}) })
} }
</script> </script>
@ -81,7 +74,7 @@
</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" v-html="item.content"></view>
</view> </view>
</view> </view>
</view> </view>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@ -62,6 +62,7 @@ export const useStore = defineStore('main2', {
if(access_token) { if(access_token) {
this.access_token = access_token this.access_token = access_token
this.isLogin = true this.isLogin = true
this.userInfo = uni.getStorageSync('userInfo')
// this.getUserInfo() // this.getUserInfo()
} }
// else{ // else{

Loading…
Cancel
Save