整合小程序库

This commit is contained in:
aixianling
2022-06-29 16:41:40 +08:00
parent 0b83cec78b
commit 2ef633a0c8
7 changed files with 133 additions and 138 deletions

View File

@@ -30,11 +30,10 @@
<div class="appName fill" v-text="app.name"/>
</div>
</div>
<AiLogin ref="login" @success="getAuth()"/>
</div>
</template>
<script>
import {mapMutations, mapState} from 'vuex'
import {mapActions, mapState} from 'vuex'
export default {
name: "home",
@@ -57,18 +56,18 @@ export default {
},
},
methods: {
...mapMutations(['getUserInfo']),
...mapActions(['getUserInfo', 'autoLogin']),
handleLogin() {
if (!this.token) {
this.$refs.login.show();
}
this.autoLogin();
} else this.$u.toast("已登录,无需重新登录!")
},
handleGotoApp(app) {
uni.navigateTo({url: `${app.path}`})
},
getApps() {
this.$instance.post("/node/wechatapps/list", null, {
baseURL: "http://192.168.1.87:12525", params: {size: 999, type: 'mp'}
baseURL: "http://192.168.1.87:12525", params: {size: 999, type: 'mp'}, withoutToken: true
}).then(res => {
if (res?.data) {
this.apps = res.data.records.map(e => {
@@ -80,14 +79,13 @@ export default {
}
})
},
getAuth() {
this.$nextTick(() => {
this.getUserInfo()
})
}
},
onShow() {
this.getAuth();
if (this.token) {
this.getUserInfo();
} else {
this.autoLogin().then(() => this.getUserInfo())
}
this.getApps()
},
}