From 71ddf0210cc4ad857bdc33a952d8f0334302307e Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Sat, 7 Nov 2026 01:03:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=BB=BA=E7=BE=8E?= =?UTF-8?q?=E7=94=B2=E5=B8=88=E5=90=8E=E6=97=A5=E7=A8=8B=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9C=AA=E5=8D=B3=E6=97=B6=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/employee-create/index.js | 3 +++ JC-Salon-WeChat/pages/employee-create/index.test.js | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/JC-Salon-WeChat/pages/employee-create/index.js b/JC-Salon-WeChat/pages/employee-create/index.js index 86be3fc0..7fd169e1 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.js +++ b/JC-Salon-WeChat/pages/employee-create/index.js @@ -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) { diff --git a/JC-Salon-WeChat/pages/employee-create/index.test.js b/JC-Salon-WeChat/pages/employee-create/index.test.js index 1d3c0971..32c506fd 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.test.js +++ b/JC-Salon-WeChat/pages/employee-create/index.test.js @@ -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