my-list-item.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view>
  3. <view class="home-list-item d-flex a-center j-sb animated fadeIn fast" hover-class="home-list-hover"
  4. @tap="clickevent">
  5. <view class="d-flex a-center">
  6. <view v-if="item.icon" class="icon iconfont" :class="['icon-'+item.icon]"></view> {{item.name}}
  7. </view>
  8. <view class="d-flex a-center j-center rightText">
  9. <text v-if="item.clicktype!='auth'">{{item.text}}</text>
  10. <view v-else class="auth"
  11. :style="{background:item.backColor,border:`1px solid ${item.borderColor}`,color:item.borderColor}">
  12. <text>{{item.text}}</text>
  13. </view>
  14. <image src="../../../static/image/my/right-jiantou.png" mode="" style="width: 15px;height: 15px;">
  15. </image>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. mapState
  23. } from "vuex"
  24. const PACKAGE_INFO_KEY = '__package_info__'
  25. export default {
  26. data() {
  27. return {}
  28. },
  29. props: {
  30. item: Object,
  31. index: Number,
  32. someData: Object
  33. },
  34. onShow() {
  35. //获取支付宝回调code
  36. },
  37. computed: {
  38. ...mapState(['userInfo'])
  39. },
  40. methods: {
  41. clickevent() {
  42. console.log(this.item);
  43. switch (this.item.clicktype) {
  44. case "navigateTo":
  45. if (this.item.url) {
  46. let option = {
  47. url: this.item.url
  48. };
  49. if (this.item.auth) {
  50. return this.navigate(option, 'navigateTo', true);
  51. }
  52. uni.navigateTo(option);
  53. }
  54. break;
  55. case "switchTab":
  56. if (this.item.url) {
  57. let option = {
  58. url: this.item.url
  59. };
  60. if (this.item.auth) {
  61. return this.navigate(option, 'switchTab', true);
  62. }
  63. uni.switchTab(option);
  64. }
  65. break;
  66. case "clear":
  67. uni.showModal({
  68. title: '提示',
  69. content: '是否要清除缓存?',
  70. confirmText: '立刻清除',
  71. success: res => {
  72. if (res.confirm) {
  73. uni.showToast({
  74. title: '清除缓存成功!',
  75. icon: "none"
  76. });
  77. }
  78. },
  79. });
  80. break;
  81. case "weixin":
  82. if (this.someData.weixinstatus) {
  83. uni.showToast({
  84. title: '已绑定',
  85. icon: 'none'
  86. });
  87. } else {
  88. this.bindother();
  89. }
  90. break;
  91. case "zhifubao":
  92. if (this.someData.zhifubaostatus) {
  93. uni.showToast({
  94. title: '已绑定',
  95. icon: 'none'
  96. });
  97. } else {
  98. this.zhofubaobindother();
  99. }
  100. break;
  101. case "auth":
  102. if (this.userInfo.sysUser.status == '0' && this.userInfo.sysUser.managementSource == '2') {
  103. if (this.userInfo.sysUser.factorVerify == '2') {
  104. uni.navigateTo({
  105. url: this.item.url,
  106. })
  107. } else {
  108. this.$emit('authModal', true);
  109. }
  110. } else if (this.userInfo.sysUser.status == '8' || this.userInfo.sysUser.status == '3') {
  111. uni.navigateTo({
  112. url: this.item.url
  113. })
  114. } else if (this.userInfo.sysUser.status == '2') {
  115. uni.navigateTo({
  116. url: this.item.url,
  117. })
  118. }
  119. break;
  120. case "nothing":
  121. uni.showToast({
  122. title: '更新中...',
  123. icon: 'none'
  124. });
  125. break;
  126. }
  127. },
  128. // 绑定微信
  129. bindother() {
  130. uni.login({
  131. provider: 'weixin',
  132. onlyAuthorize: true,
  133. success: (res) => {
  134. this.codeRes(res.code)
  135. },
  136. fail: (err) => {
  137. uni.showToast({
  138. title: '绑定失败',
  139. icon: "none"
  140. });
  141. }
  142. });
  143. },
  144. // 绑定支付宝
  145. zhofubaobindother() {
  146. let urls =
  147. 'https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=2021004153668213&scope=auth_user&redirect_uri=https://test.baoxianzhanggui.com/pay/';
  148. urls = encodeURIComponent(urls); //将地址编码成浏览器访问的格式
  149. plus.runtime.openURL(
  150. 'alipays://platformapi/startapp?appId=20000067&url=' + urls,
  151. res => {
  152. //这里写打开URL地址失败后的处理0
  153. console.log(res);
  154. uni.showModal({
  155. content: '本机未检测到对应客户端,是否打开浏览器访问页面?',
  156. success: function(res) {
  157. if (res.confirm) {
  158. //plus.runtime.openURL();
  159. }
  160. }
  161. });
  162. },
  163. 'com.eg.android.AlipayGphone'
  164. );
  165. },
  166. async codeRes(code) {
  167. let res = await this.$http.post("/wechat/bind", {
  168. code: code,
  169. })
  170. this.$emit('weixinMsg', res);
  171. },
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. .home-list-item {
  177. padding: 20upx;
  178. border-top: 1upx solid #F4F4F4;
  179. border-bottom: 1upx solid #F4F4F4;
  180. }
  181. .home-list-item>view:first-child {
  182. color: #333333;
  183. }
  184. .home-list-item>view:first-child>view {
  185. margin-right: 10upx;
  186. font-size: 32upx;
  187. }
  188. .home-list-item>view:last-child {
  189. color: #CCCCCC;
  190. }
  191. .home-list-hover {
  192. background: #f4f4f4;
  193. }
  194. .rightText {
  195. font-size: 30upx;
  196. .auth {
  197. border-radius: 2px 2px 2px 2px;
  198. padding: 2px 4px;
  199. font-size: 22rpx;
  200. }
  201. }
  202. .icon {
  203. margin-left: 10upx;
  204. font-size: 24upx;
  205. }
  206. </style>