| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- const app = getApp();
- const verify = require("../../../common/js/verify.js");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- form: {
- account: '',
- password: '',
- },
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- const admin_id = wx.getStorageSync('admin_id');
- if (admin_id) {
- wx.redirectTo({
- url: '/pages/talent/admin/index',
- })
- }
- },
- vmodel(e) {
- this.setData({
- ['form.'+e.currentTarget.dataset.value]:e.detail.value
- })
- },
- submit() {
- let self = this;
- let form = this.data.form;
- if (verify.isEmpty(form.account)) {
- app.msg('请输入账号');
- return false;
- }
- if (verify.isEmpty(form.password)) {
- app.msg('请输入密码');
- return false;
- }
- app.post('talent/admin/login',form,function(res){
- wx.setStorageSync('admin_id', res)
- wx.redirectTo({
- url: '/pages/talent/admin/index',
- });
- });
- }
- })
|