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

feat:商城改版

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