|
@@ -1,75 +0,0 @@
|
|
|
-const app = require('../../utils/util.js');
|
|
|
-var util = require('../../utils/md5.js')
|
|
|
-Page({
|
|
|
- data: {
|
|
|
- defaultType1: true,
|
|
|
- passwordType1: true
|
|
|
- },
|
|
|
- eyeStatus1() {
|
|
|
- if (this.data.defaultType1) {
|
|
|
- this.setData({
|
|
|
- passwordType1: false,
|
|
|
- defaultType1: false,
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- passwordType1: true,
|
|
|
- defaultType1: true,
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- formSubmit(e) {
|
|
|
- console.log(e.detail, "daying");
|
|
|
- var password = e.detail.value.pwd;
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/applet/bing',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- name: e.detail.value.name,
|
|
|
- pwd: util.hexMD5(password),
|
|
|
- appletsId: wx.getStorageSync('openId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- wx.switchTab({
|
|
|
- url: '/pages/index/index',
|
|
|
- })
|
|
|
- wx.setStorageSync('user', 'user')
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- },
|
|
|
- onLoad: function () {
|
|
|
- var that = this;
|
|
|
- wx.login({
|
|
|
- success: res => {
|
|
|
- // 获取到用户的 code 之后:res.code
|
|
|
- console.log("用户的code:" + res.code);
|
|
|
- const appid = "wx1c015df104db7030"
|
|
|
- const secret = "d1956c1b5d3601657c98b0dc80a006f7"
|
|
|
- let url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appid + '&secret=' + secret + '&js_code=' + res.code + '&grant_type=authorization_code';
|
|
|
- wx.request({
|
|
|
- // 自行补上自己的 APPID 和 SECRET
|
|
|
- url: url,
|
|
|
- success: res => {
|
|
|
- // 获取到用户的 openid
|
|
|
- console.log("用户的openid:" + res.data.openid);
|
|
|
- wx.setStorageSync('openId', res.data.openid)
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/applet/isExist',
|
|
|
- method: "GET",
|
|
|
- data: {
|
|
|
- appletsId: wx.getStorageSync('openId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
-
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- },
|
|
|
-})
|