Commit 1aa33f27 authored by 谢卓城's avatar 谢卓城

完善:1.添加gulp工作流. 2.样式全部采用sass. 3.网络请求封装

parent 9d822793
No preview for this file type
module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true,
},
plugins: [
"prettier"
],
extends: [
"prettier",
"prettier/standard"
],
parser: "babel-eslint",
parserOptions: {
ecmaVersion: 6,
sourceType: "module"
},
rules: {
"prettier/prettier":"error",
"no-console": 0,
},
globals: {
getApp: false,
Page: false,
wx: false,
App: false,
getCurrentPages: false,
Component: false
}
}
\ No newline at end of file
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
dist
# macOS
.vscode
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
dist
# Node.js
node_modules/
/**app.wxss**/
.container {
padding: 0;
margin: 0;
box-sizing: border-box;
}
Component({
properties: {
showDelect:Boolean,
flexList:Array,
title: String // 简化的定义方式
},
data: {
},
  methods: {
    // 这里是一个自定义方法
   tagAction(e) {
var eventOption = { content: e.currentTarget.dataset.text} // 触发事件的选项
this.triggerEvent('tagClick', eventOption)
    },
delectAction() {
this.triggerEvent('delectClick')
}
  }
})
\ No newline at end of file
/* Common/TagView/index.wxss */
.tag-container {
padding-left: 40rpx;
}
.tag-view {
padding: 10rpx 0;
display: flex;
justify-content: space-between;
align-content: center;
width: 100%;
border-bottom: 2rpx solid rgba(240, 241, 242, 1);
}
.tag-view text {
color: rgb(193, 193, 193);
}
.tag-view image {
width: 40rpx;
height: 44rpx;
margin-right: 40rpx;
}
.flex-container {
padding-right: 40rpx;
}
.flex-view {
display: inline-block;
margin: 20rpx 20rpx 0 0;
padding: 5rpx 10rpx;
color: rgb(176, 185, 194);
border: 2rpx solid rgb(240, 241, 242);
}
.flex-view .flex-container {
background-color: rebeccapurple;
padding-right: 40rpx;
}
\ No newline at end of file
This diff is collapsed.
/*
此文件为开发者工具生成,生成时间: 2020/12/4 下午4:29:30
在 /Users/purewin/Documents/Company/ChengjingPremiumMember/CJPremiumMember/pages/Cart/index.wxss 中引入样式
```
@import "./index.skeleton.wxss";
```
更多详细信息可以参考文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/skeleton.html
*/
.sk-transparent {
color: transparent !important;
}
.sk-text-14-5833-165 {
background-image: linear-gradient(transparent 14.5833%, #EEEEEE 0%, #EEEEEE 85.4167%, transparent 0%) !important;
background-size: 100% 36.7058rpx;
position: relative !important;
}
.sk-text {
background-origin: content-box !important;
background-clip: content-box !important;
background-color: transparent !important;
color: transparent !important;
background-repeat: repeat-y !important;
}
.sk-text-14-5834-4 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-14-5834-683 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-25-0000-944 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-25-0000-667 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-14-5833-599 {
background-image: linear-gradient(transparent 14.5833%, #EEEEEE 0%, #EEEEEE 85.4167%, transparent 0%) !important;
background-size: 100% 36.7058rpx;
position: relative !important;
}
.sk-text-14-5834-923 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-14-5834-562 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-25-0000-370 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-25-0000-495 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-14-5833-586 {
background-image: linear-gradient(transparent 14.5833%, #EEEEEE 0%, #EEEEEE 85.4167%, transparent 0%) !important;
background-size: 100% 36.7058rpx;
position: relative !important;
}
.sk-text-14-5834-265 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-14-5834-575 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-25-0000-200 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-25-0000-780 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-14-5833-395 {
background-image: linear-gradient(transparent 14.5833%, #EEEEEE 0%, #EEEEEE 85.4167%, transparent 0%) !important;
background-size: 100% 36.7058rpx;
position: relative !important;
}
.sk-text-14-5834-864 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-14-5834-68 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-25-0000-406 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-25-0000-969 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-14-5833-511 {
background-image: linear-gradient(transparent 14.5833%, #EEEEEE 0%, #EEEEEE 85.4167%, transparent 0%) !important;
background-size: 100% 36.7058rpx;
position: relative !important;
}
.sk-text-14-5834-425 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-14-5834-813 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-25-0000-832 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-25-0000-471 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-14-5833-397 {
background-image: linear-gradient(transparent 14.5833%, #EEEEEE 0%, #EEEEEE 85.4167%, transparent 0%) !important;
background-size: 100% 36.7058rpx;
position: relative !important;
}
.sk-text-14-5834-432 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-14-5834-800 {
background-image: linear-gradient(transparent 14.5834%, #EEEEEE 0%, #EEEEEE 85.4166%, transparent 0%) !important;
background-size: 100% 33.8824rpx;
position: relative !important;
}
.sk-text-25-0000-196 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-25-0000-366 {
background-image: linear-gradient(transparent 25.0000%, #EEEEEE 0%, #EEEEEE 75.0000%, transparent 0%) !important;
background-size: 100% 48.0000rpx;
position: relative !important;
}
.sk-text-18-7500-125 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 51.2000rpx;
position: relative !important;
}
.sk-text-36-0000-811 {
background-image: linear-gradient(transparent 36.0000%, #EEEEEE 0%, #EEEEEE 64.0000%, transparent 0%) !important;
background-size: 100% 100.0000rpx;
position: relative !important;
}
.sk-text-34-0000-438 {
background-image: linear-gradient(transparent 34.0000%, #EEEEEE 0%, #EEEEEE 66.0000%, transparent 0%) !important;
background-size: 100% 100.0000rpx;
position: relative !important;
}
.sk-image {
background: #EFEFEF !important;
}
.sk-pseudo::before, .sk-pseudo::after {
background: #EFEFEF !important;
background-image: none !important;
color: transparent !important;
border-color: transparent !important;
}
.sk-pseudo-rect::before, .sk-pseudo-rect::after {
border-radius: 0 !important;
}
.sk-pseudo-circle::before, .sk-pseudo-circle::after {
border-radius: 50% !important;
}
.sk-container {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: transparent;
}
/* pages/Cart/index.wxss */
@import "./index.skeleton.wxss";
.container {
/* position: relative; */
}
.cell-view {
/* height: 100rpx; */
}
.table-view {
padding-bottom: 98rpx;
}
.goods-container-view {
display: flex;
justify-content: flex-start;
}
.goods-container-view .goods-content {
margin-left: 20rpx;
}
.goods-container-view .goods-content text {
display: block;
margin-bottom: 10rpx;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: normal !important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.goods-container-view .goods-content .goods-name {
font-size: 26rpx;
color: rgb(33, 33, 33);
}
.goods-container-view .goods-content .goods-spec {
font-size: 24rpx;
color: rgb(153, 153, 153);
}
.goods-container-view .goods-content .goods-price {
font-size: 24rpx;
color: rgb(40, 40, 40);
}
.goods-view {
display: flex;
align-items: center;
}
.goods-select-view {
height: 100%;
}
.goods-select-icon {
width: 36rpx;
height: 36rpx;
}
.goods-icon {
margin-left: 10rpx;
width: 150rpx;
height: 150rpx;
}
.goods-container-view .buy-num {
width: 164rpx;
height: 48rpx;
line-height: 48rpx;
position: absolute;
right: 60rpx;
bottom: 30rpx;
display: flex;
font-size: 24rpx;
text-align: center;
}
.goods-container-view .buy-num .reduce-btn {
width: 48rpx;
height: 100%;
border-left: 1rpx solid #ccc;
border-bottom: 1rpx solid #ccc;
border-top: 1rpx solid #ccc;
border-bottom-left-radius: 6rpx;
border-top-left-radius: 6rpx;
}
.goods-container-view .buy-num .reduce-btn.disabled {
background-color: #f5f5f9;
border-left: 1rpx solid #eee;
border-bottom: 1rpx solid #eee;
border-top: 1rpx solid #eee;
color: #ccc;
}
.goods-container-view .buy-num .add-btn {
width: 48rpx;
height: 100%;
border-right: 1rpx solid #ccc;
border-bottom: 1rpx solid #ccc;
border-top: 1rpx solid #ccc;
border-bottom-right-radius: 6rpx;
border-top-right-radius: 6rpx;
}
.goods-container-view .buy-num .add-btn.disabled {
background-color: #f5f5f9;
border-right: 1rpx solid #eee;
border-bottom: 1rpx solid #eee;
border-top: 1rpx solid #eee;
color: #ccc;
}
.goods-container-view .buy-num input {
width: 68rpx;
height: 48rpx;
min-height: 48rpx;
text-align: center;
font-size: 24rpx;
border: 1rpx solid #ccc;
}
.shopping-cart-counter-view {
display: flex;
justify-content: space-between;
width: 100%;
height: 100rpx;
position: fixed;
bottom: 0;
left: 0;
border-bottom: 2rpx solid #eee;
border-top: 2rpx solid #eee;
background-color: #fff;
z-index: 999;
}
.shopping-cart-counter-view .all-select-view {
display: flex;
align-items: center;
margin-left: 30rpx;
height: 100%;
}
.shopping-cart-counter-view .all-select-view .select-button {
margin-right: 10rpx;
width: 36rpx;
height: 36rpx;
}
.shopping-cart-counter-view .all-select-view text {
margin-right: 10rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.shopping-cart-counter-view .price-view {
display: flex;
width: 510rpx;
justify-content: flex-end;
line-height: 100rpx;
font-size: 28rpx;
box-sizing: border-box;
}
.shopping-cart-counter-view .total {
color: #e64340;
padding-right: 30rpx;
}
.shopping-cart-counter-view .to-pay-btn {
width: 240rpx;
text-align: center;
line-height: 100rpx;
background-color: #e64340;
font-size: 32rpx;
color: #fff;
margin-top: 2rpx;
}
\ No newline at end of file
// pages/Home/index.js
// const windowHeight = wx.getSystemInfoSync().windowHeight
// const windowWidth = wx.getSystemInfoSync().windowWidth
// const colorLight = 'rgba(0, 0, 0, .9)'
// const colorDark = 'rgba(255, 255, 255, .8)'
Page({
/**
* 页面的初始数据
*/
data: {
i: 0,
loading:true,
imageUrl:'../../image/640.jpeg',
imageIcon:'../../image/group_portrait.png',
bannerList:['../../image/640.jpeg','../../image/640.jpeg'],
classifications:["居家","鞋包配饰","服装", "电器","婴童","饮食", "特色区","洗护","餐厨","文体"],
activityList:[{
icon: '../../image/640.jpeg',
text: "新品热销榜",
subText: "热销爆款不容错过",
id: 1
},{
icon: '../../image/640.jpeg',
text: "新品热销榜",
subText: "热销爆款不容错过",
id: 2
},{
icon: '../../image/640.jpeg',
text: "新品热销榜",
subText: "热销爆款不容错过",
id: 3
},{
icon: '../../image/640.jpeg',
text: "新品热销榜",
subText: "热销爆款不容错过",
id: 4
},],
iconList:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// this.setData({
// search: this.search.bind(this)
// })
setTimeout(() => {
this.setData({
loading:false
})
this.loadNewData()
}, 2000)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
loadNewData: function() {
this.data.iconList = []
this.loadMoreData()
},
loadMoreData: function() {
let list = this.data.iconList;
for (let index = 0; index < 20; index++) {
list.push({
icon: (index % 2)?'../../image/plus_dark.png':'../../image/640.jpeg',
text: "琴岛智能除螨电热毯 安全定时 智能控温" + index,
price: (171 + index)
})
}
this.setData({
iconList: list,
});
},
/**
* 用户搜索
*/
selectAction: function (e) {
wx.navigateTo({
url: '../Search/index',
})
},
cellAction:function (e) {
this.showToastText('点击了'+e.currentTarget.dataset['index'])
console.log('cellAction result', e.currentTarget.dataset['index'])
},
classificationAction: function(e) {
this.showToastText('点击了'+e.currentTarget.dataset['index'])
console.log('classificationAction result', e.currentTarget.dataset['index'])
},
onPullDownRefresh: function(e) {
this.loadNewData()
console.log('onPullDownRefresh result', this.data.iconList)
},
onReachBottom: function(e) {
this.loadMoreData()
console.log('onReachBottom result',this.data.iconList)
},
showToastText: function(text) {
wx.showToast({
title: text,
icon: 'success',
duration: 2000
})
}
})
\ No newline at end of file
<!--
此文件为开发者工具生成,生成时间: 2020/12/4 下午4:30:00
使用方法:
在 /Users/purewin/Documents/Company/ChengjingPremiumMember/CJPremiumMember/pages/Home/index.wxml 引入模板
```
<import src="index.skeleton.wxml"/>
<template is="skeleton" wx-if="{{loading}}" />
```
在 /Users/purewin/Documents/Company/ChengjingPremiumMember/CJPremiumMember/pages/Home/index.wxss 中引入样式
```
@import "./index.skeleton.wxss";
```
更多详细信息可以参考文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/skeleton.html
-->
<template name="skeleton">
<view class="sk-container">
<view class="container">
<view class="search-container">
<view class="search-view">
<view class="search-v">
<image class="search-icon sk-image"></image>
<text class="search-text sk-transparent sk-text-18-7500-200 sk-text"> 搜索商品,发现好物</text>
</view>
</view>
</view>
<view class="swiper-view">
<swiper autoplay="false" class="swiper" duration="1000" indicator-dots="true" interval="5000" current="0">
<swiper-item style="position: absolute; width: 100%; height: 100%; transform: translate(0%, 0px) translateZ(0px);">
<image class="slide-image sk-image" mode="aspectFill"></image>
</swiper-item>
</swiper>
</view>
<view class="classification-view">
<view class="classification-container" hover-class="none" hover-stop-propagation="true">
<view class="itme-view" data-index="居家" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-711 sk-text" style="background-position-x: 50%;">居家</text>
</view>
<view class="itme-view" data-index="鞋包配饰" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-151 sk-text" style="background-position-x: 50%;">鞋包配饰</text>
</view>
<view class="itme-view" data-index="服装" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-858 sk-text" style="background-position-x: 50%;">服装</text>
</view>
<view class="itme-view" data-index="电器" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-198 sk-text" style="background-position-x: 50%;">电器</text>
</view>
<view class="itme-view" data-index="婴童" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-195 sk-text" style="background-position-x: 50%;">婴童</text>
</view>
<view class="itme-view" data-index="饮食" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-715 sk-text" style="background-position-x: 50%;">饮食</text>
</view>
<view class="itme-view" data-index="特色区" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-945 sk-text" style="background-position-x: 50%;">特色区</text>
</view>
<view class="itme-view" data-index="洗护" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-614 sk-text" style="background-position-x: 50%;">洗护</text>
</view>
<view class="itme-view" data-index="餐厨" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-737 sk-text" style="background-position-x: 50%;">餐厨</text>
</view>
<view class="itme-view" data-index="文体" hover-class="none" hover-stop-propagation="true">
<image class="itme-icon sk-image" mode="aspectFill"></image>
<text class="itme-text sk-transparent sk-text-18-7500-998 sk-text" style="background-position-x: 50%;">文体</text>
</view>
</view>
</view>
<view class="recommend-view">
<image class="recommend-image sk-image" mode="aspectFill"></image>
</view>
<view class="activity-view">
<view class="activity-container">
<image class="activity-image sk-image" mode="aspectFill"></image>
<text class="activity-text sk-transparent sk-text-18-7500-465 sk-text" decode="true" user-select="true">新品热销榜</text>
<text class="activity-text sk-transparent sk-text-18-7500-615 sk-text" decode="true" user-select="true" space="false">热销爆款不容错过</text>
</view>
<view class="activity-container">
<image class="activity-image sk-image" mode="aspectFill"></image>
<text class="activity-text sk-transparent sk-text-18-7500-120 sk-text" decode="true" user-select="true">新品热销榜</text>
<text class="activity-text sk-transparent sk-text-18-7500-437 sk-text" decode="true" user-select="true" space="false">热销爆款不容错过</text>
</view>
</view>
</view>
</view>
</template>
\ No newline at end of file
/*
此文件为开发者工具生成,生成时间: 2020/12/4 下午4:30:00
在 /Users/purewin/Documents/Company/ChengjingPremiumMember/CJPremiumMember/pages/Home/index.wxss 中引入样式
```
@import "./index.skeleton.wxss";
```
更多详细信息可以参考文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/skeleton.html
*/
.sk-transparent {
color: transparent !important;
}
.sk-text-18-7500-200 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 38.4000rpx;
position: relative !important;
}
.sk-text {
background-origin: content-box !important;
background-clip: content-box !important;
background-color: transparent !important;
color: transparent !important;
background-repeat: repeat-y !important;
}
.sk-text-18-7500-711 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-151 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-858 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-198 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-195 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-715 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-945 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-614 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-737 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-998 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 41.6000rpx;
position: relative !important;
}
.sk-text-18-7500-465 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 51.2000rpx;
position: relative !important;
}
.sk-text-18-7500-615 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 51.2000rpx;
position: relative !important;
}
.sk-text-18-7500-120 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 51.2000rpx;
position: relative !important;
}
.sk-text-18-7500-437 {
background-image: linear-gradient(transparent 18.7500%, #EEEEEE 0%, #EEEEEE 81.2500%, transparent 0%) !important;
background-size: 100% 51.2000rpx;
position: relative !important;
}
.sk-image {
background: #EFEFEF !important;
}
.sk-container {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: transparent;
}
/* pages/Home/index.wxss */
@import "./index.skeleton.wxss";
.swiper-view {
width: 100%;
height: 340rpx;
}
.swiper {
height: 100%;
}
.slide-image {
width: 100%;
}
.search-container {
width: 100%;
height: 88rpx;
display:flex ;
align-items:center;
justify-content:center ;
/* background-color: rebeccapurple; */
background-color: rgba(240, 241, 242, 0.5);
}
.search-view {
border-radius: 50rpx;
width: calc(100% - 80rpx);
height: 60rpx;
background-color: rgb(243, 243, 243);
}
.search-v {
display:flex ;
align-items:center;
justify-content:center;
margin-top: 10rpx;
}
.search-icon {
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
}
.search-text {
font-size: 24rpx;
color: rgb(193, 193, 193);
}
.swiper-view {
height: 340rpx;
background-color: royalblue;
}
.classification-view {
height: 462rpx;
position: relative;
/* background-color: lawngreen; */
}
.classification-container {
position: absolute;
display: flex;
flex-wrap: wrap;
justify-content: center;
width: calc( 100% - 80rpx);
height: calc( 100% - 80rpx);
left: 40rpx;
top: 60rpx;
}
.itme-view {
margin-right: 15rpx;
margin-left: 15rpx;
width: calc( (100% - 200rpx) / 5);
height: calc( (100% - 58rpx) / 2);
text-align: center;
color: rgb(102, 102,102);
}
.itme-icon {
width: 90rpx;
height: 90rpx;
}
.itme-text {
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 26rpx;
}
.recommend-view {
height: 208rpx;
}
.recommend-image {
width: calc(100% - 30rpx);
height: 100%;
margin-left: 15rpx;
}
.activity-view {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-content:space-between;
height: 550rpx;
margin-top: 54rpx;
width: 100%;
}
.activity-container {
width: calc( (100% - 30rpx ) / 2);
height: calc( (100% - 10rpx ) / 2);
background-color: rosybrown;
position: relative;
}
.activity-image {
width: 100%;
height: 100%;
position: absolute;
}
.activity-text {
position: relative;
display: block;
margin-left: 30rpx;
color: rebeccapurple;
}
.title-view {
margin-top: 84rpx;
border-top: solid;
border-color: rgba(197, 197, 197, 0.2);
}
.title {
margin-left: 38rpx;
margin-top: 30rpx;
}
.list-grids {
width: 100%;
margin-top: 32rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
background-color: rgba(197, 197, 197, 0.2);
}
.cell-container {
margin-top: 4rpx;
background-color:white;
width: calc( (100% - 12rpx) / 2 );
height: 508rpx;
}
.icon-view {
margin-top: 30rpx;
margin-left: 30rpx;
background-color: seagreen;
width: calc( 100% - 60rpx);
height: calc((100vw - 120rpx - 12rpx) / 2);
}
.icon-view-text{
margin-left: 30rpx;
width: calc( 100% - 60rpx);
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: normal !important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.price-text {
margin-left: 30rpx;
color: lightgray;
}
\ No newline at end of file
// pages/Order/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
/* pages/Order/index.wxss */
.search-container {
width: 100vw;
height: 100vh;
}
.search-container {
text-align: center;
}
\ No newline at end of file
// pages/Search/index.js
Page({
/**
* 页面的初始数据
*/
data: {
searchText:'',
isSearch:false,
goodsList:[{"icon":"../../image/group_portrait.png","title":"休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服","type":"精选","originalPrice":34,"price":45},
{"icon":"../../image/group_portrait.png","title":"休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服","type":"精选","originalPrice":45,"price":45},{"icon":"../../image/group_portrait.png","title":"休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服","type":"精选","originalPrice":34,"price":45}],
historys:['手机','电','电脑','电视','哗哗哈哈','昌','双双','是','要','有','大厦'],
hotList:['手fffff','电sss','电ccc脑','电f视','哗哗ffff哈哈','昌','双双','是','要','有','大厦']
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
bindinput(e) {
console.log(this.data.searchText)
this.setData({
searchText:e.detail.value,
isSearch:false
})
},
bindconfirm(e) {
this.setData({
searchText:e.detail.value
})
},
searchAction() {
if (this.data.searchText.length == 0) {
return
}
let goodsList = [{"icon":"../../image/group_portrait.png","title":"休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服"+this.data.searchText,"type":"精选","originalPrice":45,"price":45},
{"icon":"../../image/group_portrait.png","title":"休闲中长厚款90分户外休闲"+this.data.searchText,"type":"精选","originalPrice":45,"price":333},{"icon":"../../image/group_portrait.png","title":"休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服"+this.data.searchText,"type":"精选","originalPrice":45,"price":45},{"icon":"../../image/group_portrait.png","title":"休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服"+this.data.searchText,"type":"精选","originalPrice":45,"price":45}]
var list = this.data.historys
if (this.data.searchText.length > 0) {
list.push(this.data.searchText)
}
this.setData({
isSearch:true,
goodsList:goodsList,
historys:list
})
console.log(this.data.searchText)
},
tagAction(e) {
console.log(e.detail.content)
},
delectAction(e) {
this.setData({
historys:[]
})
}
})
\ No newline at end of file
/* pages/Search/index.wxss */
.search-container {
padding: 32rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
}
.search-container .search {
position: relative;
width: calc( 100% - 150rpx);
height: 66rpx;
}
.search-container .search input {
width: 100%;
height: 100%;
border-radius: 30rpx;
padding-left:60rpx;
background-color: rgba(240, 241, 242, 0.5);
}
.search-container .search image {
width: 30rpx;
height: 30rpx;
position: absolute;
top: 19rpx;
left: 19rpx;
z-index: 9999;
}
.search-container .show-type.disabled{
color: rgb(193, 193, 193);
}
.search-container .show-type{
color: rgb(1, 1, 1);
}
.tag-view {
margin-top: 50rpx;
}
.goodsList-view {
display: flex;
flex-wrap: wrap;
}
.goods-view {
width: calc( 100% / 2);
/* height: calc( 100vw / 2 + ); */
}
.goods-icon {
width: calc( 100% - 60rpx);
height: calc( (100vw - 120rpx) / 2);
margin-left: 30rpx;
}
.goods-text-view {
width: calc (100% -60rpx);
margin-left: 30rpx;
}
.goods-text-view .goods-type {
padding: 5rpx;
color: red;
border: 2rpx solid red;
margin-right: 10rpx;
}
.goods-price-view {
margin-left: 30rpx;
margin-bottom: 55rpx;
}
.goods-price-view .goods-original-price {
text-decoration: line-through;
text-decoration-color: rgb(193, 193, 193);
color: rgb(193, 193, 193);
}
\ No newline at end of file
// pages/index/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
<!--pages/index/index.wxml-->
<text>pages/index/index.wxml</text>
/* pages/index/index.wxss */
\ No newline at end of file
// pages/logs/logs.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--pages/logs/logs.wxml-->
<text>pages/logs/logs.wxml</text>
/* pages/logs/logs.wxss */
\ No newline at end of file
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime
}
const gulp = require("gulp");
const sass = require("gulp-sass");
const rename = require("gulp-rename");
const imagemin = require("gulp-imagemin");
const del = require("del");
const replace = require("gulp-replace");
const postcss = require("gulp-postcss");
const autoprefixer = require("autoprefixer");
const plumber = require("gulp-plumber");
const tap = require("gulp-tap");
const path = require("path");
const notify = require("gulp-notify");
const yargs = require("yargs");
const srcPath = "./src/**";
const distPath = "./dist/";
//存放variable和mixin的sass文件在被引用时直接导入,不引入dist目录中
const DIRECTIMPORT = ["/scss/", "/font/"];
const onError = function(err) {
notify.onError({
title: "Gulp",
subtitle: "Failure!",
message: "Error: <%= error.message %>",
sound: "Beep"
})(err);
this.emit("end");
};
const wxmlFiles = [`${srcPath}/*.wxml`];
const sassFiles = [`${srcPath}/*.{scss, wxss}`];
const jsFiles = [`${srcPath}/*.js`, `!${srcPath}/env/*.js`];
const jsonFiles = [`${srcPath}/*.json`];
const imageFiles = [
`${srcPath}/images/*.{png,jpeg,jpg,gif,ico}`,
`${srcPath}/images/**/*.{png,jpeg,jpg,gif,ico}`
];
/* 清除dist目录 */
gulp.task("clean", done => {
del.sync(["dist/**"]);
done();
});
const wxml = () => {
return gulp
.src(wxmlFiles, { since: gulp.lastRun(wxml) })
.pipe(gulp.dest(distPath));
};
gulp.task(wxml);
const js = () => {
return gulp
.src(jsFiles, { since: gulp.lastRun(js) })
.pipe(gulp.dest(distPath));
};
gulp.task(js);
const envJs = env => {
return () => {
return gulp
.src(`./src/env/${env}.js`)
.pipe(rename("env.js"))
.pipe(gulp.dest(distPath));
};
};
gulp.task(envJs);
gulp.task("devEnv", envJs("dev"));
gulp.task("testEnv", envJs("tes"));
gulp.task("prodEnv", envJs("prod"));
const json = () => {
return gulp
.src(jsonFiles, { since: gulp.lastRun(json) })
.pipe(gulp.dest(distPath));
};
gulp.task(json);
const wxss = () => {
return gulp
.src([...sassFiles, ...DIRECTIMPORT.map(item => `!${srcPath}/${item}/*`)], {
since: gulp.lastRun(wxss)
})
.pipe(plumber({ errorHandler: onError }))
.pipe(
tap(file => {
const filePath = path.dirname(file.path);
//console.log("filepath", filePath);
file.contents = Buffer.from(
String(file.contents).replace(
/@import\s+['|"](.+)['|"];/g,
($1, $2) => {
// console.log("$1", $1);
// console.log("$2", $2);
return DIRECTIMPORT.some(item => {
return $2.indexOf(item) > -1;
})
? $1
: `/** ${$1} **/`;
}
)
);
})
)
.pipe(sass())
.pipe(postcss([autoprefixer(["iOS >= 8", "Android >= 4.1"])]))
.pipe(
replace(/(\/\*\*\s{0,})(@.+)(\s{0,}\*\*\/)/g, ($1, $2, $3) => {
//console.log("$1", $1);
//console.log("$2", $2);
//console.log("$3", $3);
return $3.replace(/\.scss/g, ".wxss");
})
)
.pipe(rename({ extname: ".wxss" }))
.pipe(gulp.dest(distPath));
};
gulp.task(wxss);
const img = () => {
return gulp
.src(imageFiles, { since: gulp.lastRun(img) })
.pipe(imagemin())
.pipe(gulp.dest(distPath));
};
gulp.task(img);
const newfile = done => {
yargs
.example("gulp new -p mypage", "创建mypage的page目录")
.example("gulp new -c mycomponent", "创建mycomponent的component目录")
.example(
"gulp new -s srcfile -p mypage",
"以srcfile为模版创建mypage的page目录"
)
.option({
s: {
alias: "src",
describe: "模板",
type: "string",
default: "template"
},
p: {
alias: "page",
describe: "page名称",
type: "string"
},
c: {
alias: "component",
describe: "component名称",
type: "string"
},
t: {
alias: "template",
describe: "template名称",
type: "string"
}
})
.fail(msg => {
done();
console.error("创建失败");
console.log(msg);
console.log("help");
yargs.parse(["--msg"]);
})
.help("msg");
const args = yargs.argv;
const source = args.s;
const filePaths = {
p: "pages",
c: "components"
};
let name,
type,
hasParam = false;
for (let key in filePaths) {
if (args[key]) {
hasParam = true;
name = args[key];
type = filePaths[key];
}
}
if (!hasParam) {
done();
yargs.parse(["--msg"]);
}
const defaultPath =
source === "template"
? `src/${source}/${type}/*`
: `src/${type}/${source}/*`;
return gulp.src(defaultPath).pipe(gulp.dest(`src/${type}/${name}/`));
};
gulp.task("new", newfile);
gulp.task("watch", done => {
const watchSassFiles = [
...sassFiles,
...DIRECTIMPORT.map(item => `!${srcPath}/${item}/**/*`)
];
gulp.watch(watchSassFiles, wxss);
gulp.watch(jsFiles, js);
gulp.watch(jsonFiles, json);
gulp.watch(imageFiles, img);
gulp.watch(wxmlFiles, wxml);
done();
});
gulp.task(
"build",
gulp.series(
"clean",
gulp.parallel("wxml", "js", "json", "wxss", "img", "prodEnv")
)
);
gulp.task(
"dev",
gulp.series(
"clean",
gulp.parallel("wxml", "js", "json", "wxss", "img", "devEnv"),
"watch"
)
);
gulp.task(
"test",
gulp.series(
"clean",
gulp.parallel("wxml", "js", "json", "wxss", "img", "testEnv")
)
);
This diff is collapsed.
{
"name": "chengjingpremiummember",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@git.changein.cn:xzc168520/ChengjingPremiumMember.git"
},
"author": "nemo",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.2",
"gulp-clean": "^0.4.0",
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.0.0",
"gulp-sass": "^4.1.0",
"gulp-tap": "^2.0.0"
},
"dependencies": {
"autoprefixer": "^9.7.3",
"babel-eslint": "^8.2.1",
"del": "^5.1.0",
"eslint": "^4.18.2",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-prettier": "^2.3.1",
"fs": "0.0.1-security",
"gulp": "^4.0.2",
"gulp-imagemin": "^6.2.0",
"gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.1",
"gulp-postcss": "^8.0.0",
"gulp-rename": "^1.4.0",
"gulp-replace": "^1.0.0",
"gulp-sass": "^4.0.2",
"gulp-tap": "^2.0.0",
"path": "^0.12.7",
"prettier": "^1.8.2",
"yargs": "^15.3.1"
}
}
//app.js //app.js
App({ App({
onLaunch: function () { onLaunch: function() {
// 展示本地存储能力 // 展示本地存储能力
var logs = wx.getStorageSync('logs') || [] var logs = wx.getStorageSync("logs") || [];
logs.unshift(Date.now()) logs.unshift(Date.now());
wx.setStorageSync('logs', logs) wx.setStorageSync("logs", logs);
// 登录 // 登录
wx.login({ wx.login({
success: res => { success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId // 发送 res.code 到后台换取 openId, sessionKey, unionId
} }
}) });
// 获取用户信息 // 获取用户信息
wx.getSetting({ wx.getSetting({
success: res => { success: res => {
if (res.authSetting['scope.userInfo']) { if (res.authSetting["scope.userInfo"]) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({ wx.getUserInfo({
success: res => { success: res => {
// 可以将 res 发送给后台解码出 unionId // 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo this.globalData.userInfo = res.userInfo;
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况 // 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) { if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res) this.userInfoReadyCallback(res);
} }
} }
}) });
} }
} }
}) });
}, },
globalData: { globalData: {
userInfo: null userInfo: null
} }
}) });
\ No newline at end of file
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
"pages/Home/index", "pages/Home/index",
"pages/Cart/index", "pages/Cart/index",
"pages/Search/index", "pages/Search/index",
"pages/Order/index", "pages/Order/index"
"pages/index/index",
"pages/logs/logs"
], ],
"entryPagePath": "pages/Home/index", "entryPagePath": "pages/Home/index",
"tabBar": { "tabBar": {
......
/**app.wxss**/ @import './scss/variables.scss';
.container { @import './styles/common.scss';
.container{
width: 100%;
height: 100%; height: 100%;
padding: 0; padding: 0;
box-sizing: border-box; box-sizing: border-box;
......
Component({
properties: {
showDelect: Boolean,
flexList: Array,
title: String // 简化的定义方式
},
externalClasses: ["super-class"],
data: {},
methods: {
// 这里是一个自定义方法
tagAction(e) {
var eventOption = { content: e.currentTarget.dataset.text }; // 触发事件的选项
this.triggerEvent("tagClick", eventOption);
},
delectAction() {
this.triggerEvent("delectClick");
}
}
});
.tag-container {
padding-left: 40rpx;
.tag-view {
padding: 10rpx 0;
border-bottom: 2rpx solid rgba(240, 241, 242, 1);
text {
color: rgb(193, 193, 193);
}
image {
width: 40rpx;
height: 44rpx;
margin-right: 40rpx;
}
}
.flex-container {
padding-right: 40rpx;
.flex-view {
display: inline-block;
margin: 20rpx 20rpx 0 0;
padding: 5rpx 10rpx;
color: rgb(176, 185, 194);
border: 2rpx solid rgb(240, 241, 242);
.flex-container {
background-color: rebeccapurple;
padding-right: 40rpx;
}
}
}
}
<!--Common/TagView/index.wxml--> <!--Common/TagView/index.wxml-->
<view class="tag-container" hover-class="none" hover-stop-propagation="false" wx:if="{{flexList.length > 0}}"> <view class="tag-container" hover-class="none" hover-stop-propagation="false" wx:if="{{flexList.length > 0}}">
<view class="tag-view"> <view class="tag-view super-class">
<text selectable="false" space="false" decode="false">{{title}}</text> <text selectable="false" space="false" decode="false">{{title}}</text>
<image src="../../image/delete.png" lazy-load="false" wx:if="{{showDelect}}" bind:tap="delectAction"/> <image src="../../images/delete.png" lazy-load="false" wx:if="{{showDelect}}" bind:tap="delectAction"/>
</view> </view>
<view class="flex-container"> <view class="flex-container">
<scroll-view scroll-y="true" style="height: 250rpx; width:100%;"> <scroll-view scroll-y="true" style="height: 250rpx; width:100%;">
......
/*
* @Descripttion: 开发环境
*/
const API_URL = {
host: "http://xxdev.xxx.com",
r: "https://xxr.xxx.com"
};
module.exports = API_URL;
/*
* @Descripttion: 生产环境
*/
const API_URL = {
host: "http://xxprod.xxx.com",
r: "https://xxr.xxx.com"
};
module.exports = API_URL;
/*
* @Descripttion: 测试环境
*/
const API_URL = {
host: "http://xxtest.xxx.com",
r: "https://xxr.xxx.com"
};
module.exports = API_URL;
.container {
.table-view {
padding-bottom: 98rpx;
.goods-container-view {
display: flex;
justify-content: flex-start;
.goods-content {
margin-left: 20rpx;
text {
display: block;
margin-bottom: 10rpx;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: normal !important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.goods-name {
font-size: 26rpx;
color: rgb(33, 33, 33);
}
.goods-spec {
font-size: 24rpx;
color: rgb(153, 153, 153);
}
.goods-price {
font-size: 24rpx;
color: rgb(40, 40, 40);
}
}
.buy-num {
width: 164rpx;
height: 48rpx;
line-height: 48rpx;
position: absolute;
right: 60rpx;
bottom: 30rpx;
display: flex;
font-size: 24rpx;
text-align: center;
.reduce-btn {
width: 48rpx;
height: 100%;
border-left: 1rpx solid #ccc;
border-bottom: 1rpx solid #ccc;
border-top: 1rpx solid #ccc;
border-bottom-left-radius: 6rpx;
border-top-left-radius: 6rpx;
}
.reduce-btn.disabled {
background-color: #f5f5f9;
border-left: 1rpx solid #eee;
border-bottom: 1rpx solid #eee;
border-top: 1rpx solid #eee;
color: #ccc;
}
.add-btn {
width: 48rpx;
height: 100%;
border-right: 1rpx solid #ccc;
border-bottom: 1rpx solid #ccc;
border-top: 1rpx solid #ccc;
border-bottom-right-radius: 6rpx;
border-top-right-radius: 6rpx;
}
.add-btn.disabled {
background-color: #f5f5f9;
border-right: 1rpx solid #eee;
border-bottom: 1rpx solid #eee;
border-top: 1rpx solid #eee;
color: #ccc;
}
input {
width: 68rpx;
height: 48rpx;
min-height: 48rpx;
text-align: center;
font-size: 24rpx;
border: 1rpx solid #ccc;
}
}
}
}
.goods-view {
display: flex;
align-items: center;
.goods-select-icon {
width: 36rpx;
height: 36rpx;
}
.goods-icon {
margin-left: 10rpx;
width: 150rpx;
height: 150rpx;
}
}
.shopping-cart-counter-view {
display: flex;
justify-content: space-between;
width: 100%;
height: 100rpx;
position: fixed;
bottom: 0;
left: 0;
border-bottom: 2rpx solid #eee;
border-top: 2rpx solid #eee;
background-color: #fff;
z-index: 999;
.all-select-view {
display: flex;
align-items: center;
margin-left: 30rpx;
height: 100%;
.select-button {
margin-right: 10rpx;
width: 36rpx;
height: 36rpx;
}
text {
margin-right: 10rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.price-view {
display: flex;
width: 510rpx;
justify-content: flex-end;
line-height: 100rpx;
font-size: 28rpx;
box-sizing: border-box;
}
.total {
color: #e64340;
padding-right: 30rpx;
}
.to-pay-btn {
width: 240rpx;
text-align: center;
line-height: 100rpx;
background-color: #e64340;
font-size: 32rpx;
color: #fff;
margin-top: 2rpx;
}
}
}
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<mp-cell> <mp-cell>
<view class="goods-container-view"> <view class="goods-container-view">
<view class="goods-view" bindtap="selectGoodsAction" data-index="{{index}}"> <view class="goods-view" bindtap="selectGoodsAction" data-index="{{index}}">
<image class="goods-select-icon" src="{{goods.isSelect?'../../image/check_t.png ':'../../image/check_f.png'}}" lazy-load="false"/> <image class="goods-select-icon" src="{{goods.isSelect?'../../images/check_t.png ':'../../images/check_f.png'}}" lazy-load="false"/>
<image class="goods-icon" src="{{goods.goodsUrl}}" mode="aspectFill" lazy-load="false"/> <image class="goods-icon" src="{{goods.goodsUrl}}" mode="aspectFill" lazy-load="false"/>
</view> </view>
<view class="goods-content" hover-class="none" hover-stop-propagation="false"> <view class="goods-content" hover-class="none" hover-stop-propagation="false">
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</mp-cells> </mp-cells>
<view class="shopping-cart-counter-view" hover-class="none" hover-stop-propagation="false"> <view class="shopping-cart-counter-view" hover-class="none" hover-stop-propagation="false">
<view class="all-select-view" hover-class="none" hover-stop-propagation="false" bindtap="allSelectAction"> <view class="all-select-view" hover-class="none" hover-stop-propagation="false" bindtap="allSelectAction">
<image class="select-button" src="{{isSelectAll?'../../image/check_t.png ':'../../image/check_f.png'}}" /> <image class="select-button" src="{{isSelectAll?'../../images/check_t.png ':'../../images/check_f.png'}}" />
<text user-select="false" space="false" decode="false">已选择</text> <text user-select="false" space="false" decode="false">已选择</text>
</view> </view>
<view class="price-view"> <view class="price-view">
...@@ -37,6 +37,3 @@ ...@@ -37,6 +37,3 @@
</view> </view>
</view> </view>
</view> </view>
<import src="index.skeleton.wxml"/>
<template is="skeleton" wx-if="{{loading}}" />
\ No newline at end of file
Page({
/**
* 页面的初始数据
*/
data: {
i: 0,
loading: true,
imageUrl: "../../images/640.jpeg",
imageIcon: "../../images/group_portrait.png",
bannerList: ["../../images/640.jpeg", "../../images/640.jpeg"],
classifications: [
"居家",
"鞋包配饰",
"服装",
"电器",
"婴童",
"饮食",
"特色区",
"洗护",
"餐厨",
"文体"
],
activityList: [
{
icon: "../../images/640.jpeg",
text: "新品热销榜",
subText: "热销爆款不容错过",
id: 1
},
{
icon: "../../images/640.jpeg",
text: "新品热销榜",
subText: "热销爆款不容错过",
id: 2
},
{
icon: "../../images/640.jpeg",
text: "新品热销榜",
subText: "热销爆款不容错过",
id: 3
},
{
icon: "../../images/640.jpeg",
text: "新品热销榜",
subText: "热销爆款不容错过",
id: 4
}
],
iconList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
// this.setData({
// search: this.search.bind(this)
// })
setTimeout(() => {
this.setData({
loading: false
});
this.loadNewData();
}, 2000);
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {},
loadNewData: function() {
this.data.iconList = [];
this.loadMoreData();
},
loadMoreData: function() {
let list = this.data.iconList;
for (let index = 0; index < 20; index++) {
list.push({
icon:
index % 2 ? "../../images/plus_dark.png" : "../../images/640.jpeg",
text: "琴岛智能除螨电热毯 安全定时 智能控温" + index,
price: 171 + index
});
}
this.setData({
iconList: list
});
},
/**
* 用户搜索
*/
selectAction: function(e) {
wx.navigateTo({
url: "../Search/index"
});
},
cellAction: function(e) {
this.showToastText("点击了" + e.currentTarget.dataset["index"]);
console.log("cellAction result", e.currentTarget.dataset["index"]);
},
classificationAction: function(e) {
this.showToastText("点击了" + e.currentTarget.dataset["index"]);
console.log(
"classificationAction result",
e.currentTarget.dataset["index"]
);
},
onPullDownRefresh: function(e) {
this.loadNewData();
console.log("onPullDownRefresh result", this.data.iconList);
},
onReachBottom: function(e) {
this.loadMoreData();
console.log("onReachBottom result", this.data.iconList);
},
showToastText: function(text) {
wx.showToast({
title: text,
icon: "success",
duration: 2000
});
}
});
.container {
.swiper-view {
width: 100%;
height: 340rpx;
background-color: royalblue;
.swiper {
height: 100%;
}
.slide-image {
width: 100%;
}
}
.search-container {
width: 100%;
height: 88rpx;
display:flex ;
align-items:center;
justify-content:center ;
/* background-color: rebeccapurple; */
background-color: rgba(240, 241, 242, 0.5);
.search-view {
border-radius: 50rpx;
width: calc(100% - 80rpx);
height: 60rpx;
background-color: rgb(243, 243, 243);
.search-v {
display:flex ;
align-items:center;
justify-content:center;
margin-top: 10rpx;
}
image {
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
}
text {
font-size: 24rpx;
color: rgb(193, 193, 193);
}
}
}
.classification-view {
height: 462rpx;
position: relative;
/* background-color: lawngreen; */
.classification-container {
position: absolute;
display: flex;
flex-wrap: wrap;
justify-content: center;
width: calc( 100% - 80rpx);
height: calc( 100% - 80rpx);
left: 40rpx;
top: 60rpx;
}
.itme-view {
margin-right: 15rpx;
margin-left: 15rpx;
width: calc( (100% - 200rpx) / 5);
height: calc( (100% - 58rpx) / 2);
text-align: center;
color: rgb(102, 102,102);
image {
width: 90rpx;
height: 90rpx;
}
text {
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 26rpx;
}
}
}
.recommend-view {
height: 208rpx;
image {
width: calc(100% - 30rpx);
height: 100%;
margin-left: 15rpx;
}
}
.activity-view {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
align-content:space-between;
height: 550rpx;
margin-top: 54rpx;
width: 100%;
.activity-container {
width: calc( (100% - 30rpx ) / 2);
height: calc( (100% - 10rpx ) / 2);
background-color: rosybrown;
position: relative;
}
image {
width: 100%;
height: 100%;
position: absolute;
}
text {
position: relative;
display: block;
margin-left: 30rpx;
color: rebeccapurple;
}
}
.title-view {
margin-top: 84rpx;
border-top: solid;
border-color: rgba(197, 197, 197, 0.2);
text {
margin-left: 38rpx;
margin-top: 30rpx;
}
}
.list-grids {
width: 100%;
margin-top: 32rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
background-color: rgba(197, 197, 197, 0.2);
.cell-container {
margin-top: 4rpx;
background-color:white;
width: calc( (100% - 12rpx) / 2 );
height: 508rpx;
.icon-view {
margin-top: 30rpx;
margin-left: 30rpx;
background-color: seagreen;
width: calc( 100% - 60rpx);
height: calc((100vw - 120rpx - 12rpx) / 2);
}
.icon-view-text{
margin-left: 30rpx;
width: calc( 100% - 60rpx);
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: normal !important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.price-text {
margin-left: 30rpx;
color: lightgray;
}
}
}
}
\ No newline at end of file
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<view class='search-container' bindtap="selectAction"> <view class='search-container' bindtap="selectAction">
<view class='search-view'> <view class='search-view'>
<view class='search-v'> <view class='search-v'>
<image src='../../image/search.png' class="search-icon"></image> <image src='../../images/search.png'></image>
<text class="search-text"> 搜索商品,发现好物</text> <text> 搜索商品,发现好物</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -24,26 +24,26 @@ ...@@ -24,26 +24,26 @@
<view class="classification-container" hover-class="none" hover-stop-propagation="false"> <view class="classification-container" hover-class="none" hover-stop-propagation="false">
<block wx:for="{{classifications}}" wx:key="itme" wx:for-item="text"> <block wx:for="{{classifications}}" wx:key="itme" wx:for-item="text">
<view class="itme-view" hover-class="none" hover-stop-propagation="false" bindtap="classificationAction" data-index="{{text}}"> <view class="itme-view" hover-class="none" hover-stop-propagation="false" bindtap="classificationAction" data-index="{{text}}">
<image class="itme-icon" src="../../image/group_portrait.png" mode="aspectFill" /> <image src="../../images/group_portrait.png" mode="aspectFill" />
<text class="itme-text">{{text}}</text> <text>{{text}}</text>
</view> </view>
</block> </block>
</view> </view>
</view> </view>
<view class="recommend-view"> <view class="recommend-view">
<image class="recommend-image" src="{{imageUrl}}" mode="aspectFill"/> <image src="{{imageUrl}}" mode="aspectFill"/>
</view> </view>
<view class="activity-view"> <view class="activity-view">
<block wx:for="{{activityList}}" wx:key="itme" wx:for-item="obj"> <block wx:for="{{activityList}}" wx:key="itme" wx:for-item="obj">
<view class="activity-container"> <view class="activity-container">
<image class="activity-image" src="{{imageUrl}}" mode="aspectFill"/> <image src="{{obj.icon}}" mode="aspectFill"/>
<text class="activity-text" user-select="false" decode="false">{{obj.text}}</text> <text user-select="false" decode="false">{{obj.text}}</text>
<text class="activity-text" user-select="false" space="false" decode="false">{{obj.subText}}</text> <text user-select="false" space="false" decode="false">{{obj.subText}}</text>
</view> </view>
</block> </block>
</view> </view>
<view class="title-view"> <view class="title-view">
<text class="title">每日精选</text> <text>每日精选</text>
</view> </view>
<view class="list-grids"> <view class="list-grids">
<block wx:for="{{iconList}}" wx:key="itme" wx:for-item="obj"> <block wx:for="{{iconList}}" wx:key="itme" wx:for-item="obj">
...@@ -60,7 +60,3 @@ ...@@ -60,7 +60,3 @@
</view> </view>
<!-- </scroll-view> --> <!-- </scroll-view> -->
</view> </view>
\ No newline at end of file
<import src="index.skeleton.wxml"/>
<template is="skeleton" wx-if="{{loading}}" />
\ No newline at end of file
// pages/Order/index.js
Page({
/**
* 页面的初始数据
*/
data: {},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {}
});
.container {
.search-container {
width: 100vw;
height: 100vh;
}
.search-container {
text-align: center;
}
}
\ No newline at end of file
// pages/Search/index.js
Page({
/**
* 页面的初始数据
*/
data: {
searchText: "",
isSearch: false,
goodsList: [
{
icon: "../../images/group_portrait.png",
title: "休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服",
type: "精选",
originalPrice: 34,
price: 45
},
{
icon: "../../images/group_portrait.png",
title: "休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服",
type: "精选",
originalPrice: 45,
price: 45
},
{
icon: "../../images/group_portrait.png",
title: "休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服",
type: "精选",
originalPrice: 34,
price: 45
}
],
historys: [
"手机",
"电",
"电脑",
"电视",
"哗哗哈哈",
"昌",
"双双",
"是",
"要",
"有",
"大厦"
],
hotList: [
"手fffff",
"电sss",
"电ccc脑",
"电f视",
"哗哗ffff哈哈",
"昌",
"双双",
"是",
"要",
"有",
"大厦"
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {},
bindinput(e) {
console.log(this.data.searchText);
this.setData({
searchText: e.detail.value,
isSearch: false
});
},
bindconfirm(e) {
this.setData({
searchText: e.detail.value
});
},
searchAction() {
if (this.data.searchText.length == 0) {
return;
}
let goodsList = [
{
icon: "../../images/group_portrait.png",
title:
"休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服" + this.data.searchText,
type: "精选",
originalPrice: 45,
price: 45
},
{
icon: "../../images/group_portrait.png",
title: "休闲中长厚款90分户外休闲" + this.data.searchText,
type: "精选",
originalPrice: 45,
price: 333
},
{
icon: "../../images/group_portrait.png",
title:
"休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服" + this.data.searchText,
type: "精选",
originalPrice: 45,
price: 45
},
{
icon: "../../images/group_portrait.png",
title:
"休闲中长厚款90分户外休闲中长厚款鹅绒羽绒服" + this.data.searchText,
type: "精选",
originalPrice: 45,
price: 45
}
];
var list = this.data.historys;
if (this.data.searchText.length > 0) {
list.push(this.data.searchText);
}
this.setData({
isSearch: true,
goodsList: goodsList,
historys: list
});
console.log(this.data.searchText);
},
tagAction(e) {
console.log(e.detail.content);
},
delectAction(e) {
this.setData({
historys: []
});
}
});
.container {
.search-container {
padding: 32rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
.search {
position: relative;
width: calc( 100% - 150rpx);
height: 66rpx;
input {
width: 100%;
height: 100%;
border-radius: 30rpx;
padding-left:60rpx;
background-color: rgba(240, 241, 242, 0.5);
}
image {
width: 30rpx;
height: 30rpx;
position: absolute;
top: 19rpx;
left: 19rpx;
z-index: 9999;
}
}
.show-type.disabled{
color: rgb(193, 193, 193);
}
.show-type{
color: rgb(1, 1, 1);
}
}
.tag-view {
margin-top: 50rpx;
}
.goodsList-view {
display: flex;
flex-wrap: wrap;
.goods-view {
width: calc( 100% / 2);
/* height: calc( 100vw / 2 + ); */
.goods-icon {
width: calc( 100% - 60rpx);
height: calc( (100vw - 120rpx) / 2);
margin-left: 30rpx;
}
.goods-text-view {
width: calc (100% -60rpx);
margin-left: 30rpx;
.goods-type {
padding: 5rpx;
color: red;
border: 2rpx solid red;
margin-right: 10rpx;
}
}
.goods-price-view {
margin-left: 30rpx;
margin-bottom: 55rpx;
.goods-original-price {
text-decoration: line-through;
text-decoration-color: rgb(193, 193, 193);
color: rgb(193, 193, 193);
}
}
}
}
}
\ No newline at end of file
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
<view class="search-container" hover-class="none" hover-stop-propagation="false"> <view class="search-container" hover-class="none" hover-stop-propagation="false">
<view class="search"> <view class="search">
<input type="text" placeholder="请输入商品名称" value="{{searchText}}" bindinput="bindinput" bindconfirm="bindconfirm" bindfocus="bindfocus"></input> <input type="text" placeholder="请输入商品名称" value="{{searchText}}" bindinput="bindinput" bindconfirm="bindconfirm" bindfocus="bindfocus"></input>
<image src="../../image/search.png" bindtap="search"></image> <image src="../../images/search.png" bindtap="search"></image>
</view> </view>
<text class="show-type {{searchText.length == 0?'disabled':''}}" space="false" decode="false" bindtap="searchAction">搜索</text> <text class="show-type {{searchText.length == 0?'disabled':''}}" space="false" decode="false" bindtap="searchAction">搜索</text>
</view> </view>
<view class="tag-view" hover-class="none" hover-stop-propagation="false" wx:if="{{!isSearch}}"> <view class="tag-view" hover-class="none" hover-stop-propagation="false" wx:if="{{!isSearch}}">
<TagView title="历史搜索" showDelect="{{true}}" flexList="{{historys}}" bind:tagClick="tagAction" bind:delectClick="delectAction"/> <TagView super-class="display-flex flex-j-between flex-a-center" title="历史搜索" showDelect="{{true}}" flexList="{{historys}}" bind:tagClick="tagAction" bind:delectClick="delectAction"/>
<TagView title="热门搜索" showDelect="{{false}}" flexList="{{hotList}}" bind:tagClick="tagAction"/> <TagView super-class="display-flex flex-j-between flex-a-center" title="热门搜索" showDelect="{{false}}" flexList="{{hotList}}" bind:tagClick="tagAction"/>
</view> </view>
<view class="goodsList-view" hover-class="none" hover-stop-propagation="false" wx:else> <view class="goodsList-view" hover-class="none" hover-stop-propagation="false" wx:else>
<view class="goods-view" hover-class="none" hover-stop-propagation="false" wx:for="{{goodsList}}" wx:key="index" wx:for-item="obj"> <view class="goods-view" hover-class="none" hover-stop-propagation="false" wx:for="{{goodsList}}" wx:key="index" wx:for-item="obj">
......
{ {
"description": "项目配置文件", "description": "项目配置文件",
"miniprogramRoot": "CJPremiumMember/",
"packOptions": { "packOptions": {
"ignore": [] "ignore": []
}, },
......
// copy changein -> common/scss/style
@import '../scss/variables.scss';
.flex-1 {
flex: 1;
};
.flex-center{
display: flex;
align-items: center;
justify-content: center;
}
// text overflow
.text-ellipsis {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
// flex
.display-flex {
display: flex;
}
.flex-column {
flex-direction: column;
}
.flex-wrap {
flex-wrap: wrap;
}
\ No newline at end of file
// copy changein -> common/scss/_variables
$base-font-size: 26rpx;
$font-sizes: (
xxs: 0.6923,
// 18rpx
xs: 0.7692,
// 20rpx
ssm: 0.8462,
// 22rpx
sm: 0.9230,
// 24rpx
md: 1,
// 26rpx
lg: 1.0769,
// 28rpx
xl: 1.1538,
// 30rpx
);
// spacing
// 0-5: 0
// .mt-1 => margin top .pb-2
$spacing-types: (
m: margin,
p: padding,
);
$spacing-directions: (
t: top,
r: right,
b: bottom,
l: left,
);
@each $sizeKey, $size in $font-sizes {
.fs-#{$sizeKey} {
font-size: $size * $base-font-size;
}
}
// text align
@each $var in (left, center, right) {
.text-#{$var} {
text-align: $var !important;
}
}
$flex-justify-content: (
start: flex-start,
end: flex-end,
center: center,
between: space-between,
around: space-around,
);
$flex-align-items: (
start: flex-start,
end: flex-end,
center: center,
stretch: stretch,
);
@each $key, $value in $flex-justify-content {
.flex-j-#{$key} {
justify-content: $value;
}
}
@each $key, $value in $flex-align-items {
.flex-a-#{$key} {
align-items: $value;
}
}
\ No newline at end of file
@import '../scss/style.scss';
$colors: (
"theme-color": #8FBC8F,
);
$tc: map-get($colors, "theme-color");
@mixin width($value: 100%) {
width: $value;
}
@mixin height($value: 100%) {
height: $value;
}
// width, height
.w-100 {
@include width();
}
.h-100 {
@include height();
}
/**
* 除继承样式外, app.wxss 中的样式、组件所在页面的的样式对自定义组件无效。
* 参考文档:https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html
* 采用 externalClasses 的方式 在组件.wxml需要的view的class加super-class,可以是多个
* 使用 <Component super-class="<#type#>" />
*/
Component({
properties: {
showDelect: Boolean,
flexList: Array,
title: String // 简化的定义方式
},
externalClasses: ["super-class"],
data: {
content: "content"
},
methods: {
// 这里是一个自定义方法
tagAction(e) {
var eventOption = { content: e.currentTarget.dataset.text }; // 触发事件的选项
this.triggerEvent("tagClick", eventOption);
}
}
});
{ {
"component": true,
"usingComponents": {} "usingComponents": {}
} }
\ No newline at end of file
.container {
width: 100vw;
.text {
color: red;
}
}
\ No newline at end of file
<!--template/components/index.wxml-->
<view class="container" hover-class="none" hover-stop-propagation="false">
<text class="flex-item super-class" selectable="false" space="false" decode="false" bindtap="tagAction" data-text="{{content}}">{{content}}</text>
</view>
// pages/index.js
Page({
/**
* 页面的初始数据
*/
data: {
content: "index"
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
console.log("onLoad");
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
console.log("onShareAppMessage");
}
});
{
"usingComponents": {}
}
\ No newline at end of file
.container {
width: 100vw;
.text {
color: red;
}
}
\ No newline at end of file
<view class='container'>
<text class="text">{{content}}</text>
</view>
\ No newline at end of file
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
"tabBarBorderStyle": "black", "tabBarBorderStyle": "black",
"tabBarBackgroundColor": "#F7F7F7", "tabBarBackgroundColor": "#F7F7F7",
"iconPathComponent": "image/icon_component.png", "iconPathComponent": "images/icon_component.png",
"selectedIconPathComponent": "image/icon_component_HL.png", "selectedIconPathComponent": "images/icon_component_HL.png",
"iconPathAPI": "image/icon_API.png", "iconPathAPI": "images/icon_API.png",
"selectedIconPathAPI": "image/icon_API_HL.png", "selectedIconPathAPI": "images/icon_API_HL.png",
"iconPathCloud": "image/icon_cloud.png", "iconPathCloud": "images/icon_cloud.png",
"selectedIconPathCloud": "image/icon_cloud_HL.png", "selectedIconPathCloud": "images/icon_cloud_HL.png",
"backgroundTextStyle": "dark" "backgroundTextStyle": "dark"
}, },
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
"tabBarBorderStyle": "white", "tabBarBorderStyle": "white",
"tabBarBackgroundColor": "#1F1F1F", "tabBarBackgroundColor": "#1F1F1F",
"iconPathComponent": "image/icon_component_dark.png", "iconPathComponent": "images/icon_component_dark.png",
"selectedIconPathComponent": "image/icon_component_HL.png", "selectedIconPathComponent": "images/icon_component_HL.png",
"iconPathAPI": "image/icon_API_dark.png", "iconPathAPI": "images/icon_API_dark.png",
"selectedIconPathAPI": "image/icon_API_HL.png", "selectedIconPathAPI": "images/icon_API_HL.png",
"iconPathCloud": "image/icon_cloud_dark.png", "iconPathCloud": "images/icon_cloud_dark.png",
"selectedIconPathCloud": "image/icon_cloud_HL.png", "selectedIconPathCloud": "images/icon_cloud_HL.png",
"backgroundTextStyle": "light" "backgroundTextStyle": "light"
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment