@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Eslint config file
|
||||||
|
* Documentation: https://eslint.org/docs/user-guide/configuring/
|
||||||
|
* Install the Eslint extension before using this feature.
|
||||||
|
*/
|
||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
es6: true,
|
||||||
|
browser: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
ecmaFeatures: {
|
||||||
|
modules: true,
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 2018,
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
wx: true,
|
||||||
|
App: true,
|
||||||
|
Page: true,
|
||||||
|
getCurrentPages: true,
|
||||||
|
getApp: true,
|
||||||
|
Component: true,
|
||||||
|
requirePlugin: true,
|
||||||
|
requireMiniProgram: true,
|
||||||
|
},
|
||||||
|
// extends: 'eslint:recommended',
|
||||||
|
rules: {},
|
||||||
|
}
|
@ -0,0 +1,561 @@
|
|||||||
|
// app.js
|
||||||
|
App({
|
||||||
|
onLaunch:function(){
|
||||||
|
wx.cloud.init({
|
||||||
|
//env:"apeach-wtz62"
|
||||||
|
env:'cloud1-5ggzbo3kcd4ea4e2'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 全局变量
|
||||||
|
globalData: {
|
||||||
|
url: null
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
globalData:{
|
||||||
|
clothes:[{
|
||||||
|
name:"t-shirt1",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"t-shirt2",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"red",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"t-shirt3",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"orange",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"t-shirt4",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"t-shirt5",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"red",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"t-shirt6",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"purple",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"t-shirt7",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"green",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"t-shirt8",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"sports",
|
||||||
|
colour:"white",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"t-shirt9",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"sports",
|
||||||
|
colour:"black",
|
||||||
|
T:-4,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"t-shirt10",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"t-shirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"blue",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"hoodie1",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:2,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"spring"
|
||||||
|
},{
|
||||||
|
name:"hoodie2",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"brown",
|
||||||
|
T:5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"hoodie3",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"hoodie4",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:3,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"hoodie5",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"sports",
|
||||||
|
colour:"yellow",
|
||||||
|
T:3,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"spring"
|
||||||
|
},{
|
||||||
|
name:"hoodie6",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:4,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"spring"
|
||||||
|
},{
|
||||||
|
name:"hoodie7",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:3,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"hoodie8",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"sports",
|
||||||
|
colour:"white",
|
||||||
|
T:3,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"hoodie9",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"sports",
|
||||||
|
colour:"pink",
|
||||||
|
T:5,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"hoodie10",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"hoodie",
|
||||||
|
style:"sports",
|
||||||
|
colour:"green",
|
||||||
|
T:4,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"spring"
|
||||||
|
},{
|
||||||
|
name:"skirt1",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"blue",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"skirt2",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"business",
|
||||||
|
colour:"brown",
|
||||||
|
T:3,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"skirt3",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"sport",
|
||||||
|
colour:"white",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"skirt4",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"brown",
|
||||||
|
T:2,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"skirt5",
|
||||||
|
pattern:"all",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"red",
|
||||||
|
T:-10,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"skirt6",
|
||||||
|
pattern:"all",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"business",
|
||||||
|
colour:"white",
|
||||||
|
T:-10,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"skirt7",
|
||||||
|
pattern:"all",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:5,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"skirt8",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"business",
|
||||||
|
colour:"black",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"skirt9",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"pink",
|
||||||
|
T:1,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"spring"
|
||||||
|
},{
|
||||||
|
name:"skirt10",
|
||||||
|
pattern:"all",
|
||||||
|
kind:"skirt",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:-10,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"coat1",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:5,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"coat2",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:4,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"coat3",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"business",
|
||||||
|
colour:"white",
|
||||||
|
T:2,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"spring"
|
||||||
|
},{
|
||||||
|
name:"coat4",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"business",
|
||||||
|
colour:"red",
|
||||||
|
T:5,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"coat5",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:1,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"coat6",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:9,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"coat7",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"sports",
|
||||||
|
colour:"black",
|
||||||
|
T:3,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"spring"
|
||||||
|
},{
|
||||||
|
name:"coat8",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"pink",
|
||||||
|
T:5,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"coat9",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:10,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"coat10",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"coat",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"khaki",
|
||||||
|
T:3,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"sweater1",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:3,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"sweater2",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:4,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"sweater3",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"blue",
|
||||||
|
T:4,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"sweater4",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"blue",
|
||||||
|
T:4,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"sweater5",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"gray",
|
||||||
|
T:3,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"sweater6",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"yellow",
|
||||||
|
T:3,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"sweater7",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"yellow",
|
||||||
|
T:4,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"sweater8",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"brown",
|
||||||
|
T:3,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"sweater9",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"white",
|
||||||
|
T:4,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"sweater10",
|
||||||
|
pattern:"up",
|
||||||
|
kind:"sweater",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"yellow",
|
||||||
|
T:3,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"pants1",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"long",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:1,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"spring"
|
||||||
|
},{
|
||||||
|
name:"pants2",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"long",
|
||||||
|
style:"sports",
|
||||||
|
colour:"white",
|
||||||
|
T:3,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"pants3",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"long",
|
||||||
|
style:"sports",
|
||||||
|
colour:"purple",
|
||||||
|
T:1,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"pants4",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"long",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"blue",
|
||||||
|
T:5,
|
||||||
|
thickness:"thick",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"pants5",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"long",
|
||||||
|
style:"business",
|
||||||
|
colour:"gray",
|
||||||
|
T:3,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"autumn"
|
||||||
|
},{
|
||||||
|
name:"pants6",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"short",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:3,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"pants7",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"short",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:3,
|
||||||
|
thickness:"proper",
|
||||||
|
season:"winter"
|
||||||
|
},{
|
||||||
|
name:"pants8",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"short",
|
||||||
|
style:"sports",
|
||||||
|
colour:"white",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"pants9",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"short",
|
||||||
|
style:"leisure",
|
||||||
|
colour:"black",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
},{
|
||||||
|
name:"pants10",
|
||||||
|
pattern:"down",
|
||||||
|
kind:"short",
|
||||||
|
style:"business",
|
||||||
|
colour:"brown",
|
||||||
|
T:-5,
|
||||||
|
thickness:"thin",
|
||||||
|
season:"summer"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
})
|
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
"pages/index/index",
|
||||||
|
"pages/navigation/index/index",
|
||||||
|
"pages/navigation/index/show_clothes/show_clothes",
|
||||||
|
"pages/navigation/index/add/add",
|
||||||
|
"pages/navigation/index/add/camera/camera",
|
||||||
|
"pages/navigation/index/delete/delete",
|
||||||
|
"pages/navigation/self/self",
|
||||||
|
"pages/navigation/userinform/userinform",
|
||||||
|
"pages/navigation/safety/safety",
|
||||||
|
"pages/navigation/shezhi/shezhi",
|
||||||
|
"pages/navigation/index/recommand/recommand"
|
||||||
|
|
||||||
|
],
|
||||||
|
"window": {
|
||||||
|
"backgroundTextStyle": "light",
|
||||||
|
"navigationBarBackgroundColor": "#fff",
|
||||||
|
"navigationBarTitleText": "Weixin",
|
||||||
|
"navigationBarTextStyle": "black"
|
||||||
|
},
|
||||||
|
"usingComponents": {
|
||||||
|
"van-button": "pages/miniprogram_npm/@vant/weapp/button/index",
|
||||||
|
"van-tabbar": "pages/miniprogram_npm/@vant/weapp/tabbar/index",
|
||||||
|
"van-tabbar-item": "pages/miniprogram_npm/@vant/weapp/tabbar-item/index",
|
||||||
|
"van-image": "pages/miniprogram_npm/@vant/weapp/image/index",
|
||||||
|
"van-icon": "pages/miniprogram_npm/@vant/weapp/icon/index",
|
||||||
|
"van-divider": "pages/miniprogram_npm/@vant/weapp/divider/index",
|
||||||
|
"van-rate": "pages/miniprogram_npm/@vant/weapp/rate/index",
|
||||||
|
"van-field": "pages/miniprogram_npm/@vant/weapp/field/index",
|
||||||
|
"van-toast": "pages/miniprogram_npm/@vant/weapp/toast/index"
|
||||||
|
},
|
||||||
|
"sitemapLocation": "sitemap.json",
|
||||||
|
"tabBar": {
|
||||||
|
"selectedColor": "#5001",
|
||||||
|
"backgroundColor": "white",
|
||||||
|
"borderStyle": "white",
|
||||||
|
"list": [
|
||||||
|
{
|
||||||
|
"text": "首页",
|
||||||
|
"pagePath": "pages/navigation/index/index",
|
||||||
|
"iconPath": "pages/img/首页.png",
|
||||||
|
"selectedIconPath": "pages/img/首页.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "我的",
|
||||||
|
"pagePath": "pages/navigation/self/self",
|
||||||
|
"iconPath": "pages/img/我的.png",
|
||||||
|
"selectedIconPath": "pages/img/我的.png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
/**app.wxss**/
|
||||||
|
.container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 200rpx 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
After Width: | Height: | Size: 533 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 172 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 252 KiB |
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 170 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 158 KiB |
After Width: | Height: | Size: 171 KiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 193 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 180 KiB |
After Width: | Height: | Size: 125 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 115 KiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 834 KiB |
After Width: | Height: | Size: 940 KiB |
After Width: | Height: | Size: 2.4 MiB |
After Width: | Height: | Size: 693 KiB |
After Width: | Height: | Size: 389 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 357 KiB |
After Width: | Height: | Size: 382 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 596 KiB |
After Width: | Height: | Size: 273 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 441 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 967 B |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 963 B |
After Width: | Height: | Size: 806 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 1.7 MiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 8.1 KiB |
@ -0,0 +1,327 @@
|
|||||||
|
// pages/index/index.js
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
ip:'82.157.11.188' ,
|
||||||
|
port:8080,
|
||||||
|
password:'',
|
||||||
|
islogin:1,
|
||||||
|
inputipone:'',//登录注册时时输入的手机号
|
||||||
|
compassiphone:'',//找回密码时输入的手机号
|
||||||
|
loginbtnstate:true,
|
||||||
|
strloginUser:'',//登录用户名
|
||||||
|
strloginpassword:'',//用户密码
|
||||||
|
switchChecked:'',//选中按钮
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
var _this = this;
|
||||||
|
_this.setData({
|
||||||
|
strloginUser: wx.getStorageSync("iphone"),
|
||||||
|
strloginpassword: wx.getStorageSync("password"),
|
||||||
|
switchChecked:wx.getStorageSync('checkedValue'),
|
||||||
|
loginbtnstate:wx.getStorageSync('wxlogin'),
|
||||||
|
})
|
||||||
|
console.log(_this.data.strloginUser+_this.data.strloginpassword+_this.data.switchChecked)
|
||||||
|
},
|
||||||
|
//判断是否要记住密码
|
||||||
|
bindswitchchange: function (event) {
|
||||||
|
//得到值
|
||||||
|
var checkedValue = event.detail.value;
|
||||||
|
console.log("开关状态"+checkedValue);
|
||||||
|
var _this = this;
|
||||||
|
if (checkedValue == true){
|
||||||
|
_this.setData({
|
||||||
|
switchChecked:true,
|
||||||
|
})
|
||||||
|
// wx.setStorageSync("iphone",_this.data.strloginUser);
|
||||||
|
// wx.setStorageSync("password",_this.data.strloginpassword);
|
||||||
|
//wx.setStorageSync("checkedValue", _this.data.switchChecked);
|
||||||
|
|
||||||
|
console.log(checkedValue);
|
||||||
|
} else if (checkedValue == false) {
|
||||||
|
_this.setData({
|
||||||
|
switchChecked: false
|
||||||
|
})
|
||||||
|
// wx.setStorageSync("iphone","");
|
||||||
|
// wx.setStorageSync("password","");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//输入密码(登录界面判断有无)
|
||||||
|
password1:function(event){
|
||||||
|
var that = this
|
||||||
|
var m=event.detail.value
|
||||||
|
console.log(event.detail.value)
|
||||||
|
|
||||||
|
if(m!=''){
|
||||||
|
this.setData({
|
||||||
|
strloginpassword:m
|
||||||
|
})
|
||||||
|
if(this.data.strloginUser!=''&&(this.data.strloginUser.length==11))
|
||||||
|
{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:true,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:true,
|
||||||
|
password:''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//输入手机号(登录界面判断有无)
|
||||||
|
inputiphone1:function(event){
|
||||||
|
console.log(event.detail.value)
|
||||||
|
var m=event.detail.value
|
||||||
|
|
||||||
|
if(m!=''&&(m.length==11)){
|
||||||
|
this.setData({
|
||||||
|
strloginUser:m
|
||||||
|
})
|
||||||
|
if(this.data.strloginpassword!='')
|
||||||
|
{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:true,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//输入密码(注册界面判断有无)
|
||||||
|
password2:function(event){
|
||||||
|
console.log(event.detail.value)
|
||||||
|
var m=event.detail.value
|
||||||
|
if(m!=''){
|
||||||
|
this.setData({
|
||||||
|
password:m
|
||||||
|
})
|
||||||
|
if(this.data.inputipone!=''&&(this.data.inputipone.length==11))
|
||||||
|
{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:true,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:true,
|
||||||
|
password:''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//输入手机号(注册界面判断有无)
|
||||||
|
inputiphone2:function(event){
|
||||||
|
console.log(event.detail.value)
|
||||||
|
var m=event.detail.value
|
||||||
|
if(m!=''&&(m.length==11)){
|
||||||
|
this.setData({
|
||||||
|
inputipone:m
|
||||||
|
})
|
||||||
|
if(this.data.password!='')
|
||||||
|
{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:true,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:true,
|
||||||
|
inputipone:''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//找回密码输入框
|
||||||
|
compass:function(event){
|
||||||
|
console.log("找回密码"+event.detail.value)
|
||||||
|
var m=event.detail.value
|
||||||
|
if(m!=''&&(m.length==11)){
|
||||||
|
this.setData({
|
||||||
|
compassiphone:m,
|
||||||
|
loginbtnstate:false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.setData({
|
||||||
|
loginbtnstate:true,
|
||||||
|
inputipone:''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//登录
|
||||||
|
onlogin:function(e){
|
||||||
|
var that=this
|
||||||
|
//记住密码
|
||||||
|
var checkedValue = that.data.switchChecked;
|
||||||
|
console.log(checkedValue);
|
||||||
|
//如果记住密码则向微信缓存写入账号密码
|
||||||
|
//如果不记住密码则清空微信缓存存在的账号密码
|
||||||
|
if (checkedValue == true) {
|
||||||
|
wx.setStorageSync("iphone",that.data.strloginUser);
|
||||||
|
wx.setStorageSync("password",that.data.strloginpassword);
|
||||||
|
wx.setStorageSync("checkedValue", that.data.switchChecked);
|
||||||
|
wx.setStorageSync("wxlogin", false);
|
||||||
|
console.log(that.data.loginbtnstate)
|
||||||
|
} else if (checkedValue == false) {
|
||||||
|
wx.setStorageSync("iphone","");
|
||||||
|
wx.setStorageSync("password","");
|
||||||
|
wx.setStorageSync("checkedValue", false);
|
||||||
|
wx.setStorageSync("wxlogin", true);
|
||||||
|
}
|
||||||
|
//开始检查用户名和密码是否一致
|
||||||
|
var userinfos=wx.getStorageSync('userjobs') ||[];//找数组
|
||||||
|
if(userinfos.iphone==that.data.strloginUser){
|
||||||
|
if(userinfos.password==that.data.strloginpassword)
|
||||||
|
{
|
||||||
|
|
||||||
|
wx.showToast({
|
||||||
|
title: '登录成功',
|
||||||
|
duration:2000,
|
||||||
|
}),
|
||||||
|
wx.switchTab({
|
||||||
|
url: '../navigation/index/index'
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
wx.showToast({
|
||||||
|
title: '密码错误',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
wx.showToast({
|
||||||
|
title: '用户名不存在',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//注册
|
||||||
|
formsubmit:function(e){
|
||||||
|
var that=this
|
||||||
|
console.log(e.detail.value)
|
||||||
|
var obj={}
|
||||||
|
obj.password=e.detail.value.inputpassword,
|
||||||
|
obj.iphone=e.detail.value.iphone,
|
||||||
|
console.log(obj)
|
||||||
|
//存入多个注册用户
|
||||||
|
//初始化云
|
||||||
|
wx.cloud.init({
|
||||||
|
env:'cloud1-5ggzbo3kcd4ea4e2'
|
||||||
|
});
|
||||||
|
//初始化数据库
|
||||||
|
const db=wx.cloud.database();
|
||||||
|
db.collection('user').add({
|
||||||
|
data: {
|
||||||
|
iphone:obj.iphone,
|
||||||
|
password:obj.password,
|
||||||
|
|
||||||
|
},
|
||||||
|
sucess:function(res){
|
||||||
|
console.log("添加成功",res);
|
||||||
|
},
|
||||||
|
fail:function(res){
|
||||||
|
console.log(res.errMsg,"添加失败")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//var arr=wx.getStorageSync('userjobs') ||[];
|
||||||
|
//arr.push(obj);
|
||||||
|
wx.setStorageSync('userjobs', obj);
|
||||||
|
wx.showToast({
|
||||||
|
title: '注册成功',
|
||||||
|
duration:1000,
|
||||||
|
success:function(){
|
||||||
|
that.setData({
|
||||||
|
islogin:1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//找回密码
|
||||||
|
comebackpassword:function(e){
|
||||||
|
var that =this
|
||||||
|
let wsy=wx.getStorageSync('userjobs') || [];//找数组
|
||||||
|
console.log("输入的手机号"+that.data.compassiphone)
|
||||||
|
console.log("本地缓存的手机号"+wsy.iphone)
|
||||||
|
if(wsy.iphone==that.data.compassiphone)
|
||||||
|
{
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: wsy.password,
|
||||||
|
success (res) {
|
||||||
|
wx.getClipboardData({
|
||||||
|
success (res) {
|
||||||
|
console.log(res.data) // data
|
||||||
|
that.setData({
|
||||||
|
islogin:1
|
||||||
|
})
|
||||||
|
wx.showToast({
|
||||||
|
title: '密码已复制',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wx.showToast({
|
||||||
|
title: '该手机号码未注册',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//转到注册
|
||||||
|
register:function(event){
|
||||||
|
var that = this
|
||||||
|
that.setData({
|
||||||
|
islogin:3
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//转到登录
|
||||||
|
denglu:function(event){
|
||||||
|
var that = this
|
||||||
|
that.setData({
|
||||||
|
islogin:1
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//转到忘记密码
|
||||||
|
forget:function(event){
|
||||||
|
this.setData({
|
||||||
|
islogin:2
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {},
|
||||||
|
"navigationBarTitleText":""
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
<!--pages/index/index.wxml
|
||||||
|
|
||||||
|
|
||||||
|
-->
|
||||||
|
<view class="wrapper">
|
||||||
|
<!-- 第一部分 -->
|
||||||
|
<view wx:if="{{islogin==1}}">
|
||||||
|
<image class="photo1" src="../img/登陆.jpg"></image>
|
||||||
|
<view class="header">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 找回密码 -->
|
||||||
|
<view wx:elif="{{islogin==2}}">
|
||||||
|
<view class="header">
|
||||||
|
<view class="title">找回密码</view>
|
||||||
|
<view class="info">Retrieve the password</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 请注册 -->
|
||||||
|
<view wx:else="{{islogin==3}}">
|
||||||
|
<view class="header">
|
||||||
|
<view class="title">请注册</view>
|
||||||
|
<view class="info">Please Register Your Account</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 第二部分 -->
|
||||||
|
<view class="body">
|
||||||
|
<!-- 登录页面 -->
|
||||||
|
<view wx:if="{{islogin==1}}">
|
||||||
|
<view class="input1">
|
||||||
|
<input class="one" type="number" bindinput="inputiphone1" maxlength="11" placeholder="请输入手机号" value="{{strloginUser}}"/>
|
||||||
|
<input class="one" password="true" bindinput="password1" placeholder="请输入密码" value="{{strloginpassword}}"/>
|
||||||
|
</view>
|
||||||
|
<view class="remenber"> <switch type="checkbox" checked="{{switchChecked}}" bindswitcheck="switchChecked" bindchange="bindswitchchange" style="transform:scale(0.8)"/>记住密码</view>
|
||||||
|
<button class="two" color="#3d7ef9" type="primary" bindtap="onlogin" disabled="{{loginbtnstate}}">登录</button>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<!-- 找回密码 -->
|
||||||
|
<view wx:elif="{{islogin==2}}">
|
||||||
|
<view class="input1">
|
||||||
|
<input class="one" type="number" bindinput="compass" maxlength="11" placeholder="请输入手机号" />
|
||||||
|
</view>
|
||||||
|
<button class="two" color="#3d7ef9" type="primary" bindtap="comebackpassword" disabled="{{loginbtnstate}}">找回密码</button>
|
||||||
|
</view>
|
||||||
|
<!-- 注册页面 -->
|
||||||
|
<view wx:else="{{islogin==3}}">
|
||||||
|
<form bindsubmit="formsubmit">
|
||||||
|
<view class="input1">
|
||||||
|
<input class="one" type="number" bindinput="inputiphone2" maxlength="11" placeholder="请输入手机号" name="iphone" />
|
||||||
|
<input class="one" password="true" bindinput="password2" placeholder="请输入密码" name="inputpassword" />
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<button class="two" color="#3d7ef9" type="primary" form-type="submit" disabled="{{loginbtnstate}}">注册</button>
|
||||||
|
</form>
|
||||||
|
</view>
|
||||||
|
<!-- 第三部分 -->
|
||||||
|
<!-- 登录 -->
|
||||||
|
<view wx:if="{{islogin==1}}">
|
||||||
|
<view class="end">
|
||||||
|
<text bindtap="register">注册账户</text>
|
||||||
|
<text>|</text>
|
||||||
|
<text bindtap="forget">忘记密码</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 找回密码 -->
|
||||||
|
<view wx:elif="{{islogin==2}}">
|
||||||
|
<view class="end">
|
||||||
|
<text bindtap="denglu">登录页面</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 注册 -->
|
||||||
|
<view wx:else="{{islogin==3}}">
|
||||||
|
<view class="end">
|
||||||
|
<text bindtap="denglu">登录页面</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="end-power">
|
||||||
|
<view class="power">
|
||||||
|
<text>Power By WSY</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
@ -0,0 +1,67 @@
|
|||||||
|
/* pages/index/index.wxss */
|
||||||
|
.photo1{
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: -999;
|
||||||
|
}
|
||||||
|
.header{
|
||||||
|
height: 200rpx;
|
||||||
|
padding:40rpx 30rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
font-size: 52rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
.header .info{
|
||||||
|
font-size:28rpx ;
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
.body{
|
||||||
|
padding: 40rpx;
|
||||||
|
padding-top: 230rpx;
|
||||||
|
}
|
||||||
|
.input{
|
||||||
|
margin-top: 20rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
.one{
|
||||||
|
height: 100rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
box-shadow: #77778a 0 0 5rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
}
|
||||||
|
.two{
|
||||||
|
border: solid 1rpx #73ccd8;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #73ccd8;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
}
|
||||||
|
.end{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
color: #9f9f9f;
|
||||||
|
}
|
||||||
|
.end text{
|
||||||
|
margin-left:30rpx;
|
||||||
|
}
|
||||||
|
.end-power{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.power{
|
||||||
|
color: #d6d6d6;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 50rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
.remenber{
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var component_1 = require("../common/component");
|
||||||
|
var button_1 = require("../mixins/button");
|
||||||
|
(0, component_1.VantComponent)({
|
||||||
|
mixins: [button_1.button],
|
||||||
|
props: {
|
||||||
|
show: Boolean,
|
||||||
|
title: String,
|
||||||
|
cancelText: String,
|
||||||
|
description: String,
|
||||||
|
round: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
zIndex: {
|
||||||
|
type: Number,
|
||||||
|
value: 100,
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
type: Array,
|
||||||
|
value: [],
|
||||||
|
},
|
||||||
|
overlay: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
closeOnClickOverlay: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
closeOnClickAction: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
safeAreaInsetBottom: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onSelect: function (event) {
|
||||||
|
var _this = this;
|
||||||
|
var index = event.currentTarget.dataset.index;
|
||||||
|
var _a = this.data, actions = _a.actions, closeOnClickAction = _a.closeOnClickAction, canIUseGetUserProfile = _a.canIUseGetUserProfile;
|
||||||
|
var item = actions[index];
|
||||||
|
if (item) {
|
||||||
|
this.$emit('select', item);
|
||||||
|
if (closeOnClickAction) {
|
||||||
|
this.onClose();
|
||||||
|
}
|
||||||
|
if (item.openType === 'getUserInfo' && canIUseGetUserProfile) {
|
||||||
|
wx.getUserProfile({
|
||||||
|
desc: item.getUserProfileDesc || ' ',
|
||||||
|
complete: function (userProfile) {
|
||||||
|
_this.$emit('getuserinfo', userProfile);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onCancel: function () {
|
||||||
|
this.$emit('cancel');
|
||||||
|
},
|
||||||
|
onClose: function () {
|
||||||
|
this.$emit('close');
|
||||||
|
},
|
||||||
|
onClickOverlay: function () {
|
||||||
|
this.$emit('click-overlay');
|
||||||
|
this.onClose();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {
|
||||||
|
"van-icon": "../icon/index",
|
||||||
|
"van-popup": "../popup/index",
|
||||||
|
"van-loading": "../loading/index"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
@import '../common/index.wxss';.van-action-sheet{color:var(--action-sheet-item-text-color,#323233);max-height:var(--action-sheet-max-height,90%)!important}.van-action-sheet__cancel,.van-action-sheet__item{background-color:var(--action-sheet-item-background,#fff);font-size:var(--action-sheet-item-font-size,16px);line-height:var(--action-sheet-item-line-height,22px);padding:14px 16px;text-align:center}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{background-color:var(--action-sheet-cancel-padding-color,#f7f8fa);display:block;height:var(--action-sheet-cancel-padding-top,8px)}.van-action-sheet__item--disabled{color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{color:var(--action-sheet-subname-color,#969799);font-size:var(--action-sheet-subname-font-size,12px);line-height:var(--action-sheet-subname-line-height,20px);margin-top:var(--padding-xs,8px)}.van-action-sheet__header{font-size:var(--action-sheet-header-font-size,16px);font-weight:var(--font-weight-bold,500);line-height:var(--action-sheet-header-height,48px);text-align:center}.van-action-sheet__description{color:var(--action-sheet-description-color,#969799);font-size:var(--action-sheet-description-font-size,14px);line-height:var(--action-sheet-description-line-height,20px);padding:20px var(--padding-md,16px);text-align:center}.van-action-sheet__close{color:var(--action-sheet-close-icon-color,#c8c9cc);font-size:var(--action-sheet-close-icon-size,22px)!important;line-height:inherit!important;padding:var(--action-sheet-close-icon-padding,0 16px);position:absolute!important;right:0;top:0}.van-action-sheet__loading{display:flex!important}
|
@ -0,0 +1,232 @@
|
|||||||
|
"use strict";
|
||||||
|
var __assign = (this && this.__assign) || function () {
|
||||||
|
__assign = Object.assign || function(t) {
|
||||||
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||||
|
s = arguments[i];
|
||||||
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||||
|
t[p] = s[p];
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
return __assign.apply(this, arguments);
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var component_1 = require("../common/component");
|
||||||
|
var shared_1 = require("../picker/shared");
|
||||||
|
var utils_1 = require("../common/utils");
|
||||||
|
var EMPTY_CODE = '000000';
|
||||||
|
(0, component_1.VantComponent)({
|
||||||
|
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||||
|
props: __assign(__assign({}, shared_1.pickerProps), { value: {
|
||||||
|
type: String,
|
||||||
|
observer: function (value) {
|
||||||
|
this.code = value;
|
||||||
|
this.setValues();
|
||||||
|
},
|
||||||
|
}, areaList: {
|
||||||
|
type: Object,
|
||||||
|
value: {},
|
||||||
|
observer: 'setValues',
|
||||||
|
}, columnsNum: {
|
||||||
|
type: null,
|
||||||
|
value: 3,
|
||||||
|
}, columnsPlaceholder: {
|
||||||
|
type: Array,
|
||||||
|
observer: function (val) {
|
||||||
|
this.setData({
|
||||||
|
typeToColumnsPlaceholder: {
|
||||||
|
province: val[0] || '',
|
||||||
|
city: val[1] || '',
|
||||||
|
county: val[2] || '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
} }),
|
||||||
|
data: {
|
||||||
|
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||||
|
typeToColumnsPlaceholder: {},
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
|
var _this = this;
|
||||||
|
(0, utils_1.requestAnimationFrame)(function () {
|
||||||
|
_this.setValues();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getPicker: function () {
|
||||||
|
if (this.picker == null) {
|
||||||
|
this.picker = this.selectComponent('.van-area__picker');
|
||||||
|
}
|
||||||
|
return this.picker;
|
||||||
|
},
|
||||||
|
onCancel: function (event) {
|
||||||
|
this.emit('cancel', event.detail);
|
||||||
|
},
|
||||||
|
onConfirm: function (event) {
|
||||||
|
var index = event.detail.index;
|
||||||
|
var value = event.detail.value;
|
||||||
|
value = this.parseValues(value);
|
||||||
|
this.emit('confirm', { value: value, index: index });
|
||||||
|
},
|
||||||
|
emit: function (type, detail) {
|
||||||
|
detail.values = detail.value;
|
||||||
|
delete detail.value;
|
||||||
|
this.$emit(type, detail);
|
||||||
|
},
|
||||||
|
parseValues: function (values) {
|
||||||
|
var columnsPlaceholder = this.data.columnsPlaceholder;
|
||||||
|
return values.map(function (value, index) {
|
||||||
|
if (value &&
|
||||||
|
(!value.code || value.name === columnsPlaceholder[index])) {
|
||||||
|
return __assign(__assign({}, value), { code: '', name: '' });
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onChange: function (event) {
|
||||||
|
var _this = this;
|
||||||
|
var _a;
|
||||||
|
var _b = event.detail, index = _b.index, picker = _b.picker, value = _b.value;
|
||||||
|
this.code = value[index].code;
|
||||||
|
(_a = this.setValues()) === null || _a === void 0 ? void 0 : _a.then(function () {
|
||||||
|
_this.$emit('change', {
|
||||||
|
picker: picker,
|
||||||
|
values: _this.parseValues(picker.getValues()),
|
||||||
|
index: index,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getConfig: function (type) {
|
||||||
|
var areaList = this.data.areaList;
|
||||||
|
return (areaList && areaList[type + "_list"]) || {};
|
||||||
|
},
|
||||||
|
getList: function (type, code) {
|
||||||
|
if (type !== 'province' && !code) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
var typeToColumnsPlaceholder = this.data.typeToColumnsPlaceholder;
|
||||||
|
var list = this.getConfig(type);
|
||||||
|
var result = Object.keys(list).map(function (code) { return ({
|
||||||
|
code: code,
|
||||||
|
name: list[code],
|
||||||
|
}); });
|
||||||
|
if (code != null) {
|
||||||
|
// oversea code
|
||||||
|
if (code[0] === '9' && type === 'city') {
|
||||||
|
code = '9';
|
||||||
|
}
|
||||||
|
result = result.filter(function (item) { return item.code.indexOf(code) === 0; });
|
||||||
|
}
|
||||||
|
if (typeToColumnsPlaceholder[type] && result.length) {
|
||||||
|
// set columns placeholder
|
||||||
|
var codeFill = type === 'province'
|
||||||
|
? ''
|
||||||
|
: type === 'city'
|
||||||
|
? EMPTY_CODE.slice(2, 4)
|
||||||
|
: EMPTY_CODE.slice(4, 6);
|
||||||
|
result.unshift({
|
||||||
|
code: "" + code + codeFill,
|
||||||
|
name: typeToColumnsPlaceholder[type],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
getIndex: function (type, code) {
|
||||||
|
var compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
|
||||||
|
var list = this.getList(type, code.slice(0, compareNum - 2));
|
||||||
|
// oversea code
|
||||||
|
if (code[0] === '9' && type === 'province') {
|
||||||
|
compareNum = 1;
|
||||||
|
}
|
||||||
|
code = code.slice(0, compareNum);
|
||||||
|
for (var i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].code.slice(0, compareNum) === code) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
setValues: function () {
|
||||||
|
var picker = this.getPicker();
|
||||||
|
if (!picker) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var code = this.code || this.getDefaultCode();
|
||||||
|
var provinceList = this.getList('province');
|
||||||
|
var cityList = this.getList('city', code.slice(0, 2));
|
||||||
|
var stack = [];
|
||||||
|
var indexes = [];
|
||||||
|
var columnsNum = this.data.columnsNum;
|
||||||
|
if (columnsNum >= 1) {
|
||||||
|
stack.push(picker.setColumnValues(0, provinceList, false));
|
||||||
|
indexes.push(this.getIndex('province', code));
|
||||||
|
}
|
||||||
|
if (columnsNum >= 2) {
|
||||||
|
stack.push(picker.setColumnValues(1, cityList, false));
|
||||||
|
indexes.push(this.getIndex('city', code));
|
||||||
|
if (cityList.length && code.slice(2, 4) === '00') {
|
||||||
|
code = cityList[0].code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (columnsNum === 3) {
|
||||||
|
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
|
||||||
|
indexes.push(this.getIndex('county', code));
|
||||||
|
}
|
||||||
|
return Promise.all(stack)
|
||||||
|
.catch(function () { })
|
||||||
|
.then(function () { return picker.setIndexes(indexes); })
|
||||||
|
.catch(function () { });
|
||||||
|
},
|
||||||
|
getDefaultCode: function () {
|
||||||
|
var columnsPlaceholder = this.data.columnsPlaceholder;
|
||||||
|
if (columnsPlaceholder.length) {
|
||||||
|
return EMPTY_CODE;
|
||||||
|
}
|
||||||
|
var countyCodes = Object.keys(this.getConfig('county'));
|
||||||
|
if (countyCodes[0]) {
|
||||||
|
return countyCodes[0];
|
||||||
|
}
|
||||||
|
var cityCodes = Object.keys(this.getConfig('city'));
|
||||||
|
if (cityCodes[0]) {
|
||||||
|
return cityCodes[0];
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
getValues: function () {
|
||||||
|
var picker = this.getPicker();
|
||||||
|
if (!picker) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return this.parseValues(picker.getValues().filter(function (value) { return !!value; }));
|
||||||
|
},
|
||||||
|
getDetail: function () {
|
||||||
|
var values = this.getValues();
|
||||||
|
var area = {
|
||||||
|
code: '',
|
||||||
|
country: '',
|
||||||
|
province: '',
|
||||||
|
city: '',
|
||||||
|
county: '',
|
||||||
|
};
|
||||||
|
if (!values.length) {
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
var names = values.map(function (item) { return item.name; });
|
||||||
|
area.code = values[values.length - 1].code;
|
||||||
|
if (area.code[0] === '9') {
|
||||||
|
area.country = names[1] || '';
|
||||||
|
area.province = names[2] || '';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
area.province = names[0] || '';
|
||||||
|
area.city = names[1] || '';
|
||||||
|
area.county = names[2] || '';
|
||||||
|
}
|
||||||
|
return area;
|
||||||
|
},
|
||||||
|
reset: function (code) {
|
||||||
|
this.code = code || '';
|
||||||
|
return this.setValues();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {
|
||||||
|
"van-picker": "../picker/index"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<wxs src="./index.wxs" module="computed" />
|
||||||
|
|
||||||
|
<van-picker
|
||||||
|
class="van-area__picker"
|
||||||
|
active-class="active-class"
|
||||||
|
toolbar-class="toolbar-class"
|
||||||
|
column-class="column-class"
|
||||||
|
show-toolbar
|
||||||
|
value-key="name"
|
||||||
|
title="{{ title }}"
|
||||||
|
loading="{{ loading }}"
|
||||||
|
columns="{{ computed.displayColumns(columns, columnsNum) }}"
|
||||||
|
item-height="{{ itemHeight }}"
|
||||||
|
visible-item-count="{{ visibleItemCount }}"
|
||||||
|
cancel-button-text="{{ cancelButtonText }}"
|
||||||
|
confirm-button-text="{{ confirmButtonText }}"
|
||||||
|
bind:change="onChange"
|
||||||
|
bind:confirm="onConfirm"
|
||||||
|
bind:cancel="onCancel"
|
||||||
|
/>
|