linkShare.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="content">
  3. <view class="meauList">
  4. <view class="menu-item">
  5. <view class="meanLeft">
  6. <text>分享人号码</text>
  7. </view>
  8. <view class="meanRight">
  9. <text>{{ phone }}</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>设备Id</text>
  31. </view>
  32. <view class="meanRight">
  33. <text>{{ devInfo.devId }}</text></view
  34. >
  35. </view>
  36. <view class="funChoice">
  37. <view class="funItem" @click="smChange()">
  38. <label class="simple-radio"
  39. ><radio
  40. :value="messageFlag"
  41. color="#7c5345"
  42. :checked="messageFlag == true"
  43. class="hide-original"
  44. />
  45. <text>短信权限</text></label
  46. >
  47. </view>
  48. <view class="funItem">
  49. <label class="simple-radio" @click="snChange()"
  50. ><radio
  51. :value="serviceNumberFlag"
  52. color="#7c5345"
  53. :checked="serviceNumberFlag == true"
  54. class="hide-original"
  55. />
  56. <text>服务号通知</text></label
  57. >
  58. </view>
  59. <view class="funItem">
  60. <label class="simple-radio" @click="vfChange()"
  61. ><radio
  62. :value="voipFlag"
  63. color="#7c5345"
  64. :checked="voipFlag == true"
  65. class="hide-original"
  66. />
  67. <text>语音通话</text></label
  68. ></view
  69. >
  70. </view>
  71. </view>
  72. <button class="btn1" open-type="share" v-if="shareFlag">
  73. 确认分享
  74. </button>
  75. <button class="btn1" v-else>暂不可分享</button>
  76. </view>
  77. </template>
  78. <script>
  79. export default {
  80. data() {
  81. return {
  82. devInfo: "",
  83. phone: uni.getStorageSync("phone"),
  84. messageFlag: true,
  85. serviceNumberFlag: true,
  86. voipFlag: true,
  87. shareFlag: false,
  88. };
  89. },
  90. methods: {
  91. smChange() {
  92. this.messageFlag = !this.messageFlag;
  93. this.shareUserLink("权限修改成功");
  94. },
  95. snChange() {
  96. this.serviceNumberFlag = !this.serviceNumberFlag;
  97. this.shareUserLink("权限修改成功");
  98. },
  99. vfChange() {
  100. this.voipFlag = !this.voipFlag;
  101. this.shareUserLink("权限修改成功");
  102. },
  103. onShareAppMessage() {
  104. return {
  105. title: "好友向您分享了一台设备",
  106. path:
  107. "/pagesA/sharePages/sharePages?phone=" +
  108. this.phone +
  109. "&devInfo=" +
  110. JSON.stringify(this.devInfo),
  111. };
  112. },
  113. shareUserLink(itemTitle) {
  114. let shareParam = {
  115. devId: this.devInfo.devId,
  116. sharerUserId: uni.getStorageSync("userId"),
  117. sharerPhone: uni.getStorageSync("phone"),
  118. sharedUserId: "",
  119. messageFlag: this.messageFlag == true ? 0 : 1,
  120. serviceNumberFlag: this.serviceNumberFlag == true ? 0 : 1,
  121. voipFlag: this.voipFlag == true ? 0 : 1,
  122. };
  123. this.$http
  124. .post("wap/share/shareByUrl", shareParam, {
  125. header: {
  126. "Content-Type": "application/json;charset=UTF-8",
  127. },
  128. })
  129. .then((res) => {
  130. if (res.statusCode == 200) {
  131. uni.showToast({
  132. title: itemTitle,
  133. icon: "none",
  134. duration: 1500,
  135. });
  136. this.shareFlag = true;
  137. } else {
  138. uni.showToast({
  139. title: res.data.message,
  140. icon: "none",
  141. duration: 1500,
  142. });
  143. }
  144. });
  145. },
  146. },
  147. onLoad(options) {
  148. this.devInfo = JSON.parse(options.devInfo);
  149. },
  150. onShow() {
  151. setTimeout(() => {
  152. this.shareUserLink("分享链接创建成功");
  153. }, 500);
  154. },
  155. };
  156. </script>
  157. <style lang="less" scoped>
  158. .content {
  159. height: 100vh;
  160. background: linear-gradient(180deg, #faede2 0%, #f4f4f4 100%);
  161. box-sizing: border-box;
  162. padding-top: 20rpx;
  163. box-sizing: border-box;
  164. .meauList {
  165. width: 710rpx;
  166. margin: 18rpx auto;
  167. background: #fff;
  168. border-radius: 16rpx;
  169. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
  170. overflow: hidden;
  171. transition: all 0.3s ease;
  172. .menu-item {
  173. display: flex;
  174. align-items: center;
  175. justify-content: space-between;
  176. margin: 0 32rpx;
  177. padding: 32rpx 0;
  178. border-bottom: 1rpx solid #f0f0f0;
  179. &:last-of-type {
  180. border-bottom: none;
  181. }
  182. .meanLeft {
  183. flex: 1;
  184. color: #666;
  185. font-size: 28rpx;
  186. font-weight: 400;
  187. }
  188. .meanRight {
  189. flex: 1;
  190. text-align: right;
  191. color: #333;
  192. font-size: 28rpx;
  193. font-weight: 500;
  194. padding-left: 20rpx;
  195. }
  196. }
  197. .menu-bottom {
  198. display: flex;
  199. padding: 24rpx 32rpx;
  200. border-top: 1rpx solid #f0f0f0;
  201. .meanLeft,
  202. .meanRight {
  203. flex: 1;
  204. height: 80rpx;
  205. display: flex;
  206. align-items: center;
  207. justify-content: center;
  208. border-radius: 8rpx;
  209. font-size: 30rpx;
  210. font-weight: 500;
  211. transition: all 0.2s;
  212. &:active {
  213. opacity: 0.8;
  214. }
  215. }
  216. }
  217. }
  218. .funChoice {
  219. padding-left: 30rpx;
  220. padding-top: 20rpx;
  221. .funItem {
  222. .simple-radio {
  223. display: flex;
  224. align-items: center;
  225. padding: 20rpx 0;
  226. }
  227. }
  228. }
  229. .btn1 {
  230. display: flex;
  231. align-items: center;
  232. justify-content: center;
  233. width: 710rpx;
  234. height: 94rpx;
  235. margin-top: 60rpx;
  236. background: linear-gradient(105.95deg, #a27867 0%, #74483d 100%);
  237. border-radius: 28rpx;
  238. box-shadow: 0rpx 4.69rpx 18.75rpx rgba(72, 41, 29, 0.15),
  239. 0rpx 9.38rpx 9.38rpx rgba(154, 132, 89, 0.2),
  240. 0rpx -4.69rpx 28.13rpx 4.69rpx #a16647 inset;
  241. font-family: MiSans;
  242. font-weight: 500;
  243. color: #ffffff;
  244. font-size: 32rpx;
  245. }
  246. }
  247. </style>