Browse Source

修改bug
修改首页页面

suixueyan 1 day ago
parent
commit
8752fc70b8

+ 67 - 0
common/utils/util.js

@@ -63,7 +63,74 @@ export default {
 	getDataName(key) {
 		console.log(9000, key, `${key}_${brandId}_${branchId}`)
 		return `${key}_${brandId}_${branchId}`
+	},
+	/**
+	 * 获取当前页面路由
+	 * @param index
+	 * @returns {(() => void)|null}
+	 */
+	getCurrentPageRoute(index=0) {
+		const pages = getCurrentPages();
+		if (pages.length === 0) return null;
+		return pages[pages.length - 1-index].route; // 不带 /
 	}
+	,
+	/**
+	 * 判断当前页面是否是指定页面
+	 * @param pagePath
+	 * @returns {boolean}
+	 */
+	isCurrentPage(pagePath) {
+		const current = this.getCurrentPageRoute();
+		return current === pagePath;
+	},
+	/**
+	 * 获取当前页面参数
+	 * @param index
+	 * @returns {{}|*|null}
+	 */
+	getCurrentPageOptions(index) {
+		const pages = getCurrentPages();
+		if (pages.length === 0) return null;
+		const currentPage = pages[pages.length - 1-index]; // 当前页面实例
+		// 小程序 & App 平台:参数在 options 属性上
+		if (currentPage.options) {
+			return currentPage.options;
+		}
+		// H5 可能需要从 $page 取(uni-app 特有)
+		if (currentPage.$page && currentPage.$page.options) {
+			return currentPage.$page.options;
+		}
+		// 兜底:尝试 onLoad 时传入的参数(部分平台)
+		return {};
+	},
+	/**
+	 * 获取上一页完整路径
+	 * @returns {string|null}
+	 */
+	getPrevPageFullUrl() {
+		const pages = getCurrentPages();
+		let str=""
+
+		pages.forEach(
+			(page, index) => {
+				str += page.route
+			}
+		)
+		// 至少要有两个页面(当前页 + 上一页)
+		if (pages.length < 2) {
+			return null;
+		}
 
+		const prevPage = pages[pages.length - 2]; // 上一页(倒数第二个)
+		const route = prevPage.route;             // 页面路径,如 'pages/detail/detail'
+		const options = prevPage.options || {};   // 参数对象,如 { id: '123' }
+		if (!route) return null;
+		// 拼接查询字符串
+		const queryStr = Object.keys(options)
+			.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(options[key])}`)
+			.join('&');
 
+		return `/${route}${queryStr ? '?' + queryStr : ''}`;
+	}
 }

+ 1 - 1
pages/activity/activity.vue

@@ -14,7 +14,7 @@
               <van-image
                   class="huodongText2-img"
                   height="264rpx"
-                  :src="item2.pic"
+                  :src="item2.cover"
                   width="650rpx"
               />
             </view>

+ 37 - 3
pages/home/dashboard/index.vue

@@ -60,7 +60,6 @@
 				uni.login({
 					provider: "weixin",
 					success: (wxRes) => {
-						console.log("wxCode==>", wxRes.code)
 						// uni.showToast({
 						// 	title: 'wxlogin'
 						// })
@@ -80,11 +79,10 @@
 				};
 				userLogin(data)
 					.then((res) => {
-						console.log("userLogin==>", res.data)
-						console.log("userLogin==>", res.data.token.token)
 						// uni.showToast({
 						// 	title: 'userLogin'
 						// })
+
 						if (res.data) {
 							uni.setStorageSync('token', res.data.token.token)
 							// uni.showToast({
@@ -96,8 +94,17 @@
 								uni.setStorageSync('userInfo', JSON.stringify(res.data))
 							}
 							console.log(8888, this.from)
+
 							if (this.from) {
 								if (this.from === JSON.parse(userInfo).id) {
+                  if (!this.$U.getPrevPageFullUrl()&&uni.getStorageSync('showPage')){
+                    let url = uni.getStorageSync('showPage')
+                    uni.removeStorageSync('showPage');
+                    uni.reLaunch({
+                      url: url
+                    })
+                    return;
+                  }
 									if (this.goodCode) {
 										uni.reLaunch({
 											url: '/pages/home/index?code=' + this.goodCode
@@ -113,6 +120,15 @@
 								}
 								this.bindFrom()
 							} else {
+                uni.navigateBack()
+                if (!this.$U.getPrevPageFullUrl()&&uni.getStorageSync('showPage')){
+                  let url = uni.getStorageSync('showPage')
+                  uni.removeStorageSync('showPage');
+                  uni.reLaunch({
+                    url: url
+                  })
+                  return;
+                }
 								if (this.goodCode) {
 									uni.reLaunch({
 										url: '/pages/home/index?code=' + this.goodCode
@@ -146,7 +162,16 @@
 				bindFrom(data)
 					.then((res) => {
 						console.log("bindFrom==>", res.data)
+
 						if (res.data) {
+              if (!this.$U.getPrevPageFullUrl()&&uni.getStorageSync('showPage')){
+                let url = uni.getStorageSync('showPage')
+                uni.removeStorageSync('showPage');
+                uni.reLaunch({
+                  url: url
+                })
+                return;
+              }
 							if (this.goodCode) {
 								uni.reLaunch({
 									url: '/pages/home/index?code=' + this.goodCode
@@ -159,6 +184,15 @@
 							}
 
 						} else {
+              uni.navigateBack()
+              if (!this.$U.getPrevPageFullUrl()&&uni.getStorageSync('showPage')){
+                let url = uni.getStorageSync('showPage')
+                uni.removeStorageSync('showPage');
+                uni.reLaunch({
+                  url: url
+                })
+                return;
+              }
 							if (this.goodCode) {
 								uni.reLaunch({
 									url: '/pages/home/index?code=' + this.goodCode

+ 1 - 1
pages/home/index.vue

@@ -18,7 +18,7 @@
             </template>
           </u-swiper>
           <view class="logo-search-container" :style="{top:0,left:'0rpx',paddingBottom:'20rpx',height:navbarHeight+topData.height+10+'px'}">
-            <view class="centered-image" :style="{
+            <view class="centered-image" v-if="logoImg" :style="{
                   marginTop:`${navbarHeight}px`
             }">
               <van-image

+ 1 - 8
pages/splash/index.vue

@@ -105,8 +105,7 @@
 									} else {
 										uni.reLaunch({
 											url: "/pages/home/index"
-											// url: '/pages/privateSphere/index'
-											// url: '/subPages/psGoodsDetail/index?code=G7831850573794621080&type=common'
+
 										})
 									}
 									return
@@ -123,12 +122,6 @@
 									// })
 									uni.reLaunch({
 										url: "/pages/home/index",
-										// url: '/subPages/orderDetail/orderDetail?orderNo=GO2023092454006061'
-										// url: '/subPages/myOrder/myOrder'
-										// url: '/subPages/poster/poster',
-										// url: "/subPages/goodsDetail/goodsDetail?code=G7946559351964068502&type=gift"
-										// url: '/subPages/addAddress/addAddress?code=UA795093359090873249'
-										// url: '/subPages/settleCenter/settleCenter?type=cart&ids=63&isGift=0'
 									})
 								}
 							}

+ 1 - 1
subPages/activityDetail/activityDetail.vue

@@ -3,7 +3,7 @@
     <van-image
         class="huodongText2-img"
         height="360rpx"
-        :src="activityInfo.pic"
+        :src="activityInfo.cover"
         width="100%"
         style="display: flex;align-items: center;"
     />

+ 6 - 4
subPages/course/course.vue

@@ -74,8 +74,7 @@ export default {
     this.active = type * 1;
 
     this.getGoodCate();
-    this.getGoodList();
-    console.log(this.courseTypeList);
+
   },
   onShow() {
     this.$nextTick(() => {});
@@ -102,9 +101,12 @@ export default {
   watch: {},
   methods: {
     getGoodCate() {
-      getGoodCate({ mark:"课程商品" }).then(({ data }) => {
+      getGoodCate({ goods_kind:"课程商品" }).then(({ data }) => {
         this.courseTypeList = data;
-
+        if (data.length > 0){
+          this.GoodCateId = data[0].id;
+        }
+        this.getGoodList();
       });
     },
     toDetail(item) {

+ 17 - 7
subPages/courseDetail/courseDetail.vue

@@ -1,12 +1,16 @@
 <template>
   <view style="height: 100%; background: #F8F9FA;">
-    <van-image
-        class="huodongText2-img"
-        height="360rpx"
-        :src="courseInfo.cover"
-        width="100%"
-        style="display: flex;align-items: center;"
-    />
+<!--    <van-image-->
+<!--        class="huodongText2-img"-->
+<!--        height="360rpx"-->
+<!--        :src="courseInfo.cover"-->
+<!--        width="100%"-->
+<!--        style="display: flex;align-items: center;"-->
+<!--    />-->
+    <u-swiper :list="bannerList||[]" keyName="url"
+              :indicatorStyle="{right: '20rpx', bottom: '20rpx', width: '100px',marginLeft: 'auto'}" indicator
+              indicatorMode="number" :height="'360rpx'"  imgMode="scaleToFill">
+    </u-swiper>
     <view class="huodong-ccontent" >
       <view class="course-content">
         <view class="course-title">{{ courseInfo.goods_name }}</view>
@@ -92,6 +96,7 @@ export default {
   components: {},
   data() {
     return {
+      bannerList: [],
       page: 1,
       pageSize: 10,
       courseTypeList: [],
@@ -188,6 +193,9 @@ export default {
       getGoodsDetail({goods_code: this.goods_code}).then(({data}) => {
         console.log(data)
         this.courseInfo = data.goods
+        this.bannerList=this.courseInfo.slider||[]
+
+        console.log('this.courseInfo.content', this.bannerList)
         // 修正 courseInfo.content 中的 src 属性值
         if (this.courseInfo.content) {
           this.courseInfo.content = this.courseInfo.content.replace(/\/apihttps:/g, 'https:');
@@ -444,4 +452,6 @@ export default {
   font-weight: 400;
   font-size: 28rpx;
 }
+
+
 </style>

+ 73 - 23
subPages/goodsDetail/goodsDetail.vue

@@ -164,7 +164,7 @@
     <u-toast ref="createPosterLoading"></u-toast>
     <u-overlay :show="showPosterFlag" :mask-click-able="false">
       <view class="poster-wrap">
-        <image :src="posterImgSrc" mode="widthFix"></image>
+        <image :src="posterImgSrc" class="poster-img" mode="widthFix"></image>
       </view>
       <view class="poster-box">
         <view class="poster-btn">
@@ -185,34 +185,71 @@
     </u-overlay>
     <!-- 海报生成器 -->
     <l-painter ref="painter" isCanvasToTempFilePath @success="painterSuccess"
-               css="width: 750rpx; background: #fff;padding: 20rpx" v-if="detailData.goods_name&&showPoster" hidden>
-      <l-painter-image :src="imageUrl" css="display: block; width: 100%; height: 146rpx;"/>
-      <l-painter-view css="display: block; padding: 43rpx 0 22rpx 0;">
-        <l-painter-text :text="detailData.goods_name"
-                        css=" color: #1D161F; font-size: 36rpx; fontWeight: 500; line-height: 42rpx;"/>
+               css="width: 610rpx;box-sizing: border-box; background: #fff;padding: 20rpx;border-radius: 32rpx 32rpx 32rpx 32rpx;"
+               v-if="detailData.goods_name&&showPoster" hidden>
+      <!--			<l-painter-image :src="imageUrl" css="display: block; width: 100%; height: 146rpx;" />-->
+      <l-painter-view css="height: 570rpx;width: 570rpx;">
+        <l-painter-image :src="detailData.cover" css="width: 100%; height: 100%;"/>
       </l-painter-view>
-      <l-painter-view css="position: relative; height: 580rpx;">
-        <l-painter-image :src="detailData.cover" css="object-fit: contain; width: 100%; height: 100%;"/>
+      <l-painter-view
+          css="display: flex; align-items: center; justify-content: space-between; padding: 40rpx 10rpx 0;">
+        <l-painter-text :text="detailData.goods_name"
+                        css="display: block; width: 368rpx;height: 72rpx;font-weight: 400;font-size: 28rpx;color: #444444;line-height: 36rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;box-sizing: border-box;"/>
+        <l-painter-view css="width: 1rpx;height: 60rpx; border-left: 1rpx solid #888888;">
+        </l-painter-view>
+        <l-painter-view css="display: flex; align-items: flex-end">
+          <l-painter-text css="font-size: 24rpx; font-weight: 500;color: #FF424F;line-height: 38rpx"
+                          :text="`¥`"></l-painter-text>
+          <l-painter-text css="font-size: 32rpx; font-weight: 500;color: #FF424F;line-height: 38rpx;"
+                          :text="`${detailData.price_selling}`"></l-painter-text>
+        </l-painter-view>
       </l-painter-view>
-
       <l-painter-view
-          css="display: flex; align-items: center; justify-content: space-between; padding-top: 38rpx;">
-        <l-painter-view css="flex: 1;">
+          css="display: flex; align-items: center; justify-content: space-between; padding: 36rpx 10rpx 10rpx;">
+        <l-painter-view css="width: 228rpx;height: 104rpx;">
           <l-painter-view>
-            <l-painter-text css="font-size: 32rpx; font-weight: 500; color: #858585; line-height: 38rpx;"
-                            text="售价:"></l-painter-text>
-            <l-painter-text css="font-size: 32rpx; font-weight: 500; color: #7B52C8; line-height: 38rpx;"
-                            :text="`¥${detailData.price_selling}`"></l-painter-text>
+            <l-painter-text
+                css="display: block; font-size: 24rpx; font-weight: 400; color: #888888; line-height: 52rpx;"
+                text="① 保存图片到相册"></l-painter-text>
           </l-painter-view>
-          <l-painter-view css="margin-top: 11rpx;">
+          <l-painter-view>
             <l-painter-text
-                css="display: block; font-size: 28rpx; font-weight: 500; color: #858585; line-height: 33rpx;"
-                text="长按小程序码参与"></l-painter-text>
+                css="display: block; font-size: 24rpx; font-weight: 400; color: #888888; line-height: 52rpx;"
+                text="② 打开微信扫码可见"></l-painter-text>
           </l-painter-view>
         </l-painter-view>
-        <l-painter-image :src="erCodeImg" css="width: 200rpx; height: 200rpx;"/>
+        <l-painter-image :src="erCodeImg" css="width: 176rpx; height: 176rpx;"/>
       </l-painter-view>
     </l-painter>
+<!--    <l-painter ref="painter" isCanvasToTempFilePath @success="painterSuccess"-->
+<!--               css="width: 750rpx; background: #fff;padding: 20rpx" v-if="detailData.goods_name&&showPoster" hidden>-->
+<!--      <l-painter-image :src="imageUrl" css="display: block; width: 100%; height: 146rpx;"/>-->
+<!--      <l-painter-view css="display: block; padding: 43rpx 0 22rpx 0;">-->
+<!--        <l-painter-text :text="detailData.goods_name"-->
+<!--                        css=" color: #1D161F; font-size: 36rpx; fontWeight: 500; line-height: 42rpx;"/>-->
+<!--      </l-painter-view>-->
+<!--      <l-painter-view css="position: relative; height: 580rpx;">-->
+<!--        <l-painter-image :src="detailData.cover" css="object-fit: contain; width: 100%; height: 100%;"/>-->
+<!--      </l-painter-view>-->
+
+<!--      <l-painter-view-->
+<!--          css="display: flex; align-items: center; justify-content: space-between; padding-top: 38rpx;">-->
+<!--        <l-painter-view css="flex: 1;">-->
+<!--          <l-painter-view>-->
+<!--            <l-painter-text css="font-size: 32rpx; font-weight: 500; color: #858585; line-height: 38rpx;"-->
+<!--                            text="售价:"></l-painter-text>-->
+<!--            <l-painter-text css="font-size: 32rpx; font-weight: 500; color: #7B52C8; line-height: 38rpx;"-->
+<!--                            :text="`¥${detailData.price_selling}`"></l-painter-text>-->
+<!--          </l-painter-view>-->
+<!--          <l-painter-view css="margin-top: 11rpx;">-->
+<!--            <l-painter-text-->
+<!--                css="display: block; font-size: 28rpx; font-weight: 500; color: #858585; line-height: 33rpx;"-->
+<!--                text="长按小程序码参与"></l-painter-text>-->
+<!--          </l-painter-view>-->
+<!--        </l-painter-view>-->
+<!--        <l-painter-image :src="erCodeImg" css="width: 200rpx; height: 200rpx;"/>-->
+<!--      </l-painter-view>-->
+<!--    </l-painter>-->
     <!-- 选套装 -->
     <u-popup :show="show" mode="bottom" :safeAreaInsetTop="true" round="10" closeable @close="close" @open="open">
       <view class="suit-content">
@@ -375,7 +412,18 @@ export default {
     }
   },
   onLoad(options) {
-    console.log("optionssuboacge==", options)
+    let pagePath = "/subPages/goodsDetail/goodsDetail";
+// 如果有 options,拼接查询参数
+    if (options && Object.keys(options).length > 0) {
+      const queryString = Object.keys(options)
+          .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(options[key])}`)
+          .join('&');
+      pagePath += '?' + queryString;
+    }
+    uni.setStorageSync('showPage', pagePath);
+    setTimeout(() => {
+      uni.removeStorageSync('showPage');
+    }, 5000);
     this.pageOptions = options
     this.goodsType = options.type
     this.getAfterSalePage()
@@ -392,7 +440,6 @@ export default {
   onShow() {
     let configs = uni.getStorageSync('configs') || {}
     this.imageUrl=configs?.shop_poster_logoimg ||`${this.$C.imageUrl}home_logo.png`
-
     console.log(this.imageUrl,"============================")
     this.reUserInfo()
   },
@@ -826,10 +873,13 @@ export default {
     width: 100%;
   }
 }
-
 .poster-wrap {
   text-align: center;
-  margin-top: 40rpx;
+  margin-top: 100rpx;
+  .poster-img {
+    width: 610rpx;
+    height: 944rpx;
+  }
 }
 
 .poster-box {

+ 4 - 7
subPages/service/serviceDetail.vue

@@ -1,12 +1,9 @@
 <template>
   <view style="height: 100%; background: #F8F9FA;">
-    <van-image
-        class="huodongText2-img"
-        height="360rpx"
-        :src="courseInfo.cover"
-        width="100%"
-        style="display: flex;align-items: center;"
-    />
+    <u-swiper :list="courseInfo.slider||[]" keyName="url"
+              :indicatorStyle="{right: '20rpx', bottom: '20rpx', width: '100px',marginLeft: 'auto'}" indicator
+              indicatorMode="number" :height="'360rpx'"  imgMode="scaleToFill">
+    </u-swiper>
     <view class="huodong-ccontent" >
       <view class="course-content">
         <view class="course-title fw700 fs18">{{ courseInfo.goods_name }}</view>