sharePages.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="box">
  3. <view class="meauList">
  4. <view class="menu-item">
  5. <view class="meanLeft">
  6. <text>分享人号码</text>
  7. </view>
  8. <view class="meanRight">
  9. <text>{{ sharePhone }}</text></view
  10. >
  11. </view>
  12. <view class="menu-item">
  13. <view class="meanLeft">
  14. <text>设备名称</text>
  15. </view>
  16. <view class="meanRight">
  17. <text>{{ devInfo.devName }}</text></view
  18. >
  19. </view>
  20. <view class="menu-item">
  21. <view class="meanLeft">
  22. <text>设备序列号</text>
  23. </view>
  24. <view class="meanRight">
  25. <text>{{ devInfo.clientId }}</text></view
  26. >
  27. </view>
  28. <!-- <view class="menu-item">
  29. <view class="meanLeft">
  30. <text>分享时间</text>
  31. </view>
  32. <view class="meanRight">
  33. <text>{{ item.shareTime }}</text></view
  34. >
  35. </view> -->
  36. <!-- <view class="menu-item">
  37. <view class="meanLeft">
  38. <text>分享状态</text>
  39. </view>
  40. <view class="meanRight">
  41. <text v-if="item.state == 0" style="color: #7a5446"
  42. >待确认</text
  43. >
  44. <text v-if="item.state == 1" style="color: #22b85e"
  45. >已确认</text
  46. >
  47. <text v-if="item.state == 2" style="color: #ee3535"
  48. >已拒绝</text
  49. >
  50. </view>
  51. </view> -->
  52. <view class="menu-bottom">
  53. <view class="meanLeft" @click="acceptDevice(item)">授权</view>
  54. <view class="meanRight" @click="refuseDevice(item)">拒绝</view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. devInfo: "",
  64. sharePhone: "",
  65. messageFlag: true,
  66. serviceNumberFlag: true,
  67. voipFlag: true,
  68. userId: uni.getStorageSync("userId"),
  69. shareId: "",
  70. };
  71. },
  72. methods: {
  73. acceptDevice() {
  74. let userId = uni.getStorageSync("userId");
  75. if (!userId) {
  76. uni.showModal({
  77. content: "暂未登录,请重新登录",
  78. complete: (res) => {
  79. if (res.confirm) {
  80. uni.reLaunch({
  81. url: "/pagesA/loginNew/loginNew",
  82. });
  83. } else {
  84. uni.reLaunch({
  85. url: "/pagesA/loginNew/loginNew",
  86. });
  87. }
  88. },
  89. });
  90. return;
  91. }
  92. let shareConfirmParam = {
  93. // devId: this.devInfo.devId,
  94. sharedUserId: uni.getStorageSync("userId"),
  95. state: 1,
  96. sharedPhone: uni.getStorageSync("phone"),
  97. shareId: this.shareId,
  98. };
  99. console.log(shareConfirmParam, "shareConfirmParam");
  100. this.$http
  101. .post("wap/share/urlShareConfirm", shareConfirmParam, {
  102. header: {
  103. "Content-Type": "application/json;charset=UTF-8",
  104. },
  105. })
  106. .then((res) => {
  107. if (res.data.code == 200) {
  108. uni.showToast({
  109. title: "已接受该设备",
  110. icon: "success",
  111. duration: 1500,
  112. });
  113. setTimeout(() => {
  114. uni.reLaunch({
  115. url: "/pages/home/home",
  116. });
  117. }, 1500);
  118. } else {
  119. uni.showToast({
  120. title: res.data.message,
  121. icon: "none",
  122. duration: 1500,
  123. });
  124. }
  125. });
  126. },
  127. refuseDevice() {
  128. let shareConfirmParam = {
  129. // devId: this.devInfo.devId,
  130. sharedUserId: uni.getStorageSync("userId"),
  131. state: 2,
  132. sharedPhone: this.sharePhone,
  133. shareId: this.shareId,
  134. };
  135. this.$http
  136. .post("wap/share/urlShareConfirm", shareConfirmParam, {
  137. header: {
  138. "Content-Type": "application/json;charset=UTF-8",
  139. },
  140. })
  141. .then((res) => {
  142. if (res.data.code == 200) {
  143. uni.showToast({
  144. title: "已拒绝该设备",
  145. icon: "success",
  146. duration: 1500,
  147. });
  148. setTimeout(() => {
  149. uni.reLaunch({
  150. url: "/pages/home/home",
  151. });
  152. }, 1500);
  153. } else {
  154. uni.showToast({
  155. title: res.data.message,
  156. icon: "none",
  157. duration: 1500,
  158. });
  159. }
  160. });
  161. },
  162. },
  163. onLoad(options) {
  164. this.devInfo = JSON.parse(options.devInfo);
  165. this.sharePhone = options.phone;
  166. this.shareId = options.shareId;
  167. },
  168. onShow() {
  169. let userId = uni.getStorageSync("userId");
  170. if (!userId) {
  171. uni.showModal({
  172. content: "暂未登录,请重新登录",
  173. complete: (res) => {
  174. if (res.confirm) {
  175. uni.reLaunch({
  176. url: "/pagesA/loginNew/loginNew",
  177. });
  178. } else {
  179. uni.reLaunch({
  180. url: "/pagesA/loginNew/loginNew",
  181. });
  182. }
  183. },
  184. });
  185. }
  186. },
  187. onShareAppMessage() {},
  188. };
  189. </script>
  190. <style lang="less" scoped>
  191. .box {
  192. padding: 10rpx 18rpx;
  193. width: 100vw;
  194. height: 100vh;
  195. background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
  196. box-sizing: border-box;
  197. .meauList {
  198. width: 710rpx;
  199. margin: 18rpx auto;
  200. background: #fff;
  201. border-radius: 16rpx;
  202. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
  203. overflow: hidden;
  204. transition: all 0.3s ease;
  205. .menu-item {
  206. display: flex;
  207. align-items: center;
  208. justify-content: space-between;
  209. margin: 0 32rpx;
  210. padding: 32rpx 0;
  211. border-bottom: 1rpx solid #f0f0f0;
  212. &:last-of-type {
  213. border-bottom: none;
  214. }
  215. .meanLeft {
  216. flex: 1;
  217. color: #666;
  218. font-size: 28rpx;
  219. font-weight: 400;
  220. }
  221. .meanRight {
  222. flex: 1;
  223. text-align: right;
  224. color: #333;
  225. font-size: 28rpx;
  226. font-weight: 500;
  227. padding-left: 20rpx;
  228. }
  229. }
  230. .menu-bottom {
  231. display: flex;
  232. padding: 24rpx 32rpx;
  233. border-top: 1rpx solid #f0f0f0;
  234. .meanLeft,
  235. .meanRight {
  236. flex: 1;
  237. height: 80rpx;
  238. display: flex;
  239. align-items: center;
  240. justify-content: center;
  241. border-radius: 8rpx;
  242. font-size: 30rpx;
  243. font-weight: 500;
  244. transition: all 0.2s;
  245. &:active {
  246. opacity: 0.8;
  247. }
  248. }
  249. .meanLeft {
  250. background: #7b5245;
  251. color: white;
  252. margin-right: 16rpx;
  253. }
  254. .meanRight {
  255. background: fade(#ff4d4f, 10%);
  256. color: #ff4d4f;
  257. border: 1rpx solid fade(#ff4d4f, 30%);
  258. }
  259. }
  260. }
  261. }
  262. </style>