806d3c4a by simon

版本提交

1 parent 5f588c45
Showing 367 changed files with 1689 additions and 401 deletions
......@@ -8,18 +8,20 @@ let store = require('./utils/stroage');
require('./http/mock-data');
App({
get: fetchApi.fetch,
post: (params) => {
params.method = 'post';
return fetchApi.fetch(params);
},
api: api,
config: config,
router: router,
store: store,
onLaunch: function () {},
globalData: {
indexInfo: null,
userInfo: null
}
get: fetchApi.fetch,
post: (params) => {
params.method = 'post';
return fetchApi.fetch(params);
},
api: api,
config: config,
router: router,
store: store,
onLaunch: function () {},
globalData: {
indexInfo: null,
userInfo: null,
wxcode: store.getItem("wxcode"),
tlMemberCode: ""
}
})
......
{
"pages": [
"pages/index/index",
"pages/example/example",
"pages/more/more"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "心愿单",
"navigationBarTextStyle": "black"
},
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#CF4646",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "image/tabbar/home_D.png",
"selectedIconPath": "image/tabbar/home.png",
"text": "介绍"
},
{
"pagePath": "pages/more/more",
"iconPath": "image/tabbar/set_D.png",
"selectedIconPath": "image/tabbar/set.png",
"text": "更多"
}
]
}
"pages": [
"pages/index/index",
"pages/authorize/authorize",
"pages/wish/wish",
"pages/create-wish/create-wish",
"pages/new-welfare/new-welfare",
"pages/user-table/user-table",
"pages/rank/rank",
"pages/poster/poster",
"pages/coop/coop",
"pages/example/example",
"pages/more/more"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "心愿单",
"navigationBarTextStyle": "black"
}
}
......
......@@ -19,68 +19,68 @@
// @lazysprite "filetype";
.test {
background-image: url(%ASSETS_IMG%/qr-r.jpg);
background-image: url(%ASSETS_IMG%/qr-r.jpg);
}
.app {
height: 100%;
justify-content: space-between;
// text-align: center;
box-sizing: border-box;
font-family: -apple-system-font, Helvetica Neue, Helvetica, sans-serif, FZY3JW-GB1-0;
height: 100%;
justify-content: space-between;
// text-align: center;
box-sizing: border-box;
font-family: SourceHanSansCN, -apple-system-font, Helvetica Neue, Helvetica, sans-serif, FZY3JW-GB1-0;
}
.app__width {
width: 750px;
width: 750px;
}
.app__width {
width: 750px;
width: 750px;
}
.app__inner {
margin: 20px;
margin: 20px;
}
.app__title {
font-size: $fontSize;
line-height: $fontSize + 4px;
font-weight: bold;
padding-bottom: 10px;
margin-bottom: 20px;
border-bottom: .5px solid #EEEEEE;
font-size: $fontSize;
line-height: $fontSize + 4px;
font-weight: bold;
padding-bottom: 10px;
margin-bottom: 20px;
border-bottom: .5px solid #EEEEEE;
}
.app__desc {
font-size: $fontSizeSmaller;
line-height: $fontSizeSmaller +2px;
margin-bottom: 20px;
color: $colorGray;
font-size: $fontSizeSmaller;
line-height: $fontSizeSmaller +2px;
margin-bottom: 20px;
color: $colorGray;
}
.app__bgc {
position: fixed;
background-color: #ffffff;
width: 100%;
height: 100%;
position: fixed;
background-color: #ffffff;
width: 100%;
height: 100%;
}
.app__bg {
position: absolute;
width: 100%;
height: 100%;
position: absolute;
width: 100%;
height: 100%;
}
.app__top-shadow {
position: fixed;
width: 750px;
height: 1px;
box-shadow: 0px 4px 0.9px 0.1px rgba(6, 0, 1, 0.07);
background-color: #ffffff;
position: fixed;
width: 750px;
height: 1px;
box-shadow: 0px 4px 0.9px 0.1px rgba(6, 0, 1, 0.07);
background-color: #ffffff;
}
.app__content {
position: relative;
position: relative;
}
......@@ -88,26 +88,31 @@
// web font icon
@font-face {
font-family: "iconfont";
src:url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAOsAAsAAAAAB6gAAANdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDBgqDDIJmATYCJAMMCwgABCAFhG0HORuvBsgOJUHBwIABAAlgPHyN/f7c3UVEk0mi+3QSQxJNJCoexUrxUhhKIyT4UsKbL89+kizTNWb3wyt7UkR96ayA4xev1q04fZzIa32ey/Gt5wc26luWy5iT9qKFAcYBBbQ3RgEFWiAJesPYlRdxn0C9YccRqxl5ZcBCYSwLxJFS3gwsUk6lpj7UCtUle4t4Yqo2XaeXAHj0vx//QUhYkFRlxtq1w/Q2kPRz+iOmhipDoM51Gx7PD3aIjBlAITZLgxuoMDODUq8YTerLqxUhjRU3GgFfqeqrzT88kiCqGbWNYAJlEz+nbQmJP1h91rUZVMPcGeAZM51XhqohJw97O/vO23paqy3T6coNhsqQ1esr3nVWF19mTZ3YnOwtWwPk5bvMfvYCQV11V+xUzZx02tPO6H02TtP0y4dn5a7M9ravfPvs/poNl43TTmVrW87O66dcKzd3myo2Tjo5rW07l6+fcXXd3KmUDdBKXH240GtvAAw49qfa2BeatkTevUsumTJX5pzRRVy781FXe+YP15YALi0+kkDHQRm8OLz2sP/U1NGjIPxKdyVpafxHpKWvbajtddvnaxmZHLP0XGY1d2wvLarJWrd3LMD6Q1DiSPHusrPgvOxtlAKDyt7bk32nH3emP+npcwo2dKU/Vj040Jn2+HTvAU5VFtOf5vZDf683NVrpbEvIO7N3IX421A40MRbmdVIPQGXQhMi7/+o3vjanTBtt4/7Vygr4/p/GIHW7aqBWorXqz7QVQMVYCK4xXLnISlup57Ntpvcth3Ju8j8aod2b/tauu8+FWl0xkhpDyGqNEIWZQZUG86hWawH1pmUebtBBQolShynjAKHVFSTNPpG1ekUU5jWqdPuGaq1Bod56OJ7ZYCyUdKqEmjFqgy3dUNkqCozlwXRQX4Lk7VyzlNT4XAWSNMo4DA4IyuYzkYCkMTZoOuQhGDOQkUQeZoDHEMeJUC2JKtSKAxQYq2MCA5myFwW0ijygrZAgzTCkDdSiG6TUSiRg3MEYnft8CUSuHaeZVNNTka6ASDSUo0PBAgS1IDKNQquea3lGo4NcCAxjQAyJiAdlgFkIhyOC1OWzVJBWWABFj5RajECzH9PWGDC/mX++Q1DPGJsjRY6i5hgx1hSNwhTxatwNAAAAAA==') format('woff2'),
font-family: "iconfont";
src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAOsAAsAAAAAB6gAAANdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDBgqDDIJmATYCJAMMCwgABCAFhG0HORuvBsgOJUHBwIABAAlgPHyN/f7c3UVEk0mi+3QSQxJNJCoexUrxUhhKIyT4UsKbL89+kizTNWb3wyt7UkR96ayA4xev1q04fZzIa32ey/Gt5wc26luWy5iT9qKFAcYBBbQ3RgEFWiAJesPYlRdxn0C9YccRqxl5ZcBCYSwLxJFS3gwsUk6lpj7UCtUle4t4Yqo2XaeXAHj0vx//QUhYkFRlxtq1w/Q2kPRz+iOmhipDoM51Gx7PD3aIjBlAITZLgxuoMDODUq8YTerLqxUhjRU3GgFfqeqrzT88kiCqGbWNYAJlEz+nbQmJP1h91rUZVMPcGeAZM51XhqohJw97O/vO23paqy3T6coNhsqQ1esr3nVWF19mTZ3YnOwtWwPk5bvMfvYCQV11V+xUzZx02tPO6H02TtP0y4dn5a7M9ravfPvs/poNl43TTmVrW87O66dcKzd3myo2Tjo5rW07l6+fcXXd3KmUDdBKXH240GtvAAw49qfa2BeatkTevUsumTJX5pzRRVy781FXe+YP15YALi0+kkDHQRm8OLz2sP/U1NGjIPxKdyVpafxHpKWvbajtddvnaxmZHLP0XGY1d2wvLarJWrd3LMD6Q1DiSPHusrPgvOxtlAKDyt7bk32nH3emP+npcwo2dKU/Vj040Jn2+HTvAU5VFtOf5vZDf683NVrpbEvIO7N3IX421A40MRbmdVIPQGXQhMi7/+o3vjanTBtt4/7Vygr4/p/GIHW7aqBWorXqz7QVQMVYCK4xXLnISlup57Ntpvcth3Ju8j8aod2b/tauu8+FWl0xkhpDyGqNEIWZQZUG86hWawH1pmUebtBBQolShynjAKHVFSTNPpG1ekUU5jWqdPuGaq1Bod56OJ7ZYCyUdKqEmjFqgy3dUNkqCozlwXRQX4Lk7VyzlNT4XAWSNMo4DA4IyuYzkYCkMTZoOuQhGDOQkUQeZoDHEMeJUC2JKtSKAxQYq2MCA5myFwW0ijygrZAgzTCkDdSiG6TUSiRg3MEYnft8CUSuHaeZVNNTka6ASDSUo0PBAgS1IDKNQquea3lGo4NcCAxjQAyJiAdlgFkIhyOC1OWzVJBWWABFj5RajECzH9PWGDC/mX++Q1DPGJsjRY6i5hgx1hSNwhTxatwNAAAAAA==') format('woff2'),
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.iconrefresh:before {
content: "\e874";
content: "\e874";
}
.iconempty:before {
content: "\e6a6";
content: "\e6a6";
}
.drop-down-item :last-child {
border-bottom: none;
border-bottom: none;
}
.van-popup {
background-color: transparent !important;
}
......
......@@ -8,75 +8,95 @@
*
*/
// 居中按钮样式
@mixin btn-center($width, $height) {
width: $width;
height: $height;
line-height: $height;
text-align: center;
}
// 超过多少行自动省略 默认一行
@mixin ellipsis($line:1) {
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp: $line;
overflow: hidden;
text-overflow: ellipsis;
}
// 文字截取
@mixin text-overflow() {
overflow: hidden;
white-space: normal;
text-overflow: ellipsis;
word-break: break-all;
word-wrap: normal;
overflow: hidden;
white-space: normal;
text-overflow: ellipsis;
word-break: break-all;
word-wrap: normal;
}
@mixin word-break() {
word-break: break-all;
word-wrap: break-word;
white-space: normal;
word-break: break-all;
word-wrap: break-word;
white-space: normal;
}
// No wrap
@mixin no-wrap() {
word-break: normal;
word-wrap: normal;
white-space: nowrap;
word-break: normal;
word-wrap: normal;
white-space: nowrap;
}
// 清除浮动
@mixin clearfix() {
&:before,
&:after {
content: " "; // 1
display: table; // 2
}
&:after {
clear: both;
}
&:before,
&:after {
content: " "; // 1
display: table; // 2
}
&:after {
clear: both;
}
}
// Single side border-radius
@mixin border-top-radius($radius) {
border-top-right-radius: $radius;
border-top-left-radius: $radius;
border-top-right-radius: $radius;
border-top-left-radius: $radius;
}
@mixin border-right-radius($radius) {
border-bottom-right-radius: $radius;
border-top-right-radius: $radius;
border-bottom-right-radius: $radius;
border-top-right-radius: $radius;
}
@mixin border-bottom-radius($radius) {
border-bottom-right-radius: $radius;
border-bottom-left-radius: $radius;
border-bottom-right-radius: $radius;
border-bottom-left-radius: $radius;
}
@mixin border-left-radius($radius) {
border-bottom-left-radius: $radius;
border-top-left-radius: $radius;
border-bottom-left-radius: $radius;
border-top-left-radius: $radius;
}
// Center-align a block level element
@mixin center-block() {
display: block;
margin-left: auto;
margin-right: auto;
display: block;
margin-left: auto;
margin-right: auto;
}
// CSS image replacement
// Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
@mixin hide-text() {
font-size: 0;
line-height: 0;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
font-size: 0;
line-height: 0;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
......
......@@ -39,3 +39,5 @@ $fontSizeSmall: 28px;
$fontSizeSmaller: 24px;
$fontSizeLarge: 36px;
$fontSizeLarger: 44px;
$pageBottom:80px;
......
Component({
properties: {
// 这里定义了innerText属性,属性值可以在组件使用时指定
innerText: {
type: String,
value: 'default value',
}
},
data: {
// 这里是一些组件内部数据
someData: {}
},
methods: {
// 这里是一个自定义方法
customMethod() {
this.triggerEvent('evtcomp', {
name: "_evt_custom"
})
},
// 隐藏蒙层
hideMask() {
this.triggerEvent('evtcomp', {
name: "_evt_hide_authorize"
});
}
}
})
.comp-item{
width: 557px;
height: 505px;
border-radius: 10px;
background-color: #ffffff;
}
<view class="comp-item">
</view>
......@@ -12,6 +12,16 @@ Component({
},
methods: {
// 这里是一个自定义方法
customMethod() {}
customMethod() {
this.triggerEvent('evtcomp', {
name: "_evt_custom"
})
},
// 隐藏蒙层
hideMask() {
this.triggerEvent('evtcomp', {
name: "_evt_hide_product_detail_mask"
});
}
}
})
......
<view class="demo-item">demo-item</view>
<view class="comp-item">comp-item</view>
......
Component({
properties: {
// 这里定义了innerText属性,属性值可以在组件使用时指定
innerText: {
type: String,
value: 'default value',
}
},
data: {
// 这里是一些组件内部数据
someData: {}
},
methods: {
// 这里是一个自定义方法
customMethod() {
this.triggerEvent('evtcomp', {
name: "_evt_custom"
})
},
// 隐藏蒙层
hideMask() {
this.triggerEvent('evtcomp', {
name: "_evt_hide_product_detail_mask"
});
}
}
})
.comp-item {
.bg {
position: absolute;
width: 654px;
height: 911px;
}
}
<view class="comp-item">
<image class="bg" src="../../image/rule/rule_c1.png" mode="widthFix" />
</view>
module.exports = {
mockApi: 'http://mock.simonfungc.com',
Dev: {
baseApi: 'https://dev-api.xxx.com'
baseApi: 'https://ow.go.qudone.com'
},
Test: {
baseApi: 'https://test-api.xxx.com'
......@@ -10,6 +10,6 @@ module.exports = {
baseApi: 'https://slave-api.xxx.com'
},
Prod: {
baseApi: 'https://api.xxx.com'
baseApi: 'https://api.k.wxpai.cn/bizproxy'
}
}
......
module.exports = {
index: '/xxx/index', // Index 接口
decrypt: '/xxx/decrypt', // 解析用户信息
login: '/warubiEyeCreamApi/app/login', // 通过wxcode换取sessionId
index: '/warubiEyeCreamApi/app/index', // Index 接口
register: '/warubiEyeCreamApi/app/register', // 注册(用户授权)
}
......
let config = require('./../config');
let Store = require('./../utils/stroage');
const reason = '服务异常,请稍后重试';
let Router = require('./../router/index');
const errMsg = '服务异常,请稍后重试';
// 检查并获取sessionid sid:是否需要验证sessionId
function checkSessionId(sid) {
return new Promise((resolve, reject) => {
if (!sid) {
resolve();
return;
}
let sessionId = Store.getItem('sessionId');
if (sessionId) {
resolve(sessionId);
} else {
// 身份失效
//登陆失效的回调
// Store.clear("sessionId");
// wx.reLaunch({
// // url: '/pages/authorize/authorize'
// url: '/pages/login/login',
// })
}
});
// 检查并获取sessionid
function checkSessionId() {
return new Promise((resolve, reject) => {
let sessionId = Store.getItem('sessionId');
if (sessionId) {
resolve();
} else {
// 没有sessionId则获取并埋值
wx.login({
success: function (res) {
console.log("wxlogin:", res);
Store.setItem('wxcode', res.code);
let baseUrl = config.NET_CONFIG.baseApi;
wx.request({
url: baseUrl + '/warubiEyeCreamApi/app/login',
data: {
code: res.code
},
method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
// header: {}, // 设置请求的 header
success: function (res2) {
let {
code,
content
} = res2.data;
if (code == 200 && content.sessionId) {
Store.setItem('sessionId', content.sessionId);
resolve();
} else {
wx.showToast({
title: errMsg,
icon: 'none'
});
reject();
}
// console.log("sid:", Store.getItem('sessionId'));
// resolve();
}
})
}
});
}
});
}
const fetch = function ({
loading = false,
toast = true,
sid = true,
mode,
isMock,
url,
data,
method
loading = false,
toast = true,
sid = true,
auth = true,
mode,
isMock,
url,
data,
method
}) {
// 自定义参数
// const clientInfo = {
// user_id: 1
// }
// 日志埋点不需要出现loading
if (loading && mode != 'log') wx.showLoading();
// if (loading && mode != 'log') Util.showLoading();
// 自定义参数
// const clientInfo = {
// user_id: 1
// }
// 日志埋点不需要出现loading
if (loading && mode != 'log') wx.showLoading();
// if (loading && mode != 'log') Util.showLoading();
// 新建promise对象
let promise = new Promise((resolve, reject) => {
/**
* isMock设置单个接口Mock开启
* mode:目前针对不同业务的接口进行处理,log标识本地埋点上传
*/
let baseUrl = config.NET_CONFIG.baseApi;
if (isMock && mode != 'log') {
baseUrl = config.MOCKAPI; //环境配置
}
// 新建promise对象
let promise = new Promise((resolve, reject) => {
/**
* isMock设置单个接口Mock开启
* mode:目前针对不同业务的接口进行处理,log标识本地埋点上传
*/
let baseUrl = config.NET_CONFIG.baseApi;
if (isMock && mode != 'log') {
baseUrl = config.MOCKAPI; //环境配置
}
checkSessionId().then((result) => {
if (sid) {
url += "?sessionId=" + Store.getItem("sessionId")
}
// console.log("url:", url);
wx.request({
url: baseUrl + url, //请求地址
data: data, //自定义参数
method: method || 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
// header: {}, // 设置请求的 header的默认参数,根据项目需求添加
// header: {
// 'clientInfo': JSON.stringify(clientInfo),
// 'Server-Token':'xxx'
// },
success: function (result) {
// 日志上传不需要处理结果
if (mode == 'log') return;
let res = result.data;
// 登陆失效拦截,根据项目需要添加自己的配置
if (res.code == 404) {
// wx.showToast({
// title: '当前登陆失效,请重新登陆',
// icon: 'none',
// mask: true,
// success: () => {
// return;
// }
// })
//登陆失效的回调
Store.clear("sessionId");
wx.reLaunch({
url: '/pages/authorize/authorize'
})
}
// 内部统一的成功code拦截码
if (res.code === 200) {
if (loading) {
wx.hideLoading();
}
// resolve(res);
// 直接返回content
resolve(res.content);
} else {
// 有些特殊状况不需要toast 需要弹窗
if (toast) {
wx.showToast({
title: res.errMsg || errMsg,
icon: 'none'
})
} else {
wx.hideLoading();
}
// 返回错误信息
reject(res);
}
},
fail: function (e = {
CODE: -1,
msg: errMsg,
errMsg
}) {
let msg = e.errMsg;
if (e.errMsg == 'request:fail timeout') {
msg = '服务请求超时,请稍后重试'
}
wx.showToast({
title: msg,
icon: 'none'
});
reject(e)
},
complete: function () {
// complete
}
})
})
checkSessionId().then((result) => {
// if (sid) {
// url += "?sessionId=" + Store.getItem("sessionId")
// }
// url += "?sessionId=" + Store.getItem("sessionId")
// console.log("url:", url);
wx.request({
url: baseUrl + url, //请求地址
data: data, //自定义参数
method: method || 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: {
sessionId: Store.getItem("sessionId")
}, // 设置请求的 header的默认参数,根据项目需求添加
// header: {
// 'clientInfo': JSON.stringify(clientInfo),
// 'Server-Token':'xxx'
// },
success: function (result) {
// 日志上传不需要处理结果
if (mode == 'log') return;
let res = result.data;
// 登陆失效拦截,根据项目需要添加自己的配置
if (res.code == 404) {
// wx.showToast({
// title: '当前登陆失效,请重新登陆',
// icon: 'none',
// mask: true,
// success: () => {
// return;
// }
// })
//登陆失效的回调
Store.clear("sessionId");
wx.reLaunch({
url: '/pages/authorize/authorize'
})
return;
});
return promise;
// Router.push({
// path: "authorize",
// openType: "reLaunch",
// query: {
// status: '404'
// }
// })
}
// 内部统一的成功code拦截码
if (res.code === 200) {
if (loading) {
wx.hideLoading();
}
// resolve(res);
// 直接返回content
resolve(res.content);
} else {
// 有些特殊状况不需要toast 需要弹窗
if (toast) {
wx.showToast({
title: res.errMsg || errMsg,
icon: 'none'
})
} else {
wx.hideLoading();
}
// 返回错误信息
reject(res);
}
},
fail: function (e = {
CODE: -1,
msg: errMsg,
errMsg
}) {
let msg = e.errMsg;
if (e.errMsg == 'request:fail timeout') {
msg = '服务请求超时,请稍后重试'
}
wx.showToast({
title: msg,
icon: 'none'
});
reject(e)
},
complete: function () {
// complete
}
})
})
});
return promise;
}
module.exports = {
fetch
fetch
}
......
......@@ -2,79 +2,82 @@ let app = getApp();
let config = require('../../config');
Page({
data: {
authorized: true,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
onLoad(options) {},
onReady() {
wx.showLoading();
this.autoAuth();
},
bindGetUserInfo(e) {
wx.showLoading();
this.getUserInfo(e.detail);
},
// 点openType==userInfo 手动登陆
getUserInfo(e) {
let _this = this;
// 直接就能拿到 userInfo
app.globalData.userInfo = e.userInfo;
wx.login({
success: function (res) {
app.post({
url: app.api.decrypt,
data: {
encryptedData: e.encryptedData,
iv: e.iv,
code: res.code
}
}).then((res2) => {
_this.autoAuth();
}).catch((err) => {})
}
});
},
// 刷新首页数据
refreshIndexData() {
return new Promise((resolve, reject) => {
app.post({
url: app.api.index,
data: {}
}).then((res) => {
app.globalData.indexInfo = res;
resolve(res)
}).catch((err) => {
console.log("index err:", err);
});
});
},
// 判断结果去首页
autoAuth() {
// 调用自动登陆方法
let _this = this;
this.refreshIndexData().then((result) => {
let indexInfo = app.globalData.indexInfo;
// 自动登陆成功
let loginSuc = true;
if (loginSuc) {
// 登陆成功跳转到首页
setTimeout(() => {
app.router.push({
path: 'index',
query: {},
duration: 0,
openType: "redirect"
})
wx.hideLoading();
}, 3000);
} else {
// 登陆失败,隐藏loading自动登陆
wx.hideLoading();
this.setData({
authorized: false
})
}
});
}
data: {
authorized: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
onShareAppMessage() {},
onReady() {
wx.showLoading();
this.autoAuth();
},
onLoad(options) {},
onShow() {},
bindGetUserInfo(e) {
wx.showLoading();
this.getUserInfo(e.detail);
},
getUserInfo(e) {
let _this = this;
app.globalData.userInfo = e.userInfo;
app.post({
url: app.api.register,
sid: false,
data: {
encryptedData: e.encryptedData,
iv: e.iv,
code: app.globalData.wxcode,
tlMemberCode: app.globalData.tlMemberCode
}
}).then((res2) => {
_this.autoAuth();
}).catch((err) => {})
},
// 刷新首页数据
refreshIndexData() {
return new Promise((resolve, reject) => {
app.post({
url: app.api.index,
data: {}
}).then((res) => {
app.globalData.indexInfo = res;
resolve(res)
}).catch((err) => {
console.log("index err:", err);
});
});
},
// 自动授权
autoAuth() {
let _this = this;
this.refreshIndexData().then((result) => {
if (result.isNeedAuth == 1) {
// 未授权
wx.login({
success: function (res) {
app.store.setItem("wxcode", res.code);
}
});
wx.hideLoading();
_this.setData({
authorized: false
})
} else {
// 已经授权
// setTimeout(() => {
_this.toIndex();
wx.hideLoading();
// }, 2000);
}
});
},
// 跳转到首页
toIndex() {
app.router.push({
path: "index",
openType: "redirect"
})
wx.hideLoading();
}
})
......
@import '../../assets/scss/mixins';
.page {
position: relative;
overflow: hidden;
position: relative;
overflow: hidden;
.bgc {}
.bgc {
// background-color: transparent;
// background-color: black;
background-color: #fafafc;
}
.bg {}
.main {
position: relative;
.top-space {
height: 60px;
}
.main {
.login-wrap {
padding-top: 946px;
.login {
position: relative;
width: 650px;
margin: 0 auto;
text-align: center;
.login-btn {
width: 340px;
height: 80px;
line-height: 80px;
border-radius: 40px;
border: solid 3px #4bc2ed;
margin: 0 auto;
font-size: 36px;
color: #4bc2ed;
text-align: center;
background-color: transparent;
}
}
}
&-logo {
width: 140px;
height: 140px;
}
&-name {
margin-top: 32px;
font-size: 32px;
color: #333333;
}
&-line {
margin-top: 70px;
width: 650px;
height: 2px;
background-color: #eaeaec;
}
&-title {
margin-top: 40px;
font-size: 32px;
text-align: left;
color: #333333;
}
&-tips {
margin-top: 28px;
font-size: 26px;
text-align: left;
color: #666666;
}
&-btn {
margin-top: 102px;
width: 650px;
height: 90px;
line-height: 90px;
border-radius: 8px;
background-color: #00c200;
font-size: 32px;
color: #ffffff;
}
}
}
}
......
<navbar navbar-data='{{navbarData}}'></navbar>
<view style='height: {{barHeight}}px'></view>
<view class="page-authorize page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="login-wrap">
<button class="login-btn" wx:if="{{!authorized}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">
同意微信授权
</button>
</view>
</view>
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="login">
<image class="login-logo" src="../../image/logo.png" mode="aspectFit" />
<view class="login-name">丸美</view>
<view class="login-line"></view>
<view class="login-title">完整体验小程序功能,需要您的微信授权</view>
<view class="login-tips">· 获取您的公开信息(昵称、头像等)</view>
<button type="default" class="login-btn" wx:if="{{!authorized}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">
确认授权
</button>
</view>
</view>
</view>
......
let app = getApp();
Page({
data: {},
onShareAppMessage() {},
onLoad(options) {},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
})
{
"navigationBarTitleText": "more"
}
@import '../../assets/scss/mixins';
@import '../../assets/scss/utils';
.page {
.bgc {}
.bg {}
.main {
.top-space {
height: 0px;
}
.content {
position: relative;
}
}
}
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
</view>
let app = getApp();
Page({
data: {
ruleVisible: true,
},
onShareAppMessage() {},
onLoad(options) {}
})
{
"navigationBarTitleText": "丸美心愿单",
"usingComponents": {
"rule-comp": "../../component/rule-comp/rule-comp",
"van-popup": "../../ui/vant-weapp/popup/index"
}
}
@import '../../assets/scss/mixins';
@import '../../assets/scss/utils';
.page {
.bgc {}
.bg {}
.main {
.top-space {
height: 0px;
}
.content {
position: relative;
}
}
}
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<view class="app__content main">
<view class="top-space"></view>
<view class="content">create-wish</view>
</view>
</view>
<van-popup show="{{ ruleVisible }}">
<rule-comp bind:evtcomp="evtcomp"></rule-comp>
</van-popup>
let app = getApp();
Page({
data: {},
onLoad(options) {}
data: {},
onShareAppMessage() {},
onLoad(options) {},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
})
......
{
"navigationBarTitleText": "more"
"navigationBarTitleText": "more"
}
......
......@@ -2,17 +2,17 @@
@import '../../assets/scss/utils';
.page {
.bgc {}
.bgc {}
.bg {}
.bg {}
.main {
.top-space {
height: 0px;
}
.main {
.top-space {
height: 0px;
}
.content {
position: relative;
}
.content {
position: relative;
}
}
}
......
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
</view>
......
let app = getApp();
Page({
data: {},
onLoad(options) {}
data: {
authorized: true,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
onShareAppMessage() {},
onLoad(options) {},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
// 开始互动游戏
onStartHandler() {
let path = "createWish";
app.router.push({
path: "createWish"
})
}
})
......
{
"navigationBarTitleText": "index"
"navigationBarTitleText": "我的心愿单",
"usingComponents": {
"authorize-comp": "../../component/authorize-comp/authorize-comp",
"van-popup": "../../ui/vant-weapp/popup/index"
}
}
......
......@@ -2,17 +2,58 @@
@import '../../assets/scss/utils';
.page {
.bgc {}
.bgc {
image {
width: 100%;
height: 100%;
}
}
.bg {
image {
position: absolute;
width: 750px;
height: 1303px;
top: -130px;
}
}
.decoration {
position: relative;
.bg {}
.d1 {
position: absolute;
width: 160px;
height: 192px;
top: 0;
left: 0;
}
.d2 {
position: fixed;
width: 301px;
height: 195px;
left: 0;
bottom: 0;
}
}
.main {
.top-space {
height: 0px;
}
.main {
.top-space {
height: 1042px;
}
.content {
position: relative;
}
.content {
.btn {
position: relative;
margin: 0 auto;
@include btn-center(336px, 88px);
border-radius: 44px;
background-image: linear-gradient(to right, #b83138, #f2234a 51%, #b83138);
font-weight: 300;
font-size: 32px;
color: #fff;
}
}
}
}
......
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
<view class="app__bgc bgc">
<image src="../../image/index/index_c1.png" mode="scaleToFill" />
</view>
<view class="app__bg bg">
<image src="../../image/index/index_c2.png" mode="scaleToFill" />
</view>
<view class="decoration">
<image class="d1" src="../../image/index/index_c4.png" mode="widthFix" />
<image class="d2" src="../../image/index/index_c3.png" mode="widthFix" />
</view>
<view class="app__content main">
<view class="top-space"></view>
<view class="content">
<!-- 已授权 直接到下一步操作 -->
<button class="btn" wx:if="{{authorized}}" bindtap="onStartHandler">马上测弹力值</button>
<!-- 未授权 拉起授权弹窗 -->
<!-- <button class="btn" wx:else open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">马上测弹力值2</button> -->
</view>
</view>
</view>
<!-- <van-popup show="{{ authorizeVisible }}" >
<authorize-comp bind:evtcomp="evtcomp"></authorize-comp>
</van-popup> -->
......
let app = getApp();
Page({
data: {},
onShareAppMessage() {},
onLoad(options) {},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
})
{
"navigationBarTitleText": "more"
}
@import '../../assets/scss/mixins';
@import '../../assets/scss/utils';
.page {
.bgc {}
.bg {}
.main {
.top-space {
height: 0px;
}
.content {
position: relative;
}
}
}
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
</view>
let app = getApp();
Page({
data: {},
onShareAppMessage() {},
onLoad(options) {},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
})
{
"navigationBarTitleText": "more"
}
@import '../../assets/scss/mixins';
@import '../../assets/scss/utils';
.page {
.bgc {}
.bg {}
.main {
.top-space {
height: 0px;
}
.content {
position: relative;
}
}
}
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
</view>
let app = getApp();
Page({
data: {},
onShareAppMessage() {},
onLoad(options) {},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
})
{
"navigationBarTitleText": "more"
}
@import '../../assets/scss/mixins';
@import '../../assets/scss/utils';
.page {
.bgc {}
.bg {}
.main {
.top-space {
height: 0px;
}
.content {
position: relative;
}
}
}
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
</view>
let app = getApp();
Page({
data: {},
onShareAppMessage() {},
onLoad(options) {},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
})
{
"navigationBarTitleText": "more"
}
@import '../../assets/scss/mixins';
@import '../../assets/scss/utils';
.page {
.bgc {}
.bg {}
.main {
.top-space {
height: 0px;
}
.content {
position: relative;
}
}
}
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
</view>
let app = getApp();
Page({
data: {},
onShareAppMessage() {},
onLoad(options) {},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
})
{
"navigationBarTitleText": "more"
}
@import '../../assets/scss/mixins';
@import '../../assets/scss/utils';
.page {
.bgc {}
.bg {}
.main {
.top-space {
height: 0px;
}
.content {
position: relative;
}
}
}
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
</view>
let app = getApp();
Page({
data: {},
onShareAppMessage() {},
onLoad(options) {},
// 子组件事件
evtcomp(evt) {
let {
name,
data
} = evt.detail;
switch (name) {
case "_evt_hide":
break;
default:
break;
}
},
})
{
"navigationBarTitleText": "more"
}
@import '../../assets/scss/mixins';
@import '../../assets/scss/utils';
.page {
.bgc {}
.bg {}
.main {
.top-space {
height: 0px;
}
.content {
position: relative;
}
}
}
<view class="page">
<view class="app__bgc bgc"></view>
<view class="app__bg bg"></view>
<!-- <view class="app__top-shadow"></view> -->
<view class="app__content main">
<view class="top-space"></view>
<view class="content"></view>
</view>
</view>
const routerPath = {
index: '/pages/index/index', // 首页
wish: '/pages/wish/wish', // 创建心愿单
wish: '/pages/wish/wish', // 心愿单
createWish: '/pages/create-wish/create-wish', // 创建心愿单
newWelfare: '/pages/new-welfare/new-welfare', // 新人福利
userTable: '/pages/user-table/user-table', // 用户表单
rank: '/pages/rank/rank', // 排行榜
index: '/pages/poster/poster', // 海报页
poster: '/pages/poster/poster', // 海报页
coop: '/pages/coop/coop', // 协作页/好友查看
register: '/pages/register/register', // 注册
authorize: '/pages/authorize/authorize', // 授权
......
import { VantComponent } from '../common/component';
import { safeArea } from '../mixins/safe-area';
VantComponent({
mixins: [safeArea()],
props: {
show: Boolean,
title: String,
cancelText: String,
zIndex: {
type: Number,
value: 100
},
actions: {
type: Array,
value: []
},
overlay: {
type: Boolean,
value: true
},
closeOnClickOverlay: {
type: Boolean,
value: true
}
},
methods: {
onSelect(event) {
const { index } = event.currentTarget.dataset;
const item = this.data.actions[index];
if (item && !item.disabled && !item.loading) {
this.$emit('select', item);
}
},
onCancel() {
this.$emit('cancel');
},
onClose() {
this.$emit('close');
}
}
});
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index",
"van-popup": "../popup/index",
"van-loading": "../loading/index"
}
}
<wxs src="../wxs/utils.wxs" module="utils" />
<van-popup
show="{{ show }}"
position="bottom"
z-index="{{ zIndex }}"
overlay="{{ overlay }}"
custom-class="van-action-sheet"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
bind:close="onClose"
>
<view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header">
{{ title }}
<van-icon
name="close"
custom-class="van-action-sheet__close"
bind:click="onClose"
/>
</view>
<view wx:if="{{ actions && actions.length }}">
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
<button
wx:for="{{ actions }}"
wx:key="index"
open-type="{{ item.openType }}"
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
hover-class="van-action-sheet__item--hover"
data-index="{{ index }}"
bind:tap="onSelect"
>
<block wx:if="{{ !item.loading }}">
{{ item.name }}
<text wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</text>
</block>
<van-loading wx:else size="20px" />
</button>
</view>
<slot />
<view
wx:if="{{ cancelText }}"
class="van-action-sheet__cancel"
hover-class="van-action-sheet__cancel--hover"
hover-stay-time="70"
bind:tap="onCancel"
>
{{ cancelText }}
</view>
</van-popup>
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel:before{display:block;height:10px;background-color:#f8f8f8;content:" "}.van-action-sheet__item--disabled{color:#c9c9c9}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#7d7e80}.van-action-sheet__header{font-size:16px;font-weight:500;line-height:44px;text-align:center}.van-action-sheet__close{position:absolute!important;top:0;right:0;padding:0 15px;font-size:18px!important;line-height:inherit!important;color:#999}
\ No newline at end of file
import { VantComponent } from '../common/component';
VantComponent({
classes: ['active-class', 'toolbar-class', 'column-class'],
props: {
title: String,
value: String,
loading: Boolean,
cancelButtonText: String,
confirmButtonText: String,
itemHeight: {
type: Number,
value: 44
},
visibleItemCount: {
type: Number,
value: 5
},
columnsNum: {
type: [String, Number],
value: 3
},
areaList: {
type: Object,
value: {}
}
},
data: {
columns: [{ values: [] }, { values: [] }, { values: [] }],
displayColumns: [{ values: [] }, { values: [] }, { values: [] }]
},
watch: {
value(value) {
this.code = value;
this.setValues();
},
areaList: 'setValues',
columnsNum(value) {
this.set({
displayColumns: this.data.columns.slice(0, +value)
});
}
},
methods: {
getPicker() {
if (this.picker == null) {
this.picker = this.selectComponent('.van-area__picker');
}
return this.picker;
},
onCancel(event) {
this.emit('cancel', event.detail);
},
onConfirm(event) {
this.emit('confirm', event.detail);
},
emit(type, detail) {
detail.values = detail.value;
delete detail.value;
this.$emit(type, detail);
},
onChange(event) {
const { index, picker, value } = event.detail;
this.code = value[index].code;
this.setValues().then(() => {
this.$emit('change', {
picker,
values: picker.getValues(),
index
});
});
},
getConfig(type) {
const { areaList } = this.data;
return (areaList && areaList[`${type}_list`]) || {};
},
getList(type, code) {
let result = [];
if (type !== 'province' && !code) {
return result;
}
const list = this.getConfig(type);
result = Object.keys(list).map(code => ({
code,
name: list[code]
}));
if (code) {
// oversea code
if (code[0] === '9' && type === 'city') {
code = '9';
}
result = result.filter(item => item.code.indexOf(code) === 0);
}
return result;
},
getIndex(type, code) {
let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
const list = this.getList(type, code.slice(0, compareNum - 2));
// oversea code
if (code[0] === '9' && type === 'province') {
compareNum = 1;
}
code = code.slice(0, compareNum);
for (let i = 0; i < list.length; i++) {
if (list[i].code.slice(0, compareNum) === code) {
return i;
}
}
return 0;
},
setValues() {
const county = this.getConfig('county');
let code = this.code || Object.keys(county)[0] || '';
const province = this.getList('province');
const city = this.getList('city', code.slice(0, 2));
const picker = this.getPicker();
if (!picker) {
return;
}
const stack = [];
stack.push(picker.setColumnValues(0, province, false));
stack.push(picker.setColumnValues(1, city, false));
if (city.length && code.slice(2, 4) === '00') {
;
[{ code }] = city;
}
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
return Promise.all(stack)
.catch(() => { })
.then(() => picker.setIndexes([
this.getIndex('province', code),
this.getIndex('city', code),
this.getIndex('county', code)
]))
.catch(() => { });
},
getValues() {
const picker = this.getPicker();
return picker ? picker.getValues().filter(value => !!value) : [];
},
getDetail() {
const values = this.getValues();
const area = {
code: '',
country: '',
province: '',
city: '',
county: ''
};
if (!values.length) {
return area;
}
const names = values.map((item) => item.name);
area.code = values[values.length - 1].code;
if (area.code[0] === '9') {
area.country = names[1] || '';
area.province = names[2] || '';
}
else {
area.province = names[0] || '';
area.city = names[1] || '';
area.county = names[2] || '';
}
return area;
},
reset() {
this.code = '';
return this.setValues();
}
}
});
{
"component": true,
"usingComponents": {
"van-picker": "../picker/index"
}
}
<van-picker
class="van-area__picker"
active-class="active-class"
toolbar-class="toolbar-class"
column-class="column-class"
show-toolbar
value-key="name"
title="{{ title }}"
loading="{{ loading }}"
columns="{{ displayColumns }}"
item-height="{{ itemHeight }}"
visible-item-count="{{ visibleItemCount }}"
cancel-button-text="{{ cancelButtonText }}"
confirm-button-text="{{ confirmButtonText }}"
bind:change="onChange"
bind:confirm="onConfirm"
bind:cancel="onCancel"
/>
@import '../common/index.wxss';
\ No newline at end of file
import { VantComponent } from '../common/component';
import { isNumber } from '../common/utils';
VantComponent({
relation: {
name: 'badge',
type: 'descendant',
linked(target) {
this.badges.push(target);
this.setActive();
},
unlinked(target) {
this.badges = this.badges.filter(item => item !== target);
this.setActive();
}
},
props: {
active: {
type: Number,
value: 0
}
},
watch: {
active: 'setActive'
},
beforeCreate() {
this.badges = [];
this.currentActive = -1;
},
methods: {
setActive(badge) {
let { active } = this.data;
const { badges } = this;
if (badge && !isNumber(badge)) {
active = badges.indexOf(badge);
}
if (active === this.currentActive) {
return;
}
if (this.currentActive !== -1 && badges[this.currentActive]) {
this.$emit('change', active);
badges[this.currentActive].setActive(false);
}
if (badges[active]) {
badges[active].setActive(true);
this.currentActive = active;
}
}
}
});
<view class="van-badge-group van-hairline--top-bottom custom-class">
<slot />
</view>
@import '../common/index.wxss';.van-badge-group{width:85px}
\ No newline at end of file
import { VantComponent } from '../common/component';
VantComponent({
relation: {
type: 'ancestor',
name: 'badge-group'
},
props: {
info: null,
title: String
},
methods: {
onClick() {
const group = this.getRelationNodes('../badge-group/index')[0];
if (group) {
group.setActive(this);
}
},
setActive(active) {
this.set({ active });
}
}
});
{
"component": true,
"usingComponents": {
"van-info": "../info/index"
}
}
<wxs src="../wxs/utils.wxs" module="utils" />
<view
class="{{ utils.bem('badge', { active }) }} van-hairline custom-class"
hover-class="van-badge--hover"
hover-stay-time="70"
bind:tap="onClick"
>
<view class="van-badge__text">
<van-info
wx:if="{{ info !== null }}"
info="{{ info }}"
custom-style="right: 4px"
/>
{{ title }}
</view>
</view>
@import '../common/index.wxss';.van-badge{display:block;padding:20px 12px 20px 9px;overflow:hidden;font-size:14px;line-height:1.4;color:#7d7e80;word-break:break-all;background-color:#f8f8f8;border-left:3px solid transparent;box-sizing:border-box;-webkit-user-select:none;user-select:none}.van-badge--hover{background-color:#f2f3f5}.van-badge:after{border-bottom-width:1px}.van-badge--active{font-weight:700;color:#333;border-color:#f44}.van-badge--active:after{border-right-width:1px}.van-badge--active,.van-badge--active.van-badge--hover{background-color:#fff}.van-badge__text{position:relative}
\ No newline at end of file
import { VantComponent } from '../common/component';
import { button } from '../mixins/button';
import { openType } from '../mixins/open-type';
VantComponent({
mixins: [button, openType],
classes: ['hover-class', 'loading-class'],
props: {
plain: Boolean,
block: Boolean,
round: Boolean,
square: Boolean,
loading: Boolean,
hairline: Boolean,
disabled: Boolean,
loadingText: String,
type: {
type: String,
value: 'default'
},
size: {
type: String,
value: 'normal'
},
loadingSize: {
type: String,
value: '20px'
}
},
methods: {
onClick() {
if (!this.data.disabled && !this.data.loading) {
this.$emit('click');
}
}
}
});
{
"component": true,
"usingComponents": {
"van-loading": "../loading/index"
}
}
\ No newline at end of file
<wxs src="../wxs/utils.wxs" module="utils" />
<button
id="{{ id }}"
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
open-type="{{ openType }}"
hover-class="van-button--active hover-class"
lang="{{ lang }}"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}"
aria-label="{{ ariaLabel }}"
bindtap="onClick"
bindgetuserinfo="bindGetUserInfo"
bindcontact="bindContact"
bindgetphonenumber="bindGetPhoneNumber"
binderror="bindError"
bindlaunchapp="bindLaunchApp"
bindopensetting="bindOpenSetting"
>
<block wx:if="{{ loading }}">
<van-loading
custom-class="loading-class"
size="{{ loadingSize }}"
color="{{ type === 'default' ? '#c9c9c9' : '' }}"
/>
<view
wx:if="{{ loadingText }}"
class="van-button__loading-text"
>
{{ loadingText }}
</view>
</block>
<slot wx:else />
</button>
@import '../common/index.wxss';.van-button{position:relative;display:inline-block;height:44px;padding:0;font-size:16px;line-height:42px;text-align:center;vertical-align:middle;box-sizing:border-box;border-radius:2px;-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;background-color:#000;border:inherit;border-color:#000;border-radius:inherit;content:" ";opacity:0;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#333;background-color:#fff;border:1px solid #eee}.van-button--primary{color:#fff;background-color:#07c160;border:1px solid #07c160}.van-button--info{color:#fff;background-color:#1989fa;border:1px solid #1989fa}.van-button--danger{color:#fff;background-color:#f44;border:1px solid #f44}.van-button--warning{color:#fff;background-color:#ff976a;border:1px solid #ff976a}.van-button--plain{background-color:#fff}.van-button--plain.van-button--primary{color:#07c160}.van-button--plain.van-button--info{color:#1989fa}.van-button--plain.van-button--danger{color:#f44}.van-button--plain.van-button--warning{color:#ff976a}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{height:30px;min-width:60px;padding:0 8px;font-size:12px;line-height:28px}.van-button--mini{display:inline-block;width:50px;height:22px;font-size:10px;line-height:20px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:block;width:100%}.van-button--round{border-radius:10em}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5}.van-button__loading-text{margin-left:5px;display:inline-block;vertical-align:middle}.van-button--hairline{border-width:0;padding-top:1px}.van-button--hairline:after{border-width:1px;border-color:inherit;border-radius:4px}.van-button--hairline.van-button--round:after{border-radius:10em}.van-button--hairline.van-button--square:after{border-radius:0}
\ No newline at end of file
import { link } from '../mixins/link';
import { VantComponent } from '../common/component';
VantComponent({
classes: [
'num-class',
'desc-class',
'thumb-class',
'title-class',
'price-class',
'origin-price-class',
],
mixins: [link],
props: {
tag: String,
num: String,
desc: String,
thumb: String,
title: String,
price: String,
centered: Boolean,
lazyLoad: Boolean,
thumbLink: String,
originPrice: String,
thumbMode: {
type: String,
value: 'aspectFit'
},
currency: {
type: String,
value: '¥'
}
},
methods: {
onClickThumb() {
this.jumpLink('thumbLink');
}
}
});
{
"component": true,
"usingComponents": {
"van-tag": "../tag/index"
}
}
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="custom-class van-card">
<view class="{{ utils.bem('card__header', { center: centered }) }}">
<view class="van-card__thumb" bind:tap="onClickThumb">
<image
wx:if="{{ thumb }}"
src="{{ thumb }}"
mode="{{ thumbMode }}"
lazy-load="{{ lazyLoad }}"
class="van-card__img thumb-class"
/>
<slot name="thumb" />
<van-tag
wx:if="{{ tag }}"
mark
type="danger"
custom-class="van-card__tag"
>
{{ tag }}
</van-tag>
</view>
<view class="van-card__content">
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
<slot wx:else name="title" />
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
<slot wx:else name="desc" />
<slot name="tags" />
<view class="van-card__bottom">
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
</view>
</view>
</view>
<view class="van-card__footer">
<slot name="footer" />
</view>
</view>
@import '../common/index.wxss';.van-card{position:relative;padding:5px 15px;font-size:12px;color:#333;background-color:#fafafa;box-sizing:border-box}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;width:90px;height:90px;margin-right:10px;-webkit-flex:none;flex:none}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%}.van-card__content{position:relative;min-width:0;-webkit-flex:1;flex:1}.van-card__desc,.van-card__title{word-break:break-all}.van-card__title{font-weight:700;line-height:16px}.van-card__desc{color:#7d7e80}.van-card__bottom,.van-card__desc{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#f44}.van-card__origin-price{display:inline-block;margin-left:5px;font-size:10px;color:#7d7e80;text-decoration:line-through}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{width:100%;text-align:right;-webkit-flex:none;flex:none}
\ No newline at end of file
import { VantComponent } from '../common/component';
VantComponent({
props: {
title: String,
border: {
type: Boolean,
value: true
}
}
});
{
"component": true
}
\ No newline at end of file