From 41e6159cfa12416155adcd6747e48fab28ffc534 Mon Sep 17 00:00:00 2001
From: cyy <cuiqian2004@163.com>
Date: 星期一, 26 八月 2024 22:45:17 +0800
Subject: [PATCH] test
---
pages/index/index.vue | 335 +++++++++++++++++++++++++++++++------------------------
1 files changed, 189 insertions(+), 146 deletions(-)
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 3998586..3338b09 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -1,52 +1,5 @@
-<style>
- .content {
- /* display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center; */
- width: 100vw;
- height: 100vh;
- background: #EAEAEA;
- padding: 1rpx 0rpx;
- }
- .v-area{
- border-radius: 12rpx;
- margin: 30rpx;
- padding: 10rpx;
- background: #FFFFFF;
- }
- .areaList{
- padding: 0;
- }
- .areaList li{
- /* border: 1px solid #0062CC; */
- list-style: none;
- /* width: 120rpx; */
- display: inline-block;
- padding: 30rpx 16rpx 16rpx 20rpx;
- text-align: center;
- font-size: 14px;
- }
- .logo {
- height: 120rpx;
- width: 120rpx;
- border-radius: 20rpx;
- display: inline-block;
- text-align: center;
- padding: 18rpx;
- color: #000000;
- border: 0px solid rgb(221, 221, 221);
- }
- .logo i{
- color: #000000;
- font-size: 40px;
- line-height: 53px;
- }
-
-</style>
-
<template>
- <view class="content">
+ <view class="uni-page-index">
<view class="v-area" v-for="(area,index) in data">
<p :data-key="area.ID?area.ID:area.id">{{ area.Name?area.Name:area.name }}</p>
<ul class="areaList">
@@ -59,184 +12,274 @@
</li>
<!-- Mobox3 -->
<li v-for="(app,key) in area.app_list">
- <a @tap="appCreate(app)" class="logo" :style="{'background-color':app.bk_color,'color':app.bk_color}">
+ <a @tap="appCreate(app)" class="logo"
+ :style="{'background-color':app.bk_color,'color':app.bk_color}">
<i :class="app.img_font_style" :style="{'color':app.txt_color}"></i>
</a>
- <p :data-key="app.id">{{ app.name }}</p>
+ <p :data-key="app.id">{{ app.list_name|| app.name}}</p>
</li>
-
+
</ul>
</view>
-
- <!-- <image class="logo" src="/static/logo.png"></image>
- <view class="text-area">
- <text class="title">{{title}}</text>
- </view>
- <view class="" v-for="(v,index) in data">
- <input type="text" :value="v" @focus="ontap" :data-key="index" :key="index"/>
- </view> -->
+
</view>
-</template>
+</template>
<script>
import Base64 from '../../components/js-base64/base64.js'
+ import utils from "@/js/utils.js"
export default {
- modules:{
+ modules: {
Base64,
},
onNavigationBarButtonTap(e) {
// console.log(e.text);
// console.log(e.fontSize);
- this.$store.state.areaFunc='';
- this.$store.commit("classAttrList",null);
- this.$store.commit("classGridStyleInfo",null);
- this.$store.commit("dicValueInfo",null);
- this.$store.commit("subClassAttrList",null);
- this.$store.commit("subClassGridStyleInfo",null);
+ this.$store.state.areaFunc = '';
+ this.$store.commit("classAttrList", null);
+ this.$store.commit("classGridStyleInfo", null);
+ this.$store.commit("dicValueInfo", null);
+ this.$store.commit("subClassAttrList", null);
+ this.$store.commit("subClassGridStyleInfo", null);
//鍒锋柊褰撳墠椤甸潰
// location.reload();
uni.redirectTo({
- url:'../index/index?args=9999999999'
+ url: '../index/index?args=9999999999'
});
},
data() {
return {
title: 'Hello',
- data:[]
+ data: []
}
},
onLoad(options) {
console.log(options);
// 鑾峰彇鎵�湁AppType="MES",ClientType="2"(PDA)鐨勫紩鐢ㄩ鍩熷姛鑳界偣淇℃伅
- if(this.$store.state.areaFunc)
+
+ if (this.$store.state.areaFunc)
this.data = this.$store.state.areaFunc.data;
- else
- this.$store.dispatch('areaFunc',{}).then(success=>{
- console.log(success);
- if (success.code=='00000' || success.err_code == 0) {
+ else {
+ const appType = utils.session.getValue('app_type') || "MES";
+ this.$store.dispatch('areaFunc', {
+ app_type: appType,
+ need_ace:1,
+ }).then(success => {
+ // console.log(success);
+ if (success.code == '00000' || success.err_code == 0) {
this.data = success.data;
- if(success.err_code!=undefined){ //鍒ゆ柇鏄惁鏄疢obox3
- success.result.forEach(async (area,index) => {
- if(area.client_type==2){ //鍒ゆ柇绫诲瀷鏄惁鏄疨DA绫诲瀷
- await this.GetFuncTree(index,area);
+ if (success.err_code != undefined) { //鍒ゆ柇鏄惁鏄疢obox3
+ success.result.forEach(async (area, index) => {
+ if (area.client_type == 2) { //鍒ゆ柇绫诲瀷鏄惁鏄疨DA绫诲瀷
+ area.app_type= appType
+ await this.GetFuncTree(index, area);
}
});
}
- }else{
- uni.showModal({title:"閿欒",content:success.msg,showCancel:false,confirmText:"鍙栨秷"});
+ } else {
+ uni.showModal({
+ title: this.translateSys("error"),
+ content: success.msg,
+ showCancel: false,
+ confirmText: this.translateSys("cancel")
+ });
}
- }).catch(ex=>{
+ }).catch(ex => {
// console.log(ex);
- uni.showModal({title:"閿欒",content:ex.errMsg,showCancel:false,confirmText:"鍙栨秷"});
+ uni.showModal({
+ title: this.translateSys("error"),
+ content: ex.errMsg,
+ showCancel: false,
+ confirmText: this.translateSys("cancel")
+ });
});
-
- // var data = {
- // in1:"ll1",
- // in2:"ll2",
- // in3:"ll3",
- // in4:"ll4",
- // in5:"ll5",
- // in6:"ll6",
- // };
- // for(var i in data)
- // this.$data.keys.push(i)
- // this.$data.data = data;
- // console.log(this.$data.keys);
+ }
+
},
methods: {
- async GetFuncTree(index,area){ //Mobox3鑾峰彇搴旂敤棰嗗煙鐨勫姛鑳界偣
- this.data=[];
+ async GetFuncTree(index, area) { //Mobox3鑾峰彇搴旂敤棰嗗煙鐨勫姛鑳界偣
+ this.data = [];
var $this = this;
- var json ={
- app_type: "MES",
+
+ var json = {
+ app_type: area.app_type,
area_id: area.id,
area_client_type: area.client_type,
- need_ace: '0',
+ need_ace:1,
};
- this.$store.dispatch('GetFuncTree',json).then(success=>{
- console.log(success);
+ this.$store.dispatch('GetFuncTree', json).then(success => {
+ // console.log(success);
if (success.err_code == 0) {
- $this.data.push(success.result[0]);
- this.$store.commit("areaFunc", $this.data);
- }else{
- uni.showModal({title:"閿欒",content:success.msg,showCancel:false,confirmText:"鍙栨秷"});
+ if ((success.result || []).length > 0) {
+ $this.data.push(success.result[0]);
+ console.log("onLoad", $this.data)
+ this.$store.commit("areaFunc", $this.data);
+ }
+
+ } else {
+ uni.showModal({
+ title: this.translateSys("error"),
+ content: success.msg,
+ showCancel: false,
+ confirmText: this.translateSys("cancel")
+ });
}
- }).catch(ex=>{
+ }).catch(ex => {
// console.log(ex);
- uni.showModal({title:"閿欒",content:ex.errMsg,showCancel:false,confirmText:"鍙栨秷"});
+ uni.showModal({
+ title: this.translateSys("error"),
+ content: ex.errMsg,
+ showCancel: false,
+ confirmText: this.translateSys("cancel")
+ });
});
},
- appCreate(app){ //鐐瑰嚮鍔熻兘鐐硅烦杞〉闈�+ appCreate(app) { //鐐瑰嚮鍔熻兘鐐硅烦杞〉闈� console.log(app);
- var paramStr = this.$store.state.OIMoboxSAPI?app.param:app.Param;
- var appName = this.$store.state.OIMoboxSAPI?app.name:app.Name;
- var defCode = this.$store.state.OIMoboxSAPI?app.def_code:app.DefCode;
+ var paramStr = this.$store.state.OIMoboxSAPI ? app.param : app.Param;
+ var appName = this.$store.state.OIMoboxSAPI ? (app.list_name || app.name) : app.Name;
+ var defCode = this.$store.state.OIMoboxSAPI ? app.def_code : app.DefCode;
var param = "";
- if(paramStr){
- //mobox2鐨刾aram鏄痡son瀛楃涓�- param = paramStr.replace(/\\/g,"");
- //mobox3鐨刾aram鏄痓ase64瀛楃涓�- if(!paramStr.includes('"')) param = Base64.decode(paramStr);
+ if (paramStr) {
+ //mobox2鐨刾aram鏄痡son瀛楃涓�+ param = paramStr.replace(/\\/g, "");
+ //mobox3鐨刾aram鏄痓ase64瀛楃涓�+ if (!paramStr.includes('"')) param = Base64.decode(paramStr);
}
-
- if(!param){
- uni.showModal({title:"鎻愮ず",content:"璇ュ姛鑳界偣鏈厤缃弬鏁帮紝璇烽噸鏂伴厤缃弬鏁帮紒",showCancel:false,confirmText:"鍙栨秷"});
+
+ if (!param) {
+ uni.showModal({
+ title: this.translateSys("tip"),
+ content: this.translate('tip_no_app_param'),
+ showCancel: false,
+ confirmText: this.translateSys("cancel")
+ });
return;
}
- if(defCode == '3018'){
- if(this.$store.state.OIMoboxSAPI){ //Mobox3
+ if (defCode == '3018') {
+ if (this.$store.state.OIMoboxSAPI) { //Mobox3
uni.navigateTo({
// url:'../modal/3018?param='+param+"&titlename="+appName
- url:'../modal/3018_2?param='+param+"&titlename="+appName
+ url: '../modal/3018_2?param=' + param + "&titlename=" + appName
});
- }else{ //Mobox2
+ } else { //Mobox2
uni.navigateTo({
- url:'../modal/classAttr?param='+param+"&titlename="+appName
+ url: '../modal/classAttr?param=' + param + "&titlename=" + appName
});
}
- } else if(defCode == '3037'){
- if(this.$store.state.OIMoboxSAPI){ //Mobox3
+ } else if (defCode == '3037') {
+ if (this.$store.state.OIMoboxSAPI) { //Mobox3
uni.navigateTo({
// url:'../modal/3037?param='+param+"&titlename="+appName
- url:'../modal/3037_2?param='+param+"&titlename="+appName
+ url: '../modal/3037_2?param=' + param + "&titlename=" + appName
});
- }else{ //Mobox2
+ } else { //Mobox2
uni.navigateTo({
- url:'../modal/ms_classAttr?param='+param+"&titlename="+appName
+ url: '../modal/ms_classAttr?param=' + param + "&titlename=" + appName
});
}
- } else if(defCode == '3200'){
- if(this.$store.state.OIMoboxSAPI){ //Mobox3
+ } else if (defCode == '3200') {
+ if (this.$store.state.OIMoboxSAPI) { //Mobox3
uni.navigateTo({
- url:'../modal/3200?param='+param+"&titlename="+appName
+ url: '../modal/3200?param=' + param + "&titlename=" + appName
});
}
- } else if(defCode == '5600'){ //鐮佺洏
- if(this.$store.state.OIMoboxSAPI){ //Mobox3
+ } else if (defCode == '3201') {
+ if (this.$store.state.OIMoboxSAPI) { //Mobox3
uni.navigateTo({
- url:'../modal/5600?param='+param+"&titlename="+appName
+ url: '../modal/3201?param=' + param + "&titlename=" + appName
});
}
- } else if(defCode == '5602'){ //鍒嗘嫞
- if(this.$store.state.OIMoboxSAPI){ //Mobox3
+ } else if (defCode == '5600') { //鐮佺洏
+ if (this.$store.state.OIMoboxSAPI) { //Mobox3
uni.navigateTo({
- url:'../modal/5602?param='+param+"&titlename="+appName
+ url: '../modal/5600?param=' + param + "&titlename=" + appName
});
}
- }
-
+ } else if (defCode == '5601') { //鐮佺洏
+ if (this.$store.state.OIMoboxSAPI) { //Mobox3
+ uni.navigateTo({
+ url: '../modal/5601?param=' + param + "&titlename=" + appName
+ });
+ }
+ } else if (defCode == '5602') { //鍒嗘嫞
+ if (this.$store.state.OIMoboxSAPI) { //Mobox3
+ uni.navigateTo({
+ url: '../modal/5602?param=' + param + "&titlename=" + appName
+ });
+ }
+ }
+
// uni.redirectTo({
// url:'../index/index?args=9999999999'
// });
},
- ontap(e){ //鎵爜鍔熻兘
+ ontap(e) { //鎵爜鍔熻兘
// console.log(e.target)
- getApp().onScan((result)=>{
+ getApp().onScan((result) => {
// console.log(result.decodedata);
- this.$data.data[e.target.dataset['key']]=result.decodedata;
+ this.$data.data[e.target.dataset['key']] = result.decodedata;
})
- }
-
+ },
+ translate(t) {
+ if (typeof this.$t == "function") return this.$t(`page.${t}`)
+ else return t;
+ },
+ translateSys(t) {
+ if (typeof this.$t == "function") return this.$t(`sys.${t}`)
+ else return t;
+ },
}
}
</script>
+
+<style lang="scss">
+ .uni-page-index {
+
+ width: 100vw;
+ min-height: 100vh;
+ background: #EAEAEA;
+ padding: 1rpx 0rpx;
+
+
+ .v-area {
+ border-radius: 12rpx;
+ margin: 30rpx;
+ padding: 10rpx;
+ background: #FFFFFF;
+ }
+
+ .areaList {
+ padding: 0;
+ }
+
+ .areaList li {
+ /* border: 1px solid #0062CC; */
+ list-style: none;
+ /* width: 120rpx; */
+ display: inline-block;
+ padding: 30rpx 10rpx 16rpx 10rpx;
+ text-align: center;
+ font-size: 14px;
+ width: 100px;
+ vertical-align: text-top;
+ }
+
+ .logo {
+ height: 120rpx;
+ width: 120rpx;
+ border-radius: 20rpx;
+ display: inline-block;
+ text-align: center;
+ padding: 18rpx;
+ color: #000000;
+ border: 0px solid rgb(221, 221, 221);
+ }
+
+ .logo i {
+ color: #000000;
+ font-size: 40px;
+ line-height: 53px;
+ }
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.1