소스 검색

增加邀请码

谢杰标 2 년 전
부모
커밋
9fbfdd8437
4개의 변경된 파일229개의 추가작업 그리고 192개의 파일을 삭제
  1. 8 0
      common/httpList/userInfo.js
  2. 0 2
      common/request.js
  3. 7 1
      pages4/login/login.vue
  4. 214 189
      pages5/scan/recommen.vue

+ 8 - 0
common/httpList/userInfo.js

@@ -10,6 +10,14 @@ export default {
 			data: data,
 		})
 	},
+	// 修改用户活动邀请码
+	shareActivityCode(data) {
+		return myRequest({
+			url: '/app/user/edit/shareActivityCode',
+			method: 'post',
+			data: data,
+		})
+	},
 	appInfoAttached(data) {
 		return myRequest({
 			url: '/app/user/infoAttached',

+ 0 - 2
common/request.js

@@ -37,7 +37,6 @@ export const myRequest = (options) => {
 						if (!uni.getStorageSync('user_account')) {
 							var pages = getCurrentPages() // 获取栈实例
 							let currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
-							console.log('request-->1111:', currentRoute);
 							if (currentRoute != 'pages4/login/login') {
 								uni.navigateTo({
 									url: '/pages4/login/login'
@@ -53,7 +52,6 @@ export const myRequest = (options) => {
 						uni.removeStorageSync('user_account');
 						var pages = getCurrentPages() // 获取栈实例
 						let currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
-						console.log('request-->2222:', currentRoute);
 						if (currentRoute != 'pages4/login/login') {
 							uni.navigateTo({
 								url: '/pages4/login/login'

+ 7 - 1
pages4/login/login.vue

@@ -376,6 +376,12 @@ export default {
 				//信息完善,直接进入页面
 				uni.setStorageSync('user_account', res.data.data.user_account);
 				uni.setStorageSync('token', res.data.data.token);
+				// 修改邀请码
+				this.$api.shareActivityCode({shareActivityCode: uni.getStorageSync("sac")}).then(res=>{
+					if (res.data.code == 200) {
+                        uni.removeStorageSync("sac");
+                    }
+				})
 				// /app/user/getInfo 登录用户信息// fromPlat来源平台 1小程序 2PC网站
 				this.$api.getInfo({ fromPlat: 1 }).then(resdata => {
 					if(resdata.data.code == 200){
@@ -409,8 +415,8 @@ export default {
 							uni.navigateBack();
 						}
 					}
-					
 				});
+				
 			// } else {
 			// 	//未完善信息,存为临时信息
 			// 	uni.setStorageSync('user_account_temp', res.data.data.user_account);

+ 214 - 189
pages5/scan/recommen.vue

@@ -1,199 +1,224 @@
 <template>
-	<view class="scan_course">
-		<nav-bar title="商品列表" class="navbar"></nav-bar>
-		<view class="list_item" v-for="(item, index) in courseList" :key="index">
-			<view class="course_content">
-				<view class="c_title">{{ item.goodsName }}</view>
-				<view class="c_downs">
-					<view class="img">
-						<image :src="$method.splitImgHost(item.coverUrl, true)"></image>
-						<view class="time" v-if="item.year">{{
+  <view class="scan_course">
+    <nav-bar title="商品列表" class="navbar"></nav-bar>
+    <view class="list_item" v-for="(item, index) in courseList" :key="index">
+      <view class="course_content">
+        <view class="c_title">{{ item.goodsName }}</view>
+        <view class="c_downs">
+          <view class="img">
+            <image :src="$method.splitImgHost(item.coverUrl, true)"></image>
+            <view class="time" v-if="item.year">{{
               item.year ? item.year : ""
             }}</view>
-					</view>
-					<view class="text">
-						<view class="desc">
-							<view class="left">
-								<text class="mon_t">¥ {{ item.standPrice }}</text>
-								<text v-if="item.linePrice" class="sale"> ¥ </text>
-								<text v-if="item.linePrice" class="price_line">&nbsp;{{ item.linePrice }}</text>
-							</view>
-							<view class="right">
-								<view class="regiser_row" @click="toBuy(item)">立即购买</view>
-							</view>
-						</view>
-					</view>
-				</view>
-			</view>
-		</view>
-	</view>
+          </view>
+          <view class="text">
+            <view class="desc">
+              <view class="left">
+                <text class="mon_t">¥ {{ item.standPrice }}</text>
+                <text v-if="item.linePrice" class="sale"> ¥ </text>
+                <text v-if="item.linePrice" class="price_line"
+                  >&nbsp;{{ item.linePrice }}</text
+                >
+              </view>
+              <view class="right">
+                <view class="regiser_row" @click="toBuy(item)">立即购买</view>
+              </view>
+            </view>
+          </view>
+        </view>
+      </view>
+    </view>
+  </view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				courseList: []
-			};
-		},
-		onLoad({
-			scene
-		}) {
-			this.courseList = [];
-			if (scene) {
-				let optObj = {};
-				let arrs = decodeURIComponent(scene).split("&");
-				for (let i = 0; i < arrs.length; i++) {
-					optObj[arrs[i].split("=")[0]] = arrs[i].split("=")[1];
-				}
-				this.getCourseList(optObj.sharekey);
-			}
-		},
-		methods: {
-			getCourseList(id) {
-				this.$api.actGoodsList(id).then((res) => {
-					if (res.data.code == 200) {
-						this.courseList = res.data.data;
-					} else {
-						uni.showToast({
-							title: res.data.msg,
-							icon: "error",
-						});
-					}
-				})
-			},
-			toBuy(item) {
-				if (item.goodsType == 2) {
-					uni.navigateTo({
-						url: "/pages2/bank/detail?id=" + item.goodsId,
-					});
-				} else {
-					uni.navigateTo({
-						url: "/pages3/course/detail?id=" +
-							item.goodsId +
-							"&goodsType=" +
-							item.goodsType,
-					});
-				}
-			},
-		},
-	};
+import config from "@/common/config";
+export default {
+  data() {
+    return {
+      courseList: [],
+    };
+  },
+  onLoad({ scene }) {
+    this.courseList = [];
+    if (scene) {
+      let optObj = {};
+      let arrs = decodeURIComponent(scene).split("&");
+      for (let i = 0; i < arrs.length; i++) {
+        optObj[arrs[i].split("=")[0]] = arrs[i].split("=")[1];
+      }
+      uni.setStorageSync("sac",optObj.sac);
+      this.getCourseList(optObj.sharekey);
+      this.shareActivityCode(optObj.sac);
+    }
+  },
+  methods: {
+    getCourseList(id) {
+      this.$api.actGoodsList(id).then((res) => {
+        if (res.data.code == 200) {
+          this.courseList = res.data.data;
+        } else {
+          uni.showToast({
+            title: res.data.msg,
+            icon: "error",
+          });
+        }
+      });
+    },
+    toBuy(item) {
+      if (item.goodsType == 2) {
+        uni.navigateTo({
+          url: "/pages2/bank/detail?id=" + item.goodsId,
+        });
+      } else {
+        uni.navigateTo({
+          url:
+            "/pages3/course/detail?id=" +
+            item.goodsId +
+            "&goodsType=" +
+            item.goodsType,
+        });
+      }
+    },
+    shareActivityCode(sac) {
+      let token = uni.getStorageSync("token");
+      token &&
+        uni.request({
+          url: config.BASE_URL + "/app/user/edit/shareActivityCode",
+          method: "POST",
+          data: {
+            shareActivityCode: sac,
+          },
+          header: {
+            AuthorizationToken: "WX " + token,
+            TenantId: config.tenantId,
+          },
+          success: (res) => {
+            if (res.data.code == 200) {
+              uni.removeStorageSync("sac");
+            }
+          },
+          fail: (err) => {},
+        });
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
-	.scan_course {
-		padding: 32rpx 32rpx 0;
-
-		.list_item {
-			padding: 24rpx;
-			// height: 278rpx;
-			background: #ffffff;
-			box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(1, 99, 235, 0.1);
-			border-radius: 24rpx;
-			background: #fff;
-			margin-bottom: 32rpx;
-			display: flex;
-			align-items: center;
-
-			.c_title {
-				font-size: 32rpx;
-				font-weight: bold;
-				margin-bottom: 24rpx;
-				font-weight: bold;
-				color: #222222;
-			}
-
-			.c_downs {
-				display: flex;
-			}
-
-			.img {
-				position: relative;
-				margin-right: 24rpx;
-				border-radius: 16rpx;
-				overflow: hidden;
-				width: 204rpx;
-				height: 120rpx;
-
-				image {
-					width: 100%;
-					height: 100%;
-				}
-
-				.time {
-					position: absolute;
-					bottom: 0;
-					right: 0;
-					width: 80rpx;
-					height: 32rpx;
-					background: rgba(1, 25, 45, 0.4);
-					color: #fff;
-					text-align: center;
-					line-height: 32rpx;
-					font-size: 24rpx;
-					border-radius: 10rpx 0px 10rpx 0px;
-				}
-			}
-
-			.text {
-				width: 440rpx;
-				position: relative;
-				display: flex;
-				flex-direction: column;
-				justify-content: space-between;
-				height: 120rpx;
-
-				.desc {
-					margin-top: 10rpx;
-					display: flex;
-					align-items: center;
-					justify-content: space-between;
-					width: 100%;
-
-					.left {
-						flex: 1;
-						color: #333;
-						font-size: 26rpx;
-
-						.mon_t {
-							font-weight: bold;
-							color: #fc3f3f;
-							font-size: 36rpx;
-						}
-
-						.sale {
-							color: #999999;
-							font-size: 24rpx;
-							margin-left: 8rpx;
-						}
-
-						.price_line {
-							color: #999999;
-							font-size: 24rpx;
-							text-decoration: line-through;
-							font-weight: 400;
-						}
-					}
-
-					.right {
-						font-size: 24rpx;
-						font-weight: bold;
-						padding-right: 20rpx;
-
-						.regiser_row {
-							width: 144rpx;
-							height: 52rpx;
-							line-height: 52rpx;
-							text-align: center;
-							border-radius: 16rpx;
-							background-color: #fc3f3f;
-							color: #fff;
-							font-weight: 500;
-							font-size: 26rpx;
-						}
-					}
-				}
-			}
-		}
-	}
+.scan_course {
+  padding: 32rpx 32rpx 0;
+
+  .list_item {
+    padding: 24rpx;
+    // height: 278rpx;
+    background: #ffffff;
+    box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(1, 99, 235, 0.1);
+    border-radius: 24rpx;
+    background: #fff;
+    margin-bottom: 32rpx;
+    display: flex;
+    align-items: center;
+
+    .c_title {
+      font-size: 32rpx;
+      font-weight: bold;
+      margin-bottom: 24rpx;
+      font-weight: bold;
+      color: #222222;
+    }
+
+    .c_downs {
+      display: flex;
+    }
+
+    .img {
+      position: relative;
+      margin-right: 24rpx;
+      border-radius: 16rpx;
+      overflow: hidden;
+      width: 204rpx;
+      height: 120rpx;
+
+      image {
+        width: 100%;
+        height: 100%;
+      }
+
+      .time {
+        position: absolute;
+        bottom: 0;
+        right: 0;
+        width: 80rpx;
+        height: 32rpx;
+        background: rgba(1, 25, 45, 0.4);
+        color: #fff;
+        text-align: center;
+        line-height: 32rpx;
+        font-size: 24rpx;
+        border-radius: 10rpx 0px 10rpx 0px;
+      }
+    }
+
+    .text {
+      width: 440rpx;
+      position: relative;
+      display: flex;
+      flex-direction: column;
+      justify-content: space-between;
+      height: 120rpx;
+
+      .desc {
+        margin-top: 10rpx;
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        width: 100%;
+
+        .left {
+          flex: 1;
+          color: #333;
+          font-size: 26rpx;
+
+          .mon_t {
+            font-weight: bold;
+            color: #fc3f3f;
+            font-size: 36rpx;
+          }
+
+          .sale {
+            color: #999999;
+            font-size: 24rpx;
+            margin-left: 8rpx;
+          }
+
+          .price_line {
+            color: #999999;
+            font-size: 24rpx;
+            text-decoration: line-through;
+            font-weight: 400;
+          }
+        }
+
+        .right {
+          font-size: 24rpx;
+          font-weight: bold;
+          padding-right: 20rpx;
+
+          .regiser_row {
+            width: 144rpx;
+            height: 52rpx;
+            line-height: 52rpx;
+            text-align: center;
+            border-radius: 16rpx;
+            background-color: #fc3f3f;
+            color: #fff;
+            font-weight: 500;
+            font-size: 26rpx;
+          }
+        }
+      }
+    }
+  }
+}
 </style>