|
|
|
|
@ -24,14 +24,11 @@
|
|
|
|
|
<view v-for="(item, index) in colorGroup" :key="index" class="g_w_48 g_h_48 g_radius_8 color-item" :class="{ 'color-item-selected': selectedColorIndex === index }" :style="{ backgroundColor: item.value }" style="margin-top: 10px;" @click="selectColor(index)"></view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="g_flex_row_between flex_center g_p_16">
|
|
|
|
|
<view class="g_fs_16 g_c_0">开启演示模式</view>
|
|
|
|
|
<u-switch v-model="formData.enabled" :activeColor="themeColor" inactiveColor="#e5e5e5" @change="handleSwitchChange"></u-switch>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="g_mt_40 g_ml_12 g_mr_12">
|
|
|
|
|
<rh-button btnText="保存" @clickBtn="handleSubmit" type="primary" size="full" />
|
|
|
|
|
<rh-button btnText="保存" @clickBtn="handleSubmit" type="primary" size="full" style="width: 250px;" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="g_flex_row_end g_pr_20 g_mt_8 g_fs_14 g_mb_24" style="color: #576b95" @click="handleRestore">恢复</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -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);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|