123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <template>
- <view>
- <index ref="首页" v-show="page == '首页'" />
- <store ref="活动" v-show="page == '活动'" />
- <my-case ref="案例" v-show="page == '案例'" />
- <user-center ref="我的" v-show="page == '我的'" />
- <workbench ref="工作台" v-show="page == '工作台'" />
- <dataBank ref="资料库" v-show="page == '资料库'" />
- <school ref="商学院" v-show="page == '商学院'" />
- <product ref="单品" v-show="page == '单品'" />
- <bottom-suspension-frame ref="pages" @onChange="pageChange" />
- </view>
- </template>
- <script>
- import index from './index/index.vue'
- import store from './index/store.vue'
- import myCase from './index/myCase.vue'
- import userCenter from './index/userCenter.vue'
- import dataBank from './cloud/dataBank.vue'
- import school from './cloud/school.vue'
- import product from './cloud/product.vue'
- import workbench from './cloud/workbench.vue'
- import bottomSuspensionFrame from "./modules/bottomSuspensionFrame.vue";
- export default {
- components: { bottomSuspensionFrame, index, store, myCase, userCenter, dataBank, school, product, workbench },
- data() {
- return {
- swiperItemID: 'index',
- page: '首页',
- user: {
- wechatBindUserid: 0,
- userName: ""
- }
- }
- },
- onLoad(options) {
- if (options.wechatBindUserid) {
- this.user.wechatBindUserid = options.wechatBindUserid;
- this.user.userName = options.userName;
- }
- if (options.q) this.user = this.getUrlParams(options.q);
- },
- onShow() {
- const systemInitIsComplete = this.$Http.systemInitIsComplete;
- if (!systemInitIsComplete || typeof systemInitIsComplete == 'object') {
- this.$Http.HomePageStartRendering = render(this)
- } else {
- render(this)
- }
- function render(that) {
- that.$Http.changePage = function (itemId, page, params) {
- that.$refs.pages.onClick(itemId, page, false, params)
- }.bind(that)
- // #ifdef MP-WEIXIN
- that.updatePageData(that.swiperItemID, that.page)
- // #endif
- if (that.user.wechatBindUserid) {
- console.log("被邀请绑定账号", that.user);
- uni.showModal({
- title: '提醒',
- content: `"${that.user.userName}"是否与当前微信号绑定`,
- confirmText: '确定绑定',
- success: function ({ confirm }) {
- if (confirm) uni.login({
- success(res) {
- that.$Http.basic({
- "id": 20240516090402,
- "content": {
- "wechat_code": res.code,
- "isbinging": 1,
- "wechatuserinfo": "",
- "userid": that.user.wechatBindUserid
- }
- }).then(s => {
- console.log("绑定账号", s)
- uni.showModal({
- title: '提示',
- content: s.msg == '成功' ? '绑定成功' : s.msg,
- showCancel: false,
- success: function ({ confirm }) {
- if (confirm) {
- if (s.msg == '成功') that.$Login.wechatLogin().then(() => {
- uni.reLaunch({
- url: '/pages/index/index'
- })
- that.user = {
- wechatBindUserid: 0,
- userName: ""
- }
- })
- }
- }
- });
- if (that.cutoff(res.msg, '绑定成功')) return;
- })
- }
- })
- }
- });
- }
- }
- },
- methods: {
- updatePageData(itemId, page) {
- if (this.$refs[this.page].updatePage) this.$refs.pages.onClick(itemId, page)
- },
- pageChange(detail) {
- uni.setNavigationBarTitle({
- title: detail.name,
- })
- this.page = detail.name;
- try {
- console.log(this.$refs[detail.name].updatePage)
- if (this.$refs[detail.name].updatePage) uni.pageScrollTo({
- scrollTop: 0,
- duration: 0,
- })
- this.$refs[detail.name].init(detail.callBack, detail.params)
- } catch (error) {
- detail.callBack()
- }
- console.log("切换页面", detail)
- }
- }
- }
- </script>
- <style lang="scss"></style>
|