1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- const app = getApp()
- Page({
- data: {
- authParams: null,
- authServiceCode: null
- },
- handleChange(e) {
- let { obj } = e.target.dataset;
- let value = e.detail.value;
- this.data[obj] = value;
- },
- saveCongfig() {
- try {
- app.data.authParams = JSON.parse(this.data.authParams);
- } catch (error) {
- my.showToast({
- type: 'fail',
- content: 'JSON格式有误',
- duration: 1500,
- });
- return;
- }
- app.data.authServiceCode = this.data.authServiceCode;
- my.showToast({
- type: 'success',
- content: '保存成功',
- duration: 1500,
- });
- my.navigateBack(1)
- },
- resetConfig() {
- app.data.authParams = my.getStorageSync({key: "defaultauthParams"}).data;
- app.data.authServiceCode = my.getStorageSync({key: "defaultauthServiceCode"}).data;
- this.update();
- my.showToast({
- type: 'success',
- content: '恢复成功',
- duration: 1500,
- });
- my.navigateBack(1)
- },
- update() {
- this.setData({
- authParams: JSON.stringify(app.data.authParams),
- authServiceCode: app.data.authServiceCode
- })
- },
- onLoad() {
- this.update();
- },
- });
|