提交 bd376cdf 编写于 作者: G gongfuxiang

wechat

上级 b2faecc8
......@@ -428,8 +428,7 @@ App({
},
/**
* 价格保留两位小数
* price 价格保留两位小数
* 事件操作
*/
operation_event(e) {
var value = e.target.dataset.value || null;
......
......@@ -480,6 +480,53 @@ App({
return s_x;
},
/**
* 事件操作
*/
operation_event(e) {
var value = e.currentTarget.dataset.value || null;
var type = parseInt(e.currentTarget.dataset.type);
if (value != null) {
switch (type) {
// web
case 0:
wx.navigateTo({ url: '/pages/web-view/web-view?url=' + value });
break;
// 内部页面
case 1:
wx.navigateTo({ url: value });
break;
// 跳转到外部小程序
case 2:
wx.navigateToMiniProgram({ appId: value });
break;
// 跳转到地图查看位置
case 3:
var values = value.split('|');
if (values.length != 4) {
wx.showToast({ content: '事件值格式有误' });
return false;
}
wx.openLocation({
name: values[0],
address: values[1],
longitude: values[2],
latitude: values[3],
});
break;
// 拨打电话
case 4:
wx.makePhoneCall({ number: value });
break;
}
}
},
/**
* 默认弱提示方法
* msg [string] 提示信息
......
/* 框架样式覆盖 */
.a-textarea-control textarea { font-size: 12px; }
.a-textarea-control textarea {
font-size: 12px;
}
button:after, button:before {
border: 0;
border-radius: 0;
}
/* 公共样式 */
page {
......
const app = getApp();
Component({
mixins: [],
data: {
indicator_dots: false,
indicator_color: 'rgba(0, 0, 0, .3)',
indicator_active_color: '#e31c55',
autoplay: true,
circular: true,
data_list_loding_status: 1,
data_bottom_line_status: false,
data_list: [],
},
props: {},
didMount() {
this.init();
},
didUpdate() {},
didUnmount() {},
methods: {
// 获取数
init() {
// 加载loding
this.setData({
data_list_loding_status: 1,
});
// 加载loding
wx.request({
url: app.get_request_url("index", "banner"),
method: "POST",
data: {},
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
if (res.data.code == 0) {
var data = res.data.data;
this.setData({
data_list: data,
indicator_dots: (data.length > 1),
autoplay: (data.length > 1),
data_list_loding_status: data.length == 0 ? 0 : 3,
data_bottom_line_status: true,
});
} else {
this.setData({
data_list_loding_status: 0,
data_bottom_line_status: true,
});
wx.showToast({
type: "fail",
content: res.data.msg
});
}
},
fail: () => {
this.setData({
data_list_loding_status: 2,
data_bottom_line_status: true,
});
wx.showToast({
type: "fail",
content: "服务器请求出错"
});
}
});
},
// 操作事件
banner_event(e) {
app.operation_event(e);
},
},
});
const app = getApp();
Component({
mixins: [],
props: {},
data: {
data_list_loding_status: 1,
data_bottom_line_status: false,
data_list: [],
},
didMount() {
this.init();
},
didUpdate(){},
didUnmount(){},
methods:{
init() {
// 加载loding
this.setData({
data_list_loding_status: 1,
});
// 加载loding
wx.request({
url: app.get_request_url("index", "navigation"),
method: "POST",
data: {},
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
if (res.data.code == 0) {
var data = res.data.data;
this.setData({
data_list: data,
data_list_loding_status: data.length == 0 ? 0 : 3,
data_bottom_line_status: true,
});
} else {
this.setData({
data_list_loding_status: 0,
data_bottom_line_status: true,
});
wx.showToast({
type: "fail",
content: res.data.msg
});
}
},
fail: () => {
this.setData({
data_list_loding_status: 2,
data_bottom_line_status: true,
});
wx.showToast({
type: "fail",
content: "服务器请求出错"
});
}
});
},
// 操作事件
nav_event(e) {
app.operation_event(e);
},
}
});
const app = getApp();
Component({
data: {},
properties: {
propData: Array
},
methods: {
nav_event(e) {
app.operation_event(e);
},
},
});
<view wx:if="{{data_list.length > 0}}">
<view wx:if="{{propData.length > 0}}">
<view class="data-list bg-white spacing-mb">
<view class="items" wx:for="{{data_list}}">
<view class="items" wx:for="{{propData}}" wx:key="key">
<view class="items-content tc" style="background-color:{{item.bg_color}}" data-value="{{item.event_value}}" data-type="{{item.event_type}}" bindtap="nav_event">
<image class="wh-auto" src="{{item.images_url}}" mode="aspectFit" />
</view>
<view class="title tc single-text">{{item.name}}</view>
</view>
</view>
</view>
<view wx:if="{{data_list_loding_status == 2}}">
<import src="/pages/common/nodata.wxml" />
<template is="nodata" data="{{status: data_list_loding_status}}"></template>
</view>
</view>
\ No newline at end of file
// components/popup.js
Component({
/**
* 组件的属性列表
*/
properties: {
propClassname: String,
propShow: Boolean,
propPosition: String,
propMask: Boolean,
propAnimation: Boolean,
propDisablescroll: Boolean
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="am-popup {{propClassname || ''}} {{(propShow || false) ? 'am-popup-show' : ''}} {{ (propAnimation || true) ? 'animation': '' }}" disable-scroll="{{propDisablescroll || true}}">
<view class="am-popup-mask" wx:if="{{propMask || true}}" bindtap="onMaskTap"></view>
<view class="am-popup-content am-popup-{{propPosition || 'bottom'}}">
<slot></slot>
</view>
</view>
\ No newline at end of file
.am-popup-content {
position: fixed;
}
.am-popup-mask {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.75);
opacity: 0;
pointer-events: none;
}
.am-popup-left {
transform: translateX(-100%);
left: 0;
top: 0;
bottom: 0;
}
.am-popup-right {
transform: translateX(100%);
right: 0;
top: 0;
bottom: 0;
}
.am-popup-top {
top: 0;
width: 100vw;
transform: translateY(-100%);
}
.am-popup-bottom {
bottom: 0;
width: 100vw;
transform: translateY(100%);
}
.am-popup-show .am-popup-content {
transform: none;
}
.am-popup-show .am-popup-mask {
opacity: 1;
pointer-events: auto;
}
.am-popup.animation .am-popup-content {
transition: all 0.15s linear;
}
.am-popup.animation .am-popup-mask {
transition: all 0.15s linear;
}
\ No newline at end of file
const app = getApp();
Component({
data: {
indicator_dots: false,
indicator_color: 'rgba(0, 0, 0, .3)',
indicator_active_color: '#e31c55',
autoplay: true,
circular: true,
},
properties: {
propData: Array
},
methods: {
banner_event(e) {
app.operation_event(e);
},
},
});
\ No newline at end of file
<swiper
indicator-dots="{{indicator_dots}}"
indicator-dots="{{propData.length > 0}}"
indicator-color="{{indicator_color}}"
indicator-active-color="{{indicator_active_color}}"
autoplay="{{autoplay}}"
autoplay="{{propData.length > 0}}"
circular="{{circular}}"
class="banner bg-white spacing-mb"
wx:if="{{data_list.length > 0}}">
<block wx:for="{{data_list}}">
wx:if="{{propData.length > 0}}">
<block wx:for="{{propData}}" wx:key="key">
<swiper-item>
<image class="wh-auto" src="{{item.images_url}}" mode="widthFix" data-value="{{item.event_value}}" data-type="{{item.event_type}}" bindtap="banner_event" />
</swiper-item>
</block>
</swiper>
<view wx:if="{{data_list_loding_status == 2}}">
<import src="/pages/common/nodata.wxml" />
<template is="nodata" data="{{status: data_list_loding_status}}"></template>
</view>
\ No newline at end of file
</swiper>
\ No newline at end of file
{
"enablePullDownRefresh": true,
"usingComponents": {
"popup": "mini-antui/es/popup/index"
"component-popup": "/components/popup/popup"
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@
circular="{{circular}}"
class="goods-photo bg-white"
wx:if="{{goods_photo.length > 0}}">
<block wx:for="{{goods_photo}}">
<block wx:for="{{goods_photo}}" wx:key="key">
<swiper-item>
<image class="swiper-item wh-auto" bindtap="goods_photo_view_event" data-index="{{index}}" src="{{item.images}}" mode="aspectFit" bindtap="banner_event" />
</swiper-item>
......@@ -48,7 +48,7 @@
<text class="line"></text>
<text class="text-wrapper">详情</text>
</view>
<view wx:for="{{goods_content_app}}" class="goods-detail-app bg-white">
<view wx:for="{{goods_content_app}}" wx:key="key" class="goods-detail-app bg-white">
<image wx:if="{{(item.images || null) != null}}" bindtap="goods_detail_images_view_event" data-value="{{item.images}}" class="wh-auto" src="{{item.images}}" mode="widthFix" />
<view wx:if="{{(item.content || null) != null}}" class="content-items">
<view wx:for="{{item.content}}" wx:for-item="items">{{items}}</view>
......@@ -77,10 +77,11 @@
</view>
<!-- 弹层 -->
<popup show="{{popup_status}}" position="bottom" onClose="popup_close_event">
<!-- <popup show="{{popup_status}}" position="bottom" onClose="popup_close_event"> -->
<component-popup prop-show="{{popup_status}}" prop-position="bottom" prop-onclose="popup_close_event">
<view class="goods-popup bg-white">
<view class="close fr oh">
<view class="fr" catchTap="popup_close_event">
<view class="fr" catchtap="popup_close_event">
<icon type="clear" size="20" />
</view>
</view>
......@@ -107,7 +108,7 @@
<view class="title">{{item.name}}</view>
<view wx:if="{{item.value.length > 0}}" class="attribute">
<block wx:for="{{item.value}}" wx:for-index="keys" wx:for-item="items">
<button catchTap="goods_specifications_event" data-key="{{key}}" data-keys="{{keys}}" type="default" size="mini" hover-class="none" class="{{items.is_active}} {{items.is_dont}} {{items.is_disabled}}">
<button catchtap="goods_specifications_event" data-key="{{key}}" data-keys="{{keys}}" type="default" size="mini" hover-class="none" class="{{items.is_active}} {{items.is_dont}} {{items.is_disabled}}">
<image wx:if="{{(items.images || null) != null}}" src="{{items.images}}" mode="scaleToFill" />
{{items.name}}
</button>
......@@ -126,9 +127,9 @@
</view>
</view>
</view>
<button class="goods-popup-submit bg-main" type="default" catchTap="goods_buy_confirm_event" hover-class="none">确定</button>
<button class="goods-popup-submit bg-main" type="default" catchtap="goods_buy_confirm_event" hover-class="none">确定</button>
</view>
</popup>
</component-popup>
</view>
<view wx:if="{{goods == null}}">
......
const app = getApp();
Page({
data: {
indicator_dots: false,
indicator_color: 'rgba(0, 0, 0, .3)',
indicator_active_color: '#e31c55',
autoplay: true,
circular: true,
data_list_loding_status: 1,
data_bottom_line_status: false,
data_list: [],
banner_list: [],
navigation: [],
common_shop_notice: null,
common_app_is_enable_search: 1,
common_app_is_enable_answer: 1,
......@@ -42,13 +38,9 @@ Page({
if (res.data.code == 0) {
var data = res.data.data;
self.setData({
banner_list: data.banner_list,
indicator_dots: (data.banner_list.length > 1),
autoplay: (data.banner_list.length > 1),
banner_list: data.banner_list || [],
navigation: data.navigation || [],
data_list: data.data_list,
indicator_dots: (data.data_list.length > 1),
autoplay: (data.data_list.length > 1),
common_shop_notice: data.common_shop_notice || null,
common_app_is_enable_search: data.common_app_is_enable_search,
common_app_is_enable_answer: data.common_app_is_enable_answer,
......@@ -102,6 +94,16 @@ Page({
this.init();
},
// 轮播事件
banner_event(e) {
app.operation_event(e);
},
// 导航事件
navigation_event(e) {
app.operation_event(e);
},
// 自定义分享
onShareAppMessage() {
return {
......
{
"enablePullDownRefresh": true,
"usingComponents": {
"component-home-nav": "/components/home-nav/home-nav",
"component-home-banner": "/components/home-banner/home-banner"
"component-icon-nav": "/components/icon-nav/icon-nav",
"component-banner": "/components/slider/slider"
}
}
\ No newline at end of file
......@@ -12,25 +12,14 @@
</view>
<!-- 轮播 -->
<swiper
indicator-dots="{{indicator_dots}}"
indicator-color="{{indicator_color}}"
indicator-active-color="{{indicator_active_color}}"
autoplay="{{autoplay}}"
circular="{{circular}}"
class="banner bg-white spacing-mb"
wx:if="{{banner_list.length > 0}}">
<block wx:for="{{banner_list}}">
<swiper-item>
<image class="wh-auto" src="{{item.images_url}}" mode="widthFix" data-value="{{item.event_value}}" data-type="{{item.event_type}}" bindtap="banner_event" />
</swiper-item>
</block>
</swiper>
<component-banner prop-data="{{banner_list}}"></component-banner>
<!-- 导航 -->
<component-icon-nav prop-data="{{navigation}}"></component-icon-nav>
<!-- 楼层数据 -->
<block wx:if="{{data_list.length > 0}}">
<view wx:for="{{data_list}}" wx:for-item="floor" class="floor spacing-mb">
<view wx:for="{{data_list}}" wx:key="key" wx:for-item="floor" class="floor spacing-mb">
<view class="spacing-nav-title">
<text class="line"></text>
<text class="text-wrapper">{{floor.name}}</text>
......@@ -43,7 +32,7 @@
</view>
</navigator>
<view class="goods-list" wx:if="{{floor.goods.length > 0}}">
<view wx:for="{{floor.goods}}" wx:for-item="goods" class="goods bg-white">
<view wx:for="{{floor.goods}}" wx:key="keys" wx:for-item="goods" class="goods bg-white">
<navigator url="/pages/goods-detail/goods-detail?goods_id={{goods.id}}" hover-class="none">
<image src="{{goods.home_recommended_images}}" mode="aspectFit" />
<view class="goods-base">
......
......@@ -26,13 +26,6 @@
line-height: 70rpx;
}
/**
* 轮播
*/
.banner {
height: 320rpx!important;
}
/**
* 楼层数据
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册