This commit is contained in:
jianweie
2023-06-06 16:55:49 +08:00
11 changed files with 348 additions and 47 deletions

View File

@@ -333,11 +333,13 @@ namespace CoreCms.Net.Web.Admin.Controllers
//sheet1添加第一行的头部标题
var headerRow = mySheet.CreateRow(0);
var headerStyle = ExcelHelper.GetHeaderStyle(book);
var cellNum = 0;
{% for field in ModelFields %}
var cell{{ forloop.index0 }} = headerRow.CreateCell({{ forloop.index0 }});
var cell{{ forloop.index0 }} = headerRow.CreateCell(cellNum);
cell{{ forloop.index0 }}.SetCellValue("{{field.ColumnDescription}}");
cell{{ forloop.index0 }}.CellStyle = headerStyle;
mySheet.SetColumnWidth({{ forloop.index0 }}, 10 * 256);
mySheet.SetColumnWidth(cellNum, 10 * 256);
cellNum++;
{% endfor %}
headerRow.Height = 30 * 20;
var commonCellStyle = ExcelHelper.GetCommonStyle(book);
@@ -346,10 +348,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
for (var i = 0; i < listModel.Count; i++)
{
var rowTemp = mySheet.CreateRow(i + 1);
var cellNumTemp = 0;
{% for field in ModelFields %}
var rowTemp{{ forloop.index0 }} = rowTemp.CreateCell({{ forloop.index0 }});
var rowTemp{{ forloop.index0 }} = rowTemp.CreateCell(cellNumTemp);
rowTemp{{ forloop.index0 }}.SetCellValue(listModel[i].{{field.DbColumnName}}.ToString());
rowTemp{{ forloop.index0 }}.CellStyle = commonCellStyle;
cellNumTemp++;
{% endfor %}
}
// excel
@@ -451,11 +455,13 @@ namespace CoreCms.Net.Web.Admin.Controllers
//sheet1添加第一行的头部标题
var headerRow = mySheet.CreateRow(0);
var headerStyle = ExcelHelper.GetHeaderStyle(book);
var cellNum = 0;
{% for field in ModelFields %}
var cell{{ forloop.index0 }} = headerRow.CreateCell({{ forloop.index0 }});
var cell{{ forloop.index0 }} = headerRow.CreateCell(cellNum);
cell{{ forloop.index0 }}.SetCellValue("{{field.ColumnDescription}}");
cell{{ forloop.index0 }}.CellStyle = headerStyle;
mySheet.SetColumnWidth({{ forloop.index0 }}, 10 * 256);
mySheet.SetColumnWidth(cellNum, 10 * 256);
cellNum++;
{% endfor %}
headerRow.Height = 30 * 20;
@@ -465,12 +471,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
for (var i = 0; i < listModel.Count; i++)
{
var rowTemp = mySheet.CreateRow(i + 1);
var cellNumTemp = 0;
{% for field in ModelFields %}
var rowTemp{{ forloop.index0 }} = rowTemp.CreateCell({{ forloop.index0 }});
rowTemp{{ forloop.index0 }}.SetCellValue(listModel[i].{{field.DbColumnName}}.ToString());
rowTemp{{ forloop.index0 }}.CellStyle = commonCellStyle;
var rowTemp{{ forloop.index0 }} = rowTemp.CreateCell(cellNumTemp);
rowTemp{{ forloop.index0 }}.SetCellValue(listModel[i].{{field.DbColumnName}}.ToString());
rowTemp{{ forloop.index0 }}.CellStyle = commonCellStyle;
cellNumTemp++;
{% endfor %}
}
// excel

View File

@@ -1,19 +1,14 @@
.wrap { font-size: 14px;
.content { width: 300px; margin: 40px auto 0;
.title { text-align: left; font-size: 25px; font-weight: 500; margin-bottom: 50px; }
.content { width: 350px; margin: 40px auto 0;
.title { text-align: center; font-size: 25px; font-weight: 500; margin-bottom: 50px; }
input { text-align: left; margin-bottom: 5px; padding-bottom: 3px; }
.tips { color: $u-type-info; margin-bottom: 30px; margin-top: 4px; }
.getCaptcha { background-color: rgb(253, 243, 208); color: $u-tips-color; border: none; font-size: 15px; padding: 6px 0;
&::after { border: none; }
}
.alternative { color: $u-tips-color; display: flex; justify-content: space-between; margin-top: 15px; }
}
.buttom {
.loginType { display: flex; padding: 175px 75px 75px 75px; justify-content: center;
.loginType { display: flex; padding: 75px 75px 15px 75px; justify-content: center;
.item { display: flex; flex-direction: column; align-items: center; color: $u-content-color; font-size: 14px; }
}
@@ -22,8 +17,13 @@
.link { color: $u-type-warning; }
}
}
.getCaptcha { background-color: rgb(253, 243, 208); color: $u-tips-color; border: none; font-size: 15px; padding: 6px 0; width: 100%;
&::after { border: none; }
}
}
.agreement-checked-view { position: relative; padding: 10px 0px 10px 15px; display: flex; align-items: center; margin: 5px 0; font-size: 12px; justify-content: center; }
.wrapkey { padding: 40px 35px; }
.box { margin: 15px 0; font-size: 15px; color: 555; }

View File

@@ -14,31 +14,31 @@
<view class="top"></view>
<view class="content">
<view class="title">欢迎登录{{appTitle}}</view>
<input class="coreshop-solid-bottom" type="number" v-model="mobile" placeholder="请输入手机号" />
<view class="tips">未注册的手机号验证后自动创建平台账号</view>
<button @tap="submit" :style="[inputStyle]" class="getCaptcha">获取短信验证码</button>
<view class="alternative">
<!--<view class="password">密码登录</view>-->
<view class="issue">遇到问题</view>
</view>
<u--input placeholder="请输入手机号"
border="surround"
v-model="mobile"
type="number"
@change="change"></u--input>
<view class="tips coreshop-margin-10">未注册的手机号验证后自动创建平台账号</view>
</view>
<view class="buttom">
<view class="loginType">
<!--#ifdef MP-WEIXIN-->
<view class="wechat item" @tap="goLoginByGetPhoneNumber()">
<view class="icon"><u-icon size="70" name="weixin-fill" color="rgb(83,194,64)"></u-icon></view>
微信手机号绑定
</view>
<!--#endif-->
<button @tap="submit" :style="[inputStyle]" class="getCaptcha">获取短信验证码</button>
</view>
<view class="hint">
登录即代表你同意
<text @click="goUserAgreementPage()">用户协议</text>
<text @click="goUserPrivacyPolicy()">隐私政策</text>
并授权使用您的{{appTitle}}账号信息如昵称头像收获地址以便您统一管理
<!--服务协议-->
<view class="coreshop-margin-top-15 coreshop-margin-bottom-30 agreement-checked-view">
<u-checkbox-group>
<u-checkbox v-model="agreement" :checked="agreement" @change="checkboxChange" size="20" active-color="#19be6b"></u-checkbox>
</u-checkbox-group>
<view class="coreshop-text-black-view">
<text class="coreshop-text-black">同意</text>
<text class="text-blue" @tap="goUserAgreementPage">服务协议</text>
<text class="coreshop-text-black"></text>
<text class="text-blue" @tap="goUserPrivacyPolicy">隐私协议</text>
</view>
</view>
</view>
</view>
<view class="wrapkey" v-if="showCodeBox">
<view class="key-input">
@@ -62,6 +62,7 @@
data() {
return {
agreement: false,
maxMobile: 11,
mobile: '', // 用户手机号
code: '', // 短信验证码
@@ -143,15 +144,23 @@
}
},
methods: {
goLoginByGetPhoneNumber() {
this.$u.route({ type: 'redirectTo', url: '/pages/login/loginByGetPhoneNumber/loginByGetPhoneNumber?sessionAuthId=' + this.sessionAuthId });
checkboxChange(e) {
this.agreement = e;
console.log(this.agreement);
},
change(e) {
console.log('change', e);
},
submit() {
if (this.$u.test.mobile(this.mobile)) {
this.sendCode();
} else {
if (!this.$u.test.mobile(this.mobile)) {
this.$u.toast('请输入合法的手机号码!');
return;
}
if (this.agreement == false) {
this.$u.toast('请先勾选同意《服务协议》与《隐私协议》!');
return;
}
this.sendCode();
},
// 收不到验证码选择时的选择
noCaptcha() {

View File

@@ -135,6 +135,8 @@
if (_this.$store.state.config.agentStore == '1') {
_this.utilityMenus.myStore.router = '/pages/member/agent/myStore/myStore?store=' + _this.info.store;
}
this.getShareUrl();
} else {
//报错了
_this.$u.toast(res.msg);
@@ -159,7 +161,6 @@
if (res.status) {
_this.userInfo = res.data
}
this.getShareUrl();
})
},
//去提现
@@ -173,6 +174,9 @@
url: this.$globalConstVars.shareUrl,
type: this.$globalConstVars.shareModel.url,
page: this.$globalConstVars.shareType.agent,
params: {
store: this.info.store
},
};
let userToken = this.$db.get('userToken');
if (userToken && userToken != '') {

View File

@@ -102,7 +102,7 @@
},
//跳转到首页
gotoIndex() {
uni.switchTab({ url: '/pages/index/default/default' });
_this.$u.route({ type: 'switchTab', url: '/pages/index/default/default' });
},
//跳转到商品
gotoGoods(id) {
@@ -226,7 +226,7 @@
url: '/pages/member/agent/myStore/myStore',
type: 'redirectTo',
params: {
id: id
store: id
}
})
} else {

View File

@@ -832,6 +832,176 @@ namespace CoreCms.Net.Web.Admin.Controllers
#endregion
#region ============================================================
// POST: Api/Tools/GetAgentWxCode
/// <summary>
/// 后台生成代理商小程序码
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("后台生成小程序码")]
public async Task<AdminUiCallBack> GetAgentWxCode([FromBody] FMIntId entity)
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
var userModel = await _userServices.QueryByIdAsync(entity.id);
if (userModel == null)
{
jm.code = 1;
jm.msg = "不存在此信息";
return jm;
}
var userCode = UserHelper.GetShareCodeByUserId(entity.id);
var path = "pages/share/jump/jump?scene=11-" + userCode + "-" + userCode;
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var request = new CgibinWxaappCreateWxaQrcodeRequest();
request.AccessToken = accessToken;
request.Path = path;
var response = await client.ExecuteCgibinWxaappCreateWxaQrcodeAsync(request);
if (response.IsSuccessful())
{
var memStream = new MemoryStream(response.RawBytes);
string url = string.Empty;
if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
{
url = _toolsServices.UpLoadBase64ForLocalStorage(filesStorageOptions, memStream);
}
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.AliYunOSS.ToString())
{
//上传到阿里云
url = await _toolsServices.UpLoadBase64ForAliYunOSS(filesStorageOptions, memStream);
}
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QCloudOSS.ToString())
{
//上传到腾讯云OSS
url = _toolsServices.UpLoadBase64ForQCloudOSS(filesStorageOptions, response.RawBytes);
}
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QiNiuKoDo.ToString())
{
//上传到七牛云kodo
url = _toolsServices.UpLoadBase64ForQiNiuKoDo(filesStorageOptions, response.RawBytes);
}
var bl = !string.IsNullOrEmpty(url);
jm.code = bl ? 0 : 1;
jm.msg = bl ? "上传成功!" : "上传失败";
jm.data = new
{
fileUrl = url,
src = url,
path
};
}
else
{
jm.code = 1;
jm.msg = response.ErrorMessage;
}
jm.otherData = response;
return jm;
}
#endregion
#region ============================================================
// POST: Api/Tools/GetDistributionWxCode
/// <summary>
/// 后台生成分销商小程序码
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("后台生成小程序码")]
public async Task<AdminUiCallBack> GetDistributionWxCode([FromBody] FMIntId entity)
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
var userModel = await _userServices.QueryByIdAsync(entity.id);
if (userModel == null)
{
jm.code = 1;
jm.msg = "不存在此信息";
return jm;
}
var userCode = UserHelper.GetShareCodeByUserId(entity.id);
var path = "pages/share/jump/jump?scene=4-" + userCode + "-" + userCode;
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var request = new CgibinWxaappCreateWxaQrcodeRequest();
request.AccessToken = accessToken;
request.Path = path;
var response = await client.ExecuteCgibinWxaappCreateWxaQrcodeAsync(request);
if (response.IsSuccessful())
{
var memStream = new MemoryStream(response.RawBytes);
string url = string.Empty;
if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
{
url = _toolsServices.UpLoadBase64ForLocalStorage(filesStorageOptions, memStream);
}
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.AliYunOSS.ToString())
{
//上传到阿里云
url = await _toolsServices.UpLoadBase64ForAliYunOSS(filesStorageOptions, memStream);
}
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QCloudOSS.ToString())
{
//上传到腾讯云OSS
url = _toolsServices.UpLoadBase64ForQCloudOSS(filesStorageOptions, response.RawBytes);
}
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QiNiuKoDo.ToString())
{
//上传到七牛云kodo
url = _toolsServices.UpLoadBase64ForQiNiuKoDo(filesStorageOptions, response.RawBytes);
}
var bl = !string.IsNullOrEmpty(url);
jm.code = bl ? 0 : 1;
jm.msg = bl ? "上传成功!" : "上传失败";
jm.data = new
{
fileUrl = url,
src = url
};
}
else
{
jm.code = 1;
jm.msg = response.ErrorMessage;
}
jm.otherData = response;
return jm;
}
#endregion
//通用页面获取=========================================================================
#region ====================================================

View File

@@ -763,6 +763,18 @@
</summary>
<returns></returns>
</member>
<member name="M:CoreCms.Net.Web.Admin.Controllers.ToolsController.GetAgentWxCode(CoreCms.Net.Model.FromBody.FMIntId)">
<summary>
后台生成代理商小程序码
</summary>
<returns></returns>
</member>
<member name="M:CoreCms.Net.Web.Admin.Controllers.ToolsController.GetDistributionWxCode(CoreCms.Net.Model.FromBody.FMIntId)">
<summary>
后台生成分销商小程序码
</summary>
<returns></returns>
</member>
<member name="M:CoreCms.Net.Web.Admin.Controllers.ToolsController.GetGoods">
<summary>
获取商品列表

View File

@@ -82,6 +82,7 @@
</script>
<script type="text/html" id="LAY-app-CoreCmsAgent-tableBox-bar">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="qrcode">小程序码</a>
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsAgentTbDelDrop{{d.LAY_NUM}}" no-shade="true">删除</a>
@@ -189,7 +190,7 @@
{ field: 'updateTime', title: '更新时间', width: 130, sort: false },
{ field: 'verifyTime', title: '审核时间', width: 130, sort: false },
//{ field: 'isDelete', title: '是否删除', width: 95, templet: '#switch_isDelete', sort: false, unresize: true },
{ width: 142, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsAgent-tableBox-bar' }
{ width: 222, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsAgent-tableBox-bar' }
]
]
});
@@ -226,6 +227,8 @@
doDelete(obj);
} else if (obj.event === 'edit') {
doEdit(obj)
} else if (obj.event === 'qrcode') {
doQrCode(obj)
}
});
//执行创建操作
@@ -342,6 +345,28 @@
}
});
}
//获取小程序码
function doQrCode(obj) {
coreHelper.Post("Api/Tools/GetAgentWxCode", { id: obj.data.userId }, function (e) {
if (e.code === 0) {
admin.popup({
shadeClose: false,
title: '查看小程序码',
area: ['380px', '480px'],
id: 'LAY-popup-CoreCmsAgent-QrCode',
success: function (layero, index) {
view(this.id).render('agent/agents/qrCode', { data: e.data }).done(function () {
form.render();
});
}
});
} else {
layer.msg(e.msg);
}
});
}
//执行单个删除
function doDelete(obj) {
//console.log(obj.data.id);

View File

@@ -0,0 +1,25 @@
<script type="text/html" template lay-done="layui.data.done(d);">
<div style="text-align: center" lay-filter="LAY-app-CoreCmsAgent-QrCode" id="LAY-app-CoreCmsAgent-QrCode">
<img id="cavasimg" src="{{d.params.data.fileUrl}}" width="300" height="341" style="border: 1px solid #c0c0c0" />
<div style="width: 100%;text-align:center;margin-top: 20px;">
<a class="layui-btn" href="{{d.params.data.fileUrl}}" target="_blank">下载二维码</a>
</div>
</div>
</script>
<script>
var debug = layui.setter.debug;
layui.data.done = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d.params.data); }
layui.use(['admin', 'form', 'coreHelper'], function () {
var $ = layui.$
, setter = layui.setter
, admin = layui.admin
, coreHelper = layui.coreHelper
, form = layui.form;
form.render(null, 'LAY-app-CoreCmsAgent-detailsForm');
});
};
</script>

View File

@@ -103,6 +103,7 @@
<script type="text/html" id="LAY-app-CoreCmsDistribution-tableBox-bar">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="qrcode">小程序码</a>
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">审核</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsDistributionTbDelDrop{{d.LAY_NUM}}" no-shade="true">删除</a>
@@ -219,7 +220,7 @@
{ field: 'updateTime', title: '更新时间', width: 130, sort: false },
{ field: 'verifyTime', title: '审核时间', width: 130, sort: false },
//{ field: 'isDelete', title: '是否删除', width: 95, templet: '#switch_isDelete', sort: false, unresize: true },
{ width: 142, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsDistribution-tableBox-bar' }
{ width: 222, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsDistribution-tableBox-bar' }
]
]
});
@@ -256,6 +257,8 @@
doDelete(obj);
} else if (obj.event === 'edit') {
doEdit(obj)
} else if (obj.event === 'qrcode') {
doQrCode(obj)
}
});
//执行创建操作
@@ -372,6 +375,28 @@
}
});
}
//获取小程序码
function doQrCode(obj) {
coreHelper.Post("Api/Tools/GetDistributionWxCode", { id: obj.data.userId }, function (e) {
if (e.code === 0) {
admin.popup({
shadeClose: false,
title: '查看小程序码',
area: ['380px', '480px'],
id: 'LAY-popup-CoreCmsDistributor-QrCode',
success: function (layero, index) {
view(this.id).render('distribution/distributor/qrCode', { data: e.data }).done(function () {
form.render();
});
}
});
} else {
layer.msg(e.msg);
}
});
}
//执行单个删除
function doDelete(obj) {
//console.log(obj.data.id);

View File

@@ -0,0 +1,25 @@
<script type="text/html" template lay-done="layui.data.done(d);">
<div style="text-align: center" lay-filter="LAY-app-CoreCmsDistributor-QrCode" id="LAY-app-CoreCmsDistributor-QrCode">
<img id="cavasimg" src="{{d.params.data.fileUrl}}" width="300" height="341" style="border: 1px solid #c0c0c0" />
<div style="width: 100%;text-align:center;margin-top: 20px;">
<a class="layui-btn" href="{{d.params.data.fileUrl}}" target="_blank">下载二维码</a>
</div>
</div>
</script>
<script>
var debug = layui.setter.debug;
layui.data.done = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d.params.data); }
layui.use(['admin', 'form', 'coreHelper'], function () {
var $ = layui.$
, setter = layui.setter
, admin = layui.admin
, coreHelper = layui.coreHelper
, form = layui.form;
form.render(null, 'LAY-app-CoreCmsDistributor-detailsForm');
});
};
</script>