提交 cf895e49 作者: wk

原始模式迁移

父级 7bfec634
......@@ -229,6 +229,22 @@ const params = {
getNeedDo: {
url: "/plat/api/v1/common_check/check_object/my_form_list",
method: "get"
},
getAppDetail: {
url: "/plat/web/v1/common_check/check_tpl/tpl_detail",
method: "get"
},
getOriginAppDetail: {
url: "/plat/api/v1/common_check/check_tpl/tpl_detail",
method: "get"
},
getProjectList: {
url: "/plat/api/v1/project/project_list",
method: "get"
},
getObjList: {
url: "/plat/api/v1/common_check/check_object/obj_list",
method: "get"
}
}
......
......@@ -9,7 +9,7 @@ const http = (params) => {
data: params.data,
header: {
'access_token': uni.getStorageSync('token') || '',
"token": uni.getStorageSync('token') || ''
// "token": uni.getStorageSync('token') || ''
},
success(res) {
uni.hideLoading()
......
// 公共中心域名
export const consoleBaseUrl = 'https://dev-console-api.hzdingmao.com'
// export const consoleBaseUrl = 'https://test-console-api.hzdingmao.com'
//正式环境
// export const consoleBaseUrl = 'https://console-api.hibuilding.cn'
const $http = {
get: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "GET",
header: header,
success: function(res) {
// console.log("请求参数", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res);
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err);
}
})
})
},
consoleGet: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: consoleBaseUrl + url,
data: data,
method: "GET",
header: header,
success: function(res) {
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res);
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err);
}
})
})
},
post: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "POST",
header: header,
success: function(res) {
console.log("data", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
consolePost: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: consoleBaseUrl + url,
data: data,
method: "POST",
header: header,
success: function(res) {
console.log(data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
deleteRequest: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "DELETE",
header: header,
success: function(res) {
console.log("data", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
put: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "PUT",
header: header,
success: function(res) {
console.log("data", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
consolePut: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: consoleBaseUrl + url,
data: data,
method: "PUT",
header: header,
success: function(res) {
console.log(data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
delete: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "DELETE",
header: header,
success: function(res) {
console.log(data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
consoleDelete: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}${url}`,
data: data,
method: "DELETE",
header: header,
success: function(res) {
console.log(data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
postJSON: function({
url,
data,
header
}) {
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "POST",
header: header,
success: function(res) {
console.log(res);
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
reject(err)
}
})
})
},
consolePostJSON: function({
url,
data,
header
}) {
return new Promise(function(resolve, reject) {
uni.request({
url: consoleBaseUrl + url,
data: data,
method: "POST",
header: header,
success: function(res) {
console.log(res);
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
reject(err)
}
})
})
},
upImg: function({
imgUrl,
access_token
}) {
return new Promise(function(resolve, reject) {
uni.uploadFile({
url: consoleBaseUrl + "/api/v1/base/file/upload_file",
filePath: imgUrl,
name: 'pic_file_apk',
header: {
"access_token": access_token,
"Content-Type": "multipart/form-data"
},
success: function(uploadFileRes) {
resolve(uploadFileRes);
},
fail: function(err) {
reject(err)
}
});
})
},
upFile: function({
fileUrl,
access_token
}) {
return new Promise(function(resolve, reject) {
uni.uploadFile({
url: consoleBaseUrl + "/api/v1/base/file/upload_file",
filePath: fileUrl,
name: 'pic_file_apk',
header: {
"access_token": access_token,
"Content-Type": "multipart/form-data"
},
success: function(uploadFileRes) {
resolve(uploadFileRes);
},
fail: function(err) {
reject(err)
}
});
})
},
gcyRequest: function({
url,
method,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${gcyBaseUrl}${url}`,
data: data,
method: method,
header: header,
success: function(res) {
console.log("data", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
}
export default $http
......@@ -7,9 +7,14 @@ import tabBar from 'components/uni-tabbar/uni-tabbar.vue'
import $toast from './common/toast.js'
import $config from './common/config.js'
import $mta from "api/mta.js"
import $http from './api/request.js'
Vue.prototype.$http = $http
Vue.prototype.$mta = $mta
Vue.prototype.$toast = $toast
Vue.prototype.$config = $config
Vue.prototype.getToken = function() {
return uni.getStorageSync("token")
}
Vue.component('tabBar', tabBar)
Vue.config.productionTip = false
App.mpType = 'app'
......
......@@ -363,7 +363,52 @@
}
}
],
,{
"path" : "pages/gallery/app/originalIndex/originalIndex",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/gallery/app/checkObjList/checkObjList",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/gallery/app/createCheck/createCheck",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/gallery/app/checkObjDetail/checkObjDetail",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/gallery/app/checkRecord/checkRecord",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTitleText": "uni-app",
......
<template>
<view class="check-detail-home">
<!-- <navbar :title="title"></navbar> -->
<view class="check-detail-head">
<canvas canvas-id="qrcode" style="width: 100px;height: 100px;" />
<view class="check-detail-download">
<text style="font-size: 14px;font-weight: bold;color: #333333;">{{title}}</text>
<view class="detail-download" @click="downloadQrcode">
<text>下载二维码</text>
</view>
</view>
</view>
<view class="check-detail-list">
<view v-for="(item,index) in itemList" :key="index" @click="itemClick(index)">
<view class="check-detail-item">
<view class="check-detail-content">
<view class="check-detail-v-title">{{item.check_item_name}}</view>
<view class="check-detail-v-date">{{item.created_at}}</view>
</view>
<view class="check-detail-listcard-image">
<image src="../../static/ic_arrow_left.png"></image>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import uQRCode from "../../../../common/Sansnn-uQRCode/uqrcode.js"
export default {
data() {
return {
title: "记录对象",
check_obj_id: "",
qrcodeSrc: '',
itemList: [],
size: 100,
check_item_id: ""
}
},
onLoad: function(option) {
this.title = option.obj_no;
this.check_obj_id = option.check_obj_id;
this.check_item_id = option.check_item_id
uni.setNavigationBarTitle({
title: option.obj_no
})
},
onReady() {
let text = `{"type":"platform-obj","text":"${this.title}"}`
setTimeout(() => {
this.make(text)
}, 100)
},
methods: {
itemClick(index) {
let checkItem = this.itemList[index]
uni.navigateTo({
url: `/pages/gallery/app/checkRecord/checkRecord?check_record_id=${checkItem.check_record_id}&check_item_id=${checkItem.check_item_id}&check_item_name=${checkItem.check_item_name}`
})
},
loadRecordList() {
let _this = this
uni.showLoading({
title: "加载中"
})
this.$http.get({
url: "/api/v1/common_check/check_record/item_list",
data: {
"project_id": uni.getStorageSync("project_id"),
"obj_no": _this.title,
"is_page": 0
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("检查对象详情", result);
let list = result.data.list
for (var i = 0; i < list.length; i++) {
if (list[i].check_item_id == _this.check_item_id) {
this.itemList.push(list[i])
}
}
})
},
make(text) {
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: text,
size: this.size,
margin: 10,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
correctLevel: uQRCode.errorCorrectLevel.H,
success: res => {
console.log(res)
this.qrcodeSrc = res
this.loadRecordList()
},
fail: error => {
console.log(error)
this.loadRecordList()
}
})
},
downloadQrcode() {
// #ifndef H5
this.save(this.qrcodeSrc)
// #endif
// #ifdef H5
let _t = this;
uni.downloadFile({
url: this.qrcodeSrc,
success: (res) => {
if (res.statusCode === 200) {
let file = res.tempFilePath;
_t.save(file)
}
}
});
// #endif
},
save(url) {
let _this = this;
uni.saveImageToPhotosAlbum({
filePath: url,
success: () => {
uni.hideLoading();
uni.showToast({
title: "图片已保存到相册"
});
},
fail: () => {
uni.hideLoading();
uni.showToast({
title: "图片保存失败"
});
}
});
}
}
}
</script>
<style lang="scss">
.check-detail-home {
display: flex;
flex-direction: column;
.check-detail-head {
background-color: #F5F5F5;
flex-direction: row;
display: flex;
padding: 10px;
.check-detail-download {
display: flex;
margin-top: 10px;
margin-left: 10px;
flex-direction: column;
.detail-download {
display: flex;
flex-direction: column;
width: 86px;
margin-top: 10px;
height: 24px;
background-color: #1890FF;
color: #FFFFFF;
font-size: 14px;
align-items: center;
justify-content: center;
border-radius: 2px;
}
}
}
.check-detail-list {
display: flex;
flex-direction: column;
.check-detail-item {
display: flex;
padding: 10px;
justify-content: center;
align-items: center;
flex-direction: row;
border-bottom: 1px solid #f5f5f5;
.check-detail-content {
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
height: 50px;
overflow: hidden;
.check-detail-v-title {
font-size: 16px;
color: #333333;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: normal;
display: block;
}
.check-detail-v-date {
margin-top: 5px;
font-size: 12px;
color: #000;
}
}
.check-detail-listcard-image {
width: 20px;
margin-right: 10px;
image {
width: 10px;
height: 15px;
}
}
}
}
}
</style>
<template>
<view class="home">
<!-- <navbar :title="title"></navbar> -->
<view class="uni-search">
<uni-search-bar placeholder="搜索" bgColor="#F5F5F5" @confirm="search" @input="search" />
</view>
<view class="content">
<view v-for="(item,index) in objList" :key="index" @click="itemClick(index)">
<list-card :item='item'></list-card>
</view>
<view class="loadmore" v-if="showLoadMore">{{loadTips}}</view>
</view>
<uni-fab horizontal="right" vertical="bottom" text="新增" :content="menu" @fabClick="add" :popMenu=popMenu
:pattern="pattern"></uni-fab>
</view>
</template>
<!-- 检查对象列表 -->
<script>
import Api from "../../../../api/api.js"
export default {
data() {
return {
objList: [],
menu: [],
loadTips: '正在加载...',
showLoadMore: false,
pattern: {
color: '#7A7E83',
backgroundColor: '#fff',
selectedColor: '#007AFF',
buttonColor: '#007AFF'
},
popMenu: false,
currPage: 1,
pageSize: 20,
title: "记录对象",
projectId: "",
checkItemId: "",
inputValue: "",
check_tpl_id: ""
}
},
onShow() {
this.initData()
},
onLoad: function(option) {
this.title = option.check_item_name
uni.setNavigationBarTitle({
title: option.check_item_name
})
this.check_tpl_id = option.check_tpl_id
this.checkItemId = option.check_item_id
this.projectId = uni.getStorageSync("project_id")
},
onPullDownRefresh() {
this.currPage = 1
this.objList = [];
this.showLoadMore = false
this.loadTips = '正在加载...'
console.log('onPullDownRefresh');
this.initData()
},
onReachBottom() {
this.showLoadMore = true;
this.currPage++;
this.loadMore()
},
methods: {
initData() {
this.loadData(true)
},
loadMore() {
this.loadData(false);
},
loadData(refresh) {
if (refresh) {
this.currPage = 1
}
this.getCheckList(refresh, 1)
},
add() {
uni.navigateTo({
url: `/pages/gallery/app/createCheck/createCheck?check_item_id=${this.checkItemId}&title=${this.title}&check_tpl_id=${this.check_tpl_id}`,
})
},
search(val) {
this.inputValue = val.value
this.currPage = 1
console.log(val.value);
let length = this.objList.length
this.objList.splice(0, length)
this.getCheckList(true, 0)
},
itemClick(index) {
let obj_no = this.objList[index].obj_no
let check_obj_id = this.objList[index].check_obj_id
uni.navigateTo({
url: `/pages/gallery/app/checkObjDetail/checkObjDetail?check_item_id=${this.checkItemId}&obj_no=${obj_no}&check_obj_id=${check_obj_id}`
})
},
getCheckList(refresh, is_page) {
uni.showLoading({
title: "加载中"
})
Api.getObjList({
data: {
"project_id": this.projectId,
"check_item_id": this.checkItemId,
"obj_no": this.inputValue,
"is_page": is_page,
"page": this.currPage,
"page_size": this.pageSize
}
}).then((result) => {
console.log("检查对象列表:", result);
let list = result.data.list
if (refresh) {
uni.stopPullDownRefresh()
this.objList = list
} else {
if (list.length > 0) {
for (var i = 0; i < list.length; i++) {
this.objList.push(list[i])
}
} else {
uni.showToast({
title: "没有更多数据",
icon: 'none'
})
}
}
})
}
}
}
</script>
<style lang="scss">
.home {
display: flex;
flex: 1;
box-sizing: border-box;
flex-direction: column;
.loadmore {
display: flex;
justify-content: center;
align-items: center;
}
}
</style>
<template>
<view class="index-content">
<!-- <navbar :showBack="false" :title="title"></navbar> -->
<picker @change="itemSelect" :range="projectNames">
<label>
<view class="index-uni-project">
<text>{{projectSelect}}</text>
<image src="../../../../static/icon_down_select.png"></image>
</view>
</label>
</picker>
<auto-banner class="index-uni-banner" :homeSlide="banners"></auto-banner>
<view class="index-grid-box">
<uni-grid :column="column" @change="change">
<uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
<view class="index-grid-item-box">
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+item.menu_icon+'.png'"
class="image" />
<text class="index-text">{{item.check_item_name}}</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</template>
<script>
import Api from "../../../../api/api.js"
export default {
data() {
return {
title: '',
column: 3,
projectList: [],
projectNames: [],
banners: [],
tplConfig: [],
list: [],
projectSelect: "示例项目",
projectId: "",
pattern: {
color: '#7A7E83',
backgroundColor: '#fff',
selectedColor: '#007AFF',
buttonColor: '#007AFF'
},
menu: [],
appId: ""
}
},
onLoad(option) {
this.appId = option.check_tpl_id
this.title = option.title
uni.setNavigationBarTitle({
title: this.title
})
this.loadProject()
this.loadData()
},
methods: {
loadProject(access_token) {
Api.getProjectList({
data: {
is_all: 1
}
}).then((result) => {
console.log("项目列表:", result);
if (result.code === 0) {
this.projectList = result.data.list
for (var i = 0; i < this.projectList.length; i++) {
this.projectNames[i] = this.projectList[i].project_name
}
if (this.projectList.length > 0) {
console.log("项目ID:", );
let curId = uni.getStorageSync("project_id")
if (curId.length == 0) {
this.projectSelect = this.projectList[0].project_name
uni.setStorageSync("project_id", this.projectList[0].project_id)
uni.setStorageSync("project_name", this.projectList[0].project_name)
} else {
this.projectSelect = uni.getStorageSync("project_name")
}
}
} else {
if (result.code === -1) {
uni.showToast({
title: result.msg,
icon: 'none'
})
return
}
}
})
},
loadData() {
Api.getOriginAppDetail({
data: {
"check_tpl_id": this.appId,
"show_status": 1
}
}).then((result) => {
console.log("检查项菜单:", result);
if (result.code === -1) {
uni.showToast({
title: result.msg,
icon: 'none'
})
return
}
if (result.data.line_menu_num) {
if (result.data.line_menu_num !== "") {
this.column = parseInt(result.data.line_menu_num)
} else {
this.column = 3
}
} else {
this.column = 3
}
console.log(this.column);
this.banners = result.data.home_pic
console.log("轮播图:", this.banners);
this.tplConfig = result.data.tpl_config
console.log("检查项列表:", this.tplConfig);
if (this.tplConfig) {
if (this.tplConfig.length > 0) {
this.list = this.tplConfig[0].module_config
}
}
this.title = result.data.tpl_name
uni.setStorageSync("version", result.data.version)
uni.setStorageSync("application_name", result.data.application_name)
uni.setStorageSync("version_pic", result.data.version_pic)
})
},
change(e) {
let {
index
} = e.detail
let item = this.list[index]
uni.navigateTo({
url: `/pages/gallery/app/checkObjList/checkObjList?check_item_name=${item.check_item_name}&check_item_id=${item.check_item_id}&check_tpl_id=${this.appId}`,
})
},
itemSelect(e) {
console.log(e);
let index = parseInt(e.detail.value)
this.projectSelect = this.projectList[index].project_name
uni.setStorageSync("project_id", this.projectList[index].project_id)
uni.setStorageSync("project_name", this.projectList[index].project_name)
},
}
}
</script>
<style lang="scss">
.index-content {
display: flex;
flex-direction: column;
background-color: #F5F5F5;
box-sizing: border-box;
position: relative;
.index-uni-project {
height: 80rpx;
background-color: #FFFFFF;
display: flex;
flex-direction: row;
width: 100%;
align-items: center;
justify-content: center;
text {
font-size: 32rpx;
color: #333333;
max-width: 400rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
image {
width: 40rpx;
height: 40rpx;
}
}
.index-uni-banner {
background-color: #FFFFFF;
border: 2rpx solid #F5F5F5;
border-radius: 10rpx;
margin: 30rpx;
}
.index-grid-box {
flex-direction: row;
padding: 30rpx;
background-color: #FFFFFF;
.index-grid-item-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
padding: 30rpx 10rpx;
image {
width: 80rpx;
height: 80rpx;
}
text {
text-align: center;
margin-top: 10rpx;
font-size: 24rpx;
color: #333333;
}
}
}
}
.index-content::after {
content: "";
display: block;
}
.back-icon {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
position: absolute;
right: 30rpx;
bottom: -320rpx;
background-color: rgb(0, 122, 255);
box-shadow: 0 0 10rpx 4rpx rgba(0, 0, 0, 0.2);
display: flex;
align-items: center;
justify-content: center;
image {
width: 80rpx;
height: 80rpx;
}
}
</style>
......@@ -34,16 +34,17 @@
<view class="app-content">
<v-tabs :tabs="tabs" :scroll="true" :value="current" @change="tabChange"></v-tabs>
<view class="app-group-content">
<view class="app-group-item" v-for="(item,index) in apps" :key="index">
<view class="app-group-item" v-for="(item,index) in apps[current].list" :key="index">
<view class="title">{{item.group_name||"其他"}}</view>
<uni-grid column="4" class="grid-container">
<uni-grid-item class="grid-item" v-for="(model,modelIndex) in item.data" :key="modelIndex"
@click="toIndex(model)">
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+model.logo+'.png'"
class="image" />
<view class="single-text" style="color: #666666;font-size: 28rpx;margin-top: 10rpx;">
{{model.app_name}}
<uni-grid-item class="grid-item" v-for="(model,modelIndex) in item.data" :key="modelIndex">
<view class="item" @click="toIndex(model)">
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+model.logo+'.png'"
class="image" />
<view class="single-text" style="color: #666666;font-size: 28rpx;margin-top: 10rpx;">
{{nameLengthDeal(model.app_name)}}
</view>
</view>
</uni-grid-item>
</uni-grid>
......@@ -56,6 +57,7 @@
<script>
import Api from "../../api/api.js"
import StringUtils from "../../common/stringUtils.js"
export default {
data() {
return {
......@@ -64,7 +66,16 @@
messageCount: 0,
needDoCount: 0,
groups: [],
apps: [],
apps: [{
app_menu: 1,
list: []
}, {
app_menu: 2,
list: []
}, {
app_menu: 3,
list: []
}],
current: 0,
tabs: ["生活服务", "综合办公", "岗位工作"],
requestParam: {
......@@ -88,6 +99,45 @@
this.getNeedDo()
},
methods: {
toIndex(model) {
this.$mta(model.app_id)
this.getAppDetail(model)
},
getAppDetail(model) {
Api.getAppDetail({
data: {
"check_tpl_id": model.source_id
}
}).then((result) => {
console.log("应用信息", result);
uni.setStorageSync("business_name", result.data.tpl_name)
if (result.code == 0) {
if (!result.data.business_type) {
uni.navigateTo({
url: `/pages/gallery/app/originalIndex/originalIndex?check_tpl_id=${model.source_id}&title=${result.data.tpl_name}`
})
} else if (result.data.business_type ==
2) { //独立模式 需要获取模块数量 如果只有一个模块 自动跳转表单页面 "体验嘛 呵呵"
that.toAlone(model, result.data)
} else if (result.data.business_type == 3 || result.data.business_type == 4) { //流程模式
this.models = result.data.tpl_config
uni.navigateTo({
url: `../model-form-list-page/model-form-list-page?check_tpl_id=${model.source_id}&business_type=${result.data.business_type}&title=${result.data.tpl_name}&showCfg=${JSON.stringify(this.models[0].show_cfg)}`
})
} else if (result.data.business_type == 5) {
this.currentModel = result.data.tpl_config[0]
console.log(this.currentModel);
this.$refs.bottomDialog.handleShow()
} else { //之前的默认
uni.navigateTo({
url: `../index/index?check_tpl_id=${model.source_id}&title=${result.data.tpl_name}`
})
}
} else {
this.$toast.showToast(result.msg)
}
})
},
tabChange(e) {
this.current = e
},
......@@ -140,6 +190,7 @@
"code_type": "applicationGroup"
}
}).then((result) => {
console.log("应用分组", result);
if (result.code == 0) {
let list = result.data[0].sub_data
this.groups = []
......@@ -165,31 +216,33 @@
})
},
getAppList: function() {
let that = this
Api.getAppList({
data: this.requestParam
data: this.requestParam,
header: {
'access_token': uni.getStorageSync('token') || ''
}
}).then((result) => {
if (result.code === 0) {
let list = result.data.list
that.apps = that.sortGroup(list)
console.log(that.apps);
if (that.groups.length > 0) {
for (var i = 0; i < that.apps.length; i++) {
for (var j = 0; j < that.groups.length; j++) {
if (that.groups[j].key == that.apps[i].app_group) {
that.apps[i].group_name = that.groups[j].val
//先根据菜单分组
this.apps = this.menuSort(list)
//再根据类型分组
this.apps.forEach((item) => {
item.list = this.sortGroup(item.list)
if (this.groups.length > 0) {
for (var i = 0; i < item.list.length; i++) {
for (var j = 0; j < this.groups.length; j++) {
if (this.groups[j].key == item.list[i].app_group) {
item.list[i].group_name = this.groups[j].val
}
}
}
}
}
}
})
console.log("应用分组之后", this.apps);
} else {
if (result.code === -1) {
this.$toast.showToast(result.msg)
if (result.action === 'Laravel_public_permission_fail') {
that.refreshToken()
}
}
this.$toast.showToast(result.msg)
}
})
},
......@@ -201,7 +254,8 @@
if (!map[app.app_group]) {
dest.push({
app_group: app.app_group,
data: [app]
data: [app],
app
});
map[app.app_group] = app;
} else {
......@@ -216,6 +270,32 @@
}
return dest
},
menuSort(arr) {
var map = {},
dest = [];
for (var i = 0; i < arr.length; i++) {
var app = arr[i];
if (!map[app.app_menu]) {
dest.push({
app_menu: app.app_menu,
list: [app]
});
map[app.app_menu] = app;
} else {
for (var j = 0; j < dest.length; j++) {
var dj = dest[j];
if (dj.app_menu == app.app_menu) {
dj.list.push(app);
break;
}
}
}
}
return dest
},
nameLengthDeal(name) {
return StringUtils.stringLength(name, 4)
}
}
}
</script>
......@@ -378,22 +458,25 @@
margin-top: 30rpx;
.grid-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
image {
width: 50rpx;
height: 50rpx;
}
.item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text {
margin-top: 10rpx;
font-weight: 400;
font-size: 24rpx;
color: #333;
image {
width: 50rpx;
height: 50rpx;
}
text {
margin-top: 20rpx;
font-weight: 400;
font-size: 24rpx;
color: #333;
}
}
}
}
......
......@@ -70,9 +70,28 @@
})
},
sureConfig() {
uni.$emit("refreshApp")
uni.navigateBack({
delta: 1
if (thsi.selList.length == 0) {
this.$toast.showToast("请设置常用应用")
return
}
let apps = []
this.selList.forEach((item) => {
apps.push(item.app_id)
})
Api.saveAppConfig({
data: {
apps: apps
}
}).then((result) => {
if (result.code == 0) {
this.$toast.showToast("常用应用设置成功")
uni.$emit("refreshApp")
uni.navigateBack({
delta: 1
})
} else {
this.$toast.showToast(result.msg)
}
})
},
toAdd(item) {
......
......@@ -51,7 +51,8 @@
<uni-grid-item v-for="(app,index) in appList" :key="index">
<view class="app-item" @click="toLink(app)">
<view :class="isLineVisil(index)?'app-name-left':'app-name-right'">
{{nameLengthDeal(app.app_name)}}</view>
{{nameLengthDeal(app.app_name)}}
</view>
<image class="app-logo" src="../../static/ic-score-logo.png"></image>
<view class="line" v-if="isLineVisil(index)"></view>
</view>
......@@ -744,17 +745,19 @@
font-family: "PingFang SC Medium";
font-weight: 700;
margin-left: 30rpx;
flex: 1;
font-size: 28rpx;
text-align: center;
text-align: left;
color: #333;
}
.app-name-right {
font-family: "PingFang SC Medium";
font-weight: 700;
flex: 1;
margin-left: 60rpx;
font-size: 28rpx;
text-align: center;
text-align: left;
color: #333;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment