├── README.md
├── app.js
├── app.json
├── app.wxss
├── images
├── add.png
├── camera.png
├── choose.png
├── codebg0.png
├── codebg1.png
├── codebg2.png
├── codebg3.png
├── codebg4.png
├── codebg5.png
├── codebg6.png
├── cue_btn.png
├── customer.png
├── customer2.png
├── happy.svg
├── icon-down.svg
├── icon-start.png
├── icon-toBalance.png
├── icon-toIndex.png
├── icon-toShare.png
├── icon-wh.png
├── icon-yh.png
├── more.png
├── nav-1.png
├── nav-2.png
├── nav-3.png
├── open.png
├── open2.png
├── play-icon.gif
├── redtips.png
├── redtips5.png
├── redtips6.png
├── stencil01.png
├── stencil02.png
├── stencil03.png
├── stencil04.png
├── stencil05.png
├── stencil06.png
├── tan1.png
├── tan2.png
├── tan3.png
├── time1.png
├── time2.png
├── updown-arrows.png
└── upload.png
├── pages
├── balance
│ ├── balance.js
│ ├── balance.json
│ ├── balance.wxml
│ └── balance.wxss
├── compose
│ ├── compose.js
│ ├── compose.json
│ ├── compose.wxml
│ └── compose.wxss
├── cutImgs
│ ├── cutImgs.js
│ ├── cutImgs.json
│ ├── cutImgs.wxml
│ └── cutImgs.wxss
├── help
│ ├── help.js
│ ├── help.json
│ ├── help.wxml
│ └── help.wxss
├── image-cropper
│ ├── image-cropper.js
│ ├── image-cropper.json
│ ├── image-cropper.wxml
│ └── image-cropper.wxss
├── index
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── logs
│ ├── logs.js
│ ├── logs.json
│ ├── logs.wxml
│ └── logs.wxss
├── record
│ ├── record.js
│ ├── record.json
│ ├── record.wxml
│ └── record.wxss
├── recordDetails
│ ├── recordDetails.js
│ ├── recordDetails.json
│ ├── recordDetails.wxml
│ └── recordDetails.wxss
├── redpacket
│ ├── redpacket.js
│ ├── redpacket.json
│ ├── redpacket.wxml
│ └── redpacket.wxss
├── report
│ ├── report.js
│ ├── report.json
│ ├── report.wxml
│ └── report.wxss
├── select
│ ├── select.js
│ ├── select.json
│ ├── select.wxml
│ └── select.wxss
└── share
│ ├── share.js
│ ├── share.json
│ ├── share.wxml
│ └── share.wxss
├── preview
├── 3701559631867_.pic.jpg
├── 3711559631868_.pic.jpg
├── 3721559631869_.pic.jpg
├── 3731559631870_.pic.jpg
├── 3741559631871_.pic.jpg
├── 3751559631872_.pic.jpg
├── 3761559632109_.pic.jpg
├── ht1.png
├── ht2.png
├── ht3.png
└── ht4.png
├── sitemap.json
├── utils
├── md5.js
└── util.js
└── we-cropper
├── we-cropper.js
└── we-cropper.wxml
/README.md:
--------------------------------------------------------------------------------
1 | # redpacket
2 | PHP后台微信小程序、拼图红包、支持微信企业支付到零钱
3 | ## 一、数据库及后台源码:
4 | ### 整套前端加后台价钱:300元(砍价既浪费时间又伤感情,请勿砍价;价格不是第一要素,质量靠谱才最重要。无加密代码、无混淆代码。)
5 |
6 | ### 联系QQ:1335244575 (备注:拼图红包后台)
7 | ## 二、Demo:
8 | ![包你拼小程序][1]
9 |
10 |
11 | [1]: https://img.91ud.com/FryRd2QwbK6dEpuPRjE4uhjec-9P/256
12 |
13 | ## 三、小程序截图:
14 | ![包你拼小程序][2]
15 |
16 |
17 | [2]: https://raw.githubusercontent.com/hellosee/redpacket/master/preview/3701559631867_.pic.jpg
18 |
19 | ![包你拼小程序][3]
20 |
21 |
22 | [3]: https://raw.githubusercontent.com/hellosee/redpacket/master/preview/3711559631868_.pic.jpg
23 |
24 |
25 | ![包你拼小程序][4]
26 |
27 |
28 | [4]: https://raw.githubusercontent.com/hellosee/redpacket/master/preview/3731559631870_.pic.jpg
29 | ![包你拼小程序][5]
30 |
31 |
32 | [5]: https://raw.githubusercontent.com/hellosee/redpacket/master/preview/3741559631871_.pic.jpg
33 |
34 | ![包你拼小程序][6]
35 |
36 |
37 | [6]: https://raw.githubusercontent.com/hellosee/redpacket/master/preview/3751559631872_.pic.jpg
38 |
39 | ![包你拼小程序][7]
40 |
41 |
42 | [7]: https://raw.githubusercontent.com/hellosee/redpacket/master/preview/3761559632109_.pic.jpg
43 |
44 | ## 四、后台展示图:
45 | ![包你拼小程序][8]
46 |
47 |
48 | [8]: https://raw.githubusercontent.com/hellosee/redpacket/master/preview/ht1.png
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | //app.js
2 | var md5 = require('utils/md5.js')
3 | var loginInfo={};
4 | App({
5 | setConfig: {
6 | url: '',
7 | hb_appid: 'hb_gnpu',
8 | hb_appsecret: 'KXsC5gqCr52O2nDw'
9 | },
10 | onLaunch: function () {
11 | this.userLogin();
12 | },
13 | globalData: {
14 | userInfo: null,
15 | token:'',
16 | timer: null,
17 | indexHots: [],
18 | s:'',
19 | myDevice: null
20 | },
21 | getSign: function () {
22 | var timestamp = Math.round(new Date().getTime() / 1000);
23 | var sign = md5.md5(this.setConfig.hb_appid + this.setConfig.hb_appsecret + timestamp);
24 | sign = md5.md5(sign + this.setConfig.hb_appsecret);
25 | return { appid: this.setConfig.hb_appid, timestamp: timestamp, sign: sign };
26 | },
27 | //登录
28 | userLogin: function(){
29 | var that = this;
30 | var codes;
31 | //获取登录code
32 | wx.login({
33 | success: function (res) {
34 | // console.log(res.code);return false;
35 | if (res.code) {
36 | loginInfo.code = res.code;
37 | codes = res.code;
38 | //获取用户信息
39 | wx.getSetting({
40 | success: res => {
41 | if (res.authSetting['scope.userInfo']) {
42 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
43 | wx.getUserInfo({
44 | success: res => {
45 | // 可以将 res 发送给后台解码出 unionId
46 | var infoUser = '';
47 | that.globalData.userInfo = infoUser = res.userInfo;
48 | // 所以此处加入 callback 以防止这种情况
49 | if (that.userInfoReadyCallback) {
50 | that.userInfoReadyCallback(res)
51 | }
52 | //用户信息入库
53 | var url = that.setConfig.url + '/index.php/User/login/dologin';
54 | var data = {
55 | user_name: infoUser.nickName,
56 | nick_name: infoUser.nickName,
57 | head_img: infoUser.avatarUrl,
58 | sex: infoUser.gender,
59 | coutry: infoUser.country,
60 | city: infoUser.city,
61 | province: infoUser.province,
62 | code: codes,
63 | }
64 | that.postLogin(url, data);
65 | }
66 | })
67 | }else{
68 | wx.authorize({
69 | scope: 'scope.userInfo',
70 | success: res => {
71 | // 用户同意
72 | wx.getUserInfo({
73 | success: res => {
74 | // 可以将 res 发送给后台解码出 unionId
75 | var infoUser = '';
76 | that.globalData.userInfo = infoUser = res.userInfo;
77 | // 所以此处加入 callback 以防止这种情况
78 | if (that.userInfoReadyCallback) {
79 | that.userInfoReadyCallback(res)
80 | }
81 | //用户信息入库
82 | var url = that.setConfig.url + '/index.php/User/login/dologin';
83 | var data = {
84 | user_name: infoUser.nickName,
85 | nick_name: infoUser.nickName,
86 | head_img: infoUser.avatarUrl,
87 | sex: infoUser.gender,
88 | coutry: infoUser.country,
89 | city: infoUser.city,
90 | province: infoUser.province,
91 | code: codes,
92 | }
93 | that.postLogin(url, data);
94 | }
95 | })
96 | }
97 | })
98 | }
99 | }
100 | });
101 | } else {
102 | that.userLogin();
103 | return false;
104 | }
105 | }
106 | })
107 | },
108 |
109 | //提交
110 | postLogin: function (url,data,callback=function(){}){
111 | var that = this;
112 | var signData = this.getSign();
113 | data.sign = signData.sign;
114 | data.timestamp = signData.timestamp;
115 | //发起网络请求
116 | wx.request({
117 | url: url,
118 | data: data,
119 | method: 'POST',
120 | header: { 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' },
121 | success: function (res) {
122 | if (res.data.code != 20000) {
123 | wx.showToast({
124 | title: res.data.msg,
125 | icon: 'loading',
126 | duration: 1500
127 | })
128 | if (res.data.code == 40500) { callback(res); }
129 | return false;
130 | }
131 | if (res.data.token) { that.globalData.token = res.data.token; }
132 | callback(res);
133 | }
134 | })
135 | }
136 | })
137 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/redpacket/redpacket",
5 |
6 |
7 |
8 | "pages/select/select",
9 | "pages/compose/compose",
10 | "pages/share/share",
11 | "pages/recordDetails/recordDetails",
12 | "pages/balance/balance",
13 | "pages/record/record",
14 | "pages/report/report",
15 | "pages/help/help",
16 | "pages/logs/logs",
17 | "pages/image-cropper/image-cropper",
18 | "pages/cutImgs/cutImgs"
19 |
20 | ],
21 | "window": {
22 | "backgroundTextStyle": "light",
23 | "navigationBarBackgroundColor": "#dc6142",
24 | "navigationBarTitleText": "",
25 | "navigationBarTextStyle": "white"
26 | },
27 | "sitemapLocation": "sitemap.json"
28 | }
--------------------------------------------------------------------------------
/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | page{
3 | min-height: 100%;
4 | background:#f1f1f1;
5 | }
6 | .container {
7 | height: 100%;
8 | font-size: 28rpx;
9 | }
10 | .sqbtn{
11 | display: none;
12 | width: 272rpx;
13 | height: 88rpx;
14 | position: fixed;
15 | left: 50%;
16 | top: 50%;
17 | margin-left: -136rpx;
18 | margin-top: -44rpx;
19 | background: transparent;
20 | border: none
21 | }
22 | .sqbtn::after {
23 | display: none;
24 | }
25 | .zhygg{
26 | min-width: 320rpx;
27 | margin: 30rpx 0;
28 | padding-top: 56rpx;
29 | font-size: 26rpx;
30 | color: #bbb;
31 | text-align: center;
32 | display: none;
33 | }
34 | .zhygg view{
35 | display: block
36 | }
37 | .zhygg text{
38 | color: #364a79;
39 | }
40 | .hover-submit{
41 | opacity: .8
42 | }
43 | button{
44 | border: none;
45 | padding: 0;
46 | margin: 0;
47 | font-size: 28rpx;
48 | }
49 | button::after{
50 | display: none;
51 | }
52 | .hover-submit{
53 | opacity: .7
54 | }
55 | .hover-btn{
56 | background: #cccccc !important;
57 | }
58 | .hover-btn2{
59 | background: #eeeeee !important;
60 | }
61 | .clrs{
62 | color: #fedeb2;
63 | }
64 | .fl {
65 | float: left;
66 | }
67 | .fr {
68 | float: right;
69 | }
70 | .clearfix:after {
71 | content: '';
72 | display: block;
73 | height: 0;
74 | overflow: hidden;
75 | clear: both;
76 | }
77 | .center-block {
78 | display: block;
79 | margin: 0 auto;
80 | }
81 | .btn_share {
82 | display: block;
83 | margin:0 auto;
84 | padding: 0;
85 | background-color: transparent;
86 | border: 1px solid transparent;
87 | outline: none;
88 | overflow: visible;
89 | position: relative;
90 | z-index: 0
91 | }
92 | .btn_share::after {
93 | display: none;
94 | }
95 | .item_bg {
96 | position: absolute;
97 | top: 0;
98 | left: 0;
99 | }
100 | .btn-kf {
101 | position: absolute;
102 | display: block;
103 | width: 100%;
104 | height: 100%;
105 | left: 0;
106 | top: 0;
107 | opacity: 0;
108 | }
--------------------------------------------------------------------------------
/images/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/add.png
--------------------------------------------------------------------------------
/images/camera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/camera.png
--------------------------------------------------------------------------------
/images/choose.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/choose.png
--------------------------------------------------------------------------------
/images/codebg0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/codebg0.png
--------------------------------------------------------------------------------
/images/codebg1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/codebg1.png
--------------------------------------------------------------------------------
/images/codebg2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/codebg2.png
--------------------------------------------------------------------------------
/images/codebg3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/codebg3.png
--------------------------------------------------------------------------------
/images/codebg4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/codebg4.png
--------------------------------------------------------------------------------
/images/codebg5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/codebg5.png
--------------------------------------------------------------------------------
/images/codebg6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/codebg6.png
--------------------------------------------------------------------------------
/images/cue_btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/cue_btn.png
--------------------------------------------------------------------------------
/images/customer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/customer.png
--------------------------------------------------------------------------------
/images/customer2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/customer2.png
--------------------------------------------------------------------------------
/images/happy.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/icon-down.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/icon-start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/icon-start.png
--------------------------------------------------------------------------------
/images/icon-toBalance.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/icon-toBalance.png
--------------------------------------------------------------------------------
/images/icon-toIndex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/icon-toIndex.png
--------------------------------------------------------------------------------
/images/icon-toShare.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/icon-toShare.png
--------------------------------------------------------------------------------
/images/icon-wh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/icon-wh.png
--------------------------------------------------------------------------------
/images/icon-yh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/icon-yh.png
--------------------------------------------------------------------------------
/images/more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/more.png
--------------------------------------------------------------------------------
/images/nav-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/nav-1.png
--------------------------------------------------------------------------------
/images/nav-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/nav-2.png
--------------------------------------------------------------------------------
/images/nav-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/nav-3.png
--------------------------------------------------------------------------------
/images/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/open.png
--------------------------------------------------------------------------------
/images/open2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/open2.png
--------------------------------------------------------------------------------
/images/play-icon.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/play-icon.gif
--------------------------------------------------------------------------------
/images/redtips.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/redtips.png
--------------------------------------------------------------------------------
/images/redtips5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/redtips5.png
--------------------------------------------------------------------------------
/images/redtips6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/redtips6.png
--------------------------------------------------------------------------------
/images/stencil01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/stencil01.png
--------------------------------------------------------------------------------
/images/stencil02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/stencil02.png
--------------------------------------------------------------------------------
/images/stencil03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/stencil03.png
--------------------------------------------------------------------------------
/images/stencil04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/stencil04.png
--------------------------------------------------------------------------------
/images/stencil05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/stencil05.png
--------------------------------------------------------------------------------
/images/stencil06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/stencil06.png
--------------------------------------------------------------------------------
/images/tan1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/tan1.png
--------------------------------------------------------------------------------
/images/tan2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/tan2.png
--------------------------------------------------------------------------------
/images/tan3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/tan3.png
--------------------------------------------------------------------------------
/images/time1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/time1.png
--------------------------------------------------------------------------------
/images/time2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/time2.png
--------------------------------------------------------------------------------
/images/updown-arrows.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/updown-arrows.png
--------------------------------------------------------------------------------
/images/upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/images/upload.png
--------------------------------------------------------------------------------
/pages/balance/balance.js:
--------------------------------------------------------------------------------
1 | //balance.js
2 | //获取应用实例
3 | const app = getApp()
4 | var minsum = 1 //最小提现金额
5 | var maxsum = 5000 //单笔最大提现金额
6 | var maxnum = 3 // 最大提现次数
7 | var num = 1 // 可以提现次数
8 |
9 | Page({
10 | data: {
11 | userInfo: {},
12 | hasUserInfo: false,
13 | token: '',
14 | canIUse: wx.canIUse('button.open-type.getUserInfo'),
15 | amount: '0.00', // 账户余额
16 | sum: '', // 提现金额
17 | rate: "", //提现手续费%
18 | rsum: '0.00' //手续费
19 | },
20 |
21 | //事件处理函数
22 | bindtapdetial: function () {
23 | wx: wx.navigateTo({
24 | url: '../blanceRecord/blanceRecord',
25 | })
26 | },
27 | bindtaphelp: function () {
28 | wx.navigateTo({
29 | url: '../help/help'
30 | })
31 | },
32 | bindtapreport: function () {
33 | wx.navigateTo({
34 | url: '../report/report'
35 | })
36 | },
37 | //全部提现
38 | entirely: function (e) {
39 | var amount = parseFloat(this.data.amount),
40 | rate = parseFloat(this.data.rate),
41 | max = Math.floor(amount * 100 / (1 + rate)) / 100;
42 | var rsum = Math.ceil(max * 100 * (1 + rate)) / 100 - parseFloat(max);
43 | rsum = rsum > parseFloat(this.data.amount) - parseFloat(max) ? parseFloat(this.data.amount) - parseFloat(max) : rsum;
44 | rsum = rsum > 0 ? rsum.toFixed(2) : '0.00';
45 | if (amount == 0) {
46 | wx.showToast({
47 | title: '没有余额',
48 | icon: 'loading',
49 | duration: 1000
50 | })
51 | } else {
52 | this.setData({
53 | sum: max.toFixed(2),
54 | rsum: rsum
55 | })
56 | }
57 | },
58 | // 提现输入框金额判断
59 | bindKeyInput: function (e) {
60 | var inp = !e ? this.data.sum * 1 : Math.round(e.detail.value * 100) / 100;
61 | var max = Math.min(parseFloat(this.data.amount), maxsum),
62 | rate = parseFloat(this.data.rate);
63 | max = Math.floor(max * 100 / (1 + rate)) / 100;
64 | if (max == 0 && inp != '') {
65 | wx.showToast({
66 | title: '没有余额',
67 | icon: 'loading',
68 | duration: 1000
69 | })
70 | }
71 | inp = inp > max ? max : inp;
72 | if (inp > 0) {
73 | inp = inp > minsum ? inp : minsum;
74 | inp = inp < max ? inp.toFixed(2) : max.toFixed(2);
75 | } else {
76 | inp = '';
77 | }
78 | var rsum = Math.ceil(inp * 100 * (1 + rate)) / 100 - parseFloat(inp);
79 | rsum = rsum > parseFloat(this.data.amount) - parseFloat(inp) ? parseFloat(this.data.amount) - parseFloat(inp) : rsum;
80 | rsum = rsum > 0 ? rsum.toFixed(2) : '0.00';
81 | this.setData({
82 | sum: inp,
83 | rsum
84 | })
85 | if (!e) {
86 | return inp
87 | }
88 | },
89 | // 表单提交
90 | formSubmit: function (e) {
91 | var that = this;
92 | var val = this.bindKeyInput() * 1;
93 | var rate = parseFloat(this.data.rate);
94 | var max = Math.min(parseFloat(this.data.amount), maxsum);
95 | max = Math.floor(max * 100 / (1 + rate)) / 100;
96 | if (num < 1) {
97 | wx.showLoading({
98 | title: '今日提现满' + maxnum + '次',
99 | mask: true,
100 | duration: 1500
101 | })
102 | return false;
103 | }
104 | val = val < max ? val : max;
105 | if (val > 0) {
106 | val = val > minsum ? val : minsum;
107 | val = val < max ? val : max;
108 | } else {
109 | val = '';
110 | let title = this.data.amount == 0 ? '没有余额' : '请输入提现金额'
111 | wx.showToast({
112 | title: title,
113 | icon: 'loading',
114 | duration: 1000
115 | })
116 | }
117 | var rsum = Math.ceil(val * 100 * (1 + rate)) / 100 - parseFloat(val);
118 | rsum = rsum > parseFloat(this.data.amount) - parseFloat(val) ? parseFloat(this.data.amount) - parseFloat(val) : rsum;
119 | rsum = rsum > 0 ? rsum : 0;
120 | if (val >= minsum) {
121 | wx.showModal({
122 | title: '提示',
123 | content: '确定提现' + val.toFixed(2) + '元?',
124 | success: function (res) {
125 | if (res.confirm) {
126 | wx.showLoading({
127 | title: '提现中•••',
128 | mask: true
129 | })
130 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Withdrawals&a=cash';
131 | var postData = {
132 | amount: val.toFixed(2),
133 | sxf: rsum.toFixed(2),
134 | token: that.data.token
135 | }
136 | app.postLogin(postUrl, postData, function (res) {
137 | if (res.data.code == 20000) {
138 | num--;
139 | wx.showToast({
140 | title: '提现成功',
141 | icon: 'success',
142 | duration: 1200
143 | })
144 | that.setData({
145 | amount: (that.data.amount - val - rsum).toFixed(2),
146 | sum: '',
147 | rsum: '0.00'
148 | })
149 | }
150 | });
151 | }
152 | }
153 | })
154 | } else if (val > 0) {
155 | wx.showLoading({
156 | title: '提现最低' + minsum + '元起',
157 | mask: true,
158 | duration: 1200
159 | })
160 | }
161 | },
162 |
163 | onLoad: function () {
164 | if (!app.globalData.token) {
165 | wx.showLoading({
166 | title: '加载中•••',
167 | mask: true
168 | })
169 | }
170 | this.loop()
171 | },
172 | loop: function () {
173 | if (!app.globalData.token) {
174 | var that = this
175 | setTimeout(function () { that.loop(); }, 100)
176 | } else {
177 | wx.hideLoading()
178 | var info = app.globalData.userInfo,
179 | tok = app.globalData.token;
180 | if (info) {
181 | this.setData({
182 | userInfo: info,
183 | token: tok,
184 | hasUserInfo: true
185 | })
186 | }
187 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Withdrawals&a=getAmountWithdrawalP',
188 | postData = {
189 | token: tok
190 | };
191 | app.postLogin(postUrl, postData, this.initial);
192 | }
193 | },
194 | initial: function (res) {
195 | if (res.data.code == 20000) {
196 | var data = res.data;
197 | var rate = !data.withdrawal_commission ? 0 : data.withdrawal_commission;
198 | minsum = !data.min_withdrawals ? 1 : data.min_withdrawals * 1;
199 | maxsum = !data.max_withdrawals ? 1000 : data.max_withdrawals * 1;
200 | maxnum = !data.max_withdrawal_time ? 5 : data.max_withdrawal_time * 1;
201 | num = !data.withdrawal_time ? 1 : data.withdrawal_time * 1;
202 | rate = rate < 1 ? rate : rate/100;
203 | this.setData({
204 | amount: data.amount,
205 | rate: rate,
206 | })
207 | }
208 | }
209 | })
210 |
--------------------------------------------------------------------------------
/pages/balance/balance.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "余额提现"
3 | }
--------------------------------------------------------------------------------
/pages/balance/balance.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {{userInfo.nickName}}
11 |
12 | 账户余额{{amount}}元
13 |
32 |
33 |
34 | 举报
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/pages/balance/balance.wxss:
--------------------------------------------------------------------------------
1 | /**balance.wxss**/
2 | page{
3 | height: 100%;
4 | }
5 | .container{
6 | height: 100%;
7 | background: #f1f1f1;
8 | }
9 | .clear-top{
10 | height: 86rpx;
11 | }
12 | .cl{
13 | clear: both;
14 | }
15 | .report{
16 | width:100%;
17 | text-align: center;
18 | position: absolute;
19 | bottom: 24rpx;
20 | line-height: 50rpx;
21 | }
22 | .report-btn{
23 | display: inline-block;
24 | font-size: 28rpx;
25 | color: #485f89;
26 | padding: 0 10rpx;
27 | }
28 |
29 | .box{
30 | width: 92%;
31 | margin: 30rpx auto 0;
32 | background: #FFF;
33 | padding-bottom: 40rpx;
34 | padding-top: 24rpx;
35 | position: relative;
36 | border-radius: 10rpx;
37 | box-shadow: 0 0 10rpx rgba(0, 0, 0, .1);
38 | color: #333;
39 | }
40 | .userinfo {
41 | display: block;
42 | text-align: center;
43 | }
44 | .userinfo-avatar {
45 | width: 140rpx;
46 | height: 140rpx;
47 | border-radius: 50%;
48 | margin-top: -90rpx;
49 | }
50 | .userinfo-name{
51 | width: 100%;
52 | font-size: 28rpx;
53 | color: #333;
54 | display:inline-block;
55 | vertical-align:middle;
56 | margin-top:6rpx;
57 | }
58 | .zhye{
59 | padding-left: 48rpx;
60 | padding-top: 60rpx;
61 | line-height: 90rpx;
62 | font-size: 32rpx;
63 | }
64 | .amount{
65 | display: inline-block;
66 | min-width: 112rpx;
67 | margin: 0 6rpx 0 56rpx;
68 | text-align: right;
69 | font-size: 60rpx;
70 | font-weight: 700;
71 | color: #333;
72 | }
73 | .unit{
74 | margin-left: 4rpx;
75 | }
76 | .txt{
77 | font-size: 32rpx;
78 | padding: 30rpx 0 10rpx;
79 | overflow: hidden;
80 | position: relative;
81 | }
82 | .txt .txt-l{
83 | float: left;
84 | width: 20%;
85 | height: 60rpx;
86 | line-height: 60rpx;
87 | padding-left: 48rpx;
88 | vertical-align: middle;
89 | }
90 | .txt-r{
91 | float: right;
92 | width: 61%;
93 | margin-right:48rpx;
94 | }
95 | .txt .txtipt{
96 | width: 100%;
97 | padding-top:0;
98 | padding-bottom: 26rpx;
99 | position: relative;
100 | }
101 | .txt text.icon{
102 | padding: 0;
103 | color: #000;
104 | font-size: 40rpx;
105 | position: absolute;
106 | left: 0;
107 | bottom: 30rpx;
108 | }
109 | .txt input{
110 | display: block;
111 | width: 86%;
112 | height: 60rpx;
113 | color: #333;
114 | margin: 0 auto;
115 | font-size: 40rpx;
116 | border-bottom:2rpx solid #D9D9D9;
117 | padding-left:50rpx;
118 |
119 | }
120 | .ts{
121 | font-size: 26rpx;
122 | color: #999;
123 | padding-left: 48rpx;
124 | }
125 | .ts text.entirely{
126 | margin-left: 8rpx;
127 | color: #364a79;
128 | }
129 | .ts2{
130 | padding-left: 0;
131 | text-align: center
132 | }
133 | .btn-area button{
134 | width: 592rpx;
135 | height: 80rpx;
136 | line-height: 80rpx;
137 | font-size: 32rpx;
138 | color: #fff;
139 | border-radius: 8rpx;
140 | margin: 40rpx auto;
141 | background:#28b265;
142 | }
143 |
144 | .question{
145 | width: 100%;
146 | font-size: 24rpx;
147 | text-align: center;
148 | color: #fff;
149 | position: absolute;
150 | bottom: 20rpx;
151 | }
152 | .adv{
153 | position: absolute;
154 | bottom: 0;
155 | left: 30rpx;
156 | }
--------------------------------------------------------------------------------
/pages/compose/compose.js:
--------------------------------------------------------------------------------
1 | //compose.js
2 | //获取应用实例
3 | const app = getApp()
4 |
5 | Page({
6 | data: {
7 | userInfo: {},
8 | canIUse: wx.canIUse('button.open-type.getUserInfo'),
9 | pid:'', // 拼图
10 | bgsrc: [
11 | '/images/codebg0.png'
12 | ], //分享图背景
13 | ownerImg: '', // 发起人头像
14 | redtips: '',
15 | colors: ['#f3e5b4'],
16 | redimgs:[
17 | '/images/redtips.png'
18 | ], // icon图片
19 | describe: '',
20 | xcxewm:'',
21 | opensrc:'',
22 | stIndex:0,
23 | stencil:[], // 模版图片
24 | stSwitch:false,
25 | relay:'发起了一个拼图夺宝游戏 >>' // 自定义转发标签
26 | },
27 |
28 | toStencil:function(){
29 | this.setData({
30 | stSwitch: true
31 | })
32 | if (this.data.stencil.length == 0){
33 | wx.showToast({
34 | title: '模版加载中',
35 | icon: 'loading',
36 | duration: 15000
37 | })
38 | }
39 | },
40 | //事件处理函数
41 | choose: function (e) {
42 | var index = e.currentTarget.dataset.index,
43 | stIndex = this.data.stIndex;
44 |
45 | if (index == stIndex) {
46 | this.setData({
47 | stIndex:0
48 | })
49 | } else {
50 | this.setData({
51 | stIndex: index,
52 | stSwitch: false
53 | })
54 | }
55 | },
56 |
57 | //生成朋友圈分享图
58 | sheng:function(){
59 | wx.showLoading({
60 | title: '分享图生成中',
61 | mask: true
62 | })
63 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=ToCode&a=get_code',
64 | postData = {
65 | token: app.globalData.token,
66 | pid: this.data.pid,
67 | back: this.data.stIndex,
68 | tit: this.data.redtips,
69 | con: this.data.describe,
70 | page: 'pages/recordDetails/recordDetails'
71 | };
72 |
73 | app.postLogin(postUrl, postData, function(res){
74 | if (res.data.code === 20000) {
75 | wx.showToast({
76 | title: '生成成功',
77 | icon: 'success',
78 | duration: 1000
79 | })
80 | var fximg = app.setConfig.url + '/' +res.data.data;
81 | wx.previewImage({
82 | current: '', // 当前显示图片的http链接
83 | urls: [fximg] // 需要预览的图片http链接列表
84 | })
85 | }
86 | });
87 |
88 | },
89 | //获取登录信息
90 | onLoad: function () {
91 | this.loop()
92 | },
93 | loop: function (){
94 | var info = app.globalData.userInfo,
95 | tok = app.globalData.token;
96 | var pid = wx.getStorageSync('SPid')
97 | var ownerImg = wx.getStorageSync('SOwnerImg')
98 | var redtips = wx.getStorageSync('SRedtips')
99 | var describe = wx.getStorageSync('SDescribe')
100 | var xcxewm = wx.getStorageSync('SXcxewm')
101 | this.setData({
102 | userInfo: info,
103 | token: tok,
104 | pid: pid,
105 | ownerImg: ownerImg,
106 | redtips: redtips,
107 | describe: describe,
108 | xcxewm: xcxewm,
109 | opensrc: '/images/open.png',
110 | hasUserInfo: true,
111 | })
112 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=ToCode&a=getSharePageInfo',
113 | postData = {
114 | token: tok
115 | };
116 | app.postLogin(postUrl, postData, this.initial);
117 | },
118 | initial:function(res){
119 | if (res.data.code == 20000){
120 | var data = res.data.data;
121 | var tpl_imgs = data.tpl_imgs,
122 | back_imgs = data.back_imgs,
123 | redtips_imgs = data.redtips_imgs,
124 | font_colors = data.font_colors,
125 | stencil = [],
126 | bgsrc = ['/images/codebg0.png'],
127 | redimgs = ['/images/redtips.png'],
128 | colors = ['#f3e5b4'];
129 | var path = app.setConfig.url+'/';
130 | for (var i = 0; i < tpl_imgs.length; i++){
131 | var stc = path + tpl_imgs[i],
132 | bgc = path + back_imgs[i],
133 | red = path + redtips_imgs[i],
134 | clr = font_colors[i];
135 | stencil.push(stc);
136 | bgsrc.push(bgc);
137 | redimgs.push(red);
138 | colors.push(clr);
139 | }
140 | this.setData({
141 | stencil,
142 | bgsrc,
143 | redimgs,
144 | colors
145 | })
146 | wx.hideToast();
147 | }
148 | }
149 | })
150 |
--------------------------------------------------------------------------------
/pages/compose/compose.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "生成分享图"
3 | }
--------------------------------------------------------------------------------
/pages/compose/compose.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{redtips}}
10 | {{describe}}
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/pages/compose/compose.wxss:
--------------------------------------------------------------------------------
1 | /**compose.wxss**/
2 | page{
3 | height: 100%;
4 | background: #f2f2f2;
5 | }
6 | .container{
7 | padding: 30rpx 0 0;
8 | margin: 0;
9 | height: auto;
10 | }
11 | .upper{
12 | width: 690rpx;
13 | height: 840rpx;
14 | margin: 0 auto;
15 | }
16 | .upper .bg{
17 | width: 100%;
18 | height: 100%;
19 | }
20 |
21 | .front{
22 | width: 100%;
23 | text-align: center;
24 | font-size: 32rpx;
25 | position: absolute;
26 | left: 0;
27 | top: 50rpx;
28 | }
29 |
30 | .front .avatar{
31 | width: 104rpx;
32 | height: 104rpx;
33 | margin: 34rpx auto 28rpx;
34 | position: relative;
35 | }
36 | .front .avatar .ownerimg{
37 | width: 100%;
38 | height: 100%;
39 | border-radius: 8rpx;
40 | }
41 | .front .avatar .owner-bg{
42 | width: 100%;
43 | height: 100%;
44 | position: relative;
45 | }
46 | .redtips text{
47 | display: inline-block;
48 | vertical-align: middle;
49 | margin-right: 8rpx;
50 | font-size: 28rpx;
51 | font-weight: 700;
52 | }
53 | .redtips image{
54 | display: inline-block;
55 | width: 30rpx;
56 | height: 32rpx;
57 | vertical-align: middle;
58 | }
59 | .front .describe{
60 | width: 580rpx;
61 | margin: 30rpx auto 0;
62 | line-height: 46rpx;
63 | font-size: 36rpx;
64 | font-weight: 700;
65 | overflow: hidden;
66 | text-overflow: ellipsis;
67 | white-space:nowrap;
68 | }
69 |
70 | .upper .ewm{
71 | width: 244rpx;
72 | height: 244rpx;
73 | border-radius: 50%;
74 | background: #f4e3b8;
75 | position: absolute;
76 | left: 50%;
77 | margin-left: -122rpx;
78 | top: 394rpx;
79 | display: flex;
80 | justify-content:center;
81 | align-items:center;
82 | }
83 | .upper .ewm .xcxewm{
84 | display: block;
85 | width: 220rpx;
86 | height: 220rpx;
87 | border-radius: 50%;
88 | overflow: hidden;
89 | }
90 | .upper .ewm .xcxewm image{
91 | width: 100%;
92 | height: 100%;
93 | }
94 | .upper .ewm .open{
95 | width: 90rpx;
96 | height: 90rpx;
97 | position: absolute;
98 | top: 50%;
99 | left: 50%;
100 | margin-top: -45rpx;
101 | margin-left: -45rpx;
102 | }
103 |
104 |
105 | .lower{
106 | width:690rpx;
107 | margin: 0 auto;
108 | padding: 10rpx 0 30rpx;
109 | text-align: center
110 | }
111 | .lower .btn{
112 | margin-top: 40rpx;
113 | }
114 | .lower .btn button{
115 | font-size: 28rpx;
116 | line-height: 80rpx;
117 | border-radius: 8rpx;
118 | }
119 | .lower .btn .retransmission{
120 | background: #1aac19;
121 | color: #fff;
122 | }
123 | .lower .btn .generate{
124 | background: #ffffff;
125 | margin-bottom: 20rpx;
126 | color: #333;
127 | box-shadow: 0 0 6rpx #ccc;
128 | }
129 |
130 |
131 | .stencil{
132 | position: fixed;
133 | top: 0;
134 | left: 0;
135 | bottom: 0;
136 | right: 0;
137 | background: #313131;
138 | }
139 | .stencil scroll-view{
140 | width: 590rpx;
141 | position: absolute;
142 | left: 80rpx;
143 | top: 70rpx;
144 | bottom: 70rpx;
145 | }
146 | .stencil_con{
147 | display: flex;
148 | flex-wrap:wrap ;
149 | justify-content:space-between;
150 | -webkit-justify-content:space-between;
151 | align-items:flex-start;
152 | }
153 | .stencil_con .ls{
154 | display: inline-block;
155 | width: 255rpx;
156 | height: 310rpx;
157 | margin-top: 66rpx;
158 | font-size: 0;
159 | position: relative;
160 | }
161 | .stencil_con .ls:first-child{
162 | margin-top: 0
163 | }
164 | .stencil_con .ls:nth-child(2){
165 | margin-top: 0
166 | }
167 | .stencil_con .ls.on::after{
168 | content: '';
169 | display: block;
170 | position: absolute;
171 | left: 0;
172 | top: 0;
173 | right: 0;
174 | bottom: 0;
175 | border: 4rpx solid #fff;
176 | box-shadow: 0 0 20rpx #fff;
177 | }
178 | .stencil_con .hover-stenvil::after{
179 | content: '';
180 | display: block;
181 | position: absolute;
182 | left: 0;
183 | top: 0;
184 | right: 0;
185 | bottom: 0;
186 | border: 4rpx solid #fff;
187 | box-shadow: 0 0 20rpx #fff;
188 |
189 | }
190 | .stencil_con .ls image{
191 | width: 100%;
192 | height: 100%;
193 | }
--------------------------------------------------------------------------------
/pages/cutImgs/cutImgs.js:
--------------------------------------------------------------------------------
1 | // pages/cutImgs/cutImgs.js
2 | const app = getApp();
3 | Page({
4 | data: {
5 | src: '',
6 | width: 250,//宽度
7 | height: 250,//高度
8 | },
9 | onLoad: function (options) {
10 | console.log(options);
11 | this.cropper = this.selectComponent("#image-cropper");
12 | this.setData({
13 | src: options.tempPicUrl,
14 | });
15 | wx.showLoading({
16 | title: '加载中'
17 | })
18 | },
19 | cropperload:function(e) {
20 |
21 | console.log("cropper初始化完成");
22 | },
23 | loadimage:function(e) {
24 | console.log("图片加载完成", e.detail);
25 | wx.hideLoading();
26 | //重置图片角度、缩放、位置
27 | this.cropper.imgReset();
28 | },
29 | clickcut:function(e) {
30 | console.log(e.detail);
31 | //点击裁剪框阅览图片
32 | wx.previewImage({
33 | current: e.detail.url, // 当前显示图片的http链接
34 | urls: [e.detail.url] // 需要预览的图片http链接列表
35 | })
36 | },
37 | getPicInfo:function(e){
38 | wx.showToast({
39 | title: '上传中',
40 | icon: 'loading',
41 | duration: 2000
42 | })
43 | this.cropper.getImg(function(e){
44 | //登录信息验证
45 | var tok = app.globalData.token;
46 | if (!tok) { return false; }
47 | var signData = app.getSign();
48 | var sign = signData.sign;
49 | var timestamp = signData.timestamp;
50 | wx.uploadFile({
51 | url: app.setConfig.url + '/index.php/Api/upload/plupload',
52 | filePath: e.url,
53 | name: 'file',
54 | formData: {
55 | 'token': tok,
56 | 'app':'Admin',
57 | 'sign':sign,
58 | 'timestamp' :timestamp
59 | },
60 | success: function (res) {
61 | var data = JSON.parse(res.data);
62 | if(data.code == 20000){
63 | wx.setStorageSync("src", data.data.imgurl);
64 | wx.navigateTo({
65 | url: '../redpacket/redpacket'
66 | });
67 | } else {
68 | wx.showToast({
69 | title: '上传失败',
70 | icon: 'loading',
71 | mask: true,
72 | duration: 1000
73 | });
74 | }
75 | }
76 | });
77 | });
78 | }
79 |
80 | })
--------------------------------------------------------------------------------
/pages/cutImgs/cutImgs.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {
3 | "image-cropper": "../image-cropper/image-cropper"
4 | }
5 | }
--------------------------------------------------------------------------------
/pages/cutImgs/cutImgs.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/pages/cutImgs/cutImgs.wxss:
--------------------------------------------------------------------------------
1 | .container{
2 | height: 100%;
3 | }
4 | .cancala{ position: absolute;
5 | left: 20px;
6 | bottom: 23px;
7 | width: 100px;
8 | display: block;
9 | text-align: center;
10 | font-size: 20px;
11 | background-color: red;
12 | color: #fff;
13 | border-radius: 10px;
14 | padding: 10px 0px;
15 | }
16 | .oka{
17 | position:fixed;
18 | left:180rpx;
19 | bottom:46rpx;
20 | width:400rpx;
21 | display:block;
22 | text-align:center;
23 | font-size:30rpx;
24 | background-color:#1aad19;
25 | color:#fff;
26 | border-radius:20rpx;
27 | z-index:99999;
28 | }
29 | .oka button{
30 | width:100%;
31 | height:100%;
32 | }
33 | @import '../image-cropper/image-cropper.wxss'
--------------------------------------------------------------------------------
/pages/help/help.js:
--------------------------------------------------------------------------------
1 | //help.js
2 | const app = getApp()
3 |
4 | Page({
5 | data: {
6 | lists: [],
7 | control:-1,
8 | version:'1.0',
9 | show:false
10 | },
11 | onshow: function(e){
12 | if (this.data.control === e.target.dataset.id){
13 | this.setData({
14 | control: -1
15 | })
16 | }else{
17 | this.setData({
18 | control: e.target.dataset.id
19 | })
20 | }
21 | },
22 | //拨打电话
23 | tel: function () {
24 | wx.makePhoneCall({
25 | phoneNumber: '13242857521'
26 | })
27 | },
28 | onLoad: function () {
29 | if (!app.globalData.token) {
30 | wx.showLoading({
31 | title: '加载中•••',
32 | mask: true
33 | })
34 | }
35 | this.loop()
36 | },
37 | loop: function () {
38 | if (!app.globalData.token) {
39 | var that = this
40 | setTimeout(function () { that.loop(); }, 100)
41 | } else {
42 | wx.hideLoading()
43 | var tok = app.globalData.token;
44 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Enve&a=getFAQ',
45 | postData = {
46 | token: tok
47 | };
48 | app.postLogin(postUrl, postData, this.initial);
49 | }
50 | },
51 | initial:function(res){
52 | if(res.data.code == 20000){
53 | this.setData({
54 | lists: res.data.faqList,
55 | show: true
56 | })
57 | }
58 | }
59 | })
60 |
--------------------------------------------------------------------------------
/pages/help/help.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "常见问题"
3 | }
--------------------------------------------------------------------------------
/pages/help/help.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{index+1}}. {{obj.link_name}}
10 |
11 |
12 |
13 |
14 | {{obj.link_description}}
15 |
16 |
17 |
18 |
19 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/pages/help/help.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | height: 100%;
3 | }
4 | .container{
5 | height: 100%;
6 | overflow: hidden;
7 | }
8 | .con{
9 | height: 100%;
10 | position: relative;
11 | }
12 | .box{
13 | min-height: 100%;
14 | position: relative;
15 | }
16 | .help-list {
17 | display: flex;
18 | flex-direction: column;
19 | padding: 40rpx 30rpx 100rpx;
20 | }
21 | .list{
22 | font-size: 28rpx;
23 | background: #fff;
24 | margin-bottom: 20rpx;
25 | color: #333;
26 | border-radius: 8rpx;
27 | }
28 | .list .tit{
29 | line-height: 100rpx;
30 | padding: 0 100rpx 0 30rpx;
31 | position: relative;
32 | }
33 | .list .icon{
34 | width:28rpx;
35 | height: 15rpx;
36 | position: absolute;
37 | top: 0;
38 | right: 36rpx;
39 | transform: rotate(0deg);
40 | }
41 | .list.on .icon{
42 | top: 88rpx;
43 | transform: rotate(180deg);
44 | }
45 | .list .icon image{
46 | width: 28rpx;
47 | height: 15rpx;
48 | }
49 |
50 | .list .txt{
51 | padding: 20rpx 0;
52 | margin: 0 30rpx;
53 | line-height: 46rpx;
54 | font-size: 28rpx;
55 | border-top: 2rpx solid #F2F2F2;
56 | display: none;
57 | }
58 | .list.on .txt{
59 | display: block
60 | }
61 | .btn{
62 | display: block;
63 | width: 100%;
64 | margin-top: 30rpx;
65 | line-height: 80rpx;
66 | text-align: center;
67 | background: #28b265;
68 | border-radius: 8rpx;
69 | }
70 | .btn image{
71 | display: inline-block;
72 | width: 52rpx;
73 | height: 52rpx;
74 | vertical-align: middle;
75 | }
76 | .btn text{
77 | display: inline-block;
78 | vertical-align: middle;
79 | font-size: 32rpx;
80 | color: #fff;
81 | }
82 | .foot{
83 | width: 100%;
84 | line-height: 60rpx;
85 | font-size: 24rpx;
86 | text-align: center;
87 | position: absolute;
88 | bottom: 0;
89 | }
90 | .foot text{
91 | display: inline-block;
92 | vertical-align: middle;
93 | margin: 0 6rpx;
94 | }
95 | .foot .version{
96 | color: #ccc;
97 | }
98 | .foot .line{
99 | color: #ccc;
100 | }
101 | .foot .report{
102 | display: inline-block;
103 | vertical-align: middle;
104 | color: #364a79;
105 | }
--------------------------------------------------------------------------------
/pages/image-cropper/image-cropper.json:
--------------------------------------------------------------------------------
1 | {
2 | "component": true
3 | }
--------------------------------------------------------------------------------
/pages/image-cropper/image-cropper.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/pages/image-cropper/image-cropper.wxss:
--------------------------------------------------------------------------------
1 | .image-cropper{
2 | position: fixed;
3 | top:0;
4 | left:0;
5 | width:100vw;
6 | height:100vh;
7 | z-index: 1;
8 | }
9 | .main{
10 | position: absolute;
11 | width:100vw;
12 | height:100vh;
13 | overflow: hidden;
14 | }
15 | .content{
16 | z-index: 9;
17 | position: absolute;
18 | width:100vw;
19 | height:100vh;
20 | display: flex;
21 | flex-direction:column;
22 | pointer-events:none;
23 | }
24 | .bg_black{
25 | background: rgba(0, 0, 0, 0.8)!important;
26 | }
27 | .bg_gray{
28 | background: rgba(0, 0, 0, 0.45);
29 | transition-duration: .35s;
30 | }
31 | .content>.content_top{
32 | pointer-events:none;
33 | }
34 | .content>.content_middle{
35 | display: flex;
36 | height: 200px;
37 | width:100%;
38 | }
39 | .content_middle_middle{
40 | width:200px;
41 | box-sizing:border-box;
42 | position: relative;
43 | transition-duration: .3s;
44 | }
45 | .content_middle_right{
46 | flex: auto;
47 | }
48 | .content>.content_bottom{
49 | flex: auto;
50 | }
51 | .image-cropper .img{
52 | z-index: 2;
53 | top:0;
54 | left:0;
55 | position: absolute;
56 | border:none;
57 | width:100%;
58 | backface-visibility: hidden;
59 | transform-origin:center;
60 | }
61 | .image-cropper-canvas{
62 | position: fixed;
63 | background: white;
64 | width:150px;
65 | height:150px;
66 | z-index: 10;
67 | top:-200%;
68 | pointer-events:none;
69 | }
70 | .border{
71 | background: white;
72 | pointer-events:auto;
73 | position:absolute;
74 | }
75 | .border-top-left{
76 | left:-2.5px;
77 | top:-2.5px;
78 | height:2.5px;
79 | width:33rpx;
80 | }
81 | .border-top-right{
82 | right:-2.5px;
83 | top:-2.5px;
84 | height:2.5px;
85 | width:33rpx;
86 | }
87 | .border-right-top{
88 | top:-1px;
89 | width:2.5px;
90 | height:30rpx;
91 | right:-2.5px;
92 | }
93 | .border-right-bottom{
94 | width:2.5px;
95 | height:30rpx;
96 | right:-2.5px;
97 | bottom:-1px;
98 | }
99 | .border-bottom-left{
100 | height:2.5px;
101 | width:33rpx;
102 | bottom:-2.5px;
103 | left:-2.5px;
104 | }
105 | .border-bottom-right{
106 | height:2.5px;
107 | width:33rpx;
108 | bottom:-2.5px;
109 | right:-2.5px;
110 | }
111 | .border-left-top{
112 | top:-1px;
113 | width:2.5px;
114 | height:30rpx;
115 | left:-2.5px;
116 | }
117 | .border-left-bottom{
118 | width:2.5px;
119 | height:30rpx;
120 | left:-2.5px;
121 | bottom:-1px;
122 | }
--------------------------------------------------------------------------------
/pages/index/index.js:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | const app = getApp()
4 |
5 | Page({
6 | data: {
7 | userInfo: {}, // 用户信息
8 | hasUserInfo: false, // 用户授权
9 | canIUse: wx.canIUse('button.open-type.getUserInfo'), // 检测小程序版本兼容
10 | token: '',
11 | hidden:true,
12 | indexHots:[
13 | {
14 | 'slide_pic': app.setConfig.url + '/data/upload/default/20190304/5c7c917ac49c4.png'
15 | },
16 | {
17 | 'slide_pic': app.setConfig.url + '/data/upload/admin/20180301/5a97bfbd94703.jpg'
18 | },
19 | {
20 | 'slide_pic': app.setConfig.url + '/data/upload/admin/20180228/5a96b75a07405.jpg'
21 | },
22 | {
23 | 'slide_pic': app.setConfig.url + '/data/upload/admin/20180301/5a97c08c1d8ca.jpg'
24 | },
25 | {
26 | 'slide_pic': app.setConfig.url + '/data/upload/admin/20180301/5a97c18567c58.jpg'//变态难度
27 | }
28 | ]
29 | },
30 | selected:function(e){
31 | var src = e.currentTarget.dataset.src;
32 | wx.setStorageSync("src", src);
33 | wx.navigateTo({
34 | url: '../redpacket/redpacket'
35 | })
36 | },
37 |
38 |
39 | addimg: function (e) {
40 | let that = this;
41 | wx.showActionSheet({
42 | itemList: ['从手机相册选择', '摄影师作品'],
43 | success: function (res) {
44 | if (res.tapIndex == 0) {
45 | wx.chooseImage({
46 | count: 1,
47 | sizeType: ['original', 'compressed'],
48 | sourceType: ['album'],
49 | success(res) {
50 | const tempFilePaths = res.tempFilePaths[0];
51 | console.log(tempFilePaths);
52 | wx.navigateTo({
53 | url: '../cutImgs/cutImgs?tempPicUrl=' + tempFilePaths
54 | })
55 | //that.pushImg(tempFilePaths);
56 | }
57 | });
58 |
59 | } else {
60 | wx.navigateTo({
61 | url: '../select/select?cid=0'
62 | });
63 | }
64 | },
65 | fail: function (res) {
66 | console.log(res.errMsg)
67 | }
68 | });
69 |
70 |
71 | },
72 |
73 | //底部导航跳转
74 | bindtaprecord: function() {
75 | wx.navigateTo({
76 | url: '../record/record'
77 | })
78 | },
79 | bindtapbalance: function () {
80 | wx.navigateTo({
81 | url: '../balance/balance'
82 | })
83 | },
84 | bindtaphelp: function () {
85 | wx.navigateTo({
86 | url: '../help/help'
87 | })
88 | },
89 | // 转发
90 | onShareAppMessage: function (res) {
91 | var title = '新奇的拼图大考验,快来挑战吧 >>';
92 | return {
93 | title: title,
94 | path: '/pages/index/index',
95 | success: function (res) {
96 | // 转发成功
97 | wx.showToast({
98 | title: '转发成功',
99 | icon: 'success',
100 | duration: 2000
101 | })
102 | },
103 | fail: function (res) {
104 | // 转发失败
105 | }
106 | }
107 | },
108 | chooseSpliceLongImg: function () {
109 | wx.navigateTo({
110 | url: '../longPhoto/index'
111 | })
112 | },
113 | chooseSplicephotoFrame: function () {
114 | wx.navigateTo({
115 | url: '../photoFrame/index'
116 | });
117 | },
118 | chooseSpliceNinePics: function () {
119 | wx.navigateTo({
120 | url: '../ninePics/index'
121 | });
122 | },
123 | chooseHeartPhotoFrame: function () {
124 | wx.navigateTo({
125 | url: '../heartPics/index'
126 | });
127 | },
128 | chooseWaterPics: function () {
129 | wx.navigateTo({
130 | url: '../waterMarkSet/waterMarkSet'
131 | });
132 | },
133 |
134 | onLoad:function(){
135 | var that = this;
136 | if (!app.globalData.token) {
137 | var that = this;
138 | wx.showLoading({
139 | title: '加载中•••',
140 | mask: true
141 | })
142 | }
143 | this.loop();
144 | app.globalData.timer = setTimeout(function(){
145 | wx.hideLoading();
146 | that.setData({
147 | hidden:false
148 | })
149 | },5000);
150 | },
151 | loop: function () {
152 | var info = app.globalData.userInfo,
153 | tok = app.globalData.token;
154 | if (info && !this.data.hasUserInfo){
155 | wx.hideLoading();
156 | this.setData({
157 | userInfo: info,
158 | hasUserInfo: true
159 | });
160 | if (app.globalData.timer) { clearTimeout(app.globalData.timer); }
161 | }else{
162 | var that = this;
163 | setTimeout(function () { that.loop(); }, 200)
164 | }
165 | },
166 | getUserInfo:function(e){
167 | var that = this;
168 | console.log(e);
169 | var userInfo = e.detail.userInfo
170 | if (userInfo){
171 | app.globalData.userInfo = userInfo
172 | this.setData({
173 | userInfo: userInfo,
174 | hasUserInfo: true
175 | })
176 | }
177 | },
178 |
179 | bindViewTel: function () {
180 | wx.makePhoneCall({
181 | phoneNumber: this.data.Tel,
182 | })
183 | },
184 | })
185 |
--------------------------------------------------------------------------------
/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | }
--------------------------------------------------------------------------------
/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {{userInfo.nickName}}
11 | 选择一张珍藏的照片,好友拼出来才能获得赏金
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | 请勿上传色情以及其他违禁图片
22 | 本小程序有权在收到投诉后删除相应内容
23 |
24 |
25 |
26 |
41 |
42 |
--------------------------------------------------------------------------------
/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | page{
3 | width:100%;
4 | height: 100%;
5 | }
6 | .sqbtn{
7 | display: block;
8 | border:2rpx solid #dfdfdf;
9 | border-radius: 8rpx;
10 | line-height: 88rpx;
11 | }
12 |
13 |
14 | .container{
15 | padding: 0;
16 | margin: 0;
17 | height: 100%;
18 | background: #dc6142;
19 | }
20 |
21 | .container .box{
22 | margin: 0 auto;
23 | padding-top: 40rpx;
24 | }
25 | .container .userinfo {
26 | display: flex;
27 | flex-direction: column;
28 | align-items: center;
29 | margin-bottom: 30rpx;
30 | }
31 | .container .userinfo-avatar {
32 | width: 140rpx;
33 | height: 140rpx;
34 | border: 4rpx solid #fff;
35 | border-radius: 50%;
36 | }
37 | .container .userinfo-name{
38 | margin: 20rpx 0 26rpx;
39 | font-weight: 700;
40 | }
41 | .container .box .tit{
42 | font-size: 30rpx;
43 | font-weight: 700;
44 | }
45 | .container .box .img{
46 | margin: 70rpx auto;
47 | background-color: #fff;
48 | display:flex;
49 | flex-wrap:wrap;
50 | padding:0rpx;
51 | width:585rpx;
52 | min-height:100%;
53 | background:#eee;
54 | box-sizing:border-box;
55 | }
56 | .item{
57 | width:195rpx;
58 | height:195rpx;
59 | border:8rpx solid #fff;
60 | box-shadow:1rpx 1rpx 1rpx #ddd;
61 | box-sizing:border-box;
62 | }
63 | .item image{
64 | width: 180rpx;
65 | height: 180rpx;
66 | }
67 | .container .box .img .cue{
68 | width: 360rpx;
69 | text-align: center;
70 | color: #bfa16d;
71 | position: absolute;
72 | bottom: 26rpx;
73 | right: 0;
74 | }
75 | .container .box .txt{
76 | font-size: 26rpx;
77 | line-height: 44rpx;
78 | }
79 | .container .btn{
80 | display: inline-block;
81 | font-size: 26rpx;
82 | height: 60rpx;
83 | line-height: 60rpx;
84 | border: none;
85 | background: transparent;
86 | width: 230rpx;
87 | padding: 0;
88 | margin: 0;
89 | position: absolute;
90 | bottom: 30rpx;
91 | left: 260rpx;
92 | }
93 | .container .btn image{
94 | display: inline-block;
95 | width: 28rpx;
96 | height: 28rpx;
97 | vertical-align: -4rpx;
98 | margin-right: 10rpx;
99 | }
100 | .container .btn text{
101 | color:#fff;
102 | }
103 |
104 | .container .footer{
105 | width: 100%;
106 | padding: 20rpx 0 10rpx;
107 | background: #fff;
108 | border-top: 1rpx solid #f1f1f1;
109 | box-shadow: 0 0 8rpx #666;
110 | position: fixed;
111 | left: 0;
112 | bottom: 0;
113 | }
114 | .container .listnav{
115 | display: inline-block;
116 | width: 250rpx;
117 | text-align: center;
118 | }
119 | .container .listnav image{
120 | width: 50rpx;
121 | height: 55rpx;
122 | }
123 | .container .listnav view{
124 | font-size: 24rpx;
125 | color: #dc6142;
126 | }
127 |
128 |
129 | .container_pintu{
130 | height: 100%;
131 | display: flex;
132 | flex-direction: column;
133 | align-items: center;
134 | justify-content: space-between;
135 | padding: 90rpx 0;
136 | box-sizing: border-box;
137 | }
138 | .userinfo {
139 | display: flex;
140 | flex-direction: column;
141 | align-items: center;
142 | }
143 | .logo{
144 | width:400rpx;
145 | height:80rpx;
146 | }
147 | .logo image{
148 | width:100%;
149 | height:100%;
150 | }
151 | .nav{
152 | position: relative;
153 | width:80%;
154 | height:700rpx;
155 | margin-top:110rpx;
156 | text-align: center;
157 | font-size: 34rpx;
158 | color:#fff;
159 | margin-bottom: 60rpx;
160 | }
161 | .nav_one{
162 | position: absolute;
163 | width:200rpx;
164 | height:200rpx;
165 | background-color: #ffb5b6;
166 | top:28%;
167 | left:8%;
168 | border-radius: 10rpx;
169 | }
170 | .nav_two{
171 | position: absolute;
172 | width:300rpx;
173 | height:300rpx;
174 | background-color: #b4d7ff;
175 | top:10%;
176 | right:5%;
177 | border-radius: 10rpx;
178 | }
179 | .nav_three{
180 | position: absolute;
181 | width:250rpx;
182 | height:250rpx;
183 | background-color: #fde5a9;
184 | bottom:4%;
185 | left:10%;
186 | border-radius: 10rpx;
187 | }
188 | .nav_four{
189 | position: absolute;
190 | width:200rpx;
191 | height:200rpx;
192 | background-color: #f8cefe;
193 | bottom:12%;
194 | right:10%;
195 | border-radius: 10rpx;
196 | }
197 |
198 | .navimg{
199 | display: flex;
200 | flex-direction: column;
201 | align-items: center;
202 | margin:0 auto;
203 | margin-top:30%;
204 | margin-bottom:10%;
205 | width:30%;
206 | height:30%;
207 |
208 | }
209 |
210 | .copyright{
211 | font-size: 24rpx;
212 | color:#999;
213 | margin-bottom: 0rpx;
214 | text-align: center;
215 | }
--------------------------------------------------------------------------------
/pages/logs/logs.js:
--------------------------------------------------------------------------------
1 | //logs.js
2 | const util = require('../../utils/util.js')
3 |
4 | Page({
5 | data: {
6 | logs: []
7 | },
8 | onLoad: function () {
9 | this.setData({
10 | logs: (wx.getStorageSync('logs') || []).map(log => {
11 | return util.formatTime(new Date(log))
12 | })
13 | })
14 | }
15 | })
16 |
--------------------------------------------------------------------------------
/pages/logs/logs.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "查看启动日志"
3 | }
--------------------------------------------------------------------------------
/pages/logs/logs.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{index + 1}}. {{log}}
5 |
6 |
7 |
--------------------------------------------------------------------------------
/pages/logs/logs.wxss:
--------------------------------------------------------------------------------
1 | .log-list {
2 | display: flex;
3 | flex-direction: column;
4 | padding: 40rpx;
5 | }
6 | .log-item {
7 | margin: 10rpx;
8 | }
9 |
--------------------------------------------------------------------------------
/pages/record/record.js:
--------------------------------------------------------------------------------
1 | //record.js
2 | //获取应用实例
3 | const app = getApp();
4 | Page({
5 | data: {
6 | userInfo: {},
7 | hasUserInfo: false,
8 | canIUse: wx.canIUse('button.open-type.getUserInfo'),
9 | lists: [
10 | {
11 | nam:"发出的",
12 | je:"0.00", // 总金额
13 | sl:"0", // 总数量
14 | ls:[ // 发出的列表
15 | // {
16 | // quest:"恭喜发财", //
17 | // id: 5, // id
18 | // show_amount:"1.00", // 发出的金额
19 | // add_time:"09月21日 20:06", // 时间
20 | // num: 3, // 总个数
21 | // receive_num: 3 // 已领取个数
22 | // }
23 | ]
24 | },{
25 | nam: "共收到",
26 | je: "0.00", // 收到的总金额
27 | sl: "0", // 收到的个数
28 | ls: [ // 收到的列表
29 | // {
30 | // head_img: "https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83eq4Jsic8dPLibDhG0U6QHsSU5rsZriaWvCzsq3Cvic92lyntBepemiaM2hlXdjT3MTtrkhnbR2CIBb118A/0", // 发的人微信头像链接
31 | // nick_name: "豆腐干", // 发的人微信名称
32 | // receive_answer: 6, // id
33 | // receive_amount: "10.00", // 领取的金额
34 | // add_time: "09月22日 12:22" // 时间
35 | // }
36 | ]
37 | }
38 | ], //
39 | pagel: 0, // 发出的 页数
40 | pager: 0, // 收到的 页数
41 | lower0: true, // 触底加载控制器
42 | lower1: true, // 触底加载控制器
43 | indicatorDots: false, // 滑块参数
44 | duration: 500, // 切换时间
45 | current:0 // 切换指数
46 | },
47 | //事件处理函数
48 | bindchange: function (e) {
49 | var ii = e.detail.current;
50 | this.setData({
51 | current: ii
52 | })
53 | if (ii == 1 && this.data.pager == 0){
54 | this.loaddatar();
55 | }else if(ii == 0 && this.data.pagel == 0){
56 | this.loaddatal();
57 | }
58 | },
59 | // 触底加载数据
60 | lower:function(e){
61 | var that = this;
62 | var cd = e.target.dataset.current;
63 | if (this.data.lower0 && cd == 0){
64 | this.setData({
65 | lower0: false
66 | })
67 | this.loaddatal();
68 | }
69 | if (this.data.lower1 && cd == 1) {
70 | this.setData({
71 | lower1: false
72 | })
73 | this.loaddatar();
74 | }
75 |
76 | },
77 | //拨打电话
78 | tel: function () {
79 | wx.makePhoneCall({
80 | phoneNumber: '020-22096568'
81 | })
82 | },
83 | swichNav: function (e) {
84 | var that = this;
85 | if (this.data.current == e.currentTarget.dataset.current) {
86 | return false;
87 | } else {
88 | that.setData({
89 | current: e.currentTarget.dataset.current
90 | })
91 | }
92 | },
93 | bindtaphelp: function () {
94 | wx.navigateTo({
95 | url: '../help/help'
96 | })
97 | },
98 | onLoad: function () {
99 | if (!app.globalData.token) {
100 | wx.showLoading({
101 | title: '加载中•••',
102 | mask: true
103 | })
104 | }
105 | this.loop()
106 | },
107 | loop:function(){
108 | if (!app.globalData.token) {
109 | var that = this
110 | setTimeout(function () { that.loop(); }, 100)
111 | } else {
112 | var info = app.globalData.userInfo,
113 | tok = app.globalData.token;
114 | if (info) {
115 | this.setData({
116 | userInfo: info,
117 | token: tok,
118 | hasUserInfo: true
119 | })
120 | }
121 | this.loaddatal();
122 | wx.hideLoading()
123 | }
124 | },
125 | // 发出的数据 加载
126 | loaddatal:function(){
127 | wx.showLoading({
128 | title: '加载中•••'
129 | })
130 | var tok = this.data.token;
131 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Enve',
132 | pag = this.data.pagel + 1,
133 | postData = {
134 | page: pag,
135 | token: tok
136 | };
137 | app.postLogin(postUrl, postData, this.initial);
138 | },
139 | // 发出的
140 | initial: function (res) {
141 | if (res.data.code == 20000) {
142 | var datas = res.data;
143 | if (datas.data.lenght==0){
144 | this.setData({
145 | pagel: -1
146 | })
147 | return false;
148 | }
149 | var list0 = this.data.lists[0],
150 | list1 = this.data.lists[1],
151 | pagel = this.data.pagel+1;
152 | list0.je = datas.sum_info.sum_money;
153 | list0.sl = datas.sum_info.sum_num;
154 | list0.ls = list0.ls.concat(datas.data);
155 | wx.hideLoading()
156 | this.setData({
157 | lists:[list0,list1],
158 | pagel: pagel,
159 | lower0: true
160 | })
161 |
162 | }
163 | },
164 | // 收到的数据 加载
165 | loaddatar:function(){
166 | wx.showLoading({
167 | title: '加载中•••'
168 | })
169 | var tok = this.data.token;
170 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Enve&a=reciveList',
171 | pag = this.data.pager + 1,
172 | postData = {
173 | page: pag,
174 | token: tok
175 | };
176 | app.postLogin(postUrl, postData, this.reciveList);
177 | },
178 | bindtapbalance: function () {
179 | wx.navigateTo({
180 | url: '../balance/balance'
181 | })
182 | },
183 | //收到的
184 | reciveList:function(res){
185 | if (res.data.code == 20000){
186 | var datas = res.data;
187 | if (datas.data.lenght == 0) {
188 | this.setData({
189 | pager: -1
190 | })
191 | return false;
192 | }
193 | var list0 = this.data.lists[0],
194 | list1 = this.data.lists[1],
195 | pager = this.data.pager + 1;
196 | list1.je = datas.sum_info.sum_money;
197 | list1.sl = datas.sum_info.sum_num;
198 | list1.ls = list1.ls.concat(datas.data);
199 | wx.hideLoading()
200 | this.setData({
201 | lists: [list0, list1],
202 | pager:pager,
203 | lower1: true
204 | })
205 | }
206 | }
207 | })
208 |
--------------------------------------------------------------------------------
/pages/record/record.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "我的记录"
3 | }
--------------------------------------------------------------------------------
/pages/record/record.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 我发出的
7 | 我收到的
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | {{userInfo.nickName}} {{item.nam}}
17 |
18 | 金额 (元){{item.je}}
19 | 数量 (个){{item.sl}}
20 |
21 |
22 |
23 |
24 | {{itemChild.quest}}{{itemChild.show_amount}} 元
25 | {{itemChild.add_time}}{{itemChild.receive_num}}/{{itemChild.num}}
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | {{itemChild.nick_name}}{{itemChild.add_time}}
34 | {{itemChild.receive_amount}} 元
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/pages/record/record.wxss:
--------------------------------------------------------------------------------
1 | /**record.wxss**/
2 | page{
3 | background: #f1f1f1;
4 | height: 100%;
5 | }
6 | .container{
7 | padding: 0;
8 | margin: 0;
9 | justify-content: flex-start;
10 | }
11 | .nav{
12 | width: 100%;
13 | background: #fff;
14 | position: absolute;
15 | top: 0;
16 | z-index: 100
17 | }
18 | .nav>view{
19 | display: inline-block;
20 | width: 50%;
21 | text-align: center;
22 | padding: 22rpx 0;
23 | position: relative;
24 | }
25 | .nav>view text{
26 | font-size: 32rpx;
27 | color: #666;
28 | }
29 | .nav>view.on text{
30 | color: #d95940;
31 | }
32 | .nav>view::after{
33 | content: '';
34 | display: block;
35 | width: 80rpx;
36 | height: 6rpx;
37 | background: transparent;
38 | position: absolute;
39 | bottom: 0;
40 | left: 50%;
41 | margin-left: -40rpx;
42 | }
43 | .nav>view.on::after{
44 | background: #d95940;
45 | }
46 |
47 | swiper{width: 100%;height: 100%;}
48 | .swiper-scroll{
49 | height: 96%;
50 | }
51 | .con-box{
52 | height: auto;
53 | min-height: 100%;
54 | position: relative;
55 | }
56 | .userinfo{
57 | display: flex;
58 | flex-direction: column;
59 | align-items: center;
60 | padding-top: 150rpx;
61 | }
62 | .userinfo-avatar {
63 | width: 128rpx;
64 | height: 128rpx;
65 | border: 2rpx solid #ccc;
66 | border-radius: 50%;
67 | }
68 | .userinfo-name{
69 | font-size: 32rpx;
70 | color: #333;
71 | margin: 32rpx 0;
72 | }
73 | .userinfo-name text{
74 | color: #364a79;
75 | }
76 | .count{
77 | width: 100%;
78 | text-align: center
79 | }
80 | .count>view{
81 | display: inline-block;
82 | width: 36%;
83 | }
84 | .count-t{
85 | font-size: 32rpx;
86 | color: #999;
87 | margin-bottom: 16rpx;
88 | }
89 | .count text{
90 | font-size: 40rpx;
91 | color: #333;
92 | font-weight: 700;
93 | }
94 | .ls{
95 | width: 100%;
96 | background: #fff;
97 | margin-top:60rpx;
98 | font-size: 28rpx;
99 | color: #333;
100 | }
101 | .ls-item{
102 | padding: 16rpx 30rpx;
103 | border-bottom: 2rpx solid #eee;
104 | overflow: hidden;
105 | line-height:20rpx;
106 | }
107 | .ls-item:last-child{
108 | border-bottom: none;
109 | }
110 | .ls-t .ls-l{
111 | display: inline-block;
112 | max-width: 360rpx;
113 | overflow: hidden;
114 | text-overflow: ellipsis;
115 | white-space:nowrap;
116 | }
117 | .ls-b{
118 | color: #999;
119 | }
120 | .ls-r{
121 | float: right;
122 | }
123 | .ls-item text{
124 | line-height: 46rpx;
125 | }
126 |
127 | .ls-s{
128 | display: inline-block;
129 | vertical-align: top;
130 | color: #333;
131 | }
132 | .ls-img{
133 | width: 80rpx;
134 | height: 80rpx;
135 | margin-top:6rpx
136 | }
137 | .ls-img image{
138 | width:100%;
139 | height: 100%;
140 | }
141 | .ls-c{
142 | margin-left: 20rpx;
143 | }
144 | .ls-c .ls-c-t{
145 | display: inline-block;
146 | max-width: 320rpx;
147 | overflow: hidden;
148 | text-overflow: ellipsis;
149 | white-space:nowrap;
150 | }
151 | .ls-c .ls-c-b{
152 | display: block;
153 | color: #999;
154 | }
155 | .clear{
156 | width: 100%;
157 | height: 80rpx;
158 | }
159 | .question{
160 | width: 100%;
161 | font-size: 24rpx;
162 | text-align: center;
163 | color: #364a79;
164 | position: absolute;
165 | bottom: 20rpx;
166 | }
167 | .bold{
168 | font-weight: 700;
169 | }
170 | .zhygg{
171 | margin-bottom: 10rpx;
172 | }
173 | .container .footer{
174 | width: 100%;
175 | padding: 20rpx 0 10rpx;
176 | background: #fff;
177 | border-top: 1rpx solid #f1f1f1;
178 | box-shadow: 0 0 8rpx #666;
179 | position: fixed;
180 | left: 0;
181 | bottom: 0;
182 | }
183 | .container .listnav{
184 | display: inline-block;
185 | width: 50%;
186 | text-align: center;
187 | }
188 | .container .listnav image{
189 | width: 50rpx;
190 | height: 55rpx;
191 | }
192 | .container .listnav view{
193 | font-size: 24rpx;
194 | color: #dc6142;
195 | }
--------------------------------------------------------------------------------
/pages/recordDetails/recordDetails.js:
--------------------------------------------------------------------------------
1 | //recordDetails.js
2 | //获取应用实例
3 | const app = getApp();
4 | var top1 = ''
5 | var top2 = ''
6 | var num1 = -1
7 | var num2 = -1
8 | var winW = wx.getSystemInfoSync().windowWidth;
9 | var control = false
10 | var timeout = 4
11 | var timeadd = 0
12 |
13 | var timer1 = null
14 | var timer2 = null
15 |
16 | Page({
17 | data: {
18 | userInfo: {},
19 | hasUserInfo: false,
20 | canIUse: wx.canIUse('button.open-type.getUserInfo'),
21 | token:'', // 用户登录
22 | pid:'', // 包id
23 | ownerImg:'', // 包主 头像
24 | ownerName:'', //包主 名字
25 | imgsrc:'/images/pt001.png', //图片
26 | textCN: "恭喜发财", //
27 | hint: "", // 按钮文字
28 | count: {
29 | qtx: '去提现',
30 | fhb: '发拼图',
31 | qzf: '去转发'
32 | },
33 | status: false, // 判断包主是否为自己
34 | zje:'0.00', // 总金额
35 | zlq:0, // 领取个数
36 | zgs:0, // 总个数
37 | ls: [], // 领取人列表
38 | playID:-1, // 语音播放器控制id
39 | state: 1, // 状态参数 1-可领取 2-已领取 3-领完了 4-已失效
40 | receiveState: false, // 领取状态 true为已领取
41 | receiveJE:'',
42 | mytime:'52秒', // 用时(秒)
43 | totimer:'0秒', // 计时器
44 | boxW: 600,
45 | mode: 4, // 难度选择
46 | list: [],
47 | abimg: [],
48 | num1: -1,
49 | num2: -1,
50 | key: -1,
51 | tocue:false, // 开启
52 | timeout:3,
53 | timeot:true, // 拼图页开关
54 | toend:false, // 拼图结束后弹框开关
55 | boxState: 0, // 结束后弹框状态 0-可领取 1-被领完 2-已领取
56 | boxbg:[
57 | '/images/tan1.png',
58 | '/images/tan2.png',
59 | '/images/tan3.png'
60 | ],
61 | roll:false, // 领取开关
62 | relay:'给你发了一个拼图考验,立刻去挑战吧 >>' // 转发后显示的提示语
63 | },
64 |
65 |
66 | onLoad: function (options) {
67 | wx.showLoading({
68 | title: '加载中•••',
69 | mask: true
70 | })
71 | var scene = decodeURIComponent(options.scene);
72 | if (scene > 0) {
73 | var pid = scene;
74 | } else {
75 | var pid = options.pid;
76 | }
77 | this.loop(pid);
78 | },
79 | loop:function(pid){
80 | if (!app.globalData.token){
81 | var that = this
82 | setTimeout(function () { that.loop(pid);},100)
83 | }else{
84 | var info = app.globalData.userInfo,
85 | tok = app.globalData.token;
86 | if (!info) {
87 | app.userInfoReadyCallback = res => {
88 | this.setData({
89 | userInfo: res.userInfo,
90 | token: tok,
91 | pid: pid
92 | })
93 | }
94 | } else {
95 | this.setData({
96 | userInfo: info,
97 | token: tok,
98 | pid: pid
99 | })
100 | }
101 |
102 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Enve&a=enveDetail',
103 | postData = {
104 | id: pid,
105 | token: tok
106 | };
107 | app.postLogin(postUrl, postData, this.initial);
108 | }
109 |
110 | },
111 | //数据初始化
112 | initial:function(res){
113 | wx.stopPullDownRefresh();
114 | if(res.data.code == 20000){
115 | var data = res.data.data;
116 | var vos = data.receive,
117 | status = data.status,
118 | recive_status = data.recive_status,
119 | term_status = data.be_overdue,
120 | voices = [],
121 | state = 0;
122 |
123 | if (recive_status){
124 | var hint = "已领取";
125 | state = 2
126 | } else if (!status){
127 | var hint = "赏金都被领完了";
128 | state = 3
129 | }else{
130 | var hint = "点击领取";
131 | state = 1
132 | }
133 | if (term_status == 1) {
134 | state = 4;
135 | }
136 | for(var i = 0;i {
280 | return Math.random() > .5 ? -1 : 1;
281 | }
282 | arr.sort(randomsort);
283 | arr.sort(randomsort);
284 | arr.sort(randomsort);
285 | this.setData({
286 | list: arr
287 | })
288 | setTimeout(function(){
289 | arr.sort(randomsort);
290 | arr.sort(randomsort);
291 | that.setData({
292 | list: arr
293 | })
294 | setTimeout(function () { control = true; }, 500)
295 | }, 400)
296 | },
297 | // 点击对换
298 | toStart: function (e) {
299 | if (!control) { return false }
300 | var i = e.currentTarget.dataset.key
301 | var list = this.data.list
302 | if (!top1) {
303 | num1 = i
304 | top1 = list[num1]
305 | this.setData({
306 | key: i
307 | })
308 | } else if (!top2 && num1 != i) {
309 | num2 = i;
310 | top2 = list[i]
311 | list[num1] = top2;
312 | list[i] = top1;
313 | top1 = '';
314 | top2 = '';
315 | this.setData({
316 | num1: num1,
317 | num2: num2,
318 | key: -1,
319 | list: list
320 | })
321 | this.proving();
322 | } else {
323 | top1 = '';
324 | top2 = '';
325 | num1 = -1
326 | num2 = -1
327 | this.setData({
328 | num1: num1,
329 | num2: num2,
330 | key: -1
331 | })
332 | }
333 | },
334 | //答案验证
335 | proving: function () {
336 | var that = this,
337 | list = this.data.list,
338 | mode = this.data.mode,
339 | correct = 0;
340 | for (var i = 0; i < mode; i++) {
341 | for (var j = 0; j < mode; j++) {
342 | var index = i * mode + j,
343 | oid = i + '-' + j;
344 | if (list[index].id == oid) {
345 | correct++;
346 | } else {
347 | return false;
348 | }
349 | }
350 | }
351 |
352 | if (correct == mode * mode) {
353 | if (timer2) { clearInterval(timer2); }
354 | control = false;
355 | setTimeout(function () {
356 | wx.showToast({
357 | title: '你过关啦',
358 | icon: 'success',
359 | duration: 1250
360 | })
361 | }, 300)
362 | setTimeout(function(){
363 | that.setData({
364 | tocue: false,
365 | toend: true,
366 | boxState: 0
367 | })
368 | },1500)
369 | }
370 | },
371 | // 点击打开
372 | endBtn:function(){
373 | var that = this;
374 | that.setData({
375 | roll:true
376 | })
377 | let totimer = that.data.totimer;
378 | totimer = totimer.replace("秒", "")
379 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Enve&a=saveEnveReceive';
380 | var postData = {
381 | pid: that.data.pid,
382 | get_time: totimer,
383 | token: that.data.token
384 | };
385 | var tims1 = new Date().getTime();
386 | app.postLogin(postUrl, postData, function (res) {
387 | wx.hideToast()
388 | let boxState = 1;
389 | let amount = '';
390 | console.log(res)
391 | if (res.data.code == 20000) {
392 | boxState = 2;
393 | amount = res.data.data.amount;
394 | }
395 | var tims2 = 900 - new Date().getTime() + tims1;
396 | tims2 = tims2 > 50 ? tims2 : 50;
397 | setTimeout(function(){
398 | that.setData({
399 | receiveJE: amount,
400 | boxState: boxState,
401 | roll: false
402 | })
403 |
404 | }, tims2)
405 | })
406 | },
407 | // 关闭提示框
408 | clearNnd:function(){
409 | var that = this;
410 | that.setData({
411 | toend:false
412 | })
413 | setTimeout(function(){
414 | if (that.data.state == 1){
415 | wx.showLoading({
416 | title: '刷新中',
417 | mask: true
418 | })
419 | }
420 | },500)
421 | if (that.data.state == 1){
422 | var cUrl = app.setConfig.url + '/index.php?g=Api&m=Enve&a=enveDetail',
423 | cData = {
424 | id: that.data.pid,
425 | token: that.data.token
426 | };
427 | app.postLogin(cUrl, cData, that.initial);
428 | }
429 | },
430 | //下拉刷新数据
431 | onPullDownRefresh: function (e) {
432 | if (this.data.tocue) { wx.stopPullDownRefresh();return false;}
433 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Enve&a=enveDetail',
434 | postData = {
435 | id: this.data.pid,
436 | token: this.data.token
437 | };
438 | app.postLogin(postUrl, postData, this.initial);
439 | },
440 | toBalance: function () {
441 | wx.navigateTo({
442 | url: '../balance/balance'
443 | })
444 | },
445 | toIndex: function () {
446 | wx.reLaunch({
447 | url: '../index/index'
448 | })
449 | },
450 | toShare: function () {
451 | var pid = this.data.pid;
452 | var ownerImg = this.data.ownerImg
453 | var ownerName = this.data.ownerName
454 | var describe = this.data.textCN
455 | wx.setStorageSync('SPid', pid)
456 | wx.setStorageSync('SOwnerImg', ownerImg)
457 | wx.setStorageSync('SOwnerName', ownerName)
458 | wx.setStorageSync('SDescribe', describe)
459 | wx.navigateTo({
460 | url: '../share/share?cid=1'
461 | })
462 | },
463 | // 查看大头像
464 | picture: function (e) {
465 | var maxurl = e.currentTarget.dataset.src;
466 | if(!maxurl){return false;}
467 | wx.previewImage({
468 | current: '',
469 | urls: [maxurl]
470 | })
471 | },
472 | // 转发
473 | onShareAppMessage: function (res) {
474 | var id = this.data.pid,
475 | title = this.data.ownerName + ' ' + this.data.relay;
476 | if (res.from === 'button') {
477 | // 来自页面内转发按钮
478 | console.log(res.target)
479 | }
480 | return {
481 | title: title,
482 | path: '/pages/recordDetails/recordDetails?pid=' + id,
483 | success: function (res) {
484 | // 转发成功
485 | wx.showToast({
486 | title: '转发成功',
487 | icon: 'success',
488 | duration: 2000
489 | })
490 | },
491 | fail: function (res) {
492 | // 转发失败
493 | }
494 | }
495 | }
496 | })
497 |
--------------------------------------------------------------------------------
/pages/recordDetails/recordDetails.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "小猪拼拼图夺宝",
3 | "backgroundTextStyle": "light",
4 | "enablePullDownRefresh": true
5 | }
--------------------------------------------------------------------------------
/pages/recordDetails/recordDetails.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | {{textCN}}
9 |
10 |
11 |
12 |
13 |
14 |
15 | 点击开始拼图
16 | 时间不限
17 | {{receiveJE}}元
18 | 用时{{mytime}}
19 | 很遗憾
20 | 赏金已经被抢光啦
21 | 拼图已经失效啦
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | 共{{zje}}元,领取{{zlq}}/{{zgs}}个举报
32 |
33 |
34 |
35 |
36 |
37 | {{item.name}}
38 | 用时{{item.get_time}}
39 |
40 | {{item.lsje}} 元{{item.time}}
41 |
42 |
43 |
44 |
45 | 未领取的金额,将于24小时后退回至小程序余额
46 |
47 |
48 |
49 |
50 |
51 | 用时{{totimer}}
52 |
53 |
54 |
55 |
56 |
57 |
58 | {{timeout}}
59 |
60 | 点击图片交换位置,拼图成功自动领取赏金
61 |
62 | 放弃挑战
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | {{boxState==2?"成功领取赏金":"恭喜你完成了拼图,用时"+totimer}}
71 |
72 |
73 |
74 |
75 | 不过很遗憾
76 | 赏金被别人抢先一步领完啦!
77 |
78 |
79 |
80 | {{receiveJE}}元
81 | 赏金已存入余额,立即提现
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/pages/recordDetails/recordDetails.wxss:
--------------------------------------------------------------------------------
1 | /**recordDetails.wxss**/
2 | page{
3 | background: #f1f1f1;
4 | height: 100%;
5 | }
6 | .container{
7 | padding: 0;
8 | margin: 0;
9 | justify-content: flex-start;
10 | }
11 | .userinfo{
12 | display: block;
13 | width: 100%;
14 | flex-direction: column;
15 | text-align: center;
16 | }
17 | .upper{
18 | padding-top: 30rpx;
19 | padding-bottom: 26rpx;
20 | background: #dc6142;
21 | position: relative
22 | }
23 | .userinfo-avatar {
24 | width: 128rpx;
25 | height: 128rpx;
26 | border: 2rpx solid #ccc;
27 | border-radius: 50%;
28 | }
29 | .userinfo-name{
30 | font-size: 32rpx;
31 | color: #f0cb96;
32 | margin: 16rpx 0 30rpx;
33 | }
34 | .textCN{
35 | font-size: 36rpx;
36 | color: #fedeb2;
37 | padding: 0 60rpx;
38 | margin: 30rpx 0;
39 | font-weight: 700;
40 | }
41 | .textCN .icon{
42 | display: inline-block;
43 | vertical-align: middle;
44 | margin-right: 10rpx;
45 | }
46 | .textCN .icon image{
47 | width: 54rpx;
48 | height: 54rpx;
49 | }
50 |
51 | .box{
52 | width: 280rpx;
53 | height: 280rpx;
54 | border: 4rpx solid #fae7bc;
55 | margin: 0 auto 20rpx;
56 | overflow: hidden;
57 | position: relative;
58 | }
59 | .box .minimg{
60 | width: 100%;
61 | height: 100%;
62 | }
63 | .box .box_txt{
64 | width: 100%;
65 | height: 100%;
66 | position: absolute;
67 | left: 0;
68 | top: 0;
69 | background: rgba(0, 0, 0, .6)
70 | }
71 | .box .box_txt .text{
72 | padding-top: 40rpx;
73 | }
74 | .box .box_txt .text .icon-start{
75 | width: 100rpx;
76 | height: 97rpx;
77 | margin: 12rpx 0 10rpx;
78 | }
79 | .box .box_txt .text .icon-yh{
80 | width: 92rpx;
81 | height: 92rpx;
82 | margin: 10rpx 0;
83 | }
84 | .box .box_txt .text .txt{
85 | color: #fedeb2;
86 | line-height: 1.5em;
87 | }
88 | .box .box_txt .text .txt.txt1{
89 | font-size: 32rpx;
90 | }
91 | .box .box_txt .text .receive{
92 | margin: 60rpx 0 0;
93 | }
94 | .box .box_txt .text .receive text{
95 | font-size: 72rpx;
96 | margin-right: 4rpx;
97 | }
98 | .box .box_txt .text .wctime{
99 | width: 100%;
100 | height: 75rpx;
101 | position: absolute;
102 | bottom: 0;
103 | left:0
104 | }
105 | .box .box_txt .text .wctime image{
106 | width: 100%;
107 | height: 100%;
108 | }
109 | .box .box_txt .text .wctime view{
110 | color: #fedeb2;
111 | width: 180rpx;
112 | line-height: 75rpx;
113 | position: absolute;
114 | bottom: 0;
115 | right: 10rpx;
116 | }
117 |
118 | .count{
119 | width: 100%;
120 | text-align: center;
121 | }
122 | .count>view{
123 | display: inline-block;
124 | }
125 | .count-t{
126 | font-size: 28rpx;
127 | color: #fff;
128 | padding: 4rpx 40rpx;
129 | background: transparent;
130 | border: none
131 | }
132 | .count-t image{
133 | width: 36rpx;
134 | height: 36rpx;
135 | float: left;
136 | padding-top: 16rpx;
137 | margin-right: 10rpx;
138 | }
139 | button::after{
140 | display: none
141 | }
142 |
143 |
144 |
145 | .redinfo{
146 | width: 700rpx;
147 | margin:0 auto;
148 | text-align: left;
149 | line-height: 80rpx;
150 | font-size: 28rpx;
151 | }
152 | .redinfo>view{
153 | display: inline-block;
154 | }
155 | .redinfo .infotxt{
156 | color: #999;
157 | }
158 | .redinfo .report{
159 | float: right;
160 | color: #364a79;
161 | }
162 | .ls{
163 | width:700rpx;
164 | margin: 0 auto;
165 | font-size: 28rpx;
166 | color: #333;
167 | padding-bottom: 20rpx;
168 | }
169 | .ls-item{
170 | margin-bottom: 20rpx;
171 | padding: 24rpx 24rpx;
172 | background: #fff;
173 | border: 1rpx solid #e1e1e1;
174 | border-radius: 8rpx;
175 | text-align: left;
176 | overflow: hidden;
177 | position: relative;
178 | }
179 | .ls-item:last-child{
180 | margin-bottom: 0;
181 | }
182 | .ls-r{
183 | float: right;
184 | }
185 | .ls-item text{
186 | line-height: 44rpx;
187 | }
188 | .ls-s{
189 | display: inline-block;
190 | vertical-align: top;
191 | color: #333;
192 | }
193 |
194 | .ls-img{
195 | width: 100rpx;
196 | height: 100rpx;
197 | margin-top:4rpx
198 | }
199 | .ls-img image{
200 | width:100%;
201 | height: 100%;
202 | border-radius: 8rpx;
203 | }
204 | .ls-c{
205 | margin-left: 20rpx;
206 | }
207 | .ls-c .ls-c-t{
208 | display: inline-block;
209 | width: 310rpx;
210 | margin-top: 6rpx;
211 | overflow: hidden;
212 | text-overflow: ellipsis;
213 | white-space:nowrap;
214 | font-size: 30rpx;
215 | }
216 | .ls-r{
217 | text-align: right;
218 | position: absolute;
219 | right: 24rpx;
220 | top: 26rpx;
221 | }
222 | .ls-r text{
223 | line-height: 50rpx;
224 | }
225 | .ls-r-t{
226 | font-size: 30rpx;
227 | }
228 | .ls-r-b{
229 | display: block;
230 | color: #999;
231 | }
232 | .ls-c-b{
233 | width: 300rpx;
234 | color: #999
235 | }
236 |
237 | .clear{
238 | width: 100%;
239 | height: 80rpx;
240 | }
241 | .question{
242 | width: 100%;
243 | font-size: 24rpx;
244 | text-align: center;
245 | color: #364a79;
246 | position: absolute;
247 | bottom: 20rpx;
248 | }
249 | .bold{
250 | font-weight: 700;
251 | }
252 |
253 |
254 | .cue{
255 | background: #dc6142;
256 | position: fixed;
257 | font-size: 30rpx;
258 | top: 0;
259 | left: 0;
260 | bottom: 0;
261 | right: 0;
262 | transform: scale(0);
263 | -webkit-transform: scale(0);
264 | opacity: 0;
265 | transition: all .5s;
266 | -webkit-transition: all .5s;
267 | }
268 | .cue.on{
269 | transform: scale(1);
270 | -webkit-transform: scale(1);
271 | opacity: 1;
272 | }
273 | .cue .cue_top{
274 | width: 368rpx;
275 | height: 86rpx;
276 | margin: 70rpx auto;
277 | position: relative;
278 | }
279 | .cue .cue_top image{
280 | width: 100%;
281 | height: 100%;
282 | }
283 | .cue .cue_top view{
284 | width: 220rpx;
285 | line-height: 86rpx;
286 | font-size: 32rpx;
287 | color: #fff;
288 | text-align: center;
289 | position: absolute;
290 | top: 0;
291 | right: 10rpx;
292 | }
293 |
294 | .cue .cue_con{
295 | width: 600rpx;
296 | height: 600rpx;
297 | margin: 0 auto;
298 | background: #222;
299 | position: relative;
300 | }
301 | .cue .cue_con .img{
302 | overflow: hidden;
303 | position: absolute;
304 | z-index: 10;
305 | border: 1px solid #fff;
306 | transition: top .3s,left .3s;
307 | -webkit-transition: top .3s,left .3s;
308 | }
309 | .cue .cue_con .img.in{
310 | z-index: 15;
311 | }
312 | .cue .cue_con .img.on{
313 | z-index: 20;
314 | border-color: #ff0000;
315 | }
316 | .cue .cue_con .img image{
317 | position: absolute;
318 | }
319 | .cue .cue_con .timeout{
320 | width: 260rpx;
321 | height: 260rpx;
322 | position: absolute;
323 | top: 50%;
324 | left: 50%;
325 | margin-top:-130rpx;
326 | margin-left: -130rpx;
327 | border-radius: 50%;
328 | background: rgba(0, 0, 0, 0.5);
329 | z-index: 999;
330 | transform: scale(1);
331 | -webkit-transform: scale(1);
332 | opacity: 1;
333 | transition: all .3s;
334 | -webkit-transition: all .3s;
335 | }
336 | .cue .cue_con .timeout.on{
337 | transform: scale(0);
338 | -webkit-transform: scale(0);
339 | opacity: 0;
340 | }
341 |
342 | .cue .cue_con .timeout view{
343 | width: 100%;
344 | line-height: 260rpx;
345 | text-align: center;
346 | font-size: 180rpx;
347 | color: #fff;
348 | font-weight: 700;
349 | }
350 |
351 | .cue .cue_point{
352 | margin-top: 60rpx;
353 | text-align: center;
354 | }
355 | .cue .cue_bottom{
356 | position: fixed;
357 | top: 924rpx;
358 | left: 0;
359 | right: 0;
360 | bottom: 0;
361 | display: flex;
362 | justify-content:center;
363 | align-items:center;
364 | }
365 | .cue .cue_btn{
366 | width: 300rpx;
367 | height: 90rpx;
368 | line-height: 90rpx;
369 | text-align: center;
370 | position: relative;
371 | }
372 | .cue .cue_btn image{
373 | width: 100%;
374 | height: 100%;
375 | position: absolute;
376 | left: 0;
377 | top: 0;
378 | }
379 |
380 |
381 | .end{
382 | background: rgba(0, 0, 0, 0.5);
383 | position: fixed;
384 | font-size: 30rpx;
385 | top: 0;
386 | left: 0;
387 | bottom: 0;
388 | right: 0;
389 | transform: scale(0);
390 | -webkit-transform: scale(0);
391 | opacity: 0;
392 | transition: all .5s;
393 | -webkit-transition: all .5s;
394 | }
395 | .end.on{
396 | transform: scale(1);
397 | -webkit-transform: scale(1);
398 | opacity: 1;
399 | }
400 | .end .end_bao{
401 | width: 600rpx;
402 | height: 720rpx;
403 | position: absolute;
404 | left: 50%;
405 | top: 50%;
406 | margin-left: -300rpx;
407 | margin-top: -360rpx;
408 | }
409 | .end .end_bao .end_bg{
410 | width: 100%;
411 | height: 100%;
412 | position: absolute;
413 | bottom: 0;
414 | }
415 | .end .end_bao .end_bg.end_bg3{
416 | width: 100%;
417 | height: 831rpx;
418 | }
419 | .end .end_bao .end_bg.out{
420 | opacity: 0;
421 | }
422 | .end .end_bao .end_bg.in{
423 | opacity: 1;
424 | }
425 | .end .end_bao .end_tou{
426 | width: 120rpx;
427 | height: 120rpx;
428 | position: absolute;
429 | top: 62rpx;
430 | left: 240rpx;
431 | }
432 | .end .end_bao .end_tou image{
433 | width: 100%;
434 | height: 100%;
435 | border-radius: 50%;
436 | }
437 | .end .end_bao .end_text{
438 | width: 100%;
439 | line-height: 60rpx;
440 | position: absolute;
441 | top:210rpx;
442 | text-align: center;
443 | }
444 | .end .end_bao .end_btn{
445 | width: 180rpx;
446 | height: 180rpx;
447 | border-radius: 50%;
448 | position: absolute;
449 | left: 210rpx;
450 | top: 324rpx;
451 |
452 | }
453 | .end .end_bao .end_btn.run{
454 | animation: circle 1s linear infinite;
455 | -webkit-animation: circle 1s linear infinite;
456 | }
457 | @keyframes circle{
458 | 0%{transform: rotateY(0deg)}
459 | 10%{transform: rotateY(-10deg)}
460 | 50%{transform: rotateY(-180deg)}
461 | 90%{transform: rotateY(-350deg)}
462 | 100%{transform: rotateY(-360deg)}
463 | }
464 | @-webkit-keyframes circle{
465 | 0%{transform: rotateY(0deg)}
466 | 10%{transform: rotateY(-10deg)}
467 | 50%{transform: rotateY(-180deg)}
468 | 90%{transform: rotateY(-350deg)}
469 | 100%{transform: rotateY(-360deg)}
470 | }
471 | .end .end_bao .end_btn image{
472 | width: 100%;
473 | height: 100%;
474 | }
475 | .end .end_bao .end_fail{
476 | width: 100%;
477 | position: absolute;
478 | top: 450rpx;
479 | text-align: center;
480 | }
481 | .end .end_bao .end_fail .fail_txt{
482 | line-height: 56rpx;
483 | font-size: 36rpx;
484 | }
485 | .end .end_bao .end_fail .fail_btn{
486 | width: 470rpx;
487 | line-height: 72rpx;
488 | background: #07ba09;
489 | margin: 30rpx auto 0;
490 | color: #fff;
491 | }
492 | .end .fail_clear{
493 | width: 100%;
494 | position: absolute;
495 | top: 960rpx;
496 | height: 140rpx;
497 | display: flex;
498 | justify-content:center;
499 | align-items:center;
500 | }
501 |
502 | .end_success{
503 | width: 100%;
504 | position: absolute;
505 | top: 294rpx;
506 | text-align: center;
507 | }
508 | .end_success .success_tit text{
509 | font-size: 88rpx;
510 | margin-right: 6rpx;
511 | }
512 | .end_success .success_txt{
513 | margin-top: 30rpx;
514 | color: #fff;
515 | font-size: 28rpx;
516 | }
517 |
518 | .end_success .success_btn{
519 | width: 470rpx;
520 | line-height: 72rpx;
521 | background: #07ba09;
522 | margin: 30rpx auto 0;
523 | color: #fff;
524 | }
525 | .end_success .success_btn2{
526 | background: #fff;
527 | color: #333;
528 | }
--------------------------------------------------------------------------------
/pages/redpacket/redpacket.js:
--------------------------------------------------------------------------------
1 | //redpacket.js
2 | //获取应用实例
3 | const app = getApp();
4 | var winW = wx.getSystemInfoSync().windowWidth;
5 | var maxsum = 50000; // 最大赏金
6 | var maxnum = 1000; // 最大个数
7 | var minfc = 1; // 最小发出金额
8 | var minlq = 1; // 最小领取金额
9 | var commision = 0.02; // 佣金比例(*%)
10 |
11 | Page({
12 | data: {
13 | userInfo: {}, // 用户信息
14 | hasUserInfo: false, // 用户授权
15 | canIUse: wx.canIUse('button.open-type.getUserInfo'), // 检测小程序版本兼容
16 | imgsrc: '',
17 | boxW: 180,
18 | imgW: 0,
19 | imgH: 0,
20 | imgL: 0,
21 | imgT: 0,
22 | mode: 3, //模式难度
23 | lines:[],
24 | template:[],
25 | textCN:'', // 输入框内容
26 | difficulty: true,
27 | sum: '', // 赏金
28 | num: '', // 数量
29 | serviceCharge:'0.00', // 服务费
30 | balance:'0.00', // 账户余额
31 | commision: 0, // 手续费比例
32 | token: '',
33 | btn:'生成拼图PK', // 按钮
34 | },
35 | //获取登录信息
36 | onLoad: function () {
37 | this.tomode();
38 | this.loop();
39 | },
40 | onShow:function(){
41 | var that = this;
42 | var src = wx.getStorageSync('src');
43 | // var W = wx.getStorageSync('W')
44 | // var L = wx.getStorageSync('L') || 0
45 | // var T = wx.getStorageSync('T') || 0
46 | var boxW = winW * .5
47 |
48 | that.setData({
49 | imgsrc: src,
50 | boxW: boxW
51 | })
52 |
53 | },
54 | //事件处理函数
55 | //难度选择
56 | tomode:function(e){
57 | var mode = !e ? this.data.mode : parseFloat(e.currentTarget.dataset.id),
58 | lines = [];
59 | for (var i = 1; i < 6; i++) {
60 | var obj = i * 100 / mode + '%';
61 | lines.push(obj);
62 | }
63 | console.log(lines);
64 | this.setData({
65 | lines: lines,
66 | mode: mode
67 | })
68 |
69 | },
70 | //选择推荐模版
71 | stencilShow:function(){
72 | var that = this,
73 | template = that.data.template
74 |
75 | wx.showActionSheet({
76 | itemList: template,
77 | success: function (res) {
78 | let i = res.tapIndex
79 | that.setData({
80 | textCN: template[i]
81 | })
82 | },
83 | fail: function (res) {
84 | console.log(res.errMsg)
85 | }
86 | })
87 | },
88 |
89 | //输入框规则
90 | // bindKLInput:function(e){
91 | // //筛选出汉字
92 | // var val = e.detail.value.trim(),
93 | // reg = /[\u4e00-\u9fa5]/g,
94 | // result = val.match(reg);
95 |
96 | // if (result === null){
97 | // this.setData({
98 | // textCN: ''
99 | // })
100 | // }else{
101 | // result = result.join("");
102 | // this.setData({
103 | // textCN: result
104 | // })
105 | // }
106 | // },
107 |
108 | //金额输入框函数
109 | bindJEInput: function (e) {
110 | var value = !e ? this.data.sum : e.detail.value;
111 | var inp = Math.round(value * 100) / 100;
112 | var bi = commision/100;
113 | inp = inp > maxsum ? maxsum : inp;
114 | inp = inp > minfc ? inp.toFixed(2) : minfc.toFixed(2);
115 | var val = inp*1;
116 | var balance = parseFloat(this.data.balance);
117 | var serc = Math.round(val * bi * 100) / 100;
118 | var actual = val + serc > balance ? (val + serc - balance).toFixed(2) : 0;
119 | serc = inp*1>0 ? serc < 0.01 ? 0.01 : serc : 0;
120 | if (parseFloat(actual) > 0) {
121 | //var btntxt = '还需支付' + actual + '元'
122 | this.setData({
123 | sum: inp,
124 | serviceCharge: serc.toFixed(2),
125 | //btn: btntxt
126 | })
127 | }else{
128 | this.setData({
129 | sum: inp,
130 | serviceCharge: serc.toFixed(2),
131 | //btn: '生成拼图PK'
132 | })
133 | }
134 | },
135 | //数量输入框控制函数
136 | bindSLInput: function(e){
137 | var num = parseFloat(e.detail.value);
138 | num = num > 1 ? num > maxnum ? maxnum : num : 1;
139 | this.setData({
140 | num: num
141 | })
142 | },
143 | //表单提交
144 | formSubmit: function (e) {
145 | var that = this;
146 | var val = e.detail.value,
147 | valkl = val.text,
148 | valsj = val.sum*1,
149 | valsl = parseFloat(val.num),
150 | formid = e.detail.formId;
151 | if(valkl == ''){
152 | wx.showModal({
153 | title: '提示',
154 | content: '请留下你的寄语!',
155 | showCancel:false,
156 | success: function (res) {
157 | }
158 | })
159 | return false
160 | }
161 | if(valsj == ''){
162 | wx.showModal({
163 | title: '提示',
164 | content: '请填写金额!',
165 | showCancel: false,
166 | success: function (res) {
167 | }
168 | })
169 | return false
170 | }
171 | if(valsl == ''){
172 | wx.showModal({
173 | title: '提示',
174 | content: '请填写数量!',
175 | showCancel: false,
176 | success: function (res) {
177 | }
178 | })
179 | return false
180 | }
181 | valsj = valsj > maxsum ? maxsum : valsj;
182 | valsj = valsj > minfc ? valsj : minfc;
183 | valsl = valsl > 1 ? valsl > maxnum ? maxnum : valsl : 1;
184 | var ns = valsj*100 - minlq*100*valsl;
185 | if (ns < 0) {
186 | wx.showModal({
187 | title: '提示',
188 | content: '单个金额不能少于' + minlq.toFixed(2) + '元',
189 | showCancel: false,
190 | success: function (res) {
191 | }
192 | })
193 | return false
194 | }
195 |
196 | //登录信息验证
197 | var tok = app.globalData.token;
198 | if (!tok){return false;}
199 | wx.showLoading({
200 | title: '正在提交',
201 | mask: true
202 | })
203 | var mode = this.data.mode
204 | var src = wx.getStorageSync('src')
205 | var W = wx.getStorageSync('W')
206 | var L = wx.getStorageSync('L')
207 | var T = wx.getStorageSync('T')
208 | // wx.uploadFile({
209 | // url: app.setConfig.url + '/index.php/Asset/asset/plupload',
210 | // filePath: src,
211 | // name: 'file',
212 | // formData: {
213 | // 'token': tok,
214 | // },
215 | // success: function (res) {
216 | // wx.showLoading({
217 | // title: '信息验证',
218 | // mask: true
219 | // })
220 | // var src = JSON.parse(res.data).file_url;
221 | //提交信息
222 | var postUrl = app.setConfig.url + '/index.php/Api/Enve/saveEnve',
223 | postData = {
224 | quest: valkl,
225 | amount: valsj,
226 | num: valsl,
227 | type: mode,
228 | pic_dir:src,
229 | form_id: formid,
230 | token: tok
231 | };
232 | app.postLogin(postUrl, postData, that.saveEnve);
233 | return false;
234 | // }
235 | // })
236 |
237 | },
238 | //查看原图
239 | toimgs: function () {
240 | var src = this.data.imgsrc;
241 | wx.showActionSheet({
242 | itemList: ['查看原图', '从手机相册选择', '摄影师作品'],
243 | success: function (res) {
244 | if (res.tapIndex == 0) {
245 | wx.previewImage({
246 | current: '', // 当前显示图片的http链接
247 | urls: [src] // 需要预览的图片http链接列表
248 | })
249 | } else if (res.tapIndex == 1) {
250 | wx.chooseImage({
251 | count: 1,
252 | sizeType: ['original', 'compressed'],
253 | sourceType: ['album'],
254 | success(res) {
255 | const tempFilePaths = res.tempFilePaths[0];
256 | console.log(tempFilePaths);
257 | wx.navigateTo({
258 | url: '../cutImgs/cutImgs?tempPicUrl=' + tempFilePaths
259 | })
260 | //that.pushImg(tempFilePaths);
261 | }
262 | });
263 | } else {
264 | wx.navigateTo({
265 | url: '../select/select?cid=1'
266 | });
267 | }
268 | },
269 | fail: function (res) {
270 | console.log(res.errMsg)
271 | }
272 | })
273 | },
274 | // 转发
275 | onShareAppMessage: function (res) {
276 | var title = '新奇的拼图领赏玩法,快来体验吧 >>';
277 | return {
278 | title: title,
279 | path: '/pages/index/index',
280 | success: function (res) {
281 | // 转发成功
282 | wx.showToast({
283 | title: '转发成功',
284 | icon: 'success',
285 | duration: 2000
286 | })
287 | },
288 | fail: function (res) {
289 | // 转发失败
290 | }
291 | }
292 | },
293 | //提交
294 | saveEnve:function(res){
295 | var that = this;
296 | console.log(res)
297 | if(res.data.code===20000){
298 | var payInfo = res.data.data;
299 | var pid = payInfo.pid;
300 | if (payInfo.pay_type == 2){
301 | var balance = parseFloat(that.data.balance) - parseFloat(that.data.sum) - parseFloat(that.data.serviceCharge);
302 | wx.showToast({
303 | title: '支付成功',
304 | mask: true,
305 | icon: 'success',
306 | duration: 1000
307 | })
308 | var ownerImg = that.data.userInfo.avatarUrl
309 | var ownerName = that.data.userInfo.nickName
310 | var describe = that.data.textCN
311 | wx.setStorageSync('SPid', pid)
312 | wx.setStorageSync('SOwnerImg', ownerImg)
313 | wx.setStorageSync('SOwnerName', ownerName)
314 | wx.setStorageSync('SDescribe', describe)
315 | setTimeout(function () {
316 | that.setData({
317 | sum: '',
318 | num: '',
319 | balance: balance.toFixed(2)
320 | })
321 | wx.navigateTo({
322 | url: '../share/share?cid=0'
323 | })
324 | }, 1000)
325 | var postUrlTZ = app.setConfig.url + '/index.php?g=Api&m=Enve&a=sendCreateEnveNotify',
326 | postDataTZ = {
327 | token: app.globalData.token,
328 | prepay_id: payInfo.prepay_id,
329 | pid: payInfo.pid
330 | };
331 | app.postLogin(postUrlTZ, postDataTZ);
332 | }else{
333 | wx.requestPayment({
334 | 'timeStamp': payInfo.timeStamp,
335 | 'nonceStr': payInfo.nonceStr,
336 | 'package': payInfo.package,
337 | 'signType': 'MD5',
338 | 'paySign': payInfo.paySign,
339 | 'success': function (res) {
340 | var balance = parseFloat(that.data.balance) - parseFloat(that.data.sum);
341 | wx.showToast({
342 | title: '支付成功',
343 | icon: 'success',
344 | duration: 1000
345 | })
346 | var ownerImg = that.data.userInfo.avatarUrl
347 | var ownerName = that.data.userInfo.nickName
348 | var describe = that.data.textCN
349 | wx.setStorageSync('SPid', pid)
350 | wx.setStorageSync('SOwnerImg', ownerImg)
351 | wx.setStorageSync('SOwnerName', ownerName)
352 | wx.setStorageSync('SDescribe', describe)
353 | setTimeout(function(){
354 | that.setData({
355 | sum: '',
356 | num: '',
357 | balance: '0.00'
358 | })
359 | wx.navigateTo({
360 | url: '../share/share?cid=0'
361 | })
362 | },1000)
363 | var postUrlTZ = app.setConfig.url + '/index.php?g=Api&m=Enve&a=sendCreateEnveNotify',
364 | postDataTZ = {
365 | token: app.globalData.token,
366 | prepay_id: payInfo.prepay_id,
367 | pid: payInfo.pid
368 | };
369 | app.postLogin(postUrlTZ, postDataTZ);
370 | },
371 | 'fail': function (res) {
372 | // 支付失败
373 | wx.showToast({
374 | title: '支付失败',
375 | icon: 'loading',
376 | mask: true,
377 | duration: 1000
378 | })
379 | //释放冻结金额
380 | var postUrl = app.setConfig.url + '/index.php?g=User&m=Consumer&a=rurnFrozenAmount',
381 | postData = {
382 | token: app.globalData.token
383 | };
384 | app.postLogin(postUrl, postData);
385 | }
386 |
387 | })
388 | }
389 | }
390 | return false;
391 | },
392 |
393 | loop: function () {
394 | var info = app.globalData.userInfo,
395 | tok = app.globalData.token;
396 | if (info && !this.data.hasUserInfo){
397 | wx.showLoading({
398 | title: '数据初始化',
399 | mask: true
400 | })
401 | this.setData({
402 | userInfo: info,
403 | hasUserInfo: true
404 | })
405 | }
406 | if (!tok) {
407 | var that = this
408 | setTimeout(function () { that.loop(); }, 100)
409 | } else {
410 | this.setData({
411 | token: tok
412 | })
413 | var postUrl = app.setConfig.url + '/index.php?g=User&m=Consumer&a=userInfo',
414 | postData = {
415 | token: tok
416 | };
417 | app.postLogin(postUrl, postData, this.initial);
418 | }
419 | },
420 |
421 | initial: function (res) {
422 | wx.hideLoading()
423 | if (res.data.code == 20000) {
424 | var data = res.data.data;
425 | var difficulty = !data.difficulty ? true : false;
426 | maxsum = !data.hb_max_amount ? 50000 : data.hb_max_amount; // 最大赏金
427 | maxnum = !data.hb_max_num ? 1000 : data.hb_max_num; // 最大个数
428 | minfc = !data.amount_min ? 1 : data.amount_min; // 最小发出金额
429 | minlq = !data.receive_amount_min ? 1 : data.receive_amount_min; // 最小领取金额
430 | commision = !data.commision ? 2 : data.commision; // 佣金比例(*%)
431 | this.setData({
432 | template: data.word_tpl,
433 | textCN: data.word_tpl[0],
434 | commision: commision,
435 | difficulty: difficulty
436 | })
437 | //this.bindJEInput();
438 | }
439 | }
440 | })
441 |
--------------------------------------------------------------------------------
/pages/redpacket/redpacket.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "小猪拼拼图夺宝"
3 | }
--------------------------------------------------------------------------------
/pages/redpacket/redpacket.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | 请勿上传色情以及其他违禁图片
13 | 本小程序有权在收到投诉后删除相应内容
14 |
15 |
44 |
45 |
--------------------------------------------------------------------------------
/pages/redpacket/redpacket.wxss:
--------------------------------------------------------------------------------
1 | /**redpacket.wxss**/
2 |
3 | page{
4 | background: #dc6142;
5 | height: 100%;
6 | }
7 |
8 | .container{
9 | height: auto;
10 | padding: 40rpx 0 0;
11 | margin: 0;
12 | justify-content: flex-start;
13 | }
14 |
15 | .container .picture{
16 | margin: 0 auto 24rpx;
17 | background: #000;
18 | border: 12rpx solid #fff;
19 | overflow: hidden;
20 | position: relative;
21 | }
22 | .container .picture .img{
23 | width: 100%;
24 | height: 100%;
25 | overflow: hidden;
26 | position: relative;
27 | }
28 | .container .picture .img image{
29 | width: 100%;
30 | height: 100%;
31 | position:absolute;
32 | left:0;
33 | top:0
34 | }
35 | .container .picture .line{
36 | position: absolute;
37 | transition: all .2s;
38 | }
39 | .container .picture .row{
40 | width: 100%;
41 | height: 0;
42 | border-top: 1px solid #fff;
43 | left: 0;
44 | }
45 | .container .picture .col{
46 | width: 0;
47 | height: 100%;
48 | border-left: 1px solid #fff;
49 | top: 0;
50 | }
51 | .container .txt{
52 | font-size: 26rpx;
53 | line-height: 40rpx;
54 | text-align: center;
55 | }
56 | .container .con{
57 | width: 680rpx;
58 | margin: 40rpx auto 0;
59 | padding-bottom: 30rpx;
60 | }
61 | .container .con .box{
62 | background: #fff;
63 | border-radius: 8rpx;
64 | padding: 0 30rpx;
65 | }
66 | .container .con .box .ls{
67 | height: 92rpx;
68 | line-height: 92rpx;
69 | border-bottom: 1px solid #eee;
70 | display: flex;
71 | justify-content: flex-start;
72 | align-items:center;
73 | }
74 | .container .con .box .ls.inp1 input{
75 | width: 540rpx;
76 | display: block;
77 | height: 92rpx;
78 | line-height: 92rpx;
79 | }
80 | .container .con .box .inp1 .icon-text{
81 | width: 60rpx;
82 | height: 60rpx;
83 | padding: 10rpx;
84 | }
85 | .container .con .box .inp1 .icon-text image{
86 | width: 60rpx;
87 | height: 60rpx;
88 | }
89 | .container .con .box .ls .tit{
90 | width: 180rpx;
91 | }
92 | .container .con .box .ls .md{
93 | height: 44rpx;
94 | line-height: 42rpx;
95 | padding:0 20rpx;
96 | margin-right: 32rpx;
97 | font-size: 24rpx;
98 | border:1px solid #a1a1a1;
99 | color: #8d8d8d;
100 | border-radius: 8rpx;
101 | }
102 | .container .con .box .ls .md.on{
103 | background: #dc6142;
104 | color: #fff;
105 | border-color: #dc6142;
106 | }
107 | .container .con .box .ls input{
108 | width: 420rpx;
109 | color:#993621;
110 | }
111 | .container .con .service{
112 | line-height: 72rpx;
113 | text-align: center;
114 | font-size: 26rpx;
115 | margin-top: 10rpx;
116 | }
117 | .container .con .btn button{
118 | width: 100%;
119 | height: 92rpx;
120 | line-height: 92rpx;
121 | border-radius: 8rpx;
122 | background: #f4e3b7;
123 | color: #993621;
124 | }
--------------------------------------------------------------------------------
/pages/report/report.js:
--------------------------------------------------------------------------------
1 | //report.js
2 | const app = getApp()
3 |
4 | Page({
5 | data: {
6 | lists: [{
7 | id: 1,
8 | con:'1.欺诈'
9 | }, {
10 | id: 2,
11 | con: '2.色情'
12 | }, {
13 | id: 3,
14 | con: '3.政治谣言'
15 | }, {
16 | id: 4,
17 | con: '4.常识性谣言'
18 | }, {
19 | id: 5,
20 | con: '5.诱导分享'
21 | }, {
22 | id: 6,
23 | con: '6.恶意营销'
24 | }, {
25 | id: 7,
26 | con: '7.隐身信息收集'
27 | }, {
28 | id: 8,
29 | con: '8.其他侵权类(冒名、诽谤、抄袭)'
30 | }],
31 | control:-1,
32 | phone:'',
33 | wx:'',
34 | version:'1.5.0',
35 | btn:true
36 | },
37 | //选择原因
38 | onshow: function(e){
39 | if (this.data.control != e.target.dataset.id){
40 | this.setData({
41 | control: e.target.dataset.id
42 | })
43 | }
44 | },
45 | // 表单提交
46 | submit: function () {
47 | var that = this;
48 | if(this.data.control === -1){
49 | wx.showModal({
50 | title: '提示',
51 | content: '请选择举报原因!',
52 | showCancel: false,
53 | success: function (res) {
54 | }
55 | })
56 | }else{
57 | if (this.data.btn){
58 | wx.showToast({
59 | title: '举报成功',
60 | icon: 'success',
61 | duration: 1200
62 | })
63 | that.setData({
64 | control:-1,
65 | btn:false
66 | })
67 | }else{
68 | wx.showToast({
69 | title: '您已举报',
70 | icon: 'loading',
71 | duration: 1200
72 | })
73 | }
74 | }
75 | },
76 | onLoad: function () {
77 | var res = wx.getSystemInfoSync();
78 | this.setData({
79 | version: res.SDKVersion
80 | })
81 | }
82 | })
83 |
--------------------------------------------------------------------------------
/pages/report/report.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "举报"
3 | }
--------------------------------------------------------------------------------
/pages/report/report.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 请选择举报原因
4 |
5 |
6 |
7 |
8 | {{obj.con}}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/pages/report/report.wxss:
--------------------------------------------------------------------------------
1 | page{
2 | height: 100%;
3 | overflow: hidden;
4 | }
5 | .con{
6 | padding-bottom: 30rpx;
7 | position: relative;
8 | }
9 | .reason{
10 | font-size: 28rpx;
11 | margin-top: 6rpx;
12 | line-height: 66rpx;
13 | color: #999;
14 | text-align: center;
15 | }
16 | .report-list {
17 | display: flex;
18 | flex-direction: column;
19 | padding: 0 30rpx;
20 | }
21 | .list{
22 | font-size: 32rpx;
23 | color: #333;
24 | margin-bottom: 12rpx;
25 | }
26 |
27 | .list .tit{
28 | line-height: 100rpx;
29 | padding: 0 54rpx 0 46rpx;
30 | position: relative;
31 | border-radius: 8rpx;
32 | background: #fff;
33 | }
34 |
35 | .icon{
36 | width: 50rpx;
37 | height: 50rpx;
38 | border-radius: 50%;
39 | line-height: normal;
40 | padding: 0;
41 | margin-top:24rpx;
42 | float: right;
43 |
44 | }
45 | .icon icon{
46 | margin: 0;
47 | width: 50rpx;
48 | height: 50rpx;
49 | }
50 | .icon .icon-no{
51 | width: 50rpx;
52 | height: 50rpx;
53 | border-radius: 50%;
54 | border: 1rpx solid #ccc;
55 | }
56 | .personal{
57 | font-size: 28rpx;
58 | margin-top: 6rpx;
59 | line-height: 66rpx;
60 | text-indent: 30rpx;
61 | color: #999;
62 | }
63 | .report-form{
64 | padding-bottom: 50rpx;
65 | }
66 | .form-txt{
67 | background: #fff;
68 | border-top: 1rpx solid #e1e1e1;
69 | border-bottom: 1rpx solid #e1e1e1;
70 | }
71 | .report-form .txt{
72 | margin: 0 30rpx;
73 | font-size: 32rpx;
74 | color: #333;
75 | line-height: 100rpx;
76 | }
77 | .report-form .txt:first-child{
78 | border-bottom: 1rpx solid #e1e1e1;
79 | }
80 | .report-form .txt text{
81 | display: inline-block;
82 | width: 140rpx;
83 | text-indent: 15rpx;
84 | vertical-align: middle
85 | }
86 | .report-form .txt input{
87 | display: inline-block;
88 | width: 520rpx;
89 | padding-left: 15rpx;
90 | vertical-align: middle
91 | }
92 |
93 | .btn{
94 | width: 700rpx;
95 | margin: 30rpx auto 0;
96 | line-height: 80rpx;
97 | text-align: center;
98 | background: #28b265;
99 | border-radius: 8rpx;
100 | }
101 |
102 | .btn text{
103 | display: inline-block;
104 | vertical-align: middle;
105 | font-size: 32rpx;
106 | color: #fff;
107 | }
108 |
--------------------------------------------------------------------------------
/pages/select/select.js:
--------------------------------------------------------------------------------
1 | // pages/select/select.js
2 | const app = getApp()
3 | var shearIn = 0
4 |
5 | Page({
6 | /**
7 | * 页面的初始数据
8 | */
9 | data: {
10 | team: [], // 图片类目
11 | select: '', // 图片库详情
12 | selectKey: 0 // 当前类目
13 | },
14 | // 选择
15 | select: function (e) {
16 | var key = e.currentTarget.dataset.key;
17 | if (key == this.data.selectKey){return false}
18 | this.setData({
19 | selectKey: key
20 | })
21 | if (this.data.select[key].length>0){return false}
22 | this.loaddata()
23 | },
24 | // 图片
25 | selected: function (e) {
26 | var src = e.currentTarget.dataset.src;
27 | wx.setStorageSync("src", src);
28 | if (shearIn == 0) {
29 | wx.navigateTo({
30 | url: '../redpacket/redpacket'
31 | })
32 | } else if (shearIn == 1) {
33 | wx.navigateBack({
34 | delta: 1
35 | })
36 | }
37 | },
38 | /**
39 | * 生命周期函数--监听页面加载
40 | */
41 | onLoad: function (options) {
42 | shearIn = options.cid;
43 | if (!app.globalData.token) {
44 | wx.showLoading({
45 | title: '加载中•••',
46 | mask: true
47 | })
48 | }
49 | this.loop()
50 | },
51 | loop: function () {
52 | if (!app.globalData.token) {
53 | var that = this
54 | setTimeout(function () { that.loop(); }, 100)
55 | } else {
56 | wx.hideLoading()
57 | var that = this
58 | var tok = app.globalData.token;
59 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Enve&a=getPicCats',
60 | postData = {
61 | token: tok,
62 | picCatId: 0
63 | };
64 | app.postLogin(postUrl, postData, function(res){
65 | if (res.data.code == 20000) {
66 | let datas = res.data
67 | let team = []
68 | let select = [];
69 | let selectKey = that.data.selectKey
70 | for (let i = 0; i < datas.picCats.length; i++) {
71 | team[i] = datas.picCats[i].cat_name;
72 | select[i] = [];
73 | }
74 | select = !that.data.select ? select : that.data.select;
75 | select[selectKey] = select[selectKey].concat(datas.fistCatPics);
76 | that.setData({
77 | team,
78 | select
79 | })
80 | }
81 | });
82 | }
83 | },
84 | loaddata:function(){
85 | var tok = app.globalData.token;
86 | var id = this.data.selectKey*1+1;
87 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=Enve&a=getPics',
88 | postData = {
89 | token: tok,
90 | picCatId: id
91 | };
92 | app.postLogin(postUrl, postData, this.initial);
93 | },
94 | initial: function (res) {
95 | console.log(res)
96 | if (res.data.code == 20000) {
97 | let data = res.data.data
98 | let selectKey = this.data.selectKey
99 | let select = this.data.select;
100 | select[selectKey] = select[selectKey].concat(data);
101 | this.setData({
102 | select
103 | })
104 | }
105 | },
106 |
107 | })
--------------------------------------------------------------------------------
/pages/select/select.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "选择拼图"
3 | }
--------------------------------------------------------------------------------
/pages/select/select.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{item}}
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/pages/select/select.wxss:
--------------------------------------------------------------------------------
1 | /* pages/select/select.wxss */
2 | page{
3 | background: #fff;
4 | }
5 | .container {
6 | background: #fff;
7 | }
8 | .left {
9 | width: 180rpx;
10 | position: fixed;
11 | top: 0;
12 | left: 0;
13 | }
14 | .left .item {
15 | height: 106rpx;
16 | line-height: 106rpx;
17 | text-align: center;
18 | border-bottom: 1rpx solid #eee;
19 | }
20 | .left .item.on {
21 | background: #eee;
22 | color: #d95940;
23 | }
24 | .right {
25 | display: flex;
26 | flex-wrap: wrap;
27 | justify-content: space-between;
28 | padding: 0 20rpx 20rpx;
29 | width: 572rpx;
30 | min-height: 100%;
31 | background: #eee;
32 | box-sizing: border-box;
33 | }
34 | .right.rg0{
35 | padding-bottom: 0;
36 | }
37 | .right .item {
38 | width: 257rpx;
39 | height: 257rpx;
40 | margin-top: 18rpx;
41 | border: 8rpx solid #fff;
42 | box-shadow: 1rpx 1rpx 10rpx #ddd;
43 | box-sizing: border-box;
44 | }
45 | .right .item image {
46 | width: 241rpx;
47 | height: 241rpx;
48 | }
--------------------------------------------------------------------------------
/pages/share/share.js:
--------------------------------------------------------------------------------
1 | //share.js
2 | //获取应用实例
3 | const app = getApp()
4 |
5 | Page({
6 | data: {
7 | userInfo: {},
8 | hasUserInfo: false,
9 | canIUse: wx.canIUse('button.open-type.getUserInfo'),
10 | pid:'', // id
11 | cid: '0', // 页面入口标识
12 | ownerImg: '', // 头像
13 | ownerName: '', // 名字
14 | redtips: '发了一个拼图夺宝',
15 | describe: '你拼出来算我输',
16 | xcxewm:'',
17 | opensrc:'',
18 | relay:'给你发了一个拼图夺宝,立刻去挑战吧 >>' // 自定义转发标签
19 | },
20 |
21 | //拨打电话
22 | tel: function () {
23 | wx.makePhoneCall({
24 | phoneNumber: '020-22096568'
25 | })
26 | },
27 | //事件处理函数
28 | mytry: function () {
29 | var id = this.data.pid,
30 | cid = this.data.cid;
31 | if (cid == 0) {
32 | wx.navigateTo({
33 | url: '../recordDetails/recordDetails?pid=' + id
34 | })
35 | } else {
36 | wx.navigateBack({
37 | delta: 1
38 | })
39 | }
40 | },
41 | //转发
42 | onShareAppMessage: function (res) {
43 | wx.hideToast();
44 | var id = this.data.pid,
45 | title = this.data.ownerName + ' ' + this.data.relay;
46 | if (res.from === 'button') {
47 | // 来自页面内转发按钮
48 | console.log(res)
49 | }
50 | return {
51 | title: title,
52 | path: 'pages/recordDetails/recordDetails?pid='+id,
53 | success: function (res) {
54 | // 转发成功
55 | wx.showToast({
56 | title: '转发成功',
57 | icon: 'success',
58 | duration: 2000
59 | })
60 | },
61 | fail: function (res) {
62 | // 转发失败
63 | }
64 | }
65 | },
66 | //生成朋友圈分享图
67 | sheng:function(){
68 | var cid = this.data.cid
69 | var redtips = this.data.redtips
70 | var xcxewm = this.data.xcxewm
71 | wx.setStorageSync('SRedtips', redtips)
72 | wx.setStorageSync('SXcxewm', xcxewm)
73 | if(cid == 0){
74 | wx.navigateTo({
75 | url: '../compose/compose'
76 | })
77 | }else{
78 | wx.redirectTo({
79 | url: '../compose/compose'
80 | })
81 | }
82 | },
83 | //获取登录信息
84 | onLoad: function (option) {
85 | this.loop(option)
86 | },
87 | loop: function (option){
88 | var info = app.globalData.userInfo,
89 | tok = app.globalData.token;
90 | var pid = wx.getStorageSync('SPid')
91 | var ownerImg = wx.getStorageSync('SOwnerImg')
92 | var ownerName = wx.getStorageSync('SOwnerName')
93 | var describe = wx.getStorageSync('SDescribe')
94 | this.setData({
95 | userInfo: info,
96 | token: tok,
97 | pid: pid,
98 | cid: option.cid,
99 | hasUserInfo: true,
100 | ownerName: ownerName,
101 | ownerImg: ownerImg, //用户头像
102 | describe: describe
103 | })
104 | wx.showLoading({
105 | title: '二维码生成中',
106 | mask: true
107 | })
108 |
109 | //二维码
110 | var postUrl = app.setConfig.url + '/index.php?g=Api&m=ToCode&a=getQrcode',
111 | postData = {
112 | token: tok,
113 | tit: this.data.redtips,
114 | pid: pid,
115 | con: this.data.describe,
116 | page: 'pages/recordDetails/recordDetails'
117 | };
118 | app.postLogin(postUrl, postData, this.setCode);
119 | },
120 | setCode: function(res){
121 | if(res.data.code === 20000){
122 | this.setData({
123 | xcxewm: app.setConfig.url + '/' + res.data.data,
124 | opensrc:'/images/open.png'
125 | })
126 | wx.showToast({
127 | title: '生成成功',
128 | icon: 'success',
129 | mask: true,
130 | duration: 1000
131 | })
132 | }
133 |
134 | }
135 | })
136 |
--------------------------------------------------------------------------------
/pages/share/share.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "分享"
3 | }
--------------------------------------------------------------------------------
/pages/share/share.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | {{redtips}}
11 | {{describe}}
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | {{ cid == 0 ? "我也去拼一下 →" : "← 返回"}}
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/pages/share/share.wxss:
--------------------------------------------------------------------------------
1 | /**share.wxss**/
2 | page{
3 | height: 100%;
4 | }
5 | .container{
6 | padding: 0;
7 | margin: 0;
8 | justify-content: flex-start;
9 | }
10 |
11 | .box{
12 | width: 750rpx;
13 | height: 100%;
14 | background: #cd533e;
15 | }
16 | .upper{
17 | width: 100%;
18 | height: 465rpx;
19 | overflow: hidden;
20 | position: relative;
21 | }
22 | .bg{
23 | width: 1800rpx;
24 | height: 1800rpx;
25 | background: #dc6142;
26 | border-radius:50%;
27 | box-shadow: 0 0 5rpx #c44a35;
28 | overflow: hidden;
29 | position: absolute;
30 | left: 50%;
31 | bottom: 5rpx;
32 | margin-left: -900rpx;
33 | }
34 | .bg-img{
35 | width: 750rpx;
36 | height: 460rpx;
37 | position: absolute;
38 | bottom: 0;
39 | left: 50%;
40 | margin-left: -375rpx;
41 | }
42 | .bg-img image{
43 | width: 100%;
44 | height: 100%;
45 | }
46 | .front{
47 | width: 100%;
48 | height: 100%;
49 | text-align: center;
50 | font-size: 32rpx;
51 | color: #f3e5b4;
52 | position: absolute;
53 | left: 0;
54 | top: 0;
55 | }
56 | .front .avatar{
57 | width: 120rpx;
58 | height: 120rpx;
59 | margin: 16rpx auto 18rpx;
60 | display: flex;
61 | justify-content:center;
62 | align-items:center;
63 | }
64 | .front .avatar .ownerimg{
65 | width: 100rpx;
66 | height: 100rpx;
67 | border-radius: 8rpx;
68 | }
69 | .front .avatar .owner-bg{
70 | width: 100%;
71 | height: 100%;
72 | position: relative;
73 | }
74 | .redtips text{
75 | display: inline-block;
76 | vertical-align: middle;
77 | margin-right: 8rpx;
78 | font-size: 28rpx;
79 | font-weight: 700;
80 | }
81 | .redtips image{
82 | display: inline-block;
83 | width: 30rpx;
84 | height: 32rpx;
85 | vertical-align: middle;
86 | }
87 | .front .describe{
88 | width: 580rpx;
89 | margin: 30rpx auto 0;
90 | line-height: 46rpx;
91 | font-size: 36rpx;
92 | font-weight: 700;
93 | overflow: hidden;
94 | text-overflow: ellipsis;
95 | white-space:nowrap;
96 | }
97 |
98 | .lower{
99 | width:100%;
100 | position: relative;
101 | }
102 | .lower .ewm{
103 | width: 238rpx;
104 | height: 238rpx;
105 | border-radius: 50%;
106 | background: #ebcb98;
107 | margin: -122rpx auto;
108 | display: flex;
109 | justify-content:center;
110 | align-items:center;
111 | }
112 | .lower .ewm .ewmImg{
113 | width: 218rpx;
114 | height: 218rpx;
115 | border-radius: 50%;
116 | overflow: hidden;
117 | position: relative;
118 | }
119 | .lower .ewm .ewmImg .xcxewm{
120 | width: 100%;
121 | height: 100%;
122 | }
123 | .lower .ewm .ewmImg .open{
124 | width: 90rpx;
125 | height: 90rpx;
126 | position: absolute;
127 | top: 50%;
128 | left: 50%;
129 | margin-top: -45rpx;
130 | margin-left: -45rpx;
131 | }
132 | .operation{
133 | width:690rpx;
134 | height: 340rpx;
135 | margin: 0 auto;
136 | padding: 180rpx 0 0;
137 | /* background: #fff; */
138 | border-radius: 10rpx;
139 | text-align: center
140 | }
141 | .operation .btn{
142 | margin-top: 40rpx;
143 | }
144 | .operation .btn button{
145 | font-size: 28rpx;
146 | line-height: 80rpx;
147 | border-radius: 8rpx;
148 | }
149 | .operation .btn .retransmission{
150 | background: #1aac19;
151 | color: #fff;
152 | }
153 | .operation .btn .generate{
154 | background: #F0F0F0;
155 | margin-bottom: 20rpx;
156 | color: #333;
157 | }
158 | .operation .mytry{
159 | display: inline-block;
160 | width: 690rpx;
161 | height: 80rpx;
162 | line-height: 80rpx;
163 | color: #fff;
164 | font-size: 28rpx;
165 | }
166 | .bot-img{
167 | width:477rpx;
168 | height: 65rpx;
169 | margin:0 auto;
170 | display: none
171 | }
172 | .bot-img image{
173 | width: 100%;
174 | height: 100%;
175 | }
176 |
177 | .zhygg{
178 | /* margin-top: 20rpx; */
179 | margin:40rpx 0 0;
180 | font-size: 26rpx;
181 | text-align: center
182 | }
183 | .zhygg text{
184 | color: #fff;
185 | }
--------------------------------------------------------------------------------
/preview/3701559631867_.pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/3701559631867_.pic.jpg
--------------------------------------------------------------------------------
/preview/3711559631868_.pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/3711559631868_.pic.jpg
--------------------------------------------------------------------------------
/preview/3721559631869_.pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/3721559631869_.pic.jpg
--------------------------------------------------------------------------------
/preview/3731559631870_.pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/3731559631870_.pic.jpg
--------------------------------------------------------------------------------
/preview/3741559631871_.pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/3741559631871_.pic.jpg
--------------------------------------------------------------------------------
/preview/3751559631872_.pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/3751559631872_.pic.jpg
--------------------------------------------------------------------------------
/preview/3761559632109_.pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/3761559632109_.pic.jpg
--------------------------------------------------------------------------------
/preview/ht1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/ht1.png
--------------------------------------------------------------------------------
/preview/ht2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/ht2.png
--------------------------------------------------------------------------------
/preview/ht3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/ht3.png
--------------------------------------------------------------------------------
/preview/ht4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hellosee/redpacket/1be25602fdc48897b12f524ff69d5e875c0b13e3/preview/ht4.png
--------------------------------------------------------------------------------
/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/utils/md5.js:
--------------------------------------------------------------------------------
1 | var rotateLeft = function(lValue, iShiftBits) {
2 | return(lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
3 | }
4 |
5 | var addUnsigned = function(lX, lY) {
6 | var lX4, lY4, lX8, lY8, lResult;
7 | lX8 = (lX & 0x80000000);
8 | lY8 = (lY & 0x80000000);
9 | lX4 = (lX & 0x40000000);
10 | lY4 = (lY & 0x40000000);
11 | lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
12 | if(lX4 & lY4) return(lResult ^ 0x80000000 ^ lX8 ^ lY8);
13 | if(lX4 | lY4) {
14 | if(lResult & 0x40000000) return(lResult ^ 0xC0000000 ^ lX8 ^ lY8);
15 | else return(lResult ^ 0x40000000 ^ lX8 ^ lY8);
16 | } else {
17 | return(lResult ^ lX8 ^ lY8);
18 | }
19 | }
20 |
21 | var F = function(x, y, z) {
22 | return(x & y) | ((~x) & z);
23 | }
24 |
25 | var G = function(x, y, z) {
26 | return(x & z) | (y & (~z));
27 | }
28 |
29 | var H = function(x, y, z) {
30 | return(x ^ y ^ z);
31 | }
32 |
33 | var I = function(x, y, z) {
34 | return(y ^ (x | (~z)));
35 | }
36 |
37 | var FF = function(a, b, c, d, x, s, ac) {
38 | a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac));
39 | return addUnsigned(rotateLeft(a, s), b);
40 | };
41 |
42 | var GG = function(a, b, c, d, x, s, ac) {
43 | a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac));
44 | return addUnsigned(rotateLeft(a, s), b);
45 | };
46 |
47 | var HH = function(a, b, c, d, x, s, ac) {
48 | a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac));
49 | return addUnsigned(rotateLeft(a, s), b);
50 | };
51 |
52 | var II = function(a, b, c, d, x, s, ac) {
53 | a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac));
54 | return addUnsigned(rotateLeft(a, s), b);
55 | };
56 |
57 | var convertToWordArray = function(string) {
58 | var lWordCount;
59 | var lMessageLength = string.length;
60 | var lNumberOfWordsTempOne = lMessageLength + 8;
61 | var lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64;
62 | var lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16;
63 | var lWordArray = Array(lNumberOfWords - 1);
64 | var lBytePosition = 0;
65 | var lByteCount = 0;
66 | while(lByteCount < lMessageLength) {
67 | lWordCount = (lByteCount - (lByteCount % 4)) / 4;
68 | lBytePosition = (lByteCount % 4) * 8;
69 | lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition));
70 | lByteCount++;
71 | }
72 | lWordCount = (lByteCount - (lByteCount % 4)) / 4;
73 | lBytePosition = (lByteCount % 4) * 8;
74 | lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
75 | lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
76 | lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
77 | return lWordArray;
78 | };
79 |
80 | var wordToHex = function(lValue) {
81 | var WordToHexValue = "",
82 | WordToHexValueTemp = "",
83 | lByte, lCount;
84 | for(lCount = 0; lCount <= 3; lCount++) {
85 | lByte = (lValue >>> (lCount * 8)) & 255;
86 | WordToHexValueTemp = "0" + lByte.toString(16);
87 | WordToHexValue = WordToHexValue + WordToHexValueTemp.substr(WordToHexValueTemp.length - 2, 2);
88 | }
89 | return WordToHexValue;
90 | };
91 |
92 | var uTF8Encode = function(string) {
93 | string = string.replace(/\x0d\x0a/g, "\x0a");
94 | var output = "";
95 | for(var n = 0; n < string.length; n++) {
96 | var c = string.charCodeAt(n);
97 | if(c < 128) {
98 | output += String.fromCharCode(c);
99 | } else if((c > 127) && (c < 2048)) {
100 | output += String.fromCharCode((c >> 6) | 192);
101 | output += String.fromCharCode((c & 63) | 128);
102 | } else {
103 | output += String.fromCharCode((c >> 12) | 224);
104 | output += String.fromCharCode(((c >> 6) & 63) | 128);
105 | output += String.fromCharCode((c & 63) | 128);
106 | }
107 | }
108 | return output;
109 | };
110 |
111 | function md5(string) {
112 | var x = Array();
113 | var k, AA, BB, CC, DD, a, b, c, d;
114 | var S11 = 7,
115 | S12 = 12,
116 | S13 = 17,
117 | S14 = 22;
118 | var S21 = 5,
119 | S22 = 9,
120 | S23 = 14,
121 | S24 = 20;
122 | var S31 = 4,
123 | S32 = 11,
124 | S33 = 16,
125 | S34 = 23;
126 | var S41 = 6,
127 | S42 = 10,
128 | S43 = 15,
129 | S44 = 21;
130 | string = uTF8Encode(string);
131 | x = convertToWordArray(string);
132 | a = 0x67452301;
133 | b = 0xEFCDAB89;
134 | c = 0x98BADCFE;
135 | d = 0x10325476;
136 | for(k = 0; k < x.length; k += 16) {
137 | AA = a;
138 | BB = b;
139 | CC = c;
140 | DD = d;
141 | a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
142 | d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
143 | c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
144 | b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
145 | a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
146 | d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
147 | c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
148 | b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
149 | a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
150 | d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
151 | c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
152 | b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
153 | a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
154 | d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
155 | c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
156 | b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
157 | a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
158 | d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
159 | c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
160 | b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
161 | a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
162 | d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
163 | c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
164 | b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
165 | a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
166 | d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
167 | c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
168 | b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
169 | a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
170 | d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
171 | c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
172 | b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
173 | a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
174 | d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
175 | c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
176 | b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
177 | a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
178 | d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
179 | c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
180 | b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
181 | a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
182 | d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
183 | c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
184 | b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
185 | a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
186 | d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
187 | c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
188 | b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
189 | a = II(a, b, c, d, x[k + 0], S41, 0xF4292244);
190 | d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
191 | c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
192 | b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
193 | a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
194 | d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
195 | c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
196 | b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
197 | a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
198 | d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
199 | c = II(c, d, a, b, x[k + 6], S43, 0xA3014314);
200 | b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
201 | a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
202 | d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
203 | c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
204 | b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
205 | a = addUnsigned(a, AA);
206 | b = addUnsigned(b, BB);
207 | c = addUnsigned(c, CC);
208 | d = addUnsigned(d, DD);
209 | }
210 | var tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
211 | return tempValue.toLowerCase();
212 | }
213 |
214 | module.exports.md5 = md5
--------------------------------------------------------------------------------
/utils/util.js:
--------------------------------------------------------------------------------
1 | const formatTime = date => {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = n => {
13 | n = n.toString()
14 | return n[1] ? n : '0' + n
15 | }
16 |
17 | module.exports = {
18 | formatTime: formatTime
19 | }
20 |
--------------------------------------------------------------------------------
/we-cropper/we-cropper.js:
--------------------------------------------------------------------------------
1 | /**
2 | * we-cropper v1.2.0
3 | * (c) 2018 dlhandsome
4 | * @license MIT
5 | */
6 | (function (global, factory) {
7 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8 | typeof define === 'function' && define.amd ? define(factory) :
9 | (global.WeCropper = factory());
10 | }(this, (function () { 'use strict';
11 |
12 | var device = void 0;
13 | var TOUCH_STATE = ['touchstarted', 'touchmoved', 'touchended'];
14 |
15 | function isFunction (obj) {
16 | return typeof obj === 'function'
17 | }
18 |
19 | function firstLetterUpper (str) {
20 | return str.charAt(0).toUpperCase() + str.slice(1)
21 | }
22 |
23 | function setTouchState (instance) {
24 | var arg = [], len = arguments.length - 1;
25 | while ( len-- > 0 ) arg[ len ] = arguments[ len + 1 ];
26 |
27 | TOUCH_STATE.forEach(function (key, i) {
28 | if (arg[i] !== undefined) {
29 | instance[key] = arg[i];
30 | }
31 | });
32 | }
33 |
34 | function validator (instance, o) {
35 | Object.defineProperties(instance, o);
36 | }
37 |
38 | function getDevice () {
39 | if (!device) {
40 | device = wx.getSystemInfoSync();
41 | }
42 | return device
43 | }
44 |
45 | var tmp = {};
46 |
47 | var DEFAULT = {
48 | id: {
49 | default: 'cropper',
50 | get: function get () {
51 | return tmp.id
52 | },
53 | set: function set (value) {
54 | if (typeof (value) !== 'string') {
55 | console.error(("id:" + value + " is invalid"));
56 | }
57 | tmp.id = value;
58 | }
59 | },
60 | width: {
61 | default: 750,
62 | get: function get () {
63 | return tmp.width
64 | },
65 | set: function set (value) {
66 | if (typeof (value) !== 'number') {
67 | console.error(("width:" + value + " is invalid"));
68 | }
69 | tmp.width = value;
70 | }
71 | },
72 | height: {
73 | default: 750,
74 | get: function get () {
75 | return tmp.height
76 | },
77 | set: function set (value) {
78 | if (typeof (value) !== 'number') {
79 | console.error(("height:" + value + " is invalid"));
80 | }
81 | tmp.height = value;
82 | }
83 | },
84 | scale: {
85 | default: 2.5,
86 | get: function get () {
87 | return tmp.scale
88 | },
89 | set: function set (value) {
90 | if (typeof (value) !== 'number') {
91 | console.error(("scale:" + value + " is invalid"));
92 | }
93 | tmp.scale = value;
94 | }
95 | },
96 | zoom: {
97 | default: 5,
98 | get: function get () {
99 | return tmp.zoom
100 | },
101 | set: function set (value) {
102 | if (typeof (value) !== 'number') {
103 | console.error(("zoom:" + value + " is invalid"));
104 | } else if (value < 0 || value > 10) {
105 | console.error("zoom should be ranged in 0 ~ 10");
106 | }
107 | tmp.zoom = value;
108 | }
109 | },
110 | src: {
111 | default: 'cropper',
112 | get: function get () {
113 | return tmp.src
114 | },
115 | set: function set (value) {
116 | if (typeof (value) !== 'string') {
117 | console.error(("id:" + value + " is invalid"));
118 | }
119 | tmp.src = value;
120 | }
121 | },
122 | cut: {
123 | default: {},
124 | get: function get () {
125 | return tmp.cut
126 | },
127 | set: function set (value) {
128 | if (typeof (value) !== 'object') {
129 | console.error(("id:" + value + " is invalid"));
130 | }
131 | tmp.cut = value;
132 | }
133 | },
134 | onReady: {
135 | default: null,
136 | get: function get () {
137 | return tmp.ready
138 | },
139 | set: function set (value) {
140 | tmp.ready = value;
141 | }
142 | },
143 | onBeforeImageLoad: {
144 | default: null,
145 | get: function get () {
146 | return tmp.beforeImageLoad
147 | },
148 | set: function set (value) {
149 | tmp.beforeImageLoad = value;
150 | }
151 | },
152 | onImageLoad: {
153 | default: null,
154 | get: function get () {
155 | return tmp.imageLoad
156 | },
157 | set: function set (value) {
158 | tmp.imageLoad = value;
159 | }
160 | },
161 | onBeforeDraw: {
162 | default: null,
163 | get: function get () {
164 | return tmp.beforeDraw
165 | },
166 | set: function set (value) {
167 | tmp.beforeDraw = value;
168 | }
169 | }
170 | };
171 |
172 | function prepare () {
173 | var self = this;
174 | var ref = getDevice();
175 | var windowWidth = ref.windowWidth;
176 |
177 | self.attachPage = function () {
178 | var pages = getCurrentPages();
179 | // 获取到当前page上下文
180 | var pageContext = pages[pages.length - 1];
181 | // 把this依附在Page上下文的wecropper属性上,便于在page钩子函数中访问
182 | pageContext.wecropper = self;
183 | };
184 |
185 | self.createCtx = function () {
186 | var id = self.id;
187 | if (id) {
188 | self.ctx = wx.createCanvasContext(id);
189 | } else {
190 | console.error("constructor: create canvas context failed, 'id' must be valuable");
191 | }
192 | };
193 |
194 | self.deviceRadio = windowWidth / 750;
195 | }
196 |
197 | function observer () {
198 | var self = this;
199 |
200 | var EVENT_TYPE = ['ready', 'beforeImageLoad', 'beforeDraw', 'imageLoad'];
201 |
202 | self.on = function (event, fn) {
203 | if (EVENT_TYPE.indexOf(event) > -1) {
204 | if (typeof (fn) === 'function') {
205 | event === 'ready'
206 | ? fn(self)
207 | : self[("on" + (firstLetterUpper(event)))] = fn;
208 | }
209 | } else {
210 | console.error(("event: " + event + " is invalid"));
211 | }
212 | return self
213 | };
214 | }
215 |
216 | var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
217 |
218 |
219 |
220 |
221 |
222 | function createCommonjsModule(fn, module) {
223 | return module = { exports: {} }, fn(module, module.exports), module.exports;
224 | }
225 |
226 | var base64 = createCommonjsModule(function (module, exports) {
227 | /*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */
228 | (function(root) {
229 |
230 | // Detect free variables `exports`.
231 | var freeExports = 'object' == 'object' && exports;
232 |
233 | // Detect free variable `module`.
234 | var freeModule = 'object' == 'object' && module &&
235 | module.exports == freeExports && module;
236 |
237 | // Detect free variable `global`, from Node.js or Browserified code, and use
238 | // it as `root`.
239 | var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;
240 | if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
241 | root = freeGlobal;
242 | }
243 |
244 | /*--------------------------------------------------------------------------*/
245 |
246 | var InvalidCharacterError = function(message) {
247 | this.message = message;
248 | };
249 | InvalidCharacterError.prototype = new Error;
250 | InvalidCharacterError.prototype.name = 'InvalidCharacterError';
251 |
252 | var error = function(message) {
253 | // Note: the error messages used throughout this file match those used by
254 | // the native `atob`/`btoa` implementation in Chromium.
255 | throw new InvalidCharacterError(message);
256 | };
257 |
258 | var TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
259 | // http://whatwg.org/html/common-microsyntaxes.html#space-character
260 | var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g;
261 |
262 | // `decode` is designed to be fully compatible with `atob` as described in the
263 | // HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob
264 | // The optimized base64-decoding algorithm used is based on @atk’s excellent
265 | // implementation. https://gist.github.com/atk/1020396
266 | var decode = function(input) {
267 | input = String(input)
268 | .replace(REGEX_SPACE_CHARACTERS, '');
269 | var length = input.length;
270 | if (length % 4 == 0) {
271 | input = input.replace(/==?$/, '');
272 | length = input.length;
273 | }
274 | if (
275 | length % 4 == 1 ||
276 | // http://whatwg.org/C#alphanumeric-ascii-characters
277 | /[^+a-zA-Z0-9/]/.test(input)
278 | ) {
279 | error(
280 | 'Invalid character: the string to be decoded is not correctly encoded.'
281 | );
282 | }
283 | var bitCounter = 0;
284 | var bitStorage;
285 | var buffer;
286 | var output = '';
287 | var position = -1;
288 | while (++position < length) {
289 | buffer = TABLE.indexOf(input.charAt(position));
290 | bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer;
291 | // Unless this is the first of a group of 4 characters…
292 | if (bitCounter++ % 4) {
293 | // …convert the first 8 bits to a single ASCII character.
294 | output += String.fromCharCode(
295 | 0xFF & bitStorage >> (-2 * bitCounter & 6)
296 | );
297 | }
298 | }
299 | return output;
300 | };
301 |
302 | // `encode` is designed to be fully compatible with `btoa` as described in the
303 | // HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa
304 | var encode = function(input) {
305 | input = String(input);
306 | if (/[^\0-\xFF]/.test(input)) {
307 | // Note: no need to special-case astral symbols here, as surrogates are
308 | // matched, and the input is supposed to only contain ASCII anyway.
309 | error(
310 | 'The string to be encoded contains characters outside of the ' +
311 | 'Latin1 range.'
312 | );
313 | }
314 | var padding = input.length % 3;
315 | var output = '';
316 | var position = -1;
317 | var a;
318 | var b;
319 | var c;
320 | var buffer;
321 | // Make sure any padding is handled outside of the loop.
322 | var length = input.length - padding;
323 |
324 | while (++position < length) {
325 | // Read three bytes, i.e. 24 bits.
326 | a = input.charCodeAt(position) << 16;
327 | b = input.charCodeAt(++position) << 8;
328 | c = input.charCodeAt(++position);
329 | buffer = a + b + c;
330 | // Turn the 24 bits into four chunks of 6 bits each, and append the
331 | // matching character for each of them to the output.
332 | output += (
333 | TABLE.charAt(buffer >> 18 & 0x3F) +
334 | TABLE.charAt(buffer >> 12 & 0x3F) +
335 | TABLE.charAt(buffer >> 6 & 0x3F) +
336 | TABLE.charAt(buffer & 0x3F)
337 | );
338 | }
339 |
340 | if (padding == 2) {
341 | a = input.charCodeAt(position) << 8;
342 | b = input.charCodeAt(++position);
343 | buffer = a + b;
344 | output += (
345 | TABLE.charAt(buffer >> 10) +
346 | TABLE.charAt((buffer >> 4) & 0x3F) +
347 | TABLE.charAt((buffer << 2) & 0x3F) +
348 | '='
349 | );
350 | } else if (padding == 1) {
351 | buffer = input.charCodeAt(position);
352 | output += (
353 | TABLE.charAt(buffer >> 2) +
354 | TABLE.charAt((buffer << 4) & 0x3F) +
355 | '=='
356 | );
357 | }
358 |
359 | return output;
360 | };
361 |
362 | var base64 = {
363 | 'encode': encode,
364 | 'decode': decode,
365 | 'version': '0.1.0'
366 | };
367 |
368 | // Some AMD build optimizers, like r.js, check for specific condition patterns
369 | // like the following:
370 | if (
371 | typeof undefined == 'function' &&
372 | typeof undefined.amd == 'object' &&
373 | undefined.amd
374 | ) {
375 | undefined(function() {
376 | return base64;
377 | });
378 | } else if (freeExports && !freeExports.nodeType) {
379 | if (freeModule) { // in Node.js or RingoJS v0.8.0+
380 | freeModule.exports = base64;
381 | } else { // in Narwhal or RingoJS v0.7.0-
382 | for (var key in base64) {
383 | base64.hasOwnProperty(key) && (freeExports[key] = base64[key]);
384 | }
385 | }
386 | } else { // in Rhino or a web browser
387 | root.base64 = base64;
388 | }
389 |
390 | }(commonjsGlobal));
391 | });
392 |
393 | function makeURI (strData, type) {
394 | return 'data:' + type + ';base64,' + strData
395 | }
396 |
397 | function fixType (type) {
398 | type = type.toLowerCase().replace(/jpg/i, 'jpeg');
399 | var r = type.match(/png|jpeg|bmp|gif/)[0];
400 | return 'image/' + r
401 | }
402 |
403 | function encodeData (data) {
404 | var str = '';
405 | if (typeof data === 'string') {
406 | str = data;
407 | } else {
408 | for (var i = 0; i < data.length; i++) {
409 | str += String.fromCharCode(data[i]);
410 | }
411 | }
412 | return base64.encode(str)
413 | }
414 |
415 | /**
416 | * 获取图像区域隐含的像素数据
417 | * @param canvasId canvas标识
418 | * @param x 将要被提取的图像数据矩形区域的左上角 x 坐标
419 | * @param y 将要被提取的图像数据矩形区域的左上角 y 坐标
420 | * @param width 将要被提取的图像数据矩形区域的宽度
421 | * @param height 将要被提取的图像数据矩形区域的高度
422 | * @param done 完成回调
423 | */
424 | function getImageData (canvasId, x, y, width, height, done) {
425 | wx.canvasGetImageData({
426 | canvasId: canvasId,
427 | x: x,
428 | y: y,
429 | width: width,
430 | height: height,
431 | success: function success (res) {
432 | done(res);
433 | },
434 | fail: function fail (res) {
435 | done(null);
436 | console.error('canvasGetImageData error: ' + res);
437 | }
438 | });
439 | }
440 |
441 | /**
442 | * 生成bmp格式图片
443 | * 按照规则生成图片响应头和响应体
444 | * @param oData 用来描述 canvas 区域隐含的像素数据 { data, width, height } = oData
445 | * @returns {*} base64字符串
446 | */
447 | function genBitmapImage (oData) {
448 | //
449 | // BITMAPFILEHEADER: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183374(v=vs.85).aspx
450 | // BITMAPINFOHEADER: http://msdn.microsoft.com/en-us/library/dd183376.aspx
451 | //
452 | var biWidth = oData.width;
453 | var biHeight = oData.height;
454 | var biSizeImage = biWidth * biHeight * 3;
455 | var bfSize = biSizeImage + 54; // total header size = 54 bytes
456 |
457 | //
458 | // typedef struct tagBITMAPFILEHEADER {
459 | // WORD bfType;
460 | // DWORD bfSize;
461 | // WORD bfReserved1;
462 | // WORD bfReserved2;
463 | // DWORD bfOffBits;
464 | // } BITMAPFILEHEADER;
465 | //
466 | var BITMAPFILEHEADER = [
467 | // WORD bfType -- The file type signature; must be "BM"
468 | 0x42, 0x4D,
469 | // DWORD bfSize -- The size, in bytes, of the bitmap file
470 | bfSize & 0xff, bfSize >> 8 & 0xff, bfSize >> 16 & 0xff, bfSize >> 24 & 0xff,
471 | // WORD bfReserved1 -- Reserved; must be zero
472 | 0, 0,
473 | // WORD bfReserved2 -- Reserved; must be zero
474 | 0, 0,
475 | // DWORD bfOffBits -- The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits.
476 | 54, 0, 0, 0
477 | ];
478 |
479 | //
480 | // typedef struct tagBITMAPINFOHEADER {
481 | // DWORD biSize;
482 | // LONG biWidth;
483 | // LONG biHeight;
484 | // WORD biPlanes;
485 | // WORD biBitCount;
486 | // DWORD biCompression;
487 | // DWORD biSizeImage;
488 | // LONG biXPelsPerMeter;
489 | // LONG biYPelsPerMeter;
490 | // DWORD biClrUsed;
491 | // DWORD biClrImportant;
492 | // } BITMAPINFOHEADER, *PBITMAPINFOHEADER;
493 | //
494 | var BITMAPINFOHEADER = [
495 | // DWORD biSize -- The number of bytes required by the structure
496 | 40, 0, 0, 0,
497 | // LONG biWidth -- The width of the bitmap, in pixels
498 | biWidth & 0xff, biWidth >> 8 & 0xff, biWidth >> 16 & 0xff, biWidth >> 24 & 0xff,
499 | // LONG biHeight -- The height of the bitmap, in pixels
500 | biHeight & 0xff, biHeight >> 8 & 0xff, biHeight >> 16 & 0xff, biHeight >> 24 & 0xff,
501 | // WORD biPlanes -- The number of planes for the target device. This value must be set to 1
502 | 1, 0,
503 | // WORD biBitCount -- The number of bits-per-pixel, 24 bits-per-pixel -- the bitmap
504 | // has a maximum of 2^24 colors (16777216, Truecolor)
505 | 24, 0,
506 | // DWORD biCompression -- The type of compression, BI_RGB (code 0) -- uncompressed
507 | 0, 0, 0, 0,
508 | // DWORD biSizeImage -- The size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps
509 | biSizeImage & 0xff, biSizeImage >> 8 & 0xff, biSizeImage >> 16 & 0xff, biSizeImage >> 24 & 0xff,
510 | // LONG biXPelsPerMeter, unused
511 | 0, 0, 0, 0,
512 | // LONG biYPelsPerMeter, unused
513 | 0, 0, 0, 0,
514 | // DWORD biClrUsed, the number of color indexes of palette, unused
515 | 0, 0, 0, 0,
516 | // DWORD biClrImportant, unused
517 | 0, 0, 0, 0
518 | ];
519 |
520 | var iPadding = (4 - ((biWidth * 3) % 4)) % 4;
521 |
522 | var aImgData = oData.data;
523 |
524 | var strPixelData = '';
525 | var biWidth4 = biWidth << 2;
526 | var y = biHeight;
527 | var fromCharCode = String.fromCharCode;
528 |
529 | do {
530 | var iOffsetY = biWidth4 * (y - 1);
531 | var strPixelRow = '';
532 | for (var x = 0; x < biWidth; x++) {
533 | var iOffsetX = x << 2;
534 | strPixelRow += fromCharCode(aImgData[iOffsetY + iOffsetX + 2]) +
535 | fromCharCode(aImgData[iOffsetY + iOffsetX + 1]) +
536 | fromCharCode(aImgData[iOffsetY + iOffsetX]);
537 | }
538 |
539 | for (var c = 0; c < iPadding; c++) {
540 | strPixelRow += String.fromCharCode(0);
541 | }
542 |
543 | strPixelData += strPixelRow;
544 | } while (--y)
545 |
546 | var strEncoded = encodeData(BITMAPFILEHEADER.concat(BITMAPINFOHEADER)) + encodeData(strPixelData);
547 |
548 | return strEncoded
549 | }
550 |
551 | /**
552 | * 转换为图片base64
553 | * @param canvasId canvas标识
554 | * @param x 将要被提取的图像数据矩形区域的左上角 x 坐标
555 | * @param y 将要被提取的图像数据矩形区域的左上角 y 坐标
556 | * @param width 将要被提取的图像数据矩形区域的宽度
557 | * @param height 将要被提取的图像数据矩形区域的高度
558 | * @param type 转换图片类型
559 | * @param done 完成回调
560 | */
561 | function convertToImage (canvasId, x, y, width, height, type, done) {
562 | if ( done === void 0 ) done = function () {};
563 |
564 | if (type === undefined) { type = 'png'; }
565 | type = fixType(type);
566 | if (/bmp/.test(type)) {
567 | getImageData(canvasId, x, y, width, height, function (data) {
568 | var strData = genBitmapImage(data);
569 | isFunction(done) && done(makeURI(strData, 'image/' + type));
570 | });
571 | } else {
572 | console.error('暂不支持生成\'' + type + '\'类型的base64图片');
573 | }
574 | }
575 |
576 | var CanvasToBase64 = {
577 | convertToImage: convertToImage,
578 | // convertToPNG: function (width, height, done) {
579 | // return convertToImage(width, height, 'png', done)
580 | // },
581 | // convertToJPEG: function (width, height, done) {
582 | // return convertToImage(width, height, 'jpeg', done)
583 | // },
584 | // convertToGIF: function (width, height, done) {
585 | // return convertToImage(width, height, 'gif', done)
586 | // },
587 | convertToBMP: function (ref, done) {
588 | if ( ref === void 0 ) ref = {};
589 | var canvasId = ref.canvasId;
590 | var x = ref.x;
591 | var y = ref.y;
592 | var width = ref.width;
593 | var height = ref.height;
594 | if ( done === void 0 ) done = function () {};
595 |
596 | return convertToImage(canvasId, x, y, width, height, 'bmp', done)
597 | }
598 | };
599 |
600 | function methods () {
601 | var self = this;
602 |
603 | var id = self.id;
604 | var deviceRadio = self.deviceRadio;
605 | var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度
606 | var boundHeight = self.height; // 裁剪框默认高度,即整个画布高度
607 | var ref = self.cut;
608 | var x = ref.x; if ( x === void 0 ) x = 0;
609 | var y = ref.y; if ( y === void 0 ) y = 0;
610 | var width = ref.width; if ( width === void 0 ) width = boundWidth;
611 | var height = ref.height; if ( height === void 0 ) height = boundHeight;
612 |
613 | self.updateCanvas = function () {
614 | if (self.croperTarget) {
615 | console.log('self.croperTarget', self.croperTarget)
616 | // 画布绘制图片
617 | self.ctx.drawImage(self.croperTarget, self.imgLeft, self.imgTop, self.scaleWidth, self.scaleHeight);
618 | }
619 | isFunction(self.onBeforeDraw) && self.onBeforeDraw(self.ctx, self);
620 |
621 | self.setBoundStyle(); // 设置边界样式
622 | self.ctx.draw();
623 | return self
624 | };
625 |
626 | self.pushOrign = function (src) {
627 | self.src = src;
628 |
629 | isFunction(self.onBeforeImageLoad) && self.onBeforeImageLoad(self.ctx, self);
630 |
631 | wx.getImageInfo({
632 | src: src,
633 | success: function success (res) {
634 | var innerAspectRadio = res.width / res.height;
635 |
636 | self.croperTarget = res.path;
637 |
638 | if (innerAspectRadio < width / height) {
639 | self.rectX = x;
640 | self.baseWidth = width;
641 | self.baseHeight = width / innerAspectRadio;
642 | self.rectY = y - Math.abs((height - self.baseHeight) / 2);
643 | } else {
644 | self.rectY = y;
645 | self.baseWidth = height * innerAspectRadio;
646 | self.baseHeight = height;
647 | self.rectX = x - Math.abs((width - self.baseWidth) / 2);
648 | }
649 |
650 | self.imgLeft = self.rectX;
651 | self.imgTop = self.rectY;
652 | self.scaleWidth = self.baseWidth;
653 | self.scaleHeight = self.baseHeight;
654 |
655 | self.updateCanvas();
656 |
657 | isFunction(self.onImageLoad) && self.onImageLoad(self.ctx, self);
658 | }
659 | });
660 |
661 | self.update();
662 | return self
663 | };
664 |
665 | self.getCropperBase64 = function (done) {
666 | if ( done === void 0 ) done = function () {};
667 |
668 | CanvasToBase64.convertToBMP({
669 | canvasId: id,
670 | x: x,
671 | y: y,
672 | width: width,
673 | height: height
674 | }, done);
675 | };
676 |
677 | self.getCropperImage = function () {
678 |
679 |
680 |
681 | self.croperTarget=''
682 |
683 | var args = [], len = arguments.length;
684 | while ( len-- ) args[ len ] = arguments[ len ];
685 |
686 | var ARG_TYPE = toString.call(args[0]);
687 | var fn = args[args.length - 1];
688 |
689 | switch (ARG_TYPE) {
690 | case '[object Object]':
691 | var ref = args[0];
692 | var quality = ref.quality; if ( quality === void 0 ) quality = 10;
693 |
694 | if (typeof (quality) !== 'number') {
695 | console.error(("quality:" + quality + " is invalid"));
696 | } else if (quality < 0 || quality > 10) {
697 | console.error("quality should be ranged in 0 ~ 10");
698 | }
699 | wx.canvasToTempFilePath({
700 | canvasId: id,
701 | x: x,
702 | y: y,
703 | width: width,
704 | height: height,
705 | destWidth: width * quality / (deviceRadio * 10),
706 | destHeight: height * quality / (deviceRadio * 10),
707 | success: function success (res) {
708 | isFunction(fn) && fn.call(self, res.tempFilePath);
709 | },
710 | fail: function fail (res) {
711 | isFunction(fn) && fn.call(self, null);
712 | }
713 | }); break
714 | case '[object Function]':
715 | wx.canvasToTempFilePath({
716 | canvasId: id,
717 | x: x,
718 | y: y,
719 | width: width,
720 | height: height,
721 | destWidth: width / deviceRadio,
722 | destHeight: height / deviceRadio,
723 | success: function success (res) {
724 | isFunction(fn) && fn.call(self, res.tempFilePath);
725 | },
726 | fail: function fail (res) {
727 | isFunction(fn) && fn.call(self, null);
728 | }
729 | }); break
730 | }
731 |
732 | return self
733 | };
734 | }
735 |
736 | /**
737 | * 获取最新缩放值
738 | * @param oldScale 上一次触摸结束后的缩放值
739 | * @param oldDistance 上一次触摸结束后的双指距离
740 | * @param zoom 缩放系数
741 | * @param touch0 第一指touch对象
742 | * @param touch1 第二指touch对象
743 | * @returns {*}
744 | */
745 | var getNewScale = function (oldScale, oldDistance, zoom, touch0, touch1) {
746 | var xMove, yMove, newDistance;
747 | // 计算二指最新距离
748 | xMove = Math.round(touch1.x - touch0.x);
749 | yMove = Math.round(touch1.y - touch0.y);
750 | newDistance = Math.round(Math.sqrt(xMove * xMove + yMove * yMove));
751 |
752 | return oldScale + 0.001 * zoom * (newDistance - oldDistance)
753 | };
754 |
755 | function update () {
756 | var self = this;
757 |
758 | if (!self.src) { return }
759 |
760 | self.__oneTouchStart = function (touch) {
761 | self.touchX0 = Math.round(touch.x);
762 | self.touchY0 = Math.round(touch.y);
763 | };
764 |
765 | self.__oneTouchMove = function (touch) {
766 | var xMove, yMove;
767 | // 计算单指移动的距离
768 | if (self.touchended) {
769 | return self.updateCanvas()
770 | }
771 | xMove = Math.round(touch.x - self.touchX0);
772 | yMove = Math.round(touch.y - self.touchY0);
773 |
774 | var imgLeft = Math.round(self.rectX + xMove);
775 | var imgTop = Math.round(self.rectY + yMove);
776 |
777 | self.outsideBound(imgLeft, imgTop);
778 |
779 | self.updateCanvas();
780 | };
781 |
782 | self.__twoTouchStart = function (touch0, touch1) {
783 | var xMove, yMove, oldDistance;
784 |
785 | self.touchX1 = Math.round(self.rectX + self.scaleWidth / 2);
786 | self.touchY1 = Math.round(self.rectY + self.scaleHeight / 2);
787 |
788 | // 计算两指距离
789 | xMove = Math.round(touch1.x - touch0.x);
790 | yMove = Math.round(touch1.y - touch0.y);
791 | oldDistance = Math.round(Math.sqrt(xMove * xMove + yMove * yMove));
792 |
793 | self.oldDistance = oldDistance;
794 | };
795 |
796 | self.__twoTouchMove = function (touch0, touch1) {
797 | var oldScale = self.oldScale;
798 | var oldDistance = self.oldDistance;
799 | var scale = self.scale;
800 | var zoom = self.zoom;
801 |
802 | self.newScale = getNewScale(oldScale, oldDistance, zoom, touch0, touch1);
803 |
804 | // 设定缩放范围
805 | self.newScale <= 1 && (self.newScale = 1);
806 | self.newScale >= scale && (self.newScale = scale);
807 |
808 | self.scaleWidth = Math.round(self.newScale * self.baseWidth);
809 | self.scaleHeight = Math.round(self.newScale * self.baseHeight);
810 | var imgLeft = Math.round(self.touchX1 - self.scaleWidth / 2);
811 | var imgTop = Math.round(self.touchY1 - self.scaleHeight / 2);
812 |
813 | self.outsideBound(imgLeft, imgTop);
814 |
815 | self.updateCanvas();
816 | };
817 |
818 | self.__xtouchEnd = function () {
819 | self.oldScale = self.newScale;
820 | self.rectX = self.imgLeft;
821 | self.rectY = self.imgTop;
822 | };
823 | }
824 |
825 | var handle = {
826 | // 图片手势初始监测
827 | touchStart: function touchStart (e) {
828 | var self = this;
829 | var ref = e.touches;
830 | var touch0 = ref[0];
831 | var touch1 = ref[1];
832 |
833 | setTouchState(self, true, null, null);
834 |
835 | // 计算第一个触摸点的位置,并参照改点进行缩放
836 | self.__oneTouchStart(touch0);
837 |
838 | // 两指手势触发
839 | if (e.touches.length >= 2) {
840 | self.__twoTouchStart(touch0, touch1);
841 | }
842 | },
843 |
844 | // 图片手势动态缩放
845 | touchMove: function touchMove (e) {
846 | var self = this;
847 | var ref = e.touches;
848 | var touch0 = ref[0];
849 | var touch1 = ref[1];
850 |
851 | setTouchState(self, null, true);
852 |
853 | // 单指手势时触发
854 | if (e.touches.length === 1) {
855 | self.__oneTouchMove(touch0);
856 | }
857 | // 两指手势触发
858 | if (e.touches.length >= 2) {
859 | self.__twoTouchMove(touch0, touch1);
860 | }
861 | },
862 |
863 | touchEnd: function touchEnd (e) {
864 | var self = this;
865 |
866 | setTouchState(self, false, false, true);
867 | self.__xtouchEnd();
868 | }
869 | };
870 |
871 | function cut () {
872 | var self = this;
873 | var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度
874 | var boundHeight = self.height;
875 | // 裁剪框默认高度,即整个画布高度
876 | var ref = self.cut;
877 | var x = ref.x; if ( x === void 0 ) x = 0;
878 | var y = ref.y; if ( y === void 0 ) y = 0;
879 | var width = ref.width; if ( width === void 0 ) width = boundWidth;
880 | var height = ref.height; if ( height === void 0 ) height = boundHeight;
881 |
882 | /**
883 | * 设置边界
884 | * @param imgLeft 图片左上角横坐标值
885 | * @param imgTop 图片左上角纵坐标值
886 | */
887 | self.outsideBound = function (imgLeft, imgTop) {
888 | self.imgLeft = imgLeft >= x
889 | ? x
890 | : self.scaleWidth + imgLeft - x <= width
891 | ? x + width - self.scaleWidth
892 | : imgLeft;
893 |
894 | self.imgTop = imgTop >= y
895 | ? y
896 | : self.scaleHeight + imgTop - y <= height
897 | ? y + height - self.scaleHeight
898 | : imgTop;
899 | };
900 |
901 | /**
902 | * 设置边界样式
903 | * @param color 边界颜色
904 | */
905 | self.setBoundStyle = function (ref) {
906 | if ( ref === void 0 ) ref = {};
907 | var color = ref.color; if ( color === void 0 ) color = '#04b00f';
908 | var mask = ref.mask; if ( mask === void 0 ) mask = 'rgba(0, 0, 0, 0.3)';
909 | var lineWidth = ref.lineWidth; if ( lineWidth === void 0 ) lineWidth = 1;
910 |
911 | var boundOption = [
912 | {
913 | start: { x: x - lineWidth, y: y + 10 - lineWidth },
914 | step1: { x: x - lineWidth, y: y - lineWidth },
915 | step2: { x: x + 10 - lineWidth, y: y - lineWidth }
916 | },
917 | {
918 | start: { x: x - lineWidth, y: y + height - 10 + lineWidth },
919 | step1: { x: x - lineWidth, y: y + height + lineWidth },
920 | step2: { x: x + 10 - lineWidth, y: y + height + lineWidth }
921 | },
922 | {
923 | start: { x: x + width - 10 + lineWidth, y: y - lineWidth },
924 | step1: { x: x + width + lineWidth, y: y - lineWidth },
925 | step2: { x: x + width + lineWidth, y: y + 10 - lineWidth }
926 | },
927 | {
928 | start: { x: x + width + lineWidth, y: y + height - 10 + lineWidth },
929 | step1: { x: x + width + lineWidth, y: y + height + lineWidth },
930 | step2: { x: x + width - 10 + lineWidth, y: y + height + lineWidth }
931 | }
932 | ];
933 |
934 | // 绘制半透明层
935 | self.ctx.beginPath();
936 | self.ctx.setFillStyle(mask);
937 | self.ctx.fillRect(0, 0, x, boundHeight);
938 | self.ctx.fillRect(x, 0, width, y);
939 | self.ctx.fillRect(x, y + height, width, boundHeight - y - height);
940 | self.ctx.fillRect(x + width, 0, boundWidth - x - width, boundHeight);
941 | self.ctx.fill();
942 |
943 | boundOption.forEach(function (op) {
944 | self.ctx.beginPath();
945 | self.ctx.setStrokeStyle(color);
946 | self.ctx.setLineWidth(lineWidth);
947 | self.ctx.moveTo(op.start.x, op.start.y);
948 | self.ctx.lineTo(op.step1.x, op.step1.y);
949 | self.ctx.lineTo(op.step2.x, op.step2.y);
950 | self.ctx.stroke();
951 | });
952 | };
953 | }
954 |
955 | var version = "1.2.0";
956 |
957 | var weCropper = function weCropper (params) {
958 | var self = this;
959 | var _default = {};
960 |
961 | validator(self, DEFAULT);
962 |
963 | Object.keys(DEFAULT).forEach(function (key) {
964 | _default[key] = DEFAULT[key].default;
965 | });
966 | Object.assign(self, _default, params);
967 |
968 | self.prepare();
969 | self.attachPage();
970 | self.createCtx();
971 | self.observer();
972 | self.cutt();
973 | self.methods();
974 | self.init();
975 | self.update();
976 |
977 | return self
978 | };
979 |
980 | weCropper.prototype.init = function init () {
981 | var self = this;
982 | var src = self.src;
983 |
984 | self.version = version;
985 |
986 | typeof self.onReady === 'function' && self.onReady(self.ctx, self);
987 |
988 | if (src) {
989 | self.pushOrign(src);
990 | }
991 | setTouchState(self, false, false, false);
992 |
993 | self.oldScale = 1;
994 | self.newScale = 1;
995 |
996 | return self
997 | };
998 |
999 | Object.assign(weCropper.prototype, handle);
1000 |
1001 | weCropper.prototype.prepare = prepare;
1002 | weCropper.prototype.observer = observer;
1003 | weCropper.prototype.methods = methods;
1004 | weCropper.prototype.cutt = cut;
1005 | weCropper.prototype.update = update;
1006 |
1007 | return weCropper;
1008 |
1009 | })));
1010 |
--------------------------------------------------------------------------------
/we-cropper/we-cropper.wxml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------