diff --git a/root/person/config.vue b/root/person/config.vue
index 525eca4..abdd198 100644
--- a/root/person/config.vue
+++ b/root/person/config.vue
@@ -24,14 +24,11 @@
-
- 开启演示模式
-
-
-
+
+ 恢复
@@ -43,7 +40,7 @@ export default {
let demoConfig = uni.getStorageSync("DEMO_MODE_CONFIG") || {};
let defaultThemeColor = getApp().globalData.themeColor;
let colorGroup = [
- { value: '#333' },
+ { value: '#2FC67D' },
{ value: '#FF0000' },
{ value: '#FF5000' },
{ value: '#0266D6' },
@@ -60,7 +57,6 @@ export default {
formData: {
appName: demoConfig.appName || "",
logo: demoConfig.logo || "",
- enabled: demoConfig.enabled || false,
themeColor: savedThemeColor,
},
};
@@ -71,9 +67,6 @@ export default {
this.formData.themeColor = this.colorGroup[index].value;
this.themeColor = this.colorGroup[index].value;
},
- handleSwitchChange(e) {
- this.formData.enabled = e;
- },
chooseAvatar() {
let that = this;
uni.showActionSheet({
@@ -102,14 +95,14 @@ export default {
},
handleSubmit() {
let that = this;
- if (that.formData.enabled && !that.formData.appName) {
+ if (!that.formData.appName) {
uni.showToast({
title: "请输入小程序名称",
icon: "none",
});
return;
}
- if (that.formData.enabled && !that.formData.logo) {
+ if (!that.formData.logo) {
uni.showToast({
title: "请上传小程序头像",
icon: "none",
@@ -119,10 +112,10 @@ export default {
uni.setStorageSync("DEMO_MODE_CONFIG", {
appName: that.formData.appName,
logo: that.formData.logo,
- enabled: that.formData.enabled,
+ enabled: true,
themeColor: that.formData.themeColor,
});
- uni.setStorageSync("DEMO_MODE_ENABLED", that.formData.enabled);
+ uni.setStorageSync("DEMO_MODE_ENABLED", true);
getApp().globalData.themeColor = that.formData.themeColor;
uni.showToast({
title: "保存成功",
@@ -132,6 +125,21 @@ export default {
uni.navigateBack();
}, 1500);
},
+ handleRestore() {
+ let defaultThemeColor = "#fea702";
+ uni.setStorageSync("DEMO_MODE_ENABLED", false);
+ let demoConfig = uni.getStorageSync("DEMO_MODE_CONFIG") || {};
+ demoConfig.enabled = false;
+ uni.setStorageSync("DEMO_MODE_CONFIG", demoConfig);
+ getApp().globalData.themeColor = defaultThemeColor;
+ uni.showToast({
+ title: "已恢复",
+ icon: "success",
+ });
+ setTimeout(() => {
+ uni.navigateBack();
+ }, 1500);
+ },
},
};