完善查询页面,实现基本查询功能

This commit is contained in:
ivo 2023-01-31 23:09:28 +08:00
parent d55c79c426
commit 6799c38291
33 changed files with 1222 additions and 92 deletions

View File

@ -29,7 +29,9 @@
"pages/order/delivery-detail/index",
"pages/order/invoice/index",
"pages/usercenter/name-edit/index",
"pages/index/index"
"pages/home/session/session",
"pages/home/additive/additive",
"pages/home/chemical/chemical"
],
"tabBar": {
"custom": true,

BIN
images/additive.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
images/chemical.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
images/no_additives.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
images/no_data.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
images/use_bi.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 KiB

View File

@ -1,5 +1,5 @@
const images = [{
img: '/images/use_bi.png',
img: '/images/use_bi.jpg',
text: '1',
},
{

View File

@ -0,0 +1,103 @@
// pages/home/additive/additive.js
import {
sessionAdditiveDetail
} from "../../../services/api/session";
Page({
/**
* 页面的初始数据
*/
data: {
additiveId: 0,
additiveData: {
"additiveId": 0,
"chemicals": [],
"cns": "",
"description": "",
"docs": [],
"enName": "",
"functions": [],
"ins": "",
"name": ""
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
additiveId: options?.additiveId
})
sessionAdditiveDetail({
id: this.data.additiveId
}).then(respose => {
if (respose.code == 10000) {
// console.log(respose.content);
this.setData({
additiveData: respose.content
})
console.log(this.data.pageData);
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
onGoChemical(event) {
console.log(event);
const chemicalId = event.currentTarget.dataset.chemical;
wx.navigateTo({
url: `/pages/home/chemical/chemical?chemicalId=${chemicalId}`,
});
}
})

View File

@ -0,0 +1,10 @@
{
"navigationBarTitleText": "添加剂",
"onReachBottomDistance": 10,
"backgroundTextStyle": "light",
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-tag": "tdesign-miniprogram/tag/tag",
"t-tabs": "tdesign-miniprogram/tabs/tabs"
}
}

View File

@ -0,0 +1,47 @@
<!--pages/home/additive/additive.wxml-->
<view class="main">
<view class="main-item">
<view class="title">
<image class="logo-image" src="../../../images/additive.jpg" mode="aspectFit"></image>
<view style="margin-left: 10px; margin-top: 10px;">
<view class="title-name">{{additiveData.name ? additiveData.name : 'XXX'}}</view>
<view class="title-enname">{{additiveData.enName ? additiveData.enName : 'xxx'}}</view>
</view>
</view>
<view style="display: flex; margin: 20px;">
<text style="width: 50%;">cns: {{additiveData.cns ? additiveData.cns : '-'}}</text>
<text style="width: 50%;">ins: {{additiveData.ins ? additiveData.ins : '-'}}</text>
</view>
<view style="display: flex; margin-left: 20px; margin-right: 20px;">
<t-tag wx:for="{{additiveData.functions}}" wx:key="index" wx:for-item="item" variant="light-outline" theme="primary">{{item}}</t-tag>
</view>
</view>
<view wx:if="{{additiveData.description != ''}}" class="main-item">
<view class="main-title">描述</view>
<view style="margin: 10px;">{{additiveData.description}}</view>
</view>
<view class="main-item">
<view class="main-title">包含物质</view>
<view class="chemical-item" wx:for="{{additiveData.chemicals}}" wx:key="index" wx:for-item="item" data-chemical="{{item.id}}" bindtap="onGoChemical">
<view>
<view class="chemical-name">{{item.name}}</view>
<view class="chemical-cas">{{item.cas}}</view>
</view>
<view>
<t-icon data-name="chevron-right-double" name="chevron-right-double" size="64rpx" />
</view>
</view>
</view>
<view class="main-item">
<view class="main-title">相关文档</view>
<view class="chemical-item" wx:for="{{additiveData.docs}}" wx:key="index" wx:for-item="item">
<view>
<view class="chemical-name">{{item.type}}</view>
<view class="chemical-cas" style="font-size: 0.75rem;">{{item.name}}</view>
</view>
<view style="margin-left: 5px;">
<t-icon data-name="browse" name="browse" size="64rpx" />
</view>
</view>
</view>
</view>

View File

@ -0,0 +1,70 @@
/* pages/home/additive/additive.wxss */
.main {
width: 100%;
}
.main-item {
margin: 10px;
margin-bottom: 15px;
border-radius: 0.5rem;
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
border-style: solid;
border-width: 2px;
border-color: rgba(230, 230, 230, 0.719);
padding: 15px;
}
.logo-image {
width: 75px;
height: 75px;
border-radius: 9999px;
border-style: solid;
border-width: 2px;
border-color: rgba(200, 200, 200, 0.548);
}
.title {
display: flex;
}
.main-title {
font-size: 1.25rem;
line-height: 1.75rem;
font-weight: 600;
margin: 10px;
}
.title-name {
font-size: 1.5rem;
line-height: 2rem;
font-weight: 600;
}
.title-enname {
color: rgb(150, 150, 150);
}
.chemical-item {
display: flex;
justify-content: space-between;
border-radius: 0.5rem;
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
border-style: solid;
border-width: 2px;
border-color: rgba(230, 230, 230, 0.719);
margin: 10px;
padding: 10px;
align-items: center;
}
.chemical-name {
margin-bottom: 5px;
}
.chemical-cas {
color: rgb(150, 150, 150);
}

View File

@ -0,0 +1,99 @@
// pages/home/chemical/chemical.js
import {
sessionAdditiveChemical
} from "../../../services/api/session";
Page({
/**
* 页面的初始数据
*/
data: {
chemicalId: 0,
chemicalData: {
"GHS": {
"GHSHazardStatements": []
},
"cas": "",
"chemicalId": 80,
"description": [],
"disease": [],
"enName": "",
"formula": "",
"hazards": "",
"name": "",
"otherName": "",
"toxicity": []
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
chemicalId: options?.chemicalId
})
sessionAdditiveChemical({
id: this.data.chemicalId
}).then(respose => {
if (respose.code == 10000) {
// console.log(respose.content);
this.setData({
chemicalData: respose.content
})
console.log(this.data.chemicalData);
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,15 @@
{
"navigationBarTitleText": "化学元素",
"onReachBottomDistance": 10,
"backgroundTextStyle": "light",
"usingComponents": {
"no-data": "../components/no-data/no-data",
"t-search": "tdesign-miniprogram/search/search",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-grid": "tdesign-miniprogram/grid/grid",
"t-grid-item": "tdesign-miniprogram/grid/grid-item",
"t-tag": "tdesign-miniprogram/tag/tag",
"t-tabs": "tdesign-miniprogram/tabs/tabs",
"t-tab-panel": "tdesign-miniprogram/tabs/tab-panel"
}
}

View File

@ -0,0 +1,78 @@
<!--pages/home/chemical/chemical.wxml-->
<view class="main">
<view class="main-item">
<view class="title">
<image class="logo-image" src="../../../images/chemical.png" mode="aspectFit"></image>
<view style="margin-left: 10px; margin-top: 10px;">
<view class="title-name">{{chemicalData.name ? chemicalData.name : 'XXX'}}</view>
<view class="title-enname">{{chemicalData.enName ? chemicalData.enName : 'xxx'}}</view>
</view>
</view>
<view style="margin: 20px;">
<view style="margin-bottom: 5px;">cas: {{chemicalData.cas ? chemicalData.cas : '-'}}</view>
<view style="margin-bottom: 5px;">分子式: {{chemicalData.formula ? chemicalData.formula : '-'}}</view>
<view>其它名称: </view>
<view style="margin-left: 10px;">{{chemicalData.otherName}}</view>
</view>
<view style="display: flex; margin-left: 20px; margin-right: 20px;">
<t-tag wx:for="{{chemicalData.functions}}" wx:key="index" wx:for-item="item" variant="light-outline" theme="primary">{{item}}</t-tag>
</view>
</view>
<view style="width: 100%; height: 100%;">
<t-tabs defaultValue="{{0}}" sticky>
<t-tab-panel label="描述" value="0">
<view class="no-data" wx:if="{{chemicalData.description.length == 0}}">
<image src="../../../images/no_data.jpg" mode="aspectFit"></image>
</view>
<view class="total" wx:for="{{chemicalData.description}}" wx:key="index" wx:for-item="item">{{item}}</view>
</t-tab-panel>
<t-tab-panel label="危险信息" value="1">
<view class="total">
<text class="title">GHS(全球化学品统一分类和标签制度)</text>
<t-grid class="block" column="{{3}}">
<t-grid-item wx:for="{{chemicalData.GHS.icon}}" wx:key="index" wx:for-item="item" text="{{item.extra}}" image="{{item.url}}" />
</t-grid>
<view wx:if="{{chemicalData.GHS.signal}}" style="margin-bottom: 15px;">标识: {{chemicalData.GHS.signal}}</view>
<view>防范说明:</view>
<view style="margin: 10px;" wx:for="{{chemicalData.GHS.GHSHazardStatements}}" wx:key="index" wx:for-item="item">{{item}}</view>
</view>
</t-tab-panel>
<t-tab-panel label="急性毒性" value="2">
<view wx:if="{{chemicalData.toxicity.length}}" class="total" style="margin-top: 10px;">
<view style="width: 100%; display: flex; flex-direction: row-reverse;">
<t-icon color="#0052d9" data-name="help-circle-filled" name="help-circle-filled" size="48rpx" />
</view>
<view class="toxicity-item" wx:for="{{chemicalData.toxicity}}" wx:key="index" wx:for-item="item">
<view class="toxicity-top">
<text>{{item.organism}}</text>
<text>{{item.route}}</text>
<text>{{item.dose}}</text>
<text style="color: #0052d9;">{{item.testtype}}</text>
</view>
<view class="toxicity-bottom" wx:if="{{item.effect}}">影响: {{item.effect}}</view>
<view class="toxicity-bottom" wx:if="{{item.reference}}">数据源: {{item.reference}}</view>
</view>
</view>
<no-data wx:else></no-data>
</t-tab-panel>
<t-tab-panel label="相关疾病" value="3">
<view wx:if="{{chemicalData.disease.length}}" class="total" style="margin-top: 10px;">
<view style="width: 100%; display: flex; flex-direction: row-reverse;">
<t-icon color="#0052d9" data-name="help-circle-filled" name="help-circle-filled" size="48rpx" />
</view>
<view class="disease-item" wx:for="{{chemicalData.disease}}" wx:key="index" wx:for-item="item">
<view class="disease-top">
<view class="disease-name">{{item.diseasename}}</view>
<t-tag variant="light" theme="{{item.directevidence == 'therapeutic' ? 'success' : 'warning'}}">{{item.directevidence == 'therapeutic' ? '治疗' : '相关'}}</t-tag>
</view>
<view class="disease-key">相关论文:</view>
<view class="disease-value">
<view style="margin-left: 10px;" wx:for="{{item.dois}}" wx:key="index" wx:for-item="dois">{{dois.pmids}}</view>
</view>
</view>
</view>
<no-data wx:else></no-data>
</t-tab-panel>
</t-tabs>
</view>
</view>

View File

@ -0,0 +1,135 @@
/* pages/home/chemical/chemical.wxss */
.main {
width: 100%;
}
.main-item {
margin: 10px;
margin-bottom: 15px;
border-radius: 0.5rem;
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
border-style: solid;
border-width: 2px;
border-color: rgba(230, 230, 230, 0.719);
padding: 15px;
}
.logo-image {
width: 50px;
height: 50px;
border-radius: 9999px;
border-style: solid;
border-width: 2px;
border-color: rgba(200, 200, 200, 0.548);
padding: 10px;
}
.title {
display: flex;
}
.main-title {
font-size: 1.25rem;
line-height: 1.75rem;
font-weight: 600;
margin: 10px;
}
.title-name {
font-size: 1.5rem;
line-height: 2rem;
font-weight: 600;
}
.title-enname {
color: rgb(150, 150, 150);
}
.total {
margin: 30px;
overflow: auto;
font-size: 1rem;
line-height: 1.5rem;
}
.no-data {
display: flex;
justify-content: center;
margin-top: 40px;
}
.title {
font-size: 1.125rem;
line-height: 1.75rem;
font-weight: 600;
margin-bottom: 20px;
}
.toxicity-top {
display: flex;
justify-content: space-between;
font-size: 0.75rem;
line-height: 1.25rem;
font-weight: 600;
}
.toxicity-item {
padding: 5px;
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
border-style: solid;
border-width: 2px;
border-color: rgba(230, 230, 230, 0.719);
border-radius: 0.5rem;
margin-top: 15px;
}
.toxicity-bottom {
margin-top: 5px;
font-size: 0.75rem;
line-height: 1.25rem;
margin-left: 8px;
margin-right: 8px;
}
.disease-top {
display: flex;
justify-content: space-between;
}
.disease-name {
font-size: 0.75rem;
line-height: 1.25rem;
font-weight: 600;
}
.disease-key {
font-size: 0.75rem;
line-height: 1.25rem;
}
.disease-value {
margin-right: 10px;
font-size: 0.75rem;
line-height: 1.25rem;
font-weight: 600;
color: #0052d9;
display: flex;
flex-wrap: wrap;
}
.disease-item {
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
border-style: solid;
border-width: 1px;
border-color: rgba(230, 230, 230, 0.719);
border-radius: 0.5rem;
margin-top: 15px;
padding: 5px;
padding-left: 10px;
padding-right: 10px;
}

View File

@ -0,0 +1,23 @@
// pages/home/session/components/no-data.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,4 @@
<!--pages/home/session/components/no-data.wxml-->
<view class="no-data">
<image src="/images/no_data.jpg" mode="aspectFit"></image>
</view>

View File

@ -0,0 +1,7 @@
/* pages/home/session/components/no-data.wxss */
.no-data {
display: flex;
justify-content: center;
margin-top: 40px;
}

View File

@ -26,8 +26,10 @@ Page({
navigation: {
type: 'dots'
},
loadingDialog: false,
},
goodListPagination: {
index: 0,
num: 20,
@ -158,26 +160,65 @@ Page({
});
},
showLoadingDialog() {
this.data.loadingDialog = true
},
closeLoadingDialog() {
this.data.loadingDialog = false
},
// 上传图片
uploadPicture() {
if (!isLogin()) {
return
}
let that = this;
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
maxDuration: 30,
camera: 'back',
success(res) {
console.log(res.tempFiles);
success: (res) => {
if (res.tempFiles.length >= 1) {
sessionUpload({
urls: res.tempFiles
this.setData({
loadingDialog: true
})
}
sessionUpload({
urls: res.tempFiles,
session: 0
}).then(tmp => {
console.log(tmp);
if (tmp.code == 10000) {
if (this.data.loadingDialog) {
this.goSession(tmp.content.sessionId);
}
}
this.setData({
loadingDialog: false
})
})
} else {}
}
})
},
textButton(e) {
// this.goSession(76)
this.setData({
loadingDialog: !this.data.loadingDialog
})
},
onCloseDialog() {
this.setData({
loadingDialog: false
})
},
goSession(sessionId) {
wx.navigateTo({
url: `/pages/home/session/session?sessionId=${sessionId}`,
});
}
});

View File

@ -11,9 +11,11 @@
"t-image": "/components/webp-image/index",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-toast": "tdesign-miniprogram/toast/toast",
"t-button": "tdesign-miniprogram/button/button",
"t-tabs": "tdesign-miniprogram/tabs/tabs",
"t-tab-panel": "tdesign-miniprogram/tabs/tab-panel",
"goods-list": "/components/goods-list/index",
"load-more": "/components/load-more/index"
"load-more": "/components/load-more/index",
"t-dialog": "tdesign-miniprogram/dialog/dialog"
}
}

View File

@ -2,12 +2,19 @@
<view class="swiper-wrap">
<t-swiper wx:if="{{imgSrcs.length > 0}}" current="{{current}}" autoplay="{{autoplay}}" duration="{{duration}}" interval="{{interval}}" navigation="{{navigation}}">
<t-swiper-item wx:for="{{imgSrcs}}" wx:key="index">
<t-image src="{{item.img}}" t-class="t-image__swiper" bind:tap="navToActivityDetail" data-item="{{item}}" />
<t-image src="{{item.img}}" t-class="t-image__swiper" data-item="{{item}}" />
</t-swiper-item>
</t-swiper>
</view>
</view>
<view class="home-page-container">
<!-- <t-button bindtap="textButton"></t-button> -->
<t-image t-class="searich_btn" shape="round" mode="heightFix" src="/images/search.jpg" bind:tap="uploadPicture" />
</view>
<view class="home-page-ad"></view>
<view class="home-page-ad"></view>
<t-dialog visible="{{loadingDialog}}" cancel-btn="取消操作" bind:cancel="onCloseDialog">
<view slot="content">
<t-loading t-class="dialog-content" theme="circular" size="200rpx" class="large" />
<view class="dialog-text">服务器正在拼命计算,请稍后...</view>
</view>
</t-dialog>

View File

@ -126,4 +126,14 @@ page {
.t-class-indicator,
.loading-text {
color: #b9b9b9 !important;
}
.dialog-content {
display: flex;
justify-content: center;
flex-direction: column;
}
.dialog-text {
margin-top: 30px;
}

View File

@ -0,0 +1,138 @@
// pages/home/session/session.js
import {
sessionQuery,
sessionAdditiveQuery
} from '../../../services/api/session';
Page({
/**
* 页面的初始数据
*/
data: {
sessionId: 0,
headerImage: '',
pageData: {
additives: {
count: 3,
kinds: []
},
address: [],
company: ["浏阳市青草学堂食品厂"],
images: [""],
licenseCode: ["SC11643018106863"],
sessionId: 0,
standard: "Q/AQCX0001S",
standardType: "企业标准",
tags: ["反式脂肪酸", "添加剂"],
typeCode: "",
typeName: "",
rate: {
level: 4,
text: '不建议儿童食用',
type: ''
}
},
visibleImages: false,
additives: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.sessionId = options?.sessionId;
// this.sessionId = 76
sessionQuery({
id: this.sessionId
}).then(respose => {
if (respose.code == 10000) {
console.log(respose.content);
this.setData({
pageData: respose.content
})
console.log(this.data.pageData);
}
})
sessionAdditiveQuery({
id: this.sessionId
}).then(respose => {
this.setData({
additives: respose.content.additives
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
onTabsClick(event) {
console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
},
onShowImages() {
console.log(this.data.visibleImages);
this.setData({
visibleImages: true
})
},
onCloseImages() {
this.setData({
visibleImages: false
})
},
onGoAdditive(event) {
const additiveId = event.currentTarget.dataset.additive;
wx.navigateTo({
url: `/pages/home/additive/additive?additiveId=${additiveId}`,
});
}
})

View File

@ -0,0 +1,19 @@
{
"navigationBarTitleText": "商品详情",
"onReachBottomDistance": 10,
"backgroundTextStyle": "light",
"usingComponents": {
"no-data": "../components/no-data/no-data",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-image": "tdesign-miniprogram/image/image",
"t-tag": "tdesign-miniprogram/tag/tag",
"t-tabs": "tdesign-miniprogram/tabs/tabs",
"t-skeleton": "tdesign-miniprogram/skeleton/skeleton",
"t-badge": "tdesign-miniprogram/badge/badge",
"t-tab-panel": "tdesign-miniprogram/tabs/tab-panel",
"t-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer",
"t-grid": "tdesign-miniprogram/grid/grid",
"t-grid-item": "tdesign-miniprogram/grid/grid-item",
"t-rate": "tdesign-miniprogram/rate/rate"
}
}

View File

@ -0,0 +1,137 @@
<!--pages/home/session/session.wxml-->
<view class="main">
<view class="header">
<view class="left">
<view class="type">
<text>{{ pageData.typeName ? pageData.typeName : '无分类 | ' }}</text>
<text class="type-code">{{ pageData.typeCode ? pageData.typeCode : 'xxx' }}</text>
</view>
<view>
<t-tag class="type-tag" wx:for="{{ pageData.tags }}" wx:key="index" wx:for-item="tag" variant="light" theme="warning">{{ tag }}</t-tag>
<!-- <t-tag class="type-tag" size="small" variant="light" theme="warning">反式脂肪酸</t-tag> -->
</view>
<view class="header-time">{{pageData.createTime}}</view>
</view>
<view class="right">
<t-icon class="header-icon" data-name="add-rectangle" name="add-rectangle" size="64rpx" bind:click="onIconTap" />
<t-badge count="{{pageData.images.length}}" color="#0052d9" offset="{{ [64, 8] }}">
<image class="header-image" wx:if="{{ pageData.images.length >= 1 }}" src="{{ pageData.images[0] }} " bindtap="onShowImages"></image>
</t-badge>
</view>
</view>
<view class="body">
<t-tabs defaultValue="{{0}}" space-evenly="{{false}}" bind:click="onTabsClick" sticky>
<t-tab-panel label="总览" value="{{ 0 }}">
<view class="total">
<view wx:if="{{pageData.sessionId != 0}}">
<view class="body-section">
<view class="body-row">
<text class="body-key">推荐指数:</text>
<view style="margin-left: 20px;">
<t-rate value="{{pageData.rate.level}}" icon="heart-filled" />
<view wx:if="{{pageData.rate.text != ''}}" :style="margin-top: 5px;">{{pageData.rate.text}}</view>
</view>
</view>
</view>
<view class="body-section">
<view class="body-row">
<text class="body-key">类别:</text>
<view>
<text class="body-value" wx:if="{{pageData.typeName}}">{{pageData.typeCode}} {{pageData.typeName}}</text>
<text class="body-value" wx:else>暂无分类</text>
</view>
</view>
<view class="body-row">
<text class="body-key">食品标准号:</text>
<view>
<text class="body-value" wx:if="{{pageData.standard}}">{{pageData.standard}}</text>
<text class="body-empty" wx:else>暂无数据</text>
</view>
</view>
<view class="body-row">
<text class="body-key">生产许可证:</text>
<view>
<text class="body-value" wx:if="{{pageData.licenseCode.length}}" wx:for="{{pageData.licenseCode}}" wx:key="index" wx:for-item="item">{{item}}</text>
<text class="body-empty" wx:if="{{pageData.licenseCode.length == 0}}">暂无数据</text>
</view>
</view>
</view>
<view class="body-section">
<view class="body-row" style="margin-bottom: 10px;">
<text class="body-key body-title">添加剂:</text>
<view>
<text class="body-value" wx:if="{{pageData.additives.count}}">{{pageData.additives.count}}</text>
<text wx:else>无添加</text>
</view>
</view>
<t-grid column="{{2}}" align="left">
<t-grid-item wx:for="{{pageData.additives.kinds}}" wx:key="index" wx:for-item="item">
<view class="body-additive-row" style="margin: 0;">
<text class="body-key">{{item.name}}</text>
<text class="body-value">{{item.count}}</text>
</view>
</t-grid-item>
</t-grid>
<!-- <view class="body-additive-row" wx:for="{{pageData.additives.kinds}}" wx:key="index" wx:for-item="item">
</view> -->
</view>
<view class="body-section">
<text class="body-key body-title">生产企业</text>
<view class="body-company">
<t-icon class="body-company-icon" data-name="home" name="home" size="48rpx" color="#0052d9" />
<view wx:for="{{pageData.company}}" wx:key="index" wx:for-item="item">
<text class="body-company-raw">{{item}}</text>
</view>
</view>
<view class="body-company">
<t-icon class="body-company-icon" data-name="location" name="location" size="48rpx" color="#0052d9" />
<view wx:for="{{pageData.address}}" wx:key="index" wx:for-item="item">
<text class="body-company-raw">{{item}}</text>
</view>
</view>
</view>
</view>
<view wx:if="{{pageData.sessionId == 0}}">
<t-skeleton theme="paragraph" loading="{{true}}" style="margin: 20px;"></t-skeleton>
<t-skeleton theme="paragraph" loading="{{true}}" style="margin: 20px;"></t-skeleton>
</view>
</view>
</t-tab-panel>
<t-tab-panel label="添加剂" value="{{ 1 }}">
<view wx:if="{{additives.length != 0}}" class="additive">
<view class="additive-item" wx:for="{{additives}}" wx:key="index" wx:for-item="item" data-additive="{{item.additiveId}}" bindtap="onGoAdditive">
<view class="additive-title">
<view class="additive-name">{{item.name}}</view>
<view>
<text class="additive-type" wx:for="{{item.types}}" wx:key="index" wx:for-item="tag">{{tag}}</text>
</view>
</view>
<view class="additive-standard">{{item.standard}}</view>
<view class="body-key" style="margin-bottom: 10px;" wx:if="{{item.chemicals.lenth != 0}}">所含元素:</view>
<view class="additive-chemical" wx:for="{{item.chemicals}}" wx:key="index" wx:for-item="chemical">
<view class="additive-chemical-left">
<view class="additive-chemical-name">{{chemical.name}}</view>
<view class="additive-chemical-cas">{{chemical.cas}}</view>
</view>
<view class="additive-chemical-right">
<view class="additive-chemical-right-tags"></view>
<view class="additive-chemical-right-icon">
<t-icon data-name="chevron-right-double" name="chevron-right-double" size="64rpx" />
</view>
</view>
</view>
</view>
</view>
<no-data wx:else></no-data>
</t-tab-panel>
<t-tab-panel label="相关标准" value="{{ 2 }}">
<no-data></no-data>
</t-tab-panel>
<t-tab-panel label="生产企业" value="{{ 3 }}">
<no-data></no-data>
</t-tab-panel>
</t-tabs>
</view>
</view>
<t-image-viewer closeBtn="{{true}}" showIndex="{{true}}" visible="{{visibleImages}}" images="{{pageData.images}}" bind:close="onCloseImages"></t-image-viewer>

View File

@ -0,0 +1,202 @@
/* pages/home/session/session.wxss */
.main {}
.header {
height: 20%;
display: flex;
justify-content: space-between;
margin: 10px;
margin-bottom: 20px;
padding: 10px;
background-color: rgba(255, 255, 255, 0.829);
border-radius: 0.5rem;
--tw-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
border-width: 2px;
border-style: solid;
border-color: rgba(230, 230, 230, 0.719);
}
.type {
font-size: 1.25rem;
line-height: 1.75rem;
font-weight: 600;
margin-bottom: 5px;
margin-left: 10px;
width: 100%;
}
.type-code {
font-size: 1rem;
color: rgb(165, 165, 165);
}
.type-tag {
margin-left: 10px;
}
.header-icon {
margin-right: 10px;
}
.header-image {
width: 72px;
height: 72px;
border-radius: 0.5rem;
}
.header-time {
width: 100%;
text-align: right;
bottom: 0;
font-size: 0.75rem;
margin-right: 10px;
color: rgb(150, 150, 150);
}
.left {
width: 100%;
height: 76px;
display: flex;
flex-wrap: wrap;
align-content: space-between;
}
.right {
display: flex;
align-items: flex-end;
}
.body {
width: 100%;
height: 80%;
}
.total {
margin: 30px;
overflow: auto;
}
.body-section {
margin-left: 10px;
margin-right: 10px;
margin-bottom: 25px;
}
.body-row {
display: flex;
flex-wrap: nowrap;
margin-bottom: 5px;
}
.body-key {
font-size: 1rem;
line-height: 1.5rem;
font-weight: 500;
color: rgb(20, 20, 20);
}
.body-title {
font-weight: 600;
}
.body-value {
font-size: 1rem;
line-height: 1.5rem;
color: rgb(90, 90, 90);
}
.body-company {
display: flex;
flex-wrap: nowrap;
margin-top: 10px;
}
.body-company-icon {
margin-right: 10px;
}
.body-company-raw {
font-size: 1rem;
line-height: 1.5rem;
color: rgb(90, 90, 90);
width: 100%;
}
.additive {
padding: 15px;
}
.additive-item {
/* width: 100%; */
margin-bottom: 20px;
padding: 15px;
border-radius: 0.5rem;
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
border-style: solid;
border-width: 2px;
border-color: rgba(230, 230, 230, 0.719);
}
.additive-title {
width: 100%;
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
.additive-name {
font-size: 1.125rem;
line-height: 1.75rem;
font-weight: 550;
}
.additive-type {
margin-left: 5px;
color: rgb(150, 150, 150);
}
.additive-standard {
font-size: 0.875rem;
line-height: 1.25rem;
color: rgb(150, 150, 150);
margin-bottom: 10px;
}
.additive-chemical {
border-radius: 0.5rem;
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
border-style: solid;
border-width: 2px;
border-color: rgba(230, 230, 230, 0.719);
margin-bottom: 10px;
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
.additive-chemical-name {
font-size: 1rem;
line-height: 1.5rem;
}
.additive-chemical-right-icon {
display: flex;
align-items: center;
}
.additive-chemical-cas {
margin-left: 10px;
margin-top: 5px;
color: rgb(150, 150, 150);
}
.no-data {
display: flex;
justify-content: center;
margin-top: 40px;
}

View File

@ -1,66 +0,0 @@
// pages/index/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -1,2 +0,0 @@
<!--pages/index/index.wxml-->
<text>pages/index/index.wxml</text>

View File

@ -2,7 +2,8 @@ import {
baseURL
} from '../../config/api'
import {
getToken
getToken,
isLogin
} from '../permission/login'
export function request({
path,
@ -36,6 +37,11 @@ export function uploadFile({
data
}) {
return new Promise((resolve, reject) => {
let token = getToken()
if (token == '') {
isLogin()
}
console.log(url);
wx.uploadFile({
url: baseURL + path, //接口地址
filePath: url,
@ -43,12 +49,15 @@ export function uploadFile({
header: {
"X-API-TOKEN": getToken()
},
name: 'upfile',
formData: data,
success: function (res) {
console.log(res)
resolve(res.data)
},
fail: function (res) {
console.log(res);
reject(res.data)
}
})
})

View File

@ -1,5 +1,6 @@
import {
uploadFile
uploadFile,
request
} from './request'
export function sessionUpload({
@ -7,12 +8,16 @@ export function sessionUpload({
session
}) {
if (session == 0) {
uploadFile({
path: '/ocr/upload',
url: urls[0].tempFilePath,
data: {}
}).then(res => {
console.log(res);
return new Promise((resolve, reject) => {
uploadFile({
path: '/ocr/upload',
url: urls[0].tempFilePath,
data: {}
}).then(res => {
console.log(res);
const tmp = JSON.parse(res)
resolve(tmp)
})
})
} else {
for (let index = 0; index < urls.length; index++) {
@ -25,7 +30,41 @@ export function sessionUpload({
}
}).then(res => {
console.log(res);
const tmp = JSON.parse(res)
reject(tmp)
})
}
}
}
export function sessionQuery(params) {
return request({
path: '/session/query',
params: params,
method: 'GET'
});
}
export function sessionAdditiveQuery(params) {
return request({
path: '/session/additive/query',
params: params,
method: 'GET'
});
}
export function sessionAdditiveDetail(params) {
return request({
path: '/session/additive/detail',
params: params,
method: 'GET'
});
}
export function sessionAdditiveChemical(params) {
return request({
path: '/session/additive/chemical',
params: params,
method: 'GET'
});
}

View File

@ -11,13 +11,10 @@ export function isLogin() {
success(res) {
if (res.code) {
//发起网络请求
const respose = wxLogin({
wxLogin({
code: res.code
})
respose.then(function (data) {
console.log(respose);
}).then(respose => {
token = respose.content.token
console.log(token);
resolve(true);
})
} else {