hejie пре 3 година
родитељ
комит
880776ba97
3 измењених фајлова са 104 додато и 32 уклоњено
  1. 62 32
      src/pages/my/index.vue
  2. BIN
      src/static/my/huangguan.png
  3. 42 0
      src/utils/copy.js

+ 62 - 32
src/pages/my/index.vue

@@ -40,9 +40,9 @@
               <view class="user_level flex_r mar_t10">
                 <image
                   class="level_img"
-                  src="/static/huangguan.png"
+                  src="/static/my/huangguan.png"
                   mode=""
-                ></image>
+                ></image> 
                 <view class="level_text">{{ userInfo.leve }}</view>
               </view>
             </view>
@@ -131,7 +131,11 @@
             url="/pages/top-up/index"
             hover-class="none"
           >
-            <image class="fun_img" src="/static/my/recharge.png" mode=""></image>
+            <image
+              class="fun_img"
+              src="/static/my/recharge.png"
+              mode=""
+            ></image>
             <view class="fun_text">充值</view>
           </navigator>
           <navigator
@@ -180,7 +184,11 @@
             url="/pages/group-list/index"
             hover-class="none"
           >
-            <image class="fun_img" src="/static/my/my_pintuan.png" mode=""></image>
+            <image
+              class="fun_img"
+              src="/static/my/my_pintuan.png"
+              mode=""
+            ></image>
             <view class="fun_text">发起拼团</view>
           </navigator>
           <navigator
@@ -225,7 +233,11 @@
             url="/pages/withdraw-list/index"
             hover-class="none"
           >
-            <image class="fun_img" src="/static/my/withdraw.png" mode=""></image>
+            <image
+              class="fun_img"
+              src="/static/my/withdraw.png"
+              mode=""
+            ></image>
             <view class="fun_text">提现明细</view>
           </navigator>
           <navigator
@@ -241,7 +253,11 @@
             url="/pages/sign-list/index"
             hover-class="none"
           >
-            <image class="fun_img" src="/static/my/inte-list.png" mode=""></image>
+            <image
+              class="fun_img"
+              src="/static/my/inte-list.png"
+              mode=""
+            ></image>
             <view class="fun_text">积分明细</view>
           </navigator>
         </view>
@@ -287,7 +303,11 @@
             url="/pages/szw-order-list/index?status=5"
             hover-class="none"
           >
-            <image class="fun_img" src="/static/my/evaluate.png" mode=""></image>
+            <image
+              class="fun_img"
+              src="/static/my/evaluate.png"
+              mode=""
+            ></image>
             <view class="fun_text">待评价</view>
           </navigator>
           <navigator
@@ -316,7 +336,11 @@
             url="/pages/notice/index"
             hover-class="none"
           >
-            <image class="fun_img" src="/static/my/feedback.png" mode=""></image>
+            <image
+              class="fun_img"
+              src="/static/my/feedback.png"
+              mode=""
+            ></image>
             <view class="fun_text">用户须知</view>
           </navigator>
           <navigator
@@ -332,7 +356,11 @@
               open-type="contact"
               style="background: #fff; border: 0; line-height: 1; padding: 0"
             >
-              <image class="fun_img" src="/static/my/service.png" mode=""></image>
+              <image
+                class="fun_img"
+                src="/static/my/service.png"
+                mode=""
+              ></image>
               <view class="fun_text">在线客服</view>
             </button>
           </view>
@@ -360,8 +388,8 @@ let app = getApp();
 var appEv = app.$vm.$options;
 // import { ReqApi } from "@/utils/reqTools.js";
 import authorizeModule from "@/components/authorize-module/index";
-// import uniCopy from "@/js_sdk/xb-copy/uni-copy.js";
-import { get, post } from "@/request/api.js";
+import uniCopy from "../../utils/copy";
+import { get, post, u_post } from "@/request/api.js";
 export default {
   components: {
     authorizeModule,
@@ -375,6 +403,7 @@ export default {
       customerServiceWeiXin: "", // 客服微信
       isShiMing: true,
       agentName: "", // 缘起
+      user_id: undefined,
     };
   },
   onLoad: function (options) {
@@ -397,13 +426,13 @@ export default {
       app.globalData.systemUserInfo && app.globalData.systemUserInfo.userId
         ? app.globalData.systemUserInfo.userId
         : "";
+
     if (!userId || userId == "" || userId == undefined) {
       // #ifdef  MP-WEIXIN
       that.showAuth = true;
       appEv.authorizeUserInfo((res) => {
         if (res) {
           that.shopInfo = app.globalData.shopInfo;
-
           that.showAuth = false;
           that.loadData();
         }
@@ -419,24 +448,25 @@ export default {
       });
       // #endif
     } else {
+      console.log(userId, "我是获取到的ID");
+      this.user_id = userId;
       this.loadData();
     }
   },
   methods: {
     // 获取用户信息
-    loadData: function () {
-      let that = this;
-      const info = reqApi.getMyIndex();
-      if (info) {
-        info.then((res) => {
-          if (res.data.status == 200) {
-            that.userInfo = res.data.userInfo;
-            that.userInfoAccount = res.data.userInfoAccount;
-            that.customerServiceWeiXin = res.data.customerServiceWeiXin;
-            that.isShiMing = res.data.userInfo.identifyFlag == 0 ? false : true;
-          }
-        });
-      }
+    loadData() {
+      u_post("ShuZiTeaYW/my/index", {
+        userId: this.user_id,
+      }).then((res) => {
+        if (res.status == 200) {
+          this.userInfo = res.userInfo;
+          this.userInfoAccount = res.userInfoAccount;
+          this.customerServiceWeiXin = res.customerServiceWeiXin;
+          this.isShiMing = res.userInfo.identifyFlag == 0 ? false : true;
+          // this.BannerImg = res.list;
+        }
+      });
     },
     //授权并登录
     onAuthSuccess: function () {
@@ -449,7 +479,7 @@ export default {
       });
     },
     // 跳转到实名页面
-    goToAutonym: function () {
+    goToAutonym() {
       let that = this;
       const info = reqApi.identifyUserPayment();
       if (info) {
@@ -542,12 +572,12 @@ export default {
       }
     },
     // 复制账号
-    copyText: function (e) {
-      //   uniCopy({
-      //     content: e,
-      //     success: (res) => {},
-      //     error: (e) => {},
-      //   });
+    copyText(e) {
+        uniCopy({
+          content: e,
+          success: (res) => {},
+          error: (e) => {},
+        });
     },
     // 跳转到用户设置页面
     getToSetting: function () {

BIN
src/static/my/huangguan.png


+ 42 - 0
src/utils/copy.js

@@ -0,0 +1,42 @@
+export default function uniCopy({content,success,error}) {
+	if(!content) return error('复制的内容不能为空 !')
+	content = typeof content === 'string' ? content : content.toString() // 复制内容,必须字符串,数字需要转换为字符串
+	/**
+	 * 小程序端 和 app端的复制逻辑
+	 */
+	//#ifndef H5
+	uni.setClipboardData({
+		data: content,
+		success: function() {
+			success("复制成功~")
+			console.log('success');
+		},
+		fail:function(){
+			success("复制失败~")
+		}
+	});
+	//#endif
+	
+	/**
+	 * H5端的复制逻辑
+	 */
+	// #ifdef H5
+	if (!document.queryCommandSupported('copy')) { //为了兼容有些浏览器 queryCommandSupported 的判断
+		// 不支持
+		error('浏览器不支持')
+	}
+	let textarea = document.createElement("textarea")
+	textarea.value = content
+	textarea.readOnly = "readOnly"
+	document.body.appendChild(textarea)
+	textarea.select() // 选择对象
+	textarea.setSelectionRange(0, content.length) //核心
+	let result = document.execCommand("copy") // 执行浏览器复制命令
+	if(result){
+		success("复制成功~")
+	}else{
+		error("复制失败,请检查h5中调用该方法的方式,是不是用户点击的方式调用的,如果不是请改为用户点击的方式触发该方法,因为h5中安全性,不能js直接调用!")
+	}	
+	textarea.remove()
+	// #endif
+}