diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 15e57ff2..05c70dad 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -70,6 +70,23 @@ export const getDictObj = (dictType: string, value: any) => { }) } +/** + * 获得字典数据的文本展示 + * + * @param dictType 字典类型 + * @param value 字典数据的值 + */ +export const getDictLabel = (dictType: string, value: any) => { + const dictOptions: DictDataType[] = getDictOptions(dictType) + const dictLabel = ref('') + dictOptions.forEach((dict: DictDataType) => { + if (dict.value === value) { + dictLabel.value = dict.label + } + }) + return dictLabel.value +} + export enum DICT_TYPE { USER_TYPE = 'user_type', COMMON_STATUS = 'common_status', @@ -123,5 +140,9 @@ export enum DICT_TYPE { PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态 PAY_ORDER_REFUND_STATUS = 'pay_order_refund_status', // 商户支付订单退款状态 PAY_REFUND_ORDER_STATUS = 'pay_refund_order_status', // 退款订单状态 - PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type' // 退款订单类别 + PAY_REFUND_ORDER_TYPE = 'pay_refund_order_type', // 退款订单类别 + + // ========== MP 模块 ========== + MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型 + MP_MESSAGE_TYPE = 'mp_message_type' // 消息类型 } diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index 2582beee..ec7f3744 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -11,10 +11,65 @@ import dayjs from 'dayjs' * @description format 季度 + 星期 + 几周:"YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ" * @returns 返回拼接后的时间字符串 */ -export function formatDate(date: Date, format: string): string { +export function formatDate(date: Date, format?: string): string { + // 日期不存在,则返回空 + if (!date) { + return '' + } + // 日期存在,则进行格式化 + if (format === undefined) { + format = 'YYYY-MM-DD HH:mm:ss' + } return dayjs(date).format(format) } +// TODO 芋艿:稍后去掉 +// 日期格式化 +export function parseTime(time: any, pattern?: string) { + if (arguments.length === 0 || !time) { + return null + } + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if (typeof time === 'string' && /^[0-9]+$/.test(time)) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time + .replace(new RegExp(/-/gm), '/') + .replace('T', ' ') + .replace(new RegExp(/\.\d{3}/gm), '') + } + if (typeof time === 'number' && time.toString().length === 10) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { + return ['日', '一', '二', '三', '四', '五', '六'][value] + } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} + /** * 获取当前日期是第几周 * @param dateTime 当前传入的日期值 diff --git a/src/views/mp/components/img.png b/src/views/mp/components/img.png new file mode 100644 index 00000000..c25a6e76 Binary files /dev/null and b/src/views/mp/components/img.png differ diff --git a/src/views/mp/components/wx-location/main.vue b/src/views/mp/components/wx-location/main.vue new file mode 100644 index 00000000..c0d67e29 --- /dev/null +++ b/src/views/mp/components/wx-location/main.vue @@ -0,0 +1,72 @@ + + + + diff --git a/src/views/mp/components/wx-msg/card.scss b/src/views/mp/components/wx-msg/card.scss new file mode 100644 index 00000000..67ac9219 --- /dev/null +++ b/src/views/mp/components/wx-msg/card.scss @@ -0,0 +1,101 @@ +.avue-card{ + &__item{ + margin-bottom: 16px; + border: 1px solid #e8e8e8; + background-color: #fff; + box-sizing: border-box; + color: rgba(0,0,0,.65); + font-size: 14px; + font-variant: tabular-nums; + line-height: 1.5; + list-style: none; + font-feature-settings: "tnum"; + cursor: pointer; + height:200px; + &:hover{ + border-color: rgba(0,0,0,.09); + box-shadow: 0 2px 8px rgba(0,0,0,.09); + } + &--add{ + border:1px dashed #000; + width: 100%; + color: rgba(0,0,0,.45); + background-color: #fff; + border-color: #d9d9d9; + border-radius: 2px; + display: flex; + align-items: center; + justify-content: center; + font-size: 16px; + i{ + margin-right: 10px; + } + &:hover{ + color: #40a9ff; + background-color: #fff; + border-color: #40a9ff; + } + } + } + &__body{ + display: flex; + padding: 24px; + } + &__detail{ + flex:1 + } + &__avatar{ + width: 48px; + height: 48px; + border-radius: 48px; + overflow: hidden; + margin-right: 12px; + img{ + width: 100%; + height: 100%; + } + } + &__title{ + color: rgba(0,0,0,.85); + margin-bottom: 12px; + font-size: 16px; + &:hover{ + color:#1890ff; + } + } + &__info{ + color: rgba(0,0,0,.45); + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; + overflow: hidden; + height: 64px; + } + &__menu{ + display: flex; + justify-content:space-around; + height: 50px; + background: #f7f9fa; + color: rgba(0,0,0,.45); + text-align: center; + line-height: 50px; + &:hover{ + color:#1890ff; + } + } +} + +/** joolun 额外加的 */ +.avue-comment__main { + flex: unset!important; + border-radius: 5px!important; + margin: 0 8px!important; +} +.avue-comment__header { + border-top-left-radius: 5px; + border-top-right-radius: 5px; +} +.avue-comment__body { + border-bottom-right-radius: 5px; + border-bottom-left-radius: 5px; +} diff --git a/src/views/mp/components/wx-msg/comment.scss b/src/views/mp/components/wx-msg/comment.scss new file mode 100644 index 00000000..3f1341b2 --- /dev/null +++ b/src/views/mp/components/wx-msg/comment.scss @@ -0,0 +1,88 @@ +/* 来自 https://github.com/nmxiaowei/avue/blob/master/styles/src/element-ui/comment.scss */ +.avue-comment{ + margin-bottom: 30px; + display: flex; + align-items: flex-start; + &--reverse{ + flex-direction:row-reverse; + .avue-comment__main{ + &:before,&:after{ + left: auto; + right: -8px; + border-width: 8px 0 8px 8px; + } + &:before{ + border-left-color: #dedede; + } + &:after{ + border-left-color: #f8f8f8; + margin-right: 1px; + margin-left: auto; + } + } + } + &__avatar{ + width: 48px; + height: 48px; + border-radius: 50%; + border: 1px solid transparent; + box-sizing: border-box; + vertical-align: middle; + } + &__header{ + padding: 5px 15px; + background: #f8f8f8; + border-bottom: 1px solid #eee; + display: flex; + align-items: center; + justify-content: space-between; + } + &__author{ + font-weight: 700; + font-size: 14px; + color: #999; + } + &__main{ + flex:1; + margin: 0 20px; + position: relative; + border: 1px solid #dedede; + border-radius: 2px; + &:before,&:after{ + position: absolute; + top: 10px; + left: -8px; + right: 100%; + width: 0; + height: 0; + display: block; + content: " "; + border-color: transparent; + border-style: solid solid outset; + border-width: 8px 8px 8px 0; + pointer-events: none; + } + &:before { + border-right-color: #dedede; + z-index: 1; + } + &:after{ + border-right-color: #f8f8f8; + margin-left: 1px; + z-index: 2; + } + } + &__body{ + padding: 15px; + overflow: hidden; + background: #fff; + font-family: Segoe UI,Lucida Grande,Helvetica,Arial,Microsoft YaHei,FreeSans,Arimo,Droid Sans,wenquanyi micro hei,Hiragino Sans GB,Hiragino Sans GB W3,FontAwesome,sans-serif;color: #333; + font-size: 14px; + } + blockquote{ + margin:0; + font-family: Georgia,Times New Roman,Times,Kai,Kaiti SC,KaiTi,BiauKai,FontAwesome,serif; + padding: 1px 0 1px 15px; + border-left: 4px solid #ddd; + } +} diff --git a/src/views/mp/components/wx-msg/main.vue b/src/views/mp/components/wx-msg/main.vue new file mode 100644 index 00000000..b514a73e --- /dev/null +++ b/src/views/mp/components/wx-msg/main.vue @@ -0,0 +1,338 @@ + + + + + diff --git a/src/views/mp/components/wx-music/main.vue b/src/views/mp/components/wx-music/main.vue new file mode 100644 index 00000000..52555f15 --- /dev/null +++ b/src/views/mp/components/wx-music/main.vue @@ -0,0 +1,60 @@ + + + + + + diff --git a/src/views/mp/components/wx-news/main.vue b/src/views/mp/components/wx-news/main.vue new file mode 100644 index 00000000..d08e2813 --- /dev/null +++ b/src/views/mp/components/wx-news/main.vue @@ -0,0 +1,107 @@ + + + + + + diff --git a/src/views/mp/components/wx-reply/main.vue b/src/views/mp/components/wx-reply/main.vue new file mode 100644 index 00000000..57a3cd84 --- /dev/null +++ b/src/views/mp/components/wx-reply/main.vue @@ -0,0 +1,634 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/mp/components/wx-video-play/main.vue b/src/views/mp/components/wx-video-play/main.vue new file mode 100644 index 00000000..880d10f8 --- /dev/null +++ b/src/views/mp/components/wx-video-play/main.vue @@ -0,0 +1,117 @@ + + + + diff --git a/src/views/mp/components/wx-voice-play/main.vue b/src/views/mp/components/wx-voice-play/main.vue new file mode 100644 index 00000000..f98ac681 --- /dev/null +++ b/src/views/mp/components/wx-voice-play/main.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/views/mp/freePublish/index.vue b/src/views/mp/freePublish/index.vue index 497f72ec..1d9b331e 100644 --- a/src/views/mp/freePublish/index.vue +++ b/src/views/mp/freePublish/index.vue @@ -1,3 +1,395 @@ + + + + diff --git a/src/views/mp/message/index.vue b/src/views/mp/message/index.vue index 497f72ec..34e64ebf 100644 --- a/src/views/mp/message/index.vue +++ b/src/views/mp/message/index.vue @@ -1,3 +1,262 @@ + +