拼团商品详情问题接口404

uniapp运行的H5版本,购物车报错不能购买
小程序绑定手机号会报错
uniapp 3.1 tabbar显示
This commit is contained in:
Gao xiaosong
2020-09-20 23:00:32 +08:00
parent cd942b5349
commit 32a514eb74
8 changed files with 109 additions and 61 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2057,7 +2057,7 @@ page {
} }
.shoppingCart .list { .shoppingCart .list {
margin-top: 1.71*100rpx; margin-top: 0.8*100rpx;
} }
.shoppingCart .list .item { .shoppingCart .list .item {

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="activity-goods-box x-bc" @tap="jump('/pages/activity/GroupDetails/index', { id: id })"> <view class="activity-goods-box x-bc" @tap="jump('/pages/activity/GroupDetails/index', { id: cid })">
<view class="img-box"> <view class="img-box">
<slot name="tag"></slot> <slot name="tag"></slot>
<image class="img" :src="img" mode="aspectFill"></image> <image class="img" :src="img" mode="aspectFill"></image>
@ -27,7 +27,7 @@ export default {
return {}; return {};
}, },
props: { props: {
id: 0, cid: 0,
img: '', img: '',
title: '', title: '',
info: '', info: '',

View File

@ -9,7 +9,7 @@
</view> </view>
<view class="group-box"> <view class="group-box">
<view class="goods-item" v-for="(groupon, index) in grouponList" :key="groupon.id"> <view class="goods-item" v-for="(groupon, index) in grouponList" :key="groupon.id">
<activity-card :id="groupon.id" :title="groupon.title" :info="groupon.info" :img="groupon.image" <activity-card :cid="groupon.id" :title="groupon.title" :info="groupon.info" :img="groupon.image"
:price="groupon.price" :productPrice="groupon.productPrice"> :price="groupon.price" :productPrice="groupon.productPrice">
<block slot="tag"> <block slot="tag">
<view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view> <view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view>

View File

@ -28,7 +28,7 @@
<view class="checkbox-wrapper"> <view class="checkbox-wrapper">
<checkbox-group @change="switchSelect(cartListValidIndex)"> <checkbox-group @change="switchSelect(cartListValidIndex)">
<label class="well-check"> <label class="well-check">
<checkbox value :checked="item.checked"></checkbox> <checkbox value :checked="item.checked+''"></checkbox>
</label> </label>
</checkbox-group> </checkbox-group>
</view> </view>
@ -95,7 +95,7 @@
<Recommend></Recommend> <Recommend></Recommend>
</view> </view>
<view style="height:210rpx"></view> <view style="height:210rpx"></view>
<view :class="['footer acea-row row-between-wrapper']" v-if="cartList.valid.length > 0"> <view :class="{'footer acea-row row-between-wrapper':true,'footer-h5':isH5}" v-if="cartList.valid.length > 0">
<view> <view>
<view class="select-btn"> <view class="select-btn">
<view class="checkbox-wrapper"> <view class="checkbox-wrapper">
@ -170,6 +170,7 @@
invalid: [], invalid: [],
valid: [] valid: []
}, },
isH5: false,
validList: [], validList: [],
isAllSelect: false, isAllSelect: false,
cartCount: 0, cartCount: 0,
@ -182,7 +183,6 @@
}; };
}, },
computed: mapGetters(["userInfo", "token"]), computed: mapGetters(["userInfo", "token"]),
// watch: { // watch: {
// $yroute(n) { // $yroute(n) {
// if (n.name === "ShoppingCart") { // if (n.name === "ShoppingCart") {
@ -220,6 +220,10 @@
} }
}, },
onShow: function () { onShow: function () {
// #ifdef H5
this.isH5 = true
// #endif
console.log(this.userInfo)
if (this.userInfo.uid) { if (this.userInfo.uid) {
this.carnum(); this.carnum();
this.countMoney(); this.countMoney();
@ -509,3 +513,9 @@
} }
}; };
</script> </script>
<style lang="less">
.footer-h5 {
bottom: 50px
}
</style>

View File

@ -152,6 +152,7 @@
isWeixin, isWeixin,
VUE_APP_RESOURCES_URL VUE_APP_RESOURCES_URL
} from "@/utils"; } from "@/utils";
import cookie from "@/utils/store/cookie";
import SwitchWindow from "@/components/SwitchWindow"; import SwitchWindow from "@/components/SwitchWindow";
import Authorization from "@/pages/authorization/index"; import Authorization from "@/pages/authorization/index";
@ -214,52 +215,79 @@
uni.showLoading({ uni.showLoading({
title: "绑定中" title: "绑定中"
}); });
// 获取当前环境的服务商 bindingPhone({
uni.getProvider({ code: cookie.get('wxLoginCode'),
service: "oauth", encryptedData: e.mp.detail.encryptedData,
success: function (res) { iv: e.mp.detail.iv
// 此处可以排除h5 })
if (res.provider) { .then(res => {
uni.login({ // this.User();
success: loginRes => { thit.$store.dispatch("userInfo", true);
bindingPhone({ uni.hideLoading();
code: loginRes.code, uni.showToast({
encryptedData: e.mp.detail.encryptedData, title: res.msg,
iv: e.mp.detail.iv icon: "success",
}) duration: 2000
.then(res => { });
// this.User(); })
thit.$store.dispatch("userInfo", true); .catch(error => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ thit.$store.dispatch("userInfo", true);
title: res.msg, console.log(error);
icon: "success", uni.showToast({
duration: 2000 title: error.msg ||
}); error.response.data.msg ||
}) error.response.data.message,
.catch(error => { icon: "none",
uni.hideLoading(); duration: 2000
thit.$store.dispatch("userInfo", true); });
console.log(error); });
uni.showToast({ // // 获取当前环境的服务商
title: error.msg || // uni.getProvider({
error.response.data.msg || // service: "oauth",
error.response.data.message, // success: function (res) {
icon: "none", // // 此处可以排除h5
duration: 2000 // if (res.provider) {
}); // uni.login({
}); // success: loginRes => {
}, // bindingPhone({
fail() { // code: loginRes.code,
reject("绑定失败"); // encryptedData: e.mp.detail.encryptedData,
} // iv: e.mp.detail.iv
}); // })
} // .then(res => {
}, // // this.User();
fail() { // thit.$store.dispatch("userInfo", true);
reject("获取环境服务商失败"); // uni.hideLoading();
} // uni.showToast({
}); // title: res.msg,
// icon: "success",
// duration: 2000
// });
// })
// .catch(error => {
// uni.hideLoading();
// thit.$store.dispatch("userInfo", true);
// console.log(error);
// uni.showToast({
// title: error.msg ||
// error.response.data.msg ||
// error.response.data.message,
// icon: "none",
// duration: 2000
// });
// });
// },
// fail() {
// reject("绑定失败");
// }
// });
// }
// },
// fail() {
// reject("获取环境服务商失败");
// }
// });
} else { } else {
uni.showToast({ uni.showToast({
title: "已拒绝授权", title: "已拒绝授权",

View File

@ -275,6 +275,7 @@ export const login = () => {
console.log('登录接口调用成功') console.log('登录接口调用成功')
console.log('开始检查用户信息授权') console.log('开始检查用户信息授权')
let code = loginRes.code; let code = loginRes.code;
cookie.set('wxLoginCode',loginRes.code)
// 检查授权, 检查用户信息授权 // 检查授权, 检查用户信息授权
authorize('userInfo').then(() => { authorize('userInfo').then(() => {
console.log('授权通过') console.log('授权通过')
@ -859,13 +860,21 @@ export const handleLoginFailure = () => {
store.commit("updateAuthorization", false); store.commit("updateAuthorization", false);
let currentPageUrl = getCurrentPageUrl() let currentPageUrl = getCurrentPageUrl()
// token 失效
// 判断当前是不是已经在登录页面或者授权页,防止二次跳转 if (store.state.$deviceType == 'weixin') {
if (store.getters.isAuthorizationPage || currentPageUrl == '/pages/user/Login/index') { if (store.getters.isAuthorizationPage){
console.log(store.getters.isAuthorizationPage, currentPageUrl, '已经是登录页面或者授权页面,跳出方法') toAuth()
return }
} else {
// token 失效
// 判断当前是不是已经在登录页面或者授权页,防止二次跳转
if (store.getters.isAuthorizationPage || currentPageUrl == '/pages/user/Login/index') {
console.log(store.getters.isAuthorizationPage, currentPageUrl, '已经是登录页面或者授权页面,跳出方法')
return
}
} }
console.log('————————') console.log('————————')
console.log('当前是授权页面') console.log('当前是授权页面')
console.log(store.getters) console.log(store.getters)
@ -873,6 +882,7 @@ export const handleLoginFailure = () => {
store.commit("updateAuthorizationPage", true); store.commit("updateAuthorizationPage", true);
let path = '/' + getCurrentPageUrlWithArgs() let path = '/' + getCurrentPageUrlWithArgs()
let qrCode = handleQrCode() let qrCode = handleQrCode()
if (qrCode) { if (qrCode) {