diff --git a/pages.json b/pages.json
index 525cbc9..ef36294 100644
--- a/pages.json
+++ b/pages.json
@@ -246,14 +246,31 @@
"navigationBarTitleText": "历史记录"
}
},
-
{
"path": "pages/7305/BJQ7305",
"style": {
"navigationBarTitleText": "BJQ7305"
}
+ },
+ {
+ "path": "pages/common/Share/shareIndex",
+ "style": {
+ "navigationBarTitleText": "分享"
+ }
+ },
+ {
+ "path": "pages/common/Share/shareManager",
+ "style": {
+ "navigationBarTitleText": "分享管理"
+ }
+ }
+,
+ {
+ "path": "pages/common/Share/sharePermission",
+ "style": {
+ "navigationBarTitleText": "分享设备"
+ }
}
-
],
"tabBar": {
diff --git a/pages/670/HBY670.vue b/pages/670/HBY670.vue
index 55d0d10..6d84a38 100644
--- a/pages/670/HBY670.vue
+++ b/pages/670/HBY670.vue
@@ -404,7 +404,8 @@
},
rgb565Data: [],
videoHexArray: [],
- picPath: ""
+ picPath: "",
+ permissions:[]//权限列表
}
},
created() {
@@ -436,7 +437,15 @@
var device = data.data;
these.Status.apiType = data.apiType;
these.device = device;
-
+ if(data.apiType!=='listA'){
+ Comment.getdeviceShareId(data.data.id).then(res=>{
+ if(res.code==200){
+ if(res.data.permission){
+ these.permissions=res.data.permission.split(',');
+ }
+ }
+ });
+ }
if (these.device.deviceImei) {
these.initMQ();
}
@@ -595,13 +604,16 @@
} else if (s === 1) {
console.log("分享");
uni.navigateTo({
- url: '/pages/6170/share/index',
+ url: '/pages/common/Share/shareIndex',
events: {
ack: function(data) {}
},
success: (res) => {
+ debugger;
+ let json={persissonType:'670'};
+ Object.assign(json,this.device);
res.eventChannel.emit('share', {
- data: this.device,
+ data:json
});
}
})
@@ -1188,8 +1200,12 @@
setTimeout(task, 0);
},
GearSetting: function(type) { //档位设置
+ if(!this.permissions.includes('41') && this.Status.apiType!=='listA'){
+ console.log("无操作权限");
+ return;
+ }
if (this.formData.modeCurr == type) {
- type = "close";
+ return;
}
showLoading(this, {
text: "请稍候..."
diff --git a/pages/common/Share/shareIndex.vue b/pages/common/Share/shareIndex.vue
new file mode 100644
index 0000000..1eeb856
--- /dev/null
+++ b/pages/common/Share/shareIndex.vue
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+ 分享设备
+
+
+
+ 分享管理
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/Share/shareManager.vue b/pages/common/Share/shareManager.vue
new file mode 100644
index 0000000..24dcbf7
--- /dev/null
+++ b/pages/common/Share/shareManager.vue
@@ -0,0 +1,351 @@
+
+
+
+
+ 已分享用户
+
+
+
+
+
+
+
+
+ 暂无数据
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/common/Share/sharePermission.vue b/pages/common/Share/sharePermission.vue
new file mode 100644
index 0000000..47a04fe
--- /dev/null
+++ b/pages/common/Share/sharePermission.vue
@@ -0,0 +1,421 @@
+
+
+
+
+
+
+
+
+
+ 功能权限
+ 全选
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+ 被分享人信息
+
+
+
+ {{ isCounting ? `${countdown}s后重新获取` : '获取验证码' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/utils/Common.js b/utils/Common.js
index 1daf10b..f7fcf3f 100644
--- a/utils/Common.js
+++ b/utils/Common.js
@@ -1,218 +1,284 @@
-var cfg={
- Version:'Uat',//Dev:开发环境,Uat:Uat环境,Relese正式环境
- DevApi:'http://192.168.110.54:8000/',//开发环境
- UatApi:'http://114.55.111.217/',//UAT环境
- ReleseApi:'http://relese:3169/api/'//Relese环境
-}
+import request from "@/utils/request.js";
export default {
- baseURL : cfg.Version=='Dev'?cfg.DevApi:(cfg.Version=='Uat'?cfg.UatApi:cfg.ReleseApi),
- guid:function generateUUID() {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- const r = Math.random() * 16 | 0;
- const v = c === 'x' ? r : (r & 0x3 | 0x8);
- return v.toString(16);
- });
- },
- alert: function(title, content, callback) {
- if(!title){
- title='提示'
- }
- if(!content){
- content=title;
- }
-
- uni.showModal({
- title: title,
- content: content,
- success: function(res) {
- if (res.confirm) {
- console.log('用户点击确定');
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- if (callback) {
- callback(res);
- }
+ guid: function generateUUID() {
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+ const r = Math.random() * 16 | 0;
+ const v = c === 'x' ? r : (r & 0x3 | 0x8);
+ return v.toString(16);
+ });
+ },
+ alert: function(title, content, callback) {
+ if (!title) {
+ title = '提示'
+ }
+ if (!content) {
+ content = title;
+ }
+
+ uni.showModal({
+ title: title,
+ content: content,
+ success: function(res) {
+ if (res.confirm) {
+ console.log('用户点击确定');
+ } else if (res.cancel) {
+ console.log('用户点击取消');
}
- });
- },
-
- showLoading:function(title,mask){
- uni.showLoading({
- title:title,
- mask:mask,
- })
- },
- hideLoading:function(){
- uni.hideLoading();
- },
- showToast:function(title,mask,duration,callback){
- if(!duration){
- duration=1500;
- }
- if(mask==undefined){
- mask=false;
- }
- uni.showToast({
- title:title,
- mask:mask,
- duration:duration,
- callback:callback,
- icon: 'none'
- })
- },
- GetData:function(url,data,method,contentType,succ,err,complete){
- var these=this;
- if(!url){
- console.error("url为空");
- return;
- }
-
- if(url.toLowerCase().indexOf('http://')==-1 || url.toLowerCase().indexOf('https://')==-1){
- if(url.indexOf('/')==0){
- url=url.substr(1,url.length-1);
+
+ if (callback) {
+ callback(res);
}
- let ServerPath=these.DevApi;
- if(these.Version==='Dev'){
- ServerPath=these.DevApi;
- }
- else if(these.Version==='Uat'){
- ServerPath=these.UatApi;
- }
- else if(these.Version==='Relese'){
- ServerPath=these.ReleseApi;
- }else{
- these.DevApi
- }
- url=ServerPath+url;
}
-
- var these=this;
- if(!method){
- method='POST';
+ });
+ },
+
+ showLoading: function(title, mask) {
+ uni.showLoading({
+ title: title,
+ mask: mask,
+ })
+ },
+ hideLoading: function() {
+ uni.hideLoading();
+ },
+ showToast: function(title, mask, duration, callback) {
+ if (!duration) {
+ duration = 1500;
+ }
+ if (mask == undefined) {
+ mask = false;
+ }
+ uni.showToast({
+ title: title,
+ mask: mask,
+ duration: duration,
+ callback: callback,
+ icon: 'none'
+ })
+ },
+ GetData: function(url, data, method, contentType, succ, err, complete) {
+ var these = this;
+ if (!url) {
+ console.error("url为空");
+ return;
+ }
+
+ if (url.toLowerCase().indexOf('http://') == -1 || url.toLowerCase().indexOf('https://') == -1) {
+ if (url.indexOf('/') == 0) {
+ url = url.substr(1, url.length - 1);
}
- method=method.toUpperCase();
-
- if(!contentType){
- contentType='application/json;charset=UTF-8';
+ let ServerPath = these.DevApi;
+ if (these.Version === 'Dev') {
+ ServerPath = these.DevApi;
+ } else if (these.Version === 'Uat') {
+ ServerPath = these.UatApi;
+ } else if (these.Version === 'Relese') {
+ ServerPath = these.ReleseApi;
+ } else {
+ these.DevApi
}
-
- these.checkLAN(
-
- function(){
- these.showLoading('请稍候..',true);
- setTimeout(function(){
+ url = ServerPath + url;
+ }
+
+ var these = this;
+ if (!method) {
+ method = 'POST';
+ }
+ method = method.toUpperCase();
+
+ if (!contentType) {
+ contentType = 'application/json;charset=UTF-8';
+ }
+
+ these.checkLAN(
+
+ function() {
+ these.showLoading('请稍候..', true);
+ setTimeout(function() {
uni.request({
- url:url,
- data:data,
- header:{
- "Content-Type":contentType
+ url: url,
+ data: data,
+ header: {
+ "Content-Type": contentType
},
- method:method,
- timeout:60000,
- dataType:'json',
- success:function(json){
-
- if(succ){
+ method: method,
+ timeout: 60000,
+ dataType: 'json',
+ success: function(json) {
+
+ if (succ) {
succ(json);
}
},
- fail:function(ex){
-
- if(err){
+ fail: function(ex) {
+
+ if (err) {
err(ex);
}
},
- complete:function(){
-
- if(complete){
+ complete: function() {
+
+ if (complete) {
complete();
}
}
});
-
- },0);
-
+
+ }, 0);
+
}
-
- ,function(){
+
+ ,
+ function() {
these.showToast('无网络连接');
});
- },
- checkLAN:function(succ,error){
- uni.getNetworkType({
- success: (res) => {
- const networkType = res.networkType;
-
-
- // 判断网络是否连接
- if (networkType === 'none') {
+ },
+ checkLAN: function(succ, error) {
+ uni.getNetworkType({
+ success: (res) => {
+ const networkType = res.networkType;
+
+
+ // 判断网络是否连接
+ if (networkType === 'none') {
console.error('无网络连接')
- if(error){
- error();
- }
- }else{
- if(succ){
+ if (error) {
+ error();
+ }
+ } else {
+ if (succ) {
succ();
}
-
+
}
- },
- fail: (err) => {
- console.error('获取网络状态失败:', err);
- if(error){
+ },
+ fail: (err) => {
+ console.error('获取网络状态失败:', err);
+ if (error) {
error();
}
- }
- });
-
- },
- DateFormat: function(date, format) {
- if(!date){
- date=new Date();
}
- if(!format){
- format='yyyy-MM-dd HH:mm:ss';
- }
- // 处理参数默认值
- if (typeof date === 'string' || typeof date === 'number') {
- date = new Date(date);
- }
- date = date instanceof Date ? date : new Date();
- format = format || 'yyyy-MM-dd';
-
- // 检查日期是否有效
- if (isNaN(date.getTime())) {
- return 'Invalid Date';
- }
-
- // 定义格式化映射
- const formatMap = {
- 'yyyy': date.getFullYear(),
- 'MM': String(date.getMonth() + 1).padStart(2, '0'),
- 'dd': String(date.getDate()).padStart(2, '0'),
- 'HH': String(date.getHours()).padStart(2, '0'),
- 'mm': String(date.getMinutes()).padStart(2, '0'),
- 'ss': String(date.getSeconds()).padStart(2, '0'),
- 'SSS': String(date.getMilliseconds()).padStart(3, '0'),
- 'M': date.getMonth() + 1,
- 'd': date.getDate(),
- 'H': date.getHours(),
- 'm': date.getMinutes(),
- 's': date.getSeconds(),
- 'S': date.getMilliseconds()
- };
-
- // 替换格式字符串中的占位符
- return format.replace(/(yyyy|MM|dd|HH|mm|ss|SSS|M|d|H|m|s|S)/g, (match) => {
- return formatMap[match];
- });
- }
-
-
-
-
-
+ });
+ },
+ DateFormat: function(date, format) {
+ if (!date) {
+ date = new Date();
+ }
+ if (!format) {
+ format = 'yyyy-MM-dd HH:mm:ss';
+ }
+ // 处理参数默认值
+ if (typeof date === 'string' || typeof date === 'number') {
+ date = new Date(date);
+ }
+ date = date instanceof Date ? date : new Date();
+ format = format || 'yyyy-MM-dd';
+
+ // 检查日期是否有效
+ if (isNaN(date.getTime())) {
+ return 'Invalid Date';
+ }
+
+ // 定义格式化映射
+ const formatMap = {
+ 'yyyy': date.getFullYear(),
+ 'MM': String(date.getMonth() + 1).padStart(2, '0'),
+ 'dd': String(date.getDate()).padStart(2, '0'),
+ 'HH': String(date.getHours()).padStart(2, '0'),
+ 'mm': String(date.getMinutes()).padStart(2, '0'),
+ 'ss': String(date.getSeconds()).padStart(2, '0'),
+ 'SSS': String(date.getMilliseconds()).padStart(3, '0'),
+ 'M': date.getMonth() + 1,
+ 'd': date.getDate(),
+ 'H': date.getHours(),
+ 'm': date.getMinutes(),
+ 's': date.getSeconds(),
+ 'S': date.getMilliseconds()
+ };
+
+ // 替换格式字符串中的占位符
+ return format.replace(/(yyyy|MM|dd|HH|mm|ss|SSS|M|d|H|m|s|S)/g, (match) => {
+ return formatMap[match];
+ });
+ },
+ getdeviceShareId(id) {//获取设备分享信息
+ return request({
+ url: `/app/deviceShare/${id}`,
+ method: 'get',
+ })
+ },
+ getPermissions(type) {
+ if (!type) {
+ return undefined;
+ }
+ let array = [{
+ value: "1",
+ label: "灯光模式",
+ checked: false,
+ type: ['210', '6170', '670']
+ },
+ {
+ value: "2",
+ label: "激光模式",
+ checked: false,
+ type: ['210', '6170']
+ },
+ {
+ value: "3",
+ label: "开机画面",
+ checked: false,
+ type: ['210', '6170', '670']
+ },
+ {
+ value: "4",
+ label: "人员信息登记",
+ checked: false,
+ type: ['210', '6170', '670']
+ },
+ {
+ value: "5",
+ label: "发送信息",
+ checked: false,
+ type: ['210', '6170', '670']
+ },
+ {
+ value: "6",
+ label: "产品信息",
+ checked: false,
+ type: ['210', '6170', '670']
+ }, {
+ value: "41",
+ label: "静电探测",
+ checked: false,
+ type: ['670']
+ }, {
+ value: "42",
+ label: "SOS",
+ checked: false,
+ type: ['210', '6170', '670']
+ }
+ ]
+
+ let arr=[];
+ for (let i = 0; i < array.length; i++) {
+ let item = array[i];
+ if(!item){
+ continue;
+ }
+ if(!item.type){
+ continue;
+ }
+ let typeContais=item.type.find(v=>{
+ return v.includes(type);
+ });
+ if(typeContais){
+ let json={};
+ Object.assign(json,item);
+ arr.push(json);
+ }
+ }
+ return arr;
+ }
}
\ No newline at end of file
diff --git a/utils/request.js b/utils/request.js
index 7d28d86..9bdd4b6 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -1,5 +1,5 @@
import config from '../config/index.js';
-const env = 'production'; //production development //开发of线上 改这里就行
+const env = 'development'; //production development //开发of线上 改这里就行
const BASE = config[env];
const request = (options) => {
console.log("options"+JSON.stringify(options),BASE.BASE_URL)
diff --git a/utils/update.js b/utils/update.js
index 89bf952..2b30437 100644
--- a/utils/update.js
+++ b/utils/update.js
@@ -62,7 +62,7 @@ function checkAndUpdateWgt(updateUrl) {
data: {
currentVersion: currentVersion,
platform: uni.getSystemInfoSync().platform,
- appId:"xhyc"
+ appId:"xhyc"
},
success: (res) => {
// console.log("res=>",res)