Browse Source

no message

feature/v1.0
xpz2018 5 years ago
parent
commit
9b7e3317c6
5 changed files with 17 additions and 15 deletions
  1. 8
      api/request.js
  2. 4
      pages/home/employee/index.js
  3. 15
      pages/login/index.js
  4. 3
      pages/message/index/index.wxml
  5. 2
      pages/process/index/index.wxml

8
api/request.js

@ -24,7 +24,6 @@ axios.interceptors.request.use(
return config return config
}, },
error => { error => {
// 做一些请求错误
console.error(error) console.error(error)
return Promise.reject(error) return Promise.reject(error)
} }
@ -46,7 +45,6 @@ axios.interceptors.response.use(
} }
}, },
(err) => { (err) => {
// 做一些请求错误
console.error(err) console.error(err)
return Promise.reject(err) return Promise.reject(err)
} }
@ -82,8 +80,12 @@ function handleResponse({ data, status }) {
return Promise.reject('服务器错误') return Promise.reject('服务器错误')
} }
} }
var message = '请求错误'
if (data.message) {
message = data.message
}
// 有状态码但不在这个封装的配置里,就直接返回错误 // 有状态码但不在这个封装的配置里,就直接返回错误
return STATUS[status] ? STATUS[status]() : Promise.reject('请求错误')
return STATUS[status] ? STATUS[status]() : Promise.reject(message)
} }
function handleResult(result) { function handleResult(result) {

4
pages/home/employee/index.js

@ -121,11 +121,9 @@ Page({
wx.showLoading({ title: '加载中', mask: true }) wx.showLoading({ title: '加载中', mask: true })
var item = this.data.checkList[event.currentTarget.dataset.index] var item = this.data.checkList[event.currentTarget.dataset.index]
auditEmploye({id: item.id, status: 2 }).then(result => { auditEmploye({id: item.id, status: 2 }).then(result => {
//成功回调
this.setData({ ['checkList[' + event.currentTarget.dataset.index + '].applicantStatus']: 2}) this.setData({ ['checkList[' + event.currentTarget.dataset.index + '].applicantStatus']: 2})
wx.hideLoading() wx.hideLoading()
}).catch(err => { }).catch(err => {
//异常回调
wx.hideLoading() wx.hideLoading()
util.showToast(err) util.showToast(err)
}) })
@ -136,7 +134,7 @@ Page({
addEmployee: function(event){ addEmployee: function(event){
wx.showLoading({ title: '加载中', mask: true }) wx.showLoading({ title: '加载中', mask: true })
const form = { id: 5 } const form = { id: 5 }
form.metaData = { factoryId: app.userInfo.enterpriseId, factoryName: app.userInfo.enterpriseName }
form.metaData = { factoryId: app.userInfo.factoryId, factoryName: app.userInfo.factoryName }
generateCode(form).then(result => { generateCode(form).then(result => {
this.setData({ showEmbedded: true, base64: result.data }) this.setData({ showEmbedded: true, base64: result.data })
wx.hideLoading() wx.hideLoading()

15
pages/login/index.js

@ -97,10 +97,10 @@ Page({
app.userInfo = result.data app.userInfo = result.data
app.globalData.token = authorization app.globalData.token = authorization
wx.hideLoading() wx.hideLoading()
if(app.userInfo.enterpriseId){
if(app.userInfo.factoryId){
storage.put('Authorization', app.globalData.token) storage.put('Authorization', app.globalData.token)
this.setData({ loging: false}) this.setData({ loging: false})
if(this.data.metaData && app.userInfo.enterpriseId != this.data.metaData.enterpriseId){
if(this.data.metaData && app.userInfo.factoryId != this.data.metaData.factoryId){
Dialog.alert({ title: '温馨提示', message: '您已经绑定过工厂了,现在就进入?' }).then(() => { Dialog.alert({ title: '温馨提示', message: '您已经绑定过工厂了,现在就进入?' }).then(() => {
wx.redirectTo({ url: '/pages/index/index' }) wx.redirectTo({ url: '/pages/index/index' })
}) })
@ -109,8 +109,11 @@ Page({
} }
} else if(this.data.metaData){ } else if(this.data.metaData){
// 这里要进行账号的绑定,对工厂进行绑定;或者进行申请操作; // 这里要进行账号的绑定,对工厂进行绑定;或者进行申请操作;
this.setData({ loging: false, metaData: this.data.metaData }) this.setData({ loging: false, metaData: this.data.metaData })
} else if(app.userInfo.applicationStatus == 0){
this.setData({ loging: false})
Dialog.alert({ title: '温馨提示', message: '您的申请还在审核中,如有疑问请联系管理员。' }).then(() => {
})
} else { } else {
this.setData({ loging: false}) this.setData({ loging: false})
Dialog.alert({ title: '温馨提示', message: '您还不是纸通宝SAAS用户,请联系工厂管理员,或者联系纸通宝客户人员。' }).then(() => { Dialog.alert({ title: '温馨提示', message: '您还不是纸通宝SAAS用户,请联系工厂管理员,或者联系纸通宝客户人员。' }).then(() => {
@ -122,7 +125,7 @@ Page({
util.showToast('获取用户信息失败,请注册登录') util.showToast('获取用户信息失败,请注册登录')
this.setData({ loging: false, regist: true}) this.setData({ loging: false, regist: true})
} else { } else {
util.showToast('请求错误')
util.showToast(err)
this.setData({ loging: false}) this.setData({ loging: false})
} }
config.header = null config.header = null
@ -289,8 +292,8 @@ Page({
bindingAdmin(this.data.metaData).then(result => { bindingAdmin(this.data.metaData).then(result => {
wx.hideLoading() wx.hideLoading()
storage.put('Authorization', app.globalData.token) storage.put('Authorization', app.globalData.token)
app.userInfo.enterpriseId = this.data.metaData.factoryId
app.userInfo.enterpriseName = this.data.metaData.factoryName
app.userInfo.factoryId = this.data.metaData.factoryId
app.userInfo.factoryName = this.data.metaData.factoryName
this.data.metaData = null this.data.metaData = null
this.setData({loging: false}) this.setData({loging: false})
wx.redirectTo({ url: '/pages/index/index' }) wx.redirectTo({ url: '/pages/index/index' })

3
pages/message/index/index.wxml

@ -1,7 +1,6 @@
<!--pages/mall/index/index.wxml--> <!--pages/mall/index/index.wxml-->
<cu-custom bgColor="bg-white"> <cu-custom bgColor="bg-white">
<view slot="right" class="text-cut text-black text-xl margin-l" wx:if="{{userInfo.enterpriseName}}">{{userInfo.enterpriseName}}</view>
<view slot="content" style="color:black;font-size:36rpx" wx:else>消息</view>
<view slot="content" style="color:black;font-size:36rpx">消息</view>
</cu-custom> </cu-custom>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchOrderList"> <refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchOrderList">

2
pages/process/index/index.wxml

@ -7,7 +7,7 @@
<view style="height:250rpx;background-color:#008AFF;border-radius: 0rpx 0rpx 12rpx 12rpx;"> <view style="height:250rpx;background-color:#008AFF;border-radius: 0rpx 0rpx 12rpx 12rpx;">
<view class="flex flex-center" style="padding:32rpx 28rpx;justify-content: flex-start"> <view class="flex flex-center" style="padding:32rpx 28rpx;justify-content: flex-start">
<image style="width:100rpx;height:100rpx" src="/assets/image/icon_logo.png"></image> <image style="width:100rpx;height:100rpx" src="/assets/image/icon_logo.png"></image>
<view class="text-xxl text-bold" style="color:white;margin-left:32rpx">{{userInfo.enterpriseName}}</view>
<view class="text-xxl text-bold" style="color:white;margin-left:32rpx">{{userInfo.factoryName}}</view>
</view> </view>
</view> </view>

Loading…
Cancel
Save