如何实现无跳转的解绑呢?

来源:5-8 绑定和解绑处理

jiiiiiin

2018-09-07

如题

补充一下,不好意思老师:

 methods: {
            onTapUnBinding(idx, item) {
                let provideId = 'weixin'
                switch (item.providerId) {
                    case 'QQ':
                        provideId = 'callback.do'
                        break
                }
                this.$vp.delete(`/connect/${provideId}`)
                    .then((response) => {
                        this.$message('解绑成功')
                    })
                    .catch((err) => {
                        // TODO 待修正
                        this.$message('解绑成功')
                        //alert(`解绑出错${JSON.stringify(err.response)}`)
                    })
            },
            onTapBinding: function (idx, item) {
                switch (item.providerId) {
                    case 'QQ':
                        this.$refs.bindingQQForm.submit()
                        break
                    default:
                        this.$refs.bindingWeixinForm.submit()
                }
            }
        },
public class CustomBindingConnectView extends AbstractView {

    /*
     * (non-Javadoc)
     *
     * @see
     * org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel
     * (java.util.Map, javax.servlet.http.HttpServletRequest,
     * javax.servlet.http.HttpServletResponse)
     */
    @Override
    protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
                                           HttpServletResponse response) throws Exception {

        // 响应绑定页面,微信在授权完毕之后的回调url接口响应内容
        response.setContentType("text/html;charset=UTF-8");
        // 区分绑定还是解绑成功
        if (model.get("connections") == null) {
            // TODO 待修正
            response.getWriter().write("<h3>解绑成功</h3>");
        } else {
            response.sendRedirect(request.getContextPath() + "/userBinding.html");
        }

    }

}

目前在解绑的时候,响应视图都必须是输出一个html,是否能直接根据渠道(类spring mobile判断请求的方式,根据Accept)去响应html或者json;

写回答

1回答

JoJo

2018-09-07

额...什么叫无跳转的解绑?

0
1
jiiiiiin
我补充了一下问题 不好意思老师,听课的时候打的,有点草率了,没写清除。
2018-09-10
共1条回复

Spring Security技术栈开发企业级认证与授权

Spring Security技术栈,REST风格开发常见接口,独立开发认证授权模块保证REST服务安全

2662 学习 · 1561 问题

查看课程