123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- const company = getApp().globalData.company
- const Parse = getApp().Parse
- /** 登录验证*/
- function resetlogin() {
- return new Promise((resolve, reject) => {
- wx.login({
- success: function (res) {
- if (res.code) {
- wx.request({
- url: "https://server.fmode.cn/api/wxapp/auth_wxapp",
- data: {
- c: getApp().globalData.company,
- code: res.code,
- },
- async success(res) {
- wx.setStorageSync("userInfo", res.data);
- resolve(res)
- },
- });
- }
- },
- fail: function (err) {
- wx.showToast({
- title: '服务器繁忙,请稍后重试',
- })
- }
- });
- })
- }
- function logout() {
- Parse.User.logOut().then(user => {
- wx.showToast({
- title: '退出成功',
- icon: 'success',
- image: '',
- duration: 1500,
- mask: false,
- });
- wx.clearStorage()
- // wx.removeStorageSync('userLogin')
- // wx.removeStorageSync('userInfo')
- // wx.removeStorageSync('__plugins__/wx56d559d35ae6e502/userLogin')
- // wx.removeStorageSync('__plugins__/wx56d559d35ae6e502/Parse/ncloudmaster/currentInstallationId')
- // wx.setStorageSync('userLogin', '');
- // wx.setStorageSync('userInfo', '');
- // wx.setStorageSync('__plugins__/wx56d559d35ae6e502/userLogin', '');
- // wx.setStorageSync('__plugins__/wx56d559d35ae6e502/Parse/ncloudmaster/currentInstallationId', '');
- setTimeout(() => {
- wx.redirectTo({
- url: '/nova-werun/pages/index/index',
- });
- }, 1000);
- });
- }
- module.exports = {
- resetlogin,
- logout:logout
- }
|