ソースを参照

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

lemon橪 4 年 前
コミット
1489deb618

+ 2 - 3
App.vue

@@ -51,8 +51,8 @@ export default {
   onLaunch: function () {
     // #ifdef APP-PLUS
     this.checkArguments(); // 检测启动参数
-    APPUpdate();
-	
+    APPUpdate();
+
     // 重点是以下: 一定要监听后台恢复 !一定要
     plus.globalEvent.addEventListener("newintent", (e) => {
       this.checkArguments(); // 检测启动参数
@@ -65,7 +65,6 @@ export default {
     this.getClipboard();
     // #endif
   },
-
   methods: {
     //  TODO 开屏广告 后续优化添加
     launch() {

+ 4 - 4
config/api.js

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

+ 3 - 1
pages.json

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

+ 6 - 6
pages/navigation/search/searchPage.vue

@@ -179,7 +179,7 @@
                 </div>
                 <div class="storeSellerName">
                   <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>
                   </div>
                   <span>
@@ -314,7 +314,7 @@ export default {
       isSWitch: false,
 
       params: {
-        pageNumber: 0,
+        pageNumber: 1,
         pageSize: 10,
         // sort: 'grade_asc',
         sort: "releaseTime",
@@ -324,7 +324,7 @@ export default {
       minPrice: "",
       maxPrice: "",
       sortParams: {
-        pageNumber: 0,
+        pageNumber: 1,
         pageSize: 10,
 
         // price: "", //价格,示例值(10_30)
@@ -474,7 +474,7 @@ export default {
       this.minPrice = "";
       this.maxPrice = "";
       this.params = {
-        pageNumber: 0,
+        pageNumber: 1,
         pageSize: 10,
       };
       this.loadData();
@@ -545,7 +545,7 @@ export default {
     },
 
     tabClick(index, type) {
-      this.params.pageNumber = 0;
+      this.params.pageNumber = 1;
       this.params.pageSize = 10;
       // this.params.order = "desc";
       if (this.params.sort == type) {
@@ -687,7 +687,7 @@ export default {
       this.isShowSeachGoods = true;
       this.$refs.mSearch.isShowSeachGoods = true;
       this.params.keyword = keyword;
-      this.params.pageNumber = 0;
+      this.params.pageNumber = 1;
       this.$set(this.sortParams, "keyword", keyword);
 
       this.loadData("refresh", 1);

+ 3 - 3
pages/passport/onClickLogin.vue

@@ -13,10 +13,10 @@
 </template>
 
 <script>
-import { webConnect, openIdLogin } from "@/api/connect.js";
+import {  openIdLogin } from "@/api/connect.js";
 import { whetherNavigate } from "@/utils/Foundation"; //登录跳转
 import { getUserInfo } from "@/api/members";
-import storage from "@/utils/storage.js";
+import storage from "@/utils/storage.js";
 import api from "@/config/api.js";
 
 export default {
@@ -147,7 +147,7 @@ export default {
       }
 
       // #ifdef H5
-      let code = connectLogin.code;
+      let code = connectLogin.code;
 	  let buyer = api.buyer;
       window.open(buyer+`/connect/login/web/`+code, "_self");
       // #endif

+ 239 - 229
pages/passport/wechatMPLogin.vue

@@ -1,234 +1,244 @@
 <template>
-	<view class="container">
-		<u-modal v-model="phoneAuthPopup" :title="projectName+'商城'" :show-confirm-button="false">
-			<div class="tips">
-				为了更好地用户体验,需要您授权手机号
-			</div>
-			<button class="register" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
-				去授权
-			</button>
-		</u-modal>
-		<view class="wx-auth-container">
-			<div class="box">
-				<view class="logo-info">
-					<text class="title">欢迎进入{{ projectName }}商城</text>
-				</view>
-				<view class="small-tips">
-					<view>为您提供优质服务,{{ projectName }}需要获取以下信息</view>
-					<view>您的公开信息(昵称、头像)</view>
-				</view>
-				<view class="btns">
-					<button type="primary" bindtap="getUserProfile" @click="getUserProfile()"
-						class="btn-auth">确认微信授权</button>
-				</view>
-			</div>
-		</view>
-	</view>
+  <view class="container">
+    <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>
+      <button class="register" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
+        去授权
+      </button>
+    </u-modal>
+    <view class="wx-auth-container">
+      <div class="box">
+        <view class="logo-info">
+          <text class="title">欢迎进入{{ projectName }}商城</text>
+        </view>
+        <view class="small-tips">
+          <view>为您提供优质服务,{{ projectName }}需要获取以下信息</view>
+          <view>您的公开信息(昵称、头像)</view>
+        </view>
+        <view class="btns">
+          <button type="primary" bindtap="getUserProfile" @click="getUserProfile()" class="btn-auth">确认微信授权</button>
+        </view>
+      </div>
+    </view>
+  </view>
 </template>
 
 <script>
-	import {
-		mpAutoLogin
-	} from "@/api/connect.js";
-
-	import {
-		getUserInfo
-	} from "@/api/members";
-	import storage from "@/utils/storage.js";
-	export default {
-		data() {
-			return {
-				// 是否展示手机号码授权弹窗,默认第一步不展示,要先获取用户基础信息
-				phoneAuthPopup: false,
-				// 授权信息展示,商城名称
-				projectName: "LiLi",
-				//微信返回信息,用于揭秘信息,获取sessionkey
-				code: '',
-				//微信昵称
-				nickName: '',
-				//微信头像
-				image: '',
-			};
-		},
-		//微信小程序进入页面,先获取code,否则几率出现code和后续交互数据不对应情况
-		mounted() {
-			let that = this;
-			//获取code
-			uni.login({
-				success: (res) => {
-					that.code = res.code;
-				},
-			});
-		},
-		methods: {
-			//获取用户信息
-			getUserProfile(e) {
-				let that = this;
-				// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
-				uni.getUserProfile({
-					desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
-					success: (res) => {
-						that.nickName = res.userInfo.nickName;
-						that.image = res.userInfo.avatarUrl;
-						//展示手机号获取授权
-						this.phoneAuthPopup = true;
-					},
-					fail: (res) => {
-						that.nickName = "微信用户";
-						that.image =
-							"https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132";
-						//展示手机号获取授权
-						this.phoneAuthPopup = true;
-					}
-				})
-			},
-			//获取手机号授权
-			getPhoneNumber(e) {
-
-				let that = this;
-				let iv = e.detail.iv;
-				let encryptedData = e.detail.encryptedData;
-				if (!e.detail.encryptedData) {
-					uni.showToast({
-						title: "请授予手机号码权限,手机号码会和会员系统用户绑定!",
-						icon: "none",
-					});
-					return;
-				}
-
-				let code = this.code;
-				let image = this.image;
-				let nickName = this.nickName;
-				mpAutoLogin({
-					encryptedData,
-					iv,
-					code,
-					image,
-					nickName,
-				}).then((res) => {
-					storage.setAccessToken(res.data.result.accessToken);
-					storage.setRefreshToken(res.data.result.refreshToken);
-					// 登录成功
-					uni.showToast({
-						title: "登录成功!",
-						icon: "none",
-					});
-					//获取用户信息
-					getUserInfo().then((user) => {
-						storage.setUserInfo(user.data.result);
-						storage.setHasLogin(true);
-						setTimeout(() => {
-							uni.navigateBack({
-								delta: 1,
-							});
-						}, 500);
-					});
-
-				});
-
-			},
-		},
-	};
+import { mpAutoLogin } from "@/api/connect.js";
+
+import { whetherNavigate } from "@/utils/Foundation"; //登录跳转
+import { getUserInfo } from "@/api/members";
+import storage from "@/utils/storage.js";
+export default {
+  data() {
+    return {
+      // 是否展示手机号码授权弹窗,默认第一步不展示,要先获取用户基础信息
+      phoneAuthPopup: false,
+      // 授权信息展示,商城名称
+      projectName: "LiLi",
+      //微信返回信息,用于揭秘信息,获取sessionkey
+      code: "",
+      //微信昵称
+      nickName: "",
+      //微信头像
+      image: "",
+    };
+  },
+
+  //微信小程序进入页面,先获取code,否则几率出现code和后续交互数据不对应情况
+  mounted() {
+
+    // 小程序默认分享
+    uni.showShareMenu({ withShareTicket: true });
+
+    let that = this;
+    //获取code
+    uni.login({
+      success: (res) => {
+        that.code = res.code;
+      },
+    });
+  },
+  methods: {
+    /**
+     * TODO 此方法不一定是最优解,如果有更好的办法请在  https://gitee.com/beijing_hongye_huicheng/lilishop/issues 中提出
+     * 小程序返回bug
+     * 1.介于微信登录是在login.vue的基础上作为判断跳转来
+     * 所以在页面栈中会自动记录回退路径,所以导致每次微信小程序点击回退就会自动返回login页面
+     * 当然login页面的判断就是 没有登录就会跳转到微信小程序页面 导致了无法回退到之前页面
+     * 2.解决方法: 尝试在回退的时候判断地址,让回退多一级这样就避免了
+     */
+
+    back() {
+      whetherNavigate('wx');
+    },
+    //获取用户信息
+    getUserProfile(e) {
+      let that = this;
+      // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
+      uni.getUserProfile({
+        desc: "用于完善会员资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+        success: (res) => {
+          that.nickName = res.userInfo.nickName;
+          that.image = res.userInfo.avatarUrl;
+          //展示手机号获取授权
+          this.phoneAuthPopup = true;
+        },
+        fail: (res) => {
+          that.nickName = "微信用户";
+          that.image =
+            "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132";
+          //展示手机号获取授权
+          this.phoneAuthPopup = true;
+        },
+      });
+    },
+    //获取手机号授权
+    getPhoneNumber(e) {
+      let iv = e.detail.iv;
+      let encryptedData = e.detail.encryptedData;
+      if (!e.detail.encryptedData) {
+        uni.showToast({
+          title: "请授予手机号码权限,手机号码会和会员系统用户绑定!",
+          icon: "none",
+        });
+        return;
+      }
+
+      let code = this.code;
+      let image = this.image;
+      let nickName = this.nickName;
+      mpAutoLogin({
+        encryptedData,
+        iv,
+        code,
+        image,
+        nickName,
+      }).then((res) => {
+        storage.setAccessToken(res.data.result.accessToken);
+        storage.setRefreshToken(res.data.result.refreshToken);
+        // 登录成功
+        uni.showToast({
+          title: "登录成功!",
+          icon: "none",
+        });
+        //获取用户信息
+        getUserInfo().then((user) => {
+          storage.setUserInfo(user.data.result);
+          storage.setHasLogin(true);
+          setTimeout(() => {
+            uni.navigateBack({
+              delta: 1,
+            });
+          }, 500);
+        });
+      });
+    },
+  },
+};
 </script>
-<style>
-	/*微信授权*/
-	page {
-		background-color: #ffffff;
-	}
-
-	.wx-auth-container {
-		width: 100%;
-		margin-top: 20%;
-	}
-
-	.logo-info {
-		display: flex;
-		flex-wrap: nowrap;
-		justify-content: flex-start;
-		flex-direction: row;
-		align-items: flex-start;
-		padding: 20rpx;
-
-		flex-direction: column;
-		font-weight: bold;
-	}
-
-	image {
-		width: 100px;
-		height: 100px;
-		text-align: center;
-		-webkit-transform: scale(2.5);
-		transform: scale(2.5);
-	}
-
-	.logo-info-img {
-		width: 80rpx;
-		height: 80rpx;
-		border-radius: 50%;
-		border: none;
-	}
-
-	text.title,
-	text.shop {
-		display: inline-block;
-		font-size: 60rpx;
-		color: #333;
-	}
-
-	text.shop {
-		display: inline-block;
-		font-size: 55rpx;
-		color: #333;
-	}
-
-	.box {
-		margin: 0 32rpx;
-	}
-
-	/* 文字提示*/
-	.small-tips {
-		width: 94%;
-		padding: 20rpx;
-		font-size: 24rpx;
-		margin: 0 0 20rpx;
-		color: #999;
-	}
-
-	.auth-button {
-		padding: 10px 20px;
-		width: calc(100% - 20 * 4rpx);
-	}
-
-	.tips {
-		width: 80%;
-		text-align: left;
-		margin: 6% 10%;
-		margin-top: 48rpx;
-		line-height: 1.75;
-	}
-
-	.register {
-		color: #00a327 !important;
-		border: none !important;
-		background: #fff !important;
-	}
-
-	.btn {
-		width: 100%;
-		text-align: center;
-	}
-
-	.btn-auth {
-		width: 92%;
-		margin: 0 auto 100rpx;
-
-		border-radius: 100px;
-	}
-
-	.btns {
-		margin-top: 100rpx;
-		display: flex;
-		width: 100%;
-		justify-content: center;
-	}
-</style>
+<style lang="scss" scoped>
+/*微信授权*/
+page {
+  background-color: #ffffff;
+}
+
+.wx-auth-container {
+  width: 100%;
+  margin-top: 20%;
+}
+
+.logo-info {
+  display: flex;
+  flex-wrap: nowrap;
+  justify-content: flex-start;
+  flex-direction: row;
+  align-items: flex-start;
+  padding: 20rpx;
+
+  flex-direction: column;
+  font-weight: bold;
+}
+
+image {
+  width: 100px;
+  height: 100px;
+  text-align: center;
+  -webkit-transform: scale(2.5);
+  transform: scale(2.5);
+}
+
+.logo-info-img {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 50%;
+  border: none;
+}
+
+text.title,
+text.shop {
+  display: inline-block;
+  font-size: 60rpx;
+  color: #333;
+}
+
+text.shop {
+  display: inline-block;
+  font-size: 55rpx;
+  color: #333;
+}
+
+.box {
+  margin: 0 32rpx;
+}
+
+/* 文字提示*/
+.small-tips {
+  width: 94%;
+  padding: 20rpx;
+  font-size: 24rpx;
+  margin: 0 0 20rpx;
+  color: #999;
+}
+
+.auth-button {
+  padding: 10px 20px;
+  width: calc(100% - 20 * 4rpx);
+}
+
+.tips {
+  width: 80%;
+  text-align: left;
+  margin: 6% 10%;
+  margin-top: 48rpx;
+  line-height: 1.75;
+}
+
+.register {
+  color: #00a327 !important;
+  border: none !important;
+  background: #fff !important;
+}
+
+.btn {
+  width: 100%;
+  text-align: center;
+}
+
+.btn-auth {
+  width: 92%;
+  margin: 0 auto 100rpx;
+
+  border-radius: 100px;
+}
+
+.btns {
+  margin-top: 100rpx;
+  display: flex;
+  width: 100%;
+  justify-content: center;
+}
+</style>

+ 5 - 0
pages/product/goods.vue

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

+ 37 - 16
pages/product/product/shop/-shop.vue

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

+ 6 - 1
pages/product/shopPage.vue

@@ -59,7 +59,12 @@ export default {
     this.storeId = options.id;
 
   },
-  mounted() {},
+  mounted() {
+    // #ifdef MP-WEIXIN
+    // 小程序默认分享
+    uni.showShareMenu({ withShareTicket: true });
+    // #endif
+  },
 
   methods: {
     // 点击分享

+ 6 - 0
pages/tabbar/cart/cartList.vue

@@ -192,6 +192,12 @@ export default {
       WEIXIN_num: "", //购物车兼容微信步进器
     };
   },
+  mounted() {
+    // #ifdef MP-WEIXIN
+    // 小程序默认分享
+    uni.showShareMenu({ withShareTicket: true });
+    // #endif
+  },
   /**
    * 初始化信息
    */

+ 7 - 3
pages/tabbar/category/category.vue

@@ -5,7 +5,7 @@
       <u-search class="nav-search" disabled @click.native="search" placeholder="搜索商品" :show-action="false"></u-search>
     </u-navbar>
     <view class="content">
-      <scroll-view scroll-y  scroll-with-animation class="left-aside">
+      <scroll-view scroll-y scroll-with-animation class="left-aside">
         <view v-for="(item, index) in tabList" :key="item.id" class="f-item b-b" :class="{ active: item.id === currentId }" @click="tabtap(item, index)">
           {{ item.name }}
         </view>
@@ -47,6 +47,10 @@ export default {
   },
   onLoad() {
     this.loadData();
+    // #ifdef MP-WEIXIN
+    // 小程序默认分享
+    uni.showShareMenu({ withShareTicket: true });
+    // #endif
   },
   methods: {
     /**
@@ -112,8 +116,8 @@ uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
   display: none;
 }
 /* #endif */
-.s-list{
-   box-shadow: 0 4rpx 12rpx 0 rgba(0, 0, 0, 0.05);
+.s-list {
+  box-shadow: 0 4rpx 12rpx 0 rgba(0, 0, 0, 0.05);
 }
 .nav-search {
   padding-left: 30rpx !important;

+ 7 - 3
pages/tabbar/home/views.vue

@@ -94,6 +94,10 @@ export default {
 
   mounted() {
     this.init();
+    // #ifdef MP-WEIXIN
+    // 小程序默认分享
+    uni.showShareMenu({ withShareTicket: true });
+    // #endif
   },
   methods: {
     /**
@@ -121,9 +125,9 @@ export default {
           let path = encodeURIComponent(res.result);
           config.scanAuthNavigation.forEach((src) => {
             if (res.result.indexOf(src) != -1) {
-                uni.navigateTo({
-                  url: `/${res.result.substring(src.length)}`,
-                });
+              uni.navigateTo({
+                url: `/${res.result.substring(src.length)}`,
+              });
             } else {
               setTimeout(() => {
                 uni.navigateTo({

+ 20 - 8
utils/Foundation.js

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