diff --git a/api/api.js b/api/api.js index 31116df..9a802ef 100644 --- a/api/api.js +++ b/api/api.js @@ -1,12 +1,12 @@ import request from "@/utils/request.js"; /** * 公共接口 ,优惠券接口 , 行业此讯 , 手机号码注册 - * + * */ /** * 获取主页数据 无需授权 - * + * */ export function getIndexData() { return request.get("index", {}, { @@ -16,7 +16,7 @@ export function getIndexData() { /** * 获取登录授权login - * + * */ export function getLogo() { return request.get('wechat/getLogo', {}, { @@ -27,7 +27,7 @@ export function getLogo() { /** * 保存form_id - * @param string formId + * @param string formId */ export function setFormId(formId) { return request.post("wechat/set_form_id", { @@ -38,7 +38,7 @@ export function setFormId(formId) { /** * 领取优惠卷 * @param int couponId - * + * */ export function setCouponReceive(couponId) { return request.post('coupon/receive', { @@ -65,7 +65,7 @@ export function getUserCoupons(data) { /** * 文章分类列表 - * + * */ export function getArticleCategoryList() { return request.get('article/category/list', {}, { @@ -76,7 +76,7 @@ export function getArticleCategoryList() { /** * 文章列表 * @param int cid - * + * */ export function getArticleList(cid, data) { return request.get('article/list/' + cid, data, { @@ -86,7 +86,7 @@ export function getArticleList(cid, data) { /** * 文章 热门列表 - * + * */ export function getArticleHotList() { return request.get('article/hot/list', {}, { @@ -96,7 +96,7 @@ export function getArticleHotList() { /** * 文章 轮播列表 - * + * */ export function getArticleBannerList() { return request.get('article/banner/list', {}, { @@ -106,8 +106,8 @@ export function getArticleBannerList() { /** * 文章详情 - * @param int id - * + * @param int id + * */ export function getArticleDetails(id) { return request.get('article/info', id, { @@ -150,7 +150,7 @@ export function registerVerify(phone) { /** * 手机号注册 * @param object data - * + * */ export function phoneRegister(data) { return request.post('register', data, { @@ -161,7 +161,7 @@ export function phoneRegister(data) { /** * 手机号修改密码 * @param object data - * + * */ export function phoneRegisterReset(data) { return request.post('register/reset', data, { @@ -172,7 +172,7 @@ export function phoneRegisterReset(data) { /** * 手机号+密码登录 * @param object data - * + * */ export function phoneLogin(data) { return request.post('login', data, { @@ -205,7 +205,7 @@ export function switchH5Login() { /** * 换绑手机号 - * + * */ export function bindingPhone(data) { return request.post('update/binding', data); @@ -213,7 +213,7 @@ export function bindingPhone(data) { /** * 换绑手机号校验 - * + * */ export function bindingVerify(data) { return request.post('update/binding/verify', data); @@ -221,7 +221,7 @@ export function bindingVerify(data) { /** * 退出登錄 - * + * */ export function logout() { return request.get('logout'); @@ -361,9 +361,9 @@ export function getinstallment(data) { // 到首页查询ip地址 -// 首页记录ip -export function logoip() { - return request.get(`login/log`, {}, { + +export function getip() { + return request.get('login/log', { noAuth: true }); } @@ -374,4 +374,4 @@ export function logoip() { // return request.get('order/getSignResult/',data,{ // noAuth: true // }) -// } \ No newline at end of file +// } diff --git a/api/public.js b/api/public.js index 8da5068..9a883a4 100644 --- a/api/public.js +++ b/api/public.js @@ -19,13 +19,12 @@ export function getWechatConfig() { * 获取微信sdk配置 * @returns {*} */ -export function wechatAuth(code, spread,) { +export function wechatAuth(code, spread,channelId) { var reg=/^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 ,判断正整数用/^[1-9]+[0-9]*]*$/ spread = reg.test(spread) ? spread : 0; - channelId = reg.test(channelId) ? channelId : 0; return request.get( - "wechat/authorize/login?code=" + code + "&spread_spid=" + spread , {}, + "wechat/authorize/login?code=" + code + "&spread_spid=" + spread+"&channelId="+channelId, {}, { noAuth: true } ); } diff --git a/config/cache.js b/config/cache.js index bf653ac..0365d25 100644 --- a/config/cache.js +++ b/config/cache.js @@ -26,7 +26,8 @@ module.exports = { TIPS_KEY: 'TIPS_KEY', - SPREAD: 'SPREAD', + + SPREAD: 'SPREAD', CHANNELID: 'CHANNELID', //缓存经度 CACHE_LONGITUDE: 'LONGITUDE', diff --git a/pages/goods_details/index.vue b/pages/goods_details/index.vue index bd89793..855b7f4 100644 --- a/pages/goods_details/index.vue +++ b/pages/goods_details/index.vue @@ -200,10 +200,10 @@ - + @@ -369,6 +369,7 @@ import cusPreviewImg from '@/components/cus-previewImg/cus-previewImg.vue' import { silenceBindingSpread,silenceBindingChannelId + } from "@/utils"; import parser from "@/components/jyf-parser/jyf-parser"; import { @@ -551,7 +552,7 @@ }, onLoad(options) { // console.log(JSON.stringify(options),"options.spread") - alert("options.spread"+JSON.stringify(options)) + // alert("options.spread"+JSON.stringify(options)) //用户从分享卡片进入的场景下获取主题色配置 this.$set(this, 'theme', this.$Cache.get('theme')); @@ -609,7 +610,7 @@ // #endif if (options.spread) app.globalData.spread = options.spread; - if (options.channelId) app.globalData.channelId = options.channelId; + if (options.channelId) app.globalData.channelId = options.channelId; this.getGoodsDetails(); //商品详情 this.getCouponType(); //获取默认的 优惠券类型 @@ -648,6 +649,8 @@ title: that.productInfo.storeName || '', imageUrl: that.productInfo.image || '', path: '/pages/goods_details/index?id=' + that.id + '&spread=' + that.uid, + + } }, // #endif @@ -700,6 +703,8 @@ scene: scene, type: 0, href: `${HTTP_H5_URL}${curRoute}&spread=${that.uid}`, + + title: that.productInfo.storeName, summary: app.globalData.companyName, imageUrl: that.productInfo.image, @@ -1318,7 +1323,10 @@ */ goBuy: Debounce(function(e) { if (this.isLogin === false) { - toLogin(); + // toLogin(); + uni.navigateTo({ + url:'/pages/user/index' + }) } else { this.goCat(0); } @@ -1428,6 +1436,7 @@ } }) }, + getImageBase64: function(images) { let that = this; imageBase64({ diff --git a/pages/index/index.vue b/pages/index/index.vue index deaeacb..550fc69 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -2,8 +2,12 @@ + + + :style="{visibility: showSkeleton ? 'hidden' : 'visible'}" v-if="showwait==false"> @@ -174,13 +178,13 @@ } from '@/api/api.js'; import { spread, - + } from "@/api/user"; // #ifdef MP-WEIXIN || APP-PLUS import { getTemlIds, logoip, - + } from '@/api/api.js'; // #endif // #ifdef H5 @@ -355,7 +359,8 @@ appUpdate: {}, wxText: "点击添加到我的小程序,微信首页下拉即可访问商城。", cardShow: 1, //首页商品列表模板配置,1 精品推荐 2 热门榜单 3首发新品 4促销单品 - locationStatus: false + locationStatus: false, + showwait:false } }, watch: { @@ -373,7 +378,7 @@ this.setTabList() }, onLoad(options) { - + // const env = uni.getEnv(); // 获取系统信息 @@ -382,7 +387,7 @@ // 判断当前环境 uni.setStorageSync('systemInfo', systemInfo.uniPlatform); // const storedSystemInfo = uni.getStorageSync('systemInfo'); - + // console.log('存储的系统信息:', storedSystemInfo); // if (systemInfo.uniPlatform === 'android' || systemInfo.uniPlatform === 'ios') { // console.log('当前环境是 App'); @@ -397,7 +402,7 @@ // } else { // console.log('未知环境'); // } - + if (app.globalData.isIframe) { setTimeout(() => { let active; @@ -468,13 +473,21 @@ if (this.isLogin && parseInt(options.channelId) > 0) { silenceBindingChannelId() } + this.getipdz() + // #ifdef H5 + var app_type = this.isWeiXin() ? 'weixinh5' : 'h5'; + var app_type_name = this.isWeiXin() ? '微信公众号' : 'H5'; + // #endif + if(app_type=='weixinh5'){ + this.showwait=true + } }, onShow() { let self = this; - if (!self.$Cache.getItem('cityList')) getCityList() + // if (!self.$Cache.getItem('cityList')) getCityList() // #ifdef APP-PLUS let barHeight = uni.getSystemInfoSync().statusBarHeight; self.marTop = barHeight + 40; //刘海屏 @@ -487,45 +500,69 @@ uni.showTabBar(); let currentUrl = window.location.href; - + // 解析URL,提取参数 let urlParams = new URLSearchParams(currentUrl); - + // 获取名为code的参数的值 - let codeValue = urlParams.get('code'); - console.log(codeValue,'codeValuecodeValuecodeValue'); - console.log('进入了首页'); - const id = uni.getStorageSync('openid'); - - if(codeValue){ - console.log('登陆成功',id); - uni.setStorageSync('openid', codeValue); - let stause= uni.getStorageSync('loginstause'); - if(stause){ - - console.log('进入判断1'); - - }else{ - console.log('进入判断2'); - uni.switchTab({ - url:'/pages/user/index' - }) - } - }else{ - - } + // let codeValue = urlParams.get('code'); + // console.log(codeValue,'codeValuecodeValuecodeValue'); + // console.log('进入了首页'); + // const id = uni.getStorageSync('openid'); + + // if(codeValue){ + // console.log('登陆成功',id); + // uni.setStorageSync('openid', codeValue); + // let stause= uni.getStorageSync('loginstause'); + // if(stause){ + + // console.log('进入判断1'); + + // }else{ + // console.log('进入判断2'); + // // uni.switchTab({ + // // url:'/pages/user/index' + // // }) + // } + // }else{ + + // } + // let self = this; + // if (!self.$Cache.getItem('cityList')) getCityList() + // // #ifdef APP-PLUS + // let barHeight = uni.getSystemInfoSync().statusBarHeight; + // self.marTop = barHeight + 40; //刘海屏 + // setTimeout(() => { + // if (self.appUpdate.openUpgrade == 'true') { + // self.appVersionConfig(); + // } + // }, 1000) + // #endif + uni.showTabBar(); + // 调用记录ip // this.getip() }, methods: { + isWeiXin() { + // #ifndef H5 + return false; + // #endif + var ua = navigator.userAgent.toLowerCase(); + if (ua.match(/MicroMessenger/i) == "micromessenger") { + return true; + } else { + return false; + } + }, // 获取IP地址 getipdz(){ getip().then(res => { console.log(res,111) }) }, - - + + menusTap(url) { goPage().then(res => { if (url == '/pages/goods_cate/goods_cate') { @@ -894,6 +931,15 @@ } \ No newline at end of file + diff --git a/pages/users/logins/index.vue b/pages/users/logins/index.vue index 9b11ada..0d5bb61 100644 --- a/pages/users/logins/index.vue +++ b/pages/users/logins/index.vue @@ -154,8 +154,9 @@ }, onShow() { - let abb=uni.getStorageSync('channelId') - console.log(abb,'abbabbabbabbabb'); + // let abb='4' + // uni.setStorageSync('channelId', abb); + }, methods: { // 苹果登录 @@ -319,14 +320,15 @@ uni.showLoading({ title: '登录中' }) - let channelId='' + let channelId=0 let abb=uni.getStorageSync('channelId') if(abb!=undefined){ - channelId=abb + channelId=parseInt(abb); } - let openid= uni.getStorageSync('loginstause'); + let openid= uni.getStorageSync('openid'); + console.log(typeof channelId,'channelIdchannelId'); loginMobiles({ phone: that.account, captcha: that.captcha, diff --git a/pages/users/user_info/index.vue b/pages/users/user_info/index.vue index 6e316de..d3ee0b7 100644 --- a/pages/users/user_info/index.vue +++ b/pages/users/user_info/index.vue @@ -82,8 +82,8 @@ 退出登录 - 退出登录 + 退出登录 diff --git a/pages/users/wechat_login/index.vue b/pages/users/wechat_login/index.vue index bd26367..c515679 100644 --- a/pages/users/wechat_login/index.vue +++ b/pages/users/wechat_login/index.vue @@ -144,8 +144,7 @@ //if(!code) location.replace(decodeURIComponent(decodeURIComponent(option.query.back_url))); if (code && this.options.scope !== 'snsapi_base') { let spread = app.globalData.spread ? app.globalData.spread : 0; - - let channelId = app.globalData.channelId ? app.globalData.channelId : 0; + let channelId = app.globalData.channelId ? app.globalData.channelId : 0; //公众号授权登录回调 wechatAuth(code, Cache.get("spread"), loginType) wechat.auth(code, spread,channelId).then(res => { if (res.type === 'register') { @@ -252,7 +251,7 @@ let userInfo = {}; userInfo.code = code; userInfo.spread_spid = app.globalData.spread; //获取推广人ID - userInfo.channelId = app.globalData.channelId; //渠道ID + userInfo.channelId = app.globalData.channelId; //渠道ID userInfo.avatar = ''; userInfo.nickName = '微信用户'; userInfo.type = 'routine' @@ -268,7 +267,7 @@ let userInfo = res.userInfo; userInfo.code = code; userInfo.spread_spid = app.globalData.spread; //获取推广人ID - userInfo.channelId = app.globalData.channelId; //渠道ID + userInfo.channelId = app.globalData.channelId; //渠道ID userInfo.avatar = userInfo.userInfo.avatarUrl; userInfo.city = userInfo.userInfo.city; userInfo.country = userInfo.userInfo.country; diff --git a/static/img/wait.jpg b/static/img/wait.jpg new file mode 100644 index 0000000..ef5ca2b Binary files /dev/null and b/static/img/wait.jpg differ