|
@@ -1,116 +0,0 @@
|
|
|
-// pages/login/login.js
|
|
|
-import api from '../api/api'
|
|
|
-const md5 = require('../../utils/md5');
|
|
|
-const app = getApp()
|
|
|
-Page({
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面的初始数据
|
|
|
- */
|
|
|
- data: {
|
|
|
- form:{
|
|
|
- username:'000175',
|
|
|
- password:'123456789'
|
|
|
- }
|
|
|
- },
|
|
|
- inputChange (data) {
|
|
|
- let name = data.currentTarget.dataset.name
|
|
|
- this.data.form[name] = data.detail.value
|
|
|
- this.setData({
|
|
|
- form:this.data.form
|
|
|
- })
|
|
|
- },
|
|
|
- async login () {
|
|
|
- const res = await api._post({
|
|
|
- "accountno": this.data.form.username,
|
|
|
- "password": md5.hexMD5(this.data.form.password),
|
|
|
- "systemclient":"wechatsaletool"
|
|
|
- },'/loginbyaccount')
|
|
|
- if (res.account_list.length === 1) {
|
|
|
- wx.setStorageSync('token', res.account_list[0].token)
|
|
|
- this.query_userauth()
|
|
|
- }
|
|
|
- },
|
|
|
- async query_userauth() {
|
|
|
- const res = await api._post({
|
|
|
- "classname": "sysmanage.develop.userauth.userauth",
|
|
|
- "method": "query_userauth",
|
|
|
- content: {
|
|
|
- nocache: true
|
|
|
- }
|
|
|
- })
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: '权限查询失败,请稍后再试',
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- app.globalData.tabbarList = res.data[0].modules[0].apps.map(e=>{
|
|
|
- return {
|
|
|
- title:e.meta.title,
|
|
|
- name:e.name,
|
|
|
- path:e.path
|
|
|
- }
|
|
|
- })
|
|
|
- console.log(app.globalData.tabbarList)
|
|
|
-
|
|
|
- wx.setStorageSync('userauth', res.data);
|
|
|
-
|
|
|
- wx.navigateTo({
|
|
|
- url: app.globalData.tabbarList[0].path,
|
|
|
- })
|
|
|
- },
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- */
|
|
|
- onLoad(options) {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
- onShow() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
- onHide() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
- */
|
|
|
- onUnload() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
- onReachBottom() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage() {
|
|
|
-
|
|
|
- }
|
|
|
-})
|