-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdesk.html
More file actions
182 lines (169 loc) · 4.95 KB
/
Copy pathdesk.html
File metadata and controls
182 lines (169 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html>
<html lang="zh-Hant-TW">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Desk-Mission2</title>
<!-- Bootstrap5.css -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/css/bootstrap.min.css"
integrity="sha512-GQGU0fMMi238uA+a/bdWJfpUGKUkBdgfFdgBm72SUQ6BeyWjoY/ton0tEjH+OSH9iP4Dfh+7HM0I9f5eR0L/4w=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<link rel="stylesheet" href="/src/desk.css" />
<!-- end of styles.CSS -->
</head>
<body>
<section id="deskApp">
<section class="modal-mask" :style="modalStyle">
<section class="modal-container">
<div class="modal-body">
<button
type="button"
class="btn"
v-show="hintMsg"
:class="[ isLogin ? 'btn-success':'btn-danger',
isShowStatus ? 'msg-btn' : 'btn-warning' ]"
>
{{ hintMsg }}
</button>
<button
type="button"
v-if="!isLogin"
class="btn btn-primary"
@click="goHome"
>
Back
</button>
</div>
</section>
</section>
<!-- end of modal-mask -->
<section class="list-container" v-if="isLogin">
<button type="button" class="btn msg-btn btn-success" v-if="isLogin">
{{ hintMsg }}
</button>
<div class="row py-3">
<div class="col-md-6">
<h2>產品列表</h2>
<table class="table table-hover mt-4">
<thead>
<tr>
<th width="150">產品名稱</th>
<th width="120">
原價
</th>
<th width="120">
售價
</th>
<th width="150">
是否啟用
</th>
<th width="120">
查看細節
</th>
</tr>
</thead>
<tbody>
<!--
#NOTE:
計數器放外層
https://book.vue.tw/CH1/1-6-conditions-and-flow-control.html
-->
<tr v-for="(item) in products" :key="item.id">
<td width="150">
{{ item.title }}
</td>
<td width="120">
{{ item.origin_price }}
</td>
<td width="120">
{{ item.price }}
</td>
<td width="150">
<!-- #TODO: Toggle-Switch -->
<span v-if="item.is_enabled" class="text-success"
>啟用</span
>
<span v-else>未啟用</span>
</td>
<td width="120">
<button
type="button"
class="btn btn-primary"
@click="showInfo(item)"
>
查看細節
</button>
</td>
</tr>
</tbody>
</table>
<p>目前有 <span>{{ products.length }}</span> 項產品</p>
</div>
<!-- end of col-list -->
<div class="col-md-6">
<h2>單一產品細節</h2>
<!--
#NOTE:
template-if
判斷放外層
-->
<template v-if="itemInfo.title">
<div class="card mb-3">
<img
:src="itemInfo.imageUrl"
class="card-img-top primary-image"
alt="主圖"
/>
<div class="card-body">
<h5 class="card-title">
{{ itemInfo.title }}
<span class="badge bg-primary ms-2"
>{{ itemInfo.category }}</span
>
</h5>
<p class="card-text">商品描述:{{ itemInfo.description }}</p>
<p class="card-text">商品內容:{{ itemInfo.content }}</p>
<div class="d-flex">
<p class="card-text me-2">{{ itemInfo.price }}</p>
<p class="card-text text-secondary">
<del>{{ itemInfo.origin_price }}</del>
</p>
{{ itemInfo.unit }} / 元
</div>
</div>
</div>
<template v-for="(image, id) in itemInfo.imagesUrl" :key="id">
<img
v-if="image"
:src="image"
:alt="`多圖 ${ id+1 }`"
class="images m-2"
/>
</template>
</template>
<p class="text-secondary">請選擇一個商品查看</p>
</div>
<!-- end of col-info -->
</div>
<!-- end of row -->
</section>
<!-- end of list-container -->
</section>
<!-- end of deskApp-DOM -->
<!-- axios.js -->
<!-- Bootstrap5.js -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.3/js/bootstrap.min.js"
integrity="sha512-OvBgP9A2JBgiRad/mM36mkzXSXaJE9BEIENnVEmeZdITvwT09xnxLtT4twkCa8m/loMbPHsvPl0T8lRGVBwjlQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script type="module" src="/src/scripts/desk.js"></script>
<!-- end of script.js -->
</body>
</html>