Files
dvcp_v2_wxcp_app/src/pages/loading.vue
2022-06-13 09:57:52 +08:00

144 lines
3.5 KiB
Vue

<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"/>
<input v-if="!!$route.query.code" class="codeText" :value="$route.query.code"/>
<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.id" @tap="handleGotoApp(app)" :class="{beta:app.isBeta}">{{ app.label }}({{ app.name }})</b>
</div>
</section>
</template>
<script>
import {mapActions, mapMutations, mapState} from 'vuex'
import AiResult from "../components/AiResult";
import AiSelect from "../components/AiSelect";
export default {
name: 'loading',
components: {AiSelect, AiResult},
inject: ['root'],
computed: {
...mapState(['token', 'openUser', 'user', 'apps']),
appsList() {
let {search, currentLib} = this
return this.apps.filter(e => {
if (/beta/.test(e.libPath)) {
e.isBeta = 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) || {}
}
},
data() {
return {
result: {},
libs: [
{label: "通用版", dir: "apps"},
{label: "上架版", dir: "saas"},
],
currentLib: "apps",
search: ""
}
},
methods: {
...mapMutations(['logout', 'setApps']),
...mapActions(['agentSign']),
handleGotoApp(app) {
uni.navigateTo({url: `${app.libPath}`})
},
handleSwitchSystem() {
sessionStorage.setItem("prj", this.currentLib)
this.logout()
},
},
onLoad() {
this.currentLib = sessionStorage.getItem("prj") || "apps"
this.agentSign(this.$route.query)
},
onShow() {
this.result = {
tips: "欢迎进入开发应用",
}
}
}
</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: 8px;
border-radius: 8px;
font-weight: normal;
&.beta {
background: $uni-color-warning;
position: relative;
&:before {
position: absolute;
top: 0;
right: 0;
content: "beta";
transform: translate(-8px, -50%);
color: $uni-color-error;
z-index: 20220613952;
font-weight: bold;
}
}
}
}
}
</style>