123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <template>
- <view>
- <view class="tips"></view>
- <view class="search_container">
- <input
- type="text"
- v-model="inputValue1"
- class="search_public"
- confirm-type="done"
- disabled="true"
- />
- <button class="search_btn" type="submit" @click="getSubmit1">前往</button>
- </view>
- <view class="search_container marTop20">
- <input
- type="text"
- v-model="inputValue2"
- class="search_public"
- disabled="true"
- />
- <button class="search_btn" type="submit" @click="getSubmit2">前往</button>
- </view>
- </view>
- </template>
-
- <script>
- import { deviceUrlInfo } from "@/api/public.js";
- export default {
- data() {
- return {
- state: "",
- openId: "",
- flowUrl: "",
- wifiUrl: "",
- inputValue1: "流量充值",
- inputValue2: "远程配网",
- };
- },
- onLoad(e) {
- this.state = e.state;
- this.openId = e.openId;
- this.deviceUrlInfo();
- },
- methods: {
- ///获取用户信息
- deviceUrlInfo() {
- deviceUrlInfo({
- state: this.state,
- openId: this.openId,
- }).then((res) => {
- if (res.code === 0) {
- this.flowUrl = res.data.flowUrl;
- this.wifiUrl = res.data.wifiUrl;
- }
- });
- },
- getSubmit1() {
- if (this.flowUrl.length === 0) {
- deviceUrlInfo({
- state: this.state,
- openId: this.openId,
- }).then((res) => {
- if (res.code === 0) {
- this.flowUrl = res.data.flowUrl;
- this.wifiUrl = res.data.wifiUrl;
- window.location.href = this.flowUrl;
- } else {
- uni.showToast({
- title: res.message,
- icon: "none",
- mask: true,
- duration: 2000,
- });
- }
- });
- } else {
- window.location.href = this.flowUrl;
- }
- },
- getSubmit2() {
- if (this.wifiUrl.length === 0) {
- deviceUrlInfo({
- state: this.state,
- openId: this.openId,
- }).then((res) => {
- if (res.code === 0) {
- this.flowUrl = res.data.flowUrl;
- this.wifiUrl = res.data.wifiUrl;
- window.location.href = this.wifiUrl;
- } else {
- uni.showToast({
- title: res.message,
- icon: "none",
- mask: true,
- duration: 2000,
- });
- }
- });
- } else {
- window.location.href = this.wifiUrl;
- }
- },
- },
- };
- </script>
-
- <style lang="scss" scoped>
- .tips {
- padding-top: 45%;
- margin-left: 20rpx;
- margin-right: 20rpx;
- font-size: 30rpx;
- }
- .search_container {
- display: flex;
- flex-direction: row;
- margin-top: 20rpx;
- }
- .search_public {
- background: #ededed;
- height: 80rpx;
- line-height: 80rpx;
- margin-left: 40rpx;
- margin-right: 20rpx;
- border-radius: 50rpx;
- align-items: center;
- justify-content: center;
- text-align: center;
- color: black;
- }
- .search_btn {
- height: 80rpx;
- line-height: 80rpx;
- margin-top: 20rpx;
- width: 200rpx;
- align-items: center;
- justify-content: center;
- text-align: center;
- font-size: 30rpx;
- border-radius: 50rpx;
- margin-right: 40rpx;
- }
- .marTop20 {
- margin-top: 50rpx;
- }
- .explain {
- font-size: 25rpx;
- margin-top: 40rpx;
- margin-left: 20rpx;
- margin-right: 20rpx;
- }
- </style>
|