完善标准查询
This commit is contained in:
parent
5031aed2cb
commit
56016a9a88
@ -8,7 +8,11 @@
|
|||||||
<view class="list-view">
|
<view class="list-view">
|
||||||
<t-cell wx:for="{{addtiveList}}" wx:key="index" wx:for-item="item" hover arrow data-additive="{{item.id}}" bindtap="onGoAdditive">
|
<t-cell wx:for="{{addtiveList}}" wx:key="index" wx:for-item="item" hover arrow data-additive="{{item.id}}" bindtap="onGoAdditive">
|
||||||
<view slot="title">
|
<view slot="title">
|
||||||
<view>{{item.name}}</view>
|
<view>
|
||||||
|
<text>{{item.name}}</text>
|
||||||
|
<text class="addtive-enname" style="margin-left: 10px;">cns: {{item.cns}}</text>
|
||||||
|
<text class="addtive-enname" style="margin-left: 10px;">ins: {{item.ins}}</text>
|
||||||
|
</view>
|
||||||
<view class="addtive-enname">{{item.enName}}</view>
|
<view class="addtive-enname">{{item.enName}}</view>
|
||||||
<view class="addtive-enname">{{item.function}}</view>
|
<view class="addtive-enname">{{item.function}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -13,7 +13,9 @@
|
|||||||
<t-image t-class="search_img" shape="round" mode="heightFix" src="/images/check.png" />
|
<t-image t-class="search_img" shape="round" mode="heightFix" src="/images/check.png" />
|
||||||
</view>
|
</view>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<button class="search_btn" theme="default" size="large" bind:tap="uploadPicture" block>扫一扫</button>
|
<button class="search_btn" theme="default" size="large" bind:tap="uploadPicture" block>
|
||||||
|
<t-icon t-class="" data-name="photo" name="photo" size="48rpx" />拍照识别
|
||||||
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="home-page-ad"></view> -->
|
<!-- <view class="home-page-ad"></view> -->
|
||||||
|
|||||||
@ -51,6 +51,9 @@ page {
|
|||||||
margin-right: 70px;
|
margin-right: 70px;
|
||||||
background-color: #ffcd38;
|
background-color: #ffcd38;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-page-container,
|
.home-page-container,
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
// pages/home/session/session.js
|
// pages/home/session/session.js
|
||||||
import {
|
import {
|
||||||
sessionQuery,
|
sessionQuery,
|
||||||
sessionAdditiveQuery
|
sessionAdditiveQuery,
|
||||||
|
sessionChangeStandard
|
||||||
} from '../../../services/api/session';
|
} from '../../../services/api/session';
|
||||||
import {
|
import {
|
||||||
sessionUpload
|
sessionUpload
|
||||||
@ -38,6 +39,10 @@ Page({
|
|||||||
},
|
},
|
||||||
visibleImages: false,
|
visibleImages: false,
|
||||||
additives: [],
|
additives: [],
|
||||||
|
inter: '',
|
||||||
|
standardPopupVisible: false,
|
||||||
|
standardDialogVisible: false,
|
||||||
|
changeStandard: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,6 +54,54 @@ Page({
|
|||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onChangeStandard() {
|
||||||
|
this.setData({
|
||||||
|
standardDialogVisible: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onChangeStandardInput(e) {
|
||||||
|
this.setData({
|
||||||
|
changeStandard: e.detail.value
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
confirmStandardDialog() {
|
||||||
|
sessionChangeStandard({
|
||||||
|
id: this.sessionId,
|
||||||
|
standard: this.data.changeStandard
|
||||||
|
}).then(respose => {
|
||||||
|
if (respose.code == 10000) {
|
||||||
|
this.setData({
|
||||||
|
standardDialogVisible: false,
|
||||||
|
changeStandard: ''
|
||||||
|
});
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
closeStandardDialog() {
|
||||||
|
this.setData({
|
||||||
|
standardDialogVisible: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onOpenStandard() {
|
||||||
|
if (this.data.pageData.standardInfo.isFound != 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
standardPopupVisible: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onVisibleChange(e) {
|
||||||
|
this.setData({
|
||||||
|
standardPopupVisible: e.detail.visible,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
sessionQuery({
|
sessionQuery({
|
||||||
id: this.sessionId
|
id: this.sessionId
|
||||||
@ -59,13 +112,16 @@ Page({
|
|||||||
pageData: respose.content
|
pageData: respose.content
|
||||||
})
|
})
|
||||||
console.log(this.data.pageData);
|
console.log(this.data.pageData);
|
||||||
|
if (respose.content.standardInfo.isFound == 2) {
|
||||||
|
this.startInter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
sessionAdditiveQuery({
|
sessionAdditiveQuery({
|
||||||
id: this.sessionId
|
id: this.sessionId
|
||||||
}).then(respose => {
|
}).then(respose => {
|
||||||
this.setData({
|
this.setData({
|
||||||
additives: respose.content.additives
|
additives: respose.content?.additives
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -91,11 +147,44 @@ Page({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动定时器
|
||||||
|
*/
|
||||||
|
startInter: function () {
|
||||||
|
var that = this;
|
||||||
|
that.data.inter = setInterval(
|
||||||
|
function () {
|
||||||
|
// TODO 你需要无限循环执行的任务
|
||||||
|
console.log('setInterval 每过500毫秒执行一次任务')
|
||||||
|
sessionQuery({
|
||||||
|
id: that.sessionId
|
||||||
|
}).then(respose => {
|
||||||
|
if (respose.code == 10000) {
|
||||||
|
console.log(respose.content);
|
||||||
|
if (respose.content.standardInfo.isFound != 2) {
|
||||||
|
that.setData({
|
||||||
|
pageData: respose.content
|
||||||
|
})
|
||||||
|
console.log(this.data.pageData);
|
||||||
|
this.endInter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, 3000);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 结束定时器
|
||||||
|
*/
|
||||||
|
endInter: function () {
|
||||||
|
var that = this;
|
||||||
|
clearInterval(that.data.inter);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面卸载
|
* 生命周期函数--监听页面卸载
|
||||||
*/
|
*/
|
||||||
onUnload() {
|
onUnload() {
|
||||||
|
this.endInter()
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,7 +209,7 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onTabsClick(event) {
|
onTabsClick(event) {
|
||||||
console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
|
// console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
onShowImages() {
|
onShowImages() {
|
||||||
|
|||||||
@ -14,6 +14,9 @@
|
|||||||
"t-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer",
|
"t-image-viewer": "tdesign-miniprogram/image-viewer/image-viewer",
|
||||||
"t-grid": "tdesign-miniprogram/grid/grid",
|
"t-grid": "tdesign-miniprogram/grid/grid",
|
||||||
"t-grid-item": "tdesign-miniprogram/grid/grid-item",
|
"t-grid-item": "tdesign-miniprogram/grid/grid-item",
|
||||||
"t-rate": "tdesign-miniprogram/rate/rate"
|
"t-rate": "tdesign-miniprogram/rate/rate",
|
||||||
|
"t-popup": "tdesign-miniprogram/popup/popup",
|
||||||
|
"t-dialog": "tdesign-miniprogram/dialog/dialog",
|
||||||
|
"t-input": "tdesign-miniprogram/input/input"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,8 +3,7 @@
|
|||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view class="type">
|
<view class="type">
|
||||||
<text>{{ pageData.typeName ? pageData.typeName : '无分类 | ' }}</text>
|
<text>{{ pageData.standardInfo.name ? pageData.standardInfo.name : '暂无分类' }}</text>
|
||||||
<text class="type-code">{{ pageData.typeCode ? pageData.typeCode : 'xxx' }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<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" wx:for="{{ pageData.tags }}" wx:key="index" wx:for-item="tag" variant="light" theme="warning">{{ tag }}</t-tag>
|
||||||
@ -37,15 +36,18 @@
|
|||||||
<view class="body-row">
|
<view class="body-row">
|
||||||
<text class="body-key">类别:</text>
|
<text class="body-key">类别:</text>
|
||||||
<view>
|
<view>
|
||||||
<text class="body-value" wx:if="{{pageData.typeName}}">{{pageData.typeCode}} {{pageData.typeName}}</text>
|
<text class="body-value">{{pageData.standardInfo.name ? pageData.standardInfo.name : "暂无分类"}}</text>
|
||||||
<text class="body-value" wx:else>暂无分类</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="body-row">
|
<view class="body-row">
|
||||||
<text class="body-key">食品标准号:</text>
|
<text class="body-key">食品标准号:</text>
|
||||||
<view>
|
<view>
|
||||||
<text class="body-value" wx:if="{{pageData.standard}}">{{pageData.standard}}</text>
|
<text class="body-value" style="color: #0052d9;" wx:if="{{pageData.standard}}" bindtap="onOpenStandard">{{pageData.standard}}</text>
|
||||||
<text class="body-empty" wx:else>暂无数据</text>
|
<text class="body-empty" wx:else>暂无数据</text>
|
||||||
|
<t-tag wx:if="{{pageData.standardInfo.type}}" t-class="standard-tag" variant="light" theme="primary" size="small">{{pageData.standardInfo.type}}</t-tag>
|
||||||
|
<text wx:if="{{pageData.standardInfo.isFound == 2}}" style="margin-left: 10px; color: #0052d9;">标准查询中…</text>
|
||||||
|
<text style="margin-left: 10px; color: #0052d9;" bindtap="onChangeStandard">修正</text>
|
||||||
|
<view wx:if="{{pageData.standardInfo.isFound == 0}}" class="comment">未查询到该标准,请前往国家标准网站查询或修正识别错误,再次查询。</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="body-row">
|
<view class="body-row">
|
||||||
@ -61,7 +63,7 @@
|
|||||||
<text class="body-key body-title">添加剂:</text>
|
<text class="body-key body-title">添加剂:</text>
|
||||||
<view>
|
<view>
|
||||||
<text class="body-value" wx:if="{{pageData.additives.count}}">{{pageData.additives.count}}</text>
|
<text class="body-value" wx:if="{{pageData.additives.count}}">{{pageData.additives.count}}</text>
|
||||||
<text wx:else>无添加</text>
|
<t-tag wx:else variant="light" theme="success" size="small">无添加</t-tag>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<t-grid column="{{2}}" align="left">
|
<t-grid column="{{2}}" align="left">
|
||||||
@ -79,14 +81,18 @@
|
|||||||
<text class="body-key body-title">生产企业</text>
|
<text class="body-key body-title">生产企业</text>
|
||||||
<view class="body-company">
|
<view class="body-company">
|
||||||
<t-icon class="body-company-icon" data-name="home" name="home" size="48rpx" color="#0052d9" />
|
<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">
|
<view class="body-company-box">
|
||||||
<text class="body-company-raw">{{item}}</text>
|
<view wx:for="{{pageData.company}}" wx:key="index" wx:for-item="item">
|
||||||
|
<text class="body-company-raw">{{item}}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="body-company">
|
<view class="body-company">
|
||||||
<t-icon class="body-company-icon" data-name="location" name="location" size="48rpx" color="#0052d9" />
|
<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">
|
<view class="body-company-box">
|
||||||
<text class="body-company-raw">{{item}}</text>
|
<view wx:for="{{pageData.address}}" wx:key="index" wx:for-item="item">
|
||||||
|
<text class="body-company-raw">{{item}}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -134,4 +140,38 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<t-image-viewer closeBtn="{{true}}" showIndex="{{true}}" visible="{{visibleImages}}" images="{{pageData.images}}" bind:close="onCloseImages"></t-image-viewer>
|
<t-image-viewer closeBtn="{{true}}" showIndex="{{true}}" visible="{{visibleImages}}" images="{{pageData.images}}" bind:close="onCloseImages"></t-image-viewer>
|
||||||
|
|
||||||
|
<t-popup visible="{{standardPopupVisible}}" bind:visible-change="onVisibleChange" placement="bottom">
|
||||||
|
<view class="standard-info">
|
||||||
|
<view class="standard-info-title">{{pageData.standardInfo.code}}</view>
|
||||||
|
<view class="standard-info-item">
|
||||||
|
<text class="standard-info-item-title">标准名称:</text>
|
||||||
|
<text>{{pageData.standardInfo.name}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="standard-info-item">
|
||||||
|
<text class="standard-info-item-title">标准类型:</text>
|
||||||
|
<text>{{pageData.standardInfo.type}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="standard-info-item">
|
||||||
|
<text class="standard-info-item-title">发布机构:</text>
|
||||||
|
<text>{{pageData.standardInfo.publicBy}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="standard-info-item">
|
||||||
|
<text class="standard-info-item-title">发布时间:</text>
|
||||||
|
<text>{{pageData.standardInfo.publicDate}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="standard-info-item">
|
||||||
|
<text class="standard-info-item-title">终止时间:</text>
|
||||||
|
<text>{{pageData.standardInfo.abolitionDate}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="standard-info-item">
|
||||||
|
<text class="standard-info-item-title">说明:</text>
|
||||||
|
<text>{{pageData.standardInfo.comment}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</t-popup>
|
||||||
|
|
||||||
|
<t-dialog visible="{{standardDialogVisible}}" title="修改标准编号" content="请输入正确的标准编号。" confirm-btn="确定" cancel-btn="取消" bind:confirm="confirmStandardDialog" bind:cancel="closeStandardDialog">
|
||||||
|
<t-input borderless class="dialog-input" clearable slot="content" placeholder="输入标准编号" placeholder-class="placeholder" value="{{changeStandard}}" bindchange="onChangeStandardInput" />
|
||||||
|
</t-dialog>
|
||||||
@ -86,7 +86,7 @@
|
|||||||
.body-row {
|
.body-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,12 +95,17 @@
|
|||||||
line-height: 1.5rem;
|
line-height: 1.5rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: rgb(20, 20, 20);
|
color: rgb(20, 20, 20);
|
||||||
|
min-width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.body-title {
|
.body-title {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comment {
|
||||||
|
color: rgb(150, 150, 150);
|
||||||
|
}
|
||||||
|
|
||||||
.body-value {
|
.body-value {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 1.5rem;
|
line-height: 1.5rem;
|
||||||
@ -110,7 +115,7 @@
|
|||||||
.body-company {
|
.body-company {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
margin-top: 10px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.body-company-icon {
|
.body-company-icon {
|
||||||
@ -199,4 +204,38 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-tag {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-info {
|
||||||
|
background: #fff;
|
||||||
|
color: #333;
|
||||||
|
/* display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center; */
|
||||||
|
width: 100%;
|
||||||
|
height: 500px;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-info-title {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
line-height: 1.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-info-item {
|
||||||
|
margin: 20px;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standard-info-item-title {
|
||||||
|
font-weight: 600;
|
||||||
|
min-width: 80px;
|
||||||
}
|
}
|
||||||
@ -74,4 +74,12 @@ export function sessionList(params) {
|
|||||||
params: params,
|
params: params,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sessionChangeStandard(params) {
|
||||||
|
return request({
|
||||||
|
path: '/session/standard/update',
|
||||||
|
params: params,
|
||||||
|
method: 'GET'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user