提交 c4f4c410 编写于 作者: 璃白.'s avatar 璃白. 🌻

feat:商城改版

上级 774a6879
......@@ -20,8 +20,8 @@ export default {
axios.get(
`https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/files/${plugin.path}%2F${plugin.detail}/raw?ref=master`
),
getDownloadUrl: plugin =>
`https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/archive.zip?path=plugins%2F${plugin.name}`,
getDownloadUrl: pluginPath =>
`https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/archive.zip?path=${pluginPath}`,
getPluginDetail: pluginPath =>
axios.get(
`https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/files/${pluginPath}%2Fplugin.json/raw?ref=master`
......
<template>
<div class="market">
<a-menu mode="vertical" v-model="selectedMenu" @click="getPlugins">
<a-menu-item
v-for="(item, index) in menu"
:key="item.id"
:value="item.path"
>
<a-icon :type="icon[index]" />
{{ item.name }}
<a-menu-item v-for="item in menu" :key="item.id" :value="item.path">
<a-icon :type="formatMenu(item.name).icon" />
{{ formatMenu(item.name).name }}
</a-menu-item>
</a-menu>
<div class="market-content">
......@@ -137,7 +133,6 @@ export default {
bannerList: [],
show: false,
selectedMenu: [],
icon: ["calculator", "tool", "build"],
currentSelect: {}
};
},
......@@ -150,11 +145,33 @@ export default {
api.getMenu().then(async ({ data: res }) => {
if (!res.length) return;
this.menu = res;
// console.log(res);
const firstItem = res[0];
this.selectedMenu = [firstItem.id];
this.getPlugins({ item: { value: firstItem.path } });
});
},
formatMenu(name) {
if (!name) return "";
switch (name) {
case "entertainment":
return {
name: "游戏娱乐",
icon: "build"
};
case "software":
return {
name: "应用软件",
icon: "calculator"
};
case "tools":
return {
name: "开发工具",
icon: "tool"
};
}
},
getPlugins({ item }) {
console.log(item);
const path = encodeURIComponent(item.value);
......@@ -170,7 +187,7 @@ export default {
},
async getPluginDetail(path) {
const { data: plugin } = await api.getPluginDetail(path);
plugin.path = path
plugin.path = path;
if (plugin.detail && isMdFile(plugin.detail)) {
const { readme } = await api.getReadme(plugin);
plugin.readme = readme;
......@@ -178,11 +195,8 @@ export default {
plugin.readme = plugin.detail;
}
plugin.logo = api.getLogo(plugin);
// plugin.logo = `https://gitcode.net/weixin_43881430/quicker-market/-/raw/master/plugins/${plugin.name}/${logo}`;
plugin.downloadUrl = api.getDownloadUrl(plugin);
// plugin.downloadUrl = `https://gitlab.com/api/v4/projects/layyback%2Fquicker-market/repository/archive.zip?path=plugins%2F${plugin.name}`;
// plugin.downloadUrl =
// "https://gitcode.net/api/v4/projects/weixin_43881430%2Fquicker-market/repository/archive.zip";
plugin.downloadUrl = api.getDownloadUrl(plugin.path);
console.log(plugin.downloadUrl);
return plugin;
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册