123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- <template>
- <view class="box">
-
- <!-- v-model="active" -->
- <!-- #ifdef MP -->
- <van-tabs>
- <van-tab title="扫码">
- <view class="scan">
- <view class="scan_box">
- <image src="/static/img/scan.png" mode=""></image>
- </view>
- <view class="scan_btn" @click="scanQRCode">扫码</view>
- <view class="warn_text">
- <view class="text">
- 请确保设备插卡并且处于开机状态,SIM卡有效并且开通GPRS
- 业务
- </view>
- </view>
- </view>
- </van-tab>
- <van-tab title="输入">
- <view class="input">
- <view class="text_box">
- <input type="text" placeholder="请输入设备ID号" v-model="text">
- </view>
- <view class="scan_btn" @click="next">
- <!-- <view class=""> -->
- 下一步
- <!-- </view> -->
- </view>
- <view class="warn_text">
- <view class="text">
- 请确保设备插卡并且处于开机状态,SIM卡有效并且开通GPRS
- 业务
- </view>
- </view>
- </view>
- </van-tab>
- </van-tabs>
- <!-- #endif -->
- <!-- #ifdef APP-PLUS || H5 -->
- <!-- <view class="" style="margin-top: var(--status-bar-height);">
- <uni-nav-bar title="添加设备" left-icon="left" backgroundColor="#F35546" color="#fff" @clickLeft="back"></uni-nav-bar>
- </view> -->
- <!-- #endif -->
- <!-- #ifdef APP-PLUS || H5 -->
- <!-- 状态栏占位 -->
- <view class="status_bar"></view>
- <view class="" style="margin-top: var(--status-bar-height);">
- <uni-nav-bar title="添加设备" left-icon="left" backgroundColor="#F35546" color="#fff"
- @clickLeft="back"></uni-nav-bar>
- </view>
- <view class="tab_contant">
- <view class="tab">
- <view :class="active1" @click="chenked(1)">
- <view class="tab_itemtitle">扫码</view>
- <view class="tab_itembot" v-if="isActive==1">
- <!-- <view class="scan">
- <view class="scan_box">
- <image src="/static/img/scan.png" mode=""></image>
- </view>
- <view class="scan_btn" @click="scanQRCode">扫码</view>
- <view class="warn_text">
- <view class="text">
- 请确保设备插卡并且处于开机状态,SIM卡有效并且开通GPRS
- 业务
- </view>
- </view>
- </view> -->
- </view>
- </view>
- <view :class="active2" @click="chenked(2)">
- <view class="tab_itemtitle">输入</view>
- <view class="tab_itembot" v-if="isActive==2">
- <!-- <view class="input">
- <view class="text_box">
- <input type="text" placeholder="请输入设备ID号" v-model="text">
- </view>
- <view class="scan_btn" @click="next">
- 下一步
- </view>
- <view class="warn_text">
- <view class="text">
- 请确保设备插卡并且处于开机状态,SIM卡有效并且开通GPRS
- 业务
- </view>
- </view>
- </view> -->
- </view>
- </view>
- </view>
- </view>
- <view class="scan" v-if="isActive==1">
- <view class="scan_box">
- <image src="/static/img/scan.png" mode=""></image>
- </view>
- <view class="scan_btn" @click="scanQRCode">扫码</view>
- <view class="warn_text">
- <view class="text">
- 请确保设备插卡并且处于开机状态,SIM卡有效并且开通GPRS
- 业务
- </view>
- </view>
- </view>
- <view class="input" v-if="isActive==2">
- <view class="text_box">
- <input type="text" placeholder="请输入设备ID号" v-model="text">
- </view>
- <view class="scan_btn" @click="next">
- 下一步
- </view>
- <view class="warn_text">
- <view class="text">
- 请确保设备插卡并且处于开机状态,SIM卡有效并且开通GPRS
- 业务
- </view>
- </view>
- </view>
- <!-- #endif -->
- <!-- <u-tabs :list="list" :current="current" @click="click" lineColor="#F35546" lineWidth="88" lineHeight="4"
- bg-color="#fff"></u-tabs>
- <view class="scan" v-if="current === 0">
- <view class="scan_box">
- <image src="/static/image/scan.png" mode=""></image>
- </view>
- <view class="scan_btn" @click="scanQRCode">扫码</view>
- <view class="warn_text">
- <view class="text">
- 请确保设备插卡并且处于开机状态,SIM卡有效并且开通GPRS
- 业务
- </view>
- </view>
- </view>
- <view class="input" v-if="current === 1">
- <view class="text_box">
- <input type="text" placeholder="请输入设备ID号" v-model="text">
- </view>
- <view class="scan_btn" @click="next">
- 下一步
- </view>
- <view class="warn_text">
- <view class="text">
- 请确保设备插卡并且处于开机状态,SIM卡有效并且开通GPRS
- 业务
- </view>
- </view>
- </view> -->
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: [{
- name: '扫码'
- }, {
- name: '输入'
- }],
- current: 0,
- text: '',
- isActive: 1
- }
- },
- onShow: function() {},
- computed: {
- active1() {
- return this.isActive == 1 ? 'active' : 'active1'
- },
- active2() {
- return this.isActive == 2 ? 'active' : 'active1'
- },
- active3() {
- return this.isActive == 3 ? 'active' : 'active1'
- }
- },
- methods: {
- chenked(type) {
- this.isActive = type
- },
- back() {
- uni.navigateBack()
- },
- rightClick() {
- console.log('rightClick');
- },
- leftClick() {
- console.log('leftClick');
- },
- click(item) {
- this.current = item.index;
- },
- next() {
- console.log(this.text, 777);
- if (this.text) {
- uni.navigateTo({
- url: `/pages/equ_list/bind?deviceCode=${this.text}`
- })
- } else {
- this.$util.Tips({
- title: '请输入设备ID号'
- });
- }
- },
- scanQRCode() {
- uni.scanCode({
- success: (res) => {
- console.log(res); // 打印扫码结果
- // 在这里可以对扫码结果进行处理
- uni.navigateTo({
- url: `/pages/equ_list/bind?deviceCode=${res.result}`
- })
- },
- fail: (res) => {
- console.log(res);
- // 处理扫码失败的情况
- this.$util.Tips({
- title: '扫码失败',
- icon: 'error'
- })
- }
- });
- }
- // uni.scanCode({
- // success: res => {
- // let code = null
- // this.modelCode = null
- // if (res.result && res.result.indexOf('SN') == -1) {
- // code = +res.result
- // } else if (res.result && res.result.indexOf('"SN"') != -1) {
- // res.result = JSON.parse(res.result)
- // code = +res.result.SN
- // } else {
- // return uni.showToast({
- // icon: 'none',
- // title: '非法的TBOX编号',
- // })
- // }
- // const codeType = typeof code === 'number' && !isNaN(code)
- // if (!codeType) {
- // return uni.showToast({
- // icon: 'none',
- // title: '非法的TBOX编号',
- // })
- // }
- // // 数据重置
- // this.resetData()
- // this.tboxCode = code
- // this.scanning && this.getTBoxInfo(code)
- // },
- // fail: function() {
- // this.scanning = true
- // uni.hideLoading()
- // },
- // })
- }
- }
- </script>
- <style lang="scss">
- .tab_contant {
- // position: absolute;
- width: 750rpx;
- // height: 634px;
- // left: 0px;
- // top: 0rpx;
- background: #FFFFFF;
- border-radius: 28rpx 28rpx 0px 0px;
- display: flex;
- flex-direction: column;
- align-items: center;
- .tab {
- width: 480rpx;
- height: 100rpx;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- margin-top: 26px;
- // 选中的样式
- .active {
- width: 64px;
- height: 50px;
- display: flex;
- flex-direction: column;
- align-items: center;
- .tab_itemtitle {
- font-family: 'PingFang SC';
- font-style: normal;
- font-weight: 400;
- font-size: 16px;
- line-height: 155%;
- /* identical to box height, or 25px */
- text-align: center;
- color: #000000;
- }
- .tab_itembot {
- width: 36px;
- height: 0px;
- /* 五分钟蓝 */
- margin-top: 5px;
- border: 2px solid #F35546;
- border-radius: 50px;
- }
- }
- // 未选中的样式
- .active1 {
- width: 64px;
- height: 50px;
- display: flex;
- flex-direction: column;
- align-items: center;
- .tab_itemtitle {
- font-family: 'PingFang SC';
- font-style: normal;
- font-weight: 400;
- font-size: 12px;
- line-height: 155%;
- /* identical to box height, or 19px */
- text-align: center;
- color: #000000;
- opacity: 0.6;
- }
- .tab_itembot {
- width: 15.02px;
- height: 0px;
- margin-top: 10px;
- border: 2px solid #B9B9B9;
- border-radius: 50px;
- .scan {
- padding: 55rpx 32rpx 477rpx;
- text-align: center;
- background-color: #F7F7F7;
-
- .scan_box {
- image {
- width: 386rpx;
- height: 533rpx;
- }
- }
-
- .scan_btn {
- height: 98rpx;
- line-height: 98rpx;
- background: #F35546;
- border-radius: 9rpx;
- margin-top: 79rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: #FFFFFF;
- }
-
- .warn_text {
- font-size: 24rpx;
- font-weight: 500;
- color: #777777;
- margin-top: 42rpx;
- text-align: start;
- line-height: 33rpx;
- }
-
- }
-
- .input {
- padding: 55rpx 32rpx 477rpx;
- // text-align: center;
- height: 100%;
- background-color: #F7F7F7;
-
- .text_box {
- background-color: #fff;
- height: 98rpx;
- line-height: 98rpx;
- padding: 0 32rpx;
-
- input {
- width: 100%;
- height: 100%;
- // width: 386rpx;
- // height: 533rpx;
- }
- }
-
- .scan_btn {
- height: 98rpx;
- line-height: 98rpx;
- text-align: center;
- background: #F35546;
- border-radius: 9rpx;
- margin-top: 131rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: #FFFFFF;
- }
-
- .warn_text {
- font-size: 24rpx;
- font-weight: 500;
- color: #777777;
- margin-top: 42rpx;
- text-align: start;
- line-height: 33rpx;
- }
-
- }
- }
- }
- }
- }
- .box {
- width: 750rpx;
- height: 100vh;
- background-color: #fff;
- .scan {
- padding: 55rpx 32rpx 477rpx;
- text-align: center;
- background-color: #F7F7F7;
- .scan_box {
- image {
- width: 386rpx;
- height: 533rpx;
- }
- }
- .scan_btn {
- height: 98rpx;
- line-height: 98rpx;
- background: #F35546;
- border-radius: 9rpx;
- margin-top: 79rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: #FFFFFF;
- }
- .warn_text {
- font-size: 24rpx;
- font-weight: 500;
- color: #777777;
- margin-top: 42rpx;
- text-align: start;
- line-height: 33rpx;
- }
- }
- .input {
- padding: 55rpx 32rpx 477rpx;
- // text-align: center;
- height: 100%;
- background-color: #F7F7F7;
- .text_box {
- background-color: #fff;
- height: 98rpx;
- line-height: 98rpx;
- padding: 0 32rpx;
- input {
- width: 100%;
- height: 100%;
- // width: 386rpx;
- // height: 533rpx;
- }
- }
- .scan_btn {
- height: 98rpx;
- line-height: 98rpx;
- text-align: center;
- background: #F35546;
- border-radius: 9rpx;
- margin-top: 131rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: #FFFFFF;
- }
- .warn_text {
- font-size: 24rpx;
- font-weight: 500;
- color: #777777;
- margin-top: 42rpx;
- text-align: start;
- line-height: 33rpx;
- }
- }
- }
- /* ::v-deep .u-tabs__wrapper__nav{
- justify-content: center !important;
- } */
- ::v-deep .u-tabs__wrapper__nav__item[data-v-0de61367] {
- width: 375rpx;
- }
- ::v-deep uni-input[data-v-1b9e2be9] {
- width: 100% !important;
- height: 100% !important;
- }
- </style>
|