一、購物車圖標(有商品時顯示件數,無商品時顯示爲空)---header.htmlhtml
<div class="col-sm-4"> <p class="cartbar nobox mt25 yh"> <a th:href="@{initCart}"><i class="ico"></i>購物車<i class="num"></i></a> <span th:if="${cartList.size() == 0}">爲空</span> <span th:if="${cartList.size() != 0}"> 有 <a href="initCart"><strong> <span th:text="${cartList.size()}">1</span>件商品</strong></a> </span> </p> </div>
二、登陸顯示(未登陸--您好,登陸 | 註冊 已登陸--您好,**** 退出 | 註冊)session
<p class="userInfo">您好, <!-- 未登陸 --> <span th:if="${#strings.isEmpty(session.UVO.guestName)}"> <a th:href="@{initGuestLogin}"><span class="button-t">登陸</span></a> </span> <!--已登陸 --> <span th:if="${not #strings.isEmpty(session.UVO.guestId)}"> <a th:href="@{initEditGuest}"><span class="button-t" th:text="${session.UVO.guestId}"> 張三</span></a> <a th:href="@{/}" th:if="${not #strings.isEmpty(session.UVO.guestId)}"> <span class="button-t">退出</span></a> </span> <!-- 未登陸 --> <span th:if="${ #strings.isEmpty(session.UVO.guestId)}"> <i class="line">|</i><a th:href="initGuestRegister" class="link">註冊</a></span> <i class="line">|</i><a href="init" class="link">分銷商入口</a> </p>