diff --git a/app.json b/app.json index e3401b8..0920223 100644 --- a/app.json +++ b/app.json @@ -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, diff --git a/images/additive.jpg b/images/additive.jpg new file mode 100644 index 0000000..d95a5a9 Binary files /dev/null and b/images/additive.jpg differ diff --git a/images/chemical.png b/images/chemical.png new file mode 100644 index 0000000..e333885 Binary files /dev/null and b/images/chemical.png differ diff --git a/images/no_additives.png b/images/no_additives.png new file mode 100644 index 0000000..1438000 Binary files /dev/null and b/images/no_additives.png differ diff --git a/images/no_data.jpg b/images/no_data.jpg new file mode 100644 index 0000000..a3a419a Binary files /dev/null and b/images/no_data.jpg differ diff --git a/images/use_bi.jpg b/images/use_bi.jpg new file mode 100644 index 0000000..b144ada Binary files /dev/null and b/images/use_bi.jpg differ diff --git a/images/use_bi.png b/images/use_bi.png deleted file mode 100644 index c593ed4..0000000 Binary files a/images/use_bi.png and /dev/null differ diff --git a/model/swiper.js b/model/swiper.js index ee114a8..5c7f0fc 100644 --- a/model/swiper.js +++ b/model/swiper.js @@ -1,5 +1,5 @@ const images = [{ - img: '/images/use_bi.png', + img: '/images/use_bi.jpg', text: '1', }, { diff --git a/pages/home/additive/additive.js b/pages/home/additive/additive.js new file mode 100644 index 0000000..f9bfee0 --- /dev/null +++ b/pages/home/additive/additive.js @@ -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}`, + }); + } +}) \ No newline at end of file diff --git a/pages/home/additive/additive.json b/pages/home/additive/additive.json new file mode 100644 index 0000000..da66c1a --- /dev/null +++ b/pages/home/additive/additive.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/home/additive/additive.wxml b/pages/home/additive/additive.wxml new file mode 100644 index 0000000..15dad12 --- /dev/null +++ b/pages/home/additive/additive.wxml @@ -0,0 +1,47 @@ + + + + + + + {{additiveData.name ? additiveData.name : 'XXX'}} + {{additiveData.enName ? additiveData.enName : 'xxx'}} + + + + cns: {{additiveData.cns ? additiveData.cns : '-'}} + ins: {{additiveData.ins ? additiveData.ins : '-'}} + + + {{item}} + + + + 描述 + {{additiveData.description}} + + + 包含物质 + + + {{item.name}} + {{item.cas}} + + + + + + + + 相关文档 + + + {{item.type}} + {{item.name}} + + + + + + + \ No newline at end of file diff --git a/pages/home/additive/additive.wxss b/pages/home/additive/additive.wxss new file mode 100644 index 0000000..f0abc85 --- /dev/null +++ b/pages/home/additive/additive.wxss @@ -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); +} \ No newline at end of file diff --git a/pages/home/chemical/chemical.js b/pages/home/chemical/chemical.js new file mode 100644 index 0000000..ef8efd4 --- /dev/null +++ b/pages/home/chemical/chemical.js @@ -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() { + + } +}) \ No newline at end of file diff --git a/pages/home/chemical/chemical.json b/pages/home/chemical/chemical.json new file mode 100644 index 0000000..78ed037 --- /dev/null +++ b/pages/home/chemical/chemical.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/home/chemical/chemical.wxml b/pages/home/chemical/chemical.wxml new file mode 100644 index 0000000..19b594b --- /dev/null +++ b/pages/home/chemical/chemical.wxml @@ -0,0 +1,78 @@ + + + + + + + {{chemicalData.name ? chemicalData.name : 'XXX'}} + {{chemicalData.enName ? chemicalData.enName : 'xxx'}} + + + + cas: {{chemicalData.cas ? chemicalData.cas : '-'}} + 分子式: {{chemicalData.formula ? chemicalData.formula : '-'}} + 其它名称: + {{chemicalData.otherName}} + + + {{item}} + + + + + + + + + {{item}} + + + + GHS(全球化学品统一分类和标签制度) + + + + 标识: {{chemicalData.GHS.signal}} + 防范说明: + {{item}} + + + + + + + + + + {{item.organism}} + {{item.route}} + {{item.dose}} + {{item.testtype}} + + 影响: {{item.effect}} + 数据源: {{item.reference}} + + + + + + + + + + + + {{item.diseasename}} + {{item.directevidence == 'therapeutic' ? '治疗' : '相关'}} + + 相关论文: + + {{dois.pmids}} + + + + + + + + \ No newline at end of file diff --git a/pages/home/chemical/chemical.wxss b/pages/home/chemical/chemical.wxss new file mode 100644 index 0000000..842fe25 --- /dev/null +++ b/pages/home/chemical/chemical.wxss @@ -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; +} \ No newline at end of file diff --git a/pages/home/components/no-data/no-data.js b/pages/home/components/no-data/no-data.js new file mode 100644 index 0000000..a6964ab --- /dev/null +++ b/pages/home/components/no-data/no-data.js @@ -0,0 +1,23 @@ +// pages/home/session/components/no-data.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) \ No newline at end of file diff --git a/pages/home/components/no-data/no-data.json b/pages/home/components/no-data/no-data.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/pages/home/components/no-data/no-data.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/home/components/no-data/no-data.wxml b/pages/home/components/no-data/no-data.wxml new file mode 100644 index 0000000..1341cfe --- /dev/null +++ b/pages/home/components/no-data/no-data.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/pages/home/components/no-data/no-data.wxss b/pages/home/components/no-data/no-data.wxss new file mode 100644 index 0000000..e57926c --- /dev/null +++ b/pages/home/components/no-data/no-data.wxss @@ -0,0 +1,7 @@ +/* pages/home/session/components/no-data.wxss */ + +.no-data { + display: flex; + justify-content: center; + margin-top: 40px; +} \ No newline at end of file diff --git a/pages/home/home.js b/pages/home/home.js index 43a74d7..9c3a8bb 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -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}`, + }); + } }); \ No newline at end of file diff --git a/pages/home/home.json b/pages/home/home.json index 25ef1e6..2eccc26 100644 --- a/pages/home/home.json +++ b/pages/home/home.json @@ -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" } } \ No newline at end of file diff --git a/pages/home/home.wxml b/pages/home/home.wxml index 153d692..ed94acc 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -2,12 +2,19 @@ - + + - \ No newline at end of file + + + + + 服务器正在拼命计算,请稍后... + + \ No newline at end of file diff --git a/pages/home/home.wxss b/pages/home/home.wxss index 340f26d..b27de5f 100644 --- a/pages/home/home.wxss +++ b/pages/home/home.wxss @@ -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; } \ No newline at end of file diff --git a/pages/home/session/session.js b/pages/home/session/session.js new file mode 100644 index 0000000..2cbfc58 --- /dev/null +++ b/pages/home/session/session.js @@ -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}`, + }); + } +}) \ No newline at end of file diff --git a/pages/home/session/session.json b/pages/home/session/session.json new file mode 100644 index 0000000..7b5da53 --- /dev/null +++ b/pages/home/session/session.json @@ -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" + } +} \ No newline at end of file diff --git a/pages/home/session/session.wxml b/pages/home/session/session.wxml new file mode 100644 index 0000000..c24f977 --- /dev/null +++ b/pages/home/session/session.wxml @@ -0,0 +1,137 @@ + + + + + + {{ pageData.typeName ? pageData.typeName : '无分类 | ' }} + {{ pageData.typeCode ? pageData.typeCode : 'xxx' }} + + + {{ tag }} + + + {{pageData.createTime}} + + + + + + + + + + + + + + + + 推荐指数: + + + {{pageData.rate.text}} + + + + + + 类别: + + {{pageData.typeCode}} {{pageData.typeName}} + 暂无分类 + + + + 食品标准号: + + {{pageData.standard}} + 暂无数据 + + + + 生产许可证: + + {{item}} + 暂无数据 + + + + + + 添加剂: + + {{pageData.additives.count}} + 无添加 + + + + + + {{item.name}}: + {{item.count}} + + + + + + + 生产企业 + + + + {{item}} + + + + + + {{item}} + + + + + + + + + + + + + + + {{item.name}} + + {{tag}} + + + {{item.standard}} + 所含元素: + + + {{chemical.name}} + {{chemical.cas}} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/home/session/session.wxss b/pages/home/session/session.wxss new file mode 100644 index 0000000..5df13fb --- /dev/null +++ b/pages/home/session/session.wxss @@ -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; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js deleted file mode 100644 index aadb4bd..0000000 --- a/pages/index/index.js +++ /dev/null @@ -1,66 +0,0 @@ -// pages/index/index.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml deleted file mode 100644 index a7772aa..0000000 --- a/pages/index/index.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/index/index.wxml diff --git a/services/api/request.js b/services/api/request.js index 311559f..46b945b 100644 --- a/services/api/request.js +++ b/services/api/request.js @@ -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) } }) }) diff --git a/services/api/session.js b/services/api/session.js index ad5a2e4..cad48ff 100644 --- a/services/api/session.js +++ b/services/api/session.js @@ -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' + }); } \ No newline at end of file diff --git a/services/permission/login.js b/services/permission/login.js index fda91a2..fc573ee 100644 --- a/services/permission/login.js +++ b/services/permission/login.js @@ -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 {