save
This commit is contained in:
parent
57df3c90bf
commit
8ea667e4f9
|
@ -36,6 +36,7 @@
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lunar-typescript": "^1.7.5",
|
"lunar-typescript": "^1.7.5",
|
||||||
|
"milkdown-plugin-placeholder": "^0.2.1",
|
||||||
"oh-vue-icons": "^1.0.0-rc3",
|
"oh-vue-icons": "^1.0.0-rc3",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"pinia-plugin-persistedstate": "^3.2.3",
|
"pinia-plugin-persistedstate": "^3.2.3",
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default defineComponent({
|
||||||
'w-full rounded-lg overflow-hidden flex justify-center items-center p-2 hover:scale-110 transition-all cursor-pointer ' +
|
'w-full rounded-lg overflow-hidden flex justify-center items-center p-2 hover:scale-110 transition-all cursor-pointer ' +
|
||||||
(searchConfig.current.name === item.name
|
(searchConfig.current.name === item.name
|
||||||
? 'bg-white'
|
? 'bg-white'
|
||||||
: 'bg-white/40 hover:bg-white/60')
|
: 'bg-white ')
|
||||||
}
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
searchConfig.current = { ...item }
|
searchConfig.current = { ...item }
|
||||||
|
@ -45,9 +45,10 @@ export default defineComponent({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="w-6 h-6 bg-center bg-no-repeat bg-contain"
|
class="w-[28px] h-[28px] bg-center bg-no-repeat bg-contain rounded-[8px]"
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `url('${item.icon}')`
|
backgroundImage: `url('${item.icon}')`,
|
||||||
|
backgroundSize: '100% 100%'
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,7 +57,7 @@ export default defineComponent({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<div class="w-12 h-16">
|
{/* <div class="w-12 h-16">
|
||||||
<div
|
<div
|
||||||
class="w-full h-10 rounded-lg overflow-hidden flex justify-center items-center p-2 transition-all cursor-pointer bg-white/40 hover:bg-white/60"
|
class="w-full h-10 rounded-lg overflow-hidden flex justify-center items-center p-2 transition-all cursor-pointer bg-white/40 hover:bg-white/60"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -66,7 +67,7 @@ export default defineComponent({
|
||||||
>
|
>
|
||||||
<OhVueIcon name="fa-plus" scale={1.4} fill="rgba(0,0,0,.4)" />
|
<OhVueIcon name="fa-plus" scale={1.4} fill="rgba(0,0,0,.4)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { addIcons, OhVueIcon } from 'oh-vue-icons'
|
||||||
import { IoCloseCircleOutline, RiCloseCircleLine } from 'oh-vue-icons/icons'
|
import { IoCloseCircleOutline, RiCloseCircleLine } from 'oh-vue-icons/icons'
|
||||||
import useDiscountStore from './useDiscountStore'
|
import useDiscountStore from './useDiscountStore'
|
||||||
import { debounce } from 'lodash'
|
import { debounce } from 'lodash'
|
||||||
|
import jump from '@/utils/jump'
|
||||||
addIcons(RiTimeLine, IoCloseCircleOutline, RiCloseCircleLine)
|
addIcons(RiTimeLine, IoCloseCircleOutline, RiCloseCircleLine)
|
||||||
export default defineComponent(() => {
|
export default defineComponent(() => {
|
||||||
const store = useDiscountStore()
|
const store = useDiscountStore()
|
||||||
|
@ -13,7 +14,7 @@ export default defineComponent(() => {
|
||||||
const container = containerRef.value
|
const container = containerRef.value
|
||||||
if (store.loading) return
|
if (store.loading) return
|
||||||
if (container.scrollTop + container.clientHeight >= container.scrollHeight - 15) {
|
if (container.scrollTop + container.clientHeight >= container.scrollHeight - 15) {
|
||||||
store.state.pageIndex += 1;
|
store.state.pageIndex += 1
|
||||||
|
|
||||||
store.getNews()
|
store.getNews()
|
||||||
}
|
}
|
||||||
|
@ -25,7 +26,7 @@ export default defineComponent(() => {
|
||||||
store.state.pageIndex = 1
|
store.state.pageIndex = 1
|
||||||
store.noMoreData = false
|
store.noMoreData = false
|
||||||
store.getNews()
|
store.getNews()
|
||||||
}, 500) //
|
}, 500) //
|
||||||
watch(searchText, (newValue) => {
|
watch(searchText, (newValue) => {
|
||||||
debouncedHandler(newValue)
|
debouncedHandler(newValue)
|
||||||
})
|
})
|
||||||
|
@ -57,7 +58,11 @@ export default defineComponent(() => {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
></input>
|
></input>
|
||||||
<div class={'absolute cursor-pointer hidden group-hover:block right-3 top-1/2 -translate-y-1/2'}>
|
<div
|
||||||
|
class={
|
||||||
|
'absolute cursor-pointer hidden group-hover:block right-3 top-1/2 -translate-y-1/2'
|
||||||
|
}
|
||||||
|
>
|
||||||
<OhVueIcon name={RiCloseCircleLine.name} fill="#ddd"></OhVueIcon>
|
<OhVueIcon name={RiCloseCircleLine.name} fill="#ddd"></OhVueIcon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,56 +74,61 @@ export default defineComponent(() => {
|
||||||
ref={containerRef}
|
ref={containerRef}
|
||||||
>
|
>
|
||||||
<div class={'grid grid-cols-3 gap-4 '}>
|
<div class={'grid grid-cols-3 gap-4 '}>
|
||||||
{
|
{(store.state.find ? store.searchList : store.list).map((item, index) => {
|
||||||
(store.state.find ? store.searchList :
|
return (
|
||||||
store.list).map((item, index) => {
|
<div
|
||||||
return (
|
class={
|
||||||
<div
|
'flex cursor-pointer h-[215px] overflow-hidden bg-[#17212d] items-center flex-col rounded-lg relative '
|
||||||
class={
|
}
|
||||||
'flex cursor-pointer h-[215px] overflow-hidden bg-[#17212d] items-center flex-col rounded-lg relative '
|
onClick={() => {
|
||||||
}
|
// jump(item.commdity[0]?.url)
|
||||||
onClick={() => { }}
|
window.open(item.commdity[0]?.url)
|
||||||
key={index}
|
}}
|
||||||
>
|
key={index}
|
||||||
<img class={'h-[142px] w-full object-cover'} src={item.commdity[0]?.img}></img>
|
>
|
||||||
<div
|
<img class={'h-[142px] w-full object-cover'} src={item.commdity[0]?.img}></img>
|
||||||
class={
|
<div
|
||||||
'absolute bottom-0 w-full h-[100px] rounded-lg bg-[#0003] backdrop-blur-md'
|
class={
|
||||||
}
|
'absolute bottom-0 w-full h-[100px] rounded-lg bg-[#0003] backdrop-blur-md'
|
||||||
>
|
}
|
||||||
<div class="flex flex-col w-full h-full justify-between py-2 px-3">
|
>
|
||||||
<span class="text-white text-[14px]">{item.name}</span>
|
<div class="flex flex-col w-full h-full justify-between py-2 px-3">
|
||||||
<div>
|
<span class="text-white text-[14px]">{item.name}</span>
|
||||||
<span
|
<div>
|
||||||
class={
|
<span
|
||||||
'border-[1px] border-[#f6d1b8] border-solid text-[#f6d1b8] p-1 text-[12px] rounded'
|
class={
|
||||||
}
|
'border-[1px] border-[#f6d1b8] border-solid text-[#f6d1b8] p-1 text-[12px] rounded'
|
||||||
>
|
}
|
||||||
{item.typename}
|
>
|
||||||
</span>
|
{item.typename}
|
||||||
</div>
|
</span>
|
||||||
<div class="bg-white/20 flex rounded items-center gap-x-2">
|
</div>
|
||||||
<div class="bg-[#ef5a41] h-full text-white rounded px-2 text-[18px] font-bold ">
|
<div class="bg-white/20 flex rounded items-center gap-x-2">
|
||||||
-13%
|
<div class="bg-[#ef5a41] h-full text-white rounded px-2 text-[18px] font-bold ">
|
||||||
</div>
|
-13%
|
||||||
<span class="text-[#fffbc2] text-[16px] ml-2">
|
|
||||||
¥{item.commdity[0]?.price}
|
|
||||||
</span>
|
|
||||||
<span class="text-[12px] text-[#bdbdbd] line-through decoration-current">
|
|
||||||
¥{item.commdity[0]?.oldprice}
|
|
||||||
</span>
|
|
||||||
<span class="text-[12px] text-[#ebebeb] ">
|
|
||||||
剩余{1}天
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<span class="text-[#fffbc2] text-[16px] ml-2">
|
||||||
|
¥{item.commdity[0]?.price}
|
||||||
|
</span>
|
||||||
|
<span class="text-[12px] text-[#bdbdbd] line-through decoration-current">
|
||||||
|
¥{item.commdity[0]?.oldprice}
|
||||||
|
</span>
|
||||||
|
<span class="text-[12px] text-[#ebebeb] ">剩余{1}天</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
</div>
|
||||||
})}
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
{store.loading && (
|
{store.loading && (
|
||||||
<div class={'w-full font-bold flex absolute bottom-2 bg-[#17212d] justify-center text-white py-2'}>加载中...</div>
|
<div
|
||||||
|
class={
|
||||||
|
'w-full font-bold flex absolute bottom-2 bg-[#17212d] justify-center text-white py-2'
|
||||||
|
}
|
||||||
|
>
|
||||||
|
加载中...
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
{store.noMoreData && (
|
{store.noMoreData && (
|
||||||
<div class={'w-full font-bold flex justify-center text-white py-2'}>无更多数据</div>
|
<div class={'w-full font-bold flex justify-center text-white py-2'}>无更多数据</div>
|
||||||
|
|
|
@ -114,6 +114,7 @@ export default defineComponent(() => {
|
||||||
trriger.value &&
|
trriger.value &&
|
||||||
<MilkdownProvider >
|
<MilkdownProvider >
|
||||||
<Editor
|
<Editor
|
||||||
|
|
||||||
class={"w-full h-full "}
|
class={"w-full h-full "}
|
||||||
modelValue={store.state.list[currentIndex.value]?.content || ''} onUpdate:modelValue={(e) => {
|
modelValue={store.state.list[currentIndex.value]?.content || ''} onUpdate:modelValue={(e) => {
|
||||||
if (store.state.list[currentIndex.value]) {
|
if (store.state.list[currentIndex.value]) {
|
||||||
|
|
|
@ -1,72 +1,63 @@
|
||||||
import { Milkdown, useEditor } from '@milkdown/vue';
|
import { Milkdown, useEditor } from '@milkdown/vue'
|
||||||
import { defaultValueCtx, Editor, rootCtx } from '@milkdown/kit/core';
|
import { defaultValueCtx, Editor, rootCtx } from '@milkdown/kit/core'
|
||||||
import { nord } from '@milkdown/theme-nord'
|
import { nord } from '@milkdown/theme-nord'
|
||||||
import { commonmark } from '@milkdown/kit/preset/commonmark'
|
import { commonmark } from '@milkdown/kit/preset/commonmark'
|
||||||
import { gfm } from '@milkdown/kit/preset/gfm';
|
import { gfm } from '@milkdown/kit/preset/gfm'
|
||||||
import { defineComponent, watch} from 'vue';
|
import { defineComponent } from 'vue'
|
||||||
import { menu, menuConfigCtx, type MenuConfigItem } from '@milkdown-lab/plugin-menu'
|
import { menu, menuConfigCtx, type MenuConfigItem } from '@milkdown-lab/plugin-menu'
|
||||||
import { listener, listenerCtx } from '@milkdown/kit/plugin/listener';
|
import { listener, listenerCtx } from '@milkdown/kit/plugin/listener'
|
||||||
|
|
||||||
|
|
||||||
const menuItems: MenuConfigItem[][] = [
|
const menuItems: MenuConfigItem[][] = [
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
content: 'B',
|
content: 'B',
|
||||||
// commandKey
|
// commandKey
|
||||||
key: 'ToggleStrong',
|
key: 'ToggleStrong'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
content: 'I',
|
content: 'I',
|
||||||
key: 'ToggleEmphasis',
|
key: 'ToggleEmphasis'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
content: 'S',
|
content: 'S',
|
||||||
key: 'ToggleStrikeThrough',
|
key: 'ToggleStrikeThrough'
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
]
|
]
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: ''
|
||||||
}
|
|
||||||
},
|
|
||||||
emits: ['update:modelValue'],
|
|
||||||
setup: (props, ct) => {
|
|
||||||
|
|
||||||
useEditor((root) => {
|
|
||||||
return Editor.make()
|
|
||||||
.config(nord)
|
|
||||||
.config((ctx) => {
|
|
||||||
const listener = ctx.get(listenerCtx);
|
|
||||||
ctx.set(menuConfigCtx.key, {
|
|
||||||
attributes: { class: 'milkdown-menu', 'data-menu': 'true' },
|
|
||||||
items: menuItems,
|
|
||||||
})
|
|
||||||
ctx.set(rootCtx, document.querySelector('#app'))
|
|
||||||
listener.markdownUpdated((ctx, markdown, prevMarkdown) => {
|
|
||||||
if (markdown !== prevMarkdown) {
|
|
||||||
ct.emit('update:modelValue', markdown)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
ctx.set(rootCtx, root)
|
|
||||||
ctx.set(defaultValueCtx, props.modelValue || ' ')
|
|
||||||
})
|
|
||||||
.use(listener)
|
|
||||||
.use(commonmark)
|
|
||||||
.use(gfm)
|
|
||||||
.use(menu)
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
return () => (
|
|
||||||
<Milkdown />
|
|
||||||
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
emits: ['update:modelValue'],
|
||||||
|
setup: (props, ct) => {
|
||||||
|
useEditor((root) => {
|
||||||
|
return Editor.make()
|
||||||
|
.config(nord)
|
||||||
|
.config((ctx) => {
|
||||||
|
const listener = ctx.get(listenerCtx)
|
||||||
|
ctx.set(menuConfigCtx.key, {
|
||||||
|
attributes: { class: 'milkdown-menu', 'data-menu': 'true' },
|
||||||
|
items: menuItems
|
||||||
|
})
|
||||||
|
ctx.set(rootCtx, document.querySelector('#app'))
|
||||||
|
listener.markdownUpdated((ctx, markdown, prevMarkdown) => {
|
||||||
|
if (markdown !== prevMarkdown) {
|
||||||
|
ct.emit('update:modelValue', markdown)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
ctx.set(rootCtx, root)
|
||||||
|
ctx.set(defaultValueCtx, props.modelValue || ' ')
|
||||||
|
})
|
||||||
|
.use(listener)
|
||||||
|
.use(commonmark)
|
||||||
|
.use(gfm)
|
||||||
|
.use(menu)
|
||||||
|
})
|
||||||
|
return () => <Milkdown />
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue