diff --git a/app.json b/app.json index a045be7..f768ff7 100644 --- a/app.json +++ b/app.json @@ -13,6 +13,10 @@ "pages/home/idcard/index", "pages/home/info/index", "pages/home/pinfo/index", + "pages/home/tab1/index", + "pages/home/tab2/index", + "pages/home/tab3/index", + "pages/home/tab4/index", "pages/shop/create/index", "pages/shop/detail/index", "pages/shop/order/index", diff --git a/assets/image/dbcicon.png b/assets/image/dbcicon.png new file mode 100644 index 0000000..f9df5e3 Binary files /dev/null and b/assets/image/dbcicon.png differ diff --git a/assets/image/fzcicon.png b/assets/image/fzcicon.png new file mode 100644 index 0000000..f9caf9b Binary files /dev/null and b/assets/image/fzcicon.png differ diff --git a/assets/image/qticon.png b/assets/image/qticon.png new file mode 100644 index 0000000..7c1c7dc Binary files /dev/null and b/assets/image/qticon.png differ diff --git a/assets/image/tabBj.png b/assets/image/tabBj.png new file mode 100644 index 0000000..1ab6798 Binary files /dev/null and b/assets/image/tabBj.png differ diff --git a/assets/image/zzcicon.png b/assets/image/zzcicon.png new file mode 100644 index 0000000..eea8521 Binary files /dev/null and b/assets/image/zzcicon.png differ diff --git a/pages/agent/factory/index.js b/pages/agent/factory/index.js index 0f7cb5e..8794d19 100644 --- a/pages/agent/factory/index.js +++ b/pages/agent/factory/index.js @@ -1,6 +1,10 @@ // pages/mall/factory/index.js -import { getFactoryPriceDetail } from "../../api/ztb" -import { getPreferList } from "../../api/moment" +import { + getFactoryPriceDetail +} from "../../api/ztb" +import { + getPreferList +} from "../../api/moment" const event = require('../../../utils/event') const util = require('../../../utils/util') const app = getApp() @@ -18,7 +22,7 @@ Page({ scrollTop: 0, toView: null, id: null, - tabList: [ '报价信息', '讨论', '收货标准', '注意事项' ], + tabList: ['报价信息', '讨论', '收货标准', '注意事项'], tabIndex: 0, factoryDetail: null, cateIndex: 0, @@ -29,31 +33,38 @@ Page({ finished: false, form: { pageNum: 1 - } + }, + + attentionStatus: 1 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.setData({ + this.setData({ safeBottom: app.globalData.safeBottom, - fragmentHeight: app.globalData.fragmentHeight - 90, - height: app.globalData.fragmentHeight, + fragmentHeight: app.globalData.fragmentHeight - 90, + height: app.globalData.fragmentHeight, kg: app.globalData.kg, stickyTop: app.globalData.CustomBar, daytimes: util.formatDate(new Date(), 'Y-M-D') // tabIndex: options.tabIndex ? parseInt(options.tabIndex) : 0 }) event.on('EventMessage', this, this.onEvent) - if(options.id){ + if (options.id) { this.data.id = options.id this.data.form.millPaperId = options.id - wx.showLoading({ title: '加载中', mask: true }) + wx.showLoading({ + title: '加载中', + mask: true + }) getFactoryPriceDetail(options.id).then(result => { - if(result.data.paperCategoryList && result.data.paperCategoryList.length){ + if (result.data.paperCategoryList && result.data.paperCategoryList.length) { this.data.cateId = result.data.paperCategoryList[this.data.cateIndex].categoryId } - this.setData({ factoryDetail: result.data }) + this.setData({ + factoryDetail: result.data + }) wx.hideLoading() }).catch(err => { wx.hideLoading() @@ -66,65 +77,90 @@ Page({ this.onRefreshList() } }, - onFixedChange: function({detail}){ + onFixedChange: function ({ + detail + }) { this.data.fixed = detail.fixed }, - onScroll: function({detail}) { - this.setData({ scrollTop: detail.scrollTop }) + onScroll: function ({ + detail + }) { + this.setData({ + scrollTop: detail.scrollTop + }) }, - stopTouchMove: function(e){ + stopTouchMove: function (e) { return false }, - onTabChange: function({detail}){ - if(this.data.tabIndex == Number(detail.index)){ + onTabChange: function ({ + detail + }) { + if (this.data.tabIndex == Number(detail.index)) { return } - if(this.data.fixed){ - this.setData({ tabIndex: parseInt(detail.index), toView: 'sticky' }) + if (this.data.fixed) { + this.setData({ + tabIndex: parseInt(detail.index), + toView: 'sticky' + }) } else { - this.setData({ tabIndex: parseInt(detail.index) }) + this.setData({ + tabIndex: parseInt(detail.index) + }) } - if(this.data.tabIndex == 1 && !this.data.momentList.length){ + if (this.data.tabIndex == 1 && !this.data.momentList.length) { this.fetchMomentList() } }, - checkTag: function(e){ - if(!e.currentTarget.dataset){ + checkTag: function (e) { + if (!e.currentTarget.dataset) { return } - if(!e.currentTarget.dataset.index && e.currentTarget.dataset.index != 0){ + if (!e.currentTarget.dataset.index && e.currentTarget.dataset.index != 0) { return } - if(this.data.cateIndex == e.currentTarget.dataset.index){ + if (this.data.cateIndex == e.currentTarget.dataset.index) { return } - this.setData({cateIndex : e.currentTarget.dataset.index}) + this.setData({ + cateIndex: e.currentTarget.dataset.index + }) }, - saleGood: function(e){ - if(!app.globalData.userInfo){ - wx.navigateTo({ url: '/pages/login/index' }) + saleGood: function (e) { + if (!app.globalData.userInfo) { + wx.navigateTo({ + url: '/pages/login/index' + }) return } var item = this.data.factoryDetail.paperCategoryList[this.data.cateIndex] - if(util.isEmpty(item.unitPrice)){ + if (util.isEmpty(item.unitPrice)) { util.showToast('该纸品暂无报价,无法卖货') return } - wx.navigateTo({ url: '/pages/agent/edit/index?id=' + this.data.factoryDetail.paperMillId + '&categoryId=' + item.categoryId }) + wx.navigateTo({ + url: '/pages/agent/edit/index?id=' + this.data.factoryDetail.paperMillId + '&categoryId=' + item.categoryId + }) }, - postMoment: function(){ + postMoment: function () { util.navigateTo('/pages/article/publish/index?factoryId=' + this.data.factoryDetail.paperMillId + '&name=' + this.data.factoryDetail.name) }, //*************************************************momentList************************************************// onRefreshList: function () { - this.setData({ momentList: [], ['form.pageNum']: 1, finished: false }) + this.setData({ + momentList: [], + ['form.pageNum']: 1, + finished: false + }) this.fetchMomentList() }, - fetchMomentList: function(){ + fetchMomentList: function () { if (this.data.requesting || this.data.finished) { return } - this.setData({ requesting: true }) + this.setData({ + requesting: true + }) getPreferList(this.data.form).then(result => { if (result.data.records.length) { var respList = result.data.records @@ -138,10 +174,15 @@ Page({ finished }) } else { - this.setData({ finished: true, requesting: false }) + this.setData({ + finished: true, + requesting: false + }) } }).catch(err => { - this.setData({ requesting: false }) + this.setData({ + requesting: false + }) }) }, onShareAppMessage: function () { @@ -150,10 +191,26 @@ Page({ path: 'pages/index/index?url=/pages/agent/factory/index&key=id&value=' + this.data.factoryDetail.paperMillId } }, - toService: function(){ - wx.navigateTo({ url: '/pages/home/service/index'}) + toService: function () { + wx.navigateTo({ + url: '/pages/home/service/index' + }) }, - onUnload: function(){ + onUnload: function () { event.remove('EventMessage', this) + }, + onAttentionChange: function (e) { + if (e.currentTarget.dataset.cid == 1) { + this.setData({ + attentionStatus: 2, + }) + + } + if (e.currentTarget.dataset.cid == 2) { + this.setData({ + attentionStatus: 1, + }) + } + util.showToast(this.data.attentionStatus+'') } }) \ No newline at end of file diff --git a/pages/agent/factory/index.wxml b/pages/agent/factory/index.wxml index a0dea8f..4838212 100644 --- a/pages/agent/factory/index.wxml +++ b/pages/agent/factory/index.wxml @@ -8,7 +8,9 @@ - {{factoryDetail.name}} + {{factoryDetail.name}} + {{attentionStatus == 1 ? '关注' : '取消关注'}} + {{factoryDetail.locProvinceName + factoryDetail.locCityName + factoryDetail.locDistrictName}} | diff --git a/pages/agent/index/index.js b/pages/agent/index/index.js index 158ab81..bcd02a7 100644 --- a/pages/agent/index/index.js +++ b/pages/agent/index/index.js @@ -1,5 +1,8 @@ // pages/agent/index/index.js -import { getFactoryPrice, getFactoryCity } from "../../api/ztb" +import { + getFactoryPrice, + getFactoryCity +} from "../../api/ztb" const app = getApp() Page({ @@ -23,28 +26,65 @@ Page({ cityId: '', enableSalesAgent: 1, pageNum: 1 - } + }, + + form2: { + pageNum: 1 + }, + bidType: 1, + }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.setData({ height: app.globalData.fragmentHeight - 90, kg: app.globalData.kg, CustomBar: app.globalData.CustomBar }) + this.setData({ + height: app.globalData.fragmentHeight - 90, + kg: app.globalData.kg, + CustomBar: app.globalData.CustomBar + }) this.fetchRegionList() this.fetchPapersList() }, - fetchRegionList: function(){ + fetchRegionList: function () { getFactoryCity().then(result => { //成功回调 - this.data.cateList = [{cityId: '', cityName: '全部'}].concat(result.data) + this.data.cateList = [{ + cityId: '', + cityName: '全部' + }].concat(result.data) for (let index = 0; index < this.data.cateList.length; index++) { this.data.tabList.push(this.data.cateList[index].cityName) } - this.setData({ tabList: this.data.tabList, scrolled: this.data.cateList.length >= 5 }) + this.setData({ + tabList: this.data.tabList, + scrolled: this.data.cateList.length >= 5 + }) + }) + }, + //获取纸厂列表 + fetchRegionList2: function () { + + }, + onTabChangeTop: function (e) { + if (this.data.bidType == Number(e.currentTarget.dataset.index)) { + return + } + var tabIndex = Number(e.currentTarget.dataset.index) + this.data.firstCategoryId = '' + this.setData({ + pageIndex: 0, + ['bidType']: tabIndex }) + console.log(this.bidType) + if (this.data.bidType == 1) { + this.onRefreshList() + } }, - onTabChange: function ({detail}) { - if(this.data.tabIndex == Number(detail.index)){ + onTabChange: function ({ + detail + }) { + if (this.data.tabIndex == Number(detail.index)) { return } this.data.tabIndex = Number(detail.index) @@ -62,6 +102,13 @@ Page({ }) this.fetchPapersList() }, + // 下拉刷新关注... + onRefreshList2: function () { + this.setData({ + ['form2.pageNum']: 1, + }) + this.fetchPapersList() + }, // 获取特价列表 fetchPapersList: function () { if (this.data.requesting || this.data.finished) { @@ -70,7 +117,9 @@ Page({ if (this.data.loading) { this.data.requesting = true } else { - this.setData({ requesting: true }) + this.setData({ + requesting: true + }) } getFactoryPrice(this.data.form).then(result => { if (result.data.records.length) { @@ -78,7 +127,7 @@ Page({ let nowList = `orderList[${this.data.orderList.length}]` var num = result.data.current var finished = result.data.current >= result.data.pages - if(this.data.form.pageNum == 1){ + if (this.data.form.pageNum == 1) { this.setData({ [nowList]: respList, total: result.data.total, @@ -113,6 +162,6 @@ Page({ loading: false }) }) - } + } }) \ No newline at end of file diff --git a/pages/agent/index/index.wxml b/pages/agent/index/index.wxml index 924aef2..be1a8d4 100644 --- a/pages/agent/index/index.wxml +++ b/pages/agent/index/index.wxml @@ -4,12 +4,20 @@ 纸厂代卖 - - + + + + 全部 + + + 关注 + + + - + - + @@ -77,3 +85,21 @@ + + + + + + {{loading? '正在加载' : '暂无数据'}} + + + + + + + {{finished?'到底啦~':'加载中...'}} + + + + + \ No newline at end of file diff --git a/pages/home/info/index.js b/pages/home/info/index.js index 7a06da3..a8a4510 100644 --- a/pages/home/info/index.js +++ b/pages/home/info/index.js @@ -1,5 +1,10 @@ -import { zconfig, getBaseInfo } from '../../api/ztb' -import { updateUserInfo } from '../../api/user' +import { + zconfig, + getBaseInfo +} from '../../api/ztb' +import { + updateUserInfo +} from '../../api/user' const util = require('../../../utils/util') const app = getApp() @@ -11,25 +16,71 @@ Page({ backStatus: true, nickName: '', //用户昵称 avatarUrl: '', //用户头像 - banckCardList: [ - { id: 1, name: '个体回收户' }, - { id: 2, name: '打包站' }, - { id: 3, name: '废品站' }, - { id: 4, name: '印刷' }, - { id: 6, name: '包装厂' }, - { id: 7, name: '纸箱纸板厂' }, - { id: 8, name: '后加工' }, - { id: 5, name: '其他' } + banckCardList: [{ + id: 1, + name: '个体回收户' + }, + { + id: 2, + name: '打包站' + }, + { + id: 3, + name: '废品站' + }, + { + id: 4, + name: '印刷' + }, + { + id: 6, + name: '包装厂' + }, + { + id: 7, + name: '纸箱纸板厂' + }, + { + id: 8, + name: '后加工' + }, + { + id: 5, + name: '其他' + } ], - cardList: [ - { value: '1', text: '个体回收户' }, - { value: '2', text: '打包站' }, - { value: '3', text: '废品站' }, - { value: '4', text: '印刷' }, - { value: '6', text: '包装厂' }, - { value: '7', text: '纸箱纸板厂' }, - { value: '8', text: '后加工' }, - { value: '5', text: '其他' } + cardList: [{ + value: '1', + text: '个体回收户' + }, + { + value: '2', + text: '打包站' + }, + { + value: '3', + text: '废品站' + }, + { + value: '4', + text: '印刷' + }, + { + value: '6', + text: '包装厂' + }, + { + value: '7', + text: '纸箱纸板厂' + }, + { + value: '8', + text: '后加工' + }, + { + value: '5', + text: '其他' + } ], userInfo: null, userType: 1, @@ -49,14 +100,21 @@ Page({ linkPhone: res.data.mobile, companyAddress: res.data.fullAddress, userType: res.data.userType, - realName:res.data.realName || res.data.userName + realName: res.data.realName || res.data.userName }) }) }, uploadFile: function (path) { var that = this - wx.showLoading({ title: '上传中', mask: true }) - var header = { ...zconfig.header, 'X-APP-ID': app.xAppId, appversion: app.version } + wx.showLoading({ + title: '上传中', + mask: true + }) + var header = { + ...zconfig.header, + 'X-APP-ID': app.xAppId, + appversion: app.version + } this.task = wx.uploadFile({ url: zconfig.baseUrl + '/recycle-user-center/file-uploading/upload/image', filePath: path, @@ -68,7 +126,9 @@ Page({ resp = JSON.parse(result.data) } if (resp && resp.code === 0) { - that.updateMemberInfo({avatar: resp.data}) + that.updateMemberInfo({ + avatar: resp.data + }) } else { wx.hideLoading() util.showToast('头像上传失败,请重新上传') @@ -80,46 +140,60 @@ Page({ } }) }, - showDialog: function(){ + showDialog: function (e) { this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') var that = this - this.wuxDialog.prompt({ - resetOnClose: true, - title: '修改昵称', - placeholder: that.data.userInfo.nickname || '请输入昵称', - maxlength: 18, - onConfirm(e, response) { - if(util.isEmpty(response)){ - util.showToast('请输入昵称') - return - } - that.updateMemberInfo({nickname: response}) - }, - }) + if (e.currentTarget.dataset.cid === 'nickname') { + this.wuxDialog.prompt({ + resetOnClose: true, + title: '修改昵称', + placeholder: that.data.userInfo.nickname || '请输入昵称', + maxlength: 18, + onConfirm(e, response) { + if (util.isEmpty(response)) { + util.showToast('请输入昵称') + return + } + that.updateMemberInfo({ + nickname: response + }) + }, + }) + + } }, - updateMemberInfo: function(form){ - if(form.nickname){ - wx.showLoading({ title: '处理中', mask: true }) + updateMemberInfo: function (form) { + if (form.nickname) { + wx.showLoading({ + title: '处理中', + mask: true + }) } updateUserInfo(form).then(result => { wx.hideLoading() - if(form.nickname){ - this.setData({['userInfo.nickname']: form.nickname}) - } else if(form.avatar){ - this.setData({avatarUrl: form.avatar}) + if (form.nickname) { + this.setData({ + ['userInfo.nickname']: form.nickname + }) + } else if (form.avatar) { + this.setData({ + avatarUrl: form.avatar + }) } }).catch(err => { wx.hideLoading() util.showToast(err) }) }, - toAuth: function(){ - if(this.data.userInfo && !this.data.userInfo.isAuth){ - wx.navigateTo({ url: '/pages/home/idcard/index' }) + toAuth: function () { + if (this.data.userInfo && !this.data.userInfo.isAuth) { + wx.navigateTo({ + url: '/pages/home/idcard/index' + }) } }, //通过事件执行更换头像方法比如点击头像执行该方法 - chooseImage: function() { + chooseImage: function () { var that = this wx.chooseImage({ count: 1, // 默认9 @@ -137,12 +211,16 @@ Page({ }, //裁剪图片回调 onCropback: function (event) { - this.setData({ visible: false }) + this.setData({ + visible: false + }) this.uploadFile(event.detail[0]) }, //关闭回调 closeCallback: function () { - this.setData({ visible: false }) - } + this.setData({ + visible: false + }) + }, }) \ No newline at end of file diff --git a/pages/home/info/index.wxml b/pages/home/info/index.wxml index c4bb482..2837ed0 100644 --- a/pages/home/info/index.wxml +++ b/pages/home/info/index.wxml @@ -51,10 +51,34 @@ 公司地址 {{companyAddress}} - + 昵称 {{userInfo.nickname || '点击修改昵称'}} + + 从业身份 + {{userInfo.card || '点击修改从业身份'}} + + + 所在城市 + {{userInfo.city || '点击修改所在城市'}} + + + 从业经验 + {{userInfo.age || '点击修改从业经验'}} + + + 希望采购品类 + {{userInfo.type || '点击修改希望采购品类'}} + + + 希望出货品类 + {{userInfo.type2 || '点击修改希望出货品类'}} + + + 月出货量 + {{userInfo.numberMoon || '点击修改月出货量'}} + + + 身份 + + + + + + + + + + HI,\n欢迎使用纸通宝\n开启一站式废纸交易 + + + + + + + 你的从业身份是? + + + + + + + + 打包站 + + + + + + + + + 废品站 + + + + + + + + + 造纸厂 + + + + + + + + 其他 + + + + + + + \ No newline at end of file diff --git a/pages/home/tab1/index.wxss b/pages/home/tab1/index.wxss new file mode 100644 index 0000000..f7b3f16 --- /dev/null +++ b/pages/home/tab1/index.wxss @@ -0,0 +1,94 @@ +/* pages/home/tab1/index.wxss */ +.bj { + background-color: white; + min-height: 900rpx; +} + +.vip-btn { + /* height: 90rpx; */ + width: 180rpx; + background: #F5F5F5; + float: right; + color: rgba(0, 0, 0, 0.45); + font-size: 28rpx; +} + +.top { + height: 258rpx; + width: 100%; +} + +.topText { + width: 440rpx; + height: 258rpx; + float: left; + padding-left: 48rpx; + padding-top: 60rpx; + font-size: 44rpx; + color: #000000; + font-family: PingFangSC-Medium; +} + +.mid { + height: 150rpx; + padding-top: 100rpx; + padding-left: 48rpx; + font-family: PingFangSC-Medium; + font-size: 36rpx; + color: #000000; + letter-spacing: 2px; +} + +.bottom { + height: 410rpx; + padding: 48rpx; +} + +.btson1 { + height: 147rpx; + width: 315rpx; + float: left; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 33px 22px 33px; +} + +.btson2 { + height: 147rpx; + width: 315rpx; + float: right; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 33px 22px 33px; +} + +.btson3 { + height: 147rpx; + width: 315rpx; + float: left; + margin-top: 20rpx; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 33px 22px 33px; +} + +.btson4 { + height: 147rpx; + width: 315rpx; + float: right; + margin-top: 20rpx; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 33px 22px 33px; +} +.otherInpt{ + padding-left: 48rpx; +} \ No newline at end of file diff --git a/pages/home/tab2/index.js b/pages/home/tab2/index.js new file mode 100644 index 0000000..d91cda1 --- /dev/null +++ b/pages/home/tab2/index.js @@ -0,0 +1,129 @@ +// pages/home/tab2/index.js +const storage = require('../../../utils/storage') +import regions from '../../../utils/region' +Page({ + + /** + * 页面的初始数据 + */ + data: { + options: regions, + region: [440000, '', ''], + form: { + bidType: 1, + imgList: [], + secondCategoryId: null, + stock: null, + dopantRate: null, + waterRate: null + }, + cateName: '', + dopantName: '', + waterName: '', + intervalName: '', + sumAmount: 0, + keyboard: 0, + toView: '', + focus: false, + picking: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader') + this.pickerView = this.pickerView || this.selectComponent('#picker-view') + + }, + toNextTab: function () { + wx.redirectTo({ + url: '/pages/home/tab3/index' + }) + }, + toMyInfo: function () { + storage.put('userIsLoginFirst', '1') + wx.redirectTo({ + url: '/pages/index/index' + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + backspace: function () { + console.log('点击返回被触发2') + wx.redirectTo({ + url: '/pages/home/tab1/index' + }) + + }, + showRegion: function () { + if (this.data.disabled) { + return + } + this.cascaderView.showPicker(this.data.region) + this.setData({ + picking: true + }) + }, + onRegionChange: function (e) { + if (e.detail && e.detail.options) { + this.setData({ + ['form.areaStr']: e.detail.options.map((n) => n.label).join(' '), + region: e.detail.value + }) + this.data.form['locProvinceId'] = e.detail.value[0] + this.data.form['locProvinceName'] = e.detail.options[0].label + this.data.form['locCityId'] = e.detail.value[1] + this.data.form['locCityName'] = e.detail.options[1].label + this.data.form['locDistrictId'] = e.detail.value[2] + this.data.form['locDistrictName'] = e.detail.options[2].label + } + this.setData({ picking: false }) + }, +}) \ No newline at end of file diff --git a/pages/home/tab2/index.json b/pages/home/tab2/index.json new file mode 100644 index 0000000..511cd66 --- /dev/null +++ b/pages/home/tab2/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "wux-cascader": "/components/cascader/index" + } +} \ No newline at end of file diff --git a/pages/home/tab2/index.wxml b/pages/home/tab2/index.wxml new file mode 100644 index 0000000..2adab4b --- /dev/null +++ b/pages/home/tab2/index.wxml @@ -0,0 +1,31 @@ + + + 城市 + + + + + + + + + + HI,\n欢迎使用纸通宝\n开启一站式废纸交易 + + + + + + + 你所在的城市是? + + + + + {{form.areaStr||'请选择所在地区'}} + + + + + \ No newline at end of file diff --git a/pages/home/tab2/index.wxss b/pages/home/tab2/index.wxss new file mode 100644 index 0000000..005a1fc --- /dev/null +++ b/pages/home/tab2/index.wxss @@ -0,0 +1,91 @@ +/* pages/home/tab1/index.wxss */ +.bj { + background-color: white; + min-height: 900rpx; +} + +.vip-btn { + /* height: 90rpx; */ + width: 180rpx; + background: #F5F5F5; + float: right; + color: rgba(0, 0, 0, 0.45); + font-size: 28rpx; +} + +.top { + height: 258rpx; + width: 100%; +} + +.topText { + width: 440rpx; + height: 258rpx; + float: left; + padding-left: 48rpx; + padding-top: 60rpx; + font-size: 44rpx; + color: #000000; + font-family: PingFangSC-Medium; +} + +.mid { + height: 150rpx; + padding-top: 100rpx; + padding-left: 48rpx; + font-family: PingFangSC-Medium; + font-size: 36rpx; + color: #000000; + letter-spacing: 2px; +} + +.bottom { + height: 410rpx; + padding: 48rpx; +} + +.btson1 { + height: 147rpx; + width: 315rpx; + float: left; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 33px 22px 33px; +} + +.btson2 { + height: 147rpx; + width: 315rpx; + float: right; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 33px 22px 33px; +} + +.btson3 { + height: 147rpx; + width: 315rpx; + float: left; + margin-top: 20rpx; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 33px 22px 33px; +} + +.btson4 { + height: 147rpx; + width: 315rpx; + float: right; + margin-top: 20rpx; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 33px 22px 33px; +} \ No newline at end of file diff --git a/pages/home/tab3/index.js b/pages/home/tab3/index.js new file mode 100644 index 0000000..c1c67d3 --- /dev/null +++ b/pages/home/tab3/index.js @@ -0,0 +1,95 @@ +// pages/home/tab3/index.js +const storage = require('../../../utils/storage') +Page({ + + /** + * 页面的初始数据 + */ + data: { + bidType: 1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + toNextTab: function () { + wx.redirectTo({ + url: '/pages/home/tab4/index' + }) + }, + toMyInfo: function () { + storage.put('userIsLoginFirst', '1') + wx.redirectTo({ + url: '/pages/index/index' + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + backspace: function () { + console.log('点击返回被触发3') + wx.redirectTo({ + url: '/pages/home/tab2/index' + }) + + }, + onTabChangeTop: function (e) { + if (this.data.bidType == Number(e.currentTarget.dataset.index)) { + return + } + var tabIndex = Number(e.currentTarget.dataset.index) + this.data.firstCategoryId = '' + this.setData({ + ['bidType']: tabIndex + }) + }, +}) \ No newline at end of file diff --git a/pages/home/tab3/index.json b/pages/home/tab3/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/home/tab3/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/home/tab3/index.wxml b/pages/home/tab3/index.wxml new file mode 100644 index 0000000..8942fd6 --- /dev/null +++ b/pages/home/tab3/index.wxml @@ -0,0 +1,43 @@ + + + 经验 + + + + + + + + + + HI,\n欢迎使用纸通宝\n开启一站式废纸交易 + + + + + + + 你的从业经验是? + + + + + 1年以下 + + + + + + 1~5年 + + + + + + 5年以上 + + + + + + \ No newline at end of file diff --git a/pages/home/tab3/index.wxss b/pages/home/tab3/index.wxss new file mode 100644 index 0000000..8c1a202 --- /dev/null +++ b/pages/home/tab3/index.wxss @@ -0,0 +1,79 @@ +/* pages/home/tab1/index.wxss */ +.bj { + background-color: white; + min-height: 900rpx; +} + +.vip-btn { + /* height: 90rpx; */ + width: 180rpx; + background: #F5F5F5; + float: right; + color: rgba(0, 0, 0, 0.45); + font-size: 28rpx; +} + +.top { + height: 258rpx; + width: 100%; +} + +.topText { + width: 440rpx; + height: 258rpx; + float: left; + padding-left: 48rpx; + padding-top: 60rpx; + font-size: 44rpx; + color: #000000; + font-family: PingFangSC-Medium; +} + +.mid { + height: 150rpx; + padding-top: 100rpx; + padding-left: 48rpx; + font-family: PingFangSC-Medium; + font-size: 36rpx; + color: #000000; + letter-spacing: 2px; +} + +.bottom { + height: 410rpx; + padding: 48rpx; +} + +.btson1 { + height: 147rpx; + width: 315rpx; + float: left; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 35px 22px 35px; +} + +.btson2 { + height: 147rpx; + width: 315rpx; + float: right; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 35px 22px 35px; +} + +.btson3 { + height: 147rpx; + width: 315rpx; + float: left; + margin-top: 20rpx; + overflow: hidden; + border: 3rpx solid #D8D8D8; + border-radius: 10rpx; + border-radius: 10rpx; + padding: 22px 35px 22px 35px; +} diff --git a/pages/home/tab4/index.js b/pages/home/tab4/index.js new file mode 100644 index 0000000..576b0b8 --- /dev/null +++ b/pages/home/tab4/index.js @@ -0,0 +1,76 @@ +// pages/home/tab4/index.js +const storage = require('../../../utils/storage') +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + toMyInfo:function(){ + storage.put('userIsLoginFirst', '1') + wx.redirectTo({ url: '/pages/index/index' }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + backspace:function(){ + // console.log('点击返回被触发4') + wx.redirectTo({ url: '/pages/home/tab3/index' }) + + }, +}) \ No newline at end of file diff --git a/pages/home/tab4/index.json b/pages/home/tab4/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/home/tab4/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/home/tab4/index.wxml b/pages/home/tab4/index.wxml new file mode 100644 index 0000000..ea67531 --- /dev/null +++ b/pages/home/tab4/index.wxml @@ -0,0 +1,25 @@ + + + 采购品类 + + + + + + + + + + HI,\n欢迎使用纸通宝\n开启一站式废纸交易 + + + + + + + 你希望采购的品类是? + + + + + \ No newline at end of file diff --git a/pages/home/tab4/index.wxss b/pages/home/tab4/index.wxss new file mode 100644 index 0000000..7fd2026 --- /dev/null +++ b/pages/home/tab4/index.wxss @@ -0,0 +1,46 @@ +/* pages/home/tab1/index.wxss */ +.bj { + background-color: white; + min-height: 900rpx; +} + +.vip-btn { + /* height: 90rpx; */ + width: 180rpx; + background: #F5F5F5; + float: right; + color: rgba(0, 0, 0, 0.45); + font-size: 28rpx; +} + +.top { + height: 258rpx; + width: 100%; +} + +.topText { + width: 440rpx; + height: 258rpx; + float: left; + padding-left: 48rpx; + padding-top: 60rpx; + font-size: 44rpx; + color: #000000; + font-family: PingFangSC-Medium; +} + +.mid { + height: 150rpx; + padding-top: 100rpx; + padding-left: 48rpx; + font-family: PingFangSC-Medium; + font-size: 36rpx; + color: #000000; + letter-spacing: 2px; +} + +.bottom { + height: 410rpx; + padding: 48rpx; +} + diff --git a/pages/index/index.js b/pages/index/index.js index 29ccf15..4365d40 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -168,9 +168,14 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + var userIsLoginFirst = storage.get('userIsLoginFirst') if(this.data.inited){ this.onResume() } + wx.navigateTo({ url: '/pages/home/tab1/index' }) + // if(userIsLoginFirst=='1'){ + // wx.navigateTo({ url: '/pages/home/tab1/index' }) + // } }, onEvent: function (message) { if(message.what == 250){ diff --git a/pages/login/index.js b/pages/login/index.js index 8168428..85e5c40 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -1,10 +1,30 @@ //获取应用实例 -import { $wuxCountDown } from '../../components/index' -import { config, postCaptcha, loginCaptcha, loginPwd, wechatApplet, loginWechat } from "../api/user" -import { zconfig, loginToken, getBaseInfo } from "../api/ztb" -import { pconfig } from "../api/payment" -import { mconfig } from "../api/moment" -import { sconfig, getOrderExists } from "../api/saas" +import { + $wuxCountDown +} from '../../components/index' +import { + config, + postCaptcha, + loginCaptcha, + loginPwd, + wechatApplet, + loginWechat +} from "../api/user" +import { + zconfig, + loginToken, + getBaseInfo +} from "../api/ztb" +import { + pconfig +} from "../api/payment" +import { + mconfig +} from "../api/moment" +import { + sconfig, + getOrderExists +} from "../api/saas" const storage = require('../../utils/storage') const util = require('../../utils/util') const event = require('../../utils/event') @@ -31,19 +51,25 @@ Page({ }, onLoad: function (options) { if (options.mobile) { - this.setData({ ['form.mobile']: options.mobile }) + this.setData({ + ['form.mobile']: options.mobile + }) } this.wxLogin() var check = storage.get('AgreeCheck') app.globalData.kg = storage.get('ztb-kg') if (check) { - this.setData({check: true}) + this.setData({ + check: true + }) } }, - wxLogin: function(){ + wxLogin: function () { wx.login({ success: res => { - wechatApplet({ authCode: res.code }).then(result => { + wechatApplet({ + authCode: res.code + }).then(result => { storage.put('tmpAuthToken', result.data.tmpAuthToken, 98) }) } @@ -55,21 +81,37 @@ Page({ return } app.globalData.token = authorization - config.header = { 'Authorization': 'QNT ' + authorization } - loginToken({loginToken: app.globalData.token}).then(result => { - zconfig.header = { 'Authorization': 'QNT ' + result.data.token } - pconfig.header = { 'Authorization': 'QNT ' + result.data.token } - mconfig.header = { 'Authorization': 'QNT ' + result.data.token } + config.header = { + 'Authorization': 'QNT ' + authorization + } + loginToken({ + loginToken: app.globalData.token + }).then(result => { + zconfig.header = { + 'Authorization': 'QNT ' + result.data.token + } + pconfig.header = { + 'Authorization': 'QNT ' + result.data.token + } + mconfig.header = { + 'Authorization': 'QNT ' + result.data.token + } // 登录流程完成; getBaseInfo().then(result => { - app.globalData.userInfo = result.data - if(!util.isEmpty(result.data.userToken)){ + storage.put('userIsLoginFirst', '0') + app.globalData.userInfo = result.data + if (!util.isEmpty(result.data.userToken)) { this.handleUserToken(result.data.userToken) } else { - this.setData({ loging: false}) + this.setData({ + loging: false + }) wx.hideLoading() wx.navigateBack() - event.emit('EventMessage', { what: 888, desc: 'Logined' }) + event.emit('EventMessage', { + what: 888, + desc: 'Logined' + }) } }).catch(err => { wx.hideLoading() @@ -77,7 +119,9 @@ Page({ app.globalData.token = null storage.remove('Authorization') config.header = null - this.setData({ loging: false}) + this.setData({ + loging: false + }) }) }).catch(err => { wx.hideLoading() @@ -85,18 +129,24 @@ Page({ app.globalData.token = null storage.remove('Authorization') config.header = null - this.setData({ loging: false}) + this.setData({ + loging: false + }) }) }, - handleUserToken: function(userToken){ + handleUserToken: function (userToken) { storage.put('userToken', userToken) - sconfig.header = {'user-token': userToken } + sconfig.header = { + 'user-token': userToken + } getOrderExists().then(result => { wx.hideLoading() if (Number(result.data) != 1 || !app.release) { wx.navigateBack() } else { - wx.reLaunch({ url: '/pages/paper/index' }) + wx.reLaunch({ + url: '/pages/paper/index' + }) } }).catch(err => { wx.hideLoading() @@ -104,15 +154,21 @@ Page({ app.globalData.token = null storage.remove('Authorization') config.header = null - this.setData({ loging: false}) + this.setData({ + loging: false + }) wx.navigateBack() }) }, changePwd: function () { if (this.data.pwdType === 'password') { - this.setData({ pwdType: 'text' }) + this.setData({ + pwdType: 'text' + }) } else { - this.setData({ pwdType: 'password' }) + this.setData({ + pwdType: 'password' + }) } }, bindInput: function (e) { @@ -121,19 +177,29 @@ Page({ var enable = false if ((/^1\d{10}$/.test(e.detail.value)) && e.detail.value.length == 11) { enable = true - this.setData({ mobileEnable: enable }) + this.setData({ + mobileEnable: enable + }) } } if ((/^1\d{10}$/.test(this.data.form.account)) && this.data.form.account.length == 11) { if (this.data.type == 1 && !util.isEmpty(this.data.form.captcha)) { - this.setData({ loginEnable: false }) + this.setData({ + loginEnable: false + }) } else if (this.data.type == 0 && !util.isEmpty(this.data.form.password)) { - this.setData({ loginEnable: false }) + this.setData({ + loginEnable: false + }) } else { - this.setData({ loginEnable: true }) + this.setData({ + loginEnable: true + }) } } else { - this.setData({ loginEnable: true }) + this.setData({ + loginEnable: true + }) } }, loginForm: function () { @@ -149,7 +215,10 @@ Page({ util.showToast('请输入密码') return } - wx.showLoading({ title: '登录中', mask: true }) + wx.showLoading({ + title: '登录中', + mask: true + }) if (this.data.type == 1) { loginCaptcha(this.data.form).then(result => { storage.put('Authorization', result.data.token) @@ -172,9 +241,17 @@ Page({ }, changeType: function () { if (this.data.type == 1) { - this.setData({ type: 0, ['form.captcha']: null, loginEnable: true }) + this.setData({ + type: 0, + ['form.captcha']: null, + loginEnable: true + }) } else { - this.setData({ type: 1, ['form.password']: null, loginEnable: true }) + this.setData({ + type: 1, + ['form.password']: null, + loginEnable: true + }) } }, fetchCode: function (e) { @@ -183,19 +260,33 @@ Page({ return } if (this.second && this.second.interval) return !1 - wx.showLoading({ title: '正在获取', mask: true }) - postCaptcha({ verifiableAccount: this.data.form.account, verifiableAccountType: 1, purpose: 1 }).then(result => { + wx.showLoading({ + title: '正在获取', + mask: true + }) + postCaptcha({ + verifiableAccount: this.data.form.account, + verifiableAccountType: 1, + purpose: 1 + }).then(result => { wx.hideLoading() - this.setData({ codeEnable: false }) + this.setData({ + codeEnable: false + }) util.showToast('验证码已经发送') this.wuxCountDown = new $wuxCountDown({ date: +(new Date) + 60000, onEnd() { - this.setData({ second: '重新获取验证码', codeEnable: true }) + this.setData({ + second: '重新获取验证码', + codeEnable: true + }) }, render(date) { const sec = this.leadingZeros(date.sec, 2) + ' 秒 ' - date.sec !== 0 && this.setData({ second: sec }) + date.sec !== 0 && this.setData({ + second: sec + }) }, }) }).catch(error => { @@ -204,20 +295,31 @@ Page({ }) }, readAgreement: function () { - wx.navigateTo({ url: '/pages/html/agreement/index' }) + wx.navigateTo({ + url: '/pages/html/agreement/index' + }) }, onGotUserInfo: function (e) { - this.setData({ loging: true }) - loginWechat({ encryptedData: e.detail.encryptedData, iv: e.detail.iv }).then(result => { + this.setData({ + loging: true + }) + loginWechat({ + encryptedData: e.detail.encryptedData, + iv: e.detail.iv + }).then(result => { storage.put('Authorization', result.data.token) app.globalData.token = result.data.token this.fetchUserInfo() }).catch(error => { wx.hideLoading() - this.setData({ loging: false }) + this.setData({ + loging: false + }) if (error && error.data) { if (error.code == 200101) { - this.setData({ wxflag: true }) + this.setData({ + wxflag: true + }) } this.data.userInfo = e.detail.userInfo this.data.form.tmpAuthToken = error.data.tmpAuthToken