【新增】首页弹出弹窗广告新增自定义上传图片和链接链接地址。

This commit is contained in:
大灰灰
2022-11-26 00:21:17 +08:00
parent 80067c13d8
commit d445a7ee52
6 changed files with 93 additions and 7 deletions

View File

@@ -595,6 +595,16 @@ namespace CoreCms.Net.Configuration
/// </summary> /// </summary>
public const string ShowIndexPopupWindow = "showIndexPopupWindow"; public const string ShowIndexPopupWindow = "showIndexPopupWindow";
/// <summary>
/// 首页弹窗图片地址
/// </summary>
public const string IndexPopupWindowImageUrl = "indexPopupWindowImageUrl";
/// <summary>
/// 首页弹窗图片链接地址
/// </summary>
public const string IndexPopupWindowHrefUrl = "indexPopupWindowHrefUrl";
//第三方接口============================================================================ //第三方接口============================================================================
/// <summary> /// <summary>

View File

@@ -60,6 +60,8 @@ namespace CoreCms.Net.Configuration
di.Add(SystemSettingConstVars.ShowCustomForm, new DictionaryKeyValues() { sKey = "显示自定义表单按钮", sValue = "2" }); di.Add(SystemSettingConstVars.ShowCustomForm, new DictionaryKeyValues() { sKey = "显示自定义表单按钮", sValue = "2" });
di.Add(SystemSettingConstVars.ShowIndexPopupWindow, new DictionaryKeyValues() { sKey = "显示首页弹窗", sValue = "2" }); di.Add(SystemSettingConstVars.ShowIndexPopupWindow, new DictionaryKeyValues() { sKey = "显示首页弹窗", sValue = "2" });
di.Add(SystemSettingConstVars.IndexPopupWindowImageUrl, new DictionaryKeyValues() { sKey = "图片地址", sValue = "" });
di.Add(SystemSettingConstVars.IndexPopupWindowHrefUrl, new DictionaryKeyValues() { sKey = "链接地址", sValue = "" });
//搜索发现关键字 //搜索发现关键字

View File

@@ -1,10 +1,10 @@
<template> <template>
<view class="coreshop-modal-box" :class="show?'show':''"> <view class="coreshop-modal-box" :class="show?'show':''">
<view class="dialog"> <view class="dialog">
<view class="coreshop-flex coreshop-align-end coreshop-self-end coreshop-justify-end">
<u-icon name="close-circle" color="#ffffff" size="28" @click="closeEvent"></u-icon>
</view>
<image class="img" :src="src" lazy-load mode="widthFix" @tap="imgEvent"></image> <image class="img" :src="src" lazy-load mode="widthFix" @tap="imgEvent"></image>
<view class="coreshop-flex coreshop-align-center coreshop-self-end coreshop-justify-center">
<u-icon name="close-circle" color="#ffffff" size="32" @click="closeEvent"></u-icon>
</view>
</view> </view>
</view> </view>
</template> </template>

View File

@@ -25,7 +25,7 @@
<!--返回顶部组件--> <!--返回顶部组件-->
<u-back-top :scroll-top="scrollTop" :duration="500"></u-back-top> <u-back-top :scroll-top="scrollTop" :duration="500"></u-back-top>
<!--弹出框--> <!--弹出框-->
<coreshop-modal-img :show="modalShow" :src="$globalConstVars.apiFilesUrl+'/static/images/empty/reward.png'" @imgTap="imgTap" @closeTap="closeTap" /> <coreshop-modal-img :show="modalShow" :src="indexPopupWindowImageUrl" @imgTap="imgTap" @closeTap="closeTap" />
<!-- 登录提示 --> <!-- 登录提示 -->
<coreshop-login-modal></coreshop-login-modal> <coreshop-login-modal></coreshop-login-modal>
</view> </view>
@@ -46,7 +46,10 @@
shareUrl: this.$globalConstVars.shareUrl, shareUrl: this.$globalConstVars.shareUrl,
isScorll: false, isScorll: false,
homeTitle: '', homeTitle: '',
modalShow: false modalShow: false,
indexPopupWindowHrefUrl: '',
indexPopupWindowImageUrl: '',
}; };
}, },
updated() { updated() {
@@ -54,6 +57,8 @@
}, },
mounted() { mounted() {
this.modalShow = this.$store.state.config.showIndexPopupWindow == 1; this.modalShow = this.$store.state.config.showIndexPopupWindow == 1;
this.indexPopupWindowHrefUrl = this.$store.state.config.indexPopupWindowHrefUrl;
this.indexPopupWindowImageUrl = this.$store.state.config.indexPopupWindowImageUrl;
}, },
computed: { computed: {
...mapState({ ...mapState({
@@ -91,7 +96,25 @@
methods: { methods: {
imgTap() { imgTap() {
this.modalShow = false; this.modalShow = false;
this.$refs.uToast.show({ message: "你点了海报了。", type: 'success', back: false }); var val = this.indexPopupWindowHrefUrl;
if (this.indexPopupWindowHrefUrl.indexOf('http') != -1) {
// #ifdef APP-PLUS || APP-PLUS-NVUE || MP
this.$u.route('/pages/webview/webview', { src: val });
// #endif
} else {
// #ifdef APP-PLUS || APP-PLUS-NVUE || MP
if (val == '/pages/index/default/default' || val == '/pages/category/index/index' || val == '/pages/index/cart/cart' || val == '/pages/index/member/member') {
this.$u.route({ type: 'switchTab', url: val });
return;
} else if (val.indexOf('/pages/coupon/coupon?id=') > -1) {
var id = val.replace('/pages/coupon/coupon?id=', "");
this.receiveCoupon(id)
} else {
this.$u.route(val);
return;
}
// #endif
}
}, },
closeTap() { closeTap() {
this.modalShow = false; this.modalShow = false;

View File

@@ -77,6 +77,30 @@
<input type="radio" lay-filter="showIndexPopupWindow" name="showIndexPopupWindow" value="2" title="不开启" {{d.data.configs['showIndexPopupWindow']['sValue']==="2" ? 'checked':''}}> <input type="radio" lay-filter="showIndexPopupWindow" name="showIndexPopupWindow" value="2" title="不开启" {{d.data.configs['showIndexPopupWindow']['sValue']==="2" ? 'checked':''}}>
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">{{d.data.configs['indexPopupWindowHrefUrl']['sKey']}}</label>
<div class="layui-input-inline layui-inline-7">
<input type="text" name="indexPopupWindowHrefUrl" value="{{d.data.configs['indexPopupWindowHrefUrl']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="请输入链接地址" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">点击弹窗广告后跳转的小程序地址或者外部URl地址需要在小程序业务域名增加外部URL的域名</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{{d.data.configs['indexPopupWindowImageUrl']['sKey']}}</label>
<div class="layui-input-inline layui-inline-5">
<input type="hidden" name="indexPopupWindowImageUrl" id="indexPopupWindowImageUrl" value="{{d.data.configs['indexPopupWindowImageUrl']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="" class="layui-input">
<div class="layui-upload">
<button type="button" class="layui-btn" id="upIndexPopupWindowImageUrlBtn">上传图片</button>
<div class="layui-upload-list">
<img class="layui-upload-img" id="viewIndexPopupWindowImageUrlImgBox" src="{{d.data.configs['indexPopupWindowImageUrl']['sValue'] ? d.data.configs['indexPopupWindowImageUrl']['sValue']:'/static/images/common/empty.png'}}">
<p id="viewShareTextBox"></p>
</div>
</div>
</div>
<div class="layui-form-mid layui-word-aux">微信小程序首页分享的图片</div>
</div>
<blockquote class="layui-elem-quote" style="padding-top: 20px;line-height: 30px;"> <blockquote class="layui-elem-quote" style="padding-top: 20px;line-height: 30px;">
控制个人中心面板是否显示以下组件按钮 控制个人中心面板是否显示以下组件按钮
</blockquote> </blockquote>
@@ -922,7 +946,7 @@
//开启调试情况下获取接口赋值数据 //开启调试情况下获取接口赋值数据
if (debug) { console.log(d); } if (debug) { console.log(d); }
indexData = d.data; indexData = d.data;
layui.use(['admin', 'form', 'coreHelper', 'element', 'table', 'util', 'view', 'table', 'cropperImg'], function () { layui.use(['admin', 'form', 'coreHelper', 'element', 'table', 'util', 'view', 'table', 'cropperImg', 'upload'], function () {
var $ = layui.$ var $ = layui.$
, setter = layui.setter , setter = layui.setter
, admin = layui.admin , admin = layui.admin
@@ -932,6 +956,7 @@
, table = layui.table , table = layui.table
, util = layui.util , util = layui.util
, view = layui.view , view = layui.view
, upload = layui.upload
, cropperImg = layui.cropperImg , cropperImg = layui.cropperImg
, router = layui.router() , router = layui.router()
, search = router.search; , search = router.search;
@@ -1001,6 +1026,26 @@
} }
}); });
}); });
//首页弹窗广告图片
upload.render({
elem: '#upIndexPopupWindowImageUrlBtn'
, url: layui.setter.apiUrl + 'Api/Tools/UploadFiles'
, done: function (res) {
if (res.code > 0) {
return layer.msg('上传失败');
}
layer.msg('上传成功');
$('#viewIndexPopupWindowImageUrlImgBox').attr('src', res.data.fileUrl);
$("#indexPopupWindowImageUrl").val(res.data.fileUrl);
}
, error: function () {
var viewTextBox = $('#viewTextBox');
viewTextBox.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
viewTextBox.find('.demo-reload').on('click', function () {
uploadInst.upload();
});
}
});
//退货区域显示处理 //退货区域显示处理
var reshipAreaId = 0; var reshipAreaId = 0;

View File

@@ -109,7 +109,11 @@ namespace CoreCms.Net.Web.WebApi.Controllers
var showGroupBuying = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowGroupBuying).ObjectToInt(2); //显示团购按钮 var showGroupBuying = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowGroupBuying).ObjectToInt(2); //显示团购按钮
var showSolitaire = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowSolitaire).ObjectToInt(2); //显示接龙按钮 var showSolitaire = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowSolitaire).ObjectToInt(2); //显示接龙按钮
var showCalendar = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowCalendar).ObjectToInt(2); //显示签到按钮 var showCalendar = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowCalendar).ObjectToInt(2); //显示签到按钮
var showIndexPopupWindow = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowIndexPopupWindow).ObjectToInt(2); //显示首页弹窗 var showIndexPopupWindow = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowIndexPopupWindow).ObjectToInt(2); //显示首页弹窗
var indexPopupWindowImageUrl = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IndexPopupWindowImageUrl); //首页弹窗图片地址
var indexPopupWindowHrefUrl = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IndexPopupWindowHrefUrl); //显示首页弹窗
var showCustomForm = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowCustomForm).ObjectToInt(2); //显示自定义表单按钮 var showCustomForm = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShowCustomForm).ObjectToInt(2); //显示自定义表单按钮
var imageMax = 5; //前端上传图片最多几张 var imageMax = 5; //前端上传图片最多几张
@@ -243,6 +247,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers
showSolitaire, showSolitaire,
showCalendar, showCalendar,
showIndexPopupWindow, showIndexPopupWindow,
indexPopupWindowImageUrl,
indexPopupWindowHrefUrl,
showCustomForm showCustomForm
}; };
jm.data = model; jm.data = model;