背景图设置

This commit is contained in:
2023-12-29 00:12:16 +08:00
parent 40bf8f8433
commit 5c7d95a2be
9 changed files with 92 additions and 16 deletions

View File

@@ -11,15 +11,19 @@
onLoad((e) => {
res_.value = JSON.parse(decodeURIComponent(e.res))
console.log(res_.value)
console.log(store.bgList)
if(store.bgList.length>0) {
bg_imgs.value = store.bgList
}
randomFunc()
})
// 变量
const res_ = ref(null)
const userInfo = ref(null)
const bg_imgs = ref([
'/static/result1.jpg',
'/static/result2.jpg',
'/static/result3.jpg',
{url:'/static/result1.jpg'},
{url:'/static/result2.jpg'},
{url:'/static/result3.jpg'},
])
const bg_index = ref(0)
const avatarUrl = ref(null)
@@ -29,7 +33,8 @@
function randomFunc() {
bg_index.value = parseInt((Math.random()*3))
uni.getImageInfo({
src:bg_imgs.value[bg_index.value],
// src:bg_imgs.value[bg_index.value],
src:bg_imgs.value[bg_index.value].url,
success:function(res) {
avatarUrl.value = uni.getStorageSync('avatarUrl')
info.value.left = res_.value.leftEyeVision
@@ -49,7 +54,7 @@
</view> -->
<view class="actionBox">
<view class="img-box">
<image style="width: 100%;" :src="bg_imgs[bg_index]" mode="widthFix"></image>
<image style="width: 100%;" :src="bg_imgs[bg_index].url" mode="widthFix"></image>
<view v-if="show_" class="avatar-box">
<image :src="avatarUrl" mode="widthFix"></image>
</view>

View File

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

View File

@@ -163,7 +163,7 @@
</view>
</view>
<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-content rbc-content-box">
<view class="rbc-content-row rbc-content-left">

View File

@@ -9,7 +9,11 @@
import emptyCard from "@/components/emptyCard.vue"
import api from "@/api/index.js"
import util from "@/utils"
const store = useStore()
onLoad((e) => {
if(uni.getStorageSync('userInfo')) {
userInfo.value = JSON.parse( uni.getStorageSync('userInfo'))
}
// console.log(e)
// a_info.value = JSON.parse(decodeURIComponent(e.info))
if(!e.id) {
@@ -24,6 +28,7 @@
getDetail(e.id)
})
// 变量
const userInfo = ref(null)
// const content = ref(null)
const a_info = ref(null)
// 函数
@@ -41,7 +46,27 @@
}
}
async function starFunc(type) { // 点击收藏
if(!userInfo.value) {
store.afterFailLogin(2000)
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.isStar = type
}
</script>
<template>
@@ -57,7 +82,7 @@
<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="#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>
</view>
</view>

View File

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