与后端适配

This commit is contained in:
539943419 committed 2023-12-18 14:32:09 +08:00
1 parent 0c62d232b8
commit f16d960ef8
3 files changed
+40 -22

No files matched your search

+15 -7
View File
@@ -383,9 +383,14 @@ page{
justify-content: center;
border-radius: 15rpx;
background-color: tomato;
// white-space: nowrap;
// overflow-x: auto;
// overflow-y: hidden;
// view{
// position: relative;
// top:-0.5rpx;
// white-space: nowrap;
// width: 999rpx;
// // position: relative;
// // top:-0.5rpx;
// }
}
.node_safe{
@@ -402,10 +407,11 @@ page{
justify-content: center;
border-radius: 15rpx;
background-color:springgreen;
// view{
// position: relative;
// top:-0.5rpx;
// }
view{
white-space: nowrap;
// position: relative;
// top:-0.5rpx;
}
}
.node_scores{
font-size: 31rpx;
@@ -483,7 +489,9 @@ page{
display: flex;
border-radius: 15rpx;
align-items: center;
justify-content: center;
// justify-content: center;
white-space: nowrap;
overflow-x: scroll;
}
}
}
+23 -13
View File
@@ -2,7 +2,7 @@
// 获取应用实例
const app = getApp<IAppOption>()
const serverAddr = "http://127.0.0.1:5000"
const serverAddr = "https://www.chenziyang.top:5000"
Page({
data: {
@@ -346,9 +346,10 @@ Page({
// this.data.session_key = wx.getStorageSync("session_key")
// await this.updateSession()
this.readStorageData()
this.data.session_key = '12345'
this.set_miaoStyle(this.data.active_style)
// this.edit_svg_color()
// this.updateLib()
this.updateLib()
// this.updateCollection()
// this.updateHistory()
},
@@ -873,7 +874,7 @@ Page({
//更新成分数据
updateLib() {
wx.request({
url: serverAddr + '/getLib', //仅为示例,并非真实的接口地址
url: serverAddr + '/api/ing',
data: {
session_key:this.data.session_key
},
@@ -884,7 +885,7 @@ Page({
success: res => {
// console.log(res)
var data = res.data
// console.log(data)
console.log(data)
// 能跑
// name: {
@@ -900,14 +901,14 @@ Page({
n.name = {}
n.name.zh = n.chinese_name
n.name.en = n.english_name
n.scores = n.rating
n.scores = parseInt(n.rating)
n.extra = []
for(var i of n.effects){
n.extra.push({ 'type': "safe", 'name': i },)
}
for(var i of n.potential_risk_people){
n.extra.push({ 'type': "unsafe", 'name': "风险人群:" + i })
}
// for(var i of n.effects){
n.extra.push({ 'type': "safe", 'name': n.effects },)
// }
// for(var i of n.potential_risk_people){
n.extra.push({ 'type': "unsafe", 'name': "风险人群:" + n.potential_risk_people })
// }
n.ADI = n.daily_intake_recommendation
}
for (var n of data) {
@@ -1345,14 +1346,23 @@ Page({
// 从本地读取各种数据
readStorageData(){
var list = ['data_history', 'data_collect', 'data_lib','active_style']
var m = {}
for (var k of list) {
var m = {}
m[k] = wx.getStorageSync(k)
this.setData(m)
// console.log(k,this.data[k])
// this.data[k]=wx.getStorageSync(k)
// console.log(wx.getStorageSync(k))
}
if(m['data_history'] == ''){
m['data_history'] = {}
}
if(m['data_collect'] == ''){
m['data_collect'] = []
}
if(m['data_lib'] == ''){
m['data_lib'] = []
}
this.setData(m)
// this.setData(
// {
// data_history:this.data["data_history"],
+2 -2
View File
@@ -89,7 +89,7 @@
暂无数据
</view>
<view wx:for="{{n.extra}}" wx:for-item="item">
<view class="node_ex_content" style="background-color: {{ item.type=='unsafe'?'tomato':'springgreen' }};">{{item.name}}</view>
<view class="node_ex_content" style="background-color: {{ item.type=='unsafe'?'tomato':'springgreen' }}; {{ item.name.length > 7?'':'justify-content: center;' }};"><view>{{item.name}}</view></view>
</view>
</view>
</view>
@@ -231,7 +231,7 @@
暂无数据
</view>
<view wx:for="{{n.extra}}" wx:for-item="item">
<view class="node_ex_content" style="background-color: {{ item.type=='unsafe'?'tomato':'springgreen' }};">{{item.name}}</view>
<view class="node_ex_content" style="background-color: {{ item.type=='unsafe'?'tomato':'springgreen' }}; {{ item.name.length > 7?'':'justify-content: center;' }};"><view>{{item.name}}</view></view>
</view>
</view>
</view>