修改移动端授权登录bug,没有展示自营标志,以及新增商品详情 自营以及商品数量收藏数量展示

master
lemon橪 2021-06-22 18:12:35 +08:00
parent 2f180d5178
commit 1489deb618
13 changed files with 324 additions and 256 deletions

View File

@ -65,7 +65,6 @@ export default {
this.getClipboard(); this.getClipboard();
// #endif // #endif
}, },
methods: { methods: {
// TODO 广 // TODO 广
launch() { launch() {

View File

@ -4,10 +4,10 @@
*/ */
// 开发环境 // 开发环境
const dev = { const dev = {
common: "http://192.168.0.100:8890", // common: "http://192.168.0.100:8890",
buyer: "http://192.168.0.100:8888", // buyer: "http://192.168.0.100:8888",
// common: "https://common-api.pickmall.cn", common: "https://common-api.pickmall.cn",
// buyer: "https://buyer-api.pickmall.cn", buyer: "https://buyer-api.pickmall.cn",
}; };
// 生产环境 // 生产环境
const prod = { const prod = {

View File

@ -408,7 +408,9 @@
{ {
"path": "wechatMPLogin", "path": "wechatMPLogin",
"style": { "style": {
"navigationBarTitleText": "小程序登录" "navigationBarTitleText": "小程序登录",
"navigationStyle": "custom",
"navigationBarTextStyle": "black"
} }
} }
] ]

View File

@ -179,7 +179,7 @@
</div> </div>
<div class="storeSellerName"> <div class="storeSellerName">
<div class="textHidden"> <div class="textHidden">
<u-tag style="margin-right: 10rpx" size="mini" mode="dark" v-if="item.selfOperated == 1" text="自营" type="error" /> <u-tag style="margin-right: 10rpx" size="mini" mode="dark" v-if="item.selfOperated" text="自营" type="error" />
<span>{{ item.storeName || "暂无" }}</span> <span>{{ item.storeName || "暂无" }}</span>
</div> </div>
<span> <span>
@ -314,7 +314,7 @@ export default {
isSWitch: false, isSWitch: false,
params: { params: {
pageNumber: 0, pageNumber: 1,
pageSize: 10, pageSize: 10,
// sort: 'grade_asc', // sort: 'grade_asc',
sort: "releaseTime", sort: "releaseTime",
@ -324,7 +324,7 @@ export default {
minPrice: "", minPrice: "",
maxPrice: "", maxPrice: "",
sortParams: { sortParams: {
pageNumber: 0, pageNumber: 1,
pageSize: 10, pageSize: 10,
// price: "", //,(10_30) // price: "", //,(10_30)
@ -474,7 +474,7 @@ export default {
this.minPrice = ""; this.minPrice = "";
this.maxPrice = ""; this.maxPrice = "";
this.params = { this.params = {
pageNumber: 0, pageNumber: 1,
pageSize: 10, pageSize: 10,
}; };
this.loadData(); this.loadData();
@ -545,7 +545,7 @@ export default {
}, },
tabClick(index, type) { tabClick(index, type) {
this.params.pageNumber = 0; this.params.pageNumber = 1;
this.params.pageSize = 10; this.params.pageSize = 10;
// this.params.order = "desc"; // this.params.order = "desc";
if (this.params.sort == type) { if (this.params.sort == type) {
@ -687,7 +687,7 @@ export default {
this.isShowSeachGoods = true; this.isShowSeachGoods = true;
this.$refs.mSearch.isShowSeachGoods = true; this.$refs.mSearch.isShowSeachGoods = true;
this.params.keyword = keyword; this.params.keyword = keyword;
this.params.pageNumber = 0; this.params.pageNumber = 1;
this.$set(this.sortParams, "keyword", keyword); this.$set(this.sortParams, "keyword", keyword);
this.loadData("refresh", 1); this.loadData("refresh", 1);

View File

@ -13,7 +13,7 @@
</template> </template>
<script> <script>
import { webConnect, openIdLogin } from "@/api/connect.js"; import { openIdLogin } from "@/api/connect.js";
import { whetherNavigate } from "@/utils/Foundation"; // import { whetherNavigate } from "@/utils/Foundation"; //
import { getUserInfo } from "@/api/members"; import { getUserInfo } from "@/api/members";
import storage from "@/utils/storage.js"; import storage from "@/utils/storage.js";

View File

@ -1,6 +1,7 @@
<template> <template>
<view class="container"> <view class="container">
<u-modal v-model="phoneAuthPopup" :title="projectName+'商城'" :show-confirm-button="false"> <u-navbar :custom-back="back" title="小程序登录"></u-navbar>
<u-modal v-model="phoneAuthPopup" :mask-close-able="true" :title="projectName+'商城'" :show-confirm-button="false">
<div class="tips"> <div class="tips">
为了更好地用户体验需要您授权手机号 为了更好地用户体验需要您授权手机号
</div> </div>
@ -18,8 +19,7 @@
<view>您的公开信息昵称头像</view> <view>您的公开信息昵称头像</view>
</view> </view>
<view class="btns"> <view class="btns">
<button type="primary" bindtap="getUserProfile" @click="getUserProfile()" <button type="primary" bindtap="getUserProfile" @click="getUserProfile()" class="btn-auth">确认微信授权</button>
class="btn-auth">确认微信授权</button>
</view> </view>
</div> </div>
</view> </view>
@ -27,15 +27,12 @@
</template> </template>
<script> <script>
import { import { mpAutoLogin } from "@/api/connect.js";
mpAutoLogin
} from "@/api/connect.js";
import { import { whetherNavigate } from "@/utils/Foundation"; //
getUserInfo import { getUserInfo } from "@/api/members";
} from "@/api/members"; import storage from "@/utils/storage.js";
import storage from "@/utils/storage.js"; export default {
export default {
data() { data() {
return { return {
// //
@ -43,15 +40,20 @@
// //
projectName: "LiLi", projectName: "LiLi",
//sessionkey //sessionkey
code: '', code: "",
// //
nickName: '', nickName: "",
// //
image: '', image: "",
}; };
}, },
//codecode //codecode
mounted() { mounted() {
//
uni.showShareMenu({ withShareTicket: true });
let that = this; let that = this;
//code //code
uni.login({ uni.login({
@ -61,12 +63,24 @@
}); });
}, },
methods: { methods: {
/**
* TODO 此方法不一定是最优解如果有更好的办法请在 https://gitee.com/beijing_hongye_huicheng/lilishop/issues
* 小程序返回bug
* 1.介于微信登录是在login.vue的基础上作为判断跳转来
* 所以在页面栈中会自动记录回退路径所以导致每次微信小程序点击回退就会自动返回login页面
* 当然login页面的判断就是 没有登录就会跳转到微信小程序页面 导致了无法回退到之前页面
* 2.解决方法 尝试在回退的时候判断地址让回退多一级这样就避免了
*/
back() {
whetherNavigate('wx');
},
// //
getUserProfile(e) { getUserProfile(e) {
let that = this; let that = this;
// 使wx.getUserProfile // 使wx.getUserProfile
uni.getUserProfile({ uni.getUserProfile({
desc: '用于完善会员资料', // desc: "用于完善会员资料", //
success: (res) => { success: (res) => {
that.nickName = res.userInfo.nickName; that.nickName = res.userInfo.nickName;
that.image = res.userInfo.avatarUrl; that.image = res.userInfo.avatarUrl;
@ -79,13 +93,11 @@
"https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132"; "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132";
// //
this.phoneAuthPopup = true; this.phoneAuthPopup = true;
} },
}) });
}, },
// //
getPhoneNumber(e) { getPhoneNumber(e) {
let that = this;
let iv = e.detail.iv; let iv = e.detail.iv;
let encryptedData = e.detail.encryptedData; let encryptedData = e.detail.encryptedData;
if (!e.detail.encryptedData) { if (!e.detail.encryptedData) {
@ -123,25 +135,23 @@
}); });
}, 500); }, 500);
}); });
}); });
}, },
}, },
}; };
</script> </script>
<style> <style lang="scss" scoped>
/*微信授权*/ /*微信授权*/
page { page {
background-color: #ffffff; background-color: #ffffff;
} }
.wx-auth-container { .wx-auth-container {
width: 100%; width: 100%;
margin-top: 20%; margin-top: 20%;
} }
.logo-info { .logo-info {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
justify-content: flex-start; justify-content: flex-start;
@ -151,84 +161,84 @@
flex-direction: column; flex-direction: column;
font-weight: bold; font-weight: bold;
} }
image { image {
width: 100px; width: 100px;
height: 100px; height: 100px;
text-align: center; text-align: center;
-webkit-transform: scale(2.5); -webkit-transform: scale(2.5);
transform: scale(2.5); transform: scale(2.5);
} }
.logo-info-img { .logo-info-img {
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
border-radius: 50%; border-radius: 50%;
border: none; border: none;
} }
text.title, text.title,
text.shop { text.shop {
display: inline-block; display: inline-block;
font-size: 60rpx; font-size: 60rpx;
color: #333; color: #333;
} }
text.shop { text.shop {
display: inline-block; display: inline-block;
font-size: 55rpx; font-size: 55rpx;
color: #333; color: #333;
} }
.box { .box {
margin: 0 32rpx; margin: 0 32rpx;
} }
/* 文字提示*/ /* 文字提示*/
.small-tips { .small-tips {
width: 94%; width: 94%;
padding: 20rpx; padding: 20rpx;
font-size: 24rpx; font-size: 24rpx;
margin: 0 0 20rpx; margin: 0 0 20rpx;
color: #999; color: #999;
} }
.auth-button { .auth-button {
padding: 10px 20px; padding: 10px 20px;
width: calc(100% - 20 * 4rpx); width: calc(100% - 20 * 4rpx);
} }
.tips { .tips {
width: 80%; width: 80%;
text-align: left; text-align: left;
margin: 6% 10%; margin: 6% 10%;
margin-top: 48rpx; margin-top: 48rpx;
line-height: 1.75; line-height: 1.75;
} }
.register { .register {
color: #00a327 !important; color: #00a327 !important;
border: none !important; border: none !important;
background: #fff !important; background: #fff !important;
} }
.btn { .btn {
width: 100%; width: 100%;
text-align: center; text-align: center;
} }
.btn-auth { .btn-auth {
width: 92%; width: 92%;
margin: 0 auto 100rpx; margin: 0 auto 100rpx;
border-radius: 100px; border-radius: 100px;
} }
.btns { .btns {
margin-top: 100rpx; margin-top: 100rpx;
display: flex; display: flex;
width: 100%; width: 100%;
justify-content: center; justify-content: center;
} }
</style> </style>

View File

@ -442,6 +442,11 @@ export default {
}, },
async onLoad(options) { async onLoad(options) {
this.routerVal = options; this.routerVal = options;
// #ifdef MP-WEIXIN
//
uni.showShareMenu({ withShareTicket: true });
// #endif
}, },
async onShow() { async onShow() {
this.goodsDetail = {}; this.goodsDetail = {};

View File

@ -1,26 +1,26 @@
<template> <template>
<view v-if="storeDetail"> <view v-if="storeDetail">
<!-- 商店信息 --> <!-- 商店信息 -->
<view class="store-info" > <view class="store-info">
<view class="logo"> <view class="logo">
<u-image width="120rpx" mode="aspectFit" height="120rpx" :src="storeDetail.storeLogo"></u-image> <u-image width="120rpx" mode="aspectFit" height="120rpx" :src="storeDetail.storeLogo"></u-image>
</view> </view>
<view class="name-star star-con"> <view class="name-star star-con">
<text class="name">{{ storeDetail.storeName }}</text> <div class="name">
<view> {{ storeDetail.storeName }}
<text :class="{ star: storeDetail.store_service_credit > 0 }"></text> <span v-if="storeDetail.selfOperated == 1" class="shopTag"></span>
<text :class="{ star: storeDetail.store_service_credit > 1 }"></text> </div>
<text :class="{ star: storeDetail.store_service_credit > 2 }"></text> <div class="store-row">
<text :class="{ star: storeDetail.store_service_credit > 3 }"></text> <div class="collectionNum">{{ storeDetail.collectionNum || 0 }}人关注</div>
<text :class="{ star: storeDetail.store_service_credit > 4 }"></text> <div class="goodsNum">{{ storeDetail.goodsNum || 0 }}件商品</div>
</view> </div>
</view> </view>
<view class="to-store-btn" @click="tostorePage(goodsDetail)"> <view class="to-store-btn" @click="tostorePage(goodsDetail)">
<view>进店逛逛</view> <view>进店逛逛</view>
</view> </view>
</view> </view>
<view class="store-recommend" > <view class="store-recommend">
<view class="store-recommend-title">商品推荐</view> <view class="store-recommend-title">商品推荐</view>
<view class="recommend-list"> <view class="recommend-list">
<view class="recommend-item" @click="clickGoods(item)" v-for="(item, index) in res" :key="index"> <view class="recommend-item" @click="clickGoods(item)" v-for="(item, index) in res" :key="index">
@ -58,9 +58,8 @@ export default {
// //
clickGoods(val) { clickGoods(val) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}` url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
}); });
}, },
tostorePage(val) { tostorePage(val) {
@ -73,7 +72,6 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../product.scss"; @import "../product.scss";
.recommend-item-name { .recommend-item-name {
height: 70rpx; height: 70rpx;
@ -108,6 +106,16 @@ export default {
} }
} }
.shopTag{
background: $main-color;
font-size: 24rpx;
padding: 0 12rpx;
margin-left: 10rpx;
font-weight: normal;
border-radius: 10rpx;
color: #fff;
}
.recommend-list-view { .recommend-list-view {
width: 100%; width: 100%;
} }
@ -135,6 +143,7 @@ export default {
font-size: 30rpx; font-size: 30rpx;
.name { .name {
display: flex;
width: 100%; width: 100%;
font-weight: 700; font-weight: 700;
font-size: 28rpx; font-size: 28rpx;
@ -143,7 +152,8 @@ export default {
} }
.to-store-btn { .to-store-btn {
padding: 20rpx 0; display: flex;
align-items: center;
> view { > view {
font-size: 24rpx; font-size: 24rpx;
@ -164,7 +174,6 @@ export default {
flex-direction: column; flex-direction: column;
view { view {
flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
@ -215,4 +224,16 @@ export default {
margin: 20rpx 0 0 0; margin: 20rpx 0 0 0;
} }
.goodsNum,
.collectionNum {
font-size: 24rpx;
color: #999;
}
.store-row {
display: flex;
margin: 10rpx 0;
> div {
margin-right: 20rpx;
}
}
</style> </style>

View File

@ -59,7 +59,12 @@ export default {
this.storeId = options.id; this.storeId = options.id;
}, },
mounted() {}, mounted() {
// #ifdef MP-WEIXIN
//
uni.showShareMenu({ withShareTicket: true });
// #endif
},
methods: { methods: {
// //

View File

@ -192,6 +192,12 @@ export default {
WEIXIN_num: "", // WEIXIN_num: "", //
}; };
}, },
mounted() {
// #ifdef MP-WEIXIN
//
uni.showShareMenu({ withShareTicket: true });
// #endif
},
/** /**
* 初始化信息 * 初始化信息
*/ */

View File

@ -47,6 +47,10 @@ export default {
}, },
onLoad() { onLoad() {
this.loadData(); this.loadData();
// #ifdef MP-WEIXIN
//
uni.showShareMenu({ withShareTicket: true });
// #endif
}, },
methods: { methods: {
/** /**
@ -112,7 +116,7 @@ uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
display: none; display: none;
} }
/* #endif */ /* #endif */
.s-list{ .s-list {
box-shadow: 0 4rpx 12rpx 0 rgba(0, 0, 0, 0.05); box-shadow: 0 4rpx 12rpx 0 rgba(0, 0, 0, 0.05);
} }
.nav-search { .nav-search {

View File

@ -94,6 +94,10 @@ export default {
mounted() { mounted() {
this.init(); this.init();
// #ifdef MP-WEIXIN
//
uni.showShareMenu({ withShareTicket: true });
// #endif
}, },
methods: { methods: {
/** /**

View File

@ -14,21 +14,19 @@
* 计算出当前router路径 * 计算出当前router路径
* 1.如果跳转的链接为登录页面或跳转的链接为空页面则会重新跳转到首页 * 1.如果跳转的链接为登录页面或跳转的链接为空页面则会重新跳转到首页
* 2.都不满足返回跳转页面 * 2.都不满足返回跳转页面
* @param type 'default' || 'wx' //返回地址会做判断默认为default
*/ */
export function whetherNavigate() {
export function whetherNavigate(type = "default") {
if (getCurrentPages().length > 1) { if (getCurrentPages().length > 1) {
if ((getCurrentPages().length - 2).route == "pages/passport/login") { if ((getCurrentPages().length - 2).route == "pages/passport/login") {
uni.switchTab({ navigationToBack(type);
url: "/pages/tabbar/home/index",
});
} else { } else {
if ( if (
!(getCurrentPages().length - 2).route || !(getCurrentPages().length - 2).route ||
(getCurrentPages().length - 2).route == "undefined" (getCurrentPages().length - 2).route == "undefined"
) { ) {
uni.switchTab({ navigationToBack(type);
url: "/pages/tabbar/home/index",
});
} else { } else {
uni.navigateBack({ uni.navigateBack({
delta: getCurrentPages().length - 2, delta: getCurrentPages().length - 2,
@ -156,6 +154,20 @@ export function countTimeDown(seconds) {
}; };
} }
function navigationToBack(type) {
if (type == "wx") {
// console.log(getCurrentPages().length - 3)
uni.navigateBack({
delta: getCurrentPages().length ,
});
} else {
uni.switchTab({
url: "/pages/tabbar/home/index",
});
}
}
/** /**
* 计算当前时间到第二天0点的倒计时[] * 计算当前时间到第二天0点的倒计时[]
* @returns {number} * @returns {number}
@ -181,5 +193,5 @@ module.exports = {
randomString, randomString,
countTimeDown, countTimeDown,
theNextDayTime, theNextDayTime,
whetherNavigate whetherNavigate,
}; };