2021-11-15 10:29:05 +08:00
|
|
|
<template>
|
|
|
|
|
<section class="loading">
|
|
|
|
|
<!-- <div class="iconfont iconfont-iconWeChat"/>-->
|
|
|
|
|
<!-- <div class="iconfont iconfont-iconjuminxinxi"/>-->
|
|
|
|
|
<!-- <div class="iconfont iconfont-iconLogo"/>-->
|
|
|
|
|
<ai-result v-if="result.tips" v-bind="result"/>
|
2021-11-15 15:53:44 +08:00
|
|
|
<input v-if="!!$route.query.code" class="codeText" :value="$route.query.code"/>
|
|
|
|
|
<div class="codeBtn" @click="handleLogin">去登录</div>
|
2022-01-28 16:49:59 +08:00
|
|
|
<u-radio-group v-model="currentLib" @change="handleSwitchSystem">
|
2022-01-26 10:15:03 +08:00
|
|
|
<u-radio v-for="(op,i) in libs" :key="i" :name="op.dir">{{ op.label }}</u-radio>
|
|
|
|
|
</u-radio-group>
|
2021-12-20 10:15:54 +08:00
|
|
|
<input class="codeText" v-model="search" placeholder="搜索要查找的应用"/>
|
2021-11-15 15:53:44 +08:00
|
|
|
<div flex class="appsPane wrap">
|
2022-02-16 15:10:40 +08:00
|
|
|
<b v-for="app in appsList" :key="app.path" @tap="handleGotoApp(app)">{{ app.name }}</b>
|
2021-11-15 15:53:44 +08:00
|
|
|
</div>
|
2021-11-15 10:29:05 +08:00
|
|
|
</section>
|
2021-12-08 18:01:40 +08:00
|
|
|
</template>
|
2021-11-15 10:29:05 +08:00
|
|
|
|
|
|
|
|
<script>
|
2022-01-28 16:49:59 +08:00
|
|
|
import {mapActions, mapMutations, mapState} from 'vuex'
|
2021-11-15 10:29:05 +08:00
|
|
|
import AiResult from "../components/AiResult";
|
2022-01-26 10:15:03 +08:00
|
|
|
import AiSelect from "../components/AiSelect";
|
2021-11-15 10:29:05 +08:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'loading',
|
2022-01-26 10:15:03 +08:00
|
|
|
components: {AiSelect, AiResult},
|
2021-11-15 10:29:05 +08:00
|
|
|
inject: ['root'],
|
|
|
|
|
computed: {
|
2021-11-17 17:13:52 +08:00
|
|
|
...mapState(['token', 'openUser', 'user']),
|
2021-12-20 10:15:54 +08:00
|
|
|
appsList() {
|
2022-02-16 15:10:40 +08:00
|
|
|
let {search, currentLib} = this
|
2022-03-10 14:01:30 +08:00
|
|
|
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) || []
|
2021-12-20 10:15:54 +08:00
|
|
|
},
|
2021-11-15 10:29:05 +08:00
|
|
|
currentApp() {
|
|
|
|
|
return this.apps.find(e => e.key == this.$route.query.app) || {}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2021-11-17 17:13:52 +08:00
|
|
|
result: {},
|
2021-12-20 10:15:54 +08:00
|
|
|
apps: [],
|
2022-01-26 10:15:03 +08:00
|
|
|
libs: [
|
|
|
|
|
{label: "通用版", dir: "apps"},
|
2022-02-09 10:35:29 +08:00
|
|
|
{label: "上架版", dir: "saas"},
|
2022-01-26 10:15:03 +08:00
|
|
|
],
|
|
|
|
|
currentLib: "apps",
|
2021-12-20 10:15:54 +08:00
|
|
|
search: ""
|
2021-11-15 10:29:05 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2022-01-28 16:49:59 +08:00
|
|
|
...mapMutations(['logout']),
|
2021-11-23 16:07:39 +08:00
|
|
|
...mapActions(['agentSign']),
|
2021-11-30 14:39:24 +08:00
|
|
|
handleGotoApp(app) {
|
2022-02-16 15:10:40 +08:00
|
|
|
uni.navigateTo({url: `${app.path}`})
|
2021-11-30 14:39:24 +08:00
|
|
|
},
|
2021-11-15 15:53:44 +08:00
|
|
|
handleLogin() {
|
|
|
|
|
uni.navigateTo({url: "./login"})
|
2021-11-17 17:13:52 +08:00
|
|
|
},
|
|
|
|
|
getApps() {
|
|
|
|
|
this.apps = []
|
2022-02-16 15:10:40 +08:00
|
|
|
let applications = require.context('../', true, /\.(\/.+)\/App[^\/]+\.vue$/)
|
2021-11-17 17:13:52 +08:00
|
|
|
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')})
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-01-28 16:49:59 +08:00
|
|
|
},
|
|
|
|
|
handleSwitchSystem() {
|
2022-02-09 09:37:29 +08:00
|
|
|
this.changeConfig()
|
|
|
|
|
sessionStorage.setItem("prj", this.currentLib)
|
2022-01-28 16:49:59 +08:00
|
|
|
this.getApps()
|
|
|
|
|
this.logout()
|
2022-02-09 09:37:29 +08:00
|
|
|
},
|
|
|
|
|
changeConfig() {
|
|
|
|
|
this.$http.defaults.baseURL = this.currentLib == "apps" ? "/lan" :
|
2022-02-09 16:24:15 +08:00
|
|
|
this.currentLib == "saas" ? "/online" : "/"
|
2021-11-15 10:29:05 +08:00
|
|
|
}
|
|
|
|
|
},
|
2021-11-23 16:07:39 +08:00
|
|
|
onLoad() {
|
2022-02-09 09:37:29 +08:00
|
|
|
this.currentLib = sessionStorage.getItem("prj") || "apps"
|
|
|
|
|
this.changeConfig()
|
2021-11-23 16:07:39 +08:00
|
|
|
this.agentSign(this.$route.query)
|
|
|
|
|
},
|
2021-11-23 14:58:51 +08:00
|
|
|
onShow() {
|
2021-11-17 17:13:52 +08:00
|
|
|
this.getApps()
|
2021-11-15 14:23:50 +08:00
|
|
|
this.result = {
|
|
|
|
|
tips: "欢迎进入开发应用",
|
|
|
|
|
}
|
2021-11-15 10:29:05 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.loading {
|
|
|
|
|
height: 100%;
|
|
|
|
|
position: relative;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
& > span {
|
|
|
|
|
font-size: 36px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.codeText {
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
margin-top: 16px;
|
|
|
|
|
padding: 4px 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
background: #ccc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.codeBtn {
|
|
|
|
|
width: 180px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
background: $uni-color-warning;
|
|
|
|
|
color: #fff;
|
|
|
|
|
padding: 8px;
|
|
|
|
|
margin-top: 16px;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
font-weight: normal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.appsPane {
|
|
|
|
|
justify-content: center;
|
|
|
|
|
margin-top: 16px;
|
|
|
|
|
padding: 0 16px;
|
|
|
|
|
|
|
|
|
|
b {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
background: $uni-color-primary;
|
|
|
|
|
color: #fff;
|
|
|
|
|
padding: 8px;
|
|
|
|
|
margin: 4px;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
font-weight: normal;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|