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

View File

@ -1,6 +1,7 @@
import App from './App' import App from './App'
import store from './store' import store from './store'
import uviewPlus from '@/uni_modules/uview-plus' import uviewPlus from '@/uni_modules/uview-plus'
import { mixins } from "./mixins"
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'
@ -17,7 +18,7 @@ const app = new Vue({
store, store,
...App ...App
}) })
app.mixin(mixins);
app.$mount() app.$mount()
// #endif // #endif
@ -27,6 +28,8 @@ import {
} from 'vue' } from 'vue'
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
app.mixin(mixins);
app.use(uviewPlus) app.use(uviewPlus)
// 调用setConfig方法,方法内部会进行对象属性深度合并,可以放心嵌套配置 // 调用setConfig方法,方法内部会进行对象属性深度合并,可以放心嵌套配置
// 需要在app.use(uview-plus)之后执行 // 需要在app.use(uview-plus)之后执行
@ -50,6 +53,7 @@ export function createApp() {
} }
}) })
app.use(store) app.use(store)
app.config.globalProperties.$adpid = "1111111111" app.config.globalProperties.$adpid = "1111111111"
app.config.globalProperties.$backgroundAudioData = { app.config.globalProperties.$backgroundAudioData = {
playing: false, 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> </view>
</template> </template>
<script> <script>
import getCdnUrl from "@/common/getCdnUrl"
import { corePost } from "@/common/request"
import { USERKEY } from "@/store/actionKey" import { USERKEY } from "@/store/actionKey"
import { goto, showLoading, hideLoading } from "@/common/untool"
export default { export default {
props: { props: {
@ -63,19 +60,18 @@
} }
}, },
methods: { methods: {
getCdnUrl,
async handleLogin() { async handleLogin() {
const { remberPassport, submitParams } = this const { remberPassport, submitParams } = this
if(remberPassport[0]) { if(remberPassport[0]) {
} }
showLoading() this.showLoading()
try{ try{
await this.$store.dispatch(USERKEY.LOGIN, submitParams) await this.$store.dispatch(USERKEY.LOGIN, submitParams)
await this.$store.dispatch(USERKEY.GETUSERINFO) await this.$store.dispatch(USERKEY.GETUSERINFO)
goto("tabBar/home/home") this.goto("tabBar/home/home")
}catch(e){ }catch(e){
} }
hideLoading() this.hideLoading()
} }
} }
} }