更换版本

This commit is contained in:
2024-01-22 18:48:00 +08:00
parent 9f65ea8fd9
commit 00e6dcaec0
1158 changed files with 70609 additions and 51780 deletions

View File

@@ -0,0 +1,8 @@
var t;
(t = getApp()),
Component({
properties: { tabBar: { type: Object, value: t.tabBar } },
data: {},
methods: {},
created: function () {},
});

View File

@@ -0,0 +1 @@
{ "component": true, "usingComponents": {} }

View File

@@ -0,0 +1,17 @@
<view class="we7-bottom" style="background-color:{{tabBar.backgroundColor}};border-color:{{tabBar.borderStyle}}" wx:if="{{tabBar}}">
<block wx:for="{{tabBar.list}}" wx:key="{{index}}">
<view class="we7-bottom-item" hoverClass="active" wx:if="{{item.pageUrl=='/'+thisurl}}">
<navigator hoverClass="active" openType="redirect" url="{{item.pagePath}}">
<image class="item-img" mode="widthFix" src="{{item.selectedIconPath}}"></image>
<view class="item-text" style="color: {{tabBar.selectedColor}};">{{item.text}}</view>
</navigator>
</view>
<view class="we7-bottom-item" hoverClass="active" wx:else>
<navigator hoverClass="active" openType="redirect" url="{{item.pagePath}}">
<image class="item-img" mode="widthFix" src="{{item.iconPath}}"></image>
<view class="item-text" style="color: {{tabBar.tabBarcolor}}">{{item.text}}</view>
</navigator>
</view>
</block>
</view>
<view class="we7-bottom-placeholder"></view>

View File

@@ -0,0 +1,38 @@
.we7-bottom-placeholder {
bottom: 0;
height: 134rpx;
position: relative;
width: 100%;
z-index: -1;
}
.we7-bottom {
border-top: 1px solid #000;
bottom: 0;
display: -webkit-flex;
display: flex;
left: 0;
overflow: hidden;
padding: 10rpx 0;
position: fixed;
right: 0;
}
.we7-bottom,
.we7-bottom.active,
.we7-bottom.active navigatorurl {
background-color: #fff;
}
.we7-bottom .we7-bottom-item {
flex: 1;
padding: 10rpx;
text-align: center;
}
.we7-bottom .item-img {
display: inline-block;
height: 50rpx;
width: 50rpx;
}
.we7-bottom .item-text {
display: block;
font-size: 12px;
line-height: 1;
}

34
we7/pages/index/index.js Normal file
View File

@@ -0,0 +1,34 @@
var e;
(e = getApp()),
Page({
data: { navs: [], slide: [], commend: [], userInfo: {} },
onLoad: function () {
var a = this;
e.util.footer(a),
e.util.request({
url: "wxapp/home/nav",
cachetime: "30",
success: function (e) {
e.data.message.errno ||
(console.log(e.data.message.message),
a.setData({ navs: e.data.message.message }));
},
}),
e.util.request({
url: "wxapp/home/slide",
cachetime: "30",
success: function (e) {
e.data.message.errno ||
a.setData({ slide: e.data.message.message });
},
}),
e.util.request({
url: "wxapp/home/commend",
cachetime: "30",
success: function (e) {
e.data.message.errno ||
a.setData({ commend: e.data.message.message });
},
});
},
});

View File

@@ -0,0 +1,28 @@
<view class="container">
<view class="swiper">
<swiper autoplay="true" duration="1200" indicatorDots="true" interval="3000">
<swiper-item wx:for="{{slide}}" wx:key="{{index}}">
<image class="nav-icon" mode="aspectFill" src="{{item.thumb}}"></image>
</swiper-item>
</swiper>
</view>
<view class="nav">
<navigator class="nav-item {{(index+1)%3==0?'nav-item-no-border':''}}" hoverClass="navigator-hover" url="{{item.url}}" wx:for="{{navs}}" wx:key="{{index}}">
<image class="nav-icon" src="{{item.icon}}"></image>
<view class="nav-title">{{item.name}}</view>
</navigator>
</view>
<view class="commend">
<block wx:for="{{commend}}" wx:key="{{index}}">
<view class="commend-header-title">{{item.name}}</view>
<view class="commend-column">
<navigator class="commend-item" hoverClass="navigator-hover" wx:for="{{item.article}}" wx:for-item="subItem">
<image class="commend-thumb" src="{{subItem.thumb}}"></image>
<view class="commend-title">{{subItem.title}}</view>
</navigator>
</view>
</block>
</view>
</view>
<import src="/we7/pages/templates/footer.wxml"></import>
<template is="footerWx" data="{{...tabBar}}"></template>

View File

@@ -0,0 +1,74 @@
.container {
background: #e6e6e6;
}
.nav {
background-color: #fff;
display: -webkit-flex;
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
}
.nav-item {
border: 1px solid #c9c9c9;
border-left: none;
border-top: none;
color: #fff;
flex-direction: column;
height: 237rpx;
text-align: center;
width: 248rpx;
}
.nav-item.nav-item-no-border {
border-right: none;
}
.nav-item .nav-icon {
align-items: center;
height: 118rpx;
margin-top: 38rpx;
width: 118rpx;
}
.commend-item .commend-title,
.nav-item .nav-title {
color: #000;
font-size: 24rpx;
margin-top: 20rpx;
}
.swiper {
height: 350rpx;
width: 100%;
}
.swiper image,
.swiper swiper {
height: 100%;
width: 100%;
}
.commend {
background: #fff;
flex-wrap: wrap;
margin-top: 20rpx;
text-align: center;
width: 100%;
}
.commend .commend-column {
display: -webkit-flex;
display: flex;
}
.commend .commend-header-title {
font-size: 30rpx;
line-height: 98rpx;
padding-left: 15rpx;
text-align: left;
}
.commend .commend-item {
border-right: 1px solid #c9c9c9;
display: -webkit-flex;
display: flex;
flex-direction: column;
padding-bottom: 60rpx;
width: 372rpx;
}
.commend .commend-item image {
height: 210rpx;
width: 100%;
}

View File

@@ -0,0 +1,45 @@
var e, o;
(e = getApp()),
(o = require("../../resource/js/htmlToWxml.js")),
Page({
data: { scrollHeight: 0, newsData: {} },
getNewsDetail: function () {
var n = this;
wx.request({
url: "https://wedengta.com/wxnews/getNews?action=DiscNewsContent&type=4&id=1478677877_1406730_1_9",
headers: { "Content-Type": "application/json" },
success: function (t) {
var s = t.data;
if (0 == s.ret) {
var a = JSON.parse(s.content);
(a.content = o.html2json(a.sContent)),
(a.time = e.util.formatTime(1e3 * a.iTime)),
n.setData({ newsData: a });
} else console.log("数据拉取失败");
},
fail: function (e) {
console.log("数据拉取失败");
},
});
},
stockClick: function (e) {
var o = e.currentTarget.dataset.seccode,
n = e.currentTarget.dataset.secname;
console.log("stockClick:" + o + ";secName:" + n);
},
onLoad: function (e) {
this.getNewsDetail(), console.log("onLoad");
},
onShow: function () {
console.log("onShow");
},
onReady: function () {
console.log("onReady");
},
onHide: function () {
console.log("onHide");
},
onUnload: function () {
console.log("onUnload");
},
});

View File

@@ -0,0 +1,15 @@
<import src="/we7/pages/templates/news.wxml"></import>
<view class="page_gap page_news">
<text class="h1" id="newsTitle">{{newsData.sTitle}}</text>
<view class="news_info">
<text class="span" id="newsAuthor">{{newsData.sFrom}}</text>
<text class="span" id="newsDate">{{newsData.time}}</text>
</view>
<view id="font-adjust">
<view class="news_relative" id="newsRelative"></view>
<view class="summary_block" id="summary">{{newsData.sDescription}}</view>
<view class="news_txt" id="newsContent">
<template is="newsDetail" data="{{...newsData}}"></template>
</view>
</view>
</view>

View File

@@ -0,0 +1,93 @@
.page_gap {
padding: 16px 15px;
}
.page_news {
background-color: #fff;
}
.page_news a {
color: #106fbc;
}
.page_news .h1 {
color: #373737;
display: block;
font-size: 21px;
font-weight: 700;
letter-spacing: 0.5px;
line-height: 1.3;
margin-bottom: 11px;
}
.news_info {
color: rgba(89, 89, 89, 0.6);
float: left;
font-size: 12px;
margin-bottom: 15px;
}
.news_info .span {
display: inline-block;
margin-right: 8px;
}
.summary_block {
background-color: #ececec;
border-radius: 0 3px 3px 3px;
box-sizing: border-box;
font-size: 14px;
line-height: 1.8;
margin-bottom: 20px;
padding: 10px;
position: relative;
text-align: justify;
text-indent: 30px;
word-break: break-all;
}
.summary_block:before {
background-color: #f79464;
border-radius: 0 3px 3px 0;
color: #fff;
content: "摘要";
display: inline-block;
font-size: 12px;
left: 0;
line-height: 1.6;
padding: 0 4px;
position: absolute;
text-indent: 0;
top: 0;
z-index: 10;
}
.news_relative {
clear: both;
font-size: 12px;
margin-bottom: 13px;
}
.news_relative p {
line-height: 1.7;
}
.news_relative p span {
color: rgba(89, 89, 89, 0.6);
}
.news_relative p a {
margin-right: 10px;
}
.news_txt {
color: #252525;
font-size: 16px;
line-height: 1.8;
padding-bottom: 30px;
word-break: break-all;
}
.news_txt .div {
margin-bottom: 12px;
text-align: justify;
}
.news_txt .a {
color: #106fbc;
position: relative;
}
.news_txt .b {
font-weight: 700;
}
.news_txt .img {
display: block;
padding: 5px;
width: 100%;
}

View File

@@ -0,0 +1,135 @@
var e, t, a;
(e = require("../utils/util")),
(t = "http://japi.zto.cn/zto/api_utf8/baseArea?msg_type=GET_AREA&data="),
(a = {
addDot: function (e) {
e instanceof Array &&
e.map(function (e) {
return e.fullName.length > 4
? ((e.fullNameDot = e.fullName.slice(0, 4) + "..."), e)
: ((e.fullNameDot = e.fullName), e);
});
},
load: function (d) {
d.setData({ isShow: !1 }),
(0, e.Promise)(wx.request, { url: t + "0", method: "GET" })
.then(function (l) {
var c = l.data.result[0];
return (
a.addDot(l.data.result),
d.setData({
proviceData: l.data.result,
"selectedProvince.index": 0,
"selectedProvince.code": c.code,
"selectedProvince.fullName": c.fullName,
}),
(0, e.Promise)(wx.request, { url: t + c.code, method: "GET" })
);
})
.then(function (l) {
var c = l.data.result[0];
return (
a.addDot(l.data.result),
d.setData({
cityData: l.data.result,
"selectedCity.index": 0,
"selectedCity.code": c.code,
"selectedCity.fullName": c.fullName,
}),
(0, e.Promise)(wx.request, { url: t + c.code, method: "GET" })
);
})
.then(function (e) {
var t = e.data.result[0];
a.addDot(e.data.result),
d.setData({
districtData: e.data.result,
"selectedDistrict.index": 0,
"selectedDistrict.code": t.code,
"selectedDistrict.fullName": t.fullName,
});
})
.catch(function (e) {
console.log(e);
});
},
tapProvince: function (d, l) {
var c = d.currentTarget.dataset;
(0, e.Promise)(wx.request, { url: t + c.code, method: "GET" })
.then(function (d) {
return (
a.addDot(d.data.result),
l.setData({
cityData: d.data.result,
"selectedProvince.code": c.code,
"selectedProvince.fullName": c.fullName,
"selectedCity.code": d.data.result[0].code,
"selectedCity.fullName": d.data.result[0].fullName,
}),
(0, e.Promise)(wx.request, {
url: t + d.data.result[0].code,
method: "GET",
})
);
})
.then(function (e) {
a.addDot(e.data.result),
l.setData({
districtData: e.data.result,
"selectedProvince.index": d.currentTarget.dataset.index,
"selectedCity.index": 0,
"selectedDistrict.index": 0,
"selectedDistrict.code": e.data.result[0].code,
"selectedDistrict.fullName": e.data.result[0].fullName,
});
})
.catch(function (e) {
console.log(e);
});
},
tapCity: function (d, l) {
var c = d.currentTarget.dataset;
(0, e.Promise)(wx.request, { url: t + c.code, method: "GET" })
.then(function (e) {
a.addDot(e.data.result),
l.setData({
districtData: e.data.result,
"selectedCity.index": d.currentTarget.dataset.index,
"selectedCity.code": c.code,
"selectedCity.fullName": c.fullName,
"selectedDistrict.index": 0,
"selectedDistrict.code": e.data.result[0].code,
"selectedDistrict.fullName": e.data.result[0].fullName,
});
})
.catch(function (e) {
console.log(e);
});
},
tapDistrict: function (e, t) {
var a = e.currentTarget.dataset;
t.setData({
"selectedDistrict.index": e.currentTarget.dataset.index,
"selectedDistrict.code": a.code,
"selectedDistrict.fullName": a.fullName,
});
},
confirm: function (e, t) {
t.setData({
address:
t.data.selectedProvince.fullName +
" " +
t.data.selectedCity.fullName +
" " +
t.data.selectedDistrict.fullName,
isShow: !1,
});
},
cancel: function (e) {
e.setData({ isShow: !1 });
},
choosearea: function (e) {
e.setData({ isShow: !0 });
},
}),
(module.exports = { SA: a });

View File

@@ -0,0 +1,19 @@
<view class="shade {{isShow?'show':''}}">
<view class="selector-area box box-tb">
<view class="handle-bar box box-lr box-align-center">
<text bindtap="cancel" class="btn cancel flex">取消</text>
<text bindtap="confirm" class="btn confirm flex">确定</text>
</view>
<view class="area-selector box box-lr">
<scroll-view class="selector province flex" data-type="province" scrollY="true">
<view bindtap="tapProvince" class="picker {{selectedProvince.index==index?'actived':''}}" data-code="{{item.code}}" data-full-name="{{item.fullName}}" data-index="{{index}}" wx:for="{{proviceData}}">{{item.fullNameDot}}</view>
</scroll-view>
<scroll-view class="selector city flex" data-type="city" scrollY="true">
<view bindtap="tapCity" class="picker {{selectedCity.index==index?'actived':''}}" data-code="{{item.code}}" data-full-name="{{item.fullName}}" data-index="{{index}}" wx:for="{{cityData}}">{{item.fullNameDot}}</view>
</scroll-view>
<scroll-view class="selector district flex" data-type="district" scrollY="true">
<view bindtap="tapDistrict" class="picker {{selectedDistrict.index==index?'actived':''}}" data-code="{{item.code}}" data-full-name="{{item.fullName}}" data-index="{{index}}" wx:for="{{districtData}}">{{item.fullNameDot}}</view>
</scroll-view>
</view>
</view>
</view>

View File

@@ -0,0 +1,50 @@
.shade {
background-color: #ccc;
display: none;
height: 100%;
left: 0;
opacity: 0.6;
position: absolute;
top: 0;
width: 100%;
}
.show {
display: block;
}
.handle-bar {
background-color: #eee;
height: 80rpx;
padding: 0 15px;
}
.confirm {
text-align: right;
}
.selector-area {
background-color: #e6ebf3;
bottom: 0;
height: 600rpx;
position: absolute;
width: 100%;
}
.selector {
text-align: center;
}
.picker {
font-size: 32rpx;
height: 60rpx;
line-height: 60rpx;
}
.actived {
color: blue;
}
.area-selector {
height: 520rpx;
}
.white-shade {
background-color: #fff;
height: 60rpx;
left: 0;
margin-top: 240rpx;
position: absolute;
width: 100%;
}

View File

@@ -0,0 +1,24 @@
<template name="footerWx">
<view class="we7-bottom" style="background-color:{{backgroundColor}};border-color:{{borderStyle}}" wx:if="{{list}}">
<block wx:for="{{list}}" wx:key="{{index}}">
<view class="we7-bottom-item" hoverClass="active" wx:if="{{item.pageUrl=='/'+thisurl}}">
<navigator hoverClass="active" openType="redirect" url="{{item.pagePath}}">
<image class="item-img" mode="widthFix" src="{{item.selectedIconPath}}"></image>
<view class="item-text" style="color: {{selectedColor}};">{{item.text}}</view>
</navigator>
</view>
<view class="we7-bottom-item" hoverClass="active" wx:else>
<navigator hoverClass="active" openType="redirect" url="{{item.pagePath}}">
<image class="item-img" mode="widthFix" src="{{item.iconPath}}"></image>
<view class="item-text" style="color: {{color}}">{{item.text}}</view>
</navigator>
</view>
</block>
</view>
<view class="we7-bottom-placeholder"></view>
</template>
<template name="goHome">
<navigator class="goHome" hoverClass="active" openType="redirect" url="/we7/pages/index/index">
<image mode="widthFix" src="/we7/resource/images/home.png"></image>
</navigator>
</template>

View File

View File

@@ -0,0 +1,12 @@
<template name="newsDetail">
<block wx:for="{{content}}" wx:for-index="idy" wx:for-item="cellData">
<view class="p" wx:if="{{cellData.type=='view'}}">
<block wx:for="{{cellData.child}}" wx:key="text">
<text bindtap="stockClick" class="a" data-seccode="{{item.attr['data-seccode']}}" data-secname="{{item.attr['data-secname']}}" wx:if="{{item.type=='a'}}">{{item.text}}</text>
<text wx:else>{{item.text}}</text>
</block>
</view>
<block wx:if="{{cellData.type=='img'}}"> {{wn_html_images}} <image bindload="imageLoad" class="img" data-index="{{idy}}" mode="widthFix" src="{{cellData.attr.src}}" style="width: {{cellData['attr']['width']}};max-width: 100%;height: {{cellData['attr']['height']?cellData['attr']['height']:auto}}"></image>
</block>
</block>
</template>

View File

View File

@@ -0,0 +1,12 @@
var n;
(n = getApp()),
Page({
data: { text: "微擎我的" },
onLoad: function (o) {
n.util.footer(this);
},
onReady: function () {},
onShow: function () {},
onHide: function () {},
onUnload: function () {},
});

View File

@@ -0,0 +1,7 @@
<view class="container">
<view class="textContainer">
<text class="textStyle">{{text}}</text>
</view>
</view>
<import src="/we7/pages/templates/footer.wxml"></import>
<template is="footerWx" data="{{...tabBar}}"></template>

View File

@@ -0,0 +1,16 @@
.container {
box-sizing: border-box;
height: 100%;
justify-content: space-between;
padding: 200rpx 0;
}
.container,
.textStyle {
align-items: center;
display: -webkit-flex;
display: flex;
flex-direction: column;
}
.textContainer {
margin-top: 200px;
}

199
we7/resource/js/base64.js Normal file
View File

@@ -0,0 +1,199 @@
module.exports = {
base64_encode: function (r) {
for (
var e,
a,
t,
h = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
o = 0,
c = r.length,
d = "";
o < c;
) {
if (((e = 255 & r.charCodeAt(o++)), o == c)) {
(d += h.charAt(e >> 2)), (d += h.charAt((3 & e) << 4)), (d += "==");
break;
}
if (((a = r.charCodeAt(o++)), o == c)) {
(d += h.charAt(e >> 2)),
(d += h.charAt(((3 & e) << 4) | ((240 & a) >> 4))),
(d += h.charAt((15 & a) << 2)),
(d += "=");
break;
}
(t = r.charCodeAt(o++)),
(d += h.charAt(e >> 2)),
(d += h.charAt(((3 & e) << 4) | ((240 & a) >> 4))),
(d += h.charAt(((15 & a) << 2) | ((192 & t) >> 6))),
(d += h.charAt(63 & t));
}
return d;
},
base64_decode: function (r) {
for (
var e,
a,
t,
h,
o = new Array(
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
62,
-1,
-1,
-1,
63,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
-1,
-1,
-1,
-1,
-1,
-1,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
-1,
-1,
-1,
-1,
-1
),
c = 0,
d = r.length,
i = "";
c < d;
) {
do {
e = o[255 & r.charCodeAt(c++)];
} while (c < d && -1 == e);
if (-1 == e) break;
do {
a = o[255 & r.charCodeAt(c++)];
} while (c < d && -1 == a);
if (-1 == a) break;
i += String.fromCharCode((e << 2) | ((48 & a) >> 4));
do {
if (61 == (t = 255 & r.charCodeAt(c++))) return i;
t = o[t];
} while (c < d && -1 == t);
if (-1 == t) break;
i += String.fromCharCode(((15 & a) << 4) | ((60 & t) >> 2));
do {
if (61 == (h = 255 & r.charCodeAt(c++))) return i;
h = o[h];
} while (c < d && -1 == h);
if (-1 == h) break;
i += String.fromCharCode(((3 & t) << 6) | h);
}
return i;
},
};

View File

@@ -0,0 +1,297 @@
!(function () {
function t(t) {
for (var e = {}, r = t.split(","), a = 0; a < r.length; a++) e[r[a]] = !0;
return e;
}
var e =
/^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
r = /^<\/([-A-Za-z0-9_]+)[^>]*>/,
a =
/([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,
i = t(
"area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"
),
n = t(
"a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"
),
s = t(
"abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"
),
o = t("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),
c = t(
"checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"
),
l = t("script,style"),
h = function (t, h) {
function d(t, e) {
if (e) for (r = m.length - 1; r >= 0 && m[r] != e; r--);
else var r = 0;
if (r >= 0) {
for (var a = m.length - 1; a >= r; a--) h.end && h.end(m[a]);
m.length = r;
}
}
var u,
f,
p,
m = [],
g = t;
for (
m.last = function () {
return this[this.length - 1];
};
t;
) {
if (((f = !0), m.last() && l[m.last()]))
(t = t.replace(
new RegExp("([\\s\\S]*?)</" + m.last() + "[^>]*>"),
function (t, e) {
return (
(e = e.replace(
/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g,
"$1$2"
)),
h.chars && h.chars(e),
""
);
}
)),
d(0, m.last());
else if (
(0 == t.indexOf("\x3c!--")
? (u = t.indexOf("--\x3e")) >= 0 &&
(h.comment && h.comment(t.substring(4, u)),
(t = t.substring(u + 3)),
(f = !1))
: 0 == t.indexOf("</")
? (p = t.match(r)) &&
((t = t.substring(p[0].length)), p[0].replace(r, d), (f = !1))
: 0 == t.indexOf("<") &&
(p = t.match(e)) &&
((t = t.substring(p[0].length)),
p[0].replace(e, function (t, e, r, l) {
if (((e = e.toLowerCase()), n[e]))
for (; m.last() && s[m.last()]; ) d(0, m.last());
if (
(o[e] && m.last() == e && d(0, e),
(l = i[e] || !!l) || m.push(e),
h.start)
) {
var u = [];
r.replace(a, function (t, e) {
var r = arguments[2]
? arguments[2]
: arguments[3]
? arguments[3]
: arguments[4]
? arguments[4]
: c[e]
? e
: "";
u.push({
name: e,
value: r,
escaped: r.replace(/(^|[^\\])"/g, '$1\\"'),
});
}),
h.start && h.start(e, u, l);
}
}),
(f = !1)),
f)
) {
var v = (u = t.indexOf("<")) < 0 ? t : t.substring(0, u);
(t = u < 0 ? "" : t.substring(u)), h.chars && h.chars(v);
}
if (t == g) throw "Parse Error: " + t;
g = t;
}
d();
},
d = {};
(d.html2json = function (t) {
t = (function (t) {
return t
.replace(/<\?xml.*\?>\n/, "")
.replace(/<!doctype.*\>\n/, "")
.replace(/<!DOCTYPE.*\>\n/, "");
})(t);
var e = [],
r = { node: "root", child: [] };
return (
h(t, {
start: function (t, a, i) {
var n = { node: "element", tag: t };
if (
(0 !== a.length &&
(n.attr = a.reduce(function (t, e) {
var r = e.name,
a = e.value;
return (
a.match(/ /) && (a = a.split(" ")),
t[r]
? Array.isArray(t[r])
? t[r].push(a)
: (t[r] = [t[r], a])
: (t[r] = a),
t
);
}, {})),
i)
) {
var s = e[0] || r;
void 0 === s.child && (s.child = []), s.child.push(n);
} else e.unshift(n);
},
end: function (t) {
var a = e.shift();
if (
(a.tag !== t && console.error("invalid state: mismatch end tag"),
0 === e.length)
)
r.child.push(a);
else {
var i = e[0];
void 0 === i.child && (i.child = []), i.child.push(a);
}
},
chars: function (t) {
var a = { node: "text", text: t };
if (0 === e.length) r.child.push(a);
else {
var i = e[0];
void 0 === i.child && (i.child = []), i.child.push(a);
}
},
comment: function (t) {
var r = { node: "comment", text: t },
a = e[0];
void 0 === a.child && (a.child = []), a.child.push(r);
},
}),
r
);
}),
(d.json2html = function t(e) {
var r = "";
e.child &&
(r = e.child
.map(function (e) {
return t(e);
})
.join(""));
var a = "";
if (
(e.attr &&
"" !==
(a = Object.keys(e.attr)
.map(function (t) {
var r = e.attr[t];
return (
Array.isArray(r) && (r = r.join(" ")),
t +
"=" +
(function (t) {
return '"' + t + '"';
})(r)
);
})
.join(" ")) &&
(a = " " + a),
"element" === e.node)
) {
var i = e.tag;
return [
"area",
"base",
"basefont",
"br",
"col",
"frame",
"hr",
"img",
"input",
"isindex",
"link",
"meta",
"param",
"embed",
].indexOf(i) > -1
? "<" + e.tag + a + "/>"
: "<" + e.tag + a + ">" + r + "</" + e.tag + ">";
}
return "text" === e.node
? e.text
: "comment" === e.node
? "\x3c!--" + e.text + "--\x3e"
: "root" === e.node
? r
: void 0;
});
module.exports = {
html2json: function (t) {
var e = d.html2json(t);
return (function (t) {
for (var e = [], r = [], a = 0, i = t.length; a < i; a++)
if (0 == a) {
if ("view" == t[a].type) continue;
e.push(t[a]);
} else if ("view" == t[a].type)
e.length > 0 && ((s = { type: "view", child: e }), r.push(s)),
(e = []);
else if ("img" == t[a].type) {
e.length > 0 && ((s = { type: "view", child: e }), r.push(s));
var n = t[a].attr;
t[a].attr.width &&
-1 === t[a].attr.width.indexOf("%") &&
-1 === t[a].attr.width.indexOf("px") &&
(t[a].attr.width = t[a].attr.width + "px"),
t[a].attr.height &&
-1 === t[a].attr.height.indexOf("%") &&
-1 === t[a].attr.height.indexOf("px") &&
(t[a].attr.height = t[a].attr.height + "px"),
(s = { type: "img", attr: n }),
r.push(s),
(e = []);
} else if ((e.push(t[a]), a == i - 1)) {
var s = { type: "view", child: e };
r.push(s);
}
return r;
})(
(e = (function (t) {
var e = [];
return (
(function t(r) {
var a = {};
if ("root" == r.node);
else if ("element" == r.node)
switch (r.tag) {
case "a":
a = { type: "a", text: r.child[0].text };
break;
case "img":
a = { type: "img", text: r.text };
break;
case "p":
case "div":
a = { type: "view", text: r.text };
}
else "text" == r.node && (a = { type: "text", text: r.text });
if (
(r.attr && (a.attr = r.attr),
0 != Object.keys(a).length && e.push(a),
"a" != r.tag)
) {
var i = r.child;
if (i) for (var n in i) t(i[n]);
}
})(t),
e
);
})(e))
);
},
};
})();

542
we7/resource/js/md5.js Normal file
View File

@@ -0,0 +1,542 @@
!(function (n) {
function r(n, r) {
var t = (65535 & n) + (65535 & r);
return (((n >> 16) + (r >> 16) + (t >> 16)) << 16) | (65535 & t);
}
function t(n, t, e, u, o, c) {
return r(
(function (n, r) {
return (n << r) | (n >>> (32 - r));
})(r(r(t, n), r(u, c)), o),
e
);
}
function e(n, r, e, u, o, c, f) {
return t((r & e) | (~r & u), n, r, o, c, f);
}
function u(n, r, e, u, o, c, f) {
return t((r & u) | (e & ~u), n, r, o, c, f);
}
function o(n, r, e, u, o, c, f) {
return t(r ^ e ^ u, n, r, o, c, f);
}
function c(n, r, e, u, o, c, f) {
return t(e ^ (r | ~u), n, r, o, c, f);
}
function f(n, t) {
(n[t >> 5] |= 128 << t % 32), (n[14 + (((t + 64) >>> 9) << 4)] = t);
var f,
i,
a,
h,
g,
l = 1732584193,
d = -271733879,
v = -1732584194,
C = 271733878;
for (f = 0; f < n.length; f += 16)
(i = l),
(a = d),
(h = v),
(g = C),
(d = c(
(d = c(
(d = c(
(d = c(
(d = o(
(d = o(
(d = o(
(d = o(
(d = u(
(d = u(
(d = u(
(d = u(
(d = e(
(d = e(
(d = e(
(d = e(
d,
(v = e(
v,
(C = e(
C,
(l = e(
l,
d,
v,
C,
n[f],
7,
-680876936
)),
d,
v,
n[f + 1],
12,
-389564586
)),
l,
d,
n[f + 2],
17,
606105819
)),
C,
l,
n[f + 3],
22,
-1044525330
)),
(v = e(
v,
(C = e(
C,
(l = e(
l,
d,
v,
C,
n[f + 4],
7,
-176418897
)),
d,
v,
n[f + 5],
12,
1200080426
)),
l,
d,
n[f + 6],
17,
-1473231341
)),
C,
l,
n[f + 7],
22,
-45705983
)),
(v = e(
v,
(C = e(
C,
(l = e(
l,
d,
v,
C,
n[f + 8],
7,
1770035416
)),
d,
v,
n[f + 9],
12,
-1958414417
)),
l,
d,
n[f + 10],
17,
-42063
)),
C,
l,
n[f + 11],
22,
-1990404162
)),
(v = e(
v,
(C = e(
C,
(l = e(
l,
d,
v,
C,
n[f + 12],
7,
1804603682
)),
d,
v,
n[f + 13],
12,
-40341101
)),
l,
d,
n[f + 14],
17,
-1502002290
)),
C,
l,
n[f + 15],
22,
1236535329
)),
(v = u(
v,
(C = u(
C,
(l = u(
l,
d,
v,
C,
n[f + 1],
5,
-165796510
)),
d,
v,
n[f + 6],
9,
-1069501632
)),
l,
d,
n[f + 11],
14,
643717713
)),
C,
l,
n[f],
20,
-373897302
)),
(v = u(
v,
(C = u(
C,
(l = u(l, d, v, C, n[f + 5], 5, -701558691)),
d,
v,
n[f + 10],
9,
38016083
)),
l,
d,
n[f + 15],
14,
-660478335
)),
C,
l,
n[f + 4],
20,
-405537848
)),
(v = u(
v,
(C = u(
C,
(l = u(l, d, v, C, n[f + 9], 5, 568446438)),
d,
v,
n[f + 14],
9,
-1019803690
)),
l,
d,
n[f + 3],
14,
-187363961
)),
C,
l,
n[f + 8],
20,
1163531501
)),
(v = u(
v,
(C = u(
C,
(l = u(l, d, v, C, n[f + 13], 5, -1444681467)),
d,
v,
n[f + 2],
9,
-51403784
)),
l,
d,
n[f + 7],
14,
1735328473
)),
C,
l,
n[f + 12],
20,
-1926607734
)),
(v = o(
v,
(C = o(
C,
(l = o(l, d, v, C, n[f + 5], 4, -378558)),
d,
v,
n[f + 8],
11,
-2022574463
)),
l,
d,
n[f + 11],
16,
1839030562
)),
C,
l,
n[f + 14],
23,
-35309556
)),
(v = o(
v,
(C = o(
C,
(l = o(l, d, v, C, n[f + 1], 4, -1530992060)),
d,
v,
n[f + 4],
11,
1272893353
)),
l,
d,
n[f + 7],
16,
-155497632
)),
C,
l,
n[f + 10],
23,
-1094730640
)),
(v = o(
v,
(C = o(
C,
(l = o(l, d, v, C, n[f + 13], 4, 681279174)),
d,
v,
n[f],
11,
-358537222
)),
l,
d,
n[f + 3],
16,
-722521979
)),
C,
l,
n[f + 6],
23,
76029189
)),
(v = o(
v,
(C = o(
C,
(l = o(l, d, v, C, n[f + 9], 4, -640364487)),
d,
v,
n[f + 12],
11,
-421815835
)),
l,
d,
n[f + 15],
16,
530742520
)),
C,
l,
n[f + 2],
23,
-995338651
)),
(v = c(
v,
(C = c(
C,
(l = c(l, d, v, C, n[f], 6, -198630844)),
d,
v,
n[f + 7],
10,
1126891415
)),
l,
d,
n[f + 14],
15,
-1416354905
)),
C,
l,
n[f + 5],
21,
-57434055
)),
(v = c(
v,
(C = c(
C,
(l = c(l, d, v, C, n[f + 12], 6, 1700485571)),
d,
v,
n[f + 3],
10,
-1894986606
)),
l,
d,
n[f + 10],
15,
-1051523
)),
C,
l,
n[f + 1],
21,
-2054922799
)),
(v = c(
v,
(C = c(
C,
(l = c(l, d, v, C, n[f + 8], 6, 1873313359)),
d,
v,
n[f + 15],
10,
-30611744
)),
l,
d,
n[f + 6],
15,
-1560198380
)),
C,
l,
n[f + 13],
21,
1309151649
)),
(v = c(
v,
(C = c(
C,
(l = c(l, d, v, C, n[f + 4], 6, -145523070)),
d,
v,
n[f + 11],
10,
-1120210379
)),
l,
d,
n[f + 2],
15,
718787259
)),
C,
l,
n[f + 9],
21,
-343485551
)),
(l = r(l, i)),
(d = r(d, a)),
(v = r(v, h)),
(C = r(C, g));
return [l, d, v, C];
}
function i(n) {
var r,
t = "",
e = 32 * n.length;
for (r = 0; r < e; r += 8)
t += String.fromCharCode((n[r >> 5] >>> r % 32) & 255);
return t;
}
function a(n) {
var r,
t = [];
for (t[(n.length >> 2) - 1] = void 0, r = 0; r < t.length; r += 1) t[r] = 0;
var e = 8 * n.length;
for (r = 0; r < e; r += 8)
t[r >> 5] |= (255 & n.charCodeAt(r / 8)) << r % 32;
return t;
}
function h(n) {
var r,
t,
e = "";
for (t = 0; t < n.length; t += 1)
(r = n.charCodeAt(t)),
(e +=
"0123456789abcdef".charAt((r >>> 4) & 15) +
"0123456789abcdef".charAt(15 & r));
return e;
}
function g(n) {
return unescape(encodeURIComponent(n));
}
function l(n) {
return (function (n) {
return i(f(a(n), 8 * n.length));
})(g(n));
}
function d(n, r) {
return (function (n, r) {
var t,
e,
u = a(n),
o = [],
c = [];
for (
o[15] = c[15] = void 0,
u.length > 16 && (u = f(u, 8 * n.length)),
t = 0;
t < 16;
t += 1
)
(o[t] = 909522486 ^ u[t]), (c[t] = 1549556828 ^ u[t]);
return (
(e = f(o.concat(a(r)), 512 + 8 * r.length)), i(f(c.concat(e), 640))
);
})(g(n), g(r));
}
module.exports = function (n, r, t) {
return r
? t
? d(r, n)
: (function (n, r) {
return h(d(n, r));
})(r, n)
: t
? l(n)
: (function (n) {
return h(l(n));
})(n);
};
})();

File diff suppressed because it is too large Load Diff

636
we7/resource/js/util.js Normal file
View File

@@ -0,0 +1,636 @@
!(function () {
function _interopRequireDefault(e) {
return e && e.__esModule ? e : { default: e };
}
function _defineProperty(e, t, n) {
return (
t in e
? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0,
})
: (e[t] = n),
e
);
}
function getQuery(e) {
var t = [];
if (-1 != e.indexOf("?"))
for (var n = e.split("?")[1].split("&"), a = 0; a < n.length; a++)
n[a].split("=")[0] &&
unescape(n[a].split("=")[1]) &&
(t[a] = {
name: n[a].split("=")[0],
value: unescape(n[a].split("=")[1]),
});
return t;
}
function getUrlParam(e, t) {
var n = new RegExp("(^|&)" + t + "=([^&]*)(&|$)"),
a = e.split("?")[1].match(n);
return null != a ? unescape(a[2]) : null;
}
function getSign(e, t, n) {
var a = require("underscore.js"),
r = require("md5.js"),
i = "",
o = getUrlParam(e, "sign");
if (o || (t && t.sign)) return !1;
if ((e && (i = getQuery(e)), t)) {
var s = [];
for (var u in t) u && t[u] && (s = s.concat({ name: u, value: t[u] }));
i = i.concat(s);
}
(i = a.sortBy(i, "name")), (i = a.uniq(i, !0, "name"));
for (var c = "", f = 0; f < i.length; f++)
i[f] &&
i[f].name &&
i[f].value &&
((c += i[f].name + "=" + i[f].value), f < i.length - 1 && (c += "&"));
return r(c + (n = n || getApp().siteInfo.token));
}
var _typeof =
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e &&
"function" == typeof Symbol &&
e.constructor === Symbol &&
e !== Symbol.prototype
? "symbol"
: typeof e;
},
_base = require("base64"),
_md = require("md5"),
_md2 = _interopRequireDefault(_md),
util = {
base64Encode: function (e) {
return (0, _base.base64_encode)(e);
},
base64Decode: function (e) {
return (0, _base.base64_decode)(e);
},
md5: function (e) {
return (0, _md2.default)(e);
},
url: function (e, t) {
var n = getApp(),
a =
n.siteInfo.siteroot +
"?i=" +
n.siteInfo.uniacid +
"&t=" +
n.siteInfo.multiid +
"&v=" +
n.siteInfo.version +
"&from=wxapp&";
if (
(e &&
((e = e.split("/"))[0] && (a += "c=" + e[0] + "&"),
e[1] && (a += "a=" + e[1] + "&"),
e[2] && (a += "do=" + e[2] + "&")),
t && "object" === (void 0 === t ? "undefined" : _typeof(t)))
)
for (var r in t)
r && t.hasOwnProperty(r) && t[r] && (a += r + "=" + t[r] + "&");
return a;
},
getSign: function (e, t, n) {
return getSign(e, t, n);
},
request: function (e) {
require("underscore.js");
var t,
n = require("md5.js"),
a = getApp();
((e = e || {}).cachetime = e.cachetime ? e.cachetime : 0),
(e.showLoading = void 0 === e.showLoading || e.showLoading);
var r = wx.getStorageSync("userInfo").sessionid,
i = e.url;
if (
(-1 == i.indexOf("http://") &&
-1 == i.indexOf("https://") &&
(i = util.url(i)),
getUrlParam(i, "state") ||
(e.data && e.data.state) ||
!r ||
(i = i + "&state=we7sid-" + r),
!e.data || !e.data.m)
) {
var o = getCurrentPages();
o.length &&
(o = o[getCurrentPages().length - 1]) &&
o.__route__ &&
(i += "&m=monai_market");
}
var s = getSign(i, e.data);
if ((s && (i = i + "&sign=" + s), !i)) return !1;
if (
(wx.showNavigationBarLoading(),
e.showLoading && util.showLoading(),
e.cachetime)
) {
var u = n(i),
c = wx.getStorageSync(u),
f = Date.parse(new Date());
if (c && c.data) {
if (c.expire > f)
return (
e.complete && "function" == typeof e.complete && e.complete(c),
e.success && "function" == typeof e.success && e.success(c),
console.log("cache:" + i),
wx.hideLoading(),
wx.hideNavigationBarLoading(),
!0
);
wx.removeStorageSync(u);
}
}
wx.request(
(_defineProperty(
(t = {
url: i,
data: e.data ? e.data : {},
header: e.header ? e.header : {},
method: e.method ? e.method : "GET",
}),
"header",
{ "content-type": "application/x-www-form-urlencoded" }
),
_defineProperty(t, "success", function (t) {
if (
(wx.hideNavigationBarLoading(), wx.hideLoading(), t.data.errno)
) {
if ("41009" == t.data.errno)
return (
wx.setStorageSync("userInfo", ""),
void util.getUserInfo(function () {
util.request(e);
})
);
if (e.fail && "function" == typeof e.fail) e.fail(t);
else if (t.data.message) {
if (null != t.data.data && t.data.data.redirect)
n = t.data.data.redirect;
else var n = "";
a.util.message(t.data.message, n, "error");
}
} else if (
(e.success && "function" == typeof e.success && e.success(t),
e.cachetime)
) {
var r = { data: t.data, expire: f + 1e3 * e.cachetime };
wx.setStorageSync(u, r);
}
}),
_defineProperty(t, "fail", function (t) {
wx.hideNavigationBarLoading(), wx.hideLoading();
var n = require("md5.js")(i),
a = wx.getStorageSync(n);
if (a && a.data)
return (
e.success && "function" == typeof e.success && e.success(a),
console.log("failreadcache:" + i),
!0
);
e.fail && "function" == typeof e.fail && e.fail(t);
}),
_defineProperty(t, "complete", function (t) {
e.complete && "function" == typeof e.complete && e.complete(t);
}),
t)
);
},
getWe7User: function (e, t) {
var n = wx.getStorageSync("userInfo") || {};
util.request({
url: "auth/session/openid",
data: { code: t || "" },
cachetime: 0,
showLoading: !1,
success: function (t) {
t.data.errno ||
((n.sessionid = t.data.data.sessionid),
(n.memberInfo = t.data.data.userinfo),
wx.setStorageSync("userInfo", n)),
"function" == typeof e && e(n);
},
});
},
upadteUser: function (e, t) {
var n = wx.getStorageSync("userInfo");
if (!e) return "function" == typeof t && t(n);
(n.wxInfo = e.userInfo),
util.request({
url: "auth/session/userinfo",
data: {
signature: e.signature,
rawData: e.rawData,
iv: e.iv,
encryptedData: e.encryptedData,
},
method: "POST",
header: { "content-type": "application/x-www-form-urlencoded" },
cachetime: 0,
success: function (e) {
e.data.errno ||
((n.memberInfo = e.data.data),
wx.setStorageSync("userInfo", n)),
"function" == typeof t && t(n);
},
});
},
checkSession: function (e) {
util.request({
url: "auth/session/check",
method: "POST",
cachetime: 0,
showLoading: !1,
success: function (t) {
t.data.errno
? "function" == typeof e.fail && e.fail()
: "function" == typeof e.success && e.success();
},
fail: function () {
"function" == typeof e.fail && e.fail();
},
});
},
getUserInfo: function (e, t) {
var n = function () {
console.log("start login"),
wx.login({
success: function (n) {
util.getWe7User(function (n) {
t
? util.upadteUser(t, function (t) {
"function" == typeof e && e(t);
})
: wx.canIUse("getUserInfo")
? wx.getUserInfo({
withCredentials: !0,
success: function (t) {
util.upadteUser(t, function (t) {
"function" == typeof e && e(t);
});
},
fail: function () {},
})
: "function" == typeof e && e(n);
}, n.code);
},
fail: function () {},
});
},
a = wx.getStorageSync("userInfo") || {};
a.sessionid
? util.checkSession({
success: function () {
t
? util.upadteUser(t, function (t) {
"function" == typeof e && e(t);
})
: "function" == typeof e && e(a);
},
fail: function () {
(a.sessionid = ""),
console.log("relogin"),
wx.removeStorageSync("userInfo"),
n();
},
})
: n();
},
navigateBack: function (e) {
var t = e.delta ? e.delta : 1;
if (e.data) {
var n = getCurrentPages(),
a = n[n.length - (t + 1)];
a.pageForResult ? a.pageForResult(e.data) : a.setData(e.data);
}
wx.navigateBack({
delta: t,
success: function (t) {
"function" == typeof e.success && e.success(t);
},
fail: function (t) {
"function" == typeof e.fail && e.fail(t);
},
complete: function () {
"function" == typeof e.complete && e.complete();
},
});
},
footer: function (e) {
var t = e,
n = getApp().tabBar;
for (var a in n.list)
n.list[a].pageUrl = n.list[a].pagePath.replace(/(\?|#)[^"]*/g, "");
t.setData({ tabBar: n, "tabBar.thisurl": t.__route__ });
},
message: function (e, t, n) {
if (!e) return !0;
if (
("object" == (void 0 === e ? "undefined" : _typeof(e)) &&
((t = e.redirect), (n = e.type), (e = e.title)),
t)
) {
var a = t.substring(0, 9),
r = "",
i = "";
"navigate:" == a
? ((i = "navigateTo"), (r = t.substring(9)))
: "redirect:" == a
? ((i = "redirectTo"), (r = t.substring(9)))
: ((r = t), (i = "redirectTo"));
}
console.log(r),
n || (n = "success"),
"success" == n
? wx.showToast({
title: e,
icon: "success",
duration: 2e3,
mask: !!r,
complete: function () {
r &&
setTimeout(function () {
wx[i]({ url: r });
}, 1800);
},
})
: "error" == n &&
wx.showModal({
title: "温馨提醒",
content: e,
showCancel: !1,
complete: function () {
r && wx[i]({ url: r });
},
});
},
};
(util.user = util.getUserInfo),
(util.showLoading = function () {
wx.getStorageSync("isShowLoading") &&
(wx.hideLoading(), wx.setStorageSync("isShowLoading", !1)),
wx.showLoading({
title: "加载中",
complete: function () {
wx.setStorageSync("isShowLoading", !0);
},
fail: function () {
wx.setStorageSync("isShowLoading", !1);
},
});
}),
(util.showImage = function (e) {
var t = e ? e.currentTarget.dataset.preview : "";
if (!t) return !1;
wx.previewImage({ urls: [t] });
}),
(util.parseContent = function (e) {
if (!e) return e;
var t = e.match(
new RegExp(
[
"\ud83c[\udf00-\udfff]",
"\ud83d[\udc00-\ude4f]",
"\ud83d[\ude80-\udeff]",
].join("|"),
"g"
)
);
if (t)
for (var n in t)
e = e.replace(
t[n],
"[U+" + t[n].codePointAt(0).toString(16).toUpperCase() + "]"
);
return e;
}),
(util.date = function () {
(this.isLeapYear = function (e) {
return (
0 == e.getYear() % 4 &&
(e.getYear() % 100 != 0 || e.getYear() % 400 == 0)
);
}),
(this.dateToStr = function (e, t) {
(e = arguments[0] || "yyyy-MM-dd HH:mm:ss"),
(t = arguments[1] || new Date());
var n = e,
a = ["日", "一", "二", "三", "四", "五", "六"];
return (n = (n = (n = (n = (n = (n = (n = (n = (n = (n = (n = (n =
n.replace(/yyyy|YYYY/, t.getFullYear())).replace(
/yy|YY/,
t.getYear() % 100 > 9
? (t.getYear() % 100).toString()
: "0" + (t.getYear() % 100)
)).replace(
/MM/,
t.getMonth() > 9 ? t.getMonth() + 1 : "0" + (t.getMonth() + 1)
)).replace(/M/g, t.getMonth())).replace(
/w|W/g,
a[t.getDay()]
)).replace(
/dd|DD/,
t.getDate() > 9 ? t.getDate().toString() : "0" + t.getDate()
)).replace(/d|D/g, t.getDate())).replace(
/hh|HH/,
t.getHours() > 9 ? t.getHours().toString() : "0" + t.getHours()
)).replace(/h|H/g, t.getHours())).replace(
/mm/,
t.getMinutes() > 9
? t.getMinutes().toString()
: "0" + t.getMinutes()
)).replace(/m/g, t.getMinutes())).replace(
/ss|SS/,
t.getSeconds() > 9
? t.getSeconds().toString()
: "0" + t.getSeconds()
)).replace(/s|S/g, t.getSeconds());
}),
(this.dateAdd = function (e, t, n) {
switch (((n = arguments[2] || new Date()), e)) {
case "s":
return new Date(n.getTime() + 1e3 * t);
case "n":
return new Date(n.getTime() + 6e4 * t);
case "h":
return new Date(n.getTime() + 36e5 * t);
case "d":
return new Date(n.getTime() + 864e5 * t);
case "w":
return new Date(n.getTime() + 6048e5 * t);
case "m":
return new Date(
n.getFullYear(),
n.getMonth() + t,
n.getDate(),
n.getHours(),
n.getMinutes(),
n.getSeconds()
);
case "y":
return new Date(
n.getFullYear() + t,
n.getMonth(),
n.getDate(),
n.getHours(),
n.getMinutes(),
n.getSeconds()
);
}
}),
(this.dateDiff = function (e, t, n) {
switch (e) {
case "s":
return parseInt((n - t) / 1e3);
case "n":
return parseInt((n - t) / 6e4);
case "h":
return parseInt((n - t) / 36e5);
case "d":
return parseInt((n - t) / 864e5);
case "w":
return parseInt((n - t) / 6048e5);
case "m":
return (
n.getMonth() +
1 +
12 * (n.getFullYear() - t.getFullYear()) -
(t.getMonth() + 1)
);
case "y":
return n.getFullYear() - t.getFullYear();
}
}),
(this.strToDate = function (dateStr) {
var data = dateStr,
reCat = /(\d{1,4})/gm,
t = data.match(reCat);
return (
(t[1] = t[1] - 1), eval("var d = new Date(" + t.join(",") + ");"), d
);
}),
(this.strFormatToDate = function (e, t) {
var n = 0,
a = -1,
r = t.length;
(a = e.indexOf("yyyy")) > -1 && a < r && (n = t.substr(a, 4));
var i = 0;
(a = e.indexOf("MM")) > -1 &&
a < r &&
(i = parseInt(t.substr(a, 2)) - 1);
var o = 0;
(a = e.indexOf("dd")) > -1 && a < r && (o = parseInt(t.substr(a, 2)));
var s = 0;
((a = e.indexOf("HH")) > -1 || (a = e.indexOf("hh")) > 1) &&
a < r &&
(s = parseInt(t.substr(a, 2)));
var u = 0;
(a = e.indexOf("mm")) > -1 && a < r && (u = t.substr(a, 2));
var c = 0;
return (
(a = e.indexOf("ss")) > -1 && a < r && (c = t.substr(a, 2)),
new Date(n, i, o, s, u, c)
);
}),
(this.dateToLong = function (e) {
return e.getTime();
}),
(this.longToDate = function (e) {
return new Date(e);
}),
(this.isDate = function (e, t) {
null == t && (t = "yyyyMMdd");
var n = t.indexOf("yyyy");
if (-1 == n) return !1;
var a = e.substring(n, n + 4),
r = t.indexOf("MM");
if (-1 == r) return !1;
var i = e.substring(r, r + 2),
o = t.indexOf("dd");
if (-1 == o) return !1;
var s = e.substring(o, o + 2);
return !(
!isNumber(a) ||
a > "2100" ||
a < "1900" ||
!isNumber(i) ||
i > "12" ||
i < "01" ||
s > getMaxDay(a, i) ||
s < "01"
);
}),
(this.getMaxDay = function (e, t) {
return 4 == t || 6 == t || 9 == t || 11 == t
? "30"
: 2 == t
? (e % 4 == 0 && e % 100 != 0) || e % 400 == 0
? "29"
: "28"
: "31";
}),
(this.isNumber = function (e) {
return /^\d+$/g.test(e);
}),
(this.toArray = function (e) {
e = arguments[0] || new Date();
var t = Array();
return (
(t[0] = e.getFullYear()),
(t[1] = e.getMonth()),
(t[2] = e.getDate()),
(t[3] = e.getHours()),
(t[4] = e.getMinutes()),
(t[5] = e.getSeconds()),
t
);
}),
(this.datePart = function (e, t) {
t = arguments[1] || new Date();
var n = "",
a = ["日", "一", "二", "三", "四", "五", "六"];
switch (e) {
case "y":
n = t.getFullYear();
break;
case "M":
n = t.getMonth() + 1;
break;
case "d":
n = t.getDate();
break;
case "w":
n = a[t.getDay()];
break;
case "ww":
n = t.WeekNumOfYear();
break;
case "h":
n = t.getHours();
break;
case "m":
n = t.getMinutes();
break;
case "s":
n = t.getSeconds();
}
return n;
}),
(this.maxDayOfDate = function (e) {
(e = arguments[0] || new Date()).setDate(1),
e.setMonth(e.getMonth() + 1);
var t = e.getTime() - 864e5;
return new Date(t).getDate();
});
}),
(module.exports = util);
})();

View File

@@ -0,0 +1,37 @@
var e;
(e = getApp()),
(module.exports = {
backApp: function (e) {
if (e)
try {
wx.setStorageSync("we7_webview", e);
} catch (e) {
console.log(e);
}
var t = getCurrentPages();
if (t.length > 1)
for (var n in t)
"wn_storex/pages/view/index" === t[n].__route__ &&
wx.navigateBack({ data: t.length - n + 1 });
},
urlAddCode: function (t) {
var n = wx.getStorageSync("userInfo"),
a = function (e) {
var n = (function (e, t) {
e = e.replace(/(#\/)(.*)/, "");
var n = new RegExp("(^|&)" + t + "=([^&]*)(&|$)", "i"),
a = e.match(n);
return null !== a ? unescape(a[2]) : null;
})(t, "state");
t.indexOf("http") ||
n ||
(t = t.replace(
/index.php\?/,
"index.php?from=wxapp&state=we7sid-" + e.sessionid + "&"
));
var a = getCurrentPages();
a && (a = a[getCurrentPages().length - 1]), a.setData({ url: t });
};
n.sessionid ? a(n) : e.util.getUserInfo(a);
},
});