iZaiZaiA 2 years ago
parent
commit
53d39db765

+ 0 - 1
package.json

@@ -17,7 +17,6 @@
         "js-cookie": "^3.0.1",
         "js-md5": "^0.7.3",
         "js-web-screen-shot": "^1.7.3",
-        "moment": "^2.29.4",
         "nprogress": "^0.2.0",
         "pinia": "^2.0.22",
         "remixicon": "^2.5.0",

+ 73 - 27
src/components/dateCalendar/index.vue

@@ -9,12 +9,12 @@
                     <i class="hcicon-return"/>
                 </div>
                 <div class="hc-date-month-year">
-                    <n-popselect v-model:value="selectedDate.year" :options="yearOptions" size="large" trigger="click" scrollable @update:value="popselectYear">
+                    <!--n-popselect v-model:value="selectedDate.year" :options="yearOptions" size="large" trigger="click" scrollable @update:value="popselectYear">
                         <div class="date-year">{{selectedDate.year}}年</div>
                     </n-popselect>
                     <n-popselect v-model:value="selectedDate.month" :options="monthOptions" size="large" trigger="click" scrollable @update:value="popselectMonth">
                         <div class="date-month">{{selectedDate.month}}月</div>
-                    </n-popselect>
+                    </n-popselect-->
                 </div>
                 <div class="hc-date-month" @click="nextMonthClick">
                     <i class="hcicon-enter"/>
@@ -33,7 +33,7 @@
             </div>
             <div class="hc-date-actions">
                 <div class="choice-date">{{choiceDate.year}}-{{choiceDate.month}}-{{choiceDate.date}}</div>
-                <n-button size="small" @click="backToDay">回到今天</n-button>
+                <!--n-button size="small" @click="backToDay">回到今天</n-button-->
             </div>
         </div>
     </div>
@@ -41,7 +41,7 @@
 
 <script setup>
 import { ref } from "vue";
-import moment from 'moment';
+import dayjs from "dayjs"
 const props = defineProps({
     ui: {
         type: String,
@@ -54,25 +54,25 @@ const curDateData = ref([]) //设置的日期
 const datesDay = ref([])    //日期数据
 //选择年月的日期
 const selectedDate = ref({
-    year: moment().get('year'),
-    month: moment().get('month') +1
+    year: dayjs().get('year'),
+    month: dayjs().get('month') +1
 })
 //选择的日期,年月日
 const choiceDate = ref({
-    year: moment().get('year'),
-    month: moment().get('month') +1,
-    date: moment().get('date')
+    year: dayjs().get('year'),
+    month: dayjs().get('month') +1,
+    date: dayjs().get('date')
 })
 
 //处理设置的日期
 const setCurDateData = (dateData) => {
     let curData = [];
     for (let i = 0; i < dateData.length; i++) {
-        let toDate = moment(dateData[i].date, "YYYY-MM-DD").format("YYYY-MM-DD");
+        let toDate = dayjs(dateData[i].date, "YYYY-MM-DD").format("YYYY-MM-DD");
         curData.push({
-            year: moment(toDate).get('year'),
-            month: moment(toDate).get('month')+1,
-            date: moment(toDate).get('date')
+            year: dayjs(toDate).get('year'),
+            month: dayjs(toDate).get('month')+1,
+            date: dayjs(toDate).get('date')
         })
     }
     curDateData.value = curData;
@@ -115,15 +115,15 @@ setCurDateData(dateData)
 //获取日期
 const getDatesDay = (year,month) => {
     if (year && month) {
-        let toDate = moment(year + '-' + month, "YYYY-MM").format("YYYY-MM-DD"); //格式化一下先
-        let days = moment(toDate).daysInMonth(); //天数
-        let monthOneDay = moment(toDate).startOf("month").format("YYYY-MM-DD"); //获取当月第一天
-        let weekday = moment(monthOneDay, "YYYY-MM-DD").get('weekday'); //获取当月第一天是星期几
+        let toDate = dayjs(year + '-' + month, "YYYY-MM").format("YYYY-MM-DD"); //格式化一下先
+        let days = momedayjsnt(toDate).daysInMonth(); //天数
+        let monthOneDay = dayjs(toDate).startOf("month").format("YYYY-MM-DD"); //获取当月第一天
+        let weekday = dayjs(monthOneDay, "YYYY-MM-DD").get('weekday'); //获取当月第一天是星期几
         setDatesDay(days,weekday)
     } else {
-        let days = moment().daysInMonth(); //天数
-        let monthOneDay = moment().startOf("month").format("YYYY-MM-DD"); //获取当月第一天
-        let weekday = moment(monthOneDay, "YYYY-MM-DD").get('weekday'); //获取当月第一天是星期几
+        let days = dayjs().daysInMonth(); //天数
+        let monthOneDay = dayjs().startOf("month").format("YYYY-MM-DD"); //获取当月第一天
+        let weekday = dayjs(monthOneDay, "YYYY-MM-DD").get('weekday'); //获取当月第一天是星期几
         setDatesDay(days,weekday)
     }
 }
@@ -134,9 +134,9 @@ const setDatesDay = (days,weekday) => {
     const selected = selectedDate.value; //选择的日期
     const choiceData = choiceDate.value; //选择的日期
     const dayData = {
-        year: moment().get('year'),
-        month: moment().get('month') +1,
-        date: moment().get('date')
+        year: dayjs().get('year'),
+        month: dayjs().get('month') +1,
+        date: dayjs().get('date')
     }
     //添加头部
     for (let i = 0; i < weekday; i++) {
@@ -229,15 +229,61 @@ const datesDayClick = (item) => {
     let {year,month} = selectedDate.value
     choiceDate.value = {year: year, month: month, date: item.key}
     getDatesDay(year,month)
+    backChoiceDate()
+}
+
+const zpadStart = (val,leng,pad) => {
+    val += ''
+    while (val.length < leng) {
+        val = pad + val
+    }
+    return val
+}
+
+//事件
+const emit = defineEmits(['choice-date'])
+
+//返回选择的日期
+const backChoiceDate = () => {
+    //选择的日期处理
+    const {year,month,date} = choiceDate.value
+    let months = zpadStart(month, 2, '0')
+    let dates = zpadStart(date, 2, '0')
+    const choice = {year: year, month: months, date: dates}
+    const choiceVal = year + months + dates
+    //今天的日期处理
+    const dayData = {
+        year: dayjs().get('year'),
+        month: zpadStart(dayjs().get('month') + 1, 2, '0'),
+        date: zpadStart(dayjs().get('date'), 2, '0')
+    }
+    const today = dayData.year + dayData.month + dayData.date
+    //判断处理
+    if (choiceVal > today) {
+        backToDay(false)
+    } else {
+        emit('choice-date', {date: choice, choice: choiceVal})
+    }
 }
+
 //回到今天
-const backToDay = () => {
-    const year = moment().get('year');
-    const month = moment().get('month') + 1;
-    const date = moment().get('date');
+const backToDay = (isEmit = true) => {
+    const year = dayjs().get('year');
+    const month = dayjs().get('month') + 1;
+    const date = dayjs().get('date');
     selectedDate.value = {year: year, month: month}
     choiceDate.value = {year: year, month: month, date: date}
     getDatesDay(year,month)
+    if (isEmit) {
+        //今天的日期
+        const today = {
+            year: year,
+            month: zpadStart(month, 2, '0'),
+            date: zpadStart(date, 2, '0')
+        }
+        const choice = today.year + today.month + today.date
+        emit('choice-date', {date: today, choice})
+    }
 }
 </script>
 

+ 0 - 172
src/components/hc-sb-table/index.vue

@@ -1,172 +0,0 @@
-<template>
-    <div class="hc-sb-table">
-        <svg class="svg-tabs" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="40px" height="45px">
-            <clipPath id="tabs">
-                <path fill-rule="evenodd" d="M40,45C15,36,33,0,0,0v45H40z"/>
-            </clipPath>
-        </svg>
-        <el-tabs v-model="curKey" :class="curIndex === 0 ? 'first' : curIndex === datas.length-1 ? 'fourth' : ''" @tab-change="tabClick">
-            <el-tab-pane v-for="item in datas" :label="item.label" :name="item.key">
-                <template #label>
-                    <HcIcon :name="item.icon" class="icon" v-if="item.icon"/>
-                    <span class="name">{{item.label}}</span>
-                </template>
-                <slot :name='`tab-${item.key}`'/>
-            </el-tab-pane>
-        </el-tabs>
-    </div>
-</template>
-
-<script setup>
-import {nextTick, ref, watch} from "vue";
-import {getIndex} from "vue-utils-plus"
-const props = defineProps({
-    datas: {
-        type: Array,
-        default: () => []
-    },
-    cur: {
-        type: [String,Number],
-        default: ''
-    }
-})
-
-//初始变量
-const curKey = ref(props.cur)
-const curIndex = ref(0)
-
-//监听
-watch(() => [
-    props.cur,
-    props.datas
-], ([cur, datas]) => {
-    curKey.value = cur
-    getCurIndex(datas, cur)
-})
-
-//挂载完成
-nextTick(() => {
-    getCurIndex(props.datas, props.cur)
-})
-
-//获取索引
-const getCurIndex = (datas,key) => {
-    curIndex.value = getIndex(datas, 'key', key)
-}
-
-//事件
-const emit = defineEmits(['tabClick'])
-const tabClick = (key) => {
-    curKey.value = key;
-    getCurIndex(props.datas, key)
-    emit('tabClick', key)
-}
-</script>
-
-<style lang="scss" scoped>
-.hc-sb-table {
-    position: relative;
-    height: 100%;
-    .svg-tabs {
-        opacity: 0;
-        width: 0;
-        height: 0;
-    }
-}
-</style>
-
-<style lang="scss">
-.hc-sb-table .el-tabs {
-    position: relative;
-    margin-top: -18px;
-    height: 100%;
-    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.1));
-    .el-tabs__header {
-        margin-bottom: 0;
-        .el-tabs__nav-wrap::after {
-            background-color: transparent;
-        }
-        .el-tabs__nav {
-            height: 45px;
-            .el-tabs__item {
-                margin-top: 5px;
-                padding: 0 20px;
-                user-select: none;
-                display: inline-flex;
-                align-content: center;
-                --el-text-color-primary: #838791;
-                background-color: #E5EBEF;
-                &::after {
-                    content: '';
-                    position: absolute;
-                    width: 1px;
-                    height: 15px;
-                    background-color: #CCCCCC;
-                    top: 12px;
-                    left: 0;
-                }
-                .hc-icon-i {
-                    margin-right: 5px;
-                }
-                .hc-icon-i, .name {
-                    position: relative;
-                    z-index: 10;
-                }
-            }
-            .el-tabs__item:nth-child(2) {
-                border-radius: 10px 0 0 0;
-                &::after {
-                    display: none;
-                }
-            }
-            .el-tabs__item:last-child {
-                border-radius: 0 10px 0 0;
-            }
-        }
-    }
-    .el-tabs__content {
-        padding: 0;
-        background: #f1f5f8;
-        border-radius: 0 10px 10px 10px;
-        height: calc(100% - 46px);
-    }
-    .el-tabs__active-bar {
-        position: absolute;
-        height: 45px;
-        background: #f1f5f8;
-        &::after,
-        &::before {
-            content: '';
-            background: #f1f5f8;
-            width: 40px;
-            position: absolute;
-            height: 45px;
-            top: 0px;
-            clip-path: url(#tabs);
-            right: -40px;
-        }
-        &::before {
-            left:-40px;
-            right: auto;
-            // 水平翻转
-            transform: scaleX(-1);
-        }
-    }
-    &.first .el-tabs__active-bar {
-        &::before {
-            transform: scaleX(1);
-            left: -20px;
-            clip-path: none;
-            border-radius: 15px 0 0 0;
-        }
-    }
-    &.fourth .el-tabs__active-bar {
-        &::after {
-            transform: scaleX(-1);
-            right: -20px;
-            clip-path: none;
-            border-radius: 15px 0 0 0;
-        }
-    }
-}
-</style>

+ 0 - 156
src/components/modal/SMSAuth.vue

@@ -1,156 +0,0 @@
-<template>
-    <n-modal v-model:show="showModal" :mask-closable="false">
-        <n-card class="w-414" title="短信认证" :segmented="{content: true}">
-            <n-form ref="reportFormRef" :model="reportModel" :rules="reportRules" label-placement="left" label-width="auto" size="large">
-                <n-form-item label="手机号码">
-                    <n-input v-model:value="phoneVal" placeholder="手机号码" disabled/>
-                </n-form-item>
-                <n-form-item label="验证码" path="code">
-                    <n-input-group>
-                        <n-input v-model:value="reportModel.code" placeholder="请输入验证码"/>
-                        <n-button type="primary" @click="getCodeClick" :disabled="isDisabled">
-                            {{isDisabled ? '倒计时' + currentTime + 's' : '获取验证码'}}
-                        </n-button>
-                    </n-input-group>
-                </n-form-item>
-            </n-form>
-            <template #action>
-                <div class="flex justify-center items-center">
-                    <n-button size="large" class="px-6" @click="cancelClick">取消</n-button>
-                    <n-button type="primary" size="large" class="px-6 ml-4" :loading="isLoading" @click="confirmClick">确认</n-button>
-                </div>
-            </template>
-        </n-card>
-    </n-modal>
-</template>
-
-<script setup>
-import {ref, watch} from "vue"
-import {useAppStore} from "~src/store/index";
-import {sendNotice} from '~api/other';
-import config from '~src/config/index';
-
-const props = defineProps({
-    show: {
-        type: Boolean,
-        default: false
-    },
-    loading: {
-        type: Boolean,
-        default: false
-    },
-})
-
-//变量
-const userStore = useAppStore()
-const userInfo = ref(userStore.getUserInfo);
-const phoneVal = ref(config.smsPhone + '' || userInfo.value.phone + '')
-const showModal = ref(props.show)
-const isLoading = ref(props.loading)
-
-//监听
-watch(() => [
-    props.show,
-    props.loading,
-    userStore.getUserInfo
-], ([show,  loading, user]) => {
-    userInfo.value = user
-    showModal.value = show
-    isLoading.value = loading
-})
-
-//返回的验证码
-const resCode = ref('')
-//表单
-const reportFormRef = ref(null)
-const reportModel = ref({code: null})
-const reportRules = ref({
-    code: {
-        required: true,
-        validator(rule, value) {
-            const code = resCode.value
-            if (!code) {
-                return new Error("请先获取验证码");
-            } else if (!value) {
-                return new Error("请输入验证码");
-            } else if (code !== value) {
-                return new Error("验证码错误");
-            }
-            return true;
-        },
-        trigger: ["blur", "change"]
-    }
-})
-
-
-//短信验证码
-const isDisabled = ref(false)   //是否开启倒计时
-const totalTime = 60                  //总时间,单位秒
-const recordingTime = ref(0)    //记录时间变量
-const currentTime = ref(0)      //显示时间变量
-
-//获取短信验证码
-const getCodeClick = () => {
-    sendNotice({
-        phone: phoneVal.value
-    }).then(({data}) => {
-        if (data.code === 200) {
-            resCode.value = data.msg
-            window?.$message?.success('发送成功')
-            //把显示时间设为总时间
-            currentTime.value = totalTime
-            //开始倒计时
-            isDisabled.value = true
-            //执行倒计时
-            checkingTime();
-        }else {
-            resCode.value = ''
-        }
-    })
-}
-
-//倒计时
-const checkingTime = () => {
-    //判断是否开启
-    if (isDisabled.value) {
-        //判断显示时间是否已到0,判断记录时间是否已到总时间
-        if (currentTime.value > 0 && recordingTime.value <= totalTime) {
-            //记录时间增加 1
-            recordingTime.value ++;
-            //显示时间,用总时间 - 记录时间
-            currentTime.value = totalTime - recordingTime.value;
-            //1秒钟后,再次执行本方法
-            setTimeout(() => {
-                checkingTime();
-            }, 1000)
-        } else {
-            //时间已完成,还原相关变量
-            isDisabled.value = false;		//关闭倒计时
-            recordingTime.value = 0;	//记录时间为0
-            currentTime.value = totalTime;	//显示时间为总时间
-        }
-    } else {
-        //倒计时未开启,初始化默认变量
-        isDisabled.value = false;
-        recordingTime.value = 0;
-        currentTime.value = totalTime;
-    }
-}
-
-//事件
-const emit = defineEmits(['cancel', 'confirm'])
-
-//取消
-const cancelClick = () => {
-    emit('cancel')
-}
-
-//确认
-const confirmClick = () => {
-    reportFormRef.value?.validate((errors) => {
-        if (!errors) {
-            emit('confirm')
-        }
-    })
-}
-</script>

+ 1 - 0
src/views/home/config.vue

@@ -161,6 +161,7 @@ const ThemeTabsUpdate = (val) => {
 //更改首页主题
 const homeConfigData = ref(themeData.home)
 const homeConfigClick = (item) => {
+    HomeTheme.value = item
     useAppState.setHomeTheme(item)
 }
 

+ 5 - 1
src/views/user/index.vue

@@ -141,7 +141,11 @@
                         </div>
                     </div>
                 </template>
-                <HcTable :column="logTableColumn" :datas="logTableData" :loading="logTableLoading"/>
+                <HcTable :column="logTableColumn" :datas="logTableData" :loading="logTableLoading">
+                    <template #operationContent="{row}">
+                        <div class="text-link" @click="tableOperationContent(row)">{{row?.operationContent}}</div>
+                    </template>
+                </HcTable>
                 <template #action>
                     <HcPages :pages="searchLogForm" @change="pageLogChange"/>
                 </template>

+ 0 - 5
yarn.lock

@@ -846,11 +846,6 @@ mlly@^0.5.13, mlly@^0.5.7:
     pkg-types "^0.3.4"
     ufo "^0.8.5"
 
-moment@^2.29.4:
-  version "2.29.4"
-  resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
-  integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
-
 ms@2.1.2:
   version "2.1.2"
   resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"