|
@@ -1,27 +1,14 @@
|
|
|
<script>
|
|
|
- import {mapState,mapMutations} from 'vuex'
|
|
|
+ import {mapMutations} from 'vuex'
|
|
|
export default {
|
|
|
// 此处globalData为了演示其作用,不是uView框架的一部分
|
|
|
globalData: {
|
|
|
username: '白居易'
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState(['hasLogin'])
|
|
|
- },
|
|
|
methods:{
|
|
|
...mapMutations(['login'])
|
|
|
},
|
|
|
- onLaunch() {
|
|
|
- // 1.1.0版本之前关于http拦截器代码,已平滑移动到/common/http.interceptor.js中
|
|
|
- // 注意,需要在/main.js中实例化Vue之后引入如下(详见文档说明):
|
|
|
- // import httpInterceptor from '@/common/http.interceptor.js'
|
|
|
- // Vue.use(httpInterceptor, app)
|
|
|
- if (!this.hasLogin) {
|
|
|
- this.$u.route({
|
|
|
- url: "pages/login/index",
|
|
|
- type: "redirect"
|
|
|
- })
|
|
|
- }
|
|
|
+ created() {
|
|
|
let storeInfo=uni.getStorageSync("storeInfo")||"";
|
|
|
if(storeInfo.storeId){
|
|
|
uni.getStorage({
|
|
@@ -32,6 +19,12 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ onLaunch() {
|
|
|
+ // 1.1.0版本之前关于http拦截器代码,已平滑移动到/common/http.interceptor.js中
|
|
|
+ // 注意,需要在/main.js中实例化Vue之后引入如下(详见文档说明):
|
|
|
+ // import httpInterceptor from '@/common/http.interceptor.js'
|
|
|
+ // Vue.use(httpInterceptor, app)
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|