Browse Source

首页接口 关于我们接口对接

test
Enzo 4 years ago
parent
commit
ac7a12e33b
  1. 17
      common/api.js
  2. 1
      common/http.interceptor.js
  3. 6
      common/http.js
  4. 16
      components/lf-waterfall/lf-waterfall.vue
  5. 4
      manifest.json
  6. 6
      pages/about/index.vue
  7. 25
      pages/collect/index.vue
  8. 38
      pages/index/index.vue

17
common/api.js

@ -1,5 +1,20 @@
// appId: 正式 null | 测试 wxb35ef055a4dd8ad4
export const DEV = "dev"; // dev 测试 | prod 正式
export const VERSION = '1.0.0'; // 版本号
export const DEVURL = 'https://gxsky.lanzulive.com'; // 测试服请求地址
export const DEVURL = 'http://hainan.com'; // 测试服请求地址
export const PRODURL = ''; // 正式服请求地址
export const API_WXLOGIN = '/api/login'; //登录
export const API_INDEX = '/api/index'; //首页
//系统
export const API_ABOUTUS = '/api/agent_info/about'; //关于我们
export const API_COLLECT_LIST = '/api/fav/list'; //收藏列表

1
common/http.interceptor.js

@ -16,6 +16,7 @@ const install = (Vue, vm) => {
// 请求前拦截, 现在不做拦截
Vue.prototype.$u.http.interceptor.request = config => {
console.log(config)
return true;
};

6
common/http.js

@ -89,8 +89,12 @@ function $http(url, data = {}, options = {}){
that.$u.http.setConfig({showLoading: options.showLoading});
}
//商户id
options.appid = 'wx0e8ebcd9ca9e4b97'
options.Authentication = 'c4ca4238a0b923820dcc509a6f75849b'
// 发起请求
that.$u.post(url, data).then(res => {
that.$u.post(url, data, options).then(res => {
resolve(res);
}).catch(err => {
reject(err);

16
components/lf-waterfall/lf-waterfall.vue

@ -3,34 +3,34 @@
<u-waterfall v-model="list">
<template v-slot:left="{leftList}">
<view class="list-warter" v-for="(item, index) in leftList" :key="index" @click="onClick">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.image" :index="index">
<view class="list-label">已售8777</view>
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{item.saleitem.sale}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.title}}
{{item.product.title}}
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">¥399.00</text>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
</view>
</view>
</template>
<template v-slot:right="{rightList}">
<view class="list-warter" v-for="(item, index) in rightList" :key="index" @click="onClick">
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.image" :index="index">
<view class="list-label">已售8777</view>
<u-lazy-load threshold="-450" border-radius="8px 8px 0 0" :image="item.product.picture" :index="index">
<view class="list-label">已售{item.sale}</view>
</u-lazy-load>
<view class="lf-p-20">
<view class="list-title">
{{item.title}}
{{item.product.title}}
</view>
<view class="list-price">
<!-- <text>{{item.price}}</text> -->
<lf-price :price="item.price"></lf-price>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">¥399.00</text>
<text class="lf-m-l-20 lf-font-24 lf-color-666 lf-line-through">{{item.original_price}}</text>
</view>
</view>
</view>

4
manifest.json

@ -50,10 +50,10 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wxb35ef055a4dd8ad4",
"appid" : "wx0e8ebcd9ca9e4b97",
"setting" : {
"urlCheck" : false,
"es6" : true,
"es6" : false,
"postcss" : true
},
"usingComponents" : true

6
pages/about/index.vue

@ -15,12 +15,12 @@
}
},
onLoad(){
// this.getData();
this.getData();
},
methods: {
getData(){
this.$http(this.API.API_ARTICLE_QA).then(res => {
this.content = res.data?.content;
this.$http(this.API.API_ABOUTUS).then(res => {
this.content = res.data?.about;
})
}
}

25
pages/collect/index.vue

@ -46,22 +46,23 @@
},
methods: {
getCollectList(){
this.list = [{
id: 1,
goods: {cover: '', name: '小毛驴', store: {name: '家具家电'}},
is_collect: true,
created_at_text: '2021.07.07'
},{
id: 2,
goods: {cover: '', name: '小毛驴', store: {name: '家具家电'}},
is_collect: true,
created_at_text: '2021.07.07'
}];
// this.list = [{
// id: 1,
// goods: {cover: '', name: '', store: {name: ''}},
// is_collect: true,
// created_at_text: '2021.07.07'
// },{
// id: 2,
// goods: {cover: '', name: '', store: {name: ''}},
// is_collect: true,
// created_at_text: '2021.07.07'
// }];
return;
// return;
this.$http(this.API.API_COLLECT_LIST).then(res => {
this.skeletonLoading = false;
this.isPage = res.data.has_more_page;
console.log(res)
let list = res.data.items.map(item => {
item.is_collect = true; //
return item;

38
pages/index/index.vue

@ -1,19 +1,16 @@
<template>
<view>
<swiper class="head" :current="banner_current" >
<swiper-item @click="clickBanner">
<image src="https://picsum.photos/375/360" class="swipe-img"></image>
</swiper-item>
<swiper-item @click="clickBanner">
<image src="https://picsum.photos/375/360" class="swipe-img"></image>
<swiper-item @click="clickBanner" v-for="(item,index) of banner">
<image :src="item.url" class="swipe-img" mode="aspectFill"></image>
</swiper-item>
</swiper>
<view class="content">
<!-- 消息模块 -->
<view class="lf-row-between lf-m-b-34 message-box">
<view class="lf-row-between lf-m-b-34 message-box" v-for="(item,index) of notice">
<view class="lf-flex">
<text class="lf-iconfont lf-icon-tongzhi lf-text-vertical"></text>
<view class="lf-m-l-12 lf-line-1" style="max-width: 510rpx;">国庆优惠大促快来看看吧</view>
<view class="lf-m-l-12 lf-line-1" style="max-width: 510rpx;">{{item.title}}</view>
</view>
<view class="message-btn" hover-class="lf-opacity" @click="$url('/pages/notice/article')">详情</view>
</view>
@ -26,9 +23,9 @@
</view>
</view>
<view class="lf-flex-wrap">
<view class="channel-item" v-for="(item, index) in 7" @click="$url('/pages/goodsList/index')">
<image src="../../static/logo.png" class="channel-mask" mode="aspectFill"></image>
<view class="lf-row-center channe-text lf-font-bold">冲浪</view>
<view class="channel-item" v-for="(item, index) in channel_list" @click="$url('/pages/goodsList/index')">
<image :src="item.icon" class="channel-mask" mode="aspectFill"></image>
<view class="lf-row-center channe-text lf-font-bold">{{item.name}}</view>
<!-- <view>
<u-icon name="lock-fill lf-text-vertical"></u-icon>
</view> -->
@ -119,11 +116,14 @@
},
data() {
return {
banner: [],
banner_current: 0,
recomm_list: [],
channel_list: [],
current: 0,
loading_class: false,
loading_text: '已加载全部数据~',
home_ad1: '',
list: [
{
price: 35,
@ -161,11 +161,13 @@
title: '江山如此多娇,引无数英雄竞折腰',
image: 'http://pic1.sc.chinaz.com/Files/pic/pic9/202002/zzpic23346_s.jpg',
}
]
],
notice: []
}
},
onLoad() {
this.addRandomData();
// this.addRandomData();
this.getIndexData()
},
methods: {
//
@ -178,6 +180,18 @@
this.recomm_list.push(item);
}
},
getIndexData() {
this.$http(this.API.API_INDEX).then(res => {
this.notice = res.data?.notice
this.recomm_list = res.data?.hots
this.banner = res.data?.slide
this.channel_list = res.data?.my_channels
this.home_ad1 = res.data?.home_ad1
console.log(res)
}).catch(err => {
})
},
// tabs
tabChange(current){
this.current = current;

Loading…
Cancel
Save