| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <template>
- <view class="content">
- <image class="logo" src="/static/post-bg.png"></image>
- <view class="share-box">
- <view>分销商分享给好友,好友购买产品成功后即可获</view>
- <view>得分享奖励</view>
- <view>单笔最高可赚¥200.00</view>
- <view>快去分享吧</view>
- <button type="default" open-type="share">分享</button>
- </view>
-
- <view class="share-box" style="height: 200upx;margin-top: 2%;" @longpress="copyCode">
- <view>长按复制框内整段文字,打开 [手淘] 即可购买</view>
- <view>¥kSfsDfrtrEjt¥</view>
- <button type="default" @click="copyCode">一键复制</button>
- </view>
-
- <view class="product-title">推荐产品</view>
-
- <view class="recommend-box">
- <view class="product-box" v-for="item in productList" :key="item.id" @click="goDetail(item.id)">
- <image :src="item.imgUrl"></image>
- <view class="detail-box">
- <view>{{item.productTitle}}</view>
- <view style="color: #999;">¥{{item.price}}</view>
- </view>
- </view>
- </view>
-
- </view>
- </template>
- <script>
- var md5 = require("../../common/md5.js");
- export default {
- data() {
- return {
- title: 'Hello',
- pageInfo:{},
- productList:[
- {
- id:'1',
- imgUrl:'/static/bed-bg.png',
- productTitle:'甜蜜瑞士系列床垫 卧室独立袋弹簧 护脊静音软硬适…',
- price:'13999'
- },
- {
- id:'2',
- imgUrl:'/static/bed2-bg.png',
- productTitle:'甜蜜瑞士系列床垫 卧室独立袋弹簧 护脊静音软硬适…',
- price:'15999'
- },
- {
- id:'3',
- imgUrl:'/static/bed-bg.png',
- productTitle:'甜蜜瑞士系列床垫 卧室独立袋弹簧 护脊静音软硬适…',
- price:'16999'
- },
- {
- id:'4',
- imgUrl:'/static/bed2-bg.png',
- productTitle:'甜蜜瑞士系列床垫 卧室独立袋弹簧 护脊静音软硬适…',
- price:'18999'
- }
- ]
- }
- },
- onLoad(options) {
- getApp().globalData.lastId = options.inviteId ? options.inviteId : getApp().globalData.user_id
- this.loginRequest();
- this.getPageProductList();
- },
- onShareAppMessage() {
- console.log(111);
- return {
- title: '分销小助手',
- path:'/pages/index/index?inviteId=' + getApp().globalData.user_id
- }
- },
- methods: {
- loginRequest(){
- uni.login({
- success: (res) => {
- uni.request({
- url: getApp().globalData.shareUrl, //需要设置为全局
- method: 'POST',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- data: {
- method: 'login',
- timestamp: getApp().globalData.globalTimestamp, //Date.now()
- code: res.code,
- sign: md5('login' + getApp().globalData.globalTimestamp)
- },
- success: res => {
- // 通过openid发起会员登录
- getApp().globalData.user_id = res.data.msg.id;
- getApp().globalData.open_id = res.data.msg.openid;
- getApp().globalData.isAuth = res.data.msg.auth_status === '1';
- getApp().globalData.user_name = res.data.msg.name;
- getApp().globalData.user_headUrl = res.data.msg.headimg;
- getApp().globalData.session_key = res.data.msg.session_key;
- getApp().globalData.user_phone = res.data.msg.phone;
- // getApp().globalData.times = res.data.msg.times;
- // getApp().globalData.total_times = res.data.msg.total_times;
- this.getPageInfo(res.data.msg.id);
- }
- });
- }
- });
- },
- getPageInfo(uId){ //获取首页面基本信息接口
- let that = this;
- uni.request({
- url: getApp().globalData.shareUrl, //需要设置为全局
- method: 'POST',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- data: {
- method: 'getHomePageInfo',
- timestamp: getApp().globalData.globalTimestamp, //Date.now()
- id: uId,
- sign: md5('getHomePageInfo' + getApp().globalData.globalTimestamp)
- },
- success: res => {
- if (res.data.code === 200) {
- that.pageInfo = res.data.msg
- console.log(res.data.msg)
- }
- }
- });
- },
- getPageProductList(){ //获取首页面产品列表接口
- let that = this;
- uni.request({
- url: getApp().globalData.shareUrl, //需要设置为全局
- method: 'POST',
- header: {
- 'content-type': 'application/x-www-form-urlencoded'
- },
- data: {
- method: 'getProductsList',
- timestamp: getApp().globalData.globalTimestamp, //Date.now()
- page: '',
- pageSize:'',
- sign: md5('getProductsList' + getApp().globalData.globalTimestamp)
- },
- success: res => {
- if (res.data.code === 200) {
- console.log(res.data.msg)
- //that.productList = res.data.msg;
- }
- }
- });
- },
- goDetail(id){
- uni.navigateTo({
- url: '/pages/index/detailPage/index?detailId='+id,
- success: res => {},
- fail: () => {},
- complete: () => {}
- });
- },
- copyCode(){
- uni.setClipboardData({
- data:'xxx',
- success() {
- uni.showToast({
- icon:'none',
- title:'复制成功'
- })
- }
- })
- }
- }
- }
- </script>
- <style>
- .content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .logo {
- height: 400px;
- width: 100%;
- margin-bottom: 30upx;
- }
- .share-box {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 80%;
- height: 300upx;
- border: 1px dashed red;
- background: #fff;
- font-size: 28rpx;
- padding: 5px;
- }
- .share-box button {
- width: 300rpx;
- height: 70rpx;
- line-height: 70rpx;
- margin-top: 2%;
- background-color: #27BCEF;
- color: #fff;
- }
- .title {
- font-size: 36upx;
- color: #8f8f94;
- }
- .product-title {
- margin-left: -75%;
- margin-top: 5%;
- margin-bottom: 1%;
- }
- .recommend-box {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- .product-box {
- width: 90%;
- height: 200rpx;
- padding: 20rpx;
- display: flex;
- align-items: center;
- background-color: #fff;
- border-radius:10px;
- margin-bottom: 2%;
- }
- .product-box image {
- width: 420rpx;
- height: 180rpx;
- margin-right: 5%;
- }
- .detail-box {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- font-size: 30rpx;
- height: 190rpx;
- }
- </style>
|