背景图设置

master
阿怪 9 months ago
parent 40bf8f8433
commit 5c7d95a2be

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

@ -22,6 +22,8 @@ const API = {
// 百科 // 百科
getArticleList:data => net.GET("/article/list",data),// 百科列表 getArticleList:data => net.GET("/article/list",data),// 百科列表
getArticleDetail:(data,userId) => net.GET("/article/"+data.id,null,true,{"userId":userId}),// 文章详情 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 +42,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,7 +1,8 @@
import config from '../config' 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'; const loginUrl = 'pages/user/login';
// function JSON_to_URLEncoded(element,key,list){ // function JSON_to_URLEncoded(element,key,list){
// var list = 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; return res.data;
} else { } else {
const reg = /abort/; const reg = /abort/;

@ -11,15 +11,19 @@
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)
@ -29,7 +33,8 @@
function randomFunc() { function randomFunc() {
bg_index.value = parseInt((Math.random()*3)) bg_index.value = parseInt((Math.random()*3))
uni.getImageInfo({ 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) { success:function(res) {
avatarUrl.value = uni.getStorageSync('avatarUrl') avatarUrl.value = uni.getStorageSync('avatarUrl')
info.value.left = res_.value.leftEyeVision info.value.left = res_.value.leftEyeVision
@ -49,7 +54,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_imgs[bg_index].url" 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>

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

@ -163,7 +163,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">

@ -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,7 @@
getDetail(e.id) getDetail(e.id)
}) })
// //
const userInfo = ref(null)
// const content = ref(null) // const content = ref(null)
const a_info = ref(null) const a_info = ref(null)
// //
@ -41,7 +46,27 @@
} }
} }
async function starFunc(type) { // 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 a_info.value.isStar = type
} }
</script> </script>
<template> <template>
@ -57,7 +82,7 @@
<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>

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

@ -25,6 +25,7 @@ export const useStore = defineStore('main2', {
remark_text:'', remark_text:'',
address:'', address:'',
operation_info:null, // 手术信息 operation_info:null, // 手术信息
bgList:[], // 测试结果背景图
} }
}, },
actions:{ 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){ afterFailLogin(duration){
setTimeout(()=>{ setTimeout(()=>{
uni.removeStorageSync('userInfo'); uni.removeStorageSync('userInfo');

Loading…
Cancel
Save