Selaa lähdekoodia

Merge branch 'test_tencent' into master_tencent

# Conflicts:
#	.env.production
Damon 9 kuukautta sitten
vanhempi
commit
c584c30507

+ 2 - 1
.env.development

@@ -4,4 +4,5 @@ NODE_ENV = development
 VUE_APP_ENV = 'development'
 
 # 开发环境接口
-VUE_APP_BASE_API = 'https://o3tapi.radio1964.com/web'
+VUE_APP_BASE_API = 'https://web.ohplay.airsmartser.com/web'
+# VUE_APP_BASE_API = 'https://o3tapi.radio1964.com/web'

+ 56 - 0
src/api/public.js

@@ -0,0 +1,56 @@
+import request from '@/utils/request'
+const header = getApp().globalData.userInfo
+
+// 获取用户openId
+export function getUserInfo(data) {
+  return request({
+    url: `/wxMp/auth/getUserInfo`,
+    header,
+    method: 'get',
+    data
+  })
+}
+
+// 获取用户是否已经绑定
+export function deviceBindInfo(data) {
+  return request({
+    url: `/wxMp/remoteControl/deviceBindInfo`,
+    header,
+    method: 'post',
+    data
+  })
+}
+
+// 绑定用户
+export function deviceBind(data) {
+  return request({
+    url: `/wxMp/remoteControl/deviceBind`,
+    header,
+    method: 'post',
+    data
+  })
+}
+
+// 获取链接
+export function deviceUrlInfo(data) {
+  return request({
+    url: `/wxMp/remoteControl/deviceUrlInfo`,
+    header,
+    method: 'post',
+    data
+  })
+}
+
+
+// 新活动(联通流量免费赠送)
+// export function doNewActivity(data) {
+//   return request({
+//     // 设置请求头
+//     header: {
+//       'content-type': 'application/x-www-form-urlencoded'
+//     },
+//     url: `/order/4GActivity/doExchange`,
+//     method: 'post',
+//     data
+//   })
+// }

+ 26 - 0
src/pages.json

@@ -229,6 +229,32 @@
         "navigationBarTitleText": "抱歉,出错了",
         "navigationStyle": "custom"
       }
+    },
+
+    {
+      // 猫王音响-绑定MAC地址
+      "path": "pages/public/uuid",
+      "style": {
+        "navigationBarTitleText": "猫王音响-绑定MAC地址",
+        "navigationStyle": "custom"
+      }
+    },
+    {
+      // 远程操作
+      "path": "pages/public/remote",
+      "style": {
+        "navigationBarTitleText": "远程操作",
+        "navigationStyle": "custom"
+      }
+    },
+
+    {
+      // 猫王音响-绑定MAC地址 腾讯使用
+      "path": "pages/public/uuidt",
+      "style": {
+        "navigationBarTitleText": "猫王音响-绑定MAC地址",
+        "navigationStyle": "custom"
+      }
     }
   ]
 }

+ 0 - 1
src/pages/pay/index.vue

@@ -233,7 +233,6 @@ export default {
       newAcitivityDetail({
         state: this.state,
       }).then((res) => {
-        console.log("asdfqwerqrqr====" + JSON.stringify(res));
         if (res.code === 0) {
           this.isReceive = res.data.isReceive;
           this.id = res.data.id;

+ 121 - 0
src/pages/public/remote.vue

@@ -0,0 +1,121 @@
+<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({
+        code: this.state,
+        code: this.openId,
+      }).then((res) => {
+        if (res.code === 0) {
+          this.flowUrl = res.data.flowUrl;
+          this.wifiUrl = res.data.wifiUrl;
+        }
+      });
+    },
+
+    getSubmit1() {
+      window.location.href = this.flowUrl;
+    },
+
+    getSubmit2() {
+      window.location.href = this.wifiUrl;
+    },
+  },
+};
+</script>
+  
+  <style lang="scss" scoped>
+.tips {
+  padding-top: 40%;
+  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: 20rpx;
+  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: 20rpx;
+  margin-right: 40rpx;
+}
+
+.marTop20 {
+  margin-top: 50rpx;
+}
+
+.explain {
+  font-size: 25rpx;
+  margin-top: 40rpx;
+  margin-left: 20rpx;
+  margin-right: 20rpx;
+}
+</style>

+ 148 - 0
src/pages/public/uuid.vue

@@ -0,0 +1,148 @@
+<template>
+  <view>
+    <view class="tips">请输入您的设备MAC地址:</view>
+    <!-- 搜索框 -->
+    <view class="search_container">
+      <input
+        type="text"
+        v-model="inputValue"
+        class="search_public"
+        focus="true"
+        confirm-type="done"
+        placeholder=""
+      />
+      <button class="search_btn" type="submit" @click="getSubmit">绑定</button>
+    </view>
+    <view class="explain">
+      MAC地址获取途径:设备页-当前连接设备-右上角箭头标展开详情-点击关于本机-单机MAC地址复制
+      <br />(绑定验证成功文字提示:“绑定成功”并跳转下个页面,绑定验证MAC地址不正确提示文字“MAC地址不正确,请确认后重新输入,绑定成功后该页面不再展示”)
+      <br />每个MAC地址限一个远程操作账号绑定,即只存在一个当前绑定远程操作账号,最新绑定的为当前绑定账号,其他账号自动失效,以此类推。</view
+    >
+  </view>
+</template>
+
+<script>
+import { deviceBind, deviceBindInfo, getUserInfo } from "@/api/public.js";
+export default {
+  data() {
+    return {
+      code: "",
+      state: "",
+      openId: "",
+      inputValue: "",
+    };
+  },
+  onLoad(e) {
+    this.code = e.code;
+    this.state = e.state;
+    this.getUserInfo();
+  },
+  methods: {
+    ///获取用户信息
+    getUserInfo() {
+      getUserInfo({
+        code: this.code,
+      }).then((res) => {
+        if (res.code === 0) {
+          this.openId = res.data.openid;
+        }
+      });
+    },
+
+    // http://ptt.radio1964.com/v1/device/get-wifi?UUId=AIrSMArT_210052355545
+    getSubmit() {
+      if (this.inputValue.trim().length === 0) {
+        uni.showToast({
+          title: "MAC地址不能为空",
+          icon: "none",
+          mask: true,
+          duration: 2000,
+        });
+        return;
+      }
+
+      deviceBindInfo({
+        state: this.state,
+        openId: this.openId,
+      }).then((res) => {
+        if (res.code === 0) {
+          var isBind = res.data.isBind;
+          ///已经绑定
+          if (isBind) {
+            uni.redirectTo({
+              url: `/pages/public/remote?state=${this.state}&openId=${this.openId}`,
+            });
+          } else {
+            deviceBind({
+              deviceMac: this.inputValue,
+              state: this.state,
+              openId: this.openId,
+            }).then((res) => {
+              if (res.code === 0) {
+                uni.redirectTo({
+                  url: `/pages/public/remote?state=${this.state}&openId=${this.openId}`,
+                });
+              } else {
+                uni.showToast({
+                  title: res.message,
+                  icon: "none",
+                  mask: true,
+                  duration: 2000,
+                });
+              }
+            });
+          }
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.tips {
+  padding-top: 40%;
+  margin-left: 40rpx;
+  margin-right: 40rpx;
+  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: start;
+  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: 4%;
+}
+
+.explain {
+  font-size: 25rpx;
+  margin-top: 40rpx;
+  margin-left: 40rpx;
+  margin-right: 40rpx;
+}
+</style>

+ 148 - 0
src/pages/public/uuidt.vue

@@ -0,0 +1,148 @@
+<template>
+  <view>
+    <view class="tips">请输入您的设备MAC地址:</view>
+    <!-- 搜索框 -->
+    <view class="search_container">
+      <input
+        type="text"
+        v-model="inputValue"
+        class="search_public"
+        focus="true"
+        confirm-type="done"
+        placeholder=""
+      />
+      <button class="search_btn" type="submit" @click="getSubmit">绑定</button>
+    </view>
+    <view class="explain">
+      MAC地址获取途径:设备页-当前连接设备-右上角箭头标展开详情-点击关于本机-单机MAC地址复制
+      <br />(绑定验证成功文字提示:“绑定成功”并跳转下个页面,绑定验证MAC地址不正确提示文字“MAC地址不正确,请确认后重新输入,绑定成功后该页面不再展示”)
+      <br />每个MAC地址限一个远程操作账号绑定,即只存在一个当前绑定远程操作账号,最新绑定的为当前绑定账号,其他账号自动失效,以此类推。</view
+    >
+  </view>
+</template>
+
+<script>
+import { deviceBind, deviceBindInfo, getUserInfo } from "@/api/public.js";
+export default {
+  data() {
+    return {
+      code: "",
+      state: "",
+      openId: "",
+      inputValue: "",
+    };
+  },
+  onLoad(e) {
+    this.code = e.code;
+    this.state = e.state;
+    this.getUserInfo();
+  },
+  methods: {
+    ///获取用户信息
+    getUserInfo() {
+      getUserInfo({
+        code: this.code,
+      }).then((res) => {
+        if (res.code === 0) {
+          this.openId = res.data.openid;
+        }
+      });
+    },
+
+    // http://ptt.radio1964.com/v1/device/get-wifi?UUId=AIrSMArT_210052355545
+    getSubmit() {
+      if (this.inputValue.trim().length === 0) {
+        uni.showToast({
+          title: "MAC地址不能为空",
+          icon: "none",
+          mask: true,
+          duration: 2000,
+        });
+        return;
+      }
+
+      deviceBindInfo({
+        state: this.state,
+        openId: this.openId,
+      }).then((res) => {
+        if (res.code === 0) {
+          var isBind = res.data.isBind;
+          ///已经绑定
+          if (isBind) {
+            uni.redirectTo({
+              url: `/pages/public/remote?state=${this.state}&openId=${this.openId}`,
+            });
+          } else {
+            deviceBind({
+              deviceMac: this.inputValue,
+              state: this.state,
+              openId: this.openId,
+            }).then((res) => {
+              if (res.code === 0) {
+                uni.redirectTo({
+                  url: `/pages/public/remote?state=${this.state}&openId=${this.openId}`,
+                });
+              } else {
+                uni.showToast({
+                  title: res.message,
+                  icon: "none",
+                  mask: true,
+                  duration: 2000,
+                });
+              }
+            });
+          }
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.tips {
+  padding-top: 40%;
+  margin-left: 40rpx;
+  margin-right: 40rpx;
+  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: start;
+  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: 4%;
+}
+
+.explain {
+  font-size: 25rpx;
+  margin-top: 40rpx;
+  margin-left: 40rpx;
+  margin-right: 40rpx;
+}
+</style>

+ 3 - 2
vue.config.js

@@ -10,7 +10,8 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `https://o3tapi.radio1964.com/web`,
+        target: `https://web.ohplay.airsmartser.com/web`,
+        // target: `https://o3tapi.radio1964.com/web`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
@@ -19,4 +20,4 @@ module.exports = {
     },
     disableHostCheck: true
   }
-}
+}