index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <view class="workInfo">
  3. <!-- #ifdef H5 -->
  4. <view class="pad30" v-show="isShow">
  5. <view class='default acea-row row-middle borderRadius15'>
  6. <image :src="userInfo.avatar" mode="aspectFit" class="avatar"></image>
  7. <view class="acea-row row-middle">
  8. <view class="nick_name">{{userInfo.name}}</view>
  9. </view>
  10. </view>
  11. <view class='list acea-row row-middle borderRadius15'>
  12. <view class='item acea-row row-between-wrapper'>
  13. <view class='left_name'>手机号</view>
  14. <view class='right_name' v-if="userInfo.userInfo.phone">{{userInfo.userInfo.phone}}</view>
  15. <view class='right_name' v-else>暂无</view>
  16. </view>
  17. <view class='item acea-row row-between-wrapper'>
  18. <view class='left_name'>分组</view>
  19. <view class='right_name' v-if="userInfo.userInfo.userGroup">{{userInfo.userInfo.userGroup.group_name}}</view>
  20. <view class='right_name' v-else>暂无</view>
  21. </view>
  22. <view class='item acea-row row-between'>
  23. <view class='left_name'>用户标签</view>
  24. <view class='label acea-row' v-if="userInfo.userInfo.label && userInfo.userInfo.label.length">
  25. <view class="label_bdg acea-row row-middle row-center"
  26. v-for="(item,index) in userInfo.userInfo.label" :key="index">{{item.label_name}}</view>
  27. </view>
  28. <view class='right_name' v-else>暂无</view>
  29. </view>
  30. </view>
  31. <view class='list acea-row row-middle borderRadius15'>
  32. <view class='item acea-row row-between-wrapper'>
  33. <view class='left_name'>会员等级</view>
  34. <view class='right_name' v-if="userInfo.userInfo.level">{{userInfo.userInfo.level}}</view>
  35. <view class='right_name' v-else>暂无</view>
  36. </view>
  37. <view class='item acea-row row-between-wrapper'>
  38. <view class='left_name'>推荐人</view>
  39. <view class='right_name' v-if="userInfo.userInfo.spreadUser">{{userInfo.userInfo.spreadUser.nickname}}</view>
  40. <view class='right_name' v-else>暂无</view>
  41. </view>
  42. <view class='item acea-row row-between-wrapper'>
  43. <view class='left_name'>用户类型</view>
  44. <view class='right_name' v-if="userInfo.userInfo.user_type">{{userInfo.userInfo.user_type | user_type}}</view>
  45. <view class='right_name' v-else>暂无</view>
  46. </view>
  47. <view class='item acea-row row-between-wrapper'>
  48. <view class='left_name'>余额</view>
  49. <view class='right_name' v-if="userInfo.userInfo.now_money">{{userInfo.userInfo.now_money}}</view>
  50. <view class='right_name' v-else>暂无</view>
  51. </view>
  52. <view class='item acea-row row-between-wrapper'>
  53. <view class='left_name'>推广员</view>
  54. <view class='right_name'>{{userInfo.userInfo.spread_open ? '是' : '否'}}</view>
  55. </view>
  56. <view class='item acea-row row-between-wrapper'>
  57. <view class='left_name'>生日</view>
  58. <view class='right_name' v-if="userInfo.userInfo.birthday">{{userInfo.userInfo.birthday}}</view>
  59. <view class='right_name' v-else>暂无</view>
  60. </view>
  61. </view>
  62. <view style="height: 100px;"></view>
  63. <tNav :active="0"></tNav>
  64. <!-- <view class="tui-fab-box tui-fab-right" @click="groupBack()" v-if="backGroup">
  65. <text class="iconfont icon-fanhui3"></text>
  66. </view> -->
  67. </view>
  68. <!-- #endif -->
  69. </view>
  70. </template>
  71. <script>
  72. // #ifdef H5
  73. import { initWxConfig,initAgentConfig } from "@/libs/work.js";
  74. import {getWorkAgentInfo} from "@/api/work.js";
  75. import tNav from '../components/tabNav.vue';
  76. // import {wx} from "@/utils/agent.js"
  77. export default{
  78. data() {
  79. return {
  80. userId:"",
  81. isShow:false,
  82. userInfo:{
  83. userInfo:{
  84. real_name:"",
  85. level:"",
  86. user_type:"",
  87. now_money:"",
  88. spread_open:"",
  89. birthday:"",
  90. userGroup:{},
  91. label:[],
  92. }
  93. },
  94. backGroup:false
  95. }
  96. },
  97. filters:{
  98. user_type(val){
  99. if(val =='wechat'){
  100. return '公众号'
  101. }else if(val == 'routine'){
  102. return '小程序'
  103. }else if(val == 'h5'){
  104. return 'H5'
  105. }else if(val == 'app'){
  106. return 'APP'
  107. }
  108. }
  109. },
  110. components:{tNav},
  111. onLoad(e) {
  112. this.$Cache.clear('work_user_id')
  113. if(e.userid){
  114. this.userId = e.userid;
  115. this.backGroup = true;
  116. this.$Cache.set('work_user_id',e.userid)
  117. this.getInfo();
  118. }else{
  119. initWxConfig().then((res) => {
  120. this.getUserID();
  121. }).catch((err) => {
  122. return this.$util.Tips({
  123. title: err
  124. });
  125. });
  126. }
  127. // this.getInfo();
  128. },
  129. methods:{
  130. getUserID(){
  131. if (/(iPhone|iPad|iPod|iOS|macintosh|mac os x)/i.test(navigator.userAgent)){
  132. wx.invoke('getContext', {}, (res)=>{
  133. if(res.err_msg == "getContext:ok" && res.entry == "single_chat_tools"){
  134. let entry = res.entry;
  135. //返回进入H5页面的入口类型,
  136. //目前有normal、contact_profile、single_chat_tools、group_chat_tools、chat_attachment
  137. wx.invoke('getCurExternalContact', {entry}, (response)=>{
  138. if(response.err_msg == "getCurExternalContact:ok"){
  139. //返回当前外部联系人userId
  140. this.userId = response.userId;
  141. this.$Cache.set('work_user_id',response.userId)
  142. this.getInfo();
  143. }
  144. });
  145. }else if(res.err_msg == "getContext:ok" && res.entry == "group_chat_tools"){
  146. uni.reLaunch({
  147. url:"/pages/work/groupInfo/index"
  148. })
  149. }
  150. });
  151. }else{
  152. jWeixin.invoke('getContext', {}, (res)=>{
  153. if(res.err_msg == "getContext:ok" && res.entry == "single_chat_tools"){
  154. let entry = res.entry ;
  155. //返回进入H5页面的入口类型,
  156. //目前有normal、contact_profile、single_chat_tools、group_chat_tools、chat_attachment
  157. jWeixin.invoke('getCurExternalContact', {entry}, (response)=>{
  158. if(response.err_msg == "getCurExternalContact:ok"){
  159. //返回当前外部联系人userId
  160. this.userId = response.userId;
  161. this.$Cache.set('work_user_id',response.userId)
  162. this.getInfo();
  163. }
  164. });
  165. }else if(res.err_msg == "getContext:ok" && res.entry == "group_chat_tools"){
  166. uni.reLaunch({
  167. url:"/pages/work/groupInfo/index"
  168. })
  169. }
  170. });
  171. }
  172. },
  173. getInfo(){
  174. getWorkAgentInfo({
  175. userid:this.userId,
  176. }).then(res=>{
  177. this.isShow = true;
  178. this.userInfo = res.data;
  179. }).catch(err=>{
  180. return this.$util.Tips({
  181. title: err
  182. });
  183. })
  184. },
  185. groupBack(){
  186. uni.navigateTo({
  187. url:"/pages/work/groupInfo/index?back=1"
  188. })
  189. }
  190. }
  191. }
  192. // #endif
  193. </script>
  194. <style lang="scss">
  195. /* #ifdef H5 */
  196. .workInfo{
  197. }
  198. .default {
  199. padding: 0 24rpx;
  200. height: 154rpx;
  201. background-color: #fff;
  202. margin-top: 24rpx;
  203. }
  204. .list {
  205. background-color: #fff;
  206. margin-top: 24rpx;
  207. .item{
  208. width: 100%;
  209. padding: 30rpx;
  210. .left_name{
  211. color: #666666;
  212. font-size: 30rpx;
  213. }
  214. .right_name{
  215. color: #333333;
  216. font-size: 30rpx;
  217. }
  218. .label{
  219. width: 440rpx;
  220. }
  221. .label_bdg{
  222. height: 44rpx;
  223. padding:4rpx 8rpx;
  224. background: rgba(24, 144, 255, 0.1);
  225. border-radius: 2px;
  226. margin-left: 16rpx;
  227. margin-bottom: 16rpx;
  228. font-size: 24rpx;
  229. font-family: PingFangSC-Regular, PingFang SC;
  230. font-weight: 400;
  231. color: #1890FF;
  232. }
  233. }
  234. }
  235. .avatar{
  236. width: 84rpx;
  237. height: 84rpx;
  238. border-radius: 50%;
  239. }
  240. .nick_name{
  241. font-size: 32rpx;
  242. font-weight: 500;
  243. margin: 0 12rpx 0;
  244. color: rgba(0, 0, 0, 0.65);
  245. }
  246. .badge{
  247. width: 56rpx;
  248. height: 28rpx;
  249. background: rgba(100, 64, 194, 0.16);
  250. border-radius: 4rpx;
  251. font-size: 20rpx;
  252. font-family: PingFangSC-Regular, PingFang SC;
  253. font-weight: 400;
  254. color: #6440C2;
  255. line-height: 20rpx;
  256. }
  257. .tui-fab-box {
  258. display: flex;
  259. justify-content: center;
  260. flex-direction: column;
  261. position: fixed;
  262. right:40px;
  263. bottom:100px;
  264. z-index: 99997;
  265. width: 64rpx;
  266. height: 64rpx;
  267. background: #FFFFFF;
  268. border-radius: 50%;
  269. box-shadow: 0px 0px 28rpx 0px rgba(0, 0, 0, 0.08);
  270. }
  271. .tui-fab-right {
  272. align-items: flex-end;
  273. }
  274. .iconfont{
  275. font-size: 40rpx;
  276. }
  277. /* #endif */
  278. </style>