Bläddra i källkod

添加埋点上报

wkw 3 veckor sedan
förälder
incheckning
37b7c9606d

+ 8 - 0
api/other.js

@@ -56,6 +56,14 @@ export function couponListApi(params) {
   });
 }
 
+//获取券码信息
+export function couponDetail(coupon_id) {
+  return request({
+    url: `/api/coupon/${coupon_id}`,
+    method: 'GET'
+  });
+}
+
 
 
 

+ 3 - 7
app.js

@@ -1,4 +1,5 @@
-import {login,getUserInfo} from '/api/user';
+import {login} from './api/user';
+import { FETCH_AND_FORMAT_USER_INFO } from './utils/util.js'
 App({
   onLaunch() {
     // 登录
@@ -6,12 +7,7 @@ App({
       success: async ret => {
         const res = await login({code:ret.code});
         wx.setStorageSync('token', res.data.token_type + ' ' + res.data.access_token);
-        const userRes = await getUserInfo();
-        this.globalData.userInfo = {
-          ...userRes.data,
-          avatar:userRes.data.avatar?userRes.data.avatar:'https://img.yzcdn.cn/vant/cat.jpeg',
-          nickname:userRes.data.nickname || userRes.data.username.substring(0,6)
-        };
+        this.globalData.userInfo = await FETCH_AND_FORMAT_USER_INFO();
       }
     })
   },

+ 2 - 1
custom-tab-bar/index.js

@@ -1,3 +1,4 @@
+const app = getApp();
 Component({
   data: {
     selected: 0,
@@ -41,7 +42,7 @@ Component({
     onShareAppMessage() {
       return {
         path: '/pages/index/index',
-        imageUrl: '/static/tabbar/weixin.png'
+        imageUrl: app.globalData.programConfig.share_img
       }
     },
     // onShareTimeline() {

+ 2 - 2
miniprogram_npm/lodash/index.js

@@ -4,7 +4,7 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport
 var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
 var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
 var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
-__DEFINE__(1758027817484, function(require, module, exports) {
+__DEFINE__(1758160678371, function(require, module, exports) {
 /**
  * @license
  * Lodash <https://lodash.com/>
@@ -17216,7 +17216,7 @@ __DEFINE__(1758027817484, function(require, module, exports) {
 }.call(this));
 
 }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
-return __REQUIRE__(1758027817484);
+return __REQUIRE__(1758160678371);
 })()
 //miniprogram-npm-outsideDeps=[]
 //# sourceMappingURL=index.js.map

+ 7 - 9
pages/coupon/coupon.js

@@ -20,18 +20,16 @@ Page({
       const res = await couponListApi({ page, pageSize: this.data.pageSize });
 
       const statusImgMap = {
-        used: '/static/image/yhx.png',   // 已核销
-        unused: '/static/image/whx.png', // 未核销
+        0: '/static/image/whx.png', // 未核销
+        1: '/static/image/yhx.png'  // 已核销
       };
 
       const newList = res.data.list || [];
       let allList = isRefresh ? newList : [...this.data.couponList, ...newList];
-      // allList = allList.map(item => ({
-      //   ...item,
-      //   typeText: item.type === 1 ? '菜品券' : '通用券',
-      //   statusImg: statusImgMap[item.status] || '/static/image/whx.png',
-      //   expireTime: item.expire_time || '--'
-      // }));
+      allList = allList.map(item => ({
+        ...item,
+        statusImg: statusImgMap[item.verify_status] || '/static/image/whx.png',
+      }));
 
       this.setData({
         couponList: allList,
@@ -64,7 +62,7 @@ Page({
   goPage(e) {
     const coupon = e.currentTarget.dataset.item;
     wx.navigateTo({
-      url: `/pages/coupon-detail/coupon-detail?id=${coupon.id}`
+      url: `/pages/couponDetail/couponDetail?id=${coupon.id}&status=${coupon.verify_status}`
     });
   }
 });

+ 5 - 5
pages/coupon/coupon.wxml

@@ -11,14 +11,14 @@
   >
     <!-- 有数据 -->
     <block wx:if="{{couponList.length > 0}}">
-      <view class="card-box" wx:for="{{couponList}}" wx:key="index" bindtap="goPage">
+      <view class="card-box" wx:for="{{couponList}}" wx:key="index" data-item="{{item}}" bindtap="goPage">
         <image class="card-img" src="/static/image/yhq.png" mode="aspectFit"/>
         <view class="card-cont">
-          <view class="card-cont-lf">{{item.typeText}}</view>
+          <view class="card-cont-lf">{{item.coupon_type || '代金券'}}</view>
           <view class="card-cont-ri">
-            <view>
-              <view>{{item.name}}</view>
-              <view class="pop-time">{{item.expireTime}}到期</view>
+            <view class="card-cont-ri-text">
+              <view class="m-ellipsis">{{item.coupon_name}}</view>
+              <view class="pop-time m-ellipsis">{{item.end_time}}到期</view>
             </view>
             <view>
               <image class="card-cont-status" src="{{item.statusImg}}" mode="aspectFit"/>

+ 17 - 3
pages/coupon/coupon.wxss

@@ -22,9 +22,10 @@
   display: flex;
   align-items: center;
   box-sizing: border-box;
-  margin: 0 28rpx 0 46rpx;
+  padding: 0 28rpx 0 46rpx;
   left: 0;
   right: 0;
+  width: 100%;
 }
 .card-cont-lf{
   font-family: PingFangSC, PingFang SC;
@@ -32,18 +33,25 @@
   font-size: 24rpx;
   color: #FDA233;
   line-height: 34rpx;
+  flex-shrink: 0;
 }
 .card-cont-ri{
-  margin-left: 126rpx;
+  margin-left: 110rpx;
   font-family: PingFangSC, PingFang SC;
   font-weight: 600;
   font-size: 28rpx;
   color: #000000;
-  /* line-height: 40rpx; */
   display: flex;
   justify-content: space-between;
   align-items: center;
   flex: 1;
+  overflow: hidden;
+  box-sizing: border-box;
+}
+.card-cont-ri-text{
+  overflow: hidden;
+  margin-right: 10rpx;
+  box-sizing: border-box;
 }
 .pop-time{
   font-family: PingFangSC, PingFang SC;
@@ -57,4 +65,10 @@
   width: 140rpx;
   height: 56rpx;
   margin-top: 10rpx;
+}
+.loading{
+  color: #969799;
+  font-size:24rpx;
+  text-align: center;
+  padding-bottom: 40px;
 }

+ 35 - 58
pages/couponDetail/couponDetail.js

@@ -1,70 +1,47 @@
+import { couponDetail } from '../../api/other';
 Page({
-
-  /**
-   * 页面的初始数据
-   */
   data: {
-    status:0
+    codeType: 'qr',
+    status:0,
+    id:'',
+    couponInfo:{}
   },
   goPage(){
     wx.switchTab({
       url: '/pages/store/store'
     })
   },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
   onLoad(options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
-
+    this.setData({
+      status:options.status,
+      id:options.id
+    })
   },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
+  onReady(){
+    this.getcouponDetail();
+  },
+  async getcouponDetail(){
+    const res = await couponDetail(this.data.id);
+    if(res.code == 200){
+      let item = {
+        ...res.data,
+        verify_status_text:res.data.verify_status == 0?'未核销':res.data.verify_status == 1?'已核销':'已过期'
+      }
+      this.setData({
+        couponInfo:item
+      })
+    }else{
+      wx.showToast({
+        title: res.message || '请求失败',
+        icon: 'none',
+        duration: 2000
+      });
+    }
+    console.log(res)
+  },
+  toggleCode() {
+    this.setData({
+      codeType: this.data.codeType === 'qr' ? 'bar' : 'qr'
+    });
   }
 })

+ 17 - 8
pages/couponDetail/couponDetail.wxml

@@ -2,18 +2,27 @@
   <header text="我的优惠券"></header>
   <view class="content">
     <view wx:if="{{status == 0}}">
-      <view class="title">烤鸭券</view>
-      <view class="time">2025-01-01到期</view>
+      <view class="title">{{couponInfo.coupon_name}}</view>
+      <view class="time">{{couponInfo.end_time}}到期</view>
     </view>
     <view class="code-box" wx:if="{{status == 0}}">
-      <view class="code-img"></view>
-      <view class="code-text">使用时向服务业出示此码</view>
-      <view class="barcode">切换至条形码</view>
+      <!-- 显示二维码 -->
+      <block wx:if="{{codeType === 'qr'}}">
+        <image class="code-img" src="{{'data:image/png;base64,' + couponInfo.qr_code}}" mode="aspectFit" />
+        <view class="code-text">使用时向服务员出示此码</view>
+        <view class="barcode" bindtap="toggleCode">切换至条形码</view>
+      </block>
+      <!-- 显示条形码 -->
+      <block wx:elif="{{codeType === 'bar'}}">
+        <image class="code-img" src="{{'data:image/png;base64,' + couponInfo.bar_code}}" mode="aspectFit" />
+        <view class="code-text">使用时向服务员出示此码</view>
+        <view class="barcode" bindtap="toggleCode">切换至二维码</view>
+      </block>
     </view>
     <view class="code-box" wx:if="{{status == 1}}">
       <image class="yhx-img" src="/static/image/yhx-bg.png" mode="aspectFit"/>
-      <view class="code-yhx-text">已核销</view>
-      <view class="barcode-yhx">2020-01-01 12:23:12核销</view>
+      <view class="code-yhx-text">{{couponInfo.verify_status_text}}</view>
+      <view class="barcode-yhx">{{couponInfo.verify_time}}核销</view>
     </view>
     <view class="store-box" bindtap="goPage">
       <view class="box-lf">
@@ -21,7 +30,7 @@
         <view>适用门店</view>
       </view>
       <view class="box-ri">
-        <view>去查看12家</view>
+        <view>去查看{{couponInfo.stores}}家</view>
         <image class="arrow-right" src="/static/image/arrow-right.png" mode="aspectFit"/>
       </view>
     </view>

+ 1 - 1
pages/couponDetail/couponDetail.wxss

@@ -31,7 +31,7 @@
 .code-img{
   width: 264rpx;
   height: 264rpx;
-  background: #FFFFFF;
+  /* background: #FFFFFF; */
   border-radius: 20rpx;
 }
 .code-text{

+ 1 - 1
pages/index/index.js

@@ -53,7 +53,7 @@ Page({
   onShareAppMessage() {
     return {
       path: '/pages/index/index',
-      imageUrl: '/static/tabbar/weixin.png'
+      imageUrl: app.globalData.programConfig.share_img
     }
   },
 })

+ 1 - 1
pages/mine/mine.wxml

@@ -6,7 +6,7 @@
         <van-image lazy-load round width="144rpx" height="144rpx" fit="cover" src="{{userInfo.avatar}}" />
       </button>
       <view class="user-text mt28">{{userInfo.nickname}}</view>
-      <view class="user-text user-number">参赛号:103910</view>
+      <view class="user-text user-number" wx:if="{{userInfo.competitionNo}}">参赛号:{{userInfo.competitionNo}}</view>
     </view>
     <view class="bg-color">
       <view class="content">

+ 75 - 20
pages/register/register.js

@@ -1,4 +1,6 @@
 import { enroll,smsSend } from '../../api/other';
+import { FETCH_AND_FORMAT_USER_INFO } from '../../utils/util.js'
+import { uploadImage } from '../../utils/upload.js';
 const app = getApp();
 Page({
   data: {
@@ -25,7 +27,10 @@ Page({
     codeText: '获取验证码',
     codeDisabled: false,
     timer: null,
-    countdown: 60
+    countdown: 60,
+    couponInfo:{},
+    filePath: '',  // 上传成功的文件路径
+    fileType: ''   // image / pdf
   },
 
   onShowPicker() {
@@ -48,26 +53,72 @@ Page({
       showPicker: false
     }, () => this.checkFormValid());
   },
-
-  // 上传文件
-  afterRead(event) {
-    const { file } = event.detail;
-    wx.uploadFile({
-      url: 'https://example.weixin.qq.com/upload', // 替换成真实接口
-      filePath: file.url,
-      name: 'file',
-      formData: { user: 'test' },
-      success: (res) => {
-        const { fileList } = this.data;
-        const path = res.data; // 假设返回路径
-        fileList.push({ ...file, url: path });
-        this.setData({
-          fileList,
-          formData: { ...this.data.formData, competition_image: path }
-        });
+  // 点击上传区域
+  chooseFile() {
+    wx.showActionSheet({
+      itemList: ['图片', 'PDF'],
+      success: res => {
+        if (res.tapIndex === 0) {
+          this.chooseImage();
+        } else {
+          this.choosePdf();
+        }
+      }
+    });
+  },
+  // 选择图片
+  chooseImage() {
+    wx.chooseImage({
+      count: 1,
+      sizeType: ['original', 'compressed'],
+      sourceType: ['album', 'camera'],
+      success: res => {
+        const path = res.tempFilePaths[0];
+        this.uploadFile(path, 'image');
       }
     });
   },
+  // 选择 PDF
+  choosePdf() {
+    wx.chooseMessageFile({
+      count: 1,
+      type: 'file',
+      success: res => {
+        const file = res.tempFiles[0];
+        if (file.name.endsWith('.pdf')) {
+          this.uploadFile(file.path, 'pdf');
+        } else {
+          wx.showToast({ title: '请选择 PDF 文件', icon: 'none' });
+        }
+      }
+    });
+  },
+  // 上传文件
+  async uploadFile(path, type) {
+    if (!path) {
+      wx.showToast({ title: '文件路径错误', icon: 'none' });
+      return;
+    }
+    try {
+      const res = await uploadImage(path);
+      console.log('上传成功:', res);
+      this.setData({
+        filePath: res.url,
+        fileType: type,
+        "formData.competition_image": res.path
+      });
+    } catch (err) {
+      console.error('上传失败:', err);
+    }
+  },
+  // 删除文件
+  removeFile() {
+    this.setData({
+      filePath: '',
+      fileType: '',
+      "formData.competition_image": ''
+    });
+  },
 
   // 输入框数据绑定
   onInput(e) {
@@ -138,8 +189,12 @@ Page({
     };
     const res = await enroll(payload);
     if (res.code === 200) {
-      wx.showToast({ title: res.data, icon: 'none', duration: 2000 });
+      // 优惠券信息
+      this.setData({
+        couponInfo:res.data[0]
+      })
       this.setData({ showRegistrationSuccess: true });
+      app.globalData.userInfo = await FETCH_AND_FORMAT_USER_INFO();
     } else {
       wx.showToast({ title: res.message || '报名失败', icon: 'none', duration: 2000 });
     }
@@ -147,7 +202,7 @@ Page({
   // 点击协议文字显示弹窗
   showAgreement(e) {
     const type = e.currentTarget.dataset.type;
-    const dataInfo = app.globalData.programConfig.marathon_event;   
+    const dataInfo = app.globalData.programConfig;   
     this.setData({
       showAgreementModal: true,
       agreementContent: type == 'rules'?dataInfo.rules : type == 'liability'?dataInfo.disclaimer : dataInfo.privacy_policy,

+ 28 - 5
pages/register/register.wxml

@@ -91,10 +91,33 @@
         <view class="from-li">
           <image class="from-li-img img-w3" src="/static/image/register/sc.png" mode="aspectFit" />
           <view class="uploader">
-            <van-uploader file-list="{{fileList}}" bind:after-read="afterRead" />
+            <!-- 已选择文件 -->
+            <block wx:if="{{filePath}}">
+              <block wx:if="{{fileType === 'image'}}">
+                <view class="preview-wrap">
+                  <image src="{{filePath}}" class="preview-img" mode="aspectFit" />
+                  <view class="delete-btn" bindtap="removeFile">
+                    <van-icon name="cross" color="#fff" size="16" class="delete-btn-icon"/>
+                  </view>
+                </view>
+              </block>
+              <block wx:elif="{{fileType === 'pdf'}}">
+                <view class="preview-wrap-pdf">
+                  <view class="pdf-preview">📄 已选择 PDF 文件</view>
+                  <text class="delete-btn-pdf" bindtap="removeFile">✖</text>
+                </view>
+              </block>
+            </block>
+
+            <!-- 未选择文件 -->
+            <block wx:if="{{!filePath}}">
+              <view class="uploader-text" bindtap="chooseFile">
+                <image class="uploader-img" src="/static/image/xj.png" mode="aspectFit"/>
+                <view>上传图片</view>
+              </view>
+            </block>
           </view>
         </view>
-
       </view>
     </view>
 
@@ -146,10 +169,10 @@
       <view class="pop-card">
         <image class="pop-card-img" src="/static/image/register/yhq-bg.png" mode="aspectFit"/>
         <view class="pop-card-cont">
-          <view class="pop-card-cont-lf">菜品券</view>
+          <view class="pop-card-cont-lf">{{couponInfo.coupon_type}}</view>
           <view class="pop-card-cont-ri">
-            <view>烤鸭券</view>
-            <view class="pop-time">2025-01-01到期</view>
+            <view class="m-ellipsis">{{couponInfo.coupon_name}}</view>
+            <view class="pop-time">{{couponInfo.end_time}}到期</view>
           </view>
         </view>
       </view>

+ 58 - 2
pages/register/register.wxss

@@ -76,6 +76,57 @@
 }
 .uploader{
   margin-top: 10rpx;
+  margin-bottom: 9rpx;
+}
+.preview-wrap{
+  position: relative;
+  display: flex;
+  width: 160rpx;
+}
+.preview-wrap-pdf{
+  display: flex;
+}
+.preview-img{
+  width: 160rpx;
+  height: 160rpx;
+}
+.delete-btn{
+  position: absolute;
+  right: 0;
+  top: 0;
+  background: rgba(0,0,0,0.6);
+  border-radius: 0 0 0 12px;
+  width:28rpx;
+  height: 28rpx;
+}
+.delete-btn-pdf{
+  margin-left: 20rpx;
+}
+.delete-btn-icon{
+  position: absolute;
+  top: -2px;
+  right: -2px;
+  transform: scale(0.5);
+}
+.uploader-text{
+  width: 328rpx;
+  height: 190rpx;
+  background: #F3F3F3;
+  border-radius: 16rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  font-family: PingFangSC, PingFang SC;
+  font-weight: 400;
+  font-size: 28rpx;
+  color: #4A4A4A;
+  line-height: 40rpx;
+}
+.uploader-img{
+  width: 48rpx;
+  height: 42.85rpx;
+  margin-bottom: 20rpx;
 }
 .agree{
   margin: 0 32rpx 32rpx;
@@ -139,15 +190,17 @@
   height: 140rpx;
 }
 .pop-card-cont{
+  width: 418rpx;
   height: 140rpx;
-  margin: 0 28rpx;
+  padding: 0 28rpx;
+  box-sizing: border-box;
   position: absolute;
   top: 0;
   display: flex;
   align-items: center;
-  box-sizing: border-box;
 }
 .pop-card-cont-lf{
+  flex-shrink: 0;
   font-family: PingFangSC, PingFang SC;
   font-weight: 600;
   font-size: 24rpx;
@@ -155,12 +208,15 @@
   line-height: 34rpx;
 }
 .pop-card-cont-ri{
+  box-sizing: border-box;
   margin-left: 72rpx;
   font-family: PingFangSC, PingFang SC;
   font-weight: 600;
   font-size: 28rpx;
   color: #000000;
   line-height: 40rpx;
+  flex: 1;
+  overflow: hidden;
 }
 .pop-time{
   font-family: PingFangSC, PingFang SC;

+ 1 - 1
pages/rules/rules.js

@@ -5,7 +5,7 @@ Page({
     rulesText:''
   },
   onLoad(options) {
-    const dataInfo = app.globalData.programConfig.marathon_event;
+    const dataInfo = app.globalData.programConfig;
     this.setData({
       headerText: options.type == 0?'活动规则':'免责声明',
       rulesText:options.type == 0?dataInfo.rules:dataInfo.disclaimer

+ 12 - 17
pages/storeDetail/storeDetail.js

@@ -1,13 +1,17 @@
 import { storeDetail } from '../../api/other';
-import { MAKE_PHONE_CALL } from '../../utils/util.js';
+import { MAKE_PHONE_CALL,REPORT_BEHAVIOR } from '../../utils/util.js';
 // import amapFile from '../../utils/amap-wx.130.js';
 Page({
   data: {
     dataInfo:{},
     latitude:0,
-    longitude:0
+    longitude:0,
+    id:'',//门店id
   },
   onLoad(options) {
+    this.setData({
+      id:options.id
+    })
     wx.getLocation({
       type: 'wgs84',
       success: (res) => {
@@ -27,7 +31,6 @@ Page({
         this.loadData(options.id)
       }
     })
-    
   },
   async loadData(id){
     const res = await storeDetail(id,{longitude:this.data.longitude,latitude:this.data.latitude});
@@ -40,21 +43,13 @@ Page({
     }
   },
   onAddress(){
+    REPORT_BEHAVIOR('门店导航', { link_id: this.data.id })
     wx.openLocation({
-    latitude: this.data.dataInfo.latitude * 1, // 纬度
-    longitude: this.data.dataInfo.longitude * 1, // 经度
-    name:this.data.dataInfo.name,
-    address: this.data.dataInfo.address,
-  })
-    // const myAmap = new amapFile.AMapWX({ key: '9570ea64f637d1744ec4944bc909176a' });
-    // myAmap.getPoiAround({
-    //   success: data => {
-    //     console.log('周边POI:', data);
-    //   },
-    //   fail: info => {
-    //     console.error(info);
-    //   }
-    // });
+      latitude: this.data.dataInfo.latitude * 1, // 纬度
+      longitude: this.data.dataInfo.longitude * 1, // 经度
+      name:this.data.dataInfo.name,
+      address: this.data.dataInfo.address,
+    })
   },
   onPhone(){
     MAKE_PHONE_CALL(this.data.dataInfo.phone);

BIN
static/image/xj.png


+ 27 - 4
utils/util.js

@@ -1,8 +1,9 @@
-const MAKE_PHONE_CALL = (phoneNumber) => {
+import { getUserInfo,behaviorReport } from '../api/user'
+// 获取手机号
+export const MAKE_PHONE_CALL = (phoneNumber) => {
   if (!phoneNumber) {
     phoneNumber = '15527606226';
   }
-
   wx.makePhoneCall({
     phoneNumber: phoneNumber,
     success() {
@@ -13,5 +14,27 @@ const MAKE_PHONE_CALL = (phoneNumber) => {
     }
   });
 };
-
-export { MAKE_PHONE_CALL };
+// 获取用户信息
+export async function FETCH_AND_FORMAT_USER_INFO() {
+  const userRes = await getUserInfo()
+  const data = userRes.data || {}
+  return {
+    ...data,
+    avatar: data.avatar || 'https://img.yzcdn.cn/vant/cat.jpeg',
+    nickname: data.nickname || data.username.substring(0,6)
+  }
+}
+// 埋点上报
+export async function REPORT_BEHAVIOR(eventName = '', extra = {}) {
+  try {
+    const res = await behaviorReport({
+      type: eventName,
+      ...extra
+    });
+    console.log('埋点成功:', res);
+    return res;
+  } catch (err) {
+    console.error('埋点失败:', err);
+    return null;
+  }
+}