背景图设置
This commit is contained in:
parent
40bf8f8433
commit
5c7d95a2be
2
App.vue
2
App.vue
@ -34,6 +34,8 @@
|
||||
// sHeight.value = res.screenHeight
|
||||
}
|
||||
})
|
||||
// 获取测试结果背景图
|
||||
store.getBgList()
|
||||
})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
@ -22,6 +22,8 @@ const API = {
|
||||
// 百科
|
||||
getArticleList:data => net.GET("/article/list",data),// 百科列表
|
||||
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),// 收藏列表
|
||||
/*
|
||||
@ -40,6 +42,7 @@ const API = {
|
||||
getCategoryList:data => net.GET('/api/goods_category/lists'), // 获取商品分类
|
||||
getCategory:data => net.GET('/api/goods/category',data), // 根据分类Id获取分类商品
|
||||
getCartList:data => net.GET('/api/cart/lists',data), // 获取购物车列表
|
||||
getBgList:data => net.GET('/poster/list',data), // 获取测试结果背景图列表
|
||||
addCart:data => net.POST('/api/cart/add',data), // 加入购物车
|
||||
delCart:data => net.POST('/api/cart/delete',data), // 删除购物车
|
||||
updateCart:data => net.POST('/api/cart/edit',data), // 更新购物车
|
||||
|
@ -1,7 +1,8 @@
|
||||
import config from '../config'
|
||||
|
||||
// import store from '../store'
|
||||
|
||||
// import {useStore} from '@/store/index.js'
|
||||
// console.log(useStore)
|
||||
// const store = useStore()
|
||||
const loginUrl = 'pages/user/login';
|
||||
// function JSON_to_URLEncoded(element,key,list){
|
||||
// var list = list || [];
|
||||
@ -75,6 +76,20 @@ export default {
|
||||
});
|
||||
}
|
||||
}
|
||||
// if(res.data.code === 7) { // 登录失败
|
||||
// uni.showToast({
|
||||
// title:res.msg,
|
||||
// icon:"error",
|
||||
// duration:2000,
|
||||
// mask:true,
|
||||
// success() {
|
||||
// if(res.code === 7) // 登录失败
|
||||
// {
|
||||
// store.afterFailLogin(2000)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
return res.data;
|
||||
} else {
|
||||
const reg = /abort/;
|
||||
|
@ -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>
|
||||
|
@ -57,20 +57,27 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
@ -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">
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -25,6 +25,7 @@ export const useStore = defineStore('main2', {
|
||||
remark_text:'',
|
||||
address:'',
|
||||
operation_info:null, // 手术信息
|
||||
bgList:[], // 测试结果背景图
|
||||
}
|
||||
},
|
||||
actions:{
|
||||
@ -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){
|
||||
setTimeout(()=>{
|
||||
uni.removeStorageSync('userInfo');
|
||||
|
Loading…
Reference in New Issue
Block a user