From 54de4347772b94fafcdd30f501f9cba5dc736219 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Fri, 2 Apr 2021 18:31:46 +0800 Subject: [PATCH] no message --- app.js | 1 + app.json | 1 + pages/home/index/index.wxml | 14 +++++------ pages/home/setting/index.js | 44 +++++++++++++++++++++++++++++++++++ pages/home/setting/index.json | 10 ++++++++ pages/home/setting/index.wxml | 28 ++++++++++++++++++++++ pages/home/setting/index.wxss | 1 + 7 files changed, 92 insertions(+), 7 deletions(-) create mode 100644 pages/home/setting/index.js create mode 100644 pages/home/setting/index.json create mode 100644 pages/home/setting/index.wxml create mode 100644 pages/home/setting/index.wxss diff --git a/app.js b/app.js index c19a5ae..328a15b 100644 --- a/app.js +++ b/app.js @@ -8,6 +8,7 @@ App({ //----------------------------------------------globalData-------------------------------------- globalData: { token: null, + agenting: 1, keyboardHeight: 0, isIos: false } diff --git a/app.json b/app.json index 3e4055e..dc4b15d 100644 --- a/app.json +++ b/app.json @@ -9,6 +9,7 @@ "pages/home/customer-info/index", "pages/home/authory/index", "pages/home/qrcode/index", + "pages/home/setting/index", "pages/process/agent-list/index", "pages/process/check-list/index", "pages/process/order-list/index", diff --git a/pages/home/index/index.wxml b/pages/home/index/index.wxml index 47a517f..ca4ef15 100644 --- a/pages/home/index/index.wxml +++ b/pages/home/index/index.wxml @@ -47,7 +47,7 @@ --> - + @@ -68,20 +68,20 @@ --> - + - + - - 修改密码 + + 设置 - + diff --git a/pages/home/setting/index.js b/pages/home/setting/index.js new file mode 100644 index 0000000..b320083 --- /dev/null +++ b/pages/home/setting/index.js @@ -0,0 +1,44 @@ +// pages/home/setting/index.js +import Dialog from '../../../components/dialog/dialog' +import util from '../../../utils/util' +import { finalizeToken } from "../../../api/user" +const event = require('../../../utils/event') +const storage = require('../../../utils/storage') +const app = getApp() + +Page({ + + /** + * 页面的初始数据 + */ + data: { + agenting: true + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var agenting = storage.get('saas-agenting') + if(!util.isEmpty(agenting)){ + app.globalData.agenting = agenting + } + this.setData({ agenting: app.globalData.agenting ? true : false }) + }, + settingAgent: function(){ + var agenting = this.data.agenting ? 0 : 1 + app.globalData.agenting = agenting + storage.put('saas-agenting', agenting) + this.setData({ agenting: agenting ? true : false }) + }, + loginOut: function () { + Dialog.confirm({ title: '温馨提示', message: '确定退出纸通宝账号?' }).then(() => { + storage.remove('Authorization') + app.globalData.token = null + app.userInfo = null + finalizeToken() + wx.redirectTo({ url: '/pages/login/index' }) + event.emit('EventMessage', { what: 888, desc: 'Logout' }) + }).catch(error => { + }) + } +}) \ No newline at end of file diff --git a/pages/home/setting/index.json b/pages/home/setting/index.json new file mode 100644 index 0000000..0783c2d --- /dev/null +++ b/pages/home/setting/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "van-cell": "/components/cell/index", + "van-cell-group": "/components/cell-group/index", + "van-info": "/components/info/index", + "van-icon": "/components/icon/index", + "van-switch": "/components/switch/index", + "van-dialog": "/components/dialog/index" + } +} \ No newline at end of file diff --git a/pages/home/setting/index.wxml b/pages/home/setting/index.wxml new file mode 100644 index 0000000..03d64a4 --- /dev/null +++ b/pages/home/setting/index.wxml @@ -0,0 +1,28 @@ + + + 重置 + + + + + + + 默认使用千鸟代付 + + + + + + + + 修改密码 + + + + + 退出当前账号 + + + + + \ No newline at end of file diff --git a/pages/home/setting/index.wxss b/pages/home/setting/index.wxss new file mode 100644 index 0000000..ebceea0 --- /dev/null +++ b/pages/home/setting/index.wxss @@ -0,0 +1 @@ +/* pages/home/setting/index.wxss */ \ No newline at end of file