| | |
| | | // pages/module_user/userregistercompany/userregistercompany.js |
| | | const userservice = require("../../../service/userservice") |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | data: { |
| | | sceneTypes: [ |
| | | {value: '1', name: '餐饮'}, |
| | | {value: '7', name: '汽修'}, |
| | | {value: '6', name: '工业企业' }, |
| | | {value: '2', name: '工地'}, |
| | | {value: '3', name: '码头'}, |
| | | {value: '4', name: '堆场'}, |
| | | {value: '5', name: '搅拌站' }, |
| | | {value: '6', name: '工业企业' }, |
| | | {value: '7', name: '汽修'}, |
| | | ], |
| | | sceneTypeIndex: 0, |
| | | |
| | |
| | | onSubmit: function () { |
| | | if (!this.submitCheck()) return |
| | | |
| | | |
| | | let msg = this.data.msg |
| | | let info = { |
| | | sceneType: this.data.sceneTypes[this.data.sceneTypeIndex].value, |
| | | userName: msg[0].value, |
| | | password: msg[1].value, |
| | | department: msg[3].value, |
| | | address: msg[4].value, |
| | | telephone: msg[5].value, |
| | | orgCode: msg[6].value |
| | | } |
| | | |
| | | wx.showLoading({ |
| | | title: '注册中', |
| | | mask: true, |
| | | }) |
| | | setTimeout(() => { |
| | | wx.hideLoading() |
| | | }, 10000); |
| | | var that = this |
| | | userservice.register(info, { |
| | | success(res) { |
| | | if (res.success) { |
| | | app.globalData.accessToken = { |
| | | userId: res.userId, |
| | | suserId: res.suserId, |
| | | } |
| | | that.getUserInfo() |
| | | } else { |
| | | wx.hideLoading({ |
| | | success: (res) => { |
| | | wx.showToast({ |
| | | title: '用户名称重复', |
| | | duration: 2000, |
| | | icon: 'error', |
| | | mask: true, |
| | | }) |
| | | }, |
| | | fail: (res) => {}, |
| | | complete: (res) => {}, |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | return true |
| | | } |
| | | }, |
| | | |
| | | getUserInfo() { |
| | | userservice.getUserInfo(app.globalData.accessToken.userId, { |
| | | success(data) { |
| | | app.globalData.accessToken.userName = data.acountname |
| | | app.globalData.accessToken.password = data.acountname |
| | | wx.setStorage({ |
| | | key: 'accessToken', |
| | | data: app.globalData.accessToken, |
| | | }) |
| | | app.globalData.userInfo = data |
| | | wx.setStorage({ |
| | | key: 'userInfo', |
| | | data: data, |
| | | success: (result) => { |
| | | wx.switchTab({ |
| | | url: '/pages/home/home', |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | }) |