123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
-
- <view class="container">
- <view class="item-container">
- <button class="alarm-item flex-row flex-between" @tap="bindAlarmChange" :data-index="index" v-for="(item, index) in alarm_list" :key="index">
- <view class="flex-row">
- <view class="item-text">{{ item }}</view>
- </view>
- <image class="item-icon" :src="(alarm_push & (1 << index)) != 0 ? '/static/resource/images/kaiqi.png' : '/static/resource/images/guanbi.png'"></image>
- </button>
- </view>
- </view>
- </template>
- <script>
- var config = require('../../common/config.js');
- var http = require('../../common/http.js');
- var common = require('../../common/common.js');
- var storage = require('../../common/storage.js');
- export default {
- data() {
- return {
- alarm_list: ['出围栏报警', '入围栏报警', '断电报警', '低电报警', '震动报警', '位移报警', '点火报警', '侧翻报警', '拆卸报警'],
- alarm_push: 0
- };
- }
-
- ,
- onLoad: function (options) {},
-
- onReady: function () {},
-
- onShow: function () {
- this.loadNotice();
- },
-
- onHide: function () {},
-
- onUnload: function () {},
-
- onPullDownRefresh: function () {},
-
- onReachBottom: function () {},
-
- onShareAppMessage: function () {},
- methods: {
- loadNotice: function () {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- bindAlarmChange(e) {
- const index = e.currentTarget.dataset.index;
- common.loading();
- http.postApi(
- config.API_XCX_SET_NOTICE,
- {
- alarm_push: this.alarm_push ^ (1 << index)
- },
- (resp) => {
- uni.hideLoading();
- if (resp.data.code === 200) {
- this.setData({
- alarm_push: this.alarm_push ^ (1 << index)
- });
- } else {
- common.simpleToast(resp.data.msg);
- }
- }
- );
- }
- }
- };
- </script>
- <style>
- @import './notice.css';
- </style>
|