小程序跳转PC

pull/6/head
pangdundun 2023-10-08 15:37:17 +08:00
parent 97ab8e6518
commit 4d0b9210e8
47 changed files with 142 additions and 67 deletions

View File

@ -49,7 +49,7 @@
onLoad(option) { onLoad(option) {
if(option.userid){ if(option.userid){
this.userid = option.userid this.userid = option.userid
console.log(this.userid); // console.log(this.userid);
} }
}, },
methods: { methods: {
@ -70,7 +70,7 @@
}) })
} }
if (this.newPassword == this.confirmNewPassword) { if (this.newPassword == this.confirmNewPassword) {
console.log(this.userid,this.oldPassword,this.newPassword); // console.log(this.userid,this.oldPassword,this.newPassword);
this.$http({ this.$http({
url: this.api.user_update_pwd, url: this.api.user_update_pwd,
method: 'put', method: 'put',
@ -80,7 +80,7 @@
"password": this.newPassword "password": this.newPassword
} }
}).then(res=>{ }).then(res=>{
console.log(res); // console.log(res);
if(res.code == 200){ if(res.code == 200){
uni.showToast({ uni.showToast({
icon: 'success', icon: 'success',

View File

@ -142,7 +142,7 @@
</view> </view>
次施肥 次施肥
</view> </view>
<view class="changeMoreBtn" @click="toWebView"> <view class="changeMoreBtn" @click="toWebView(indexs)">
<image src="../../static/changeMore.png" mode=""></image> <image src="../../static/changeMore.png" mode=""></image>
<text>修改更多参数</text> <text>修改更多参数</text>
</view> </view>
@ -250,9 +250,10 @@
this.getReg(); this.getReg();
}, },
methods: { methods: {
toWebView() { toWebView(id) {
// console.log(id);
uni.navigateTo({ uni.navigateTo({
url: '/pages/web_view/web_view' url: '/pages/web_view/web_view?id=' + id
}) })
}, },
countData10(data) { countData10(data) {
@ -310,7 +311,7 @@
url: this.api.readFs_reg, url: this.api.readFs_reg,
data: data data: data
}).then((res) => { }).then((res) => {
console.log(res, 11); // console.log(res, 11);
if (res.code == 200) { if (res.code == 200) {
uni.hideLoading() uni.hideLoading()
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
@ -318,7 +319,7 @@
this.getType00(); this.getType00();
this.inputData1[10 + (this.indexs - 1) + '01'] = this.countData10(this.inputData1[10 + ( this.inputData1[10 + (this.indexs - 1) + '01'] = this.countData10(this.inputData1[10 + (
this.indexs - 1) + '01']) this.indexs - 1) + '01'])
console.log(this.inputData1[10 + (this.indexs - 1) + '01'], 111); // console.log(this.inputData1[10 + (this.indexs - 1) + '01'], 111);
} else { } else {
that.$refs.uToast.show({ that.$refs.uToast.show({
title: res.msg, title: res.msg,
@ -332,7 +333,7 @@
}, },
getType00() { getType00() {
var number = this.padString(this.inputData1[10 + (this.indexs - 1) + "00"].toString(2), 3) var number = this.padString(this.inputData1[10 + (this.indexs - 1) + "00"].toString(2), 3)
console.log(number); // console.log(number);
if (Number(number[0])) { if (Number(number[0])) {
this.topActive = 1 this.topActive = 1
} else if (Number(number[1])) { } else if (Number(number[1])) {

View File

@ -59,7 +59,7 @@
url: this.api.sel_eqbyid + userid, url: this.api.sel_eqbyid + userid,
method: 'GET' method: 'GET'
}).then(res => { }).then(res => {
console.log(res, '根据用户id查询对应的设备数据'); // console.log(res, 'id');
if (res.code == 200) { if (res.code == 200) {
this.deviceList=res.data this.deviceList=res.data
} }

View File

@ -326,7 +326,7 @@
url: this.api.getFs_rtdata + "?equipmentId=" + i.deviceId, url: this.api.getFs_rtdata + "?equipmentId=" + i.deviceId,
method: 'post', method: 'post',
}).then(res => { }).then(res => {
console.log(res, '主页查看施肥机实时数据'); // console.log(res, '');
if(res.code == 200){ if(res.code == 200){
uni.hideLoading({ uni.hideLoading({
title: '完成' title: '完成'

View File

@ -110,7 +110,7 @@
url: this.api.user_logout, url: this.api.user_logout,
method: 'GET' method: 'GET'
}).then(res => { }).then(res => {
console.log(res, '退出'); // console.log(res, '退');
if (res.code == 200) { if (res.code == 200) {
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
@ -168,7 +168,7 @@
uni.getStorage({ uni.getStorage({
key: 'userid', key: 'userid',
success: function(res) { success: function(res) {
console.log(res); // console.log(res);
that.$http({ that.$http({
url: that.api.sel_user, url: that.api.sel_user,
method: 'GET', method: 'GET',
@ -176,7 +176,7 @@
userId: res.data userId: res.data
} }
}).then(res => { }).then(res => {
console.log(res); // console.log(res);
if (res.code == 200) { if (res.code == 200) {
that.userName = res.data.username; that.userName = res.data.username;
that.admin = that.user_level(res.data.userType); that.admin = that.user_level(res.data.userType);

View File

@ -1,14 +1,48 @@
<template> <template>
<web-view src="https://portal.lihe-control.com/#/realTime"></web-view> <web-view v-if='src' :src="src"></web-view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
token:'',
id:'',
src:'',
userid:''
}; };
} },
onLoad(options) {
// console.log('options',options);
if(options){
this.id = options.id
}
let that = this
uni.getStorage({
key: 'token',
success: function(res) {
// console.log('res',res);
that.token = res.data;
uni.getStorage({
key:'userid',
success:function(res){
that.userid = res.data
that.src = `https://portal.lihe-control.com/#/irrigateSet?id=${that.id}&token=${that.token}&userid=${that.userid}`
// console.log(that.src);
}
})
},
fail:function(err){
uni.navigateTo({
url:'/pages/fertilizer_machine/fertilizer_machine'
});
uni.showToast({
title: "跳转失败!",
icon: 'fail',
})
}
})
}
} }
</script> </script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -214,9 +214,10 @@ var _default = {
onLoad: function onLoad(option) { onLoad: function onLoad(option) {
if (option.userid) { if (option.userid) {
this.userid = option.userid; this.userid = option.userid;
console.log(this.userid); // console.log(this.userid);
} }
}, },
methods: { methods: {
// 密码提交 // 密码提交
submit_pwd: function submit_pwd() { submit_pwd: function submit_pwd() {
@ -235,7 +236,7 @@ var _default = {
}); });
} }
if (this.newPassword == this.confirmNewPassword) { if (this.newPassword == this.confirmNewPassword) {
console.log(this.userid, this.oldPassword, this.newPassword); // console.log(this.userid,this.oldPassword,this.newPassword);
this.$http({ this.$http({
url: this.api.user_update_pwd, url: this.api.user_update_pwd,
method: 'put', method: 'put',
@ -245,7 +246,7 @@ var _default = {
"password": this.newPassword "password": this.newPassword
} }
}).then(function (res) { }).then(function (res) {
console.log(res); // console.log(res);
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({
icon: 'success', icon: 'success',

View File

@ -439,9 +439,10 @@ var _default = {
this.getReg(); this.getReg();
}, },
methods: (_methods = { methods: (_methods = {
toWebView: function toWebView() { toWebView: function toWebView(id) {
// console.log(id);
uni.navigateTo({ uni.navigateTo({
url: '/pages/web_view/web_view' url: '/pages/web_view/web_view?id=' + id
}); });
}, },
countData10: function countData10(data) { countData10: function countData10(data) {
@ -500,14 +501,14 @@ var _default = {
url: this.api.readFs_reg, url: this.api.readFs_reg,
data: data data: data
}).then(function (res) { }).then(function (res) {
console.log(res, 11); // console.log(res, 11);
if (res.code == 200) { if (res.code == 200) {
uni.hideLoading(); uni.hideLoading();
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
_this2.inputData1 = res.data; _this2.inputData1 = res.data;
_this2.getType00(); _this2.getType00();
_this2.inputData1[10 + (_this2.indexs - 1) + '01'] = _this2.countData10(_this2.inputData1[10 + (_this2.indexs - 1) + '01']); _this2.inputData1[10 + (_this2.indexs - 1) + '01'] = _this2.countData10(_this2.inputData1[10 + (_this2.indexs - 1) + '01']);
console.log(_this2.inputData1[10 + (_this2.indexs - 1) + '01'], 111); // console.log(this.inputData1[10 + (this.indexs - 1) + '01'], 111);
} else { } else {
that.$refs.uToast.show({ that.$refs.uToast.show({
title: res.msg, title: res.msg,
@ -521,7 +522,7 @@ var _default = {
}, },
getType00: function getType00() { getType00: function getType00() {
var number = this.padString(this.inputData1[10 + (this.indexs - 1) + "00"].toString(2), 3); var number = this.padString(this.inputData1[10 + (this.indexs - 1) + "00"].toString(2), 3);
console.log(number); // console.log(number);
if (Number(number[0])) { if (Number(number[0])) {
this.topActive = 1; this.topActive = 1;
} else if (Number(number[1])) { } else if (Number(number[1])) {

File diff suppressed because one or more lines are too long

View File

@ -224,7 +224,7 @@ var _default = {
url: this.api.sel_eqbyid + userid, url: this.api.sel_eqbyid + userid,
method: 'GET' method: 'GET'
}).then(function (res) { }).then(function (res) {
console.log(res, '根据用户id查询对应的设备数据'); // console.log(res, '根据用户id查询对应的设备数据');
if (res.code == 200) { if (res.code == 200) {
_this.deviceList = res.data; _this.deviceList = res.data;
} }

View File

@ -772,7 +772,7 @@ var _default = {
url: _this.api.getFs_rtdata + "?equipmentId=" + i.deviceId, url: _this.api.getFs_rtdata + "?equipmentId=" + i.deviceId,
method: 'post' method: 'post'
}).then(function (res) { }).then(function (res) {
console.log(res, '主页查看施肥机实时数据'); // console.log(res, '主页查看施肥机实时数据');
if (res.code == 200) { if (res.code == 200) {
uni.hideLoading({ uni.hideLoading({
title: '完成' title: '完成'

View File

@ -138,7 +138,7 @@ var _default = {
url: this.api.user_logout, url: this.api.user_logout,
method: 'GET' method: 'GET'
}).then(function (res) { }).then(function (res) {
console.log(res, '退出'); // console.log(res, '退出');
if (res.code == 200) { if (res.code == 200) {
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
@ -193,7 +193,7 @@ var _default = {
uni.getStorage({ uni.getStorage({
key: 'userid', key: 'userid',
success: function success(res) { success: function success(res) {
console.log(res); // console.log(res);
that.$http({ that.$http({
url: that.api.sel_user, url: that.api.sel_user,
method: 'GET', method: 'GET',
@ -201,7 +201,7 @@ var _default = {
userId: res.data userId: res.data
} }
}).then(function (res) { }).then(function (res) {
console.log(res); // console.log(res);
if (res.code == 200) { if (res.code == 200) {
that.userName = res.data.username; that.userName = res.data.username;
that.admin = that.user_level(res.data.userType); that.admin = that.user_level(res.data.userType);

View File

@ -133,7 +133,7 @@ __webpack_require__.r(__webpack_exports__);
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
/* WEBPACK VAR INJECTION */(function(uni) {
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
@ -145,10 +145,48 @@ exports.default = void 0;
// //
var _default = { var _default = {
data: function data() { data: function data() {
return {}; return {
token: '',
id: '',
src: '',
userid: ''
};
},
onLoad: function onLoad(options) {
// console.log('options',options);
if (options) {
this.id = options.id;
}
var that = this;
uni.getStorage({
key: 'token',
success: function success(res) {
// console.log('res',res);
that.token = res.data;
uni.getStorage({
key: 'userid',
success: function success(res) {
that.userid = res.data;
that.src = "https://portal.lihe-control.com/#/irrigateSet?id=".concat(that.id, "&token=").concat(that.token, "&userid=").concat(that.userid);
// console.log(that.src);
}
});
},
fail: function fail(err) {
uni.navigateTo({
url: '/pages/fertilizer_machine/fertilizer_machine'
});
uni.showToast({
title: "跳转失败!",
icon: 'fail'
});
}
});
} }
}; };
exports.default = _default; exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }) /***/ })

View File

@ -1 +1 @@
<web-view src="https://portal.lihe-control.com/#/realTime"></web-view> <block wx:if="{{src}}"><web-view src="{{src}}"></web-view></block>