123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- <style lang="scss">
- @import "@/uni_modules/uview-ui/index.scss";
- </style>
- <script>
- import {
- checkLogin
- } from './libs/login';
- import {
- HTTP_REQUEST_URL
- } from './config/app';
- import {
- getShopConfig,
- silenceAuth
- } from '@/api/public';
- import Auth from '@/libs/wechat.js';
- import Routine from './libs/routine.js';
- import {
- silenceBindingSpread
- } from "@/utils";
- import {
- getCartCounts,
- } from '@/api/order.js';
- import {
- colorChange,
- getCrmebCopyRight
- } from '@/api/api.js';
- import {
- mapGetters
- } from "vuex"
- import colors from '@/mixins/color.js';
- let green =
- '--view-theme: rgba(66,202,77,1);--view-theme-16: #42CA4D;--view-priceColor:#FF7600;--view-minorColor:rgba(108, 198, 94, 0.5);--view-minorColorT:rgba(66, 202, 77, 0.1);--view-bntColor:#FE960F;--view-op-ten: rgba(66,202,77, 0.1);--view-main-start:#70E038; --view-main-over:#42CA4D;--view-op-point-four: rgba(66,202,77, 0.04);'
- let red =
- '--view-theme: rgba(233,51,35,1);--view-theme-16: #e93323;--view-priceColor:#e93323;--view-minorColor:rgba(233, 51, 35, 0.5);--view-minorColorT:rgba(233, 51, 35, 0.1);--view-bntColor:#FE960F;--view-op-ten: rgba(233,51,35, 0.1);--view-main-start:#FF6151; --view-main-over:#e93323;--view-op-point-four: rgba(233,51,35, 0.04);'
- let blue =
- '--view-theme: rgba(29,176,252,1);--view-theme-16:#1db0fc;--view-priceColor:#FD502F;--view-minorColor:rgba(58, 139, 236, 0.5);--view-minorColorT:rgba(9, 139, 243, 0.1);--view-bntColor:#22CAFD;--view-op-ten: rgba(29,176,252, 0.1);--view-main-start:#40D1F4; --view-main-over:#1DB0FC;--view-op-point-four: rgba(29,176,252, 0.04);'
- let pink =
- '--view-theme: rgba(255,68,143,1);--view-theme-16:#ff448f;--view-priceColor:#FF448F;--view-minorColor:rgba(255, 68, 143, 0.5);--view-minorColorT:rgba(255, 68, 143, 0.1);--view-bntColor:#282828;--view-op-ten: rgba(255,68,143, 0.1);--view-main-start:#FF67AD; --view-main-over:#FF448F;--view-op-point-four: rgba(255,68,143, 0.04);'
- let orange =
- '--view-theme: rgba(254,92,45,1); --view-theme-16:#FE5C2D;--view-priceColor:#FE5C2D;--view-minorColor:rgba(254, 92, 45, 0.5);--view-minorColorT:rgba(254, 92, 45, 0.1);--view-bntColor:#FDB000;--view-op-ten: rgba(254,92,45, 0.1);--view-main-start:#FF9445; --view-main-over:#FE5C2D;--view-op-point-four: rgba(254,92,45, 0.04);'
- export default {
- globalData: {
- spid: 0,
- code: 0,
- isLogin: false,
- userInfo: {},
- MyMenus: [],
- globalData: false,
- isIframe: false,
- tabbarShow: true,
- windowHeight: 0,
- locale: ''
- },
- mixins: [colors],
- computed: mapGetters(['isLogin', 'cartNum']),
- watch: {
- isLogin: {
- deep: true,
- handler: function(newV, oldV) {
- if (newV) {
-
- } else {
- this.$store.commit('indexData/setCartNum', '')
- }
- }
- },
- cartNum(newCart, b) {
- this.$store.commit('indexData/setCartNum', newCart + '')
- if (newCart > 0) {
- uni.setTabBarBadge({
- index: Number(uni.getStorageSync('FOOTER_ADDCART')) || 2,
- text: newCart + ''
- })
- } else {
- uni.hideTabBarRedDot({
- index: Number(uni.getStorageSync('FOOTER_ADDCART')) || 2
- })
- }
- }
- },
- async onLaunch(option) {
- let that = this;
- colorChange('color_change').then(res => {
- uni.setStorageSync('is_diy', res.data.is_diy)
- uni.$emit('is_diy', res.data.is_diy)
- switch (res.data.status) {
- case 1:
- uni.setStorageSync('viewColor', blue)
- uni.$emit('ok', blue, res.data.status)
- break;
- case 2:
- uni.setStorageSync('viewColor', green)
- uni.$emit('ok', green, res.data.status)
- break;
- case 3:
- uni.setStorageSync('viewColor', red)
- uni.$emit('ok', red, res.data.status)
- break;
- case 4:
- uni.setStorageSync('viewColor', pink)
- uni.$emit('ok', pink, res.data.status)
- break;
- case 5:
- uni.setStorageSync('viewColor', orange)
- uni.$emit('ok', orange, res.data.status)
- break;
- default:
- uni.setStorageSync('viewColor', red)
- uni.$emit('ok', red, res.data.status)
- break
- }
- });
- if (option.query.spread) {
- that.$Cache.set('spread', option.query.spread);
- that.globalData.spid = option.query.spread;
- that.globalData.pid = option.query.spread;
- silenceBindingSpread()
- }
- if (option.query.spid) {
- that.$Cache.set('spread', option.query.spid);
- that.globalData.spid = option.query.spid;
- that.globalData.pid = option.query.spid;
-
- }
-
- uni.getSystemInfo({
- success: function(res) {
-
-
- let height = res.windowHeight - res.statusBarHeight - 44
-
- that.globalData.windowHeight = res.windowHeight + 'px'
-
-
-
-
- }
- });
-
-
- if (HTTP_REQUEST_URL == '') {
- console.error(
- "请配置根目录下的config.js文件中的 'HTTP_REQUEST_URL'\n\n请修改开发者工具中【详情】->【AppID】改为自己的Appid\n\n请前往后台【小程序】->【小程序配置】填写自己的 appId and AppSecret"
- );
- return false;
- }
- if (option.query.hasOwnProperty('scene')) {
- switch (option.scene) {
-
- case 1047:
- let val = that.$util.getUrlParams(decodeURIComponent(option.query.scene));
- that.globalData.code = val.pid === undefined ? val : val.pid;
- break;
-
- case 1048:
- that.globalData.code = option.query.scene;
- break;
-
- case 1049:
- that.globalData.code = option.query.scene;
- break;
-
- case 1001:
- that.globalData.spid = option.query.scene;
- break;
- }
- }
- const updateManager = wx.getUpdateManager();
- updateManager.onCheckForUpdate(function(res) {
-
- });
- updateManager.onUpdateReady(function() {
- wx.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success: function(res) {
- if (res.confirm) {
-
- updateManager.applyUpdate();
- }
- }
- });
- });
- updateManager.onUpdateFailed(function() {
- return that.Tips({
- title: '新版本下载失败'
- });
- });
-
-
-
-
-
- uni.getSystemInfo({
- success: function(res) {
- that.globalData.navHeight = res.statusBarHeight * (750 / res.windowWidth) + 91;
- }
- });
-
- let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
- that.globalData.navH = menuButtonInfo.top * 2 + menuButtonInfo.height / 2;
-
-
- uni.getSystemInfo({
- success(e) {
-
- if (e.windowWidth > 420 && !window.top.isPC && !/iOS|Android/i.test(e.system)) {
- window.location.pathname = '/static/html/pc.html';
- }
- }
- });
- if (option.query.hasOwnProperty('type') && option.query.type == "iframeWindow") {
- this.globalData.isIframe = true;
- } else {
- this.globalData.isIframe = false;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var __s = document.createElement('script');
- __s.src = `${HTTP_REQUEST_URL}/api/get_script`;
- document.head.appendChild(__s);
-
- getCrmebCopyRight().then(res => {
- uni.setStorageSync('copyRight', res.data)
- })
- },
- methods: {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- onHide: function() {
- }
- };
- </script>
- <style>
- @import url('@/plugin/emoji-awesome/css/tuoluojiang.css');
- @import url('@/plugin/animate/animate.min.css');
- @import 'static/css/base.css';
- @import 'static/iconfont/iconfont.css';
- @import 'static/css/guildford.css';
- @import 'static/css/style.scss';
- view {
- box-sizing: border-box;
- }
- page {
- font-family: PingFang SC;
- }
- .bg-color-red {
- background-color: var(--view-theme) !important;
- }
- .syspadding {
- padding-top: var(--status-bar-height);
- }
- .flex {
- display: flex;
- }
- .uni-scroll-view::-webkit-scrollbar {
-
- display: none;
- }
- ::-webkit-scrollbar {
- width: 0;
- height: 0;
- color: transparent;
- }
- .uni-system-open-location .map-content.fix-position {
- height: 100vh;
- top: 0;
- bottom: 0;
- }
- .open-location {
- width: 100%;
- height: 100vh;
- }
- </style>
|