This commit is contained in:
aihe 2024-02-29 12:42:24 +08:00
parent 8105a9d0fb
commit 53e0b3e13f
4 changed files with 33 additions and 11 deletions

View File

@ -6,7 +6,6 @@
version
} from './package.json'
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import { getSessionXToken } from "@/session"
import { USERKEY } from "@/store/actionKey"
export default {
@ -14,8 +13,6 @@
},
onLaunch: function() {
const xToken = getSessionXToken()
// 登录认证
this.$store.dispatch(USERKEY.GETUSERINFO)
// #ifdef H5

View File

@ -1,6 +1,7 @@
import App from './App'
import store from './store'
import uviewPlus from '@/uni_modules/uview-plus'
import { mixins } from "./mixins"
// #ifndef VUE3
import Vue from 'vue'
@ -17,7 +18,7 @@ const app = new Vue({
store,
...App
})
app.mixin(mixins);
app.$mount()
// #endif
@ -27,6 +28,8 @@ import {
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
app.mixin(mixins);
app.use(uviewPlus)
// 调用setConfig方法,方法内部会进行对象属性深度合并,可以放心嵌套配置
// 需要在app.use(uview-plus)之后执行
@ -50,6 +53,7 @@ export function createApp() {
}
})
app.use(store)
app.config.globalProperties.$adpid = "1111111111"
app.config.globalProperties.$backgroundAudioData = {
playing: false,

25
mixins/index.js Normal file
View File

@ -0,0 +1,25 @@
import getCdnUrl from "@/common/getCdnUrl"
import * as untools from "@/common/untool"
import {
corePost
} from "@/common/request"
export const mixins = {
data() {
return {
};
},
computed: {},
created() {
console.log("我是mixin中的created生命周期函数");
},
// mounted() {
// console.log("我是mixin中的mounted生命周期函数");
// },
methods: {
...untools,
corePost,
getCdnUrl
},
}

View File

@ -40,10 +40,7 @@
</view>
</template>
<script>
import getCdnUrl from "@/common/getCdnUrl"
import { corePost } from "@/common/request"
import { USERKEY } from "@/store/actionKey"
import { goto, showLoading, hideLoading } from "@/common/untool"
export default {
props: {
@ -63,19 +60,18 @@
}
},
methods: {
getCdnUrl,
async handleLogin() {
const { remberPassport, submitParams } = this
if(remberPassport[0]) {
}
showLoading()
this.showLoading()
try{
await this.$store.dispatch(USERKEY.LOGIN, submitParams)
await this.$store.dispatch(USERKEY.GETUSERINFO)
goto("tabBar/home/home")
this.goto("tabBar/home/home")
}catch(e){
}
hideLoading()
this.hideLoading()
}
}
}