diff --git a/app.json b/app.json index 0920223..d241a88 100644 --- a/app.json +++ b/app.json @@ -31,7 +31,10 @@ "pages/usercenter/name-edit/index", "pages/home/session/session", "pages/home/additive/additive", - "pages/home/chemical/chemical" + "pages/home/chemical/chemical", + "pages/additive/list/additive-list", + "pages/standard/list/index", + "pages/user/index" ], "tabBar": { "custom": true, @@ -45,15 +48,15 @@ "text": "首页" }, { - "pagePath": "pages/goods/category/index", + "pagePath": "pages/additive/list/additive-list", "text": "分类" }, { - "pagePath": "pages/cart/index", - "text": "购物车" + "pagePath": "pages/standard/list/index", + "text": "标准" }, { - "pagePath": "pages/usercenter/index", + "pagePath": "pages/user/index", "text": "我的" } ] diff --git a/custom-tab-bar/data.js b/custom-tab-bar/data.js index ba35a99..32ea82f 100644 --- a/custom-tab-bar/data.js +++ b/custom-tab-bar/data.js @@ -5,17 +5,17 @@ export default [{ }, { icon: 'sort', - text: '分类', - url: 'pages/goods/category/index', + text: '添加剂', + url: 'pages/additive/list/additive-list', }, { - icon: 'cart', - text: '购物车', - url: 'pages/cart/index', + icon: 'wallet', + text: '标准', + url: 'pages/standard/list/index', }, { icon: 'person', text: '个人中心', - url: 'pages/usercenter/index', + url: 'pages/user/index', }, ]; \ No newline at end of file diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml index 384fd2f..5be390c 100644 --- a/custom-tab-bar/index.wxml +++ b/custom-tab-bar/index.wxml @@ -1,18 +1,8 @@ - - - - - {{ item.text }} - - - - + + + + + {{ item.text }} + + + \ No newline at end of file diff --git a/images/standard.jpg b/images/standard.jpg new file mode 100644 index 0000000..35f977c Binary files /dev/null and b/images/standard.jpg differ diff --git a/images/weixin.png b/images/weixin.png new file mode 100644 index 0000000..eaf3601 Binary files /dev/null and b/images/weixin.png differ diff --git a/pages/additive/list/additive-list.js b/pages/additive/list/additive-list.js new file mode 100644 index 0000000..07047c6 --- /dev/null +++ b/pages/additive/list/additive-list.js @@ -0,0 +1,111 @@ +// pages/additive/list/additive-list.js + +import { + sessionAdditiveList +} from '../../../services/api/additive'; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + searchValue: "", + addtiveList: [], + page: { + num: 1, + size: 20, + total: 0 + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getAddtiveList(); + }, + + getAddtiveList() { + console.log(this.data.searchValue); + const params = { + pageNumber: this.data.page.num, + pageSize: this.data.page.size + } + if (this.data.searchValue) { + params['search'] = this.data.searchValue + } + sessionAdditiveList(params).then(respose => { + this.setData({ + addtiveList: respose.content.contentList, + "page.total": respose.content.total + }) + }) + }, + + doSearch(e) { + console.log(e); + const value = e.detail.value; + this.setData({ + "page.num": 1, + "searchValue": value + }) + this.getAddtiveList(); + }, + + onGoAdditive(event) { + const additiveId = event.currentTarget.dataset.additive; + wx.navigateTo({ + url: `/pages/home/additive/additive?additiveId=${additiveId}`, + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.getTabBar().init(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/additive/list/additive-list.json b/pages/additive/list/additive-list.json new file mode 100644 index 0000000..c00b48a --- /dev/null +++ b/pages/additive/list/additive-list.json @@ -0,0 +1,12 @@ +{ + "navigationBarTitleText": "添加剂", + "onReachBottomDistance": 10, + "backgroundTextStyle": "light", + "usingComponents": { + "t-sticky": "tdesign-miniprogram/sticky/sticky", + "t-icon": "tdesign-miniprogram/icon/icon", + "t-cell": "tdesign-miniprogram/cell/cell", + "t-tag": "tdesign-miniprogram/tag/tag", + "t-search": "tdesign-miniprogram/search/search" + } +} \ No newline at end of file diff --git a/pages/additive/list/additive-list.wxml b/pages/additive/list/additive-list.wxml new file mode 100644 index 0000000..b635889 --- /dev/null +++ b/pages/additive/list/additive-list.wxml @@ -0,0 +1,17 @@ + + + + + + + + + + + {{item.name}} + {{item.enName}} + {{item.function}} + + + + \ No newline at end of file diff --git a/pages/additive/list/additive-list.wxss b/pages/additive/list/additive-list.wxss new file mode 100644 index 0000000..ab32d0a --- /dev/null +++ b/pages/additive/list/additive-list.wxss @@ -0,0 +1,21 @@ +/* pages/additive/list/additive-list.wxss */ + +.main { + padding: 10px; +} + +.list-view { + margin-bottom: 80px; +} + +.addtive-enname { + font-size: 0.875rem; + line-height: 1.25rem; + color: rgb(150, 150, 150); + margin-top: 5px; + margin-bottom: 5px; + white-space: nowrap; + overflow: hidden; + width: 250px; + text-overflow: clip; +} \ No newline at end of file diff --git a/pages/home/home.js b/pages/home/home.js index 9c3a8bb..f9d38d2 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -59,6 +59,7 @@ Page({ init() { this.loadHomePage(); + isLogin() }, loadHomePage() { @@ -170,9 +171,6 @@ Page({ // 上传图片 uploadPicture() { - if (!isLogin()) { - return - } wx.chooseMedia({ count: 1, mediaType: ['image'], diff --git a/pages/home/home.wxml b/pages/home/home.wxml index ed94acc..795c484 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -11,7 +11,7 @@ - + diff --git a/pages/home/session/session.js b/pages/home/session/session.js index 2cbfc58..f638e71 100644 --- a/pages/home/session/session.js +++ b/pages/home/session/session.js @@ -55,7 +55,7 @@ Page({ } }) sessionAdditiveQuery({ - id: this.sessionId + id: this.data.sessionId }).then(respose => { this.setData({ additives: respose.content.additives diff --git a/pages/standard/list/index.js b/pages/standard/list/index.js new file mode 100644 index 0000000..dfa0da7 --- /dev/null +++ b/pages/standard/list/index.js @@ -0,0 +1,109 @@ +// pages/standard/list/index.js + +import { + sessionStandardList +} from '../../../services/api/standard'; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + searchValue: "", + standardList: [], + page: { + num: 1, + size: 20, + total: 0 + } + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.getStandardList(); + }, + + doSearch(e) { + const value = e.detail.value; + this.setData({ + "page.num": 1, + "searchValue": value + }) + this.getStandardList(); + }, + + doSearchClear(e) { + this.setData({ + "searchValue": '', + "standardList": [] + }) + }, + + getStandardList() { + const params = { + pageNumber: this.data.page.num, + pageSize: this.data.page.size + } + if (this.data.searchValue) { + params['search'] = this.data.searchValue + sessionStandardList(params).then(respose => { + this.setData({ + standardList: respose.content.contentList, + "page.total": respose.content.total + }) + }) + } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.getTabBar().init(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/standard/list/index.json b/pages/standard/list/index.json new file mode 100644 index 0000000..c684cb9 --- /dev/null +++ b/pages/standard/list/index.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "t-search": "tdesign-miniprogram/search/search", + "t-tag": "tdesign-miniprogram/tag/tag", + "t-check-tag": "tdesign-miniprogram/tag/check-tag", + "t-image": "tdesign-miniprogram/image/image" + } +} \ No newline at end of file diff --git a/pages/standard/list/index.wxml b/pages/standard/list/index.wxml new file mode 100644 index 0000000..f53ed4f --- /dev/null +++ b/pages/standard/list/index.wxml @@ -0,0 +1,20 @@ + + + + + + + + + + + + {{item.name}} + {{item.code}} + + {{item.public}} + {{item.status == 3 ? '过期' : '有效'}} + + + + \ No newline at end of file diff --git a/pages/standard/list/index.wxss b/pages/standard/list/index.wxss new file mode 100644 index 0000000..9fc4fd6 --- /dev/null +++ b/pages/standard/list/index.wxss @@ -0,0 +1,64 @@ +/* pages/standard/list/index.wxss */ + +.main { + padding: 10px; +} + +.top-empty { + width: 100%; + height: 150px; +} + +.search-view { + display: flex; + justify-content: center; +} + +.search { + width: 250px; +} + +.standard-image { + padding-top: 30px; + display: flex; + justify-content: center; +} + +.list-view { + margin: 10px; + margin-top: 20px; + margin-bottom: 80px; +} + +.standard-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: 2px; + border-color: rgba(230, 230, 230, 0.719); + margin: 10px; + padding: 10px; + border-radius: 0.5rem; +} + +.standard-name { + font-weight: 600; +} + +.standard-code { + margin-top: 5px; + margin-left: 10px; + margin-bottom: 5px; + color: rgb(150, 150, 150); +} + +.standard-bottom { + display: flex; + justify-content: space-between; + align-items: center; +} + +.standard-public { + font-size: 0.875rem; + line-height: 1.25rem; +} \ No newline at end of file diff --git a/pages/user/index.js b/pages/user/index.js new file mode 100644 index 0000000..c07fd4c --- /dev/null +++ b/pages/user/index.js @@ -0,0 +1,73 @@ +// pages/user/index.js + +import { + isLogin +} from '../../services/permission/login'; + +Page({ + + /** + * 页面的初始数据 + */ + data: { + loginStatus: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + loginStatus: isLogin() + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + this.getTabBar().init(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/user/index.json b/pages/user/index.json new file mode 100644 index 0000000..248787f --- /dev/null +++ b/pages/user/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "t-image": "/components/webp-image/index", + "t-avatar": "tdesign-miniprogram/avatar/avatar" + } +} \ No newline at end of file diff --git a/pages/user/index.wxml b/pages/user/index.wxml new file mode 100644 index 0000000..7c77dd3 --- /dev/null +++ b/pages/user/index.wxml @@ -0,0 +1,9 @@ + + + + + {{ loginStatus ? '微信用户' :'请登录'}} + + + + \ No newline at end of file diff --git a/pages/user/index.wxss b/pages/user/index.wxss new file mode 100644 index 0000000..8be2647 --- /dev/null +++ b/pages/user/index.wxss @@ -0,0 +1,40 @@ +/* pages/user/index.wxss */ +.user-center-card { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 480rpx; + background-image: url('https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png'); + background-size: cover; + background-repeat: no-repeat; + padding: 0 24rpx; +} + +.searich_btn { + margin-top: 192rpx; + margin-bottom: 48rpx; + height: 96rpx; + line-height: 48rpx; + display: flex; + justify-content: flex-start; + align-items: center; + color: #333; + position: relative; +} + +.user-center-card__header__avatar { + width: 96rpx; + height: 96rpx; + border-radius: 48rpx; + overflow: hidden; +} + +.user-center-card__header__name { + font-size: 36rpx; + line-height: 48rpx; + color: #333; + font-weight: bold; + margin-left: 24rpx; + margin-right: 16rpx; +} \ No newline at end of file diff --git a/pages/usercenter/index.wxml b/pages/usercenter/index.wxml index d71686d..0955e31 100644 --- a/pages/usercenter/index.wxml +++ b/pages/usercenter/index.wxml @@ -1,17 +1,9 @@ - + - - - - + + 当前版本 {{versionNo}} - - - - 服务时间: {{customerServiceInfo.serviceTimeDuration}} - - 电话客服 - - 取消 - + + + + 服务时间: {{customerServiceInfo.serviceTimeDuration}} + + 电话客服 + + 取消 + - - + \ No newline at end of file diff --git a/services/api/additive.js b/services/api/additive.js new file mode 100644 index 0000000..c63fe2b --- /dev/null +++ b/services/api/additive.js @@ -0,0 +1,11 @@ +import { + request +} from './request' + +export function sessionAdditiveList(params) { + return request({ + path: '/additive/list', + params: params, + method: 'GET' + }); +} \ No newline at end of file diff --git a/services/api/standard.js b/services/api/standard.js new file mode 100644 index 0000000..60db8bd --- /dev/null +++ b/services/api/standard.js @@ -0,0 +1,11 @@ +import { + request +} from './request' + +export function sessionStandardList(params) { + return request({ + path: '/standard/list', + params: params, + method: 'GET' + }); +} \ No newline at end of file