123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- const app = getApp();
- Page({
- data: {
- user: '',
- password: '',
- qtzh:"手机号码",
- qtPassword:"密码",
- color1:"",
- color2:"",
- inputValue1: null,
- inputValue2: null,
- usertext:'',
- },
-
- onLoad: function (options) {
- var _this =this;
- setTimeout(function () {
- wx.hideLoading()
-
-
- if (wx.getStorageSync('user')){
- _this.setData({
- inputValue1: wx.getStorageSync('user'),
- });
- }
-
- })
- wx.getSetting({
- success(res) {
- if (res.authSetting['scope.userInfo']) {
-
-
-
- console.log('已经授权');
- } else {
- wx.reLaunch({
- url: '/pages/Jurisdiction/click_Jurisdiction/click_Jurisdiction'
- })
- console.log('没有授权');
- }
- }
- })
- },
-
- Telephone: function (e) {
- var user = e.detail.value;
-
- this.setData({
- user: user
- });
- },
-
- password: function (e) {
- var password = e.detail.value;
-
- this.setData({
- password: password
- });
- },
-
- Landbutton: function (e) {
- var that = this;
-
- let Land_url = 'public/login';
- let Land_data = {
- user: this.data.user,
- password: this.data.password,
- };
- app.postRequest(Land_url, Land_data, function (res) {
- if (res.code == 201) {
- console.log(res.data);
-
-
- wx.switchTab({
- url: '/pages/index/index'
- })
-
- try {
- wx.setStorageSync('access_key', res.data.access_key)
- wx.setStorageSync('access_token', res.data.access_token)
- wx.setStorageSync('access_user', res.data.access_user)
- wx.setStorageSync('user', that.data.user)
- } catch (e) {
- }
-
- return;
-
- }
-
-
-
-
-
-
-
-
- wx.showToast({
- title: '登陆失败',
- icon: 'none',
- mask: true,
- duration: 1500
- })
-
- if (res.data.user){
- that.setData({
- qtzh: res.data.user,
- color1: "color:red;font-size: 25rpx;",
- inputValue1: '',
- user: '',
- });
- }
-
- if (res.data.password){
- that.setData({
- qtPassword: res.data.password,
- color2: "color:red;font-size: 25rpx;",
- inputValue2: '',
- password: '',
- });
- }else{
- that.setData({
- qtPassword: '密码',
- inputValue2: '',
- color2:'',
- password: '',
- });
- }
-
-
-
- })
- },
- })
|