| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <view>
- <view class="cell" :style="{ borderRadius: round }">
- <view class="cellItem dis a-c j-s" v-for="(item, index) in celllist" :key="index" @tap="cellClick(item)">
- <view class="left dis a-c">
- <image v-if="item.icon" :src="item.icon" mode=""></image>
- <text class="leftTitle" :style="leftStyle">{{ item.title }}</text>
- </view>
- <view class="Right dis a-c">
- <view class="mr-1 dis a-c j-c">
- <text v-if="item.value" style="font-size: ;">{{ item.value }}</text>
- <slot v-else name="customContent" :item="item" :index="index">
- </slot>
- </view>
- <image v-if="item.rightIcon !== undefined ? item.rightIcon : rightIcon" class="rightArrow"
- src="/static/icon/my/arrowRight.png" mode="">
- </image>
- </view>
- </view>
- </view>
- <!-- 更新组件:结果通过 update() 的返回值拿回,不再依赖事件桥接 -->
- <app-update ref="app_update"></app-update>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from "vuex"
- import appUpdate from "@/components/yzhua006-update/app-update"; //app更新组件
- export default {
- components: {
- appUpdate,
- },
- props: {
- // 单元格列表
- celllist: {
- type: Array,
- default: () => []
- },
- /*圆角 */
- round: {
- type: String,
- default: '0'
- },
- leftStyle: {
- type: Object,
- default: () => {}
- },
- rightIcon: {
- type: Boolean,
- default: true,
- }
- },
- data() {
- return {
- hasUpdate: false,
- latestVersion: '', // 检测到的最新版本号
- };
- },
- computed: {
- ...mapState(['userInfo']),
- },
- methods: {
- //菜单点击回调
- cellClick(item) {
- if (typeof item.handler === 'function') {
- // 如果配置了 handler,直接执行
- item.handler(item);
- return;
- }
- switch (item.clickType) {
- case 'navigate':
- if (item.url) {
- uni.navigateTo({
- url: item.url,
- })
- } else {
- uni.showToast({
- title: '链接错误,无法跳转',
- icon: "none"
- });
- }
- break;
- case 'checkVersion': //检查版本
- //#ifdef APP-PLUS
- // 直接通过 update() 的返回值拿检查结果,不走事件桥接
- // 返回值结构:{ hasUpdate, latestVersion }
- this.$refs.app_update.update().then((res) => {
- this.updateStatus(res);
- }).catch((e) => {
- console.error('[checkVersion] 检查更新失败:', e);
- });
- //#endif
- // 非app端不检查更新
- //#ifdef H5
- uni.showToast({
- title: '请在App中操作',
- icon: "none"
- });
- //#endif
- break;
- case 'auth': //实名认证 0.未认证 1. 认证成功 2. 认证驳回"
- if (this.userInfo.sysUser.authStatus == 1) {
- uni.navigateTo({
- url: '/pages/my/identityInfo'
- })
- } else {
- uni.navigateTo({
- url: '/pages/my/realNameAuth'
- })
- }
- break;
- case 'weChat': //微信
- break;
- case 'alipay': //支付宝
- break;
- case 'clear': //清除缓存
- uni.showModal({
- title: '提示',
- content: '是否要清除缓存?',
- confirmText: '立刻清除',
- success: res => {
- if (res.confirm) {
- uni.showToast({
- title: '清除缓存成功!',
- icon: "none"
- });
- }
- },
- });
- break;
- default:
- }
- },
- // 检查结果回调:item = { hasUpdate, latestVersion }
- updateStatus(item) {
- this.hasUpdate = item.hasUpdate;
- if (item.latestVersion) {
- this.latestVersion = item.latestVersion;
- }
- if (!this.hasUpdate) {
- uni.showToast({
- title: '已经是最新版本',
- icon: "none"
- });
- }
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .cell {
- width: 100%;
- background: #FFFFFF;
- padding: 0 30rpx;
- box-sizing: border-box;
- .cellItem {
- padding: 30rpx 0;
- box-sizing: border-box;
- border-bottom: 1rpx solid #eee;
- // 左侧
- .left {
- image {
- width: 40rpx;
- height: 40rpx;
- margin-right: 20rpx;
- }
- .leftTitle {
- font-size: 28rpx;
- color: #333;
- }
- }
- .Right {
- width: auto;
- font-size: 30rpx;
- color: #666;
- .rightArrow {
- width: 30rpx;
- height: 30rpx;
- }
- }
- }
- :last-child {
- border-bottom: none;
- }
- }
- </style>
|