zdg #149

Merged
zhengdegang merged 12 commits from zdg into main 2024-08-21 09:21:08 +08:00
11 changed files with 274 additions and 25 deletions
Showing only changes of commit c57f21461a - Show all commits

View File

@ -13,9 +13,11 @@ export class ApiService {
if (!!data) config[method=='get'?'params':'data'] = data
if (!!option) Object.assign(config, option)
// 特殊格式处理
if (type == 'file') config.headers = { 'Content-Type': 'multipart/form-data' }
else if (type == 'json') config.headers = { 'Content-Type': 'application/json' }
else if (type == 'form') config.headers = { 'Content-Type': 'application/x-www-form-urlencoded' }
let headers
if (type == 'file') headers = { 'Content-Type': 'multipart/form-data' }
else if (type == 'json') headers = { 'Content-Type': 'application/json' }
else if (type == 'form') headers = { 'Content-Type': 'application/x-www-form-urlencoded' }
headers && (config.headers = { ...config.headers, ...headers })
return request(config)
}
}

View File

@ -1,9 +1,9 @@
@font-face {
font-family: "iconfont"; /* Project id 2794390 */
src: url('iconfont.woff2?t=1723453634574') format('woff2'),
url('iconfont.woff?t=1723453634574') format('woff'),
url('iconfont.ttf?t=1723453634574') format('truetype'),
url('iconfont.svg?t=1723453634574#iconfont') format('svg');
src: url('iconfont.woff2?t=1724134927539') format('woff2'),
url('iconfont.woff?t=1724134927539') format('woff'),
url('iconfont.ttf?t=1724134927539') format('truetype'),
url('iconfont.svg?t=1724134927539#iconfont') format('svg');
}
.iconfont {
@ -14,6 +14,74 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-zan:before {
content: "\e658";
}
.icon-zan1:before {
content: "\e659";
}
.icon-zan2:before {
content: "\e65a";
}
.icon-zan3:before {
content: "\e65c";
}
.icon-zan4:before {
content: "\e67c";
}
.icon-yizan:before {
content: "\e67e";
}
.icon-zan5:before {
content: "\e67f";
}
.icon-zan-yizan:before {
content: "\e680";
}
.icon-zan6:before {
content: "\e681";
}
.icon-MBEfenggeduosetubiao-xihuan:before {
content: "\e682";
}
.icon-zan7:before {
content: "\e683";
}
.icon-zan11:before {
content: "\e6ff";
}
.icon-zan8:before {
content: "\e684";
}
.icon-dianzan-red:before {
content: "\e685";
}
.icon-zan9:before {
content: "\e69e";
}
.icon-zanping:before {
content: "\100ae";
}
.icon-zan10:before {
content: "\e686";
}
.icon-arrangement:before {
content: "\e656";
}

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,125 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "1242129",
"name": "赞",
"font_class": "zan",
"unicode": "e658",
"unicode_decimal": 58968
},
{
"icon_id": "1741390",
"name": "赞",
"font_class": "zan1",
"unicode": "e659",
"unicode_decimal": 58969
},
{
"icon_id": "3159200",
"name": "赞",
"font_class": "zan2",
"unicode": "e65a",
"unicode_decimal": 58970
},
{
"icon_id": "3402139",
"name": "赞",
"font_class": "zan3",
"unicode": "e65c",
"unicode_decimal": 58972
},
{
"icon_id": "4931286",
"name": "赞 (1)",
"font_class": "zan4",
"unicode": "e67c",
"unicode_decimal": 59004
},
{
"icon_id": "4942300",
"name": "已赞",
"font_class": "yizan",
"unicode": "e67e",
"unicode_decimal": 59006
},
{
"icon_id": "5806181",
"name": "赞",
"font_class": "zan5",
"unicode": "e67f",
"unicode_decimal": 59007
},
{
"icon_id": "7172310",
"name": "赞-已赞",
"font_class": "zan-yizan",
"unicode": "e680",
"unicode_decimal": 59008
},
{
"icon_id": "7293361",
"name": "赞2",
"font_class": "zan6",
"unicode": "e681",
"unicode_decimal": 59009
},
{
"icon_id": "8705087",
"name": "MBE风格多色图标-喜欢",
"font_class": "MBEfenggeduosetubiao-xihuan",
"unicode": "e682",
"unicode_decimal": 59010
},
{
"icon_id": "10024138",
"name": "赞",
"font_class": "zan7",
"unicode": "e683",
"unicode_decimal": 59011
},
{
"icon_id": "11055391",
"name": "赞",
"font_class": "zan11",
"unicode": "e6ff",
"unicode_decimal": 59135
},
{
"icon_id": "11086734",
"name": "赞",
"font_class": "zan8",
"unicode": "e684",
"unicode_decimal": 59012
},
{
"icon_id": "23592614",
"name": "点赞",
"font_class": "dianzan-red",
"unicode": "e685",
"unicode_decimal": 59013
},
{
"icon_id": "26327261",
"name": "赞",
"font_class": "zan9",
"unicode": "e69e",
"unicode_decimal": 59038
},
{
"icon_id": "27804883",
"name": "赞评",
"font_class": "zanping",
"unicode": "100ae",
"unicode_decimal": 65710
},
{
"icon_id": "29252894",
"name": "赞",
"font_class": "zan10",
"unicode": "e686",
"unicode_decimal": 59014
},
{
"icon_id": "4978988",
"name": "作业-布置作业",

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 264 KiB

After

Width:  |  Height:  |  Size: 302 KiB

View File

@ -5,7 +5,7 @@
*/
// @ts-ignore
const API = window?.api || {}
const timRenderInstance = API.getTimRender()
const timRenderInstance = API?.getTimRender?.() || {}
// im 事件监听
export class IMListeners {

View File

@ -1,23 +1,32 @@
<template>
<el-button v-if="props.test" type="primary" @click="trigger">测试</el-button>
<div ref="warpRef" class="c-warp">
<template v-for="i in sum">
<slot><el-icon><Star /></el-icon></slot>
<template v-for="(item, index) in iconCache.list">
<slot>
<el-icon v-if="props.def"><Star /></el-icon>
<svg v-else class="icon" aria-hidden="true">
<use :xlink:href="`#icon-`+item.icon"></use>
</svg>
</slot>
</template>
</div>
</template>
<script setup>
// -
import { nextTick, ref } from 'vue'
import { ref, nextTick, useSlots, reactive } from 'vue'
import {Star} from '@element-plus/icons-vue'
const warpRef = ref(null)
const props = defineProps({ test: Boolean })
const sum = ref(0)
const props = defineProps({ test: Boolean, def: Boolean })
const slots = useSlots() //
let iconCache = reactive({list:[]}) //
const isSlot = !!Object.keys(slots).length // 使
// === ===
const trigger = () => {
sum.value++
const trigger = async () => {
iconCache.list.push({
icon: isSlot||props.def ? '' : getRandomIcon() //
})
nextTick(() => {
const el = warpRef.value.lastElementChild //
const el = warpRef.value.lastElementChild //
animInit(el)
})
}
@ -35,12 +44,12 @@ const animInit = (el) => {
let right = getRandom(5, maxw, false, true) // -
let isPlus = getRandomBool()?'':'-' // -
let rotate = getRandom(0, 60, false, true) // -
let scaleMax = getRandom(0, 1, true, true)+1 // -
let scaleMax = getRandom(0.5, 1.5, true, true)+1 // -
setStatic(el,'position','absolute') // -
setStatic(el, 'right', right, 'px') // -
const amFn = () => { // opacity: 0.5;
// -
if (bottom > maxH) {el.remove();return}
if (bottom > maxH) {el.remove();resetIconCache();return}
// : -
if (bottom < 101 && opacity < 1) opacity = toNumber(opacity + 0.01)
else if (bottom > maxH - 100 && opacity > 0) opacity = toNumber(opacity - 0.01)
@ -59,8 +68,23 @@ const animInit = (el) => {
}
amFn() //
}
// -
const setStatic = (el, type, val, end) => el.style[type] = val + (end || '')
//
const resetIconCache = () => {
const len = warpRef.value?.children?.length||0
if (!len && iconCache.list.length) iconCache.list = []
}
// -
const getRandomIcon = () => {
const iconArr = [ // icon
'zan10', 'zanping', 'zan9', 'dianzan-red', 'zan8', 'zan11', 'zan7', 'MBEfenggeduosetubiao-xihuan',
'zan6', 'zan-yizan', 'zan5', 'yizan', 'zan4', 'zan3', 'zan2', 'zan1', 'zan'
]
const ind = getRandom(0, iconArr.length-1)
return iconArr[ind]
}
// isFloat isMax
const getRandom = (min, max, isFloat, isMax, pos=2) => {
const maxVal = isMax ? max - min + 1 : max - min
@ -71,6 +95,8 @@ const getRandom = (min, max, isFloat, isMax, pos=2) => {
const getRandomBool = () => Math.random() > 0.5
// -()
const toNumber = (v, pos = 2) => Number(v.toFixed(pos))
//
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
//
defineExpose({ trigger })
</script>

View File

@ -78,7 +78,7 @@ const btnList = [ // 工具栏按钮列表
]
// === ===
onMounted(async() => {
getClassInfo() // ex3
// getClassInfo() // ex3
setTimeout(() => {
resetStatus() // -
}, 200);
@ -93,7 +93,7 @@ const getClassInfo = async () => {
let timGroupId = data?.ex3 || ''
console.log('获取群ID:', timGroupId)
const chat = await imChatRef.value?.initImChat(timGroupId) // im-chat
if (!timGroupId) timGroupId = chat.timGroupId
if (!timGroupId) timGroupId = chat?.timGroupId
classManageApi.startClass(classObj.id, timGroupId) //
}
// tab-change
@ -128,10 +128,10 @@ const chatChange = (type, data, ...args) => {
switch(head) {
case MsgEnum.HEADS.MSG_0001:
// console.log(':', data)
if(msgIds.includes(msgId)) return
upvoteRef.value.trigger()
if (msgIds.length >= 100) msgIds.shift() //
msgIds.push(msgId) //
if(msgIds.includes(msgId)) return // -
upvoteRef.value.trigger() //
if (msgIds.length >= 100) msgIds.shift() //
msgIds.push(msgId) //
break
default:
console.log('未知消息:', data)