@ -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,53 @@
|
|||||||
|
{
|
||||||
|
"cloud": true,
|
||||||
|
"pages": [
|
||||||
|
"pages/index/index",
|
||||||
|
"pages/navigation/index/index",
|
||||||
|
"pages/navigation/index/show_clothes/show_clothes",
|
||||||
|
"pages/navigation/index/add/add",
|
||||||
|
"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",
|
||||||
|
"pages/navigation/index/add/camera/camera"
|
||||||
|
],
|
||||||
|
"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;
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"openapi": [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
// 云函数入口文件
|
||||||
|
const cloud = require('wx-server-sdk')
|
||||||
|
|
||||||
|
cloud.init() // 使用当前云环境
|
||||||
|
const db=cloud.database()
|
||||||
|
const MAX_LIMIT=100
|
||||||
|
// 云函数入口函数
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
const wxContext = cloud.getWXContext()
|
||||||
|
//先取出集合记录总数
|
||||||
|
const countResult=await db.collection('cloth').count()
|
||||||
|
const total=countResult.total
|
||||||
|
//计算分几次取
|
||||||
|
const batchTimes = Math.ceil(total / 100)
|
||||||
|
// 承载所有读操作的 promise 的数组
|
||||||
|
const tasks = []
|
||||||
|
for (let i = 0; i < batchTimes; i++) {
|
||||||
|
const promise = db.collection('cloth').skip(i * MAX_LIMIT).limit(MAX_LIMIT).get()
|
||||||
|
tasks.push(promise)
|
||||||
|
}
|
||||||
|
// 等待所有
|
||||||
|
return (await Promise.all(tasks)).reduce((acc, cur) => {
|
||||||
|
return {
|
||||||
|
event,
|
||||||
|
openid: wxContext.OPENID,
|
||||||
|
appid: wxContext.APPID,
|
||||||
|
unionid: wxContext.UNIONID,
|
||||||
|
data: acc.data.concat(cur.data),
|
||||||
|
errMsg: acc.errMsg,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "get",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"wx-server-sdk": "~2.6.3"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"openapi": [
|
||||||
|
"wxacode.get"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
const cloud = require('wx-server-sdk');
|
||||||
|
|
||||||
|
cloud.init({
|
||||||
|
env: cloud.DYNAMIC_CURRENT_ENV
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取小程序二维码云函数入口函数
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
// 获取小程序二维码的buffer
|
||||||
|
const resp = await cloud.openapi.wxacode.get({
|
||||||
|
path: 'pages/index/index'
|
||||||
|
});
|
||||||
|
const { buffer } = resp;
|
||||||
|
// 将图片上传云存储空间
|
||||||
|
const upload = await cloud.uploadFile({
|
||||||
|
cloudPath: 'code.png',
|
||||||
|
fileContent: buffer
|
||||||
|
});
|
||||||
|
return upload.fileID;
|
||||||
|
};
|
@ -0,0 +1,17 @@
|
|||||||
|
const cloud = require('wx-server-sdk');
|
||||||
|
|
||||||
|
cloud.init({
|
||||||
|
env: cloud.DYNAMIC_CURRENT_ENV
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取openId云函数入口函数
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
// 获取基础信息
|
||||||
|
const wxContext = cloud.getWXContext();
|
||||||
|
|
||||||
|
return {
|
||||||
|
openid: wxContext.OPENID,
|
||||||
|
appid: wxContext.APPID,
|
||||||
|
unionid: wxContext.UNIONID,
|
||||||
|
};
|
||||||
|
};
|
@ -0,0 +1,25 @@
|
|||||||
|
const getOpenId = require('./getOpenId/index');
|
||||||
|
const getMiniProgramCode = require('./getMiniProgramCode/index');
|
||||||
|
const createCollection = require('./createCollection/index');
|
||||||
|
const selectRecord = require('./selectRecord/index');
|
||||||
|
const updateRecord = require('./updateRecord/index');
|
||||||
|
const sumRecord = require('./sumRecord/index');
|
||||||
|
|
||||||
|
|
||||||
|
// 云函数入口函数
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
switch (event.type) {
|
||||||
|
case 'getOpenId':
|
||||||
|
return await getOpenId.main(event, context);
|
||||||
|
case 'getMiniProgramCode':
|
||||||
|
return await getMiniProgramCode.main(event, context);
|
||||||
|
case 'createCollection':
|
||||||
|
return await createCollection.main(event, context);
|
||||||
|
case 'selectRecord':
|
||||||
|
return await selectRecord.main(event, context);
|
||||||
|
case 'updateRecord':
|
||||||
|
return await updateRecord.main(event, context);
|
||||||
|
case 'sumRecord':
|
||||||
|
return await sumRecord.main(event, context);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "quickstartFunctions",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"wx-server-sdk": "~2.4.0"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
const cloud = require('wx-server-sdk');
|
||||||
|
|
||||||
|
cloud.init({
|
||||||
|
env: cloud.DYNAMIC_CURRENT_ENV
|
||||||
|
});
|
||||||
|
const db = cloud.database();
|
||||||
|
|
||||||
|
// 查询数据库集合云函数入口函数
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
// 返回数据库查询结果
|
||||||
|
return await db.collection('sales').get();
|
||||||
|
};
|
@ -0,0 +1,18 @@
|
|||||||
|
const cloud = require('wx-server-sdk');
|
||||||
|
|
||||||
|
cloud.init({
|
||||||
|
env: cloud.DYNAMIC_CURRENT_ENV
|
||||||
|
});
|
||||||
|
const db = cloud.database();
|
||||||
|
const $ = db.command.aggregate;
|
||||||
|
|
||||||
|
// 聚合记录云函数入口函数
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
// 返回数据库聚合结果
|
||||||
|
return db.collection('sales').aggregate()
|
||||||
|
.group({
|
||||||
|
_id: '$region',
|
||||||
|
sum: $.sum('$sales')
|
||||||
|
})
|
||||||
|
.end();
|
||||||
|
};
|
@ -0,0 +1,32 @@
|
|||||||
|
const cloud = require('wx-server-sdk');
|
||||||
|
|
||||||
|
cloud.init({
|
||||||
|
env: cloud.DYNAMIC_CURRENT_ENV
|
||||||
|
});
|
||||||
|
const db = cloud.database();
|
||||||
|
|
||||||
|
// 修改数据库信息云函数入口函数
|
||||||
|
exports.main = async (event, context) => {
|
||||||
|
try {
|
||||||
|
// 遍历修改数据库信息
|
||||||
|
for (let i = 0; i < event.data.length; i++) {
|
||||||
|
await db.collection('sales').where({
|
||||||
|
_id: event.data[i]._id
|
||||||
|
})
|
||||||
|
.update({
|
||||||
|
data: {
|
||||||
|
sales: event.data[i].sales
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
success: true,
|
||||||
|
data: event.data
|
||||||
|
};
|
||||||
|
} catch (e) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
errMsg: e
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
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: 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: 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: 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: 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}
|