From c5e49c10499435802a6551b98772f95660c6f85a Mon Sep 17 00:00:00 2001 From: 王飞 <14095171+wang-fei12345@user.noreply.gitee.com> Date: 星期五, 07 三月 2025 09:15:56 +0800 Subject: [PATCH] 定位app首次提交 --- pages/index/person.vue | 322 +++++++++++++++++++++++++++++------------------------ 1 files changed, 175 insertions(+), 147 deletions(-) diff --git a/pages/index/person.vue b/pages/index/person.vue index 077fd69..2e851a4 100644 --- a/pages/index/person.vue +++ b/pages/index/person.vue @@ -15,12 +15,13 @@ </view> <view class="userinfo-value-box"> <view class="user-nickname">{{ vuex_is_login ? vuex_user :'鏄电О' }}</view> - <view class="user-nickname">{{ vuex_is_login ? company :'鏄电О' }}</view> + <view class="user-nickname">{{ vuex_is_login ? company :'鍏徃' }}</view> <!-- <view class="user-company">{{ vuex_is_login ? usercode :'鏆傛湭鐧诲綍' }}</view> --> </view> </view> - <view style="margin:0 15px;margin-top:20px;"> - <u-notice-bar v-if="text1.length!=0" mode="closable" direction="row" step :text="text1">{{text1}}</u-notice-bar> + <view style="margin:0 15px;margin-top:20px;"> + <u-notice-bar v-if="text1.length!=0" mode="closable" direction="row" step + :text="text1">{{text1}}</u-notice-bar> <u-cell-group> <u-cell size="large" icon="level" title="褰撳墠鐗堟湰" :value="appversion" isLink @click="update"> </u-cell> @@ -38,6 +39,8 @@ <u-switch slot="value" v-model="isoffline" @change="changelixian"></u-switch></u-cell> <u-cell size="large" icon="../../static/my/3wei.png" title="鏄剧ず3缁�"> <u-switch slot="value" v-model="is3wei" @change="change3wei"></u-switch></u-cell> + <u-cell size="large" icon="../../static/my/ceju.png" title="瀵荤墿闃蹭涪"> + <u-switch slot="value" v-model="isceju" @change="changeceju"></u-switch></u-cell> </u-cell-group> <image v-if="imageSrc" :src="imageSrc" mode="aspectFit"></image> </view> @@ -47,7 +50,7 @@ <u-icon name="close" style="position: absolute;right: 10px;top:10px" @click="closemodal"></u-icon> <uni-data-select style="position: absolute; width: 85%;" placeholder="閫夋嫨鏌滃瓙" v-model="value" :localdata="guizi" @change="change"></uni-data-select> - <uni-grid style="margin-top: 50px;margin-bottom: 120px;" v-if="isguizi" :column="3" :highlight="true"> + <uni-grid style="margin-top: 50px;" v-if="isguizi" :column="3" :highlight="true"> <view v-for="(locker,index) in lockers" :key="index"> <uni-grid-item v-for="(item, index) in locker" :index="index" :key="index" style="height: 20px; padding:0"> @@ -57,7 +60,7 @@ </uni-grid-item> </view> </uni-grid> - <view v-else style="background-color: #ffffff; margin-top: 30px;margin-bottom: 30px;"></view> + <view v-else style="background-color: #ffffff; margin-top: 30px;margin-bottom: 30px;"></view> <!--<u--form style="width: 80%; position: absolute;bottom: 60px;" labelPosition="left" :model="model2" :rules="rules2" ref="uForm"> <u-form-item required label="鎵嬫満鍙�:" prop="userInfo.phone" borderBottom ref="item1" labelWidth="60px"> @@ -137,13 +140,15 @@ <u-modal :show="show" :title="title" @cancel="cancel" @confirm="confirm" ref="uModal" :showCancelButton="true" :content='content'></u-modal> <successCom ref="refSuccess"></successCom> + + <!-- <bleCom></bleCom> --> </view> </template> <script> // const content = require('./content') const http = uni.$u.http - +import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update'; var url = http.config.baseURL.split(":")[0] + ":" + http.config.baseURL.split(":")[1] import successCom from '@/components/success.vue' import { @@ -151,6 +156,7 @@ get_time_cha_s } from '@/js/tools.js' import store from '@/store/index.js' + import bleCom from './ble.vue'; import linkCom from '@/components/linkBox.vue' import { updateBaseURL @@ -177,6 +183,7 @@ export default { mixins: [pagesPerson, minLogin], components: { + bleCom, successCom, linkCom }, @@ -186,7 +193,7 @@ tag: '', value: 0, guizi: [], - appversion: 'v1.0.7', + appversion: 'v1.1.0', downloadUrl: '', text1: [], isguizi: false, @@ -532,15 +539,16 @@ }, mounted() { this.lunbo() - findFakagui().then((res) => { - if (res.code == 0) { - this.guizi = res.data.map(item => ({ - value: item.deviceid, - text: item.cabinetname - })); - } - }) - + if (this.vuex_is_login) { + findFakagui().then((res) => { + if (res.code == 0) { + this.guizi = res.data.map(item => ({ + value: item.deviceid, + text: item.cabinetname + })); + } + }) + } setTimeout(() => { this.paddingTop = this.vuex_padding_top this.paddingTop += 5 @@ -548,16 +556,23 @@ }, methods: { lunbo() { - findTbUpapp().then((res) => { - if (res.code == 0) { - if (this.appversion != res.data.version) { - for (var i = 0; i < res.data.info.split(",").length; i++) { - this.text1.push(res.data.info.split(",")[i]) + // const params = { + // name: '瀹氫綅app', + // // deviceid: this.value, + // } + if (this.vuex_is_login) { + findTbUpapp().then((res) => { + console.log(res); + if (res.code == 0) { + if (this.appversion != res.data.version) { + for (var i = 0; i < res.data.info.split(",").length; i++) { + this.text1.push(res.data.info.split(",")[i]) + } + this.downloadUrl = res.data.address } - this.downloadUrl = res.data.address } - } - }) + }) + } }, change(e) { if (this.value != 0) { @@ -565,49 +580,49 @@ const params = { deviceid: this.value, } - findFakaji(params).then((res) => { + if (this.vuex_is_login) { + findFakaji(params).then((res) => { - if (res.data != 0) { - for (var j = 0; j < 3; j++) { - let num = 0 - let total = 20 - for (let i = num; i < total; i++) { - if (this.lockers[j][i].num === parseInt(res.data[j * 20 + i].slotnumber)) { - // // 璁剧疆borderColor灞炴�� - if (res.data[j * 20 + i].allowtakecard == 'true') { - this.lockers[j][i].borderColor = '#00ff00'; - this.lockers[j][i].checked = true - this.kalist.push(res.data[j * 20 + i].slotnumber) - } else { - this.lockers[j][i].borderColor = '#a3a3a3'; - this.lockers[j][i].checked = false + if (res.data != 0) { + for (var j = 0; j < 3; j++) { + let num = 0 + let total = 20 + for (let i = num; i < total; i++) { + if (this.lockers[j][i].num === parseInt(res.data[j * 20 + i].slotnumber)) { + // // 璁剧疆borderColor灞炴�� + if (res.data[j * 20 + i].allowtakecard == 'true') { + this.lockers[j][i].borderColor = '#00ff00'; + this.lockers[j][i].checked = true + this.kalist.push(res.data[j * 20 + i].slotnumber) + } else { + this.lockers[j][i].borderColor = '#a3a3a3'; + this.lockers[j][i].checked = false + } } - } - if (i == total - 1) { - break; + if (i == total - 1) { + break; + } } } } - } - }) + }) + } } else { this.isguizi = false this.this.kalist = [] } }, update() { - if (this.info == '') { + if (this.info == undefined) { this.$refs.refSuccess.showBox({ type: 'error', txt: '鏈娴嬪埌鏂扮増鏈�' }); } else { - console.log("鏇存柊鐗堟湰========銆嬨�嬨�嬨�嬨�嬨�嬨�嬨��"); - // const downloadUrl = 'http://39.106.210.13:8081/version/latest.apk'; // 鏇挎崲涓哄疄闄呯殑涓嬭浇閾炬帴 - console.log(this.downloadUrl); uni.showLoading({ title: '姝e湪涓嬭浇' }); + uni.downloadFile({ url: this.downloadUrl, header: { @@ -620,11 +635,8 @@ uni.openDocument({ filePath: res.tempFilePath, showMenu: true, - success: () => { - console.log('鏂囦欢鎵撳紑鎴愬姛'); - }, + success: () => {}, fail: (err) => { - console.error('鏂囦欢鎵撳紑澶辫触', err); uni.showToast({ title: '鏂囦欢鎵撳紑澶辫触', icon: 'none' @@ -659,7 +671,6 @@ this.model2.userInfo.yzm = '' }, check1(rowIndex) { - console.log("鍙栧崱===銆嬨�嬨�嬨�嬨�嬨��"); // 閬嶅巻姣忎釜瀛愭暟缁� if (this.rowindex != 0) { for (let i = 0; i < this.lockers.length; i++) { //3 @@ -686,12 +697,13 @@ slotnumber: this.rowindex, deviceid: this.value, } - findFakaTag(params).then((res) => { - this.tag = res.data.tagid - }) + if (this.vuex_is_login) { + findFakaTag(params).then((res) => { + this.tag = res.data.tagid + }) + } }, faka() { - console.log("鍙戝崱====銆嬨�嬨�嬨�嬨�嬨�嬨�嬨�嬨��"); this.showfaka = true }, @@ -738,7 +750,6 @@ // }, timeout: 5000, //璁剧疆瓒呮椂鏃堕棿,榛樿5绉� success: (rep) => { //鍏蜂綋鎹曡幏璇风湅鑷繁鎺ュ彛杩斿洖鐨勫舰寮� - console.log(rep); if (rep.data > 0) { for (var i = 0; i < this.kalist.length; i++) { @@ -746,23 +757,22 @@ slotnumber: this.kalist[i], deviceid: this.value, } - - undateFaka(params).then((res) => { - console.log(res); - if (res.data > 0) { - this.$refs.refSuccess.showBox({ - type: 'success', - txt: "鍙栧崱鎴愬姛锛�" - }); - } - }) + if (this.vuex_is_login) { + undateFaka(params).then((res) => { + if (res.data > 0) { + this.$refs.refSuccess.showBox({ + type: 'success', + txt: "鍙栧崱鎴愬姛锛�" + }); + } + }) + } } } }, fail(error) { - console.log(error); // uni.hideLoading(); // uni.$u.toast('缃戠粶涓嶉��'); // reject(error) @@ -805,12 +815,6 @@ data.tagid = this.tag - // data.slotnumber = cabinet.slotNumber; - // const deviceid = cabinet.deviceId; - // const tagname = sessionStorage.getItem("username"); - // const tagid = cabinet.tagid; - - console.log(data); var method = 'POST' var contentType = 'application/x-www-form-urlencoded' uni.request({ @@ -826,22 +830,21 @@ // }, timeout: 5000, //璁剧疆瓒呮椂鏃堕棿,榛樿5绉� success: (rep) => { //鍏蜂綋鎹曡幏璇风湅鑷繁鎺ュ彛杩斿洖鐨勫舰寮� - console.log(rep); if (rep.data > 0) { const params = { slotnumber: this.rowindex, deviceid: this.value, } - undateFaka(params).then((res) => { - console.log(res); - if (res.data > 0) { - this.$refs.refSuccess.showBox({ - type: 'success', - txt: "鍙栧崱鎴愬姛锛�" - }); - } - }) - + if (this.vuex_is_login) { + undateFaka(params).then((res) => { + if (res.data > 0) { + this.$refs.refSuccess.showBox({ + type: 'success', + txt: "鍙栧崱鎴愬姛锛�" + }); + } + }) + } } }, fail(error) {}, @@ -852,9 +855,7 @@ } }, - groupChange(n) { - console.log('groupChange', n); - }, + groupChange(n) {}, radioChange(n) { if (n == "鍥哄畾鍗�") { this.tagshow = true @@ -885,18 +886,19 @@ title: '姝e湪鑾峰彇楠岃瘉鐮�' }) this.yzm = this.generateRandomCode(); - console.log(this.yzm); const params = { phone: this.model2.userInfo.phone, randomNumber: this.yzm, } - sms(params).then((res) => { - uni.hideLoading(); - // 杩欓噷姝ゆ彁绀轰細琚玹his.start()鏂规硶涓殑鎻愮ず瑕嗙洊 - uni.$u.toast('楠岃瘉鐮佸凡鍙戦��'); - // 閫氱煡楠岃瘉鐮佺粍浠跺唴閮ㄥ紑濮嬪�掕鏃� - this.$refs.uCode.start(); - }) + if (this.vuex_is_login) { + sms(params).then((res) => { + uni.hideLoading(); + // 杩欓噷姝ゆ彁绀轰細琚玹his.start()鏂规硶涓殑鎻愮ず瑕嗙洊 + uni.$u.toast('楠岃瘉鐮佸凡鍙戦��'); + // 閫氱煡楠岃瘉鐮佺粍浠跺唴閮ㄥ紑濮嬪�掕鏃� + this.$refs.uCode.start(); + }) + } } else { uni.$u.toast('鍊掕鏃剁粨鏉熷悗鍐嶅彂閫�'); } @@ -913,19 +915,20 @@ title: '姝e湪鑾峰彇楠岃瘉鐮�' }) this.yzm = this.generateRandomCode(); - console.log(this.yzm); const params = { phone: this.model1.userInfo.phone, randomNumber: this.yzm, } - sms(params).then((res) => { - uni.hideLoading(); - // 杩欓噷姝ゆ彁绀轰細琚玹his.start()鏂规硶涓殑鎻愮ず瑕嗙洊 - uni.$u.toast('楠岃瘉鐮佸凡鍙戦��'); - // 閫氱煡楠岃瘉鐮佺粍浠跺唴閮ㄥ紑濮嬪�掕鏃� - this.$refs.uCode.start(); + if (this.vuex_is_login) { + sms(params).then((res) => { + uni.hideLoading(); + // 杩欓噷姝ゆ彁绀轰細琚玹his.start()鏂规硶涓殑鎻愮ず瑕嗙洊 + uni.$u.toast('楠岃瘉鐮佸凡鍙戦��'); + // 閫氱煡楠岃瘉鐮佺粍浠跺唴閮ㄥ紑濮嬪�掕鏃� + this.$refs.uCode.start(); - }) + }) + } } else { uni.$u.toast('鍊掕鏃剁粨鏉熷悗鍐嶅彂閫�'); } @@ -954,23 +957,55 @@ value: e }) }, - + change3wei(e) { store.commit('$tStore', { name: 'is3wei', value: e }) }, + changeceju(e) { + console.log(e); + // checkUpdate() + if (e==true) { + uni.reLaunch({ + url: '/pages/index/ble' + }); + }else{ + // closeBle() { //鍏抽棴钃濈墮 + uni.closeBLEConnection({ + deviceId: this.GET_CONNECT_DEVICEId, + success(res) { + store.commit('$tStore', { + name: 'GET_CONNECT_DEVICEId', + value: "" + }) + store.commit('$tStore', { + name: 'GET_BLE_DATA', + value: '璇峰厛杩炴帴钃濈墮' + }) + store.commit('$tStore', { + name: 'isceju', + value: false + }) + } + }) + // }, + } + + }, + + cancelinfo() { this.showinfo = false - this.fileList1=[] - this.model1.userInfo.phone='' - this.model1.userInfo.name='' - this.model1.userInfo.images='' - this.model1.userInfo.tagId='' - this.model1.userInfo.yzm='' + this.fileList1 = [] + this.model1.userInfo.phone = '' + this.model1.userInfo.name = '' + this.model1.userInfo.images = '' + this.model1.userInfo.tagId = '' + this.model1.userInfo.yzm = '' }, confirminfo() { this.$refs.uForm.validate().then(res => { @@ -982,7 +1017,6 @@ baoliu38: this.model1.userInfo.images, ptagid: this.model1.userInfo.tagId, } - console.log(params); var method = 'POST' var contentType = 'application/x-www-form-urlencoded' uni.request({ @@ -999,13 +1033,12 @@ // }, timeout: 5000, //璁剧疆瓒呮椂鏃堕棿,榛樿5绉� success: (rep) => { //鍏蜂綋鎹曡幏璇风湅鑷繁鎺ュ彛杩斿洖鐨勫舰寮� - console.log(rep); if (rep.data > 0) { - this.model1.userInfo.phone='' - this.model1.userInfo.name='' - this.model1.userInfo.images='' - this.model1.userInfo.tagId='' - this.model1.userInfo.yzm='' + this.model1.userInfo.phone = '' + this.model1.userInfo.name = '' + this.model1.userInfo.images = '' + this.model1.userInfo.tagId = '' + this.model1.userInfo.yzm = '' this.fileList1 = [] } }, @@ -1014,9 +1047,6 @@ uni.hideLoading(); } }); - // updateTagApi(params).then((res) => { - // console.log(res); - // }) this.showinfo = false }).catch(errors => { uni.$u.toast('鏍¢獙澶辫触', errors) @@ -1075,25 +1105,27 @@ submitForm() { // 鏇存柊 baseURL updateBaseURL("http://" + this.form.url + ':' + this.form.port); // 璋冪敤 updateBaseURL 鍑芥暟 - earlyWarning().then((res) => { - if (res.code == 0) { - this.$refs.refSuccess.showBox({ - type: 'success', - txt: "鍒囨崲鏁版嵁婧愭垚鍔燂紒" - }); - this.showpopup = false - this.form.port = '' - this.form.url = '' - } else { - this.$refs.refSuccess.showBox({ - type: 'error', - txt: res.data - }); - this.showpopup = false - this.form.port = '' - this.form.url = '' - } - }) + if (this.vuex_is_login) { + earlyWarning().then((res) => { + if (res.code == 0) { + this.$refs.refSuccess.showBox({ + type: 'success', + txt: "鍒囨崲鏁版嵁婧愭垚鍔燂紒" + }); + this.showpopup = false + this.form.port = '' + this.form.url = '' + } else { + this.$refs.refSuccess.showBox({ + type: 'error', + txt: res.data + }); + this.showpopup = false + this.form.port = '' + this.form.url = '' + } + }) + } }, camera() { this.showinfo = true @@ -1140,12 +1172,8 @@ plus.push.createMessage(content, payload, options); uni.getPushClientId({ - success: (res) => { - console.log(res.cid); - }, - fail(err) { - console.log(err) - } + success: (res) => {}, + fail(err) {} }); }, cancel() { -- Gitblit v1.9.3