This commit is contained in:
2023-11-07 17:15:33 +08:00
commit fe37e2e1df
418 changed files with 53012 additions and 0 deletions
+147
View File
@@ -0,0 +1,147 @@
<template>
<view>
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</view>
</template>
<script>
export default {
data() {
return {
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "admin/site_config/sys/update",
// 表单字段显示规则
columns: [
{
title: "基本信息",
type: "bar-title",
placeholder: ""
},
{
key: "siteLogo",
title: "LOGO",
type: "image",
placeholder: "请上传LOGO",
limit: 1
},
{
key: "siteTitle",
title: "网站标题",
type: "text",
placeholder: "请输入网站标题"
},
{
key: "siteDesc",
title: "网站描述",
type: "text",
placeholder: "请输入网站描述"
},
{
key: "siteCopyright",
title: "版权信息",
type: "text",
placeholder: "请输入版权信息"
},
{
key: "siteIcpNumber",
title: "ICP备案号",
type: "text",
placeholder: "请输入ICP备案号"
},
{
title: "联系方式",
type: "bar-title",
placeholder: ""
},
{
key: "companyName",
title: "公司名称",
type: "text",
placeholder: "请输入公司名称"
},
{
key: "companyAddress",
title: "公司地址",
type: "text",
placeholder: "请输入公司地址"
},
{
key: "companyPhone",
title: "公司电话",
type: "text",
placeholder: "请输入公司电话"
},
{
key: "companyEmail",
title: "公司邮箱",
type: "text",
placeholder: "请输入公司邮箱"
},
{
key: "companyServicePhone",
title: "客服热线",
type: "text",
placeholder: "请输入客服热线"
},
{
key: "companyMobileSiteImage",
title: "手机站二维码",
type: "image",
limit: 1,
placeholder: "请上传收手机站上二维码"
},
{
key: "companyGzhImage",
title: "公众号二维码",
type: "image",
limit: 1,
placeholder: "请上传公众号二维码"
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name:[
{ required:true, message:'分类名称不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
};
},
onLoad() {
//
vk.callFunction({
url: 'admin/site_config/sys/detail',
title: '请求中...',
success: (res) => {
this.form1.data = res.data
}
});
},
methods: {
},
}
</script>
<style lang="scss">
</style>
+320
View File
@@ -0,0 +1,320 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/enquiry/attributes/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "label",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key:"values", title:"可选值", type:"tag",width: 500
},
{ key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false, width: 100 },
// {
// key: "remark",
// title: "备注",
// type: "text",
// align: "left",
// width: 220
// },
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
enable: true
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key:"label", title:"属性名称", type:"text", placeholder:"输入属性名称",
rules:[
{ required:true, message:"该项不能为空", trigger:["change","blur"] },
]
},
{ key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false, width: 100 },
{
key:"values", title:"可选值", type:"tag", placeholder:"输入可选值",
rules:[
{ required:true, message:"该项不能为空", trigger:["change","blur"] },
]
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
},{ required:true, message:'不能为空', trigger:'blur' },],
label:[
{ required:true, message:'属性名称不能为空', trigger:'blur' },
],
values:[
{ required:true, message:'可选值不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/enquiry/attributes/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/enquiry/attributes/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/enquiry/attributes/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
</script>
<style lang="scss" scoped>
.page-body {}
</style>
+335
View File
@@ -0,0 +1,335 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/enquiry/template/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{ key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false, width: 100 },
// {
// key: "remark",
// title: "备注",
// type: "text",
// align: "left",
// width: 220
// },
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
enable: true
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "模板名称",
type: "text",
placeholder: "请输入模板名称"
},
{ key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false },
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
{
key:"extraAttributes", title:"额外属性", type:"array<object>", itemWidth:260,
showAdd:true,
showClear:true,
// 新增一行时,该行的默认值
defaultValue:{
label:""
},
rightBtns:['copy', 'delete'],
// 每行每个字段对应的渲染规则
columns:[
{
key:"label", title:"属性名称", type:"text", placeholder:"输入属性名称",
rules:[
{ required:true, message:"该项不能为空", trigger:["change","blur"] },
]
},
{
key:"values", title:"可选值", type:"tag", placeholder:"输入可选值",
rules:[
{ required:true, message:"该项不能为空", trigger:["change","blur"] },
]
},
]
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
},{ required:true, message:'不能为空', trigger:'blur' },],
enable:[
{ required:true, message:'不能为空', trigger:'blur' },
],
name:[
{ required:true, message:'模板名称不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/enquiry/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/enquiry/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/enquiry/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
</script>
<style lang="scss" scoped>
.page-body {}
</style>
+79
View File
@@ -0,0 +1,79 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
这里是后台首页
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
export default {
data() {
// 页面数据变量
return {
// init请求返回的数据
data:{
},
// 表单请求数据
form1:{
}
}
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady(){
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options){
},
pageTo(path){
vk.navigateTo(path);
},
load(e){
console.log(1,e);
},
error(e){
console.log(2,e);
}
},
// 过滤器
filters:{
},
// 计算属性
computed:{
}
}
</script>
<style lang="scss" scoped>
</style>
+276
View File
@@ -0,0 +1,276 @@
<template>
<view class="page-body no-user-select">
<view class="login-view">
<image class="image" :src="vk.getVuex('$app.staticUrl.navBar.logo')" mode="aspectFit"></image>
<text class="login-title">欢迎登录</text>
<el-form :model="form1" status-icon :rules="rules" ref="form1" label-width="60px" class="form-view">
<el-form-item label="账 号" prop="pass" class="form-item"><el-input class="input" type="text" v-model="form1.username" placeholder="请输入用户名"></el-input></el-form-item>
<el-form-item label="密 码" prop="checkPass" class="form-item">
<el-input class="input" type="password" v-model="form1.password" show-password placeholder="请输入密码" maxlength="20"></el-input>
</el-form-item>
<view class="password-box">
<view class="remember-password">
<el-checkbox v-model="checked"><text class="tips" style="font-size: 12px;">记住密码</text></el-checkbox>
</view>
<view class="forget-password"><text @click="forgetPassWord" style="font-size: 12px;">忘记密码?</text></view>
</view>
<el-button class="login_but" type="primary" @click="submit">登录</el-button>
</el-form>
<view v-if="testUser && testUser.show && testUser.list && testUser.list.length > 0" class="test-user-list">
<view>体验账号:</view>
<view v-for="(item, index) in testUser.list" :key="index" class="test-user-item">
<text class="test-user-item-nickname">{{ item.nickname }}</text>
<text class="test-user-item-username">账号:{{ item.username }}</text>
<text class="test-user-item-password">密码:{{ item.password }}</text>
</view>
</view>
<!-- <view class="btns-box">
<text @click="shortMessageLogin">短信验证码登录</text>
<text @click="noCccount">没有账号?</text>
<text class="register" @click="register">立即注册</text>
</view> -->
</view>
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
import config from "@/app.config.js";
export default {
data() {
return {
...config.staticUrl.navBar,
testUser: (config.login && config.login.testUser) || {}, // 体验账号信息
// 表单信息
form1: {
username: "",
password: "",
needPermission: true
},
checked: false, // 是否记录密码
// 表单验证规则
rules: {
},
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
mounted() {},
methods: {
// 页面初始化
init() {
let that = this;
let { login } = vk.getVuex("$user");
if (login) {
if (login.username) that.form1.username = login.username;
if (login.password) {
that.form1.password = login.password;
that.checked = true;
}
}
if (!getApp().isAllowLoginBackground()) {
return false;
}
// 执行以下函数,主要是为了使云函数提前热启动
vk.userCenter.checkToken({
loading: true,
success: data => {
that.login_success(data);
}
});
},
// 表单提交
submit() {
let that = this;
vk.userCenter.login({
data: that.form1,
success: data => {
if (!getApp().isAllowLoginBackground(data.userInfo)) {
vk.alert("您的账户无登陆权限");
return false;
}
if (that.checked) {
// 账号密码保存本地缓存
vk.setVuex("$user.login.username", that.form1.username);
vk.setVuex("$user.login.password", that.form1.password);
} else {
// 删除本地缓存
vk.setVuex("$user.login.username", "");
vk.setVuex("$user.login.password", "");
}
that.login_success(data);
}
});
},
//登陆成功
login_success(data={}) {
let { userInfo={} } = data;
// 先清空下菜单缓存
vk.setVuex("$app.inited", false);
vk.setVuex("$app.navMenu", []);
// 再执行init函数
getApp().init();
// 最后跳转到首页或页面返回
let pages = getCurrentPages();
if (
pages.length >= 2 &&
pages[pages.length - 2] &&
pages[pages.length - 2].route &&
pages[pages.length - 2].route.indexOf("login/") == -1
) {
// 如果上一个页面不是login目录下的,则调上一个页面
vk.reLaunch("/" + pages[pages.length - 2].route);
} else {
// 否则进入首页
vk.navigateToHome();
}
},
forgetPassWord() {
console.log(`忘记密码了`);
vk.toast("暂不支持", "none");
},
shortMessageLogin() {
console.log(`短信登录`);
},
noCccount() {
console.log(`没有账号`);
},
register() {
console.log(`立即注册`);
vk.toast("暂不支持注册", "none");
}
}
};
</script>
<style lang="scss" scoped>
.page-body {
width: 100%;
height: 100vh;
background: #46d0e7 url(../../static/bg/007.jpg?t=2) no-repeat fixed center center;
background-size: cover;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.login-view:hover {
background-color: rgba(255, 255, 255, 1);
}
.login-view {
width: 100%;
max-width: 420px;
border-radius: 7px;
background-color: rgba(255, 255, 255, 0.97);
padding: 40px 30px;
box-sizing: border-box;
border: 1px solid #f5f5f5;
box-shadow: 6px 6px 10px 0px #888888;
::v-deep .input .el-input__inner {
border: 0 !important;
background-color: rgba(255, 255, 255, 0);
}
.image {
display: block;
width: 64px;
height: 64px;
margin: 0 auto;
margin-bottom: 15px;
border-radius: 6px;
}
.form-view {
margin-top: 20px;
.form-item {
border-bottom: 1px solid #f5f5f5;
}
}
.login-title {
display: block;
text-align: center;
color: #121212;
font-size: 22px;
letter-spacing: 2px;
}
.login_but {
width: 100%;
letter-spacing: 4px;
font-size: 17px;
}
.password-box {
font-size: 13px;
color: #b1b1b1;
margin-bottom: 20px;
display: flex;
align-items: center;
.remember-password {
flex: 1;
cursor: pointer;
user-select: none;
}
.forget-password {
flex: 1;
text-align: right;
cursor: pointer;
user-select: none;
&:active {
color: #3a6ffd;
}
}
}
.tips {
color: #b1b1b1;
}
.btns-box {
font-size: 13px;
color: #b1b1b1;
padding-top: 25px;
display: flex;
box-sizing: border-box;
text {
cursor: pointer;
&:first-of-type {
flex: 1;
}
&:nth-of-type(2) {
margin-right: 8px;
}
}
.register {
color: #46d0e7;
}
}
}
.test-user-list {
margin-top: 10px;
user-select: text;
font-size: 12px;
color: #606266;
.test-user-item {
margin: 5px 0;
.test-user-item-nickname {
}
.test-user-item-username {
margin-left: 10px;
}
.test-user-item-password {
margin-left: 10px;
}
}
}
}
</style>
+358
View File
@@ -0,0 +1,358 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/spot/goods/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "address",
title: "供货地",
type: "address",
width: 220,
align: "left",
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "files",
title: "附件",
type: "file",
// align: "left",
width: 220
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
name: ''
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称",
disabled: true
},
{
key: "categoryIds",
title: "分类",
type: "checkbox",
placeholder: "请选分类",
action: "admin/spot/category/sys/getList",
actionData: {level: 2},
min:1,
max: 5,
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
watch: (obj)=> {
console.log(obj);
this.form1.data.name = obj.option.map(item => item.name),join("、")
}
},
{
key: "address",
title: "供货地",
type: "address",
placeholder: "请输入供货地",
},
{
key: "files",
title: "附件",
type: "file",
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name:[
{ required:true, message:'分类名称不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/spot/goods/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/spot/goods/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/product/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
</script>
<style lang="scss" scoped>
.page-body {}
/deep/.el-checkbox-group .direction-row{
flex-wrap: wrap;
}
</style>
+338
View File
@@ -0,0 +1,338 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="500px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/spot/category/sys/getTree",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
// {
// key: "parent_id",
// title: "上级id",
// type: "text",
// width: 220,
// },
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name:[
{ required:true, message:'分类名称不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/spot/category/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/spot/category/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/product/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
</script>
<style lang="scss" scoped>
.page-body {}
</style>
@@ -0,0 +1,74 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
这里是页面内容
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
export default {
data() {
// 页面数据变量
return {
// init请求返回的数据
data:{
},
// 表单请求数据
form1:{
}
}
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady(){
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options){
},
// 页面跳转
pageTo(path){
vk.navigateTo(path);
},
},
// 过滤器
filters:{
},
// 计算属性
computed:{
}
}
</script>
<style lang="scss" scoped>
.page-body{
}
</style>