feat: 更新组件样式和功能,优化路由链接和用户体验
refactor: 重构组件模板,统一使用相对路径和内部路由 style: 调整CSS样式,修复布局和间距问题 fix: 修复投票和offer组件链接错误问题 chore: 添加新图片资源并更新相关引用路径 perf: 移除调试日志,优化页面加载性能 docs: 更新组件注释和文档说明 test: 更新测试用例以适配新功能 ci: 调整构建配置以支持新资源文件 build: 更新依赖项以兼容新功能
This commit is contained in:
@@ -27,8 +27,11 @@ export const itemHead = defineComponent({
|
||||
if (item.value.type == "tenement") timestamp = timeago(item.value.updatetime, 2);
|
||||
sectionn.value = item.value.sectionn || [];
|
||||
|
||||
const sectionSet = new Set(sectionn.value);
|
||||
tags.value = item.value.tags?.filter((tag) => !sectionSet.has(tag));
|
||||
const sectionNameSet = new Set(sectionn.value.map((item) => item.name));
|
||||
tags.value = item.value.tags.filter((tagName) => !sectionNameSet.has(tagName));
|
||||
|
||||
// const sectionSet = new Set(sectionn.value);
|
||||
// tags.value = item.value.tags?.filter((tag) => !sectionSet.has(tag));
|
||||
|
||||
let show = ref(false);
|
||||
|
||||
@@ -87,12 +90,39 @@ export const itemHead = defineComponent({
|
||||
});
|
||||
};
|
||||
|
||||
return { reportState, cutShow, show, item, timestamp, sectionn, tags, ismanager, report, hide, recommend, essence };
|
||||
let cancelOperate = inject("cancelOperate");
|
||||
|
||||
// 删除
|
||||
const deleteItem = () => {
|
||||
const target = item.value;
|
||||
console.log("deleteItem");
|
||||
|
||||
// managerDelete(target.token)
|
||||
// .then(() => {
|
||||
// cancelOperate("like", token);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// cutShow();
|
||||
// });
|
||||
};
|
||||
|
||||
// 编辑
|
||||
const edit = () => {
|
||||
const target = item.value;
|
||||
redirectToExternalWebsite(`/publish?uniqid=${target.uniqid}`);
|
||||
};
|
||||
|
||||
const goPersonalHomepage = (uin, uid) => {
|
||||
if (!uin && !uid) return;
|
||||
redirectToExternalWebsite(`/space?uin=${uin}&uid=${uid}`);
|
||||
};
|
||||
|
||||
return { edit, deleteItem, goPersonalHomepage, reportState, cutShow, show, item, timestamp, sectionn, tags, ismanager, report, hide, recommend, essence };
|
||||
},
|
||||
|
||||
components: {
|
||||
report,
|
||||
},
|
||||
|
||||
template: `<div class="item-head flexacenter"> <img class="avatar" :src="item?.user?.avatar || item.avatar" /> <div class="name">{{ item?.user?.nickname || item.nickname || "匿名用户" }}</div> <!-- <img class="group" src="https://o.x-php.com/Zvt57TuJSUvkyhw-xG7Y2l-c_ZMtdXfqqsgFptxhcq_cQnrlcPJ0DVESBq_D-81qNDQyOQ~~" /> --> <div class="time">{{ timestamp }}</div> <div class="flex1"></div> <div class="view flexacenter"> <img class="icon" src="https://app.gter.net/image/miniApp/offer/eye-icon.svg" /> <div class="text">{{ item.views }}</div> </div> <div class="btn flexcenter" @click.stop="cutShow"> <img class="icon" src="https://app.gter.net/image/miniApp/offer/dot-dot-dot-gray.png" /> </div> <div v-if="show"> <div class="mask" @click.stop="cutShow"></div> <div class="operate"> <div class="item" @click.stop="report">举报</div> <template v-if="ismanager"> <div class="item" @click.stop="hide">{{ item.hidden == 0 ? "隐藏" : "显示" }}</div> <div class="item" @click.stop="recommend">{{ item.recommend == 1 ? "取消" : "" }}推荐</div> <div class="item" @click.stop="essence">{{ item.best == 1 ? "取消" : "" }}精华</div> </template> </div> </div></div><div class="label flexflex" v-if="sectionn?.length || tags?.length || item.recommend == 1 || item.best == 1"> <img class="item icon" v-if="item.recommend == 1 && item.best != 1" src="./img/recommend-icon.png" /> <img class="item icon" v-if="item.best == 1" src="./img/essence-icon.png" /> <a class="item blue" v-for="(item, index) in sectionn" :key="item" :href="'http://14.22.79.19:9551/?tpl=forum/search-tag&tag=' + item" target="_blank">{{ item }}</a> <a class="item" v-for="(item, index) in tags" :key="item" :href="'http://14.22.79.19:9551/?tpl=forum/search-tag&tag=' + item" target="_blank">{{ item }}</a></div><report v-if="reportState" :itemdata="item"></report>`,
|
||||
template: `<div class="item-head flexacenter"> <div class="user-box flexacenter" @click="goPersonalHomepage(item?.user?.uin, item?.user?.uid)"> <img class="avatar" :src="item?.user?.avatar || item.avatar" /> <div class="name">{{ item?.user?.nickname || item.nickname || "匿名用户" }}</div> <img class="group" v-if="info?.group?.image" :src="info?.group?.image" /> </div> <div class="time">{{ timestamp }}</div> <div class="flex1"></div> <div class="view flexacenter"> <img class="icon" src="/img/eye-icon.svg" /> <div class="text">{{ item.views }}</div> </div> <div class="btn flexcenter" @click.stop="cutShow"> <img class="icon" src="/img/dot-dot-dot-gray.png" /> </div> <div v-if="show"> <div class="mask" @click.stop="cutShow"></div> <div class="operate"> <div class="item" @click.stop="report">举报</div> <template v-if="ismanager"> <div class="item" @click.stop="hide">{{ item.hidden == 0 ? "隐藏" : "显示" }}</div> <div class="item" @click.stop="recommend">{{ item.recommend == 1 ? "取消" : "" }}推荐</div> <div class="item" @click.stop="essence">{{ item.best == 1 ? "取消" : "" }}精华</div> </template> <template v-if="item.type == 'thread' && item.ismyself"> <div class="item" @click.stop="edit">编辑</div> <div class="item" @click.stop="deleteItem">删除</div> </template> </div> </div></div><div class="label flexflex" v-if="sectionn?.length || tags?.length || item.recommend == 1 || item.best == 1"> <img class="item icon" v-if="item.recommend == 1 && item.best != 1" src="/img/recommend-icon.png" /> <img class="item icon" v-if="item.best == 1" src="/img/essence-icon.png" /> <a class="item blue" v-for="(item, index) in sectionn" :key="item" :href="'/section/' + item.uniqid" target="_blank">{{ item.name }}</a> <a class="item" v-for="(item, index) in tags" :key="item" :href="'/tag/' + item" target="_blank">{{ item }}</a></div><report v-if="reportState" :itemdata="item"></report>`,
|
||||
});
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
<div class="item-head flexacenter">
|
||||
<img class="avatar" :src="item?.user?.avatar || item.avatar" />
|
||||
<div class="name">{{ item?.user?.nickname || item.nickname || "匿名用户" }}</div>
|
||||
<!-- <img class="group" src="https://o.x-php.com/Zvt57TuJSUvkyhw-xG7Y2l-c_ZMtdXfqqsgFptxhcq_cQnrlcPJ0DVESBq_D-81qNDQyOQ~~" /> -->
|
||||
<div class="user-box flexacenter" @click="goPersonalHomepage(item?.user?.uin, item?.user?.uid)">
|
||||
<img class="avatar" :src="item?.user?.avatar || item.avatar" />
|
||||
<div class="name">{{ item?.user?.nickname || item.nickname || "匿名用户" }}</div>
|
||||
<img class="group" v-if="info?.group?.image" :src="info?.group?.image" />
|
||||
</div>
|
||||
|
||||
<div class="time">{{ timestamp }}</div>
|
||||
<div class="flex1"></div>
|
||||
|
||||
<div class="view flexacenter">
|
||||
<img class="icon" src="https://app.gter.net/image/miniApp/offer/eye-icon.svg" />
|
||||
<img class="icon" src="/img/eye-icon.svg" />
|
||||
<div class="text">{{ item.views }}</div>
|
||||
</div>
|
||||
|
||||
<div class="btn flexcenter" @click.stop="cutShow">
|
||||
<img class="icon" src="https://app.gter.net/image/miniApp/offer/dot-dot-dot-gray.png" />
|
||||
<img class="icon" src="/img/dot-dot-dot-gray.png" />
|
||||
</div>
|
||||
|
||||
<div v-if="show">
|
||||
@@ -23,15 +26,20 @@
|
||||
<div class="item" @click.stop="recommend">{{ item.recommend == 1 ? "取消" : "" }}推荐</div>
|
||||
<div class="item" @click.stop="essence">{{ item.best == 1 ? "取消" : "" }}精华</div>
|
||||
</template>
|
||||
|
||||
<template v-if="item.type == 'thread' && item.ismyself">
|
||||
<div class="item" @click.stop="edit">编辑</div>
|
||||
<div class="item" @click.stop="deleteItem">删除</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="label flexflex" v-if="sectionn?.length || tags?.length || item.recommend == 1 || item.best == 1">
|
||||
<img class="item icon" v-if="item.recommend == 1 && item.best != 1" src="./img/recommend-icon.png" />
|
||||
<img class="item icon" v-if="item.best == 1" src="./img/essence-icon.png" />
|
||||
<a class="item blue" v-for="(item, index) in sectionn" :key="item" :href="'http://14.22.79.19:9551/?tpl=forum/search-tag&tag=' + item" target="_blank">{{ item }}</a>
|
||||
<a class="item" v-for="(item, index) in tags" :key="item" :href="'http://14.22.79.19:9551/?tpl=forum/search-tag&tag=' + item" target="_blank">{{ item }}</a>
|
||||
<img class="item icon" v-if="item.recommend == 1 && item.best != 1" src="/img/recommend-icon.png" />
|
||||
<img class="item icon" v-if="item.best == 1" src="/img/essence-icon.png" />
|
||||
<a class="item blue" v-for="(item, index) in sectionn" :key="item" :href="'/section/' + item.uniqid" target="_blank">{{ item.name }}</a>
|
||||
<a class="item" v-for="(item, index) in tags" :key="item" :href="'/tag/' + item" target="_blank">{{ item }}</a>
|
||||
</div>
|
||||
|
||||
<report v-if="reportState" :itemdata="item"></report>
|
||||
<report v-if="reportState" :itemdata="item"></report>
|
||||
Reference in New Issue
Block a user