diff --git a/app/admin/controller/mall/Item.php b/app/admin/controller/mall/Item.php new file mode 100644 index 0000000..4eeb006 --- /dev/null +++ b/app/admin/controller/mall/Item.php @@ -0,0 +1,72 @@ +model = new \app\common\model\MallItem(); + } + + /** + * 查看 + * @throws Throwable + */ + public function index(\Webman\Http\Request $request): \support\Response + { + $response = $this->initializeBackend($request); + if ($response !== null) { + return $response; + } + + if ($request->get('select') || $request->post('select')) { + $this->_select(); + return $this->success(); + } + + /** + * 1. withJoin 不可使用 alias 方法设置表别名,别名将自动使用关联模型名称(小写下划线命名规则) + * 2. 以下的别名设置了主表别名,同时便于拼接查询参数等 + * 3. paginate 数据集可使用链式操作 each(function($item, $key) {}) 遍历处理 + */ + list($where, $alias, $limit, $order) = $this->queryBuilder(); + $res = $this->model + ->withJoin($this->withJoinTable, $this->withJoinType) + ->visible(['admin' => ['username']]) + ->alias($alias) + ->where($where) + ->order($order) + ->paginate($limit); + + return $this->success('', [ + 'list' => $res->items(), + 'total' => $res->total(), + 'remark' => get_route_remark(), + ]); + } + + /** + * 若需重写查看、编辑、删除等方法,请复制 @see \app\admin\library\traits\Backend 中对应的方法至此进行重写 + */ +} \ No newline at end of file diff --git a/app/common/model/MallItem.php b/app/common/model/MallItem.php new file mode 100644 index 0000000..9cf1066 --- /dev/null +++ b/app/common/model/MallItem.php @@ -0,0 +1,23 @@ +belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id'); + } +} \ No newline at end of file diff --git a/app/common/validate/MallItem.php b/app/common/validate/MallItem.php new file mode 100644 index 0000000..79a1a41 --- /dev/null +++ b/app/common/validate/MallItem.php @@ -0,0 +1,31 @@ + [], + 'edit' => [], + ]; + +} diff --git a/web/src/lang/backend/en/mall/item.ts b/web/src/lang/backend/en/mall/item.ts new file mode 100644 index 0000000..059f152 --- /dev/null +++ b/web/src/lang/backend/en/mall/item.ts @@ -0,0 +1,17 @@ +export default { + id: 'id', + title: 'title', + description: 'description', + remark: 'remark', + score: 'score', + '类型': '类型', + '类型 1': '类型 1', + '类型 2': '类型 2', + '类型 3': '类型 3', + admin_id: 'admin_id', + admin__username: 'username', + sort: 'sort', + create_time: 'create_time', + update_time: 'update_time', + 'quick Search Fields': 'id', +} diff --git a/web/src/lang/backend/zh-cn/mall/item.ts b/web/src/lang/backend/zh-cn/mall/item.ts new file mode 100644 index 0000000..cfb997d --- /dev/null +++ b/web/src/lang/backend/zh-cn/mall/item.ts @@ -0,0 +1,17 @@ +export default { + id: 'ID', + title: '标题', + description: '描述', + remark: '备注', + score: '兑换积分', + '类型': '类型', + '类型 1': '奖励', + '类型 2': '充值', + '类型 3': '实物', + admin_id: '创建管理员', + admin__username: '用户名', + sort: '排序', + create_time: '创建时间', + update_time: '修改时间', + 'quick Search Fields': 'ID', +} diff --git a/web/src/views/backend/mall/item/index.vue b/web/src/views/backend/mall/item/index.vue new file mode 100644 index 0000000..7c2d555 --- /dev/null +++ b/web/src/views/backend/mall/item/index.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/web/src/views/backend/mall/item/popupForm.vue b/web/src/views/backend/mall/item/popupForm.vue new file mode 100644 index 0000000..f56ea20 --- /dev/null +++ b/web/src/views/backend/mall/item/popupForm.vue @@ -0,0 +1,134 @@ + + + + +