MobileClassifyWrap.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <script setup>
  2. import { useRouter } from 'vue-router'
  3. import {useClassify} from '../hooks/useClassify'
  4. const router=useRouter()
  5. const {
  6. classifyTypeOpt,
  7. classifyState,
  8. getMyClassify,
  9. getPubClassify,
  10. classifyTypeChange,
  11. handleAddClassify,
  12. handleConfirmEditClassify,
  13. handleShowOpt,
  14. handleClassifyShare,
  15. handleCopyClassify,
  16. handleClassifyDel,
  17. handleAddClassifyBeforeClose
  18. }=useClassify()
  19. getMyClassify()
  20. getPubClassify()
  21. function goMobileSearch() {
  22. router.push({
  23. path:'/myETA/searchlist'
  24. })
  25. }
  26. function goChartList(item){
  27. router.push({
  28. path:"/myETA/chartlist",
  29. query:{
  30. cid:item.MyChartClassifyId,
  31. cname:item.MyChartClassifyName,
  32. iscommon:classifyState.classifyTypeAct==1?false:true
  33. }
  34. })
  35. }
  36. function goChooseChart(){
  37. router.push({
  38. path:'/myETA/choosechart'
  39. })
  40. }
  41. </script>
  42. <template>
  43. <div class="myETA-mobile-classify-wrap">
  44. <div class="sticky-top">
  45. <div class="search-box">
  46. <van-search
  47. shape="round"
  48. readonly
  49. placeholder="请输入图表名称"
  50. @click="goMobileSearch"
  51. />
  52. </div>
  53. <div class="classify-type-box">
  54. <span
  55. :class="['item',item.type===classifyState.classifyTypeAct?'active':'']"
  56. v-for="item in classifyTypeOpt"
  57. :key="item.id"
  58. @click="classifyTypeChange(item)"
  59. >{{item.name}}</span>
  60. </div>
  61. </div>
  62. <ul class="list-box">
  63. <li
  64. class="item"
  65. v-for="item in classifyState.classifyTypeAct==1?classifyState.myClassifyList:classifyState.pubClassifyList"
  66. :key="item.MyChartClassifyId"
  67. @click="goChartList(item)"
  68. >
  69. <img class="left-icon" src="@/assets/imgs/ppt/ppt_icon_file.png" alt="">
  70. <div style="flex:1">
  71. <div class="van-ellipsis name">{{item.MyChartClassifyName}}</div>
  72. <div class="share-user" v-if="classifyState.classifyTypeAct==2">分享人: {{item.RealName}}</div>
  73. </div>
  74. <img class="right-icon" src="@/assets/imgs/ppt/ppt_icon_menu.png" alt="" @click.stop="handleShowOpt(item)">
  75. </li>
  76. </ul>
  77. <!-- 底部操作栏 -->
  78. <div class="fix-bot-box">
  79. <div class="item" @click="handleAddClassify('')">
  80. <img class="icon" src="@/assets/imgs/icon_file.png" alt="">
  81. <span>添加分类</span>
  82. </div>
  83. <div class="item" @click="goChooseChart">
  84. <img class="icon" src="@/assets/imgs/icon_select.png" alt="">
  85. <span>选择图表</span>
  86. </div>
  87. </div>
  88. </div>
  89. <!-- 添加我的分类弹窗 -->
  90. <van-dialog
  91. v-model:show="classifyState.showEidtClassifyName"
  92. :title="classifyState.isAddClassifyName?'添加分类':'重命名'"
  93. show-cancel-button
  94. confirmButtonText="确定"
  95. @confirm="handleConfirmEditClassify"
  96. :before-close="handleAddClassifyBeforeClose"
  97. >
  98. <div class="rename-wrap">
  99. <input type="text" placeholder="请输入分类名称!" v-model="classifyState.classifyNameVal">
  100. </div>
  101. </van-dialog>
  102. <!-- 分类操作弹窗 -->
  103. <van-popup
  104. v-model:show="classifyState.showClassifyOpt"
  105. round
  106. position="bottom"
  107. >
  108. <div class="classify-opt-wrap">
  109. <div class="item border">
  110. <img src="@/assets/imgs/ppt/ppt_icon_file.png" alt="">
  111. <span>{{classifyState.activeClassifyVal.MyChartClassifyName}}</span>
  112. </div>
  113. <!-- 我的图库分类操作 -->
  114. <template v-if="classifyState.classifyTypeAct==1">
  115. <div class="item border blue" @click="handleAddClassify(classifyState.activeClassifyVal)">
  116. <img src="@/assets/imgs/ppt/ppt_icon_write.png" alt="">
  117. <span>重命名</span>
  118. </div>
  119. <div class="item border blue">
  120. <img src="@/assets/imgs/icon_user.png" alt="">
  121. <span>所有人可见</span>
  122. <van-switch
  123. class="switch-box"
  124. size="22px"
  125. :model-value="classifyState.activeClassifyVal.IsPublic?true:false"
  126. @update:model-value="handleClassifyShare"
  127. />
  128. </div>
  129. <div class="item border red" @click="handleClassifyDel(classifyState.activeClassifyVal)">
  130. <img src="@/assets/imgs/icon_del.png" alt="">
  131. <span>删除</span>
  132. </div>
  133. </template>
  134. <!-- 公共图库分类操作 -->
  135. <template v-if="classifyState.classifyTypeAct==2">
  136. <div class="item border blue" @click="handleCopyClassify(classifyState.activeClassifyVal)">
  137. <img src="@/assets/imgs/ppt/ppt_icon_copy.png" alt="">
  138. <span>复制</span>
  139. </div>
  140. </template>
  141. </div>
  142. </van-popup>
  143. </template>
  144. <style lang="scss" scoped>
  145. .sticky-top{
  146. position: sticky;
  147. top: 0;
  148. z-index: 99;
  149. background-color: #fff;
  150. }
  151. .classify-type-box{
  152. padding: $page-padding;
  153. box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.08);
  154. .item{
  155. display: inline-block;
  156. font-size: 32px;
  157. color: $font-grey_999;
  158. margin-right: 40px;
  159. position: relative;
  160. }
  161. .active{
  162. color: #333;
  163. &::after{
  164. content: '';
  165. position: absolute;
  166. bottom: -$page-padding;
  167. left: 50%;
  168. transform: translateX(-50%);
  169. display: block;
  170. width: 50px;
  171. height: 6px;
  172. background-color: $theme-color;
  173. border-radius: 3px;
  174. }
  175. }
  176. }
  177. .list-box{
  178. padding: $page-padding;
  179. padding-bottom: 130px;
  180. .item{
  181. padding: 20px 0;
  182. display: flex;
  183. .left-icon{
  184. width: 32px;
  185. height: 32px;
  186. margin-right: 20px;
  187. flex-shrink: 0;
  188. }
  189. .right-icon{
  190. flex-shrink: 0;
  191. width: 4px;
  192. height: 20px;
  193. margin-left: 20px;
  194. }
  195. .name{
  196. flex: 1;
  197. }
  198. .share-user{
  199. color: $font-grey_999;
  200. margin-top: 15px;
  201. }
  202. }
  203. }
  204. .fix-bot-box{
  205. position: fixed;
  206. left: 0;
  207. right: 0;
  208. bottom: 0;
  209. height: 120px;
  210. background-color: #fff;
  211. display: flex;
  212. justify-content: space-around;
  213. align-items: center;
  214. z-index: 99;
  215. .item{
  216. width: 304px;
  217. height: 80px;
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. color: #fff;
  222. font-size: 32px;
  223. box-shadow: 0px 3px 14px 2px rgba(0, 0, 0, 0.05), 0px 8px 10px 1px rgba(0, 0, 0, 0.06), 0px 5px 5px -3px rgba(0, 0, 0, 0.1);
  224. border-radius: 12px;
  225. background-color: $theme-color;
  226. .icon{
  227. width: 40px;
  228. height: 40px;
  229. margin-right: 10px;
  230. }
  231. }
  232. }
  233. .rename-wrap{
  234. display: flex;
  235. align-items: center;
  236. padding: 50px 30px;
  237. span{
  238. flex-shrink: 0;
  239. margin-right: 20px;
  240. }
  241. input{
  242. flex: 1;
  243. line-height: 70px;
  244. padding: 0 30px;
  245. border-radius: 70px;
  246. border: 1px solid $border-color;
  247. width: 150px;
  248. }
  249. }
  250. .classify-opt-wrap{
  251. .item{
  252. padding: 42px;
  253. display: flex;
  254. align-items: center;
  255. position: relative;
  256. img{
  257. width: 36px;
  258. height: 36px;
  259. margin-right: 20px;
  260. }
  261. .switch-box{
  262. position: absolute;
  263. right: 42px;
  264. top: 50%;
  265. transform: translateY(-50%);
  266. }
  267. }
  268. .border{
  269. border-bottom: 1px solid $border-color;
  270. }
  271. .blue{
  272. color: $theme-color;
  273. }
  274. .red{
  275. color: $theme-red;
  276. }
  277. }
  278. </style>