Commit 4613efb9 authored by 冯超鹏's avatar 冯超鹏

添加新的功能

parent 63a41b4c
Pipeline #19 failed with stages
<?php
namespace App\Http\Controllers;
use App\Http\Resources\PermissionResource;
use App\Http\Requests\UsersRequest;
use App\Http\Resources\UserResource;
use App\Laravue\JsonResponse;
use App\Laravue\Models\Device;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redis;
use Validator;
class DevicesController extends Controller
{
//设备列表
/*
* 设备类型
* type 不传默认是第一个
* @type 设备类型id
* */
public function devicelist(Request $request){
$type = $request->input('type');//设备类型id
$pagenNum=$request->input('page')-1;//页数
$limit = $request->input('limit');
if($pagenNum === '' || $limit == ''){
return $this->jsonErrorData(105,'页数或limit不能为空');
}
return $this->jsonSuccessData($this->whertype($type==''? '1':$type,$pagenNum,$limit));
}
/*
* 删除设备
* type 1==逻辑删除
* type 2== 物理删除
* */
public function deletedecice(Request $request){
$type = (int)$request->input('type');
$deviceid = (int)$request->input('deviceid');//设备id
if ($type == '' || $deviceid == ''){
return $this->jsonErrorData(105,'参数不能为空');
}
if ($type == 1){//逻辑删除
$dete = Device::where('id','=',$deviceid)
->value('delete');
if ($dete != 1){
$update = Device::where('id','=',$deviceid)
->update(['delete'=>1]);
return $this->jsonSuccessData($update);
}else{
return $this->jsonErrorData(105,'数据异常');
}
}else if ($type == 2){//物理删除
$dete = Device::where('id','=',$deviceid)
->value('delete');
if ($dete != 2){
$delete = Device::where('id','=',$deviceid)
->delete();
return $this->jsonSuccessData($delete);
}else{
return $this->jsonErrorData(105,'数据异常');
}
}
}
//添加设备
public function adddevice(Request $request){
}
//返回设备类型和单位和介质
public function devicetype(){
$databadevice = DB::table('device_type')->get();
$gas = DB::table('gas')->get();
$danwei = DB::table('danwei')->get();
return $this->jsonSuccessData(['devicetype'=>$databadevice,'gas'=>$gas,'danwei'=>$danwei]);
}
//返回设备列表
private function whertype($type,$pagenNum,$limit) : array {
$databadevice = DB::table('device');
$devicelist = $databadevice
->where('dtype','=',$type)
->join('device_type as dy',"device.dtype",'=','dy.tid')
->join('gas as g',"device.status",'=','g.id')
->select('dy.tname','g.gas','device.*')
->orderBy('device.id', 'desc')
->offset($pagenNum)
->limit($limit)
->get()->toArray();
return $devicelist;
}
/**
* @param bool $isNew
* @return array
* 用户添加设备表单验证
*/
private function getValidationRulesdevice($isNew = true)
{
return [
'devicenum'=>'required|between:2,25|regex:/^[A-Za-z0-9\-\_]+$/|unique:BackgroundUser,username',
'password'=> 'sometimes|required|string|min:6',
'contacts_phone'=> 'required|regex:/^1[3465789]\d{9}$/|unique:BackgroundUser',
'nickname'=>'required|between:2,25|regex:/^[A-Za-z0-9\-\_]+$/|unique:BackgroundUser,nickname'
];
}
}
\ No newline at end of file
...@@ -225,6 +225,22 @@ class UserController extends Controller ...@@ -225,6 +225,22 @@ class UserController extends Controller
]; ];
} }
/**
* @param bool $isNew
* @return array
* 用户提交表单验证
*/
private function getValidationRulesuser($isNew = true)
{
return [
'email' => $isNew ? 'required|email|unique:users' : 'required|email',
'username'=>'required|between:2,25|regex:/^[A-Za-z0-9\-\_]+$/|unique:BackgroundUser,username',
'password'=> 'sometimes|required|string|min:6',
'contacts_phone'=> 'required|regex:/^1[3465789]\d{9}$/|unique:BackgroundUser',
'nickname'=>'required|between:2,25|regex:/^[A-Za-z0-9\-\_]+$/|unique:BackgroundUser,nickname'
];
}
// 后台管理用户列表 // 后台管理用户列表
public function HUserList(Request $request){ public function HUserList(Request $request){
$pagenNum=$request->input('page')-1;//页数 $pagenNum=$request->input('page')-1;//页数
...@@ -247,32 +263,117 @@ class UserController extends Controller ...@@ -247,32 +263,117 @@ class UserController extends Controller
} }
//新增用户 //新增用户
public function addUser(Request $request){ public function addUser(Request $request){
$userdata = $request->all();
//获取用户列表 //获取用户列表
$userdata=$request->all(); $validator = Validator::make($request->all(), $this->getValidationRulesuser(false,false));
$validator = Validator::make(
$request->all(),
array_merge(
$this->getValidationRules(),
[
'username'=>'required|between:3,25|regex:/^[A-Za-z0-9\-\_]+$/|unique:BackgroundUser,username',
'password'=>'required|string|min:6',
'phone'=> 'required|regex:/^1[3465789]\d{9}$/|unique:phone',
'email'=>'email',
]
)
);
if ($validator->fails()) { if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 403); return response()->json(['errors' => $validator->errors()], 403);
}else{ }else{
foreach ($userdata as $k =>$val){ $type = new Users();
if (!is_null($val)){ $arr = $type->getTypeAllToArray($userdata);
$type = new Users(); return $this->jsonSuccessData($arr);
$arr = $type->getTypeAllToArray($userdata); }
return $this->jsonSuccessData($arr); }
/*
* 删除用户
* type
* 1 == 逻辑删除用户
* 2 == 物理删除用户
* duserid 删除用户的id
* */
public function deleteuser(Request $request){
$type = (int)$request->input('type');
$duserid = (int)$request->input('duserid');
if($type == ''){
return $this->jsonErrorData(105,'type参数不能为空');
}
if($duserid == ''){
return $this->jsonErrorData(105,'duserid参数不能为空');
}
if($type == 1){ // 逻辑删除
$users = Users::where('id','=',$duserid)
->update(['state'=>1]);
if($users){
return $this->jsonSuccessData($users);
}else{
return $this->jsonErrorData(105,'获取用户数据失败');
}
}else if($type == 2){
$users = Users::where('id','=',$duserid)
->delete();
if($users){
return $this->jsonSuccessData($users);
}else{
return $this->jsonErrorData(105,'获取用户数据失败');
}
}
}
//更新用户
public function Upuser(Request $request){
if($_POST){
$userdata = $request->all();
$uid = $userdata['userid'];
if(!isset($userdata['userid']) || $userdata['userid'] == ''){
return $this->jsonErrorData(105,'用户id不能为空');
}
$validator = Validator::make($request->all(), $this->getValidationRulesuser(false));
if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 403);
}else{
foreach ($userdata as $k=>$v){
if ($k == 'userid'){
unset($userdata[$k]);
}
}
$re =Users::where('id','=',(int)$uid)->update($userdata);
if ($re){
return $this->jsonSuccessData($re);
}else{ }else{
return $this->jsonErrorData(105,'完善表单信息'); return $this->jsonErrorData(105,'更新失败');
} }
} }
}else{
// 获取用户数据
$userid = (int)$request->input('userid');
if($userid == ''){
return $this->jsonErrorData(105,'用户id不能为空');
}
$userdata = Users::where('id','=',$userid)
->select('username','nickname','contacts_name','contacts_phone','email','title','company','mapcenter')
->where('state','=',2)
->first();
if ($userdata){
return $this->jsonSuccessData($userdata);
}else{
return $this->jsonErrorData(105,'获取数据失败');
}
} }
} }
//返回地址列表
public function areachina (Request $request){
$region = Db::table('areachina');
if($_POST){
$areaid = $request->input('areaid');
if($areaid == ''){
return $this->jsonErrorData('105','地区id不能为空');
}
$area = $region->where('pid','=',$areaid)
->where('status','=','1')
->select('area_name','areaid')
->get();
}else{
$area = $region->where('pid','=','0')
->where('status','=','1')
->select('area_name','areaid')
->get();
}
if($area){
return $this->jsonSuccessData($area);
}else{
return $this->jsonErrorData(105,'获取失败');
}
}
} }
...@@ -26,7 +26,10 @@ class WxuserController extends Controller ...@@ -26,7 +26,10 @@ class WxuserController extends Controller
* */ * */
$pagenNum=$request->input('page')-1;//页数 $pagenNum=$request->input('page')-1;//页数
$limit = $request->input('limit'); $limit = $request->input('limit');
$Wxuser = Wxuser::select('nickname','id','sex','province','city','mobile','country','headimgurl','created_at','state') if($pagenNum === '' || $limit == ''){
return $this->jsonErrorData(105,'页数或limit不能为空');
}
$Wxuser = Wxuser::select('nickname','id','openid','sex','province','city','mobile','country','headimgurl','created_at','state')
->offset($pagenNum) ->offset($pagenNum)
->orderBy('id', 'desc') ->orderBy('id', 'desc')
->limit($limit) ->limit($limit)
......
<?php
namespace App\Laravue\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Passport\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
class Device extends Authenticatable
{
use Notifiable, HasRoles, HasApiTokens;
protected $table = "device";
public $timestamps = false;
}
...@@ -25,14 +25,8 @@ class Users extends Authenticatable ...@@ -25,14 +25,8 @@ class Users extends Authenticatable
public $timestamps = false; public $timestamps = false;
public function getTypeAllToArray($userdata = []) { public function getTypeAllToArray($userdata = []) {
$check = '/^(1(([356789][0-9])|(47)))\d{8}$/'; $userdata['password'] = sha1($userdata['password']);
if($userdata == []){ $userdata['add_time'] = time();
return "表单值不能为空";
}
if(!preg_match($check,$userdata['contacts_phone'])){
return "手机号格式错误";
}
$userdata['password'] = sha1($userdata['password']);
return $this->insertGetId($userdata); return $this->insertGetId($userdata);
} }
} }
\ No newline at end of file
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
"laravel/passport": "^8.4", "laravel/passport": "^8.4",
"laravel/tinker": "^2.0", "laravel/tinker": "^2.0",
"league/flysystem-aws-s3-v3": "^1.0", "league/flysystem-aws-s3-v3": "^1.0",
"predis/predis": "^1.1",
"spatie/laravel-permission": "^3.0" "spatie/laravel-permission": "^3.0"
}, },
"require-dev": { "require-dev": {
......
...@@ -14620,6 +14620,22 @@ ...@@ -14620,6 +14620,22 @@
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
}, },
"v-viewer": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/v-viewer/-/v-viewer-1.5.1.tgz",
"integrity": "sha512-Q5ICKzmYQD0qTf+hti2Lhgy6UYY2zgFr+YrN9a3yPgr7pOjYrG405Pz4+6Z6FXlhdhGysCWFJUNCI2tsIyvjWQ==",
"requires": {
"throttle-debounce": "^2.0.1",
"viewerjs": "^1.5.0"
},
"dependencies": {
"throttle-debounce": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-2.1.0.tgz",
"integrity": "sha512-AOvyNahXQuU7NN+VVvOOX+uW6FPaWdAOdRP5HfwYxAfCzXTFKRMoIMk+n+po318+ktcChx+F1Dd91G3YHeMKyg=="
}
}
},
"v8-compile-cache": { "v8-compile-cache": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz",
...@@ -14657,6 +14673,11 @@ ...@@ -14657,6 +14673,11 @@
"extsprintf": "^1.2.0" "extsprintf": "^1.2.0"
} }
}, },
"viewerjs": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/viewerjs/-/viewerjs-1.5.0.tgz",
"integrity": "sha512-ZiJ0vrXDvomLSY3ixaZCJtmdenomsvPPQwZKwvtXUMCiO2HHtFGoB/KqpS9QzABSeKaRLfcENp1uRYJ7l1MkYQ=="
},
"vm-browserify": { "vm-browserify": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz",
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"report": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --report --config=node_modules/laravel-mix/setup/webpack.config.js", "report": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --report --config=node_modules/laravel-mix/setup/webpack.config.js",
"lint": "eslint --ext .js,.vue resources/js", "lint": "eslint --ext .js,.vue resources/js",
"startb": "nodemon --watch src -e html,vue,js,scss build/build.js", "startb": "nodemon --watch src -e html,vue,js,scss build/build.js",
"start":"npm run dev" "start": "npm run dev"
}, },
"husky": { "husky": {
"hooks": { "hooks": {
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
"fideloper/proxy": "^4.0", "fideloper/proxy": "^4.0",
"laravel/framework": "^6.2", "laravel/framework": "^6.2",
"laravel/tinker": "^1.0", "laravel/tinker": "^1.0",
"symfony/translation-contracts": "^1.1.6", "symfony/translation-contracts": "^1.1.6"
}, },
"devDependencies": { "devDependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-dynamic-import": "^7.8.3",
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
"screenfull": "^4.2.1", "screenfull": "^4.2.1",
"sortablejs": "^1.10.2", "sortablejs": "^1.10.2",
"tui-editor": "^1.4.6", "tui-editor": "^1.4.6",
"v-viewer": "^1.5.1",
"vue": "2.6.10", "vue": "2.6.10",
"vue-count-to": "^1.0.13", "vue-count-to": "^1.0.13",
"vue-i18n": "^8.15.5", "vue-i18n": "^8.15.5",
......
...@@ -40,6 +40,12 @@ class Resource { ...@@ -40,6 +40,12 @@ class Resource {
method: 'delete', method: 'delete',
}); });
} }
wxuser(){
return request({
url: '/' + this.uri,
method: 'get',
});
}
} }
export { Resource as default }; export { Resource as default };
import request from '@/utils/request';
import Resource from '@/api/resource';
class UserResource extends Resource {
constructor() {
super('wxuser');
}
permissions(id) {
return request({
url: '/' + this.uri + '/' + id + '/permissions',
method: 'get',
});
}
updatePermission(id, permissions) {
return request({
url: '/' + this.uri + '/' + id + '/permissions',
method: 'put',
data: permissions,
});
}
}
export { UserResource as default };
\ No newline at end of file
...@@ -14,7 +14,6 @@ Vue.use(ElementUI, { ...@@ -14,7 +14,6 @@ Vue.use(ElementUI, {
size: Cookies.get('size') || 'medium', // set element-ui default size size: Cookies.get('size') || 'medium', // set element-ui default size
i18n: (key, value) => i18n.t(key, value), i18n: (key, value) => i18n.t(key, value),
}); });
// register global utility filters. // register global utility filters.
Object.keys(filters).forEach(key => { Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key]); Vue.filter(key, filters[key]);
......
...@@ -126,6 +126,7 @@ export default { ...@@ -126,6 +126,7 @@ export default {
reviewer: '审核人', reviewer: '审核人',
id: '序号', id: '序号',
date: '时间', date: '时间',
username: '账号名称',
author: '作者', author: '作者',
readings: '阅读数', readings: '阅读数',
status: '状态', status: '状态',
...@@ -136,6 +137,7 @@ export default { ...@@ -136,6 +137,7 @@ export default {
delete: '删除', delete: '删除',
cancel: '取 消', cancel: '取 消',
confirm: '确 定', confirm: '确 定',
openid: 'openid',
}, },
errorLog: { errorLog: {
tips: '请点击右上角bug小图标', tips: '请点击右上角bug小图标',
......
...@@ -81,3 +81,4 @@ export default { ...@@ -81,3 +81,4 @@ export default {
}, },
}, },
}; };
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<el-input v-model="listQuery.title" :placeholder="$t('table.title')" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" /> <el-input v-model="listQuery.title" placeholder="用户名称或关键字" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
<el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter"> <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">
{{ $t('table.search') }} {{ $t('table.search') }}
</el-button> </el-button>
<el-button v-waves :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload"> <el-button v-waves :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload">
{{ $t('table.export') }} {{ $t('table.export') }}
</el-button> </el-button>
<el-checkbox v-model="showReviewer" class="filter-item" style="margin-left:15px;" @change="tableKey=tableKey+1">
{{ $t('table.openid') }}
</el-checkbox>
</div> </div>
<el-table <el-table
...@@ -17,53 +20,84 @@ ...@@ -17,53 +20,84 @@
border border
fit fit
highlight-current-row highlight-current-row
style="width: 100%;" style="width: 98%;"
@sort-change="sortChange" @sort-change="sortChange"
> >
<el-table-column :label="$t('table.id')" prop="id" sortable="custom" align="center" width="80"> <el-table-column label="ID" prop="id" sortable="custom" align="center" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.id }}</span> <span>{{ scope.row.id }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('table.date')" width="150px" align="center"> <el-table-column v-if="showReviewer" label="openid" width="150px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span> <span>{{ scope.row.openid }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('table.title')" min-width="150px"> <el-table-column label="用户头像" align="center" width="120">
<template slot-scope="{row}"> <template slot-scope="scope">
<span class="link-type" @click="handleUpdate(row)">{{ row.title }}</span> <el-image :src="scope.row.headimgurl":fit="fit"></el-image>
<el-tag>{{ row.type | typeFilter }}</el-tag> </template>
</el-table-column>
<el-table-column label="用户名称" width="130px" align="center">
<template slot-scope="scope">
<span>{{ scope.row.nickname }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('table.author')" width="110px" align="center"> <el-table-column label="性别" width="120px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.author }}</span> <span>{{ scope.row.author }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="showReviewer" :label="$t('table.reviewer')" width="110px" align="center"> <el-table-column label="省份" width="140px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span style="color:red;">{{ scope.row.reviewer }}</span> <span>{{ scope.row.province }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('table.importance')" width="80px"> <el-table-column label="country" align="center" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<svg-icon v-for="n in +scope.row.importance" :key="n" icon-class="star" class="meta-item__icon" /> <span>{{ scope.row.country }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('table.readings')" align="center" width="95"> <el-table-column label="城市" width="140px" align="center">
<template slot-scope="{row}"> <template slot-scope="scope">
<span v-if="row.pageviews" class="link-type" @click="handleFetchPv(row.pageviews)">{{ row.pageviews }}</span> <span>{{ scope.row.city }}</span>
<span v-else>0</span> </template>
</el-table-column>
<el-table-column label="手机号" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.mobile }}</span>
</template>
</el-table-column>
<!-- | parseTime('{y}-{m}-{d} {h}:{i}') -->
<el-table-column label="创建时间" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.created_at | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('table.status')" class-name="status-col" width="100"> <!-- 状态 后续需要加 -->
<!-- <el-table-column :label="$t('table.status')" class-name="status-col" width="100">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-tag :type="row.status | statusFilter"> <el-tag :type="row.status | statusFilter">
{{ row.status }} {{ row.status }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('table.actions')" align="center" width="230" class-name="small-padding fixed-width">
<template slot-scope="{row}">
<el-button type="primary" size="mini" @click="handleUpdate(row)">
{{ $t('table.edit') }}
</el-button>
<el-button v-if="row.status!='published'" size="mini" type="success" @click="handleModifyStatus(row,'published')">
{{ $t('table.publish') }}
</el-button>
<el-button v-if="row.status!='draft'" size="mini" @click="handleModifyStatus(row,'draft')">
{{ $t('table.draft') }}
</el-button>
<el-button v-if="row.status!='deleted'" size="mini" type="danger" @click="handleModifyStatus(row,'deleted')">
{{ $t('table.delete') }}
</el-button>
</template>
</el-table-column> -->
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
...@@ -116,9 +150,11 @@ ...@@ -116,9 +150,11 @@
</template> </template>
<script> <script>
import { fetchList, fetchPv, createArticle, updateArticle } from '@/api/article'; import { fetchPv, createArticle, updateArticle } from '@/api/article';
import waves from '@/directive/waves'; // Waves directive import waves from '@/directive/waves'; // Waves directive
import { parseTime } from '@/utils'; import { parseTime } from '@/utils';
import Resource from '@/api/resource';
const WxuserResource = new Resource('wxuser/wxlist?page=1&limit=1');
import Pagination from '@/components/Pagination'; // Secondary package based on el-pagination import Pagination from '@/components/Pagination'; // Secondary package based on el-pagination
const calendarTypeOptions = [ const calendarTypeOptions = [
{ key: 'CN', display_name: 'China' }, { key: 'CN', display_name: 'China' },
...@@ -134,7 +170,7 @@ const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => { ...@@ -134,7 +170,7 @@ const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
}, {}); }, {});
export default { export default {
name: 'ComplexTable', name: 'WXUser',
components: { Pagination }, components: { Pagination },
directives: { waves }, directives: { waves },
filters: { filters: {
...@@ -153,7 +189,7 @@ export default { ...@@ -153,7 +189,7 @@ export default {
data() { data() {
return { return {
tableKey: 0, tableKey: 0,
list: null, list: [],
total: 0, total: 0,
listLoading: true, listLoading: true,
listQuery: { listQuery: {
...@@ -163,8 +199,8 @@ export default { ...@@ -163,8 +199,8 @@ export default {
title: undefined, title: undefined,
type: undefined, type: undefined,
sort: '+id', sort: '+id',
fits: ['fill', 'contain', 'cover', 'none', 'scale-down'],
}, },
importanceOptions: [1, 2, 3],
calendarTypeOptions, calendarTypeOptions,
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }], sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
statusOptions: ['published', 'draft', 'deleted'], statusOptions: ['published', 'draft', 'deleted'],
...@@ -200,11 +236,8 @@ export default { ...@@ -200,11 +236,8 @@ export default {
methods: { methods: {
async getList() { async getList() {
this.listLoading = true; this.listLoading = true;
const { data } = await fetchList(this.listQuery); const { data } = await WxuserResource.list({});
this.list = data.items; this.list = data;
this.total = data.total;
// Just to simulate the time of the request
this.listLoading = false; this.listLoading = false;
}, },
handleFilter() { handleFilter() {
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<script src=/static/tinymce4.7.5/tinymce.min.js></script> <script src=/static/tinymce4.7.5/tinymce.min.js></script>
<script src="{{ mix('js/vendor.js') }}"></script> <script src="{{ mix('js/vendor.js') }}"></script>
<script src="{{ mix('js/manifest.js') }}"></script> <!-- <script src="{{ mix('js/manifest.js') }}"></script> -->
<script src="{{ mix('js/app.js') }}"></script> <script src="{{ mix('js/app.js') }}"></script>
</body> </body>
</html> </html>
...@@ -29,6 +29,17 @@ Route::group(['middleware' => 'auth:api'], function () { ...@@ -29,6 +29,17 @@ Route::group(['middleware' => 'auth:api'], function () {
Route::get('wxuser/wxlist', 'WxuserController@wxlist');//微信用户列表 Route::get('wxuser/wxlist', 'WxuserController@wxlist');//微信用户列表
Route::get('user/HUserList', 'UserController@HUserList');//用户列表 Route::get('user/HUserList', 'UserController@HUserList');//用户列表
Route::post('user/addUser', 'UserController@addUser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//新增用户 Route::post('user/addUser', 'UserController@addUser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//新增用户
Route::post('user/deleteuser','UserController@deleteuser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//删除用户
Route::match(['get','post'],'user/Upuser','UserController@Upuser')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//更新用户
Route::match(['get','post'],'user/areachina','UserController@areachina')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//获取地址列表
});
//设备路由
Route::group(['middleware'=>'auth:api'],function (){
Route::get('devices/devicelist', 'DevicesController@devicelist');//设备列表
Route::get('devices/devicetype','DevicesController@devicetype');//设备类型
Route::post('devices/deletedecice','DevicesController@deletedecice')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//删除设备
Route::post('devices/adddevice','DevicesController@adddevice')->middleware('permission:' . \App\Laravue\Acl::PERMISSION_PERMISSION_MANAGE);//新增设备
}); });
// Fake APIs // Fake APIs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment