调整部分框架

This commit is contained in:
aixianling
2022-05-30 18:46:49 +08:00
parent 16beb074f6
commit 8e9a7de387
7 changed files with 112 additions and 59 deletions

View File

@@ -5,13 +5,12 @@
<!-- <div class="iconfont iconfont-iconLogo"/>-->
<ai-result v-if="result.tips" v-bind="result"/>
<input v-if="!!$route.query.code" class="codeText" :value="$route.query.code"/>
<div class="codeBtn" @click="handleLogin">去登录</div>
<u-radio-group v-model="currentLib" @change="handleSwitchSystem">
<u-radio v-for="(op,i) in libs" :key="i" :name="op.dir">{{ op.label }}</u-radio>
</u-radio-group>
<input class="codeText" v-model="search" placeholder="搜索要查找的应用"/>
<div flex class="appsPane wrap">
<b v-for="app in appsList" :key="app.path" @tap="handleGotoApp(app)">{{ app.name }}</b>
<b v-for="app in appsList" :key="app.id" @tap="handleGotoApp(app)">{{ app.label }}({{ app.name }})</b>
</div>
</section>
</template>
@@ -26,12 +25,12 @@ export default {
components: {AiSelect, AiResult},
inject: ['root'],
computed: {
...mapState(['token', 'openUser', 'user']),
...mapState(['token', 'openUser', 'user', 'apps']),
appsList() {
let {search, currentLib} = this
return this.apps.filter(e => {
return (currentLib == "apps" && e.path.indexOf("project") > -1) || e.path.indexOf(currentLib) > -1
}).filter(e => !!search ? e.name.indexOf(search) > -1 : true) || []
return (currentLib == "apps" && e.libPath.indexOf("project") > -1) || e.libPath.indexOf(currentLib) > -1
}).filter(e => !!search ? e.label.indexOf(search) > -1 : true) || []
},
currentApp() {
return this.apps.find(e => e.key == this.$route.query.app) || {}
@@ -40,7 +39,6 @@ export default {
data() {
return {
result: {},
apps: [],
libs: [
{label: "通用版", dir: "apps"},
{label: "上架版", dir: "saas"},
@@ -50,42 +48,21 @@ export default {
}
},
methods: {
...mapMutations(['logout']),
...mapMutations(['logout', 'setApps']),
...mapActions(['agentSign']),
handleGotoApp(app) {
uni.navigateTo({url: `${app.path}`})
},
handleLogin() {
uni.navigateTo({url: "./login"})
},
getApps() {
this.apps = []
let applications = require.context('../', true, /\.(\/.+)\/App[^\/]+\.vue$/)
applications.keys().map(path => {
if (applications(path).default) {
let {name: key, appName: name} = applications(path).default
this.apps.push({key, name, path: path.replace(/^\.(.+).vue$/g, '$1')})
}
})
uni.navigateTo({url: `${app.libPath}`})
},
handleSwitchSystem() {
this.changeConfig()
sessionStorage.setItem("prj", this.currentLib)
this.getApps()
this.logout()
},
changeConfig() {
this.$http.defaults.baseURL = this.currentLib == "apps" ? "/lan" :
this.currentLib == "saas" ? "/online" : "/"
}
},
onLoad() {
this.currentLib = sessionStorage.getItem("prj") || "apps"
this.changeConfig()
this.agentSign(this.$route.query)
},
onShow() {
this.getApps()
this.result = {
tips: "欢迎进入开发应用",
}