Commit 854bacf6 authored by Menethil's avatar Menethil
Browse files

添加Renard小程序

parent a50998e6
<view
class="custom-class van-icon van-icon-{{ name }}"
style="{{ color ? 'color: ' + color : '' }}; {{ size ? 'font-size: ' + size : '' }}"
bind:tap="onClick"
>
<view wx:if="{{ info !== null }}" class="van-icon__info">{{ info }}</view>
</view>
@font-face{font-style:normal;font-weight:400;font-family:vant-icon;src:url(https://img.yzcdn.cn/vant/vant-icon-eb8c95.ttf) format('truetype')}.van-icon{position:relative;display:inline-block;font:normal normal normal 14px/1 vant-icon;font-size:inherit;text-rendering:auto}.van-icon__info{color:#fff;left:100%;top:-.5em;font-size:.5em;padding:0 .3em;text-align:center;min-width:1.2em;line-height:1.2;position:absolute;border-radius:.6em;box-sizing:border-box;background-color:#f44;-webkit-transform:translateX(-50%);transform:translateX(-50%);font-family:PingFang SC,Helvetica Neue,Arial,sans-serif}.van-icon::before{display:inline-block}.van-icon-add-o::before{content:"\F000"}.van-icon-add::before{content:"\F001"}.van-icon-add2::before{content:"\F002"}.van-icon-after-sale::before{content:"\F003"}.van-icon-alipay::before{content:"\F004"}.van-icon-arrow-left::before{content:"\F005"}.van-icon-arrow::before{content:"\F006"}.van-icon-balance-pay::before{content:"\F007"}.van-icon-browsing-history::before{content:"\F008"}.van-icon-card::before{content:"\F009"}.van-icon-cart::before{content:"\F00A"}.van-icon-cash-back-record::before{content:"\F00B"}.van-icon-cash-on-deliver::before{content:"\F00C"}.van-icon-certificate::before{content:"\F00D"}.van-icon-chat::before{content:"\F00E"}.van-icon-check::before{content:"\F00F"}.van-icon-checked::before{content:"\F010"}.van-icon-clear::before{content:"\F011"}.van-icon-clock::before{content:"\F012"}.van-icon-close::before{content:"\F013"}.van-icon-completed::before{content:"\F014"}.van-icon-contact::before{content:"\F015"}.van-icon-coupon::before{content:"\F016"}.van-icon-credit-pay::before{content:"\F017"}.van-icon-debit-pay::before{content:"\F018"}.van-icon-delete::before{content:"\F019"}.van-icon-description::before{content:"\F01A"}.van-icon-discount::before{content:"\F01B"}.van-icon-ecard-pay::before{content:"\F01C"}.van-icon-edit-data::before{content:"\F01D"}.van-icon-edit::before{content:"\F01E"}.van-icon-exchange-record::before{content:"\F01F"}.van-icon-exchange::before{content:"\F020"}.van-icon-fail::before{content:"\F021"}.van-icon-free-postage::before{content:"\F022"}.van-icon-gift-card-pay::before{content:"\F023"}.van-icon-gift-card::before{content:"\F024"}.van-icon-gift::before{content:"\F025"}.van-icon-gold-coin::before{content:"\F026"}.van-icon-goods-collect::before{content:"\F027"}.van-icon-home::before{content:"\F028"}.van-icon-hot-sale::before{content:"\F029"}.van-icon-hot::before{content:"\F02A"}.van-icon-idcard::before{content:"\F02B"}.van-icon-info-o::before{content:"\F02C"}.van-icon-like-o::before{content:"\F02D"}.van-icon-like::before{content:"\F02E"}.van-icon-location::before{content:"\F02F"}.van-icon-logistics::before{content:"\F030"}.van-icon-more-o::before{content:"\F031"}.van-icon-more::before{content:"\F032"}.van-icon-new-arrival::before{content:"\F033"}.van-icon-new::before{content:"\F034"}.van-icon-other-pay::before{content:"\F035"}.van-icon-passed::before{content:"\F036"}.van-icon-password-not-view::before{content:"\F037"}.van-icon-password-view::before{content:"\F038"}.van-icon-pause::before{content:"\F039"}.van-icon-peer-pay::before{content:"\F03A"}.van-icon-pending-deliver::before{content:"\F03B"}.van-icon-pending-evaluate::before{content:"\F03C"}.van-icon-pending-orders::before{content:"\F03D"}.van-icon-pending-payment::before{content:"\F03E"}.van-icon-phone::before{content:"\F03F"}.van-icon-photo::before{content:"\F040"}.van-icon-photograph::before{content:"\F041"}.van-icon-play::before{content:"\F042"}.van-icon-point-gift::before{content:"\F043"}.van-icon-points-mall::before{content:"\F044"}.van-icon-points::before{content:"\F045"}.van-icon-qr-invalid::before{content:"\F046"}.van-icon-qr::before{content:"\F047"}.van-icon-question::before{content:"\F048"}.van-icon-receive-gift::before{content:"\F049"}.van-icon-records::before{content:"\F04A"}.van-icon-search::before{content:"\F04B"}.van-icon-send-gift::before{content:"\F04C"}.van-icon-setting::before{content:"\F04D"}.van-icon-share::before{content:"\F04E"}.van-icon-shop-collect::before{content:"\F04F"}.van-icon-shop::before{content:"\F050"}.van-icon-shopping-cart::before{content:"\F051"}.van-icon-sign::before{content:"\F052"}.van-icon-stop::before{content:"\F053"}.van-icon-success::before{content:"\F054"}.van-icon-tosend::before{content:"\F055"}.van-icon-underway::before{content:"\F056"}.van-icon-upgrade::before{content:"\F057"}.van-icon-value-card::before{content:"\F058"}.van-icon-wap-home::before{content:"\F059"}.van-icon-wap-nav::before{content:"\F05A"}.van-icon-warn::before{content:"\F05B"}.van-icon-wechat::before{content:"\F05C"}
\ No newline at end of file
const VALID_MODE = ['closeable', 'link'];
const FONT_COLOR = '#f60';
const BG_COLOR = '#fff7cc';
Component({
externalClasses: ['custom-class'],
properties: {
text: {
type: String,
value: '',
observer() {
this.setData({}, this._init);
}
},
mode: {
type: String,
value: ''
},
url: {
type: String,
value: ''
},
openType: {
type: String,
value: 'navigate'
},
delay: {
type: Number,
value: 0
},
speed: {
type: Number,
value: 50
},
scrollable: {
type: Boolean,
value: true
},
leftIcon: {
type: String,
value: ''
},
color: {
type: String,
value: FONT_COLOR
},
backgroundColor: {
type: String,
value: BG_COLOR
}
},
data: {
show: true,
hasRightIcon: false,
width: undefined,
wrapWidth: undefined,
elapse: undefined,
animation: null,
resetAnimation: null,
timer: null
},
attached() {
const { mode } = this.data;
if (mode && this._checkMode(mode)) {
this.setData({
hasRightIcon: true
});
}
},
detached() {
const { timer } = this.data;
timer && clearTimeout(timer);
},
methods: {
_checkMode(val) {
const isValidMode = ~VALID_MODE.indexOf(val);
if (!isValidMode) {
console.warn(`mode only accept value of ${VALID_MODE}, now get ${val}.`);
}
return isValidMode;
},
_init() {
wx.createSelectorQuery()
.in(this)
.select('.van-notice-bar__content')
.boundingClientRect((rect) => {
if (!rect || !rect.width) {
return;
}
this.setData({
width: rect.width
});
wx.createSelectorQuery()
.in(this)
.select('.van-notice-bar__content-wrap')
.boundingClientRect((rect) => {
if (!rect || !rect.width) {
return;
}
const wrapWidth = rect.width;
const {
width, speed, scrollable, delay
} = this.data;
if (scrollable && wrapWidth < width) {
const elapse = width / speed * 1000;
const animation = wx.createAnimation({
duration: elapse,
timeingFunction: 'linear',
delay
});
const resetAnimation = wx.createAnimation({
duration: 0,
timeingFunction: 'linear'
});
this.setData({
elapse,
wrapWidth,
animation,
resetAnimation
}, () => {
this._scroll();
});
}
})
.exec();
})
.exec();
},
_scroll() {
const {
animation, resetAnimation, wrapWidth, elapse, speed
} = this.data;
resetAnimation.translateX(wrapWidth).step();
const animationData = animation.translateX(-(elapse * speed) / 1000).step();
this.setData({
animationData: resetAnimation.export()
});
setTimeout(() => {
this.setData({
animationData: animationData.export()
});
}, 100);
const timer = setTimeout(() => {
this._scroll();
}, elapse);
this.setData({
timer
});
},
_handleButtonClick() {
const { timer } = this.data;
timer && clearTimeout(timer);
this.setData({
show: false,
timer: null
});
},
onClick(event) {
this.triggerEvent('click', event);
}
}
});
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}
\ No newline at end of file
<view
wx:if="{{ show }}"
class="custom-class van-notice-bar {{ hasRightIcon ? 'van-notice-bar--within-icon' : '' }}"
style="color: {{ color }};background-color: {{ backgroundColor }}"
bind:tap="onClick"
>
<view wx:if="{{ leftIcon }}" class="van-notice-bar__left-icon">
<image src="{{ leftIcon }}" />
</view>
<view class="van-notice-bar__content-wrap">
<view class="van-notice-bar__content" animation="{{ animationData }}">
{{ text }}
</view>
</view>
<block wx:if="{{ mode }}">
<van-icon
wx:if="{{ mode === 'closeable' }}"
class="van-notice-bar__right-icon"
name="close"
bind:tap="_handleButtonClick"
/>
<navigator
wx:if="{{ mode === 'link' }}"
url="{{ url }}"
open-type="{{ openType }}"
>
<van-icon class="van-notice-bar__right-icon" name="arrow" />
</navigator>
</block>
</view>
.van-notice-bar{display:-webkit-box;display:-webkit-flex;display:flex;padding:9px 10px;font-size:12px;line-height:1.5}.van-notice-bar--within-icon{position:relative;padding-right:30px}.van-notice-bar__left-icon{height:18px;min-width:20px;padding-top:1px;box-sizing:border-box}.van-notice-bar__left-icon>image{width:16px;height:16px}.van-notice-bar__right-icon{position:absolute;top:10px;right:10px;font-size:15px;line-height:1}.van-notice-bar__content-wrap{position:relative;-webkit-box-flex:1;-webkit-flex:1;flex:1;height:18px;overflow:hidden}.van-notice-bar__content{position:absolute;white-space:nowrap}
\ No newline at end of file
Component({
properties: {
text: String,
color: {
type: String,
value: '#fff'
},
backgroundColor: {
type: String,
value: '#e64340'
},
duration: {
type: Number,
value: 3000
}
},
methods: {
show() {
const { duration } = this.data;
clearTimeout(this.timer);
this.setData({
show: true
});
if (duration > 0 && duration !== Infinity) {
this.timer = setTimeout(() => {
this.hide();
}, duration);
}
},
hide() {
clearTimeout(this.timer);
this.setData({
show: false
});
}
}
});
const defaultOptions = {
selector: '#van-notify',
duration: 3000
};
function Notify(options = {}) {
const pages = getCurrentPages();
const ctx = pages[pages.length - 1];
options = Object.assign({}, defaultOptions, parseParam(options));
const el = ctx.selectComponent(options.selector);
delete options.selector;
if (el) {
el.setData({
...options
});
el.show();
}
}
function parseParam(params = '') {
return typeof params === 'object' ? params : { text: params };
}
module.exports = Notify;
{
"component": true
}
\ No newline at end of file
<view
class="van-notify {{ show ? 'van-notify--show' : '' }}"
style="background-color:{{ backgroundColor }}"
>
{{ text }}
</view>
.van-notify{top:0;opacity:0;width:100%;z-index:110;color:#fff;position:fixed;min-height:32px;line-height:2.3;font-size:14px;text-align:center;background-color:#e64340;-webkit-transition:all .4s ease;transition:all .4s ease;-webkit-transform:translateZ(0) translateY(-100%);transform:translateZ(0) translateY(-100%)}.van-notify--show{opacity:1;-webkit-transform:translateZ(0) translateY(0);transform:translateZ(0) translateY(0)}
\ No newline at end of file
// components/sharePop/sharePop.js
Component({
/**
* 组件的属性列表
*/
properties: {
url: {
type: String,
value: '', // 属性值 (可选)
},
bottom:{
type: Number,
value: 0, // 属性值 (可选)
}
},
/**
* 组件的初始数据
*/
data: {
// 弹窗显示控制
showPop: false,
},
/**
* 组件的方法列表
*/
methods: {
closeShare: function() {
this.setData({
showPop: false,
});
},
togglePopup: function() {
let that = this;
this.setData({
showPop: !this.data.showPop,
});
},
// 保存分享图
_saveShare: function() {
wx.showLoading({
title: '加载中',
});
setTimeout(function() {
wx.hideLoading()
}, 2000);
let that = this;
wx.downloadFile({
url: that.data.url,
success: function(res) {
console.log(res)
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function(res) {
wx.showModal({
title: '存图成功',
content: '图片成功保存到相册了,可以分享到朋友圈了',
showCancel: false,
confirmText: '好的',
confirmColor: '#a78845',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
});
wx.hideLoading();
},
fail: function(res) {
console.log('fail')
}
})
},
fail: function() {
console.log('fail')
}
})
},
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="share-pop-box" hidden="{{!showPop}}">
<view class="share-pop" style='bottom:{{bottom}}rpx;'>
<view class="close" bindtap="closeShare">
<image class="icon" src="/static/images/icon_close.png"></image>
</view>
<view class="share-items">
<view class='share-touser'>
<button style="opacity:0;height: 160rpx;width: 160rpx;" open-type="share">分享给朋友
</button>
</view>
<view class='share-friend'>
<button style="opacity:0;height: 160rpx;width: 160rpx;" bindtap="_saveShare">分享朋友圈
</button>
</view>
</view>
</view>
</view>
\ No newline at end of file
.share-pop-box {
width: 100%;
height: 100%;
position: fixed;
background: rgba(0, 0, 0, 0.5);
z-index: 8;
bottom: 0;
/* display: none; */
}
.share-pop {
width: 100%;
height: 400rpx;
max-height: 780rpx;
padding: 31.25rpx;
background: #fff;
position: fixed;
z-index: 9;
bottom: 0rpx;
}
.share-pop .close {
position: absolute;
width: 48rpx;
height: 48rpx;
right: 31.25rpx;
overflow: hidden;
top: 31.25rpx;
}
.share-pop .close .icon {
width: 48rpx;
height: 48rpx;
}
.share-pop .share-items {
margin-top: 80rpx;
flex-flow: row;
display: flex;
justify-content: space-around;
}
.share-pop .share-touser {
height: 160rpx;
width: 160rpx;
background: url("https://litemall-1256968571.file.myqcloud.com/icon/%E5%88%86%E4%BA%AB_%E5%BE%AE%E4%BF%A1.png") no-repeat center 1rpx;
background-size: 160rpx auto;
border-radius: 80rpx;
}
.share-pop .share-friend {
height: 160rpx;
width: 160rpx;
background: url("https://litemall-1256968571.file.myqcloud.com/icon/%E5%88%86%E4%BA%AB_%E5%BE%AE%E4%BF%A1%E6%9C%8B%E5%8F%8B%E5%9C%88.png") no-repeat center 1rpx;
background-size: 160rpx auto;
border-radius: 10rpx;
}
.share-pop image {
height: 120rpx;
width: 120rpx;
}
\ No newline at end of file
// 以下是业务服务器API地址
// 本机开发时使用
var WxApiRoot = 'http://192.168.1.105:8082/wx/';
// 云平台上线时使用
// var WxApiRoot = 'https://litemall.menethil.com.cn/wx/';
// var WxApiRoot = 'https://www.menethil.com.cn/wx/';
module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口
CatalogList: WxApiRoot + 'catalog/index', //分类目录全部分类数据接口
CatalogCurrent: WxApiRoot + 'catalog/current', //分类目录当前分类数据接口
CatalogAll: WxApiRoot + 'catalog/all', //分类目录当前分类数据接口
AuthLoginByWeixin: WxApiRoot + 'auth/login_by_weixin', //微信登录
AuthLoginByAccount: WxApiRoot + 'auth/login', //账号登录
AuthRegister: WxApiRoot + 'auth/register', //账号注册
AuthReset: WxApiRoot + 'auth/reset', //账号密码重置
AuthRegisterCaptcha: WxApiRoot + 'auth/regCaptcha', //验证码
GoodsCount: WxApiRoot + 'goods/count', //统计商品总数
GoodsList: WxApiRoot + 'goods/list', //获得商品列表
GoodsCategory: WxApiRoot + 'goods/category', //获得分类数据
GoodsDetail: WxApiRoot + 'goods/detail', //获得商品的详情
GoodsNew: WxApiRoot + 'goods/new', //新品
GoodsHot: WxApiRoot + 'goods/hot', //热门
GoodsRelated: WxApiRoot + 'goods/related', //商品详情页的关联商品(大家都在看)
BrandList: WxApiRoot + 'brand/list', //品牌列表
BrandDetail: WxApiRoot + 'brand/detail', //品牌详情
CartList: WxApiRoot + 'cart/index', //获取购物车的数据
CartAdd: WxApiRoot + 'cart/add', // 添加商品到购物车
CartFastAdd: WxApiRoot + 'cart/fastadd', // 立即购买商品
CartUpdate: WxApiRoot + 'cart/update', // 更新购物车的商品
CartDelete: WxApiRoot + 'cart/delete', // 删除购物车的商品
CartChecked: WxApiRoot + 'cart/checked', // 选择或取消选择商品
CartGoodsCount: WxApiRoot + 'cart/goodscount', // 获取购物车商品件数
CartCheckout: WxApiRoot + 'cart/checkout', // 下单前信息确认
CollectList: WxApiRoot + 'collect/list', //收藏列表
CollectAddOrDelete: WxApiRoot + 'collect/addordelete', //添加或取消收藏
CommentList: WxApiRoot + 'comment/list', //评论列表
CommentCount: WxApiRoot + 'comment/count', //评论总数
CommentPost: WxApiRoot + 'comment/post', //发表评论
TopicList: WxApiRoot + 'topic/list', //专题列表
TopicDetail: WxApiRoot + 'topic/detail', //专题详情
TopicRelated: WxApiRoot + 'topic/related', //相关专题
SearchIndex: WxApiRoot + 'search/index', //搜索关键字
SearchResult: WxApiRoot + 'search/result', //搜索结果
SearchHelper: WxApiRoot + 'search/helper', //搜索帮助
SearchClearHistory: WxApiRoot + 'search/clearhistory', //搜索历史清楚
AddressList: WxApiRoot + 'address/list', //收货地址列表
AddressDetail: WxApiRoot + 'address/detail', //收货地址详情
AddressSave: WxApiRoot + 'address/save', //保存收货地址
AddressDelete: WxApiRoot + 'address/delete', //保存收货地址
RegionList: WxApiRoot + 'region/list', //获取区域列表
OrderSubmit: WxApiRoot + 'order/submit', // 提交订单
OrderPrepay: WxApiRoot + 'order/prepay', // 订单的预支付会话
OrderList: WxApiRoot + 'order/list', //订单列表
OrderDetail: WxApiRoot + 'order/detail', //订单详情
OrderCancel: WxApiRoot + 'order/cancel', //取消订单
OrderRefund: WxApiRoot + 'order/refund', //退款取消订单
OrderDelete: WxApiRoot + 'order/delete', //删除订单
OrderConfirm: WxApiRoot + 'order/confirm', //确认收货
OrderComment: WxApiRoot + 'order/comment', // 代评价商品信息
FootprintList: WxApiRoot + 'footprint/list', //足迹列表
FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹
UserFormIdCreate: WxApiRoot + 'formid/create', //用户FromId,用于发送模版消息
GroupOn: WxApiRoot + 'groupon/query', //团购API-查询
GroupOnMy: WxApiRoot + 'groupon/my', //团购API-我的团购
GroupOnDetail: WxApiRoot + 'groupon/detail', //团购API-详情
GroupOnJoin: WxApiRoot + 'groupon/join', //团购API-详情
StorageUpload: WxApiRoot + 'storage/upload' //图片上传
};
\ No newline at end of file
Supports Markdown
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