myaccount.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view v-if="!loading">
  7. <!-- 已经绑定的账号-->
  8. <view class="card" style="margin-top: 2%;" v-for="item in account" @click="accountdetail(item)">
  9. <view class="Tasktext">
  10. <image :src="item.platform_icon" mode=""></image>
  11. <span>{{item.nick_name}}</span>
  12. <image :src="suc_flag===0 ? auth_exp_img : auth_suc_img" mode=""
  13. style="height: 25rpx;padding-left: 25rpx;"></image>
  14. </view>
  15. <view class="dou">
  16. <p style="padding-right: 20rpx;color:#A8A8A8;">粉丝数</p>
  17. <p>{{item.show_fans_count}}</p>
  18. </view>
  19. <view class="clickkk">
  20. <image :src="togoimg" mode="" style="width: 16rpx;height: 30rpx;"></image>
  21. </view>
  22. </view>
  23. </view>
  24. <view v-if="!loading">
  25. <!-- 未绑定的 list_all含未绑定平台的id和name-->
  26. <view class="card" style="margin-top: 2%;" v-for="item in list_all">
  27. <view class="Tasktext" @click="bindaccount(item)">
  28. <image :src="item.platform_icon" mode=""></image>
  29. <span>绑定{{item.platform_name}}账号</span>
  30. </view>
  31. <view class="dou"></view>
  32. <view class="clickkk" @click="bindaccount(item)">
  33. <image :src="togoimg" mode="" style="width: 16rpx;height: 30rpx;"></image>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="" style="width: 100%;height: 200rpx;">
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import mvBar from "@/components/mys_navBar/mysNavBar";
  43. import {
  44. fansview
  45. } from '@/components/utils.js';
  46. export default {
  47. components: {
  48. mvBar,
  49. },
  50. data() {
  51. return {
  52. navH: getApp().globalData.navHeight,
  53. loading: false,
  54. togoimg: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/task16.png',
  55. list_all: [],
  56. account: [],
  57. suc_flag: 0, //0表示已过期,1表示未过期
  58. auth_suc_img: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/auth_suc.png',
  59. auth_exp_img: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/auth-exp.png',
  60. mysNavConfig: {
  61. /* 开启单页显示首页图标 */
  62. isHome: true,
  63. /* 固定导航 */
  64. navFixed: true,
  65. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  66. navTitle: {
  67. text: "社媒账号绑定",
  68. color: "",
  69. fontSize: "32rpx", // px upx rpx
  70. fontWeight: "normal", // 100 - 700
  71. },
  72. btnType: "type2",
  73. onLeftClick: '',
  74. /* type2 按钮 */
  75. type2Config: {
  76. // 左图标
  77. leftPath: "/static/img/png2.png",
  78. // 右图标
  79. rightPath: "/static/img/png4.png",
  80. // 圆角
  81. radius: "40rpx",
  82. },
  83. },
  84. }
  85. },
  86. async onShow() {
  87. this.loading = true;
  88. uni.showLoading({
  89. title: '加载中'
  90. });
  91. await this.getlist_all()
  92. await this.getlist_bind()
  93. //检查token是否有效,发送获取销量接口,得到code值
  94. await this.checkToken()
  95. uni.hideLoading();
  96. this.loading = false;
  97. },
  98. onLoad() {},
  99. methods: {
  100. tomylocation() {
  101. uni.navigateTo({
  102. url: './mylocation'
  103. });
  104. },
  105. topersoninfo() {
  106. uni.navigateTo({
  107. url: './personinfo'
  108. });
  109. },
  110. tomybank() {
  111. uni.navigateTo({
  112. url: './mybank'
  113. });
  114. },
  115. // 信息表
  116. // 此前已获取所有平台的信息
  117. getlist_bind() {
  118. //查询快手平台绑定表
  119. return this.$https.get('/youngee/c/t/g/get-talent-account-kuaishou')
  120. .then(res => {
  121. console.log("get list_bind----", res)
  122. // !== -3表示绑定了平台
  123. if (res.data.code !== -3) {
  124. this.account = res.data.data
  125. for (var i = 0; i < this.account.length; i++) {
  126. this.account[i].show_fans_count = this.account[i].fan
  127. for (var j = 0; j < this.list_all.length; j++) {
  128. if (this.list_all[j].id == this.account[i].platform_id) {
  129. this.account[i].platform_icon = this.list_all[j].platform_icon
  130. //表示从索引 j 开始删除1个元素。list_all中,剩下的都是未绑定的平台
  131. this.list_all.splice(j, 1)
  132. }
  133. }
  134. }
  135. }
  136. })
  137. },
  138. // getlist() {
  139. // //查询快手平台绑定表
  140. // return this.$https.get('/youngee/c/t/g/get-talent-account')
  141. // .then(res => {
  142. // console.log("get list----", res)
  143. // // !== -3表示绑定了平台
  144. // if (res.data.code !== -3) {
  145. // this.account = res.data.data
  146. // for (var i = 0; i < this.account.length; i++) {
  147. // this.account[i].show_fans_count = fansview(this.account[i].fans_count)
  148. // for (var j = 0; j < this.list_all.length; j++) {
  149. // if (this.list_all[j].id == this.account[i].platform_id) {
  150. // this.account[i].platform_icon = this.list_all[j].platform_icon
  151. // //表示从索引 j 开始删除1个元素。list_all中,剩下的都是未绑定的平台
  152. // this.list_all.splice(j, 1)
  153. // }
  154. // }
  155. // }
  156. // }
  157. // })
  158. // },
  159. // 获取所有平台的id、icon和name
  160. getlist_all() {
  161. return this.$https.get('/youngee/c/g/get-info-tables')
  162. .then(res => {
  163. this.list_all = res.data.data.ThirdPlatform
  164. console.log("this.list_all", this.list_all)
  165. })
  166. },
  167. checkToken() {
  168. //进入页面就发送一个请求,看是否过期
  169. return this.$https.get('/youngee/c/t/g/check-token-exp')
  170. .then(res => {
  171. console.log("checkToken___", res)
  172. if (res.data.code == -2) {
  173. this.suc_flag = 0
  174. } else {
  175. this.suc_flag = 1
  176. }
  177. })
  178. },
  179. // 前往绑定账号
  180. // bindaccount(item) {
  181. // console.log("11", item)
  182. // uni.navigateTo({
  183. // url: '/page_mycenter/myinformation/bindaccount?platform_id=' + item.id
  184. // });
  185. // },
  186. //前往绑定抖音页面
  187. // 前往绑定账号
  188. bindaccount(item) {
  189. //绑定抖音平台
  190. if (item.id == 4) {
  191. uni.navigateTo({
  192. url: '/page_mycenter/bindaccounts/kuaishoubind'
  193. });
  194. } else {
  195. uni.navigateTo({
  196. url: '/page_mycenter/myinformation/bindaccount?platform_id=' + item.id
  197. });
  198. }
  199. },
  200. // 前往账号详情
  201. accountdetail(item) {
  202. uni.navigateTo({
  203. url: '/page_mycenter/bindaccounts/kuaishoubind?platform_id=' + item.platform_id +
  204. '&account_id=' + item
  205. .account_id
  206. });
  207. },
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. view {
  213. font-size: 14px;
  214. line-height: inherit;
  215. }
  216. .menu {
  217. position: fixed;
  218. top: 180rpx;
  219. border-bottom: #FCCF41;
  220. background-color: #FFFFFF;
  221. justify-content: space-around;
  222. height: 5%;
  223. width: 100%;
  224. display: flex;
  225. z-index: 10;
  226. }
  227. .menu-item p {
  228. font-weight: 600;
  229. &.lor {
  230. border-bottom: 5rpx solid #F0D232;
  231. color: #F0D232;
  232. padding-bottom: 15rpx;
  233. }
  234. }
  235. .card {
  236. display: flex;
  237. align-items: center;
  238. // justify-content: space-between;
  239. width: 88%;
  240. padding: 24rpx;
  241. margin-top: 30rpx;
  242. border-radius: 10rpx;
  243. background-color: #ffffff;
  244. margin: 0 auto;
  245. box-shadow: 0px 0px 10rpx 2rpx #F4F4F4;
  246. }
  247. .Tasktext {
  248. display: inline-block;
  249. padding: 0 0 0 1%;
  250. width: 400rpx;
  251. }
  252. .Tasktext span {
  253. color: #333333;
  254. font-weight: 550;
  255. text-indent: 2em;
  256. font-size: 30rpx;
  257. }
  258. .Tasktext image {
  259. vertical-align: middle;
  260. width: 50rpx;
  261. height: 50rpx;
  262. display: inline-block;
  263. padding-right: 14rpx;
  264. }
  265. .dou {
  266. display: flex;
  267. width: 250rpx;
  268. }
  269. .dou p {
  270. display: inline-block;
  271. font-size: 30rpx;
  272. color: #333333;
  273. font-weight: 550;
  274. }
  275. .dou span {
  276. font-size: 24rpx;
  277. color: #666666;
  278. }
  279. </style>