diff --git a/app.js b/app.js index 13244c2..deb5377 100644 --- a/app.js +++ b/app.js @@ -14,15 +14,30 @@ App({ kg: 0 }, onShow: function() { - const updateManager = wx.getUpdateManager() - updateManager.onCheckForUpdate(function (res) { - // 请求完新版本信息的回调 - // console.log('updateManager>>>' + res.hasUpdate) - }) - updateManager.onUpdateReady(function () { - // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 - updateManager.applyUpdate() - }) + if (wx.canIUse('getUpdateManager')) { + const updateManager = wx.getUpdateManager() + updateManager.onCheckForUpdate(function (res) { + // 请求完新版本信息的回调 + if (res.hasUpdate) { + updateManager.onUpdateReady(function () { + // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 + updateManager.applyUpdate() + }) + updateManager.onUpdateFailed(function () { + // 新版本下载失败 + wx.showModal({ + title: '已有新版本', + content: '请您删除小程序,重新搜索进入', + }) + }) + } + }) + } else { + wx.showModal({ + title: '溫馨提示', + content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' + }) + } if(this.globalData.Custom){ return } diff --git a/app.json b/app.json index 8ad1493..a04053b 100644 --- a/app.json +++ b/app.json @@ -8,6 +8,7 @@ "pages/home/password/index", "pages/home/setting/index", "pages/home/authory/index", + "pages/home/certificate/index", "pages/home/idcard/index", "pages/home/info/index", "pages/home/tab1/index", diff --git a/pages/agent/address/index.js b/pages/agent/address/index.js index cbf0395..fb5348c 100644 --- a/pages/agent/address/index.js +++ b/pages/agent/address/index.js @@ -16,7 +16,6 @@ Page({ receiver:'', phone:'', details:'', - isDefault:'', locProvinceId: '', locCityId: '', districtId: '' @@ -27,24 +26,18 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader') this.setData({ safeBottom: app.globalData.safeBottom }) }, - bindinput: function(e){ + bindInput: function(e){ this.data.form[e.target.id] = e.detail.value }, showRegion: function(){ - if(this.data.disabled){ - return - } + this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader') this.cascaderView.showPicker(this.data.region) }, 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.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['locCityId'] = e.detail.value[1] this.data.form['districtId'] = e.detail.value[2] @@ -52,25 +45,21 @@ Page({ }, submitForm: function(){ if(util.isEmpty(this.data.form.receiver)){ - util.showToast('请输入收货人') - return - } - if(util.isEmpty(this.data.form.phone)){ - util.showToast('请输入手机号') + util.showToast('请输入工厂全称') return } if(util.isEmpty(this.data.form.districtId)){ - util.showToast('请选择店铺所在区域') + util.showToast('请选择所在区域') return } if(util.isEmpty(this.data.form.details)){ - util.showToast('请输入店铺详细地址') + util.showToast('请输入详细地址') return } - if(util.isEmpty(this.data.form.isDefault)){ - util.showToast('请确定是否默认') + if(util.isEmpty(this.data.form.phone)){ + util.showToast('请输入发货人姓名') return - } + } wx.showLoading({ title: '处理中', mask: true }) createAddress(this.data.form).then(res => { wx.hideLoading() diff --git a/pages/agent/address/index.wxml b/pages/agent/address/index.wxml index 7d090b8..c075304 100644 --- a/pages/agent/address/index.wxml +++ b/pages/agent/address/index.wxml @@ -15,14 +15,13 @@ 详细地址: - + 发货人姓名: - + - 提交 diff --git a/pages/home/certificate/index.js b/pages/home/certificate/index.js new file mode 100644 index 0000000..5f50d09 --- /dev/null +++ b/pages/home/certificate/index.js @@ -0,0 +1,101 @@ +// pages/home/authory/index.js +import { getAuthSession, certificateImage } from "../../api/user" +const util = require('../../../utils/util') +const event = require('../../../utils/event.js') + +Page({ + /** + * 页面的初始数据 + */ + data: { + form: { identityAuthToken: null }, + flag: false, // 是否不可以编辑, false:可编辑;true:不可编辑 + imgList: [null, null] + }, + + onLoad: function (options) { + event.on('EventMessage', this, this.onEvent) + wx.showLoading({ title: '加载中', mask: true }) + getAuthSession().then(result => { + wx.hideLoading() + this.data.form.identityAuthToken = result.data.token + }).catch(error => { + wx.hideLoading() + }) + }, + onEvent: function (message) { + if (message.what == 82) { + wx.navigateBack() + } + }, + submitForm: function () { + if (util.isEmpty(this.data.form.frontImg)) { + util.showToast('请上传身份证正面照片') + return + } + if (util.isEmpty(this.data.form.backImg)) { + util.showToast('请上传身份证背面照片') + return + } + wx.showLoading({ title: '处理中', mask: true }) + certificateImage(this.data.form).then(result => { + wx.hideLoading() + var tokenJson = JSON.stringify(result.data) + wx.setStorageSync('identityAuthToken', tokenJson) + wx.navigateTo({ url: '/pages/home/authory/index' }) + }).catch(error => { + wx.hideLoading() + util.showToast(error) + }) + }, + /*******************************************************图片上传************************************************************/ + chooseImage: function(e) { + if (this.data.flag) { + return + } + var index = e.currentTarget.dataset.index + var that = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + that.setData({ ['imgList[' + index + ']']: res.tempFilePaths[0] }) + const fileSystemManager = wx.getFileSystemManager() + var type = that.suffixImage(res.tempFilePaths[0]) + fileSystemManager.readFile({ + filePath: that.data.imgList[index], // 例如图片临时路径 + encoding: 'base64', + success(res) { + let { data } = res // 编码后的数据 + if(index == 0){ + that.data.form.frontImg = {base64: data, type} + } else { + that.data.form.backImg = {base64: data, type} + } + } + }) + } + }) + }, + suffixImage: function(path){ + return path.substring(path.lastIndexOf('.') + 1) + }, + viewImage: function(e) { + var urlList = [] + for (var i = 0; i < this.data.imgList.length; i++) { + if (!util.isEmpty(this.data.imgList[i])) { + urlList.push(this.data.imgList[i]) + } + } + wx.previewImage({ urls: urlList, current: e.currentTarget.dataset.url }) + }, + deleteImg: function(e) { + var index = e.currentTarget.dataset.index + this.data.imgList[index] = null; + this.setData({ imgList: this.data.imgList }) + }, + onUnload: function () { + event.remove('EventMessage', this) + } +}) \ No newline at end of file diff --git a/pages/home/certificate/index.json b/pages/home/certificate/index.json new file mode 100644 index 0000000..1682085 --- /dev/null +++ b/pages/home/certificate/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "picker-view": "/components/picker-view/index", + "wux-button": "/components/button/index" + } +} \ No newline at end of file diff --git a/pages/home/certificate/index.wxml b/pages/home/certificate/index.wxml new file mode 100644 index 0000000..ec0eca8 --- /dev/null +++ b/pages/home/certificate/index.wxml @@ -0,0 +1,103 @@ + + + 企业认证 + + + + *请拍摄/上传本人身份证(头像面) + + + + + + + + + + + + + + + + + *公司名称: + + + + + + *信用代码: + + + + + + 工厂占地面积: + + + + + + 工厂人数: + + + + + + 工厂设备数: + + + + + + 月出货量: + + + + + + 从业经验: + + + + + + + *请拍摄/上传本人身份证(国徽面) + + + + + + + + + + + + + + + + + + 真实姓名: + + + + + + 身份证号码: + + + + + + + 提交认证 + + + \ No newline at end of file diff --git a/pages/home/certificate/index.wxss b/pages/home/certificate/index.wxss new file mode 100644 index 0000000..4789765 --- /dev/null +++ b/pages/home/certificate/index.wxss @@ -0,0 +1,64 @@ +/* pages/home/authory/index.wxss */ +.margin-top { + margin-top: 18rpx +} + +.image-reader-item { + position: relative; + width: 99%; + height: 400rpx; + background-color: #f8f8f8; + box-sizing: border-box; + list-style: none; + background-size: cover; + border-radius: 6rpx; +} + +.image-reader-item .md-icon { + position: absolute; + top: 45%; + left: 50%; + transform: translate(-50%, -50%); + opacity: 0.5; +} + +.image-reader-item .md-load { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.image-reader-item .md-hint { + position: absolute; + top: 50%; + left: 0; + width: 100%; + margin-top: 10px; + font-size: 12px; + color: #bababa; + text-align: center; +} + +.image-reader-item .delete { + position: absolute; + top: 0px; + right: 0px; + opacity: 0.8; + border-top-right-radius: 6rpx; + border-bottom-left-radius: 8rpx; + padding: 6rpx 12rpx; + height: auto; + background-color: rgba(0, 0, 0, 0.5); +} + +.inputs{ + width: 65%; + height: 36px; + padding: 10px 0px; +} + +.must{ + padding-top: 14px; + font-size: 28px; +} \ No newline at end of file diff --git a/project.config.json b/project.config.json index dcdc167..8a7c46d 100644 --- a/project.config.json +++ b/project.config.json @@ -30,14 +30,12 @@ "outputPath": "" }, "enableEngineNative": false, - "bundle": false, "useIsolateContext": true, - "useCompilerModule": true, - "userConfirmedUseCompilerModuleSwitch": true, "userConfirmedBundleSwitch": false, "packNpmManually": false, "packNpmRelationList": [], - "minifyWXSS": true + "minifyWXSS": true, + "showES6CompileOption": false }, "compileType": "miniprogram", "libVersion": "2.18.1",