This commit is contained in:
@@ -2,6 +2,7 @@ const employeesApi = require('../../api/employees')
|
||||
const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload')
|
||||
const { showErrorToast, toUserMessage } = require('../../utils/toast')
|
||||
const { showActionModal } = require('../../utils/action-modal')
|
||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||
|
||||
const EMPLOYEE_COLORS = ['#7BA7C7', '#8FB89A', '#A894C7', '#D7A86E', '#D98DA5', '#79A6A3', '#B9A16B', '#9BA9C8']
|
||||
const COLOR_WHEEL_RADIUS = 110
|
||||
@@ -313,6 +314,7 @@ Page({
|
||||
avatar: form.avatar || undefined
|
||||
})
|
||||
const id = saved && typeof saved === 'object' ? (saved.userId || saved.id) : this.data.selectedWechatUserId
|
||||
markPlanningRefresh()
|
||||
this.setData({
|
||||
createdEmployee: { id, name: nickname, title: nickname, avatar: form.avatar || '' },
|
||||
applicationApproved: false
|
||||
@@ -348,6 +350,7 @@ Page({
|
||||
}
|
||||
const result = await employeesApi.createUser(payload)
|
||||
const id = result && typeof result === 'object' ? (result.id || result.userId) : result
|
||||
markPlanningRefresh()
|
||||
const employee = { id, name: nickname, title: nickname, avatar: form.avatar || '' }
|
||||
this.setData({ createdEmployee: employee, applicationApproved: false })
|
||||
if (this.data.applicationId) {
|
||||
|
||||
@@ -4,14 +4,20 @@ const employeesApi = require('../../api/employees')
|
||||
let navigatedBack = false
|
||||
let navigatedTo = ''
|
||||
let modalConfirm = false
|
||||
const storage = {}
|
||||
const app = { globalData: {} }
|
||||
global.wx = {
|
||||
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
||||
getDeviceInfo: () => ({ platform: 'devtools' }),
|
||||
showToast: () => {},
|
||||
showModal: options => options.success({ confirm: modalConfirm }),
|
||||
navigateBack: () => { navigatedBack = true },
|
||||
navigateTo: options => { navigatedTo = options.url }
|
||||
navigateTo: options => { navigatedTo = options.url },
|
||||
setStorageSync: (key, value) => { storage[key] = value },
|
||||
getStorageSync: key => storage[key]
|
||||
}
|
||||
global.getApp = () => app
|
||||
global.getCurrentPages = () => []
|
||||
global.setTimeout = callback => { callback(); return 1 }
|
||||
|
||||
let definition
|
||||
@@ -65,6 +71,8 @@ async function run() {
|
||||
})
|
||||
assert.strictEqual(page.data.onboardingVisible, true)
|
||||
assert.strictEqual(emitted, undefined)
|
||||
assert.strictEqual(app.globalData.planningNeedRefresh, true)
|
||||
assert.strictEqual(storage.planningNeedRefresh, '1')
|
||||
|
||||
let schedulePayload
|
||||
page.data.pickerMode = true
|
||||
|
||||
Reference in New Issue
Block a user