系统切换优化

This commit is contained in:
aixianling
2022-01-28 16:49:59 +08:00
parent 208354cb64
commit 9aab400c05
3 changed files with 18 additions and 5 deletions

View File

@@ -29,12 +29,18 @@
"open": true, "open": true,
"proxy": { "proxy": {
"/lan": { "/lan": {
// "target": "http://192.168.1.87:9000", "target": "http://192.168.1.87:9000",
"target": "http://test87tpweb.cunwuyun.cn",
"changeOrigin": true, "changeOrigin": true,
"pathRewrite": { "pathRewrite": {
"^/lan": "/" "^/lan": "/"
} }
},
"/saas": {
"target": "https://test87tpweb.cunwuyun.cn",
"changeOrigin": true,
"pathRewrite": {
"^/saas": "/"
}
} }
} }
}, },

View File

@@ -6,7 +6,7 @@
<ai-result v-if="result.tips" v-bind="result"/> <ai-result v-if="result.tips" v-bind="result"/>
<input v-if="!!$route.query.code" class="codeText" :value="$route.query.code"/> <input v-if="!!$route.query.code" class="codeText" :value="$route.query.code"/>
<div class="codeBtn" @click="handleLogin">去登录</div> <div class="codeBtn" @click="handleLogin">去登录</div>
<u-radio-group v-model="currentLib" @change="getApps"> <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 v-for="(op,i) in libs" :key="i" :name="op.dir">{{ op.label }}</u-radio>
</u-radio-group> </u-radio-group>
<input class="codeText" v-model="search" placeholder="搜索要查找的应用"/> <input class="codeText" v-model="search" placeholder="搜索要查找的应用"/>
@@ -17,7 +17,7 @@
</template> </template>
<script> <script>
import {mapActions, mapState} from 'vuex' import {mapActions, mapMutations, mapState} from 'vuex'
import AiResult from "../components/AiResult"; import AiResult from "../components/AiResult";
import AiSelect from "../components/AiSelect"; import AiSelect from "../components/AiSelect";
@@ -48,6 +48,7 @@ export default {
} }
}, },
methods: { methods: {
...mapMutations(['logout']),
...mapActions(['agentSign']), ...mapActions(['agentSign']),
handleGotoApp(app) { handleGotoApp(app) {
uni.navigateTo({url: `/${this.currentLib}${app.path}`}) uni.navigateTo({url: `/${this.currentLib}${app.path}`})
@@ -65,6 +66,12 @@ export default {
this.apps.push({key, name, path: path.replace(/^\.(.+).vue$/g, '$1')}) this.apps.push({key, name, path: path.replace(/^\.(.+).vue$/g, '$1')})
} }
}) })
},
handleSwitchSystem() {
this.$http.defaults.baseURL = this.currentLib == "apps" ? "/lan" :
this.currentLib == "sass" ? "/saas" : "/"
this.getApps()
this.logout()
} }
}, },
onLoad() { onLoad() {

View File

@@ -236,7 +236,7 @@ const store = new Vuex.Store({
}, },
agentSign(state, params) { agentSign(state, params) {
let url = window.location.href, let url = window.location.href,
{corpId = "ww596787bb70f08288", suiteId} = state.state.config {corpId, suiteId} = state.state.config
if (agentSignURL == url) { if (agentSignURL == url) {
return Promise.resolve() return Promise.resolve()
} else { } else {