123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <template>
- <view>
- <view class="home-list-item d-flex a-center j-sb animated fadeIn fast" hover-class="home-list-hover"
- @tap="clickevent">
- <view class="d-flex a-center">
- <view v-if="item.icon" class="icon iconfont" :class="['icon-'+item.icon]"></view> {{item.name}}
- </view>
- <view class="d-flex a-center j-center rightText">
- {{item.text}}
- <view class="icon iconfont" :class="{'icon-youjiantou':!item.data}">{{item.data || ''}}</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- const PACKAGE_INFO_KEY = '__package_info__'
- export default {
- data() {
- return {}
- },
- props: {
- item: Object,
- index: Number,
- someData: Object
- },
- onShow() {
- //获取支付宝回调code
- },
- methods: {
- clickevent() {
- switch (this.item.clicktype) {
- case "navigateTo":
- if (this.item.url) {
- let option = {
- url: this.item.url
- };
- if (this.item.auth) {
- return this.navigate(option, 'navigateTo', true);
- }
- uni.navigateTo(option);
- }
- break;
- case "switchTab":
- if (this.item.url) {
- let option = {
- url: this.item.url
- };
- if (this.item.auth) {
- return this.navigate(option, 'switchTab', true);
- }
- uni.switchTab(option);
- }
- break;
- case "clear":
- uni.showModal({
- title: '提示',
- content: '是否要清除缓存?',
- confirmText: '立刻清除',
- success: res => {
- if (res.confirm) {
- uni.showToast({
- title: '清除缓存成功!',
- icon: "none"
- });
- }
- },
- });
- break;
- case "weixin":
- if (this.someData.weixinstatus) {
- uni.showToast({
- title: '已绑定',
- icon: 'none'
- });
- } else {
- this.bindother();
- }
- break;
- case "zhifubao":
- if (this.someData.zhifubaostatus) {
- uni.showToast({
- title: '已绑定',
- icon: 'none'
- });
- } else {
- this.zhofubaobindother();
- }
- break;
- case "nothing":
- uni.showToast({
- title: '更新中...',
- icon: 'none'
- });
- break;
- }
- },
- // 绑定微信
- bindother() {
- uni.login({
- provider: 'weixin',
- onlyAuthorize: true,
- success: (res) => {
- this.codeRes(res.code)
- },
- fail: (err) => {
- uni.showToast({
- title: '绑定失败',
- icon: "none"
- });
- }
- });
- },
- // 绑定支付宝
- zhofubaobindother() {
- let urls =
- 'https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=2021004153668213&scope=auth_user&redirect_uri=https://test.baoxianzhanggui.com/pay/';
- urls = encodeURIComponent(urls); //将地址编码成浏览器访问的格式
- plus.runtime.openURL(
- 'alipays://platformapi/startapp?appId=20000067&url=' + urls,
- res => {
- //这里写打开URL地址失败后的处理0
- console.log(res);
- uni.showModal({
- content: '本机未检测到对应客户端,是否打开浏览器访问页面?',
- success: function(res) {
- if (res.confirm) {
- //plus.runtime.openURL();
- }
- }
- });
- },
- 'com.eg.android.AlipayGphone'
- );
- },
- async codeRes(code) {
- let res = await this.$http.post("/wechat/bind", {
- code: code,
- })
- this.$emit('weixinMsg', res);
- },
- }
- }
- </script>
- <style scoped>
- .home-list-item {
- padding: 20upx;
- border-top: 1upx solid #F4F4F4;
- border-bottom: 1upx solid #F4F4F4;
- }
- .home-list-item>view:first-child {
- color: #333333;
- }
- .home-list-item>view:first-child>view {
- margin-right: 10upx;
- font-size: 32upx;
- }
- .home-list-item>view:last-child {
- color: #CCCCCC;
- }
- .home-list-hover {
- background: #f4f4f4;
- }
- .rightText {
- font-size: 30upx;
- }
- .icon {
- margin-left: 10upx;
- font-size: 24upx;
- }
- </style>
|