123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <script>
- // #ifdef APP-PLUS
- import {
- getUpApp
- } from './utils/upApp.js';
- // #endif
- import {
- mapActions,
- mapMutations
- } from 'vuex';
- import {
- getConfig
- } from '@/api/app';
- import {
- setTabbar,
- strToParams
- } from '@/utils/tools';
- import {
- bindSuperior
- } from '@/api/user';
- import {
- INVITE_CODE
- } from '@/config/cachekey';
- import Cache from '@/utils/cache';
- export default {
- onLaunch: function(options) {
- // #ifdef APP-PLUS
- // 判断是否升级
- getUpApp();
- // #endif
- // 获取配置
- this.getConfigFun();
- this.getUser();
- this.getSystemInfo();
- },
- onShow: function(options) {
- console.log(options);
- this.bindCode(options);
- },
- onHide: function() {},
- methods: {
- ...mapActions(['getSystemInfo', 'getUser', 'wxShare', 'initLocationFunc']),
- ...mapMutations(['setConfig']),
- async getConfigFun() {
- const {
- code,
- data
- } = await getConfig();
- if (code == 1) {
- this.setConfig(data);
- if (data.is_open_nearby) {
- // 获取定位
- this.initLocationFunc();
- }
- setTabbar();
- // 防止第一次调用时拿不到数据
- this.wxShare();
- }
- },
- async bindCode(options) {
- if (!options.query) return;
- let invite_code = options.query.invite_code || strToParams(decodeURIComponent(options.query.scene))
- .invite_code;
- if (invite_code) {
- const {
- data,
- code
- } = await bindSuperior({
- code: invite_code
- });
- if (code == -1) {
- Cache.set(INVITE_CODE, invite_code);
- }
- }
- }
- }
- };
- </script>
- <style lang="scss">
- @import 'styles/common.scss';
- @import 'components/uview-ui/index.scss';
- @import url('@/plugin/emoji-awesome/css/apple.css');
- @import url('static/font/iconfont.css');
- /*每个页面公共css */
- page {
- background: linear-gradient(180deg, rgba(243, 244, 246, 0.98) 0%, #f4e4e4 37%, #f4eced 69%, #f3eced 85%, #f3f4f6 100%);
- }
- .d-flex {
- display: flex;
- }
- .justify-content-between {
- justify-content: space-between;
- }
- .justify-content-center {
- justify-content: center;
- }
- .align-items-center {
- align-items: center;
- }
- .flex-wrap {
- flex-wrap: wrap;
- }
- .text-center {
- text-align: center;
- }
- .bg-white {
- background-color: #fff;
- }
- .radius10 {
- border-radius: 20upx;
- }
- .titColor {
- color: #040404;
- }
- .align-content-between {
- align-content: space-between;
- }
- </style>
|