@uxda/appkit 1.2.44 → 1.2.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import Taro, { useDidShow } from '@tarojs/taro';
3
3
  import '@nutui/nutui-taro';
4
4
  import dayjs from 'dayjs';
5
5
  import groupBy from 'lodash/groupBy';
6
+ import debounce from 'lodash/debounce';
6
7
 
7
8
  const _hoisted_1$n = { class: "token-line number" };
8
9
  const _hoisted_2$j = { class: "number" };
@@ -3796,8 +3797,8 @@ var script = /* @__PURE__ */ defineComponent({
3796
3797
  setup(__props, { emit: __emit }) {
3797
3798
  const props = __props;
3798
3799
  const safeArea = useSafeArea();
3799
- const loginRule = ref({});
3800
3800
  const showLoginRule = ref(false);
3801
+ const loginRuleTip = ref("");
3801
3802
  const style = computed(() => {
3802
3803
  let str = "";
3803
3804
  if (props.withTabbar) {
@@ -3811,7 +3812,10 @@ var script = /* @__PURE__ */ defineComponent({
3811
3812
  onMounted(() => {
3812
3813
  checkLoginTimeRule();
3813
3814
  });
3814
- async function checkLoginTimeRule() {
3815
+ useDidShow(() => {
3816
+ checkLoginTimeRule();
3817
+ });
3818
+ const checkLoginTimeRule = debounce(() => {
3815
3819
  const appkitOptions = useAppKitOptions();
3816
3820
  const $http = useHttp();
3817
3821
  $http.post("/cas/sysUser/checkLoginTimeRule", {
@@ -3821,20 +3825,11 @@ var script = /* @__PURE__ */ defineComponent({
3821
3825
  }).then((result) => {
3822
3826
  if (result === true)
3823
3827
  return;
3824
- getLoginRule();
3828
+ loginRuleTip.value = result.message;
3825
3829
  showLoginRule.value = true;
3830
+ emits("show", loginRuleTip.value);
3826
3831
  });
3827
- }
3828
- async function getLoginRule() {
3829
- const appkitOptions = useAppKitOptions();
3830
- const $http = useHttp();
3831
- $http.get("/cas/sysUser/getLoginRule", {
3832
- appCode: props.app || appkitOptions.app()
3833
- }).then((result) => {
3834
- loginRule.value = result;
3835
- emits("show", { startTime: loginRule.value.startTime, endTime: loginRule.value.endTime });
3836
- });
3837
- }
3832
+ }, 100);
3838
3833
  const emits = __emit;
3839
3834
  return (_ctx, _cache) => {
3840
3835
  return _ctx.show && showLoginRule.value ? (openBlock(), createElementBlock(
@@ -3849,7 +3844,7 @@ var script = /* @__PURE__ */ defineComponent({
3849
3844
  createElementVNode(
3850
3845
  "div",
3851
3846
  _hoisted_2,
3852
- " \u4EC5\u53EF\u5728\u5DE5\u4F5C\u65E5" + toDisplayString(loginRule.value.startTime) + "-" + toDisplayString(loginRule.value.endTime) + "\u8FDB\u884C\u4E1A\u52A1\u64CD\u4F5C ",
3847
+ toDisplayString(loginRuleTip.value),
3853
3848
  1
3854
3849
  /* TEXT */
3855
3850
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "1.2.44",
3
+ "version": "1.2.48",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -5,16 +5,18 @@
5
5
  src="https://cdn.ddjf.com/static/images/nutshell/empty-permission.png"
6
6
  />
7
7
  <div class="login-setting-text">
8
- 仅可在工作日{{ loginRule.startTime }}-{{ loginRule.endTime }}进行业务操作
8
+ {{ loginRuleTip }}
9
9
  </div>
10
10
  </div>
11
11
  </template>
12
12
 
13
13
  <script lang="ts" setup>
14
- import { computed, onMounted, ref } from 'vue'
14
+ import { computed, ref, onMounted } from 'vue'
15
15
  import { useHttp } from '../api'
16
16
  import { useAppKitOptions } from '../../Appkit'
17
17
  import { useSafeArea } from '../../shared/composables'
18
+ import { useDidShow } from '@tarojs/taro'
19
+ import debounce from 'lodash/debounce'
18
20
 
19
21
  const props = withDefaults(
20
22
  defineProps<{
@@ -32,8 +34,8 @@ const props = withDefaults(
32
34
  )
33
35
 
34
36
  const safeArea = useSafeArea()
35
- const loginRule = ref<any>({})
36
37
  const showLoginRule = ref<boolean>(false)
38
+ const loginRuleTip = ref('')
37
39
 
38
40
  const style = computed(() => {
39
41
  let str = ''
@@ -49,9 +51,12 @@ const style = computed(() => {
49
51
  onMounted(() => {
50
52
  checkLoginTimeRule()
51
53
  })
54
+ useDidShow(() => {
55
+ checkLoginTimeRule()
56
+ })
52
57
 
53
58
  // 检验登录时间
54
- async function checkLoginTimeRule() {
59
+ const checkLoginTimeRule = debounce(() => {
55
60
  const appkitOptions = useAppKitOptions()
56
61
 
57
62
  const $http = useHttp()
@@ -64,26 +69,13 @@ async function checkLoginTimeRule() {
64
69
  .then((result: any) => {
65
70
  if (result === true) return
66
71
 
67
- getLoginRule()
68
- showLoginRule.value = true
69
- })
70
- }
71
-
72
- // 查询当前租户登录规则
73
- async function getLoginRule() {
74
- const appkitOptions = useAppKitOptions()
72
+ loginRuleTip.value = result.message
75
73
 
76
- const $http = useHttp()
77
- $http
78
- .get('/cas/sysUser/getLoginRule', {
79
- appCode: props.app || appkitOptions.app(),
80
- })
81
- .then((result) => {
82
- loginRule.value = result
74
+ showLoginRule.value = true
83
75
 
84
- emits('show', { startTime: loginRule.value.startTime, endTime: loginRule.value.endTime })
76
+ emits('show', loginRuleTip.value)
85
77
  })
86
- }
78
+ }, 100)
87
79
 
88
80
  // 父组件事件
89
81
  const emits = defineEmits(['show'])