diff --git a/app.js b/app.js index 5255751..aa4c898 100644 --- a/app.js +++ b/app.js @@ -1,15 +1,15 @@ //app.js App({ //----------------------------------------------globalData-------------------------------------- - release: 1, + release: 0, tmplIds: ['kg0T1ve0FpYrEtZ4ExbypHm8mtS7OJaehvqN_T9ypoI'], version: 152, - xAppId: '503258978847952896', - accountInfo: null, + xAppId: '503258978847953926', + userInfo: null, globalData: { openId: null, token: null, - isIPhoneX: false, + keyboardHeight: 0, isIos: false } }) \ No newline at end of file diff --git a/app.json b/app.json index 8803a30..3f52d25 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "pages":[ - "pages/index/index", "pages/login/index", + "pages/index/index", "pages/home/mobile/index", "pages/home/authory/index", "pages/htmls/agreement/index", diff --git a/assets/image/bg-logo.png b/assets/image/bg-logo.png deleted file mode 100644 index 61da39b..0000000 Binary files a/assets/image/bg-logo.png and /dev/null differ diff --git a/assets/image/icon_logo.png b/assets/image/icon_logo.png index 02966f3..0d7ab4f 100644 Binary files a/assets/image/icon_logo.png and b/assets/image/icon_logo.png differ diff --git a/pages/api/payment.js b/pages/api/payment.js deleted file mode 100644 index f407f8a..0000000 --- a/pages/api/payment.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright © 2020-present LiuDanYang. All rights Reserved. - */ -import { mGet, mPost } from "./request" -const app = getApp() - -const pconfig = { - baseUrl: app.release ? `https://psc.qniao.cn` : `http://psc-dev.qniao.cn` -} -// *******************************************************************账户业务*********************************************************** -// /credit/get/self-enterprise-credit-by-enterprise-id查看个人的采购额度 -const getCreditInfo = (params) => mGet(`/payment-settlement-center/credit/get/self-enterprise-credit-by-enterprise-id`, params, pconfig) - -const paymentInfo = (params) => mPost(`/payment-settlement-center/pay`, params, pconfig) - -export { - pconfig, - getCreditInfo, - paymentInfo -} \ No newline at end of file diff --git a/pages/api/saas.js b/pages/api/saas.js new file mode 100644 index 0000000..dd402da --- /dev/null +++ b/pages/api/saas.js @@ -0,0 +1,18 @@ +/** + * Copyright © 2020-present LiuDanYang. All rights Reserved. + */ +import { mGet, mPost } from "./request" +const app = getApp() + +const sconfig = { + baseUrl: app.release ? `https://api-client-ztb.qniao.cn` : `http://47.113.118.47:9000` +} +// *****************************************账户业务********************************************** +const loginToken = (params) => mPost(`/recycle-user-center/authorize/get/product-line-token/by/login-token`, params, sconfig) +const getBaseInfo = () => mGet(`/ztb-factory/get/self-enterprise-profile-detail`, null, sconfig) + +export { + sconfig, + loginToken, + getBaseInfo +} \ No newline at end of file diff --git a/pages/api/user.js b/pages/api/user.js index 12f76aa..9adc51f 100644 --- a/pages/api/user.js +++ b/pages/api/user.js @@ -1,59 +1,24 @@ /** * Copyright © 2020-present LiuDanYang. All rights Reserved. */ -import { mGet, mPost, mDelete } from "./request" -// import { mconfig } from "./mall" -// import { cconfig } from "./cloud" -import { pconfig } from "./payment" +import { mGet, mPost } from "./request" +import { sconfig } from "./saas" const util = require('../../utils/util') const storage = require('../../utils/storage') const app = getApp() const config = { - baseUrl: app.release ? 'https://uec.qniao.cn' : 'http://47.107.97.166:9000', - header: { - 'Authorization': `QNT ` + storage.get('Authorization') - } + baseUrl: app.release ? 'https://uec.qniao.cn' : 'https://uec-dev.qniao.cn' } -const checkTestCode = (params) => mGet(`/uec/get/check/qr-code`, params, config) -///uec/get/auth-captcha -const verifyCode = (code, params) => mGet(`/uec/verify/qrcode${code}`, params, config) - -const qrcodeEmploye = (params) => mPost(`/uec/generate/qrcode`, params, config) -// /uec/get/wechat-applet-session const wechatApplet = (params) => mPost('/uec/get/wechat-applet-session', params, config) -const authCaptcha = (params) => mPost(`/uec/get/auth-captcha`, params, config) -const verifyCaptcha = (params) => mPost(`/uec/authorize/by-captcha`, params, config) +const loginCaptcha = (params) => mPost(`/uec/authorize/by-captcha`, params, config) +const loginPwd = (params) => mPost(`/uec/authorize/by-password`, params, config) +const postCaptcha = (params) => mPost(`/uec/get/auth-captcha`, params, config) +const setPassword = (params) => mPost(`/uec/user/set/sign-in-password`, params, config) +const modifyMobile = (params) => mPost(`/uec/user/modify/mobile`, params, config) const getUserInfo = (params) => mGet('/uec/get/user-info', params, config) - -const getAuthSession = () => mGet('/uec/create/identity-auth-session', null, config) - -const certificateImage = (params) => mPost('/uec/recognize/certificate-img', params, config) - -const certificateIdentity = (params) => mPost('/uec/identify/identity', params, config) - -const bindingAdmin = (params) => mPost(`/uec/bind/primary-account`, params, config) - -const bindingAccount = (params) => mPost(`/uec/apply/to/be/emplyee/of/enterprise`, params, config) - -const getCheckList = (params) => mGet(`/uec/get/auditing-joining-enterprise-application-list`, params, config) - -const getEmployeList = (params) => mGet(`/uec/get/passed-employees`, params, config) - -const auditEmploye = (params) => mPost(`/uec/audit/employee-joining-application`, params, config) - -const deleteEmploye = (params) => mPost(`/uec/remove/employees`, params, config) - -const adminEmploye = (params) => mPost(`/uec/grant/admin-role/to/employees`, params, config) - -const getAddressList = () => mGet(`/uec/get/enterprise-shipping-address-list/by-userId`, null, config) - -const getAddressInfo = (id) => mGet(`/uec/get/enterprise-shipping-address-list/by-userId`, null, config) - -const saveAddress = (params) => mPost(`/uec/save/enterprise-shipping-address`, params, config) -// /uec/delete/enterprise-shipping-address/{id} -const deleteAddress = (id) => mDelete(`/uec/delete/enterprise-shipping-address/${id}`, null, config) - +const updateUserInfo = (params) => mPost('/uec/user/update/user-info', params, config) +const verifyCode = (code, params) => mGet(`/uec/verify/qrcode${code}`, params, config) // **************************************************************************************************************************************** // /authorize/by-wechat-applet小程序登录 @@ -116,7 +81,6 @@ function unionWechat(form, resolve, reject) { data: form, method: 'POST', success: function (result) { - wx.hideLoading() if (result.data.code == 0) { storage.remove('tempToken') resolve(result.data) @@ -204,42 +168,23 @@ function phoneWechat(form) { return promise } -function finalizeToken() { +function finalizeToken(){ config.header = null - mconfig.header = null - pconfig.header = null - cconfig.header = null + sconfig.header = null } export { config, - qrcodeEmploye, - verifyCode, - checkTestCode, - wechatApplet, - authCaptcha, - verifyCaptcha, + finalizeToken, + wechatApplet, getUserInfo, - getAuthSession, - certificateImage, - certificateIdentity, + updateUserInfo, + postCaptcha, + loginPwd, + loginCaptcha, phoneWechat, loginWechat, - bindingAdmin, - bindingAccount, - getCheckList, - getEmployeList, - auditEmploye, - deleteEmploye, - adminEmploye, - getAddressList, - saveAddress, - getAddressInfo, - deleteAddress, - finalizeToken -} - -// module.exports = { -// phoneWechat: phoneWechat, -// loginWechat: loginWechat -// } \ No newline at end of file + setPassword, + modifyMobile, + verifyCode +} \ No newline at end of file diff --git a/pages/home/index/index.js b/pages/home/index/index.js index 0a4c832..5a7e61a 100644 --- a/pages/home/index/index.js +++ b/pages/home/index/index.js @@ -1,7 +1,6 @@ // pages/stock/index.js import Dialog from '../../../components/dialog/dialog' import { finalizeToken } from "../../api/user" -import { getCreditInfo } from "../../api/payment" const util = require('../../../utils/util') const event = require('../../../utils/event.js') const app = getApp() diff --git a/pages/home/index/index.wxml b/pages/home/index/index.wxml index 898e516..4c53ab5 100644 --- a/pages/home/index/index.wxml +++ b/pages/home/index/index.wxml @@ -47,23 +47,7 @@ 查看订单明细 - - - - - - - 商城订单 - - - - - - - - - - + diff --git a/pages/index/index.js b/pages/index/index.js index 52699f8..f505277 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,12 +1,4 @@ // pages/administ/index.js -import Dialog from '../../components/dialog/dialog' -import { config, getUserInfo, verifyCode } from "../api/user" -// import { loginToken, cconfig } from "../api/cloud" -// import { mconfig } from "../api/mall" -import { pconfig } from "../api/payment" -const storage = require('../../utils/storage') -const event = require('../../utils/event') -const util = require('../../utils/util') const app = getApp() Page({ @@ -21,11 +13,7 @@ Page({ { index: 1, value: 'work', badge: 0, name: '工作台', blue: '/assets/image/tabbar/process-blue.png', gray: '/assets/image/tabbar/process-gray.png' }, { index: 2, value: 'home', badge: 0, name: '我的', blue: '/assets/image/tabbar/home-blue.png', gray: '/assets/image/tabbar/home-gray.png' } ], - tabIndex: 0, - inited: false, - authorization: null, - code: null, - // code: '?mark=cloudprint&QrCodeRecordId=541755014083907584' + tabIndex: 0 }, /************************************** 初始化流程 ********************************************/ onLoad: function (options) { @@ -35,157 +23,11 @@ Page({ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() }) - if(options.q){ - //扫二维码进入的, - let q = decodeURIComponent(options.q) - this.data.code = q.substring(q.indexOf('?')) - } - event.on('EventMessage', this, this.onEvent) - }, - onReady: function () { - wx.showLoading({ title: '获取中', mask: true }) - wx.getSystemInfo({ - success: e => { - app.globalData.isIPhoneX = this.checkIPhoneX(e) - app.globalData.isIos = this.checkIos(e) - app.globalData.dev = e.platform == 'devtools' - - let custom = wx.getMenuButtonBoundingClientRect() - app.globalData.Custom = custom - // 顶部操作栏高度 - app.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight + (app.globalData.isIos ? 4 : 0) - let windowHeight = e.windowHeight * (750 / e.windowWidth) - - let safeBottom = e.windowHeight - e.safeArea.bottom - if(safeBottom > e.windowHeight){ - safeBottom = 34 - } - app.globalData.safeBottom = safeBottom * (750 / e.windowWidth) - // 状态栏高度 - app.globalData.StatusBar = e.statusBarHeight * (750 / e.windowWidth) - let statusBarHeight = app.globalData.CustomBar * (750 / e.windowWidth) - app.globalData.statusBarHeight = statusBarHeight - // fragmentHeight:指的是整个页面statusBarHeight以下的高度 - app.globalData.fragmentHeight = windowHeight - statusBarHeight - app.globalData.safeFragmentHeight = windowHeight - statusBarHeight - app.globalData.safeBottom - app.globalData.windowWidth = e.windowWidth - - this.data.inited = true - const fheght = (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight) - 100 - event.emit('InitMessage', { what: 8, desc: 'Inited' }) - this.setData({fragment: fheght, safeBottom: app.globalData.safeBottom, inited: true }) - this.data.authorization = app.globalData.token || storage.get('Authorization') - if(this.data.code){ - // 进入登录绑定页面 - this.fetchCode(this.data.code) - } else if(this.data.authorization){ - app.globalData.token = this.data.authorization - this.fetchUserInfo() - } else { - wx.hideLoading() - this.onResume() - } - } - }) - }, - checkIos: function (e) { - if ('ios' === e.platform) { - return true - } - if (e.system.startsWith('iOS')) { - return true - } - return false - }, - checkIPhoneX: function (e) { - var t = e.model - return (/iPhone 11/.test(t) || /iPhone X/.test(t) || /iPhone 12/.test(t)) && this.checkIos(e) - }, - /************************************** 登录流程 ********************************************/ - onEvent: function (message) { - if (message.what == 888) { - if(!app.accountInfo){ - this.setData({ tabIndex: 0 }) - } else if(app.accountInfo && app.accountInfo.applicationStatus == 0){ - this.setData({ tabIndex: 1 }) - } - } - }, - fetchUserInfo: function(){ - if(!app.globalData.token){ - wx.hideLoading() - this.onResume() - return - } - config.header = { 'Authorization': 'QNT ' + app.globalData.token } - getUserInfo().then(result => { - if (result.data.token) { - storage.put('Authorization', result.data.token) - app.globalData.token = result.data.token - } - app.accountInfo = result.data - loginToken({loginToken: app.globalData.token}).then(result => { - mconfig.header = { 'Authorization': 'QNT ' + result.data } - cconfig.header = { 'Authorization': 'QNT ' + result.data } - pconfig.header = { 'Authorization': 'QNT ' + result.data } - // 登录流程完成; - wx.hideLoading() - // 如果是员工,或者 - if(app.accountInfo && app.accountInfo.applicationStatus == 0){ - this.setData({ tabIndex: 1 }) - } - this.onResume() - // event.emit('EventMessage', { what: 888, desc: 'Logined' }) - }).catch(err => { - wx.hideLoading() - this.onResume() - }) - }).catch(err => { - wx.hideLoading() - this.onResume() - }) - }, - // 根据二维码的code获取相关的内容; - fetchCode: function(code){ - verifyCode(code).then(result => { - this.data.code = null - if(result.data.redirectUrl == '/login'){ - // 根据userId来获取用户信息;并且直接登录 - app.globalData.token = result.data.metaData.token - storage.put('Authorization', app.globalData.token) - this.fetchUserInfo() - } else if('/page/index/yaoqing' == result.data.redirectUrl || '/page/index/shenqing' == result.data.redirectUrl){ - storage.put('metaData', JSON.stringify(result.data), 1) - wx.hideLoading() - // 进入login页面; - wx.navigateTo({ url: '/pages/index/index?code=11' }) - } else { - wx.hideLoading() - if(!result.data.message){ - result.data.message = '二维码解析失败,请重新扫码' - } - util.showToast(result.data.message) - } - }).catch(err => { - //异常回调 - wx.hideLoading() - if(this.data.authorization){ - Dialog.alert({ title: '温馨提示', message: '二维码解析失败,以当前账号进行登录!' }).then(() => { - wx.showLoading({ title: '登录中', mask: true }) - app.globalData.token = this.data.authorization - this.fetchUserInfo() - }) - } else { - util.showToast(err) - this.onResume() - } - }) + this.setData({fragment: (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight) - 100, safeBottom: app.globalData.safeBottom }) }, /************************************** 生命周期函数--监听页面初次渲染完成 ********************************************/ onShow: function () { - if(this.data.inited){ - this.onResume() - } + this.onResume() }, onResume: function(){ var pageView = this.selectComponent('#' + this.data.tabList[this.data.tabIndex].value) @@ -194,17 +36,10 @@ Page({ } }, onChange: function ({detail}) { - if(detail == 2 && !app.accountInfo){ - wx.navigateTo({ url: '/pages/login/index' }) - return - } this.setData({ tabIndex: detail }) this.onResume() }, stopTouchMove: function(e){ return false - }, - onUnload: function(){ - event.remove('EventMessage', this) } }) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json index 176b038..c95a7d8 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -5,7 +5,6 @@ "van-tabbar-item": "/components/tabbar-item/index", "mall": "/pages/mall/index/index", "workbench": "/pages/process/index/index", - "home": "/pages/home/index/index", - "van-dialog": "/components/dialog/index" + "home": "/pages/home/index/index" } } \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index f14268c..caadf07 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,11 +1,11 @@ - + - + diff --git a/pages/login/index.js b/pages/login/index.js index 01a637b..64c7554 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -1,12 +1,9 @@ //获取应用实例 import Dialog from '../../components/dialog/dialog' -import { config, wechatApplet, getUserInfo, loginWechat, authCaptcha, verifyCaptcha, bindingAdmin, bindingAccount } from "../api/user" -// import { loginToken, cconfig } from "../api/cloud" -// import { mconfig } from "../api/mall" -import { pconfig } from "../api/payment" +import { config, postCaptcha, loginCaptcha, loginPwd, verifyCode } from "../api/user" +import { sconfig, loginToken, getBaseInfo } from "../api/saas" const util = require('../../utils/util') const storage = require('../../utils/storage') -const event = require('../../utils/event') const app = getApp() Page({ @@ -23,145 +20,106 @@ Page({ captcha: null }, loging: false, - regist: false, qrPage: null, metaData: null, - code: null, - checked: true, - height: app.globalData.fragmentHeight + code: null }, /************************************** 初始化登录流程 ********************************************/ onLoad: function (options) { - var json = storage.get('metaData') - if(options.code && json){ - //分享带code进入的, - this.setData({ code: options.code, height: app.globalData.fragmentHeight }) - storage.remove('metaData') - var form = JSON.parse(json) - this.data.metaData = form.metaData - this.data.qrPage = form.redirectUrl - } else { - this.setData({ height: app.globalData.fragmentHeight }) - } - this.wxLogin() - }, - onEvent: function (message) { - if (message.what == 888) { - this.initAccountInfo() + const updateManager = wx.getUpdateManager() + updateManager.onCheckForUpdate() + updateManager.onUpdateReady(function () { + // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 + updateManager.applyUpdate() + }) + if(options.q){ + //扫二维码进入的, + let q = decodeURIComponent(options.q) + this.data.code = q.substring(q.indexOf('?')) } }, - wxLogin: function(){ - wx.login({ - success: res => { - // 获取openId - wechatApplet({ authCode: res.code }).then(result => { - storage.put('tmpAuthToken', result.data.tmpAuthToken, 98) - }) + onReady: function () { + wx.getSystemInfo({ + success: e => { + app.globalData.isIos = this.checkIos(e) + app.globalData.dev = e.platform == 'devtools' + + let custom = wx.getMenuButtonBoundingClientRect() + app.globalData.Custom = custom + // 顶部操作栏高度 + app.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight + (app.globalData.isIos ? 4 : 0) + let windowHeight = e.windowHeight * (750 / e.windowWidth) + + let safeBottom = e.windowHeight - e.safeArea.bottom + if(safeBottom > e.windowHeight){ + safeBottom = 34 + } + app.globalData.safeBottom = safeBottom * (750 / e.windowWidth) + // 状态栏高度 + app.globalData.StatusBar = e.statusBarHeight * (750 / e.windowWidth) + let statusBarHeight = app.globalData.CustomBar * (750 / e.windowWidth) + app.globalData.statusBarHeight = statusBarHeight + // fragmentHeight:指的是整个页面statusBarHeight以下的高度 + app.globalData.fragmentHeight = windowHeight - statusBarHeight + app.globalData.safeFragmentHeight = windowHeight - statusBarHeight - app.globalData.safeBottom + app.globalData.windowWidth = e.windowWidth + + if(this.data.code){ + this.fetchQrCode(this.data.code) + } else { + this.fetchUserInfo() + } } }) }, - // 获取用户信息,进行登录 + checkIos: function (e) { + if ('ios' === e.platform) { + return true + } + if (e.system.startsWith('iOS')) { + return true + } + return false + }, + /************************************** 获取用户信息,进行登录 ********************************************/ fetchUserInfo: function(){ - config.header = { 'Authorization': 'QNT ' + app.globalData.token } + var authorization = app.globalData.token || storage.get('Authorization') + if (util.isEmpty(authorization)) { + return + } + app.globalData.token = authorization + config.header = { 'Authorization': 'QNT ' + authorization } this.setData({ loging: true}) - getUserInfo().then(result => { - this.setData({ loging: false}) - if(!result.data.mobile){ - wx.hideLoading() - //小白用户;注册流程; - this.setData({ regist: true }) - return - } - if (result.data.token) { - storage.put('Authorization', result.data.token) - app.globalData.token = result.data.token - } - app.accountInfo = result.data - if(result.data.enterpriseId){ - // 企业不一致 - var invaild = false - if(this.data.metaData && this.data.metaData.enterpriseId){ - invaild = result.data.enterpriseId != this.data.metaData.enterpriseId - } else if(this.data.metaData && this.data.metaData.joiningEnterprisePublicInvitationId){ - invaild = result.data.enterpriseId != this.data.metaData.joiningEnterprisePublicInvitationId - } - if(invaild){ - wx.hideLoading() - Dialog.alert({ title: '温馨提示', message: '您已经绑定过企业,现在就进入?' }).then(() => { - this.toIndex() - }) - } else { - this.toIndex() - } - } else if(this.data.metaData){ - // 如果有metaData + loginToken({loginToken: app.globalData.token}).then(result => { + sconfig.header = { 'Authorization': 'QNT ' + result.data.token } + getBaseInfo().then(result => { + this.setData({ loging: false}) + app.userInfo = result.data wx.hideLoading() - this.setData({ metaData: this.data.metaData, qrPage: this.data.qrPage, regist: false, loging: false }) - } else { - //如果绑定过手机号码; + wx.redirectTo({ url: '/pages/index/index' }) + }).catch(err => { wx.hideLoading() - this.toIndex() - } + util.showToast(err) + app.globalData.token = null + storage.remove('Authorization') + config.header = null + this.setData({ loging: false}) + }) }).catch(err => { - //异常回调 wx.hideLoading() + util.showToast(err) + app.globalData.token = null + storage.remove('Authorization') + config.header = null this.setData({ loging: false}) }) }, - toIndex: function(){ - loginToken({loginToken: app.globalData.token}).then(result => { - mconfig.header = { 'Authorization': 'QNT ' + result.data } - cconfig.header = { 'Authorization': 'QNT ' + result.data } - pconfig.header = { 'Authorization': 'QNT ' + result.data } - // 登录完成... - wx.hideLoading() - event.emit('EventMessage', { what: 888, desc: 'Logined' }) - wx.navigateBack() - }).catch(err => { - wx.hideLoading() - }) - }, - onBoxChange: function({detail}){ - this.setData({ checked: detail }) - }, /************************************** 注册流程 ********************************************/ readAgreement: function () { wx.navigateTo({ url: '/pages/htmls/agreement/index' }) }, - onGotUserInfo: function (e) { - if(!this.data.checked){ - util.showToast('请阅读并同意《服务与隐私协议》') - return - } - if(this.data.loging){ - return - } - this.setData({ loging: true }) - if(this.data.form.tmpAuthToken){ - this.registAccount() - return - } - loginWechat({ encryptedData: e.detail.encryptedData, iv: e.detail.iv }).then(result => { - storage.put('Authorization', result.data.token) - app.globalData.token = result.data.token - this.data.form.tmpAuthToken = result.data.tmpAuthToken - if(e.currentTarget.id == 'btn-login'){ - this.registAccount() - } else { - this.fetchUserInfo() - } - }).catch(error => { - if(error.data && error.data.tmpAuthToken){ - this.data.form.tmpAuthToken = error.data.tmpAuthToken - this.setData({ regist: true, loging: false }) - } else { - this.setData({ loging: false }) - } - util.showToast(error.message) - }) - }, inputFocus: function(e) { - storage.put('keyboardHeight', e.detail.height) + app.globalData.keyboardHeight = e.detail.height }, bindInput: function (e) { this.data.form[e.target.id] = e.detail.value @@ -191,16 +149,13 @@ Page({ onFinished: function(){ this.setData({ second: '重新获取验证码', codeEnable: true }) }, - loginFrom: function(){ - this.setData({ regist: true }) - }, fetchCaptcha: function(){ if (!(/^1\d{10}$/.test(this.data.form.account)) || this.data.form.account.length < 11) { util.showToast('请输入11位手机号码') return } wx.showLoading({ title: '正在获取', mask: true }) - authCaptcha({ verifiableAccount: this.data.form.account, verifiableAccountType: 1, purpose: 1 }).then(result => { + postCaptcha({ verifiableAccount: this.data.form.account, verifiableAccountType: 1, purpose: 1 }).then(result => { wx.hideLoading() this.setData({ codeEnable: false }) util.showToast('验证码已经发送') @@ -227,45 +182,53 @@ Page({ } wx.showLoading({ title: '登录中', mask: true }) this.setData({ loging: true }) - // this.data.form.password = md5.hexMD5(this.data.form.password).toUpperCase() if (this.data.type == 1) { - verifyCaptcha(this.data.form).then(result => { - wx.setStorageSync('Authorization', result.data.token) + loginCaptcha(this.data.form).then(result => { + storage.put('Authorization', result.data.token) app.globalData.token = result.data.token this.fetchUserInfo() }).catch(error => { wx.hideLoading() - this.setData({ loging: false }) + console.log(error) util.showToast(error) }) } else { - // authorize/by-password 密码登录 - } - }, - /************************************** 二维码流程 ********************************************/ - bindAccount: function(){ - if (util.isEmpty(this.data.form.userName)) { - util.showToast('请输入您的姓名,以便于识别') - return - } - this.setData({ loging: true }) - this.data.metaData.userName = this.data.form.userName - if(this.data.qrPage == '/page/index/yaoqing'){ - bindingAdmin(this.data.metaData).then(result => { - this.data.metaData = null + loginPwd(this.data.form).then(result => { + storage.put('Authorization', result.data.token) + app.globalData.token = result.data.token this.fetchUserInfo() }).catch(error => { - this.setData({loging: false}) + wx.hideLoading() util.showToast(error) }) + } + }, + changeType: function () { + if (this.data.type == 1) { + this.setData({ type: 0, ['form.captcha']: null, loginEnable: true }) } else { - bindingAccount(this.data.metaData).then(result => { - this.data.metaData = null - this.fetchUserInfo() - }).catch(error => { - this.setData({loging: false}) - util.showToast(error) - }) + this.setData({ type: 1, ['form.password']: null, loginEnable: true }) } + }, + /************************************** 二维码流程 ********************************************/ + fetchQrCode: function(code){ + verifyCode(code).then(result => { + this.data.code = null + if(result.data.redirectUrl == '/login'){ + // 根据userId来获取用户信息;并且直接登录 + app.globalData.token = result.data.metaData.token + storage.put('Authorization', app.globalData.token) + this.fetchUserInfo() + } else { + wx.hideLoading() + if(!result.data.message){ + result.data.message = '二维码解析失败,请重新扫码' + } + util.showToast(result.data.message) + } + }).catch(err => { + //异常回调 + wx.hideLoading() + }) } }) \ No newline at end of file diff --git a/pages/login/index.json b/pages/login/index.json index db02766..c83be94 100644 --- a/pages/login/index.json +++ b/pages/login/index.json @@ -2,7 +2,6 @@ "usingComponents": { "van-button": "/components/button/index", "van-dialog": "/components/dialog/index", - "van-count-down": "/components/count-down/index", - "van-checkbox": "/components/checkbox/index" + "van-count-down": "/components/count-down/index" } } \ No newline at end of file diff --git a/pages/login/index.wxml b/pages/login/index.wxml index fc5a6ca..90ed99a 100644 --- a/pages/login/index.wxml +++ b/pages/login/index.wxml @@ -1,94 +1,49 @@ - - 登录 - + + + - - - + + + + 手机号码 - - - 欢迎您使用千鸟跟单王! - - 现邀请您成为{{metaData.name}}的管理员 - - - 现邀请您成为{{metaData.name}}的员工 - - - - - - 提交 - + + - - - - - 手机号码 - - - - - - - {{type == 1 ? '验证码' : '密码'}} - - - - - - - {{second}} - - - - - - - - - 登录 - - + + + {{type == 1 ? '验证码' : '密码'}} + + + + + + {{second}} + + + + + + + {{type == 1 ? '密码登录' : '验证码登录'}} + + + + 登录 - - - - 千鸟互联云印通 - 专注服务于印刷包装企业 - - - - 微信用户一键登录 - - - 手机验证码登录 - - - - 登录即同意 - - 《服务与隐私协议》 - - - - + + + + 仅限纸通宝工厂用户使用 \ No newline at end of file diff --git a/pages/login/index.wxss b/pages/login/index.wxss index e83520a..ef76a63 100644 --- a/pages/login/index.wxss +++ b/pages/login/index.wxss @@ -3,19 +3,6 @@ page { background-color: #fff; } -.relative{ - height: 100%; - width: 100%; - position:relative; -} - -.container { - width: 100%; - flex-direction: column; - position: fixed; - bottom: 64rpx; -} - .label { font-size: 30rpx; font-family: PingFang-SC-Regular, PingFang-SC; diff --git a/pages/mall/components/cell/index.js b/pages/mall/components/cell/index.js deleted file mode 100644 index e5d500e..0000000 --- a/pages/mall/components/cell/index.js +++ /dev/null @@ -1,23 +0,0 @@ -// pages/mall/components/sku.js -Component({ - /** - * 组件的属性列表 - */ - properties: { - - }, - - /** - * 组件的初始数据 - */ - data: { - - }, - - /** - * 组件的方法列表 - */ - methods: { - - } -}) diff --git a/pages/mall/components/cell/index.json b/pages/mall/components/cell/index.json deleted file mode 100644 index e8cfaaf..0000000 --- a/pages/mall/components/cell/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/mall/components/cell/index.wxml b/pages/mall/components/cell/index.wxml deleted file mode 100644 index 8a7f9b8..0000000 --- a/pages/mall/components/cell/index.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/mall/components/sku.wxml diff --git a/pages/mall/components/cell/index.wxss b/pages/mall/components/cell/index.wxss deleted file mode 100644 index 8562a32..0000000 --- a/pages/mall/components/cell/index.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/mall/components/sku.wxss */ \ No newline at end of file diff --git a/pages/mall/components/fence/index.js b/pages/mall/components/fence/index.js deleted file mode 100644 index e5d500e..0000000 --- a/pages/mall/components/fence/index.js +++ /dev/null @@ -1,23 +0,0 @@ -// pages/mall/components/sku.js -Component({ - /** - * 组件的属性列表 - */ - properties: { - - }, - - /** - * 组件的初始数据 - */ - data: { - - }, - - /** - * 组件的方法列表 - */ - methods: { - - } -}) diff --git a/pages/mall/components/fence/index.json b/pages/mall/components/fence/index.json deleted file mode 100644 index e8cfaaf..0000000 --- a/pages/mall/components/fence/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/mall/components/fence/index.wxml b/pages/mall/components/fence/index.wxml deleted file mode 100644 index 8a7f9b8..0000000 --- a/pages/mall/components/fence/index.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/mall/components/sku.wxml diff --git a/pages/mall/components/fence/index.wxss b/pages/mall/components/fence/index.wxss deleted file mode 100644 index 8562a32..0000000 --- a/pages/mall/components/fence/index.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/mall/components/sku.wxss */ \ No newline at end of file diff --git a/pages/mall/components/sku/index.js b/pages/mall/components/sku/index.js deleted file mode 100644 index e5d500e..0000000 --- a/pages/mall/components/sku/index.js +++ /dev/null @@ -1,23 +0,0 @@ -// pages/mall/components/sku.js -Component({ - /** - * 组件的属性列表 - */ - properties: { - - }, - - /** - * 组件的初始数据 - */ - data: { - - }, - - /** - * 组件的方法列表 - */ - methods: { - - } -}) diff --git a/pages/mall/components/sku/index.json b/pages/mall/components/sku/index.json deleted file mode 100644 index e8cfaaf..0000000 --- a/pages/mall/components/sku/index.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "component": true, - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/mall/components/sku/index.wxml b/pages/mall/components/sku/index.wxml deleted file mode 100644 index 8a7f9b8..0000000 --- a/pages/mall/components/sku/index.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/mall/components/sku.wxml diff --git a/pages/mall/components/sku/index.wxss b/pages/mall/components/sku/index.wxss deleted file mode 100644 index 8562a32..0000000 --- a/pages/mall/components/sku/index.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/mall/components/sku.wxss */ \ No newline at end of file diff --git a/pages/process/index/index.json b/pages/process/index/index.json index 1269718..b869717 100644 --- a/pages/process/index/index.json +++ b/pages/process/index/index.json @@ -1,9 +1,11 @@ { "component": true, "usingComponents": { - "van-tabs": "/components/tabs/index", - "van-tab": "/components/tab/index", - "van-loading": "/components/loading/index", - "van-button": "/components/button/index" + "van-grid": "/components/grid/index", + "van-grid-item": "/components/grid-item/index", + "van-cell": "/components/cell/index", + "van-cell-group": "/components/cell-group/index", + "van-info": "/components/info/index", + "van-icon": "/components/icon/index" } } \ No newline at end of file diff --git a/pages/process/index/index.wxml b/pages/process/index/index.wxml index 143c2c8..6733d98 100644 --- a/pages/process/index/index.wxml +++ b/pages/process/index/index.wxml @@ -2,47 +2,17 @@ 工作台 - - - - 正在加载 - - - - - - - - - - - - - - - - - - - - - - - 您的申请还在审核中,如有疑问请联系管理员。 - - - - - 您还没有入驻云印通 - - 现在去申请 - - - - - - 您还没有云印通账号 - - 现在去登录 - - \ No newline at end of file + + + + + 收货管理 + + + + + + + + + \ No newline at end of file diff --git a/project.config.json b/project.config.json index abc836e..eb29e99 100644 --- a/project.config.json +++ b/project.config.json @@ -41,7 +41,7 @@ }, "compileType": "miniprogram", "libVersion": "2.14.0", - "appid": "wx0e4e0fc5432db6d8", + "appid": "wx8214a7f3614a3340", "projectname": "ztb-saas-mini", "debugOptions": { "hidedInDevtools": []