Commit 6509f975090071843d353d444c0f7092189ed609
1 parent
30757721
刷新达人更多详情页信息接口
Showing
1 changed file
with
216 additions
and
204 deletions
src/pages/recommendMore/recommendMore.vue
| ... | ... | @@ -27,214 +27,226 @@ |
| 27 | 27 | </template> |
| 28 | 28 | |
| 29 | 29 | <script> |
| 30 | - // 引入组件 | |
| 31 | - import { Toast, Indicator } from 'mint-ui'; | |
| 32 | - import backBox from "@/components/backBox/backBox"; | |
| 33 | - import dresserList from "@/components/dresserList/dresserList"; | |
| 34 | - | |
| 35 | - export default { | |
| 36 | - name: 'fansShopMessageList', | |
| 37 | - data() { | |
| 38 | - return { | |
| 39 | - title: "", | |
| 40 | - backs: { // nav导航条数据 | |
| 41 | - title: "推荐达人", | |
| 42 | - funcs: { | |
| 43 | - back: { | |
| 44 | - icon: "static/img/icon_back.png" | |
| 45 | - } | |
| 46 | - } | |
| 47 | - }, | |
| 48 | - list: null, // 达人列表 | |
| 49 | - loading: false, // 上拉加载控制 | |
| 50 | - pages:0, // 分页 | |
| 51 | - } | |
| 52 | - }, | |
| 53 | - components: { | |
| 54 | - backBox, | |
| 55 | - dresserList | |
| 56 | - }, | |
| 57 | - created() { | |
| 58 | - | |
| 59 | - // 设置标题 | |
| 60 | - this.$set(this, "title", "推荐达人页"); | |
| 61 | - document.title = "推荐达人页" | |
| 62 | - // 获取更多的推荐达人 | |
| 63 | - this.recommendMore(); | |
| 64 | - }, | |
| 65 | - methods: { | |
| 66 | - | |
| 67 | - // 下拉刷新 | |
| 68 | - // onRefresh() { | |
| 69 | - | |
| 70 | - // // 下拉刷新中 | |
| 71 | - // this.$set(this, "isLoading", true); | |
| 72 | - | |
| 73 | - // // 获取关注人列表 | |
| 74 | - // this.fansShopMessageList(); | |
| 75 | - // }, | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * 已关注达人列表 | |
| 79 | - */ | |
| 80 | - recommendMore () { | |
| 81 | - | |
| 82 | - // 校验登录 | |
| 83 | - if (this.$parent.checkLogin()) { | |
| 84 | - this.loading = true; | |
| 85 | - this.pages++ | |
| 86 | - // 加载中提示 | |
| 87 | - Indicator.open("加载中..."); | |
| 88 | - | |
| 89 | - // 请求接口 | |
| 90 | - this.http("/Api/" + this.getApiVersion().dynamic + "/hotDarenList", { | |
| 91 | - uid: this.getStore("uid"), | |
| 92 | - page: this.pages | |
| 93 | - },this.recommendMoreCallback, { | |
| 94 | - method: "post" | |
| 95 | - }); | |
| 96 | - } | |
| 97 | - }, | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * 已关注达人列表回调 | |
| 101 | - * @param {object} res [服务器返回数据] | |
| 102 | - * @param {object} ext [扩展参数] | |
| 103 | - */ | |
| 104 | - recommendMoreCallback(res, ext) { | |
| 105 | - | |
| 106 | - // 加载完成 | |
| 107 | - Indicator.close(); | |
| 108 | - | |
| 109 | - // 下拉刷新结束 | |
| 110 | - this.$set(this, "isLoading", false); | |
| 111 | - | |
| 112 | - // 返回处理 | |
| 113 | - if (res.code == 200) { | |
| 114 | - | |
| 115 | - // 解构数据 | |
| 116 | - let {data: datas} = res; | |
| 117 | - | |
| 118 | - /*获取裂变数据*/ | |
| 119 | - if (datas.list && datas.list.length) { | |
| 120 | - // 隐藏加载圈 | |
| 121 | - this.loading = false; | |
| 122 | - if(this.pages>1){ | |
| 123 | - this.$set(this, "list",[...this.list,...datas.list]); | |
| 124 | - }else { | |
| 125 | - this.$set(this, "list",datas.list); | |
| 126 | - } | |
| 127 | - | |
| 128 | - } | |
| 129 | - } | |
| 130 | - }, | |
| 131 | - /** | |
| 132 | - * 关注/取消关注达人 | |
| 133 | - */ | |
| 134 | - fansShop(item) { | |
| 135 | - Indicator.open("加载中..."); | |
| 136 | - // 判断必要参数 | |
| 137 | - if (item.id && this.$route.query.uid) { | |
| 138 | - // 请求接口 | |
| 139 | - this.http("/Api/" + this.getApiVersion().dynamic + "/fansShop", { | |
| 140 | - id: item.id || 0, | |
| 141 | - uid: this.getStore("uid") || 0 | |
| 142 | - }, this.fansShopCallback, { | |
| 143 | - method: "post", | |
| 144 | - item | |
| 145 | - } | |
| 146 | - ); | |
| 147 | - } | |
| 148 | - }, | |
| 149 | - | |
| 150 | - /** | |
| 151 | - * 关注/取消关注达人回调 | |
| 152 | - * @param {object} res [服务器返回数据] | |
| 153 | - * @param {object} ext [扩展参数] | |
| 154 | - */ | |
| 155 | - fansShopCallback(res, ext) { | |
| 156 | - | |
| 157 | - // 加载完成 | |
| 158 | - Indicator.close(); | |
| 159 | - if (res.code) { | |
| 160 | - // 设置已关注 | |
| 161 | - if (ext.item.is_fans == "0") { | |
| 162 | - // 关注达人 | |
| 163 | - this.$set(ext.item, "is_fans", "1"); | |
| 164 | - }else{ | |
| 165 | - // 取消关注达人 | |
| 166 | - this.$set(ext.item, "is_fans", "0"); | |
| 167 | - } | |
| 168 | - }else if (res.statusCode === 200 && res.data.code == 400) { | |
| 169 | - | |
| 170 | - // 关注失败 | |
| 171 | - Toast(res.data.message); | |
| 172 | - } else { | |
| 173 | - | |
| 174 | - // 关注失败 | |
| 175 | - Toast("关注失败"); | |
| 176 | - } | |
| 177 | - }, | |
| 178 | - /** | |
| 179 | - * 通用跳转 | |
| 180 | - * @param {object} item [数据对象] | |
| 181 | - */ | |
| 182 | - toDetail(item) { | |
| 183 | - // 判断并调用通用跳转 | |
| 184 | - if (typeof this.$parent.gotoDetail === "function") { | |
| 185 | - | |
| 186 | - // 临时,设置跳转达人个人主页用户数据 | |
| 187 | - Object.assign(item, { | |
| 188 | - type: "5", | |
| 189 | - to: (this.mode == "prod") ? "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + item.id + "&uid=" + this.getStore("uid") | |
| 190 | - : "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect"+ "&id=" + item.id + "&uid=" + this.getStore("uid"), | |
| 191 | - shop_type: "" | |
| 192 | - }); | |
| 193 | - | |
| 194 | - // 调用通用跳转 | |
| 195 | - this.$parent.gotoDetail(item); | |
| 196 | - } | |
| 197 | - }, | |
| 198 | - | |
| 199 | - /** | |
| 200 | - * 后退 | |
| 201 | - */ | |
| 202 | - back() { | |
| 203 | - | |
| 204 | - // 判断是否有后退函数 | |
| 205 | - if (typeof this.$parent.back === "function") { | |
| 206 | - | |
| 207 | - // 调用后退 | |
| 208 | - this.$parent.back(); | |
| 209 | - } else { | |
| 210 | - | |
| 211 | - // 后退 | |
| 212 | - window.history.go(-1); | |
| 213 | - } | |
| 214 | - } | |
| 215 | - }, | |
| 216 | - head: { | |
| 217 | - title () { | |
| 218 | - return { | |
| 219 | - inner: this.title | |
| 220 | - } | |
| 221 | - } | |
| 222 | - }, | |
| 223 | - watch: { | |
| 224 | - | |
| 225 | - // 设置页面标题 | |
| 226 | - title(newVal) { | |
| 227 | - if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") { | |
| 228 | - this.$iFrame.insertIFrame(newVal); | |
| 229 | - } else { | |
| 230 | - this.$emit("updateHead"); | |
| 231 | - } | |
| 232 | - } | |
| 30 | +// 引入组件 | |
| 31 | +import { Toast, Indicator } from 'mint-ui'; | |
| 32 | +import backBox from "@/components/backBox/backBox"; | |
| 33 | +import dresserList from "@/components/dresserList/dresserList"; | |
| 34 | + | |
| 35 | +export default { | |
| 36 | + name: 'fansShopMessageList', | |
| 37 | + data () { | |
| 38 | + return { | |
| 39 | + title: "", | |
| 40 | + backs: { // nav导航条数据 | |
| 41 | + title: "推荐达人", | |
| 42 | + funcs: { | |
| 43 | + back: { | |
| 44 | + icon: "static/img/icon_back.png" | |
| 45 | + } | |
| 233 | 46 | } |
| 47 | + }, | |
| 48 | + list: null, // 达人列表 | |
| 49 | + loading: false, // 上拉加载控制 | |
| 50 | + pages: 0, // 分页 | |
| 234 | 51 | } |
| 52 | + }, | |
| 53 | + components: { | |
| 54 | + backBox, | |
| 55 | + dresserList | |
| 56 | + }, | |
| 57 | + created () { | |
| 58 | + | |
| 59 | + // 设置标题 | |
| 60 | + this.$set(this, "title", "推荐达人页"); | |
| 61 | + document.title = "推荐达人页" | |
| 62 | + // 获取更多的推荐达人 | |
| 63 | + this.recommendMore(); | |
| 64 | + }, | |
| 65 | + methods: { | |
| 66 | + | |
| 67 | + // 下拉刷新 | |
| 68 | + // onRefresh() { | |
| 69 | + | |
| 70 | + // // 下拉刷新中 | |
| 71 | + // this.$set(this, "isLoading", true); | |
| 72 | + | |
| 73 | + // // 获取关注人列表 | |
| 74 | + // this.fansShopMessageList(); | |
| 75 | + // }, | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 已关注达人列表 | |
| 79 | + */ | |
| 80 | + recommendMore () { | |
| 81 | + | |
| 82 | + // 校验登录 | |
| 83 | + if (this.$parent.checkLogin()) { | |
| 84 | + this.loading = true; | |
| 85 | + this.pages++ | |
| 86 | + // 加载中提示 | |
| 87 | + Indicator.open("加载中..."); | |
| 88 | + | |
| 89 | + // 请求接口 | |
| 90 | + this.http("/Api/" + this.getApiVersion().dynamic + "/hotDarenList", { | |
| 91 | + uid: this.getStore("uid"), | |
| 92 | + page: this.pages | |
| 93 | + }, this.recommendMoreCallback, { | |
| 94 | + method: "post" | |
| 95 | + }); | |
| 96 | + } | |
| 97 | + }, | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * 已关注达人列表回调 | |
| 101 | + * @param {object} res [服务器返回数据] | |
| 102 | + * @param {object} ext [扩展参数] | |
| 103 | + */ | |
| 104 | + recommendMoreCallback (res, ext) { | |
| 105 | + | |
| 106 | + // 加载完成 | |
| 107 | + Indicator.close(); | |
| 108 | + | |
| 109 | + // 下拉刷新结束 | |
| 110 | + this.$set(this, "isLoading", false); | |
| 111 | + | |
| 112 | + // 返回处理 | |
| 113 | + if (res.code == 200) { | |
| 114 | + | |
| 115 | + // 解构数据 | |
| 116 | + let { data: datas } = res; | |
| 117 | + | |
| 118 | + /*获取裂变数据*/ | |
| 119 | + if (datas.list && datas.list.length) { | |
| 120 | + // 隐藏加载圈 | |
| 121 | + this.loading = false; | |
| 122 | + if (this.pages > 1) { | |
| 123 | + this.$set(this, "list", [...this.list, ...datas.list]); | |
| 124 | + } else { | |
| 125 | + this.$set(this, "list", datas.list); | |
| 126 | + } | |
| 127 | + | |
| 128 | + } | |
| 129 | + } | |
| 130 | + }, | |
| 131 | + /** | |
| 132 | + * 关注/取消关注达人 | |
| 133 | + */ | |
| 134 | + fansShop (item) { | |
| 135 | + Indicator.open("加载中..."); | |
| 136 | + // 判断必要参数 | |
| 137 | + if (item.id && this.$route.query.uid) { | |
| 138 | + // 请求接口 | |
| 139 | + this.http("/Api/" + this.getApiVersion().dynamic + "/fansShop", { | |
| 140 | + id: item.id || 0, | |
| 141 | + uid: this.getStore("uid") || 0 | |
| 142 | + }, this.fansShopCallback, { | |
| 143 | + method: "post", | |
| 144 | + item | |
| 145 | + } | |
| 146 | + ); | |
| 147 | + } | |
| 148 | + }, | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * 关注/取消关注达人回调 | |
| 152 | + * @param {object} res [服务器返回数据] | |
| 153 | + * @param {object} ext [扩展参数] | |
| 154 | + */ | |
| 155 | + fansShopCallback (res, ext) { | |
| 156 | + | |
| 157 | + // 加载完成 | |
| 158 | + Indicator.close(); | |
| 159 | + if (res.code) { | |
| 160 | + // 设置已关注 | |
| 161 | + if (ext.item.is_fans == "0") { | |
| 162 | + // 关注达人 | |
| 163 | + this.$set(ext.item, "is_fans", "1"); | |
| 164 | + } else { | |
| 165 | + // 取消关注达人 | |
| 166 | + this.$set(ext.item, "is_fans", "0"); | |
| 167 | + } | |
| 168 | + } else if (res.statusCode === 200 && res.data.code == 400) { | |
| 169 | + | |
| 170 | + // 关注失败 | |
| 171 | + Toast(res.data.message); | |
| 172 | + } else { | |
| 173 | + | |
| 174 | + // 关注失败 | |
| 175 | + Toast("关注失败"); | |
| 176 | + } | |
| 177 | + }, | |
| 178 | + /** | |
| 179 | + * 通用跳转 | |
| 180 | + * @param {object} item [数据对象] | |
| 181 | + */ | |
| 182 | + toDetail (item) { | |
| 183 | + // 判断并调用通用跳转 | |
| 184 | + if (typeof this.$parent.gotoDetail === "function") { | |
| 185 | + | |
| 186 | + // 临时,设置跳转达人个人主页用户数据 | |
| 187 | + Object.assign(item, { | |
| 188 | + type: "5", | |
| 189 | + to: (this.mode == "prod") ? "https://managemall.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + item.id + "&uid=" + this.getStore("uid") | |
| 190 | + : "https://wjjshop.cnlive.com/html/preferred-library/1/#/pages/darenProfile/darenProfile?from=redirect" + "&id=" + item.id + "&uid=" + this.getStore("uid"), | |
| 191 | + shop_type: "" | |
| 192 | + }); | |
| 193 | + | |
| 194 | + // 调用通用跳转 | |
| 195 | + this.$parent.gotoDetail(item); | |
| 196 | + } | |
| 197 | + }, | |
| 198 | + | |
| 199 | + /** | |
| 200 | + * 后退 | |
| 201 | + */ | |
| 202 | + back () { | |
| 203 | + | |
| 204 | + // 判断是否有后退函数 | |
| 205 | + if (typeof this.$parent.back === "function") { | |
| 206 | + | |
| 207 | + // 调用后退 | |
| 208 | + this.$parent.back(); | |
| 209 | + } else { | |
| 210 | + | |
| 211 | + // 后退 | |
| 212 | + window.history.go(-1); | |
| 213 | + } | |
| 214 | + } | |
| 215 | + }, | |
| 216 | + head: { | |
| 217 | + title () { | |
| 218 | + return { | |
| 219 | + inner: this.title | |
| 220 | + } | |
| 221 | + } | |
| 222 | + }, | |
| 223 | + watch: { | |
| 224 | + | |
| 225 | + // 设置页面标题 | |
| 226 | + title (newVal) { | |
| 227 | + if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") { | |
| 228 | + this.$iFrame.insertIFrame(newVal); | |
| 229 | + } else { | |
| 230 | + this.$emit("updateHead"); | |
| 231 | + } | |
| 232 | + } | |
| 233 | + }, | |
| 234 | + mounted () { | |
| 235 | + // 页面显示监听 | |
| 236 | + document.addEventListener('visibilitychange', () => { | |
| 237 | + | |
| 238 | + // 页面显示出来了 | |
| 239 | + if (document.hidden === false) { | |
| 240 | + | |
| 241 | + // 刷新达人更多详情页信息接口 | |
| 242 | + this.recommendMore(); | |
| 243 | + } | |
| 244 | + }); | |
| 245 | + }, | |
| 246 | +} | |
| 235 | 247 | </script> |
| 236 | 248 | |
| 237 | 249 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 238 | 250 | <style rel="stylesheet/less" lang="less" scoped> |
| 239 | - @import "recommendMore"; | |
| 251 | +@import 'recommendMore'; | |
| 240 | 252 | </style> | ... | ... |