From 1eefd113e28e802348a9cae69a41945c1dc48b0f Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期三, 11 六月 2025 21:05:26 +0800 Subject: [PATCH] Merge branch 'dev' of http://42.193.1.25:9521/r/lmk-shop-wx into dev --- config/api.js | 3 pages/tabbar/user/utils/tool.vue | 472 ++-- pages/userPermissions/addStoreMember.vue | 287 +++ pages.json | 799 +++++--- api/collect.js | 13 pages/mine/activity/reportActivity.vue | 388 ++++ pages/customerManager/customerManager.vue | 86 pages/mine/activity/myActivity.vue | 465 +++++ api/activity.js | 76 api/userPermissions.js | 69 pages/tabbar/index/home.vue | 158 + pages/mine/activity/detail.vue | 318 +++ pages/video/video-edit.vue | 788 +++++++++ pages/tabbar/video/video.vue | 2 api/customerManager.js | 0 manifest.json | 2 components/dropdown-menu.vue | 204 ++ pages/userPermissions/userPermissions.vue | 287 +++ pages/goods-manager/addGoods/addGoods.vue | 89 pages/mine/myCollect/myCollect.vue | 595 ++++++ api/video.js | 14 pages/video/home-page.vue | 47 22 files changed, 4,554 insertions(+), 608 deletions(-) diff --git a/api/activity.js b/api/activity.js new file mode 100644 index 0000000..1557181 --- /dev/null +++ b/api/activity.js @@ -0,0 +1,76 @@ +/** + * 娲诲姩鐩稿叧API + */ +import { http, Method } from "@/utils/request.js"; + +import api from "@/config/api.js"; + +/** + * 鏌ヨ鐢ㄦ埛鎶ュ悕娲诲姩鍒楄〃 + * + * @param params + */ + export function getMyActivityList(params) { + return http.request({ + url: "/lmk/my-activity/getMyActivityList", + method: Method.GET, + needToken: true, + params: params, + }); +} + +/** + * 鍙栨秷鎶ュ悕 + * + * @param params + */ + export function activityCancel(params) { + return http.request({ + url: "/lmk/my-activity/activityCancel/"+ params, + method: Method.PUT, + needToken: true, + }); +} + +/** + * 鑾峰緱娲诲姩璇︽儏 + * @param params + */ +export function getActivityDetail(params){ + return http.request({ + url: "/lmk/activityReport/getDetail/" + params, + method: Method.GET, + needToken: true, + }); +} + + +/** + * 鎶ュ悕娲诲姩 + * @param param + */ +export function activityReport(param){ + return http.request({ + url: "/lmk/activityReport", + method: Method.POST, + needToken: true, + data:param + }); +} + +/** + * 鑾峰緱鎵�鏈夊彲鎶ュ悕鐨勬椿鍔ㄥ垪琛� + * + * @param params + */ + export function getActivityReportList(param) { + return http.request({ + url: "/lmk/activityReport", + method: Method.GET, + needToken: true, + params:param + }); +} + + + diff --git a/api/collect.js b/api/collect.js index 4a12dec..ed4b199 100644 --- a/api/collect.js +++ b/api/collect.js @@ -20,3 +20,16 @@ data: data }); } + +/** + * 鑾峰緱鎴戠殑鏀惰棌鎸変紶鍏ョ被鍨� video锛宎ctivity锛宻tore + * @param {Object} param + */ +export function getMyCollectList(param){ + return http.request({ + url: "/lmk/my-collect/getMyCollectList", + method: Method.GET, + needToken: true, + params: param + }); +} \ No newline at end of file diff --git a/api/customerManager.js b/api/customerManager.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/api/customerManager.js diff --git a/api/userPermissions.js b/api/userPermissions.js new file mode 100644 index 0000000..63e3d92 --- /dev/null +++ b/api/userPermissions.js @@ -0,0 +1,69 @@ +/** + * 鐢ㄦ埛鏉冮檺绠$悊API + */ +import { http, Method } from "@/utils/request.js"; + +import api from "@/config/api.js"; + +/** + * 鑾峰緱鐢ㄦ埛鍒楄〃锛堝晢鎴凤級 + * @param {Object} param + */ +export function getPage(param){ + return http.request({ + url: "/lmk/lmk-user-permissions/page", + method: Method.GET, + needToken: true, + params: param + }); +} + +/** + * 鍒犻櫎鐢ㄦ埛锛堝晢鎴凤級 + */ +export function del(param){ + return http.request({ + url: "/lmk/lmk-user-permissions/" + param, + method: Method.DELETE, + needToken: true, + }); +} +/** + * 鏂板鐢ㄦ埛锛堝晢鎴凤級 + */ +export function add(param){ + return http.request({ + url: "/lmk/lmk-user-permissions", + method: Method.POST, + needToken: true, + data: param + }); +} +/** + * 淇敼鐢ㄦ埛锛堝晢鎴凤級 + */ +export function update(param){ + return http.request({ + url: "/lmk/lmk-user-permissions", + method: Method.PUT, + needToken: true, + data: param + }); +} + +export function getDetail(param){ + return http.request({ + url: "/lmk/lmk-user-permissions/" +param, + methode: Method.GET, + needToken: true + }) + +} + +export function restPassword(param){ + return http.request({ + url:'/lmk/lmk-user-permissions/restPassword/'+param, + method: Method.PUT, + needToken: true + }) +} \ No newline at end of file diff --git a/api/video.js b/api/video.js index 65b48e8..4d5e90d 100644 --- a/api/video.js +++ b/api/video.js @@ -130,3 +130,17 @@ data: data }); } + + +/** + * 鑾峰彇瑙嗛璇︽儏 + * + * @param params + */ + export function getVideoDetail(id) { + return http.request({ + url: "/lmk/video/wx/detail/" + id, + method: Method.GET, + needToken: true + }); +} \ No newline at end of file diff --git a/components/dropdown-menu.vue b/components/dropdown-menu.vue new file mode 100644 index 0000000..6dee7c9 --- /dev/null +++ b/components/dropdown-menu.vue @@ -0,0 +1,204 @@ +<template> + <view class="dropdown-container" :style="{ '--theme-color': themeColor }"> + <!-- 瑙﹀彂鎸夐挳 --> + <view class="dropdown-trigger" @click="toggleDropdown"> + <uni-icons type="more-filled" size="20" color="#666"></uni-icons> + <view class="dropdown-icon" :class="{ 'rotate': isOpen }"> + <uni-icons type="arrowdown" size="16" color="#666"></uni-icons> + </view> + </view> + + <!-- 涓嬫媺鑿滃崟 --> + <view + class="dropdown-menu" + :class="[placementClass]" + v-if="isOpen" + @click.stop + > + <scroll-view scroll-y class="dropdown-scroll" :style="{ maxHeight: maxHeight + 'px' }"> + <view + v-for="(item, index) in options" + :key="index" + class="dropdown-item" + @click="selectItem(item)" + > + <text>{{ item[labelKey] }}</text> + </view> + </scroll-view> + </view> + + <!-- 閬僵灞� --> + <view + class="dropdown-mask" + v-if="isOpen" + @click="closeDropdown" + ></view> + </view> +</template> + +<script> +export default { + name: 'DropdownMenu', + props: { + // 閫夐」鍒楄〃 + options: { + type: Array, + default: () => [] + }, + // 閫夐」瀵硅薄涓樉绀烘枃鏈殑key + labelKey: { + type: String, + default: 'label' + }, + // 閫夐」瀵硅薄涓�肩殑key + valueKey: { + type: String, + default: 'command' + }, + // 涓婚棰滆壊 + themeColor: { + type: String, + default: '#409EFF' + }, + // 涓嬫媺鑿滃崟鏈�澶ч珮搴� + maxHeight: { + type: Number, + default: 300 + }, + // 鑿滃崟寮瑰嚭浣嶇疆锛坱op/bottom锛� + placement: { + type: String, + default: 'bottom', + validator: (value) => ['top', 'bottom'].includes(value) + } + }, + data() { + return { + isOpen: false, + selectedItem: null + } + }, + computed: { + placementClass() { + return `placement-${this.placement}`; + } + }, + methods: { + toggleDropdown() { + this.isOpen = !this.isOpen + if (this.isOpen) { + this.$emit('open') + } else { + this.$emit('close') + } + }, + closeDropdown() { + this.isOpen = false + this.$emit('close') + }, + selectItem(item) { + this.selectedItem = item + this.closeDropdown() + + // 鏍规嵁閰嶇疆杩斿洖鏁翠釜瀵硅薄鎴杤alue鍊� + const emitValue = typeof item === 'object' ? item[this.valueKey] : item + this.$emit('input', emitValue) + this.$emit('change', emitValue) + } + } +} +</script> + +<style lang="scss" scoped> +.dropdown-container { + position: relative; + display: inline-block; + z-index: 10; +} + +.dropdown-trigger { + height: 70rpx; + line-height: 70rpx; + border-radius: 8rpx; + background-color: #fff; + box-sizing: border-box; + cursor: pointer; + + &:active { + opacity: 0.8; + } +} + +.dropdown-text { + flex: 1; + font-size: 28rpx; + color: #333; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.dropdown-icon { + transition: transform 0.3s; + margin-left: 10rpx; + + &.rotate { + transform: rotate(180deg); + } +} + +.dropdown-menu { + position: absolute; + left: 0; + display: inline-block; + white-space: nowrap; + background-color: #fff; + border: 1rpx solid #EBEEF5; + border-radius: 8rpx; + // box-shadow: 0 2rpx 12rpx 0 rgba(0, 0, 0, 0.1); + z-index: 100; + overflow: hidden; + + &.placement-bottom { + top: 80rpx; + } + + &.placement-top { + bottom: 80rpx; + } +} + +.dropdown-scroll { + width: 100%; +} + +.dropdown-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 20rpx; + height: 80rpx; + line-height: 80rpx; + font-size: 28rpx; + color: #606266; + + &:active { + background-color: #f5f7fa; + } + + &.active { + color: var(--theme-color); + font-weight: bold; + } +} + +.dropdown-mask { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: transparent; + z-index: 99; +} +</style> \ No newline at end of file diff --git a/config/api.js b/config/api.js index 778e0d7..bc6ccf9 100644 --- a/config/api.js +++ b/config/api.js @@ -4,9 +4,6 @@ */ // 寮�鍙戠幆澧� const dev = { - // im: "http://192.168.0.4:8885", - // common: "http://192.168.0.4:8890", - // buyer: "http://192.168.0.4:8888", im: "http://127.0.0.1:8885", common: "http://127.0.0.1:8890", buyer: "http://127.0.0.1:8888", diff --git a/manifest.json b/manifest.json index 01f9fd8..5c11ce6 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name" : "lilishop", - "appid" : "__UNI__ED807EA", + "appid" : "__UNI__818CC42", "description" : "", "versionName" : "4.5.3", "versionCode" : 4000503, diff --git a/pages.json b/pages.json index 8c0d19a..5931aad 100644 --- a/pages.json +++ b/pages.json @@ -1,39 +1,46 @@ { - "easycom": { - "autoscan": true, - "custom": { - "^u-(.*)": "@/uview-components/uview-ui/components/u-$1/u-$1.vue",//uview, - "^uni-(.*)": "@/uni_modules/uni-$1/components/uni-$1/uni-$1.vue" // uniapp缁勪欢 - } - }, - "preloadRule": { - "pages/tabbar/index/home": // 椤甸潰璺緞 - // 椤甸潰鐨勯涓嬭浇閰嶇疆 - { - "network": "all", // all(涓嶉檺缃戠粶) wifi(浠厀ifi涓嬮涓嬭浇) - "packages": ["uview-components"] // 棰勪笅杞藉垎鍖呯殑 root 鎴� name銆俖_APP__ 琛ㄧず涓诲寘 - } - }, + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "@/uview-components/uview-ui/components/u-$1/u-$1.vue", //uview, + "^uni-(.*)": "@/uni_modules/uni-$1/components/uni-$1/uni-$1.vue" // uniapp缁勪欢 + } + }, + "preloadRule": { + "pages/tabbar/index/home": // 椤甸潰璺緞 + // 椤甸潰鐨勯涓嬭浇閰嶇疆 + { + "network": "all", // all(涓嶉檺缃戠粶) wifi(浠厀ifi涓嬮涓嬭浇) + "packages": [ + "uview-components" + ] // 棰勪笅杞藉垎鍖呯殑 root 鎴� name銆俖_APP__ 琛ㄧず涓诲寘 + } + }, "pages": [ // 绗竴涓氨鏄椤� { - "path" : "pages/tabbar/index/home", - "style" : - { + "path": "pages/tabbar/index/home", + "style": { // "navigationBarTitleText" : "瑙嗛", - "enablePullDownRefresh" : false, + "enablePullDownRefresh": false, "navigationStyle": "custom" // 闅愯棌椤堕儴瀵艰埅鏍� } }, + // { + // "path": "pages/tabbar/index/home1", + // "style": { + // "navigationBarTitleText": "" + // } + // }, { "path": "pages/tabbar/home/index", "style": { "navigationBarTitleText": "棣栭〉", "navigationStyle": "custom", // 闅愯棌绯荤粺瀵艰埅鏍� "navigationBarTextStyle": "black", - "enablePullDownRefresh":true + "enablePullDownRefresh": true } - }, + }, { "path": "pages/tabbar/home/title", "style": { @@ -46,21 +53,22 @@ "navigationBarTitleText": "璐墿杞�", "navigationStyle": "custom", // 闅愯棌绯荤粺瀵艰埅鏍� "navigationBarBackgroundColor": "#fff", - "enablePullDownRefresh":true, //瀹炵幇涓嬫媺鍒锋柊鏍峰紡 + "enablePullDownRefresh": true, //瀹炵幇涓嬫媺鍒锋柊鏍峰紡 "componentPlaceholder": { - "u-navbar": "view", - "u-checkbox-group": "view", - "u-checkbox": "view", - "u-swipe-action": "view", - "u-image": "view", - "u-icon": "view", - "u-count-down": "view", - "u-modal": "view", - "u-popup": "view", - "u-toast": "view" - } + "u-navbar": "view", + "u-checkbox-group": "view", + "u-checkbox": "view", + "u-swipe-action": "view", + "u-image": "view", + "u-icon": "view", + "u-count-down": "view", + "u-modal": "view", + "u-popup": "view", + "u-toast": "view" + } } - }, { + }, + { "path": "pages/tabbar/category/category", "style": { "navigationBarTitleText": "鍒嗙被", @@ -88,7 +96,7 @@ "contentAdjust": "false", "bounce": "none", "safearea": { - "bottom": "none" + "bottom": "none" } }, "componentPlaceholder": { @@ -108,7 +116,7 @@ "contentAdjust": "false", "bounce": "none", "safearea": { - "bottom": "none" + "bottom": "none" } }, "componentPlaceholder": { @@ -162,7 +170,7 @@ "contentAdjust": "false", "bounce": "none", "safearea": { - "bottom": "none" + "bottom": "none" } }, "componentPlaceholder": { @@ -172,7 +180,8 @@ "u-back-top": "view" } } - }, { + }, + { "path": "pages/tabbar/user/my", "style": { "navigationBarTextStyle": "white", @@ -185,25 +194,21 @@ } } }, - { "path": "pages/tabbar/home/web-view", + "style": {} + }, + { + "path": "pages/tabbar/special/special", "style": { - + "navigationBarTitleText": "涓撻" } }, - { - "path": "pages/tabbar/special/special", - "style": { - "navigationBarTitleText": "涓撻" - } - }, { - "path" : "pages/tabbar/video/video", - "style" : - { - "navigationBarTitleText" : "鍙戝竷瑙嗛", - "enablePullDownRefresh" : false, + "path": "pages/tabbar/video/video", + "style": { + "navigationBarTitleText": "鍙戝竷瑙嗛", + "enablePullDownRefresh": false, "componentPlaceholder": { "u-icon": "view", "u-button": "view", @@ -216,11 +221,10 @@ } }, { - "path" : "pages/goods-manager/goodsList/goodsList", - "style" : - { - "enablePullDownRefresh" : true, - "navigationBarTitleText" : "鍟嗗搧鍒楄〃", + "path": "pages/goods-manager/goodsList/goodsList", + "style": { + "enablePullDownRefresh": true, + "navigationBarTitleText": "鍟嗗搧鍒楄〃", "componentPlaceholder": { "u-icon": "view", "u-button": "view", @@ -233,11 +237,10 @@ } }, { - "path" : "pages/goods-manager/addGoods/addGoods", - "style" : - { - "enablePullDownRefresh" : true, - "navigationBarTitleText" : "鏂板鍟嗗搧", + "path": "pages/goods-manager/addGoods/addGoods", + "style": { + "enablePullDownRefresh": true, + "navigationBarTitleText": "鏂板鍟嗗搧", "componentPlaceholder": { "u-icon": "view", "u-button": "view", @@ -245,31 +248,85 @@ "u-form-item": "view", "u-input": "view", "u-popup": "view", - "u-search": "view" + "u-search": "view", + "u-upload": "view" + } + } + }, + { + "path": "pages/userPermissions/userPermissions", + "style": { + "navigationBarTitleText": "鐢ㄦ埛鏉冮檺", + "componentPlaceholder": { + "u-icon": "view", + "u-button": "view", + "u-form": "view", + "u-form-item": "view", + "u-input": "view", + "u-popup": "view", + "u-search": "view", + "u-loading": "view", + "u-navbar": "view" + } + } + }, + { + "path": "pages/customerManager/customerManager", + "style": { + "navigationBarTitleText": "瀹㈡埛绠$悊", + "componentPlaceholder": { + "u-icon": "view", + "u-button": "view", + "u-form": "view", + "u-form-item": "view", + "u-input": "view", + "u-popup": "view", + "u-search": "view", + "u-loading": "view", + "u-checkbox": "view", + "u-checkbox-group": "view", + "u-navbar": "view" + } + } + }, + { + "path": "pages/userPermissions/addStoreMember", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", // 闅愯棌椤堕儴瀵艰埅鏍� + "componentPlaceholder": { + "u-icon": "view", + "u-button": "view", + "u-form": "view", + "u-form-item": "view", + "u-input": "view", + "u-popup": "view", + "u-search": "view", + "u-loading": "view", + "u-checkbox": "view", + "u-checkbox-group": "view", + "u-navbar": "view" } } } - - ], "subPackages": [ - { - "root": "uview-components", // 蹇呴』涓巔reloadRule涓殑鍚嶇О瀹屽叏涓�鑷� - "name": "uview-components", - "pages": [ - { - "path": "pages/empty-page/empty-page", - "style": { - "navigationBarTitleText": "", - "disableScroll": true - } - } - ] - }, + { + "root": "uview-components", // 蹇呴』涓巔reloadRule涓殑鍚嶇О瀹屽叏涓�鑷� + "name": "uview-components", + "pages": [ + { + "path": "pages/empty-page/empty-page", + "style": { + "navigationBarTitleText": "", + "disableScroll": true + } + } + ] + }, { "root": "pages/mine", "pages": [ - { "path": "signIn", "style": { @@ -278,7 +335,8 @@ "u-icon": "view" } } - }, { + }, + { "path": "myTracks", "style": { "navigationBarTitleText": "鎴戠殑瓒宠抗", @@ -293,7 +351,8 @@ "u-checkbox": "view" } } - }, { + }, + { "path": "myCollect", "style": { "navigationBarTitleText": "鏀惰棌", @@ -399,39 +458,33 @@ "path": "deposit/index", "style": { "navigationStyle": "custom" - } }, { "path": "deposit/operation", "style": { "navigationStyle": "custom" - } }, { "path": "deposit/recharge", "style": { "navigationBarTitleText": "鍏呭�奸噾棰�" - } }, { "path": "deposit/withdrawal", "style": { "navigationBarTitleText": "鎻愮幇閲戦" - } }, - - { - "path": "deposit/info", - "style": { - "navigationBarTitleText": "棰勫瓨娆捐鎯�" - - } - }, - { + { + "path": "deposit/info", + "style": { + "navigationBarTitleText": "棰勫瓨娆捐鎯�" + } + }, + { "path": "address/address", "style": { "enablePullDownRefresh": true, @@ -477,7 +530,6 @@ "navigationBarTitleText": "鍔熻兘浠嬬粛" } }, - { "path": "set/securityCenter/fingerLogin", "style": { @@ -490,36 +542,26 @@ "navigationBarTitleText": "闈㈠鐧诲綍" } }, - - { "path": "set/securityCenter/editPassword", "style": { "navigationBarTitleText": "淇敼瀵嗙爜", - "app-plus": { - - } + "app-plus": {} } }, - { "path": "set/securityCenter/bindMobile", "style": { "navigationBarTitleText": "缁戝畾鎵嬫満鍙�", - "app-plus": { - - } + "app-plus": {} } }, - { "path": "im/list", "style": { "navigationStyle": "custom", // 闅愯棌绯荤粺瀵艰埅鏍� "enablePullDownRefresh": true, - "app-plus": { - } - + "app-plus": {} } }, { @@ -527,9 +569,7 @@ "style": { "navigationStyle": "custom", // 闅愯棌绯荤粺瀵艰埅鏍� "enablePullDownRefresh": true, - "app-plus": { - } - + "app-plus": {} } }, { @@ -548,7 +588,6 @@ "navigationBarTitleText": "瀹夊叏涓績" } }, - { "path": "set/editionIntro", "style": { @@ -578,12 +617,14 @@ "app-plus": { "titleNView": { "padding-right": "12", - "buttons": [{ - "text": "淇濆瓨", - "fontSize": "16", - "width": "auto", - "color": "#FFFFFF" - }] + "buttons": [ + { + "text": "淇濆瓨", + "fontSize": "16", + "width": "auto", + "color": "#FFFFFF" + } + ] } }, "componentPlaceholder": { @@ -595,7 +636,8 @@ "u-picker": "view" } } - }, { + }, + { "path": "help/tips", "style": { "navigationBarTitleText": "", @@ -603,7 +645,8 @@ "u-parse": "view" } } - }, { + }, + { "path": "point/myPoint", "style": { "navigationBarTitleText": "鎴戠殑绉垎", @@ -613,7 +656,7 @@ } } }, - { + { "path": "msgTips/main", "style": { "navigationBarTitleText": "娑堟伅涓績" @@ -642,209 +685,292 @@ "style": { "navigationBarTitleText": "璁㈠崟璺熻釜" } + }, + { + "path": "activity/detail", + "style": { + "navigationBarTitleText": "娲诲姩璇︽儏", + "enablePullDownRefresh": true, //涓嬫媺鍒锋柊 + "componentPlaceholder": { + "u-form": "view", + "u-form-item": "view", + "u-input": "view", + "u-icon": "view", + "u-action-sheet": "view", + "u-checkbox-group": "view", + "u-checkbox": "view", + "u-navbar": "view", + "u-button": "view", + "u-image": "view" + } + } + }, + { + "path": "activity/myActivity", + "style": { + "navigationBarTitleText": "鎴戠殑娲诲姩", + "enablePullDownRefresh": true, //涓嬫媺鍒锋柊 + "componentPlaceholder": { + "u-form": "view", + "u-form-item": "view", + "u-input": "view", + "u-icon": "view", + "u-action-sheet": "view", + "u-checkbox-group": "view", + "u-checkbox": "view", + "u-navbar": "view", + "u-button": "view", + "u-image": "view" + } + } + }, + { + "path": "activity/reportActivity", + "style": { + "navigationBarTitleText": "娲诲姩", + "enablePullDownRefresh": true, //涓嬫媺鍒锋柊 + "componentPlaceholder": { + "u-form": "view", + "u-form-item": "view", + "u-input": "view", + "u-icon": "view", + "u-action-sheet": "view", + "u-checkbox-group": "view", + "u-checkbox": "view", + "u-navbar": "view", + "u-button": "view", + "u-image": "view", + "u-loadmore": "view" + } + } + }, + { + "path": "myCollect/myCollect", + "style": { + "navigationBarTitleText": "鎴戠殑鏀惰棌", + "enablePullDownRefresh": true, //涓嬫媺鍒锋柊 + "componentPlaceholder": { + "u-icon": "view", + "u-button": "view", + "u-form": "view", + "u-form-item": "view", + "u-input": "view", + "u-popup": "view", + "u-search": "view", + "u-loading": "view", + "u-navbar": "view", + "u-image": "view", + "u-loadmore": "view" + } + } } - ] - }, - - { "root": "pages/product", - "pages": [{ - "path": "shopPage", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - },{ - "path": "shopList", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - },{ - "path": "licencePhoto", - "style": { - "navigationBarTitleText": "钀ヤ笟鎵х収" - } - },{ - "path": "shopPageGoods", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom" - } - }, - { - "path": "goods", - "style": { - "backgroundColor": "#fff", + "pages": [ + { + "path": "shopPage", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "shopList", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "licencePhoto", + "style": { + "navigationBarTitleText": "钀ヤ笟鎵х収" + } + }, + { + "path": "shopPageGoods", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom" + } + }, + { + "path": "goods", + "style": { + "backgroundColor": "#fff", + "navigationStyle": "custom", + "app-plus": { + // 灏嗗洖寮瑰睘鎬у叧鎺� + "bounce": "none", + // 绂佹椤甸潰婊氬姩 + "scrollIndicator": "none", + "safearea": { + "bottom": { + "offset": "none" + } + } + }, + "componentPlaceholder": { + "u-icon": "view", + "u-navbar": "view", + "u-popup": "view" + } + } + }, + { + "path": "askList", + "style": { + "navigationBarTitleText": "闂瓟涓撳尯" + } + }, + { + "path": "product/promotion/-promotion-details", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-tag": "view" + } + } + }, + { + "path": "product/promotion/-promotion-assemble-promotions", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-tag": "view", + "u-count-down": "view" + } + } + }, + { + "path": "product/promotion/-promotion-assemble-list", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-image": "view", + "u-button": "view", + "u-empty": "view" + } + } + }, + { + "path": "product/goods/-goods-intro", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-empty": "view", + "u-parse": "view" + } + } + }, + { + "path": "product/shop/-shop", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-image": "view", + "u-loading": "view" + } + } + }, + { + "path": "product/evaluation/-evaluation", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-avatar": "view", + "u-read-more": "view", + "u-image": "view", + "u-empty": "view" + } + } + }, + { + "path": "product/goods/-goods-swiper", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-loading": "view", + "u-image": "view" + } + } + }, + { + "path": "product/popup/address", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-popup": "view", + "u-icon": "view", + "u-empty": "view" + } + } + }, + { //鍟嗗搧璇勪环 + "path": "comment", "navigationStyle": "custom", - "app-plus": { - // 灏嗗洖寮瑰睘鎬у叧鎺� - "bounce": "none", - // 绂佹椤甸潰婊氬姩 - "scrollIndicator": "none", - "safearea": { - "bottom": { - "offset": "none" - } - } - }, - "componentPlaceholder": { - "u-icon": "view", - "u-navbar": "view", - "u-popup": "view" + "style": { + "navigationBarTitleText": "鍟嗗搧璇勪环", + //app椤甸潰涓嶆樉绀烘粴鍔ㄦ潯 + "scrollIndicator": "none" + } + }, + { // 瀹㈡湇 + "path": "customerservice/index", + "style": { + "navigationBarTitleText": "瀹㈡湇", + "usingComponents": { + // #ifdef MP-WEIXIN + "chat": "plugin://myPlugin/chat" + // #endif + } } } - }, - { - "path": "askList", - "style": { - "navigationBarTitleText": "闂瓟涓撳尯" - } - }, - { - "path": "product/promotion/-promotion-details", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-tag": "view" - } - } - }, - { - "path": "product/promotion/-promotion-assemble-promotions", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-tag": "view", - "u-count-down": "view" - } - } - }, - { - "path": "product/promotion/-promotion-assemble-list", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-image": "view", - "u-button": "view", - "u-empty": "view" - } - } - }, - { - "path": "product/goods/-goods-intro", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-empty": "view", - "u-parse": "view" - } - } - }, - { - "path": "product/shop/-shop", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-image": "view", - "u-loading": "view" - } - } - }, - { - "path": "product/evaluation/-evaluation", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-avatar": "view", - "u-read-more": "view", - "u-image": "view", - "u-empty": "view" - } - } - }, - { - "path": "product/goods/-goods-swiper", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-loading": "view", - "u-image": "view" - } - } - }, - { - "path": "product/popup/address", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-popup": "view", - "u-icon": "view", - "u-empty": "view" - } - } - }, - { //鍟嗗搧璇勪环 - "path": "comment", - "navigationStyle": "custom", - "style": { - "navigationBarTitleText": "鍟嗗搧璇勪环", - //app椤甸潰涓嶆樉绀烘粴鍔ㄦ潯 - "scrollIndicator": "none" - } - }, - { // 瀹㈡湇 - "path": "customerservice/index", - "style": { - "navigationBarTitleText": "瀹㈡湇", - "usingComponents": { - // #ifdef MP-WEIXIN - "chat": "plugin://myPlugin/chat" - // #endif - } - } - } - ] - }, { "root": "pages/floor", - "pages": [{ - "path": "empty" - }] - + "pages": [ + { + "path": "empty" + } + ] }, { "root": "pages/video", - "pages": [{ + "pages": [ + { "path": "home-page", "style": { "navigationBarTitleText": "TA鐨勪富椤�" } }, { - "path" : "video-play", - "style" : - { - "navigationBarTitleText" : "" + "path": "video-play", + "style": { + "navigationBarTitleText": "" } }, { - "path" : "home-page-edit", - "style" : - { - "navigationBarTitleText" : "涓婚〉淇℃伅淇敼" + "path": "home-page-edit", + "style": { + "navigationBarTitleText": "涓婚〉淇℃伅淇敼" + } + }, + { + "path": "video-edit", + "style": { + "navigationBarTitleText": "瑙嗛缂栬緫" } } ] }, { "root": "pages/passport", - "pages": [{ + "pages": [ + { "path": "login", "style": { "navigationBarTitleText": "", @@ -854,14 +980,13 @@ "animationType": "slide-in-bottom", "scrollIndicator": "none", "safearea": { - "bottom": { - "offset": "none" - } - } + "bottom": { + "offset": "none" + } + } } } }, - { "path": "entry/seller/index", "style": { @@ -949,58 +1074,57 @@ } } ] - }, - { "root": "pages/promotion", - "pages": [ { + "pages": [ + { "path": "seckill", "style": { "navigationBarTitleText": "闄愭椂鎶㈣喘", "navigationStyle": "custom", // 闅愯棌绯荤粺瀵艰埅鏍� - "navigationBarTextStyle": "black" , + "navigationBarTextStyle": "black", "app-plus": { "titleNView": { - "homeButton":true + "homeButton": true } } } }, - - { + { "path": "joinGroup", "style": { "navigationBarTitleText": "鎷煎洟娲诲姩", "navigationStyle": "custom", // 闅愯棌绯荤粺瀵艰埅鏍� - "navigationBarTextStyle": "black" , + "navigationBarTextStyle": "black", "app-plus": { // 灏嗗洖寮瑰睘鎬у叧鎺� "bounce": "none" } } - },{ + }, + { "path": "lives", "style": { "navigationStyle": "custom", "navigationBarTextStyle": "black" - } - },{ + }, + { "path": "bargain/list", "style": { "navigationStyle": "custom", "navigationBarTextStyle": "white" - } - },{ + }, + { "path": "bargain/detail", "style": { "navigationStyle": "custom", "navigationBarTextStyle": "white" - } - },{ + }, + { "path": "bargain/log", "style": { "navigationBarTitleText": "鐮嶄环璁板綍", @@ -1009,28 +1133,26 @@ "u-empty": "view" } } - },{ + }, + { "path": "point/detail", "style": { "navigationStyle": "custom", "navigationBarTextStyle": "white" - } - },{ + }, + { "path": "point/pointList", "style": { "navigationBarTitleText": "绉垎鍟嗗煄" - - } } - ] - }, { "root": "pages/cart", - "pages": [{ + "pages": [ + { "path": "coupon/myCoupon", "style": { "navigationBarTitleText": "鎴戠殑浼樻儬鍒�", @@ -1055,7 +1177,6 @@ "navigationBarTitleText": "浼樻儬鍒�" } }, - { "path": "coupon/couponCenter", "style": { @@ -1072,7 +1193,6 @@ "navigationBarTitleText": "鏀粯璁㈠崟", "app-plus": { "popGesture": "none" //绂佹渚ф粦閫�鍑� - } } }, @@ -1092,18 +1212,15 @@ "path": "payment/shareOrderGoods", "style": { "navigationBarTitleText": "", - "app-plus": { - - } + "app-plus": {} } } - ] - }, { "root": "pages/order", - "pages": [{ + "pages": [ + { "path": "complain/complain", "style": { "navigationBarTitleText": "璁㈠崟鍟嗗搧鎶曡瘔" @@ -1173,7 +1290,6 @@ "navigationBarTitleText": "璇勪环璇︽儏" } }, - { "path": "evaluate/releaseEvaluate", "style": { @@ -1193,7 +1309,6 @@ } } }, - { "path": "afterSales/applyProgress", "style": { @@ -1214,13 +1329,15 @@ "bounce": "none", "titleNView": { "titleColor": "#FFFFFF", - "buttons": [{ - "text": "瀹屾垚", - "fontSize": "14", - "color": "#FFFFFF", - "width": "36px" - // "background": "rgba(0,0,0,0)" - }] + "buttons": [ + { + "text": "瀹屾垚", + "fontSize": "14", + "color": "#FFFFFF", + "width": "36px" + // "background": "rgba(0,0,0,0)" + } + ] } } } @@ -1274,7 +1391,6 @@ "app-plus": { // 鍏ㄥ眬鍏抽棴鍥炲脊鍔熻兘 "bounce": "none" - } }, "tabBar": { @@ -1283,7 +1399,8 @@ "selectedColor": "#ff573e", "borderStyle": "black", "backgroundColor": "#ffffff", - "list": [{ + "list": [ + { "pagePath": "pages/tabbar/index/home", "iconPath": "static/tabbar/home.png", "selectedIconPath": "static/tabbar/home-s.png", @@ -1326,4 +1443,4 @@ // "query": "" //鍚姩鍙傛暟锛屽湪椤甸潰鐨刼nLoad鍑芥暟閲岄潰寰楀埌 // }] } -} +} \ No newline at end of file diff --git a/pages/customerManager/customerManager.vue b/pages/customerManager/customerManager.vue new file mode 100644 index 0000000..f2e7aa5 --- /dev/null +++ b/pages/customerManager/customerManager.vue @@ -0,0 +1,86 @@ +<template> + <view > + <!-- 鍐呭鍖哄煙 --> + <scroll-view scroll-y style="height: 100vh;" @scrolltolower="loadMore" class="user-list" + :lower-threshold="100" + > + <view > + <view class="user-item" v-for="(user, index) in userList" :key="user.id" > + + <view class="user-info"> + <text class="realName">{{ user.realName }}</text> + <text class="mobile">{{ user.mobile }}</text> + </view> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <view class="action-buttons"> + <u-button type="primary" size="mini" @click.stop="restPassword(user.memberId)" class="edit-btn">閲嶇疆瀵嗙爜</u-button> + <u-button type="primary" size="mini" @click.stop="navigateToDetail(user.id)" class="edit-btn">淇敼</u-button> + <u-button type="error" size="mini" @click.stop="deleteUser(user.id)" + class="delete-btn">鍒犻櫎</u-button> + </view> + + </view> + </view> + + <!-- 鏀硅繘鐨勫姞杞芥洿澶氭彁绀� --> + <view > + <u-loadmore class="load-more" + v-if="mockData.length > 0" + :status="loading ? 'loading' : noMore ? 'nomore' : 'loadmore'" + :load-text="{ + loadmore: '涓婃媺鍔犺浇鏇村', + loading: '姝e湪鍔犺浇', + nomore: '娌℃湁鏇村浜�' + }" + /> + </view> + <view style="height:150rpx"> + + </view> + </scroll-view> + + + + </view> +</template> + +<script> + import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue'; + import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue'; + import UForm from '@/uview-components/uview-ui/components/u-form/u-form.vue'; + import UFormItem from '@/uview-components/uview-ui/components/u-form-item/u-form-item.vue'; + import UInput from '@/uview-components/uview-ui/components/u-input/u-input.vue'; + import USearch from '@/uview-components/uview-ui/components/u-search/u-search.vue'; + import UPopup from '@/uview-components/uview-ui/components/u-popup/u-popup.vue'; + import ULoading from '@/uview-components/uview-ui/components/u-loading/u-loading.vue' + export default { + components: { + UIcon, + UButton, + UForm, + UFormItem, + UInput, + USearch, + UPopup, + ULoading + }, + data() { + return { + + } + }, + methods: { + + } + } +</script> + +<style> +.load-more { + padding: 20rpx 0; + text-align: center; + color: #999; + font-size: 26rpx; + background-color: #f7f8fa; + } +</style> diff --git a/pages/goods-manager/addGoods/addGoods.vue b/pages/goods-manager/addGoods/addGoods.vue index bcc7e93..877de76 100644 --- a/pages/goods-manager/addGoods/addGoods.vue +++ b/pages/goods-manager/addGoods/addGoods.vue @@ -4,36 +4,45 @@ <u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules"> <u-form-item label="鍟嗗搧鍒嗙被" label-width="130" prop=""> - <picker @change="bindCategoryChange" :value="index" :range="categoryArray"> - <view class="uni-input">{{categoryArray[index]}}</view> + <picker @change="bindCategoryChange" :value="c_index" :range="categoryArray" :range-key="'name'"> + <view class="uni-input">{{ categoryArray[c_index].name }}</view> </picker> </u-form-item> - <u-form-item class="border" label="鍟嗗搧鍚嶇О" label-width="130" prop="name"> - <u-input v-model="form.name" clearable placeholder="璇疯緭鍏ュ晢鍝佸悕绉�" /> + <u-form-item class="border" label="鍟嗗搧鍚嶇О" label-width="130" prop="goodsName"> + <u-input v-model="form.goodsName" clearable placeholder="璇疯緭鍏ュ晢鍝佸悕绉�" /> </u-form-item> - <u-form-item label="鍟嗗搧浠锋牸" label-width="130" prop="mobile"> - <u-input v-model="form.mobile" type="number" maxlength="11" placeholder="璇疯緭鍏ュ晢鍝佷环鏍�" /> + <u-form-item label="鍟嗗搧浠锋牸" label-width="130" prop="price"> + <u-input v-model="form.price" type="number" placeholder="璇疯緭鍏ュ晢鍝佷环鏍�" /> </u-form-item> - <u-form-item class="detailgoods" label="璇︾粏鍦板潃" label-width="130" prop="detail"> - <u-input type="textarea" v-model="form.detail" maxlength="100" height="150" placeholder="琛楅亾妤肩墝鍙风瓑" /> - </u-form-item> + <u-form-item label="鍟嗗搧鍗栫偣" label-width="130"> - <u-input type="textarea" v-model="form.alias" placeholder="璇疯緭鍏ュ晢鍝佸崠鐐�" /> + <u-input type="textarea" v-model="form.sellingPoint" placeholder="璇疯緭鍏ュ晢鍝佸崠鐐�" /> </u-form-item> <u-form-item label="鍟嗗搧鍝佺墝" label-width="130" prop=""> - <div @click="showBrands"> - {{ form.___path || '璇烽�夋嫨鍝佺墝' }} - </div> + <picker @change="bindBrandsChange" :value="b_index" :range="brandsArray" :range-key="'name'"> + <view class="uni-input">{{ brandsArray[b_index].name }}</view> + </picker> </u-form-item> <u-form-item label="璁¢噺鍗曚綅" label-width="130" prop="___path"> - <div @click="showUnit"> - {{ form.___path || '璇烽�夋嫨鎵�鍦ㄥ湴鍖�' }} - </div> + <picker @change="bindUnitChange" :value="u_index" :range="unitArray" :range-key="'name'"> + <view class="uni-input">{{ unitArray[u_index].name }}</view> + </picker> </u-form-item> + <u-form-item label="閿�鍞ā寮�" label-width="130" prop="___path"> + <radio-group name="radio"> + <label> + <radio value="radio1" /><text>闆跺敭鍨�</text> + </label> + <label> + <radio value="radio2" /><text>鎵瑰彂鍨�</text> + </label> + </radio-group> + </u-form-item> + <view class="opt-view"> @@ -61,22 +70,25 @@ import UFormItem from '@/uview-components/uview-ui/components/u-form-item/u-form-item.vue'; import UInput from '@/uview-components/uview-ui/components/u-input/u-input.vue'; import UUpload from '@/uview-components/uview-ui/components/u-upload/u-upload.vue'; -import UCheckboxGroup from '@/uview-components/uview-ui/components/u-checkbox-group/u-checkbox-group.vue'; -import UCheckbox from '@/uview-components/uview-ui/components/u-checkbox/u-checkbox.vue'; +// import UCheckboxGroup from '@/uview-components/uview-ui/components/u-checkbox-group/u-checkbox-group.vue'; +// import UCheckbox from '@/uview-components/uview-ui/components/u-checkbox/u-checkbox.vue'; import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue'; import storage from "@/utils/storage.js"; import * as API_GOODS from "@/api/goods.js"; export default { - components: { UForm, UFormItem, UInput, UUpload, UCheckboxGroup, UCheckbox, UIcon }, + components: { UForm, UFormItem, UInput, UUpload, UIcon }, data() { return { + c_index: 0, + b_index: 0, + u_index: 0, storage, form: {}, - categoryArray:[], - brandsArray:[], - unitArray:[] + categoryArray: [], + brandsArray: [], + unitArray: [] } }, methods: { @@ -89,27 +101,40 @@ }); this.form.images = images; }, - bindCategoryChange(){}, - bindBrandsChange(){}, - bindUnitChange(){}, - initCategory(){ + bindCategoryChange(e) { + this.c_index = e.detail.value + console.log('this.c_index', this.c_index); + + this.initBrands(this.categoryArray[this.c_index].id) + }, + bindBrandsChange(e) { + this.b_index = e.detail.value + this.form.brandId = this.brandsArray[this.b_index].id + }, + bindUnitChange(e) { + this.u_index = e.detail.value + this.form.goodsUnit = this.unitArray[this.u_index].name + }, + initCategory() { API_GOODS.getStoreGoodsCategory().then((res) => { const params = res.data.result; this.categoryArray = params - if(params.length>0){ + if (params && params.length > 0) { this.initBrands(params[0].id) } }); }, - initBrands(categoryId){ + initBrands(categoryId) { + this.brandsArray = [] API_GOODS.getStoreGoodsBrands(categoryId).then((res) => { - const params = res.data.result; + const params = res.data; this.brandsArray = params }); }, - initGoods(){ + initGoods() { API_GOODS.getgoodsUnit().then((res) => { - const params = res.data.result; + const params = res.data.result.records; + this.unitArray = params }); }, @@ -117,7 +142,7 @@ onShow() { this.initGoods() this.initCategory() - + }, onLoad(option) { uni.showLoading({ diff --git a/pages/mine/activity/detail.vue b/pages/mine/activity/detail.vue new file mode 100644 index 0000000..fb61737 --- /dev/null +++ b/pages/mine/activity/detail.vue @@ -0,0 +1,318 @@ +<template> + <view class="container"> + <!-- 椤堕儴娴锋姤鍥� --> + <!-- 鍔ㄦ�佸皝闈㈠尯鍩� --> + <view class="cover-container"> + <!-- 鍥剧墖绫诲瀷 --> + <block v-if="activityInfo.coverType === '鍥剧墖'"> + <image :src="getUrl(activityInfo.cover)" class="activity-cover" /> + </block> + <block v-if=" activityInfo.coverType === '瑙嗛'"> + <video :src="getUrl(item.cover)" + @play="handleVideoPlay" class="activity-cover"></video> + </block> + <!-- 鏂囧瓧绫诲瀷 --> + <block v-if="activityInfo.coverType === '鏂囧瓧'"> + <view class="text-cover"> + <text class="cover-text">{{ activityInfo.cover }}</text> + </view> + </block> + </view> + + <!-- 娲诲姩鍩烘湰淇℃伅 --> + <view class="info-section"> + <text class="title">{{ activityInfo.activityName }}</text> + <view class="meta-info"> + <view> + <text class="time"> + 寮�濮嬫椂闂达細{{ activityInfo.startTime }} + </text> + + </view> + <view> + <text class="time"> + 缁撴潫鏃堕棿锛歿{ activityInfo.endTime }} + </text> + </view> + <view> + <text class="location">鍦扮偣锛歿{ activityInfo.activityLocation || '鏆傛棤' }}</text> + </view> + <view> + <text class="location">鏈�澶т汉鏁帮細{{ activityInfo.limitUserNum || '鏆傛棤' }}</text> + </view> + <view> + <text class="location">娲诲姩绫诲瀷锛歿{ activityInfo.activityType || '鏆傛棤' }}</text> + </view> + </view> + <view class="tags"> + <text v-for="(tag, index) in activityInfo.tags" :key="index" class="tag">{{ tag }}</text> + </view> + </view> + + + + <!-- 娲诲姩璇︽儏鍐呭 --> + <view class="content-section"> + <rich-text :nodes="activityInfo.activityContent"></rich-text> + </view> + <!-- 鎶ュ悕鐘舵�� --> + <view class="status-bar" :style="{ backgroundColor: statusBarColor }"> + <u-button class="signup-btn" @click.stop="activityReport()" :disabled="reportBtn" >{{ reportBtn ? '宸叉姤鍚�': '绔嬪嵆鎶ュ悕'}}</u-button> + <u-button class="signup-btn" @click.stop="collect()">{{ isCollect ? '鍙栨秷鏀惰棌' : '鏀惰棌' }}</u-button> + </view> + </view> +</template> + +<script> + import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue'; + import {changeCollect} from '@/api/collect.js' + import {getFilePreviewUrl} from '@/api/common.js' + import { + getActivityDetail, + activityReport + } from '@/api/activity.js'; + export default { + components: { + UButton + }, + data() { + return { + activityInfo: { + coverType: '', + cover: '', + activityName: '', + startTime: '', // 鏃堕棿鎴� + endTime: '', + activityLocation: '', + tags: [], + activityContent: '', + activityType: '', + limitUserNum:'', + }, + isCollect:false, + reportBtn:false, + detailId: null, // 瀛樺偍鎺ユ敹鐨勫弬鏁� + reportFrom: { + activityId: '', + cancel: false, //鎶ュ悕鎺ュ彛榛樿鎴慺alse + }, + collectForm:{ + collectType:'', + refId:'', + }, + }; + }, + onLoad(options) { + // 鎺ユ敹 URL 鍙傛暟 + if (options.id) { + this.detailId = options.id; + // 鍙湪姝ゅ鍙戣捣璇锋眰锛屾牴鎹� ID 鍔犺浇璇︽儏鏁版嵁 + this.loadDetailData(); + } + }, + methods: { + collect(){ + this.collectForm.collectType = 'activity' + this.collectForm.refId = this.detailId + changeCollect(this.collectForm).then(res=>{ + if (res.statusCode === 200) { + this.isCollect = true; + uni.showToast({ + title: res.data.msg, // 鎻愮ず鏂囧瓧 + icon: 'success', // 鍥炬爣绫诲瀷锛坰uccess/loading/none锛� + mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛堥槻姝㈣Е鎽哥┛閫忥級 + }); + } + }) + }, + //鎶ュ悕 + activityReport() { + this.reportFrom.activityId = this.detailId + activityReport(this.reportFrom).then(res => { + if (res.statusCode === 200) { + this.reportBtn = true; + uni.showToast({ + title: res.data.msg, // 鎻愮ず鏂囧瓧 + icon: 'success', // 鍥炬爣绫诲瀷锛坰uccess/loading/none锛� + mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛堥槻姝㈣Е鎽哥┛閫忥級 + }); + } + + }) + }, + getUrl(params){ + getFilePreviewUrl(params).then(res =>{ + return res.data.data + }) + }, + getActivityDetail(id) { + uni.showLoading({ + title: '鍔犺浇涓�' + }); + getActivityDetail(id).then(res => { + uni.hideLoading(); + console.log(res.data) + if (res.statusCode === 200) { + //璧嬪�� + this.activityInfo.coverType = res.data.data.coverType; + this.activityInfo.cover = res.data.data.cover; + this.activityInfo.activityName = res.data.data.activityName; + this.activityInfo.startTime = res.data.data.startTime; + this.activityInfo.endTime = res.data.data.endTime; + this.activityInfo.activityLocation = res.data.data.activityLocation; + this.activityInfo.activityContent = '<h2>娲诲姩浠嬬粛</h2>' + '<p>' + res.data.data.activityContent + '</p>'; + this.activityInfo.activityType = res.data.data.activityType; + this.activityInfo.limitUserNum = res.data.data.limitUserNum; + this.reportBtn = res.data.data.isReport; + this.isCollect = res.data.data.isCollect; + } + }) + }, + loadDetailData() { + + //鑾峰緱璇︽儏鎺ュ彛 + this.getActivityDetail(this.detailId); + + + + } + } + }; +</script> +<style lang="scss"> + /* 灏侀潰瀹瑰櫒 */ + .cover-container { + position: relative; + width: 100%; + height: 400rpx; + overflow: hidden; + background-color: #f5f5f5; + } + + /* 鍥剧墖/瑙嗛灏侀潰鏍峰紡 */ + .activity-cover { + width: 100%; + height: 100%; + border-radius: 0; /* 涓庡垪琛ㄩ〉淇濇寔涓�鑷� */ + } + + /* 鏂囧瓧灏侀潰鏍峰紡 - 涓庡垪琛ㄩ〉淇濇寔涓�鑷� */ + .text-cover { + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); + padding: 40rpx; + } + + .cover-text { + color: #fff; + font-size: 36rpx; + font-weight: bold; + text-align: center; + line-height: 1.4; + text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.2); + } + .header-image { + width: 100%; + height: 400rpx; + } + + .info-section { + padding: 30rpx; + background: #fff; + margin-top: 20rpx; + } + + .title { + font-size: 40rpx; + font-weight: bold; + color: #333; + display: block; + margin-bottom: 20rpx; + } + + .meta-info { + margin-bottom: 20rpx; + color: #666; + } + + .time { + margin-right: 30rpx; + } + + .tags { + display: flex; + flex-wrap: wrap; + margin-top: 20rpx; + } + + .tag { + font-size: 24rpx; + padding: 8rpx 20rpx; + background: #f0f0f0; + border-radius: 30rpx; + margin-right: 15rpx; + margin-bottom: 15rpx; + } + + .status-bar { + padding: 25rpx 30rpx; + display: flex; + justify-content: space-between; + align-items: center; + color: #fff; + font-size: 28rpx; + margin: 20rpx 0; + } + + .signup-btn { + background: #fff; + color: #2196F3; + padding: 10rpx 30rpx; + border-radius: 50rpx; + font-size: 28rpx; + } + + .content-section { + padding: 30rpx; + background: #fff; + margin-top: 20rpx; + } + + .footer { + position: fixed; + bottom: 0; + left: 0; + right: 0; + height: 100rpx; + background: #fff; + display: flex; + justify-content: space-around; + align-items: center; + border-top: 1rpx solid #eee; + padding: 20rpx 0; + } + + .footer-item { + display: flex; + flex-direction: column; + align-items: center; + font-size: 24rpx; + color: #666; + } + + .footer-icon { + width: 40rpx; + height: 40rpx; + margin-bottom: 10rpx; + } + .btn-container { + display: flex; + justify-content: center; + align-items: center; + margin-top: 8px; /* 涓庝笂鏂规爣棰樹繚鎸侀棿璺� */ + } +</style> \ No newline at end of file diff --git a/pages/mine/activity/myActivity.vue b/pages/mine/activity/myActivity.vue new file mode 100644 index 0000000..c977479 --- /dev/null +++ b/pages/mine/activity/myActivity.vue @@ -0,0 +1,465 @@ +<template> + <view class="activity-container"> + + <!-- 椤堕儴 Tab 瀵艰埅 --> + <view class="tab-nav"> + <view + v-for="(tab, index) in tabs" + :key="index" + class="tab-item" + :class="{active: currentTab === index}" + @click="switchTab(index)" + > + {{tab}} + <view class="tab-indicator" v-if="currentTab === index"></view> + </view> + </view> + + <!-- 娲诲姩鍒楄〃 --> + <view class="activity-list"> + <!-- 宸叉姤鍚嶆椿鍔� --> + <view v-if="currentTab === 0"> + <view v-if="signedActivities.length > 0"> + <view + v-for="(item, idx) in signedActivities" + :key="idx" + class="activity-item card" + > + <!-- 灏侀潰鍖哄煙 --> + <view class="cover-container"> + <block v-if="item.coverType === '鍥剧墖' || item.coverType === '瑙嗛'"> + <image :src="getUrl(item.cover)" mode="aspectFill" class="activity-cover" /> + </block> + <block v-if="item.coverType === '鏂囧瓧'"> + <view class="activity-cover text-cover">{{ item.cover }}</view> + </block> + </view> + + <!-- 娲诲姩淇℃伅 --> + <view class="activity-info"> + <view class="info-header"> + <view class="activity-title">{{ item.activityName }}</view> + <view class="activity-status signed">宸叉姤鍚�</view> + </view> + + <view class="activity-meta"> + <view class="meta-item"> + <u-icon name="calendar" size="16" color="#999"></u-icon> + <text class="activity-time">{{ item.startTime }} - {{ item.endTime }}</text> + </view> + <view class="meta-item"> + <u-icon name="map" size="16" color="#999"></u-icon> + <text class="activity-location">{{ item.activityLocation || '寰呭畾' }}</text> + </view> + </view> + + <view class="action-container"> + <button + class="cancel-btn" + @click="handleActivityCancel(item.id)" + hover-class="cancel-btn-hover" + > + 鍙栨秷鎶ュ悕 + </button> + </view> + </view> + </view> + </view> + <view v-else class="empty-state"> + + <text class="empty-text">鏆傛棤宸叉姤鍚嶆椿鍔�</text> + </view> + </view> + + <!-- 宸茬粨鏉熸椿鍔� --> + <view v-if="currentTab === 1"> + <view v-if="endedActivities.length > 0"> + <view + v-for="(item, idx) in endedActivities" + :key="idx" + class="activity-item card" + > + <view class="cover-container"> + <block v-if="item.coverType === '鍥剧墖' || item.coverType === '瑙嗛'"> + <image :src="getUrl(item.cover)" mode="aspectFill" class="activity-cover" /> + </block> + <block v-if="item.coverType === '鏂囧瓧'"> + <view class="activity-cover text-cover">{{ item.cover }}</view> + </block> + </view> + + <!-- 娲诲姩淇℃伅 --> + <view class="activity-info"> + <view class="info-header"> + <view class="activity-title">{{ item.activityName }}</view> + <view class="activity-status ended">宸茬粨鏉�</view> + </view> + + <view class="activity-meta"> + <view class="meta-item"> + <u-icon name="calendar" size="16" color="#999"></u-icon> + <text class="activity-time">{{ item.startTime }} - {{ item.endTime }}</text> + </view> + <view class="meta-item"> + <u-icon name="map" size="16" color="#999"></u-icon> + <text class="activity-location">{{ item.activityLocation || '寰呭畾' }}</text> + </view> + </view> + </view> + </view> + </view> + <view v-else class="empty-state"> + + <text class="empty-text">鏆傛棤宸茬粨鏉熸椿鍔�</text> + </view> + </view> + + <!-- 宸插彇娑堟椿鍔� --> + <view v-if="currentTab === 2"> + <view v-if="canceledActivities.length > 0"> + <view + v-for="(item, idx) in canceledActivities" + :key="idx" + class="activity-item card" + > + <view class="cover-container"> + <block v-if="item.coverType === '鍥剧墖' || item.coverType === '瑙嗛'"> + <image :src="getUrl(item.cover)" mode="aspectFill" class="activity-cover" /> + </block> + <block v-if="item.coverType === '鏂囧瓧'"> + <view class="activity-cover text-cover">{{ item.cover }}</view> + </block> + </view> + + <!-- 娲诲姩淇℃伅 --> + <view class="activity-info"> + <view class="info-header"> + <view class="activity-title">{{ item.activityName }}</view> + <view class="activity-status canceled">宸插彇娑�</view> + </view> + + <view class="activity-meta"> + <view class="meta-item"> + <u-icon name="calendar" size="16" color="#999"></u-icon> + <text class="activity-time">{{ item.startTime }} - {{ item.endTime }}</text> + </view> + <view class="meta-item"> + <u-icon name="map" size="16" color="#999"></u-icon> + <text class="activity-location">{{ item.activityLocation || '寰呭畾' }}</text> + </view> + </view> + </view> + </view> + </view> + <view v-else class="empty-state"> + <text class="empty-text">鏆傛棤宸插彇娑堟椿鍔�</text> + </view> + </view> + </view> + </view> +</template> + +<script> +import {getMyActivityList,collectCancel,activityCancel} from '@/api/activity.js' +import {getFilePreviewUrl} from '@/api/common.js' +export default { + data() { + return { + currentTab: 0, // 褰撳墠閫変腑鐨則ab绱㈠紩 + tabs: ['宸叉姤鍚�', '宸茬粨鏉�', '宸插彇娑�'], + signedActivities: [], // 宸叉姤鍚嶅垪琛� + endedActivities: [],// 宸茬粨鏉熷垪琛� + canceledActivities: [],//宸插彇娑堝垪琛� + query:{ + status:'', + cancel:false, + }, + } + }, + onLoad(){ + this.currentTab = 0; + this.getMyActivityList(this.currentTab); + }, + methods: { + handleActivityCancel(activityId){ + activityCancel(activityId).then(res =>{ + if(res.statusCode == 200){ + uni.showToast({ + title: res.data.msg, + icon: 'success', + mask: true, + duration: 2000, + success: () => { + setTimeout(() => { + this.getMyActivityList(this.currentTab); + }, 2000); + } + }); + } + }) + }, + getUrl(params){ + getFilePreviewUrl(params).then(res =>{ + return res.data.data + }) + }, + switchTab(index) { + if (this.currentTab !== index) { + this.currentTab = index; + this.getMyActivityList(index) + } + }, + getMyActivityList(index){ + uni.showLoading({ + title: '鍔犺浇涓�' + }); + if(index === 0){ + this.query.cancel = false; + getMyActivityList(this.query).then(res =>{ + uni.hideLoading(); + if(res.statusCode === 200){ + this.signedActivities = res.data.data + } + }) + }else if(index === 1){ + this.query.status = '宸茬粨鏉�'; + this.query.cancel = false; + getMyActivityList(this.query).then(res =>{ + uni.hideLoading(); + if(res.statusCode === 200){ + this.endedActivities = res.data.data + } + }) + }else if(index === 2){ + this.query.cancel = true; + getMyActivityList(this.query).then(res =>{ + uni.hideLoading(); + if(res.statusCode === 200){ + this.canceledActivities = res.data.data + } + }) + } + this.query.status = ''; + this.query.cancel= false; + }, + } +} +</script> + +<style lang="scss"> +.activity-container { + padding: 0; + background-color: #f7f8fa; + min-height: 100vh; +} + +/* Tab 瀵艰埅鏍峰紡 */ +.tab-nav { + display: flex; + background-color: #fff; + margin-bottom: 16rpx; + position: sticky; + top: 0; + z-index: 10; + box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04); +} + +.tab-item { + flex: 1; + text-align: center; + padding: 28rpx 0; + font-size: 30rpx; + color: #666; + position: relative; + transition: all 0.3s ease; + + &.active { + color: #2979ff; + font-weight: 500; + } + + .tab-indicator { + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + width: 80rpx; + height: 6rpx; + background-color: #2979ff; + border-radius: 3rpx; + animation: scaleIn 0.3s ease; + } +} + +@keyframes scaleIn { + from { transform: translateX(-50%) scaleX(0); } + to { transform: translateX(-50%) scaleX(1); } +} + +/* 娲诲姩鍒楄〃鏍峰紡 */ +.activity-list { + padding: 20rpx 24rpx; +} + +.card { + background: #fff; + border-radius: 16rpx; + margin-bottom: 24rpx; + overflow: hidden; + box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04); + transition: transform 0.2s ease, box-shadow 0.2s ease; + + &:active { + transform: scale(0.98); + box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08); + } +} + +.activity-item { + display: flex; + padding: 24rpx; +} + +.cover-container { + position: relative; + width: 200rpx; + height: 200rpx; + border-radius: 12rpx; + overflow: hidden; + margin-right: 24rpx; + flex-shrink: 0; +} + +.activity-cover { + width: 100%; + height: 100%; + border-radius: 12rpx; +} + +.text-cover { + display: flex; + align-items: center; + justify-content: center; + background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); + color: #fff; + font-size: 28rpx; + padding: 16rpx; + line-height: 1.4; +} + +.activity-info { + flex: 1; + display: flex; + flex-direction: column; +} + +.info-header { + display: flex; + justify-content: space-between; + align-items: flex-start; + margin-bottom: 16rpx; +} + +.activity-title { + flex: 1; + font-size: 32rpx; + color: #333; + font-weight: 500; + margin-right: 16rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + line-height: 1.4; +} + +.activity-meta { + font-size: 24rpx; + color: #999; + margin-bottom: 16rpx; +} + +.meta-item { + display: flex; + align-items: center; + margin-bottom: 12rpx; + + .u-icon { + margin-right: 8rpx; + } +} + +.activity-status { + font-size: 24rpx; + padding: 6rpx 16rpx; + border-radius: 20rpx; + flex-shrink: 0; + + &.signed { + color: #2979ff; + background-color: rgba(41, 121, 255, 0.1); + } + + &.ended { + color: #909399; + background-color: rgba(144, 147, 153, 0.1); + } + + &.canceled { + color: #fa3534; + background-color: rgba(250, 53, 52, 0.1); + } +} + +/* 鎿嶄綔鎸夐挳 */ +.action-container { + display: flex; + justify-content: flex-end; + margin-top: auto; + padding-top: 16rpx; +} + +.cancel-btn { + background: #fef0f0; + color: #fa3534; + border: none; + border-radius: 40rpx; + padding: 0 32rpx; + height: 64rpx; + line-height: 64rpx; + font-size: 26rpx; + transition: all 0.3s ease; + + &::after { + border: none; + } + + &.cancel-btn-hover { + background: #fde2e2; + transform: scale(0.98); + } +} + +/* 绌虹姸鎬� */ +.empty-state { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 100rpx 0; + text-align: center; + + .empty-image { + width: 300rpx; + height: 300rpx; + opacity: 0.6; + margin-bottom: 40rpx; + } + + .empty-text { + font-size: 28rpx; + color: #999; + margin-top: 20rpx; + } +} +</style> \ No newline at end of file diff --git a/pages/mine/activity/reportActivity.vue b/pages/mine/activity/reportActivity.vue new file mode 100644 index 0000000..26f3407 --- /dev/null +++ b/pages/mine/activity/reportActivity.vue @@ -0,0 +1,388 @@ +<template> + <view class="wrapper"> + <!-- 鍐呭鍖哄煙 --> + <scroll-view scroll-y class="content" style="height: 100vh;" @scrolltolower="loadMore" + :lower-threshold="100" + > + <view class="waterfall"> + <view class="column" v-for="(column, index) in columns" :key="index"> + <!-- 閬嶅巻姣忓垪鍐呭 --> + <view class="item" v-for="(item, idx) in column" :key="item.id" @click="handleItemClick(item)"> + <!-- 鍥剧墖绫诲瀷 --> + <image v-if="item.type === '鍥剧墖'" :src="getUrl(item.cover)" mode="widthFix" class="media" + @load="imageLoad" :data-item="item" :style="{ height: item.height + 'px' }" /> + + <!-- 瑙嗛绫诲瀷 --> + <video v-if="item.type === '瑙嗛'" :src="getUrl(item.cover)" class="media" controls + :poster="item.poster" @play="handleVideoPlay" + :style="{ height: item.height + 'px' }"></video> + + <!-- 鏂囧瓧绫诲瀷 --> + <view v-if="item.type === '鏂囧瓧'" class="text-content"> + <text class="title">{{ item.cover }}</text> + </view> + <text class="title">{{ item.title }}</text> + + </view> + </view> + </view> + <!-- <view style="height: 150rpx;"></view> --> + <!-- 鏀硅繘鐨勫姞杞芥洿澶氭彁绀� --> + <view class="load-more"> + <u-loadmore + v-if="mockData.length > 0" + :status="loading ? 'loading' : noMore ? 'nomore' : 'loadmore'" + :load-text="{ + loadmore: '涓婃媺鍔犺浇鏇村', + loading: '姝e湪鍔犺浇', + nomore: '娌℃湁鏇村浜�' + }" + /> + </view> + <view style="height:150rpx"> + + </view> + </scroll-view> + + + + </view> +</template> + +<script> + import { + changeCollect + } from '@/api/collect.js' + import { + getFilePreviewUrl + } from '@/api/common.js' + import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue'; + import UImage from '@/uview-components/uview-ui/components/u-image/u-image.vue'; + import ULoadmore from '@/uview-components/uview-ui/components/u-loadmore/u-loadmore.vue' + import { + getActivityReportList, + } from '@/api/activity.js'; + export default { + components: { + UImage, + UButton, + ULoadmore + }, + data() { + return { + columns: [ + [], + [] + ], // 鍙屽垪甯冨眬 + mockData: [], + colHeight: [0, 0], // 璁板綍鍚勫垪楂樺害 + baseImageHeight: 300, // 鍥剧墖鍩虹楂樺害 + baseVideoHeight: 350, // 瑙嗛鍩虹楂樺害 + baseTextHeight: 120, // 鏂囧瓧鍩虹楂樺害 + query: { + pageNumber: 1, + pageSize: 8, + }, + loading: false, // 鏄惁姝e湪鍔犺浇 + noMore: false, // 鏄惁娌℃湁鏇村鏁版嵁 + total: 0 // 鎬绘暟鎹噺 + }; + }, + onLoad() { + this.getActivityList(); + }, + methods: { + getUrl(params) { + getFilePreviewUrl(params).then(res => { + return res.data.data + }) + }, + + /** + * 涓嬫媺鍒锋柊鏃� + */ + onPullDownRefresh() { + this.query.pageNumber = 1; // 閲嶇疆椤电爜 + this.noMore = false; + this.mockData = []; // 娓呯┖鏁版嵁 + this.getActivityList(); + }, + loadMore() { + + // 鏄剧ず鍔犺浇鐘舵�� + this.loading = true; + + // 寤惰繜鎵ц璁︰I鏈夊弽搴旀椂闂� + setTimeout(() => { + this.query.pageNumber += 1; + this.getActivityList(); + }, 300); + }, + async getActivityList() { + + try { + + const res = await getActivityReportList(this.query); + this.loading = false; + if (res.statusCode === 200) { + const newData = res.data.data.map(value => ({ + id: value.id, + type: value.coverType, + cover: value.cover, + height: value.coverType === '鍥剧墖' ? this.baseImageHeight : + value.coverType === '瑙嗛' ? this.baseVideoHeight : this.baseTextHeight, + title: value.activityName, + content: value.activityContent, + poster: '', + })); + + // 鏇存柊鎬绘暟鎹噺 + this.total = res.data.total || 0; + + // 杩藉姞鎴栨浛鎹㈡暟鎹� + this.mockData = this.query.pageNumber === 1 + ? newData + : [...this.mockData, ...newData]; + + // 鍒ゆ柇鏄惁杩樻湁鏇村鏁版嵁 + this.noMore = newData.length < this.query.pageSize || + this.mockData.length >= this.total; + + // 甯冨眬鏇存柊 + this.$nextTick(() => { + this.layoutItems(); + }); + } + } catch (error) { + console.error('鍔犺浇澶辫触:', error); + // 澶辫触鏃跺洖閫�椤电爜 + if (this.query.pageNumber > 1) { + this.query.pageNumber -= 1; + } + } finally { + this.loading = false; + uni.hideLoading(); + uni.stopPullDownRefresh(); + } + }, + // 鍥剧墖鍔犺浇瀹屾垚鍥炶皟 + layoutItems() { + this.columns = [ + [], + [] + ]; + this.colHeight = [0, 0]; + + this.mockData.forEach(item => { + const minIndex = this.colHeight.indexOf(Math.min(...this.colHeight)); + this.columns[minIndex].push(item); //鑾峰緱楂樺害鏇村皬鐨� 鏀惧叆鍏冪礌 + this.colHeight[minIndex] += item.height + 40; // 40涓洪棿璺� + }); + }, + // 鍥剧墖鍔犺浇鍥炶皟 + imageLoad(e) { + const { + height, + width + } = e.detail; + const ratio = height / width; + const item = e.currentTarget.dataset.item; + + // 閲嶆柊璁$畻瀹為檯鏄剧ず楂樺害 + const viewWidth = uni.upx2px(345); // 灏唕px杞崲涓簆x + const viewHeight = viewWidth * ratio; + + // 鏇存柊item楂樺害 + item.height = viewHeight; + + // 閲嶆柊璁$畻鍒楅珮搴� + this.recalculateColumns(); + }, + // 閲嶆柊璁$畻鍒楅珮搴� + recalculateColumns() { + this.colHeight = [0, 0]; + this.columns.forEach((column, colIndex) => { + column.forEach(item => { + this.colHeight[colIndex] += item.height + 40; // 40涓洪棿璺� + }); + }); + }, + handleItemClick(item) { + console.log(item) + uni.navigateTo({ + url: `/pages/mine/activity/detail?id=${item.id}` // 鍙傛暟閫氳繃 URL 浼犻�� + }); + } + } + } +</script> + +<style lang="scss"> + /* 鏂板鍔犺浇鏇村鏍峰紡 */ + .load-more { + padding: 20rpx 0; + text-align: center; + color: #999; + font-size: 26rpx; + background-color: #f7f8fa; + } + .btn-container { + display: flex; + justify-content: center; + align-items: center; + margin-top: 8px; + /* 涓庝笂鏂规爣棰樹繚鎸侀棿璺� */ + } + + /* 鍏ㄥ眬鏍峰紡浼樺寲 */ + .wrapper { + height: 100vh; + display: flex; + flex-direction: column; + background-color: #f7f8fa; + } + + /* 瀵艰埅鏍忎紭鍖� */ + .u-navbar { + box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); + } + + /* 鍐呭鍖哄煙浼樺寲 */ + .content { + flex: 1; + overflow: hidden; + padding: 0 20rpx; + box-sizing: border-box; + /* 纭繚鍙互婊氬姩 */ + -webkit-overflow-scrolling: touch; + } + + /* 鐎戝竷娴佸竷灞�浼樺寲 */ + .waterfall { + display: flex; + padding: 20rpx 0; + gap: 20rpx; + } + + .column { + flex: 1; + display: flex; + flex-direction: column; + gap: 20rpx; + } + + /* 鍗$墖椤逛紭鍖� */ + .item { + background: #fff; + border-radius: 16rpx; + overflow: hidden; + box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08); + transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); + + &:active { + transform: scale(0.98); + box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.12); + } + } + + /* 濯掍綋鍐呭鏍峰紡 */ + .media { + width: 100%; + display: block; + border-radius: 16rpx 16rpx 0 0; + background-color: #f5f5f5; + + &[mode="widthFix"] { + height: auto; + } + } + + /* 瑙嗛鐗规畩鏍峰紡 */ + video.media { + object-fit: cover; + } + + /* 鏂囧瓧鍐呭鏍峰紡 */ + .text-content { + padding: 24rpx; + background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); + min-height: 160rpx; + display: flex; + align-items: center; + justify-content: center; + + .title { + color: #fff; + font-size: 32rpx; + font-weight: 500; + line-height: 1.4; + text-align: center; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; + overflow: hidden; + } + } + + /* 鏍囬鏍峰紡浼樺寲 */ + .title { + padding: 20rpx 24rpx; + font-size: 28rpx; + color: #333; + line-height: 1.5; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + font-weight: 500; + + &:not(.text-content .title) { + border-top: 1rpx solid #f0f0f0; + } + } + + /* 鍔犺浇鍔ㄧ敾 */ + @keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(20rpx); + } + + to { + opacity: 1; + transform: translateY(0); + } + } + + .item { + animation: fadeInUp 0.4s ease forwards; + opacity: 0; + + @for $i from 1 through 10 { + &:nth-child(#{$i}) { + animation-delay: $i * 0.05s; + } + } + } + + /* 绌虹姸鎬佹牱寮� */ + .empty-state { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 60vh; + text-align: center; + + image { + width: 240rpx; + opacity: 0.6; + margin-bottom: 30rpx; + } + + text { + color: #c0c4cc; + font-size: 28rpx; + } + } +</style> \ No newline at end of file diff --git a/pages/mine/myCollect/myCollect.vue b/pages/mine/myCollect/myCollect.vue new file mode 100644 index 0000000..7251419 --- /dev/null +++ b/pages/mine/myCollect/myCollect.vue @@ -0,0 +1,595 @@ +<template> + + <view class="activity-container"> + <!-- 椤堕儴 Tab 瀵艰埅 --> + <view class="tab-nav"> + <view v-for="(tab, index) in tabs" :key="index" class="tab-item" :class="{active: currentTab === index}" + @click="switchTab(index)"> + {{tab}} + </view> + </view> + + <!-- 瑙嗛鍒楄〃 --> + <view class="activity-list"> + <view v-if="currentTab === 0"> + <scroll-view scroll-y class="activity-list" style="height: 100vh;" @scrolltolower="loadMore" + :lower-threshold="100"> + <view v-if="videoCollects.length > 0"> + <view v-for="(item, idx) in videoCollects" :key="idx" class="video-item"> + <!-- 瑙嗛灏侀潰+鎾斁鎸夐挳 --> + <view class="video-cover-container"> + <image :src="item.coverUrl" mode="aspectFill" class="video-cover" /> + <view class="play-icon"> + <u-icon name="play-circle-fill" size="60" color="#fff"></u-icon> + </view> + <view class="video-duration" v-if="item.duration">{{ item.duration }}</view> + </view> + + <!-- 瑙嗛淇℃伅 --> + <view class="video-info"> + <view class="video-title">{{ item.authorName || '鏈煡浣滆��' }}</view> + <view class="video-meta"> + <text class="video-weight" v-if="item.weight > 0"> + <u-icon name="thumb-up-fill" size="24" color="#999"></u-icon> + {{ item.weight }} + </text> + </view> + </view> + + <!-- 鎿嶄綔鎸夐挳 --> + <view class="video-actions"> + <button class="cancel-btn" @click.stop="handleCancelCollection(item,'video')"> + 鍙栨秷鏀惰棌 + </button> + </view> + </view> + </view> + <view v-else class="empty-tip"> + <text>鏆傛棤鏀惰棌瑙嗛</text> + </view> + <view class="load-more"> + <u-loadmore v-if="videoCollects.length > 0" + :status="loading ? 'loading' : noMore ? 'nomore' : 'loadmore'" :load-text="{ + loadmore: '涓婃媺鍔犺浇鏇村', + loading: '姝e湪鍔犺浇', + nomore: '娌℃湁鏇村浜�' + }" /> + </view> + </scroll-view> + + + + </view> + + <view v-if="currentTab === 1"> + <scroll-view scroll-y class="activity-list" style="height: 100vh;" @scrolltolower="loadMore" + :lower-threshold="100"> + <view v-if="goodsCollects.length > 0"> + <view v-for="(item, idx) in goodsCollects" :key="idx" class="activity-item"> + <!-- 灏侀潰鍖哄煙 --> + <block> + <image :src="item.original" mode="aspectFill" class="activity-cover" /> + </block> + + <!-- 娲诲姩淇℃伅 --> + <view class="activity-info"> + <view class="activity-title">{{ item.goodsName }}</view> + <view class="activity-meta"> + <text class="activity-time">浠锋牸:{{ item.price }}鍏�</text> + <text class="activity-location">{{ item.storeName || '鏆傛棤' }}</text> + </view> + </view> + + <!-- 鎿嶄綔鍖哄煙 --> + <view class="action-container"> + <button class="cancel-btn" @click="handleCancelCollection(item,'goods')" + hover-class="cancel-btn-hover"> + 鍙栨秷鏀惰棌 + </button> + </view> + + </view> + </view> + <view v-else class="empty-tip"> + + <text>鏆傛棤鏀惰棌鍟嗗搧</text> + </view> + <view class="load-more"> + <u-loadmore v-if="goodsCollects.length > 0" + :status="loading ? 'loading' : noMore ? 'nomore' : 'loadmore'" :load-text="{ + loadmore: '涓婃媺鍔犺浇鏇村', + loading: '姝e湪鍔犺浇', + nomore: '娌℃湁鏇村浜�' + }" /> + </view> + </scroll-view> + </view> + + <view v-if="currentTab === 2"> + <scroll-view scroll-y class="activity-list" style="height: 80vh;" @scrolltolower="loadMore" + :lower-threshold="100"> + <view v-if="activityCollects.length > 0"> + <view v-for="(item, idx) in activityCollects" :key="idx" class="activity-item"> + <!-- 灏侀潰鍖哄煙 --> + <block v-if="item.coverType === '鍥剧墖' || item.coverType === '瑙嗛'"> + <image :src="item.cover" mode="aspectFill" class="activity-cover" /> + </block> + <block v-if="item.coverType === '鏂囧瓧'"> + <view class="activity-cover text-cover">{{ item.cover }}</view> + </block> + <!-- 娲诲姩淇℃伅 --> + <view class="activity-info"> + <view class="activity-title">{{ item.activityName }}</view> + <view class="activity-meta"> + <text class="activity-time">{{ item.startTime }}</text> + <text class="activity-time"> {{ item.endTime }}</text> + <text class="activity-location">{{ item.activityLocation || '鏆傛棤' }}</text> + </view> + </view> + <!-- 鎿嶄綔鍖哄煙 --> + <view class="action-container"> + <button class="cancel-btn" @click="handleCancelCollection(item,'activity')" + hover-class="cancel-btn-hover"> + 鍙栨秷鏀惰棌 + </button> + </view> + + </view> + + + </view> + <view v-else class="empty-tip"> + <text>鏆傛棤鏀惰棌娲诲姩</text> + </view> + <view class="load-more"> + <u-loadmore v-if="activityCollects.length > 0" + :status="loading ? 'loading' : noMore ? 'nomore' : 'loadmore'" :load-text="{ + loadmore: '涓婃媺鍔犺浇鏇村', + loading: '姝e湪鍔犺浇', + nomore: '娌℃湁鏇村浜�' + }" /> + </view> + <view style="height: 150rpx"></view> + </scroll-view> + + </view> + + + + </view> + + + </view> + +</template> + +<script> + import ULoadmore from '@/uview-components/uview-ui/components/u-loadmore/u-loadmore.vue' + import UImage from '@/uview-components/uview-ui/components/u-image/u-image.vue'; + import { + getFilePreviewUrl + } from '@/api/common.js' + import { + changeCollect, + getMyCollectList + } from '@/api/collect.js' + import { + ifError + } from 'assert' + export default { + components: { + UImage, + ULoadmore + }, + data() { + return { + total: 0, + loading: false, + noMore: { + video: false, + goods: false, + activity: false + }, + currentTab: 0, // 褰撳墠閫変腑鐨則ab绱㈠紩 + tabs: ['瑙嗛', '鍟嗗搧', '娲诲姩'], + // + videoCollects: [], // 鏀惰棌瑙嗛鍒楄〃 + goodsCollects: [], // 鏀惰棌鍟嗗搧鍒楄〃 + activityCollects: [], // 鏀惰棌娲诲姩鍒楄〃 + collectForm: { + collectType: '', + refId: '', + }, + query: { + type: 'video', + pageNumber: 1, + pageSize: 5, + } + } + }, + onLoad() { + this.currentTab = 0; + //TODO 鏈櫥褰曢渶瑕乮d锛屾祴璇曠敤鍐欐\ + this.getintit() + }, + methods: { + + /** + * 涓嬫媺鍒锋柊鏃� + */ + onPullDownRefresh() { + this.currentTab = 0; + this.query.pageNumber = 1; // 閲嶇疆椤电爜 + this.noMore = false; + this.videoCollects = []; + this.goodsCollects = []; // 鏀惰棌鍟嗗搧鍒楄〃 + this.activityCollects = []; // 鏀惰棌娲诲姩鍒楄〃// 娓呯┖鏁版嵁 + this.getintit(); + }, + loadMore() { + this.loading = true; + this.query.pageNumber += 1; + // 寤惰繜鎵ц璁︰I鏈夊弽搴旀椂闂� + setTimeout(() => { + this.query.pageNumber += 1; + this.getintit(); + }, 300); + }, + handleCancelCollection(item, type) { + console.log(item) + this.collectForm.collectType = type; + this.collectForm.refId = item.id; + changeCollect(this.collectForm).then(res => { + if (res.statusCode === 200) { + uni.showToast({ + title: res.data.msg, // 鎻愮ず鏂囧瓧 + icon: 'none', // 鍥炬爣绫诲瀷锛坰uccess/loading/none锛� + mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛堥槻姝㈣Е鎽哥┛閫忥級 + }); + this.getintit(); + } + + }) + }, + getUrl(params) { + getFilePreviewUrl(params).then(res => { + return res.data.data + }) + }, + // 鍒囨崲tab + switchTab(index) { + if (this.currentTab !== index) { + this.currentTab = index + //鍒囨崲鏃堕〉鐮佸綊0 + this.query.pageNumber = 0; + // 娓呯┖鏁版嵁 + this.videoCollects = []; + this.goodsCollects = []; + this.activityCollects = []; + // 瀹為檯椤圭洰涓彲浠ュ湪杩欓噷娣诲姞鍔犺浇鏁版嵁鐨勯�昏緫 + this.getintit() + } + }, + async getintit() { + uni.showLoading({ + title: '鍔犺浇涓�' + }); + if (this.currentTab === 0) { + this.query.type = 'video'; + getMyCollectList(this.query).then(res => { + uni.hideLoading(); + this.loading = false; + + if (res.statusCode === 200) { + const newData = res.data.data + this.total = res.data.total || 0; + // 杩藉姞鎴栨浛鎹㈡暟鎹� + this.videoCollects = this.query.pageNumber === 1 ? + newData : + [...this.videoCollects, ...newData]; + // 鍒ゆ柇鏄惁杩樻湁鏇村鏁版嵁 + this.noMore = newData.length < this.query.pageSize || + this.videoCollects.length >= this.total; + + } + }) + } else if (this.currentTab === 1) { + this.query.type = 'goods'; + getMyCollectList(this.query).then(res => { + uni.hideLoading(); + this.loading = false; + if (res.statusCode === 200) { + const newData = res.data.data + this.total = res.data.total || 0; + + this.goodsCollects = this.query.pageNumber === 1 ? + newData : + [...this.goodsCollects, ...newData]; + // 鍒ゆ柇鏄惁杩樻湁鏇村鏁版嵁 + this.noMore = newData.length < this.query.pageSize || + this.goodsCollects.length >= this.total; + } + }) + } else if (this.currentTab === 2) { + this.query.type = 'activity'; + getMyCollectList(this.query).then(res => { + uni.hideLoading(); + this.loading = false; + if (res.statusCode === 200) { + const newData = res.data.data + this.total = res.data.total || 0; + + this.activityCollects = this.query.pageNumber === 1 ? + newData : + [...this.activityCollects, ...newData]; + this.noMore = newData.length < this.query.pageSize || + this.activityCollects.length >= this.total; + } + }) + } + + } + } + } +</script> + +<style lang="scss"> + .text-cover { + display: flex; + align-items: center; + justify-content: center; + background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); + color: #fff; + font-size: 28rpx; + padding: 16rpx; + line-height: 1.4; + } + + /* 瑙嗛鍒楄〃涓撶敤鏍峰紡 */ + .video-item { + display: flex; + padding: 24rpx 0; + border-bottom: 1rpx solid #f5f5f5; + align-items: center; + + &:last-child { + border-bottom: none; + } + } + + .video-cover-container { + position: relative; + width: 240rpx; + height: 160rpx; + border-radius: 12rpx; + overflow: hidden; + margin-right: 24rpx; + flex-shrink: 0; + + .video-cover { + width: 100%; + height: 100%; + } + + .play-icon { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + opacity: 0.9; + } + + .video-duration { + position: absolute; + right: 8rpx; + bottom: 8rpx; + background: rgba(0, 0, 0, 0.6); + color: #fff; + font-size: 20rpx; + padding: 4rpx 12rpx; + border-radius: 20rpx; + } + } + + .video-info { + flex: 1; + display: flex; + flex-direction: column; + justify-content: space-between; + height: 160rpx; + + .video-title { + font-size: 30rpx; + color: #333; + font-weight: bold; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + } + + .video-meta { + display: flex; + justify-content: space-between; + font-size: 24rpx; + color: #999; + + + + .video-weight { + display: flex; + align-items: center; + } + } + } + + .video-actions { + margin-left: 20rpx; + flex-shrink: 0; + + .cancel-btn { + background: #f5f5f5; + color: #666; + border: none; + font-size: 24rpx; + padding: 8rpx 20rpx; + border-radius: 20rpx; + + &:active { + background: #eee; + } + } + } + + .empty-tip { + text-align: center; + padding: 100rpx 0; + + image { + width: 300rpx; + margin-bottom: 30rpx; + opacity: 0.6; + } + + text { + display: block; + font-size: 28rpx; + color: #999; + } + } + + .activity-container { + padding: 20rpx; + background-color: #f5f5f5; + min-height: 100vh; + } + + /* Tab 瀵艰埅鏍峰紡 */ + .tab-nav { + display: flex; + background-color: #fff; + border-radius: 12rpx; + margin-bottom: 20rpx; + box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05); + } + + .tab-item { + flex: 1; + text-align: center; + padding: 24rpx 0; + font-size: 28rpx; + color: #666; + position: relative; + + &.active { + color: #007AFF; + font-weight: bold; + + &::after { + content: ''; + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + width: 80rpx; + height: 6rpx; + background-color: #007AFF; + border-radius: 3rpx; + } + } + } + + /* 娲诲姩鍒楄〃鏍峰紡 */ + .activity-list { + background-color: #fff; + border-radius: 12rpx; + padding: 20rpx; + box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05); + } + + .activity-item { + display: flex; + padding: 20rpx 0; + border-bottom: 1rpx solid #eee; + + &:last-child { + border-bottom: none; + } + } + + .activity-cover { + width: 200rpx; + height: 140rpx; + border-radius: 8rpx; + margin-right: 20rpx; + } + + .activity-info { + flex: 1; + position: relative; + } + + .activity-title { + font-size: 32rpx; + color: #333; + font-weight: bold; + margin-bottom: 12rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + } + + .activity-meta { + font-size: 24rpx; + color: #999; + margin-bottom: 16rpx; + + text { + display: block; + margin-bottom: 8rpx; + } + } + + .activity-status { + position: absolute; + right: 0; + top: 0; + font-size: 24rpx; + padding: 4rpx 12rpx; + border-radius: 20rpx; + + &.signed { + color: #007AFF; + background-color: rgba(0, 122, 255, 0.1); + } + + &.ended { + color: #999; + background-color: rgba(153, 153, 153, 0.1); + } + + &.canceled { + color: #ff3b30; + background-color: rgba(255, 59, 48, 0.1); + } + } + + /* 绌虹姸鎬佹彁绀� */ + .empty-tip { + text-align: center; + padding: 100rpx 0; + + image { + width: 300rpx; + margin-bottom: 30rpx; + opacity: 0.6; + } + + text { + display: block; + font-size: 28rpx; + color: #999; + } + } +</style> \ No newline at end of file diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue index e65155f..9ba0f38 100644 --- a/pages/tabbar/index/home.vue +++ b/pages/tabbar/index/home.vue @@ -25,13 +25,39 @@ :controls="false" :loop="true" :object-fit="item.objectFit" + :enable-progress-gesture="false" class="video-item" @play="onPlay(item.id, index)" @pause="onPause(index)" @ended="onEnded(index)" @click="togglePlay(index)" @timeupdate="onTimeUpdate($event)" + @loadedmetadata="onLoadedMetadata($event)" + ></video> + <!-- 鑷畾涔夋帶鍒舵潯 --> + <view + @touchstart="handleTouchStart" + @touchmove="handleTouchMove" + @touchend="handleTouchEnd" + class="container"> + <!-- 杩涘害鏉� - 鏁翠釜鍖哄煙鍙嫋鍔� --> + <view class="process-warp" :style="{ opacity: showProcess ? 1 : 0 }"> + <!-- 鏄剧ず褰撳墠杩涘害 --> + <view class="progress-text">{{ hasPlayTime }}/{{formartDuration}}</view> + <view + class="progress-bar" + id="progressBar" + > + + <!-- 宸插~鍏呴儴鍒� --> + <view class="progress-fill" :style="{ width: progress + '%' }"></view> + </view> + </view> + + + + </view> <!-- 鎮寕鍟嗗搧閾炬帴灞� --> <view class="goods-link-warp"> @@ -181,8 +207,24 @@ import { getRecommendVideos, savePlayRecord, subscribe, getVideoComments, addVideoComment, thubmsUpComment, cancelThubmsUpComment } from "@/api/video.js"; import { changeCollect } from "@/api/collect.js"; export default { + computed: { + hasPlayTime() { + return this.sliderFormatTime(this.progress > 0 ? this.duration * this.progress / 100 : 0); + } + }, data() { return { + currentTime: 0, + formartDuration: '', + duration: 0, + startX: 0, + progress: 0, // 瑙嗛杩涘害 + startProgress : 0, // 寮�濮嬫粦鍔ㄦ椂鐨勮繘搴� + barLeft: 0, // 杩涘害鏉″乏杈圭晫浣嶇疆 + barWidth: 0, // 杩涘害鏉″搴� + isDragging: false, // 鏄惁姝e湪鎷栧姩 + processHidenTimer: null, // 杩涘害鏉¢殣钘忓畾鏃跺櫒 + showProcess: false, // 鏄惁鏄剧ず杩涘害鏉� videoNoMore: false, // 鏄惁杩樻湁鏇村瑙嗛 commentNoMore: false, // 鏄惁杩樻湁鏇村璇勮 commentQuery: { @@ -255,6 +297,16 @@ this.initVideoContexts(); }, methods: { + // 鑾峰彇杩涘害鏉$殑浣嶇疆鍜屽昂瀵� + getBarRect() { + const query = uni.createSelectorQuery().in(this); + query.select('#progressBar').boundingClientRect(rect => { + if (rect) { + this.barLeft = rect.left; + this.barWidth = rect.width; + } + }).exec(); + }, // 璺宠浆涓汉涓婚〉 jumpToHomePage(authorId) { uni.navigateTo({ @@ -351,6 +403,12 @@ const input = this.$refs.commentInput; if (input) input.focus(); }); + }, + // 杩涘害鏉℃椂闂存牸寮忓寲 (00:00) + sliderFormatTime(seconds) { + const mins = Math.floor(seconds / 60); + const secs = Math.floor(seconds % 60); + return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`; }, // 鏍煎紡鍖栨椂闂� formatTime(time) { @@ -584,6 +642,8 @@ }, // 瑙嗛鎾斁浜嬩欢 onPlay(id, index) { + this.getBarRect() + this.progress = 0 console.log(id, index, "瑙﹀彂鎾斁"); if(index === this.currentIndex) { this.currentVideoIsPlaying = true; @@ -613,7 +673,6 @@ } this.startPauseTime = Date.now() }, - // 瑙嗛缁撴潫浜嬩欢 onEnded(index) { // this.currentVideoIsPlaying = false; @@ -621,9 +680,66 @@ // 璁板綍鎾斁鏃堕暱 onTimeUpdate(e) { - this.playRecord.playAt = e.detail.currentTime + this.playRecord.playAt = e.detail.currentTime; + + this.currentTime = e.detail.currentTime; + this.progress = (e.detail.currentTime / this.duration) * 100 + }, + // 瑙︽懜寮�濮� + handleTouchStart(e) { + this.isDragging = true; + this.showProcess = true; + this.startProgress = this.progress; // 璁板綍寮�濮嬫椂鐨勮繘搴� + this.startX = e.touches[0].pageX; + console.log("璁板綍寮�濮嬫椂鐨勮繘搴�", this.startProgress); + this.videoContexts[this.currentIndex].pause() + // this.updateProgress(e); }, + // 瑙︽懜绉诲姩 + handleTouchMove(e) { + if (!this.isDragging || !this.barWidth) return; + clearTimeout(this.processHidenTimer) + this.videoContexts[this.currentIndex].pause() + this.updateProgress(e); + }, + + // 瑙︽懜缁撴潫 + handleTouchEnd() { + this.isDragging = false; + console.log("婊戝姩缁撴潫", this.duration * this.progress); + this.videoContexts[this.currentIndex].seek(this.duration * this.progress / 100) + this.videoContexts[this.currentIndex].play() + this.processHidenTimer = setTimeout(() => { + this.showProcess = false; + }, 1000); + }, + + // 鏇存柊杩涘害 + updateProgress(e) { + // 鑾峰彇褰撳墠瑙︽懜鐐筙鍧愭爣 + const currentX = e.touches[0].pageX; + + // 璁$畻婊戝姩璺濈(鍍忕礌) + const deltaX = currentX - this.startX; + + // 灏嗗儚绱犺窛绂昏浆鎹负杩涘害澧為噺 + const deltaProgress = (deltaX / this.barWidth) * 100; + console.log("杩涘害澧為噺", deltaProgress); + // 璁$畻鏂拌繘搴� = 寮�濮嬫椂鐨勮繘搴� + 婊戝姩澧為噺 + let newProgress = this.startProgress + deltaProgress; + + // 闄愬埗鑼冨洿鍦�0-100涔嬮棿 + newProgress = Math.max(0, Math.min(100, newProgress)); + + this.progress = newProgress; + }, + // 鑾峰彇瑙嗛鎬绘椂闀� + onLoadedMetadata(e) { + this.duration = e.detail.duration; + this.formartDuration = this.sliderFormatTime(this.duration); + console.log("瑙嗛鎬绘椂闀�", this.duration); + }, // 淇濆瓨鎾斁璁板綍 async savePlayRecord() { console.log(Date.now(), this.playRecord.startPlayTime, this.totalHidenTime); @@ -659,7 +775,7 @@ .video-swiper { width: 100%; - height: 100%; + height: calc(100% - 50px); } .video-item { @@ -1015,4 +1131,40 @@ .thumbs-num { margin-left: 4rpx; } + .container { + display: flex; + flex-direction: column; + align-items: center; + position: absolute; + bottom: 0; + width: 100%; + } + + .progress-bar { + position: relative; + width: 100%; + height: 16px; + background-color: #eee; + overflow: hidden; + } + + .progress-fill { + position: absolute; + left: 0; + top: 0; + height: 100%; + background-color: lightgray; + transition: width 0.1s; + } + .process-warp { + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + } + .progress-text { + margin-top: 10px; + font-size: 14px; + color: #666; + } </style> \ No newline at end of file diff --git a/pages/tabbar/user/utils/tool.vue b/pages/tabbar/user/utils/tool.vue index 447b221..21aa150 100644 --- a/pages/tabbar/user/utils/tool.vue +++ b/pages/tabbar/user/utils/tool.vue @@ -1,239 +1,275 @@ <template> - <view> - <!-- 甯哥敤宸ュ叿 --> - <view class="interact-tools" style="margin-bottom: 15px"> + <view> + <!-- 甯哥敤宸ュ叿 --> + <view class="interact-tools" style="margin-bottom: 15px"> - <div class="paddingBox"> - <view class="interact-container"> - <view class="interact-item" @click="navigateTo('/pages/mine/address/addressManage')"> - <image src="/static/mine/myaddress.png" mode=""></image> - <view>鍦板潃绠$悊</view> - </view> - - <view class="interact-item" @click="navigateTo('/pages/mine/myTracks')"> - <image src="/static/mine/logistics.png" mode=""></image> - <view>鎴戠殑瓒宠抗</view> - </view> - - <view class="interact-item" @click="navigateTo('/pages/order/evaluate/myEvaluate')"> - <image src="/static/mine/feedback.png" mode=""></image> - <view>鎴戠殑璇勪环</view> - </view> - <!-- <view class="interact-item" @click="linkMsgDetail()"> + <div class="paddingBox"> + <view class="interact-container"> + <view class="interact-item" @click="navigateTo('/pages/mine/address/addressManage')"> + <image src="/static/mine/myaddress.png" mode=""></image> + <view>鍦板潃绠$悊</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/mine/myTracks')"> + <image src="/static/mine/logistics.png" mode=""></image> + <view>鎴戠殑瓒宠抗</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/order/evaluate/myEvaluate')"> + <image src="/static/mine/feedback.png" mode=""></image> + <view>鎴戠殑璇勪环</view> + </view> + <!-- <view class="interact-item" @click="linkMsgDetail()"> <image src="/static/mine/mycommit.png" mode=""></image> <view>鎴戠殑娑堟伅</view> </view> --> - - - <view class="interact-item" @click="navigateTo('/pages/mine/myCollect')"> - <image src="/static/mine/myfavorite.png" mode=""></image> - <view>鎴戠殑鍏虫敞</view> - </view> - - - - <view class="interact-item" @click="navigateTo('/pages/mine/point/myPoint')"> - <image src="/static/mine/mypoint.png" mode=""></image> - <view>鎴戠殑绉垎</view> - </view> - - <view class="interact-item" @click="distribution"> + + + <view class="interact-item" @click="navigateTo('/pages/mine/myCollect')"> + <image src="/static/mine/myfavorite.png" mode=""></image> + <view>鎴戠殑鍏虫敞</view> + </view> + + + + <view class="interact-item" @click="navigateTo('/pages/mine/point/myPoint')"> + <image src="/static/mine/mypoint.png" mode=""></image> + <view>鎴戠殑绉垎</view> + </view> + + <!-- <view class="interact-item" @click="distribution"> <image src="/static/mine/distribution.png" mode=""></image> <view>鎴戠殑鍒嗛攢</view> - </view> - - - - <view class="interact-item" @click="navigateTo('/pages/order/complain/complainList')"> - <image src="/static/mine/shensu.png" mode=""></image> - <view>鎴戠殑鎶曡瘔</view> - </view> - - <view class="interact-item" @click="navigateTo('/pages/cart/coupon/myCoupon')"> - <image src="/static/mine/mycoupon.png" mode=""></image> - <view>浼樻儬鍒�</view> - </view> - - - - - <view class="interact-item" @click="navigateTo('/pages/mine/signIn')"> - <image src="/static/mine/sign.png" mode=""></image> - <view>姣忔棩绛惧埌</view> - </view> - - - - + </view> --> - - <view class="interact-item" @click="navigateTo('/pages/cart/coupon/couponCenter')"> - <image src="/static/mine/couponcenter.png" mode=""></image> - <view>棰嗗埜涓績</view> - </view> - - - - <view class="interact-item" @click="navigateTo('/pages/promotion/bargain/log')"> - <image src="/static/mine/kanjia.png" mode=""></image> - <view>鐮嶄环璁板綍</view> - </view> - - - - <view class="interact-item" @click="navigateTo('/pages/mine/set/feedBack')"> - <image src="/static/mine/feedback.png" mode=""></image> - <view>鎰忚鍙嶉</view> - </view> - - <view class="interact-item" @click="navigateTo('/pages/mine/set/editionIntro')"> - <image src="/static/mine/pointgift.png" mode=""></image> - <view>鍏充簬</view> - </view> - - <view class="interact-item" @click="navigateTo('/pages/passport/entry/seller/index')"> - <image src="/static/mine/feedback.png" mode=""></image> - <view>搴楅摵鍏ラ┗</view> - </view> - - - <view class="interact-item" @click="navigateTo('/pages/mine/set/setUp')"> - <image src="/static/mine/setting.png" mode=""></image> - <view>璁剧疆</view> - </view> - <view class="interact-item" @click="navigateTo('/pages/goods-manager/goodsList/goodsList')"> - <image src="/static/mine/setting.png" mode=""></image> - <view>鍟嗗搧绠$悊</view> - </view> - - - </view> - </div> - </view> - </view> + <view class="interact-item" @click="navigateTo('/pages/mine/myCollect')"> + <image src="/static/mine/shensu.png" mode=""></image> + <view>鎴戠殑鏀惰棌</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/mine/activity/myActivity')"> + <image src="/static/mine/shensu.png" mode=""></image> + <view>鎴戠殑娲诲姩</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/mine/activity/reportActivity')"> + <image src="/static/mine/shensu.png" mode=""></image> + <view>娲诲姩</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/mine/myCollect/myCollect')"> + <image src="/static/mine/shensu.png" mode=""></image> + <view>鎴戠殑鏀惰棌</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/userPermissions/userPermissions')"> + <image src="/static/mine/shensu.png" mode=""></image> + <view>鐢ㄦ埛鏉冮檺</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/customerManager/customerManager')"> + <image src="/static/mine/shensu.png" mode=""></image> + <view>瀹㈡埛绠$悊</view> + </view> + <view class="interact-item" @click="navigateTo('/pages/order/complain/complainList')"> + <image src="/static/mine/shensu.png" mode=""></image> + <view>鎴戠殑鎶曡瘔</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/cart/coupon/myCoupon')"> + <image src="/static/mine/mycoupon.png" mode=""></image> + <view>浼樻儬鍒�</view> + </view> + + + + + <view class="interact-item" @click="navigateTo('/pages/mine/signIn')"> + <image src="/static/mine/sign.png" mode=""></image> + <view>姣忔棩绛惧埌</view> + </view> + + + + + + + <view class="interact-item" @click="navigateTo('/pages/cart/coupon/couponCenter')"> + <image src="/static/mine/couponcenter.png" mode=""></image> + <view>棰嗗埜涓績</view> + </view> + + + + <view class="interact-item" @click="navigateTo('/pages/promotion/bargain/log')"> + <image src="/static/mine/kanjia.png" mode=""></image> + <view>鐮嶄环璁板綍</view> + </view> + + + + <view class="interact-item" @click="navigateTo('/pages/mine/set/feedBack')"> + <image src="/static/mine/feedback.png" mode=""></image> + <view>鎰忚鍙嶉</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/mine/set/editionIntro')"> + <image src="/static/mine/pointgift.png" mode=""></image> + <view>鍏充簬</view> + </view> + + <view class="interact-item" @click="navigateTo('/pages/passport/entry/seller/index')"> + <image src="/static/mine/feedback.png" mode=""></image> + <view>搴楅摵鍏ラ┗</view> + </view> + + + <view class="interact-item" @click="navigateTo('/pages/mine/set/setUp')"> + <image src="/static/mine/setting.png" mode=""></image> + <view>璁剧疆</view> + </view> + <view class="interact-item" @click="navigateTo('/pages/goods-manager/goodsList/goodsList')"> + <image src="/static/mine/setting.png" mode=""></image> + <view>鍟嗗搧绠$悊</view> + </view> + + + </view> + </div> + </view> + </view> </template> <script> -import { distribution } from "@/api/goods"; -import configs from "@/config/config"; -import storage from "@/utils/storage"; + import { + distribution + } from "@/api/goods"; + import configs from "@/config/config"; + import storage from "@/utils/storage"; -export default { - data() { - return { - configs, - storage - } - }, - - methods: { - handleNavigate(url) { - uni.navigateTo({ - url, - }); + export default { + data() { + return { + configs, + storage + } }, - navigateTo(url) { - const ignores = [ - '/pages/mine/set/setUp', - '/pages/mine/set/editionIntro', - '/pages/mine/set/feedBack', - '/pages/goods-manager/goodsList/goodsList' - ] - if (!ignores.includes(url)) { - if (this.$options.filters.tipsToLogin('normal')) { + + methods: { + handleNavigate(url) { + uni.navigateTo({ + url, + }); + }, + navigateTo(url) { + const ignores = [ + '/pages/mine/set/setUp', + '/pages/mine/set/editionIntro', + '/pages/mine/set/feedBack', + '/pages/goods-manager/goodsList/goodsList', + '/pages/mine/set/feedBack', + '/pages/mine/activity/myActivity', + '/pages/mine/myCollect/myCollect', + '/pages/mine/myCollect' + ] + if (!ignores.includes(url)) { + if (this.$options.filters.tipsToLogin('normal')) { + this.handleNavigate(url) + } + } else { this.handleNavigate(url) } - } - else { - this.handleNavigate(url) - } - }, - - linkMsgDetail(){ - uni.navigateTo({ - url: `/pages/mine/im/list`, - }); - }, - - distribution() { - distribution().then((res) => { - if (res.data.result) { - let type = res.data.result.distributionStatus; - if (type == "PASS") { - uni.navigateTo({ - url: "/pages/mine/distribution/home", - }); - } else if (type == "REFUSE") { - uni.navigateTo({ - url: "/pages/mine/distribution/auth", - }); - } else if (type == "RETREAT") { - uni.showToast({ - title: "鎮ㄧ殑鍒嗛攢璧勬牸宸茶娓呴��銆傝鑱旂郴绠$悊鍛橈紒", - duration: 2000, - icon: "none", - }); - } else { - uni.showToast({ - title: "鎮ㄧ殑淇℃伅姝e湪瀹℃牳", - duration: 2000, - icon: "none", - }); - } - } else if (!res.data.success && res.data.code == 22000) { - uni.showToast({ - title: "鍒嗛攢鍔熻兘鏆傛湭寮�鍚�", - duration: 2000, - icon: "none", - }); - } else { - // 娌℃湁璧勬牸鐢宠 鍏堝幓瀹炲悕璁よ瘉 - uni.navigateTo({ - url: "/pages/mine/distribution/auth", - }); - } - }); - }, - }, -}; + }, + + linkMsgDetail() { + uni.navigateTo({ + url: `/pages/mine/im/list`, + }); + }, + + distribution() { + distribution().then((res) => { + if (res.data.result) { + let type = res.data.result.distributionStatus; + if (type == "PASS") { + uni.navigateTo({ + url: "/pages/mine/distribution/home", + }); + } else if (type == "REFUSE") { + uni.navigateTo({ + url: "/pages/mine/distribution/auth", + }); + } else if (type == "RETREAT") { + uni.showToast({ + title: "鎮ㄧ殑鍒嗛攢璧勬牸宸茶娓呴��銆傝鑱旂郴绠$悊鍛橈紒", + duration: 2000, + icon: "none", + }); + } else { + uni.showToast({ + title: "鎮ㄧ殑淇℃伅姝e湪瀹℃牳", + duration: 2000, + icon: "none", + }); + } + } else if (!res.data.success && res.data.code == 22000) { + uni.showToast({ + title: "鍒嗛攢鍔熻兘鏆傛湭寮�鍚�", + duration: 2000, + icon: "none", + }); + } else { + // 娌℃湁璧勬牸鐢宠 鍏堝幓瀹炲悕璁よ瘉 + uni.navigateTo({ + url: "/pages/mine/distribution/auth", + }); + } + }); + }, + }, + }; </script> <style lang="scss" scoped> -.interact-tools { - border-left: none; - border-right: none; + .interact-tools { + border-left: none; + border-right: none; - .interactBox { - height: 156rpx; - } - .interact-container { - margin: 0 20rpx; - background: #fff; - border-radius: 20rpx; - box-shadow: 0 4rpx 24rpx 0 rgba($color: #f6f6f6, $alpha: 1); - .interact-item-img { - width: 52rpx !important; - height: 52rpx !important; - // margin-bottom: !important; - margin: 0 auto 6rpx auto !important; - } - image { - width: 52rpx; - height: 52rpx; - margin-bottom: 6rpx; - } - display: flex; - align-items: center; - flex-wrap: wrap; - text-align: center; + .interactBox { + height: 156rpx; + } - .interact-item { - font-size: $font-sm; - width: 25%; - height: 160rpx; - padding: 30rpx; - } - } -} -</style> + .interact-container { + margin: 0 20rpx; + background: #fff; + border-radius: 20rpx; + box-shadow: 0 4rpx 24rpx 0 rgba($color: #f6f6f6, $alpha: 1); + + .interact-item-img { + width: 52rpx !important; + height: 52rpx !important; + // margin-bottom: !important; + margin: 0 auto 6rpx auto !important; + } + + image { + width: 52rpx; + height: 52rpx; + margin-bottom: 6rpx; + } + + display: flex; + align-items: center; + flex-wrap: wrap; + text-align: center; + + .interact-item { + font-size: $font-sm; + width: 25%; + height: 160rpx; + padding: 30rpx; + } + } + } +</style> \ No newline at end of file diff --git a/pages/tabbar/video/video.vue b/pages/tabbar/video/video.vue index cc04f4e..18d38ae 100644 --- a/pages/tabbar/video/video.vue +++ b/pages/tabbar/video/video.vue @@ -207,6 +207,7 @@ formData: { id: '', title: '', + cover: '', videoFileKey: '', videoDuration: 0, videoFit: 'cover', @@ -519,6 +520,7 @@ id: '', title: '', videoFileKey: '', + cover: '', videoFit: 'cover', videoDuration: 0, goodsId: '', diff --git a/pages/userPermissions/addStoreMember.vue b/pages/userPermissions/addStoreMember.vue new file mode 100644 index 0000000..26c68da --- /dev/null +++ b/pages/userPermissions/addStoreMember.vue @@ -0,0 +1,287 @@ +<template> + <view class="add-user-container"> + <u-navbar :is-back="true" :title="title" title-color="#333" back-icon-color="#333"></u-navbar> + <!-- 琛ㄥ崟鍖哄煙 --> + <view class="form-card"> + <u-form :model="form" ref="uForm1" label-width="150rpx"> + + <!-- 鐪熷疄濮撳悕 --> + <u-form-item label="鐪熷疄濮撳悕" prop="realName" borderBottom required="true"> + <u-input v-model="form.realName" placeholder="璇疯緭鍏ョ湡瀹炲鍚�" border="none" /> + </u-form-item> + + <!-- 鐢佃瘽 --> + <u-form-item label="鐢佃瘽" prop="mobile" borderBottom required="true"> + <u-input v-model="form.mobile" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" border="none" type="number" /> + </u-form-item> + <!-- 瀵嗙爜 --> + <u-form-item label="瀵嗙爜" prop="password" borderBottom required="true" v-if="!form.id"> + <u-input v-model="form.password" placeholder="璇疯緭鍏ュ瘑鐮�" border="none" type="password" /> + </u-form-item> + + <!-- 瑙掕壊閫夋嫨 --> + <u-form-item label="瑙掕壊" prop="role" borderBottom required="true"> + <!-- 澶嶉�夋缁勶紝澧炲姞甯冨眬鍜岄棿璺� --> + <u-checkbox-group @change="checkboxGroupChange" class="checkbox-group"> + <u-checkbox @change="checkboxChange" v-model="item.checked" v-for="(item, index) in list" + :key="index" :name="item.name" class="custom-checkbox"> + <span class="checkbox-label">{{ item.name }}</span> + </u-checkbox> + + </u-checkbox-group> + <!-- 鍏ㄩ�夋寜閽紝澧炲姞闂磋窛鍜屾牱寮� --> + <!-- <u-button type="text" @click="checkedAll" class="select-all-btn"> + 鍏ㄩ�� + </u-button> --> + </u-form-item> + + </u-form> + + <!-- 鎻愪氦鎸夐挳 --> + <view class="submit-btn"> + <u-button type="primary" shape="circle" @click="submitForm()" :loading="loading">鎻愪氦</u-button> + </view> + </view> + </view> +</template> + +<script> + import { + add, + update, + getDetail + } from "@/api/userPermissions.js" + import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue'; + import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue'; + import UForm from '@/uview-components/uview-ui/components/u-form/u-form.vue'; + import UFormItem from '@/uview-components/uview-ui/components/u-form-item/u-form-item.vue'; + import UInput from '@/uview-components/uview-ui/components/u-input/u-input.vue'; + import USearch from '@/uview-components/uview-ui/components/u-search/u-search.vue'; + import UPopup from '@/uview-components/uview-ui/components/u-popup/u-popup.vue'; + import ULoading from '@/uview-components/uview-ui/components/u-loading/u-loading.vue'; + + import UCheckbox from '@/uview-components/uview-ui/components/u-checkbox/u-checkbox.vue'; + import UCheckboxGroup from '@/uview-components/uview-ui/components/u-checkbox-group/u-checkbox-group.vue'; + + export default { + components: { + UIcon, + UButton, + UForm, + UFormItem, + UInput, + USearch, + UPopup, + ULoading, + UCheckbox, + UCheckboxGroup + }, + data() { + return { + title: '', + // 琛ㄥ崟鏁版嵁 + form: { + id: '', + mobile: '', + realName: '', + password: '', + role: '', + oldPassword: '' + }, + + role: [], + // 鍔犺浇鐘舵�� + loading: false, + // 瑙掕壊閫夐」 + list: [{ + name: '绠$悊鍛�', + checked: false, + disabled: false + }, + { + name: '绠$悊鍛�2', + checked: false, + disabled: false + }, + { + name: '绠$悊鍛�3', + checked: false, + disabled: false + } + ], + + }; + }, + onLoad(options) { + // 鎺ユ敹 URL 鍙傛暟 + if (options.id) { + this.form.id = options.id; + // 鍙湪姝ゅ鍙戣捣璇锋眰锛屾牴鎹� ID 鍔犺浇璇︽儏鏁版嵁 + this.title = '淇敼鐢ㄦ埛'; + this.getDetail(); + } else { + this.title = '鏂板鐢ㄦ埛'; + } + }, + methods: { + //鑾峰緱璇︽儏 + getDetail() { + uni.showLoading({ + title: '鍔犺浇涓�' + }); + getDetail(this.form.id).then(res => { + uni.hideLoading(); + if (res.statusCode === 200) { + this.form.mobile = res.data.data.mobile; + this.form.realName = res.data.data.realName; + this.form.password = res.data.data.password; + // 瑙f瀽瑙掕壊鏁扮粍 + const roles = JSON.parse(res.data.data.role); + + // 鏇存柊澶嶉�夋閫変腑鐘舵�� + this.list = this.list.map(item => { + return { + ...item, + checked: roles.includes(item.name) + }; + }); + + + this.form.role = roles; + } + }) + }, + // 瑙掕壊閫夋嫨鍙樺寲 + checkboxChange(e) { + // console.log(e); + }, + checkboxGroupChange(e) { + this.role = e; + }, + // 鍏ㄩ�� + checkedAll() { + this.list.map(val => { + val.checked = true; + }) + }, + // 鎻愪氦琛ㄥ崟 + async submitForm() { + // 1. 鎵嬪姩瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.uForm1.validate(valid => { + if (valid) { + this.loading = true; + // 2. 澶勭悊瑙掕壊鏁版嵁锛堝皢 checked=true 鐨勯」杞负 role 鏁扮粍锛� + + this.form.role = JSON.stringify(this.role); + console.log(this.form) + if (this.form.id) { + update(this.form).then(res => { + this.loading = false; + if (res.statusCode === 200) { + uni.showToast({ + title: res.data.msg, // 鎻愮ず鏂囧瓧 + icon: 'none', // 鍥炬爣绫诲瀷锛坰uccess/loading/none锛� + mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛堥槻姝㈣Е鎽哥┛閫忥級 + }); + + setTimeout(() => uni.navigateBack(), 1500); + } + }) + } else { + add(this.form).then(res => { + this.loading = false; + if (res.statusCode === 200) { + uni.showToast({ + title: res.data.msg, // 鎻愮ず鏂囧瓧 + icon: 'none', // 鍥炬爣绫诲瀷锛坰uccess/loading/none锛� + mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛堥槻姝㈣Е鎽哥┛閫忥級 + }); + + setTimeout(() => uni.navigateBack(), 1500); + } + }) + } + + } + }); + + + + } + } + }; +</script> + +<style lang="scss" scoped> + .checkbox-group { + display: flex; + flex-wrap: wrap; + gap: 16px; + /* 閫夐」闂磋窛 */ + margin-bottom: 16px; + /* 涓庢寜閽殑闂磋窛 */ + } + + /* 鍗曚釜澶嶉�夋鏍峰紡 */ + .custom-checkbox { + /deep/ .u-checkbox__icon-wrap { + border-radius: 4px; + /* 鍦嗚 */ + border: 1px solid #dcdfe6; + /* 杈规 */ + } + + /deep/ .u-checkbox__icon--checked { + background-color: #2979ff; + /* 閫変腑鑳屾櫙鑹� */ + border-color: #2979ff; + } + } + + /* 澶嶉�夋鏂囧瓧鏍峰紡 */ + .checkbox-label { + margin-left: 8px; + /* 鏂囧瓧涓庡浘鏍囩殑闂磋窛 */ + font-size: 14px; + color: #606266; + } + + /* 鍏ㄩ�夋寜閽牱寮� */ + .select-all-btn { + width: 40rpx; + margin-top: 8px; + } + + .add-user-container { + padding: 30rpx; + min-height: 100vh; + background-color: #f5f7fa; + + .form-card { + background-color: #fff; + border-radius: 16rpx; + padding: 30rpx; + box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05); + } + + .submit-btn { + margin-top: 60rpx; + padding: 0 30rpx; + } + + // 璋冩暣uView琛ㄥ崟鏍峰紡 + ::v-deep .u-form-item { + padding: 24rpx 0; + + &__body { + padding: 0; + } + } + + // 澶嶉�夋鏍峰紡璋冩暣 + ::v-deep .u-checkbox-group { + width: 100%; + padding: 16rpx 0; + } + } +</style> \ No newline at end of file diff --git a/pages/userPermissions/userPermissions.vue b/pages/userPermissions/userPermissions.vue new file mode 100644 index 0000000..c13d57d --- /dev/null +++ b/pages/userPermissions/userPermissions.vue @@ -0,0 +1,287 @@ +<template> + <view class="container"> + <!-- 鏍囬 --> + <view class="header"> + <text class="title">鐢ㄦ埛鍒楄〃</text> + + </view> + <view> + <button class="add-btn" @click="navigateToAdd()">鏂板鐢ㄦ埛</button> + </view> + <!-- 鎼滅储妗� --> + <view class="search-box"> + <u-search v-model="query.realName" placeholder="鎼滅储濮撳悕" :showAction="false" @change="searchUser()"></u-search> + </view> + + <!-- 鐢ㄦ埛鍒楄〃 --> + <scroll-view scroll-y class="user-list" @scrolltolower="loadMore" v-if="userList.length > 0"> + <view class="user-item" v-for="(user, index) in userList" :key="user.id" > + + <view class="user-info"> + <text class="realName">{{ user.realName }}</text> + <text class="mobile">{{ user.mobile }}</text> + </view> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <view class="action-buttons"> + <u-button type="primary" size="mini" @click.stop="restPassword(user.memberId)" class="edit-btn">閲嶇疆瀵嗙爜</u-button> + <u-button type="primary" size="mini" @click.stop="navigateToDetail(user.id)" class="edit-btn">淇敼</u-button> + <u-button type="error" size="mini" @click.stop="deleteUser(user.id)" + class="delete-btn">鍒犻櫎</u-button> + </view> + + </view> + + <!-- 鍔犺浇鏇村鎻愮ず --> + + <view class="load-more"> + <u-loadmore + v-if="mockData.length > 0" + :status="loading ? 'loading' : noMore ? 'nomore' : 'loadmore'" + :load-text="{ + loadmore: '涓婃媺鍔犺浇鏇村', + loading: '姝e湪鍔犺浇', + nomore: '娌℃湁鏇村浜�' + }" + /> + </view> + <view style="height:150rpx"> + + </view> + </scroll-view> + + + </view> +</template> + +<script> + import { + getPage, + del, + add, + update, + restPassword + } from "@/api/userPermissions.js" + import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue'; + import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue'; + import UForm from '@/uview-components/uview-ui/components/u-form/u-form.vue'; + import UFormItem from '@/uview-components/uview-ui/components/u-form-item/u-form-item.vue'; + import UInput from '@/uview-components/uview-ui/components/u-input/u-input.vue'; + import USearch from '@/uview-components/uview-ui/components/u-search/u-search.vue'; + import UPopup from '@/uview-components/uview-ui/components/u-popup/u-popup.vue'; + import ULoading from '@/uview-components/uview-ui/components/u-loading/u-loading.vue' + + + export default { + components: { + UIcon, + UButton, + UForm, + UFormItem, + UInput, + USearch, + UPopup, + ULoading + }, + data() { + return { + userList: [], // 鐢ㄦ埛鍒楄〃鏁版嵁 + loading: false, // 鍔犺浇鐘舵�� + noMoreData: false, // 鏄惁娌℃湁鏇村鏁版嵁 + query: { + realName: '', + page: 1, + pageSize: 10, + } + + + } + }, + onShow() { + this.getPage() + }, + onLoad() { + this.getPage() + }, + methods: { + restPassword(id){ + restPassword(id).then(res=>{ + if(res.statusCode === 200){ + uni.showToast({ + title: res.data.msg, // 鎻愮ず鏂囧瓧 + icon: 'none', // 鍥炬爣绫诲瀷锛坰uccess/loading/none锛� + mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛堥槻姝㈣Е鎽哥┛閫忥級 + }); + } + }) + }, + async getPage() { + // + uni.showLoading({ + title: '鍔犺浇涓�' + }); + getPage(this.query).then(res => { + uni.hideLoading(); + if (res.statusCode === 200) { + const data = res.data.data; + if (this.query.page === 1) { + this.userList = data || []; + } else { + // 鍚﹀垯杩藉姞鏁版嵁 + this.userList = [...this.userList, ...(data || [])]; + + } + } + }) + + + }, + + // 鎼滅储鐢ㄦ埛 + searchUser() { + this.query.page = 1 + this.noMoreData = false + this.userList = [] + this.getPage() + }, + + // 鍔犺浇鏇村 + loadMore() { + if (!this.noMoreData) { + this.query.page++ + this.getPage() + } + }, + // 璺宠浆鍒版柊澧炵敤鎴� + navigateToAdd() { + uni.navigateTo({ + url: `/pages/userPermissions/addStoreMember` + }) + }, + // 璺宠浆鍒扮敤鎴疯鎯� + navigateToDetail(id) { + uni.navigateTo({ + url: `/pages/userPermissions/addStoreMember?id=${id}` + }) + }, + deleteUser(id){ + del(id).then(res =>{ + if (res.statusCode === 200) { + this.getPage(); + } + }) + } + } + } +</script> + +<style lang="scss" scoped> + .user-item { + display: flex; + justify-content: space-between; + align-items: center; + padding: 20rpx; + border-bottom: 1rpx solid #f5f5f5; + } + + .user-info { + flex: 1; + display: flex; + flex-direction: column; + } + + .action-buttons { + display: flex; + margin-left: 20rpx; + } + + .edit-btn { + margin-right: 10rpx; + } + .container { + padding: 20rpx; + height: 100vh; + display: flex; + flex-direction: column; + background-color: #f5f5f5; + } + + .header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 20rpx 0; + margin-bottom: 20rpx; + + .title { + font-size: 36rpx; + font-weight: bold; + color: #333; + } + + + } + + .add-btn { + width: 50%; + background-color: #2979ff; + color: white; + border-radius: 40rpx; + padding: 0 50rpx; + height: 60rpx; + line-height: 60rpx; + font-size: 26rpx; + box-shadow: 0 2rpx 10rpx rgba(41, 121, 255, 0.3); + margin-bottom: 20rpx; + } + + .search-box { + margin-bottom: 20rpx; + } + + .user-list { + flex: 1; + overflow: hidden; + } + + .user-item { + display: flex; + align-items: center; + padding: 20rpx; + margin-bottom: 20rpx; + background-color: #fff; + border-radius: 12rpx; + box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05); + + .avatar { + width: 80rpx; + height: 80rpx; + border-radius: 50%; + margin-right: 20rpx; + } + + .user-info { + flex: 1; + display: flex; + flex-direction: column; + + .realName { + font-size: 32rpx; + color: #333; + margin-bottom: 8rpx; + } + + .mobile { + font-size: 24rpx; + color: #999; + } + } + } + .load-more { + padding: 20rpx 0; + text-align: center; + color: #999; + font-size: 26rpx; + background-color: #f7f8fa; + } + +</style> \ No newline at end of file diff --git a/pages/video/home-page.vue b/pages/video/home-page.vue index 10be23c..1e29861 100644 --- a/pages/video/home-page.vue +++ b/pages/video/home-page.vue @@ -61,23 +61,28 @@ <!-- 瑙嗛鍒楄〃 --> <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'works' && videoList.length > 0"> - <view class="video-container"> <view class="video-item" v-for="(item, index) in videoList" :key="item.id" - @click="playAuthorVideo(index)" > - <image class="video-cover" :src="item.coverUrl" mode="aspectFill"></image> + <image class="video-cover" @click="playAuthorVideo(index)" :src="item.coverUrl" mode="aspectFill"></image> <view class="video-info"> <view class="video-stats"> <view class="stat"> <uni-icons type="heart" size="16" color="#fff"></uni-icons> <text>{{item.collectNum}}</text> + <view class="more-op"> + <dropdown-menu + :options="item.options" + placement="top" + theme-color="#07C160" + @change="handleChange" + ></dropdown-menu> + </view> </view> </view> </view> - </view> </view> </scroll-view> <scroll-view class="video-list" scroll-y :show-scrollbar="false" @scrolltolower="getPage" v-show="currentTab === 'likes' && collectVideoList.length > 0"> @@ -115,11 +120,19 @@ </template> <script> +import DropdownMenu from '@/components/dropdown-menu.vue' + import {getAuthorInfo, getAuthorVideoPage, getAuthorCollectVideoPage} from '@/api/user.js' import {subscribe, unSubscribe} from '@/api/video.js' export default { + components: {DropdownMenu}, data() { return { + options: [ + { command: 1, label: '鍖椾含' }, + { command: 2, label: '涓婃捣' }, + { command: 3, label: '骞垮窞' } + ], currentTab: 'works', // works: 浣滃搧, likes: 鍠滄 authorId: '', userInfo: { @@ -159,6 +172,9 @@ this.getAuthorVideoPage(); }, methods: { + handleChange(value) { + console.log('閫変腑鍊�:', value) + }, getPage() { if(this.currentTab === 'works') { if(this.nomoreVideo) { @@ -465,12 +481,15 @@ } .video-info { + display: flex; + height: 60rpx; + align-items: center; + font-size: 24rpx; + width: 100%; + padding-right: 20rpx; + box-sizing: border-box; position: absolute; bottom: 20rpx; - left: 20rpx; - right: 20rpx; - color: #fff; - font-size: 24rpx; } .video-title { @@ -484,17 +503,25 @@ .video-stats { display: flex; + width: 100%; } .stat { display: flex; + width: 100%; align-items: center; - margin-right: 20rpx; - text-shadow: 0 0 5rpx rgba(0, 0, 0, 0.5); + position: relative; +} + +.more-op { + position: absolute; + right: 0; } .stat text { margin-left: 5rpx; + color: #fff; + font-size: 14px; } .empty-state { diff --git a/pages/video/video-edit.vue b/pages/video/video-edit.vue new file mode 100644 index 0000000..a6e2f37 --- /dev/null +++ b/pages/video/video-edit.vue @@ -0,0 +1,788 @@ +<template> + <view class="publish-container"> + <!-- 瑙嗛涓婁紶鍖哄煙 --> + <view class="upload-section"> + <view class="upload-btn" @click="chooseVideo" v-if="!videoInfo.url"> + <u-icon name="plus" size="40" color="#999"></u-icon> + <text class="upload-text">鐐瑰嚮涓婁紶瑙嗛</text> + <text class="upload-tips">鏀寔MP4鏍煎紡锛屾渶闀�60绉�</text> + </view> + + <view class="video-preview" v-else> + <video + :src="videoInfo.url" + :object-fit="formData.videoFit" + class="video-player" + :poster="videoInfo.cover || ''" + ></video> + <view class="progress-box"> + <progress style="width: 100%;" :percent="videoUploadProgress" active-mode="forwards" show-info stroke-width="6" :active="true" active-color="#ff573e" /> + </view> + <view class="video-actions"> + <u-button type="error" size="mini" @click="reUpload">閲嶆柊涓婁紶</u-button> + <u-button type="primary" size="mini" @click="chooseCover" v-if="videoInfo.url">{{formData.cover ? '鏇存崲灏侀潰' : '璇烽�夋嫨灏侀潰'}}</u-button> + </view> + </view> + </view> + + <!-- 瑙嗛淇℃伅琛ㄥ崟 --> + <view class="form-section"> + <u-form :model="formData" ref="formRef" labelWidth="80"> + <!-- 鏍囬杈撳叆 --> + <u-form-item label="鏍囬" prop="title" borderBottom> + <u-input + v-model="formData.title" + placeholder="璇疯緭鍏ヨ棰戞爣棰�,20瀛椾互鍐�" + maxlength="20" + show-word-limit + clearable + /> + </u-form-item> + + <!-- 璇濋杈撳叆 --> + <u-form-item label="璇濋" prop="tags" borderBottom> + <view class="tags-input-container"> + <u-input + v-model="tagInput" + placeholder="杈撳叆璇濋锛屽洖杞︾‘璁�" + clearable + @confirm="addTag" + @blur="addTag" + @input="searchTags" + ></u-input> + <!-- 宸查�夎瘽棰樺睍绀� --> + <view class="tags-display" v-if="formData.tags.length > 0"> + <my-tag + v-for="(tag, index) in formData.tags" + :key="index" + :text="tag.tagName" + :index="index" + type="success" + @close="removeTag(index)" + /> + </view> + <text class="tags-count" v-if="formData.tags.length > 0"> + 宸查�� {{ formData.tags.length }}/5 + </text> + </view> + <!-- 璇濋鎺ㄨ崘 --> + <view class="hot-topics" v-if="showTopicRecommendations"> + <text class="section-title">{{ tagInput ? '鎺ㄨ崘璇濋' : '鐑棬璇濋' }}</text> + <view class="topic-list"> + <my-tag + v-for="(tag, index) in recommendedTags" + :key="index" + :text="tag.tagName" + :index="index" + type="success" + :closeable="false" + @click="selectTopic(index)" + /> + </view> + </view> + </u-form-item> + + + <!-- 鍟嗗搧閾炬帴 --> + <u-form-item label="鍟嗗搧" prop="goodsId" borderBottom> + <view class="goods-link-container"> + <u-input + placeholder="鍙�夋嫨鎺ㄨ崘鍟嗗搧" + clearable + v-if="!selectedGoods" + @click="chooseGoods" + disabled + > + <u-icon + slot="right" + name="search" + size="24" + @click="chooseGoods" + ></u-icon> + </u-input> + <view class="goods-preview" v-if="selectedGoods"> + <image :src="selectedGoods.image" class="goods-image"></image> + <view class="goods-info"> + <text class="goods-name">{{ selectedGoods.name }}</text> + <text class="goods-price">楼{{ selectedGoods.price }}</text> + </view> + <u-icon + name="close" + size="20" + @click="clearGoods" + ></u-icon> + </view> + </view> + </u-form-item> + </u-form> + </view> + + <!-- 鍙戝竷鎸夐挳 --> + <view class="publish-btn"> + <u-button + type="primary" + shape="circle" + :loading="loading" + @click="handlePublish" + :disabled="!canPublish" + > + {{ loading ? '鍙戝竷涓�...' : '绔嬪嵆鍙戝竷' }} + </u-button> + </view> + + <!-- 鍟嗗搧閫夋嫨寮圭獥 --> + <u-popup v-model="showGoodsPicker" mode="bottom" round="20" height="70%"> + <view class="goods-picker"> + <view class="picker-header"> + <text class="picker-title">閫夋嫨鍟嗗搧</text> + <u-icon name="close" size="24" @click="showGoodsPicker = false"></u-icon> + </view> + <view class="search-bar"> + <u-search + v-model="goodsSearch" + placeholder="鎼滅储鍟嗗搧鍚嶇О" + :showAction="false" + ></u-search> + </view> + <scroll-view class="goods-list" scroll-y> + <view + class="goods-item" + v-for="goods in filteredGoods" + :key="goods.id" + @click="selectGoods(goods)" + > + <image :src="goods.image" class="goods-image"></image> + <view class="goods-info"> + <text class="goods-name">{{ goods.name }}</text> + <text class="goods-price">楼{{ goods.price }}</text> + </view> + <u-icon + name="checkmark" + size="24" + :color="selectedGoods && selectedGoods.id === goods.id ? '#2979ff' : '#ccc'" + ></u-icon> + </view> + </scroll-view> + </view> + </u-popup> + + <custom-tabbar bgColor="#ffffff" selected="video"></custom-tabbar> + </view> +</template> + +<script> +import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue'; +import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue'; +import UForm from '@/uview-components/uview-ui/components/u-form/u-form.vue'; +import UFormItem from '@/uview-components/uview-ui/components/u-form-item/u-form-item.vue'; +import UInput from '@/uview-components/uview-ui/components/u-input/u-input.vue'; +import USearch from '@/uview-components/uview-ui/components/u-search/u-search.vue'; +import UPopup from '@/uview-components/uview-ui/components/u-popup/u-popup.vue'; +import MyTag from '@/components/my-tag.vue' + +import { getSTSToken, getFilePreviewUrl } from "@/api/common.js"; +import { publish, getVideoDetail } from "@/api/video.js"; +import { getRecommendTag3 } from "@/api/video-tag.js"; +import { getFileKey } from "@/utils/file.js"; +export default { + components: {MyTag,UIcon,UButton,UForm,UFormItem,UInput,USearch,UPopup}, + data() { + return { + cosClient: null, + bucket: '', + region: '', + videoUploadProgress: 0, + loading: false, + showGoodsPicker: false, + goodsSearch: '', + tagInput: '', + videoInfo: { + url: '', + fileKey: '', + fileType: '', + fileSize: 0, + originalFileName: '', + cover: '' + }, + formData: { + id: '', + title: '', + cover: '', + videoFileKey: '', + videoDuration: 0, + videoFit: 'cover', + goodsId: '', + tags: [], + fileInfo: {} + }, + selectedGoods: null, + goodsList: [ + { + id: '1', + name: '鏂版鏃犵嚎钃濈墮鑰虫満', + price: '199.00', + image: 'https://via.placeholder.com/100' + }, + { + id: '2', + name: '鏅鸿兘鎵嬬幆杩愬姩鎵嬭〃', + price: '299.00', + image: 'https://via.placeholder.com/100' + } + ], + recommendedTags: [], + rules: { + title: [ + { required: true, message: '璇疯緭鍏ヨ棰戞爣棰�', trigger: 'blur' }, + { min: 1, max: 20, message: '鏍囬闀垮害鍦�1鍒�20涓瓧绗�', trigger: 'blur' } + ] + } + }; + }, + computed: { + canPublish() { + return this.formData.videoFileKey && this.formData.title && this.formData.cover; + }, + filteredGoods() { + if (!this.goodsSearch) return this.goodsList; + return this.goodsList.filter(goods => + goods.name.toLowerCase().includes(this.goodsSearch.toLowerCase()) + ); + }, + showTopicRecommendations() { + return (this.tagInput === '' || this.recommendedTags.length > 0) && this.formData.tags.length < 5; + } + }, + onLoad(option) { + this.getVideoDetail(option.id) + }, + onShow() { + this.initCOS() + // 鍒濆鍖栨帹鑽愭爣绛� + this.getRecommendTags() + }, + methods: { + getVideoDetail(id) { + getVideoDetail(id).then(res => { + this.fileInfo.cover = res.data.data.coverUrl + this.fileInfo.url = res.data.data.videoUrl + this.formData.cover = res.data.data.coverFileKey + this.formData.id = res.data.data.id + this.formData.title = res.data.data.title + this.formData.videoFileKey = res.data.data.videoFileKey + this.formData.videoFit = res.data.data.videoFit + this.formData.videoDuration = res.data.data.videoDuration + this.formData.goodsId = res.data.data.goodsId + this.formData.tags = res.data.data.tags + }).catch(() => { + uni.navigateBack({ + delta: 1 + }); + }) + }, + // 鑾峰彇鎺ㄨ崘鏍囩 + async getRecommendTags(type) { + const params = { + tagName: this.tagInput.trim(), + searchType: type + } + getRecommendTag3(params).then(res => { + this.recommendedTags = res.data.data + }) + }, + // 鍒濆鍖栬吘璁簯cos瀹㈡埛绔� + initCOS() { + // 璋冪敤鍚庣鑾峰彇sts涓存椂璁块棶鍑瘉 + getSTSToken().then(res => { + const COS = require('@/lib/cos-wx-sdk-v5.js'); // 寮�鍙戞椂浣跨敤 + // const COS = require('./lib/cos-wx-sdk-v5.min.js'); // 涓婄嚎鏃朵娇鐢ㄥ帇缂╁寘 + + // console.log(COS.version); sdk 鐗堟湰闇�瑕佷笉浣庝簬 1.7.2 + this.cosClient = new COS({ + SecretId: res.data.data.tmpSecretId, // sts 鏈嶅姟涓嬪彂鐨勪复鏃� secretId + SecretKey: res.data.data.tmpSecretKey, // sts 鏈嶅姟涓嬪彂鐨勪复鏃� secretKey + SecurityToken: res.data.data.sessionToken, // sts 鏈嶅姟涓嬪彂鐨勪复鏃� SessionToken + StartTime: res.data.data.stsStartTime, // 寤鸿浼犲叆鏈嶅姟绔椂闂达紝鍙伩鍏嶅鎴风鏃堕棿涓嶅噯瀵艰嚧鐨勭鍚嶉敊璇� + ExpiredTime: res.data.data.stsEndTime, // 涓存椂瀵嗛挜杩囨湡鏃堕棿 + SimpleUploadMethod: 'putObject', // 寮虹儓寤鸿锛岄珮绾т笂浼犮�佹壒閲忎笂浼犲唴閮ㄥ灏忔枃浠跺仛绠�鍗曚笂浼犳椂浣跨敤 putObject,sdk 鐗堟湰鑷冲皯闇�瑕乿1.3.0 + }); + this.bucket = res.data.data.bucket + this.region = res.data.data.region + }) + + }, + // 閫夋嫨瑙嗛 + chooseVideo() { + uni.chooseVideo({ + sourceType: ['album', 'camera'], + maxDuration: 60, + camera: 'back', + success: (res) => { + this.videoUploadProgress = 0 + // 鑾峰彇鏂囦欢鍚� + const tempPath = res.tempFilePath; + let fileName = tempPath.substring(tempPath.lastIndexOf('/') + 1); + + // 澶勭悊瀹夊崜鍙兘鐨刄RI缂栫爜 + if(fileName.indexOf('%') > -1) { + fileName = decodeURIComponent(fileName); + } + const fileKey = getFileKey(fileName); + this.videoInfo = { + url: res.tempFilePath, + fileKey: fileKey, + fileType: fileKey.split('/')[0], + fileSize: res.size, + originalFileName: fileName, + cover: '' + }; + this.formData.videoFileKey = fileKey; + this.formData.videoDuration = res.duration; + // 鍒ゆ柇瑙嗛鐨勫~鍏呮ā寮� + this.formData.videoFit = this.calculateVideoFit(res.width, res.height) + + this.cosClient.uploadFile({ + Bucket: this.bucket, + Region: this.region, + Key: fileKey, + FilePath: res.tempFilePath, + SliceSize: 1024 * 1024 * 5, /* 瑙﹀彂鍒嗗潡涓婁紶鐨勯槇鍊�,5M */ + onProgress: (progressData) => { + console.log(progressData.percent); + this.videoUploadProgress = progressData.percent * 100 + } + }, (err, data) => { + if (err) { + console.log('涓婁紶澶辫触', err); + this.videoInfo = { + url: '', + fileKey: '', + fileType: '', + fileSize: 0, + originalFileName: '', + cover: '' + } + } else { + console.log(this.videoInfo); + } + }); + }, + fail: (err) => { + uni.showToast({ + title: '鏈�夋嫨瑙嗛', + icon: 'none' + }); + console.error(err); + } + }); + }, + // 鏍规嵁瀹介珮姣旈�夋嫨瑙嗛濉厖妯″紡 + calculateVideoFit(width, height) { + const viewportRatio = uni.getSystemInfoSync().windowWidth / uni.getSystemInfoSync().windowHeight; + const videoRatio = width / height; + + // 瑙勫垯1锛氳秴瀹借棰戯紙濡傜數褰�21:9锛� + if (videoRatio > 2) return 'contain'; + + // 瑙勫垯2锛氱珫灞忚棰戯紙濡�9:16锛� + if (videoRatio < 0.8) return 'cover'; + + // 瑙勫垯3锛氭帴杩戝睆骞曟瘮渚嬬殑妯睆瑙嗛 + return Math.abs(videoRatio - viewportRatio) > 0.3 ? 'contain' : 'cover'; + }, + // 閲嶆柊涓婁紶 + reUpload() { + this.videoInfo = { + url: '', + cover: '', + duration: 0, + size: 0 + }; + this.chooseVideo(); + }, + + // 閫夋嫨灏侀潰 + chooseCover() { + uni.chooseImage({ + count: 1, + sizeType: ['compressed'], + sourceType: ['album'], + success: (res) => { + let fileName = res.tempFilePaths[0].substring(res.tempFilePaths[0].lastIndexOf('/') + 1); + // 澶勭悊瀹夊崜鍙兘鐨刄RI缂栫爜 + if(fileName.indexOf('%') > -1) { + fileName = decodeURIComponent(fileName); + } + const fileKey = getFileKey(fileName); + this.videoInfo.cover = res.tempFilePaths[0]; + this.cosClient.uploadFile({ + Bucket: this.bucket, + Region: this.region, + Key: fileKey, + FilePath: res.tempFilePaths[0], + SliceSize: 1024 * 1024 * 5 /* 瑙﹀彂鍒嗗潡涓婁紶鐨勯槇鍊�,5M */ + }, (err, data) => { + if (err) { + console.log('涓婁紶澶辫触', err); + } else { + // 鑾峰彇灏侀潰鐨勮闂湴鍧� + getFilePreviewUrl(fileKey).then(res => { + this.videoInfo.cover = res.data.data + this.formData.cover = fileKey + }) + } + }); + } + }); + }, + + // 閫夋嫨鍟嗗搧 + chooseGoods() { + this.showGoodsPicker = true; + }, + + // 閫夋嫨鍏蜂綋鍟嗗搧 + selectGoods(goods) { + this.selectedGoods = goods; + this.formData.goodsId = goods.id; + this.showGoodsPicker = false; + }, + + // 娓呴櫎鍟嗗搧 + clearGoods() { + this.selectedGoods = null; + this.formData.goodsId = ''; + }, + + // 鎼滅储鐑棬璇濋 + searchTags() { + if (this.tagInput.trim() !== '') { + this.getRecommendTags("SEARCH") + } + }, + // 娣诲姞鏍囩 + addTag() { + if(!this.tagInput.trim()) { + return + } + const newTag = {'id': '', 'tagName': this.tagInput.trim()}; + if (newTag && this.formData.tags.length < 5) { + if (this.formData.tags.filter(item => item.tagName === newTag.tagName).length < 1) { + this.formData.tags.push(newTag); + this.tagInput = ''; + this.getRecommendTags() // 閲嶇疆鎺ㄨ崘 + } else { + uni.showToast({ + title: '璇ヨ瘽棰樺凡娣诲姞杩囦簡~', + icon: 'none' + }); + } + } else if (this.formData.tags.length >= 5) { + uni.showToast({ + title: '鏈�澶氭坊鍔�5涓瘽棰榽', + icon: 'none' + }); + } + }, + + // 閫夋嫨鎺ㄨ崘璇濋 + selectTopic(index) { + const tag = this.recommendedTags[index] + if (this.formData.tags.length >= 5) { + uni.showToast({ + title: '鏈�澶氭坊鍔�5涓瘽棰榽', + icon: 'none' + }); + return; + } + + if (this.formData.tags.filter(item => item.tagName === tag.tagName).length < 1) { + this.formData.tags.push(tag); + this.tagInput = ''; + } else { + uni.showToast({ + title: '璇ヨ瘽棰樺凡娣诲姞杩囦簡~', + icon: 'none' + }); + } + }, + + // 绉婚櫎鏍囩 + removeTag(index) { + this.formData.tags.splice(index, 1); + }, + + // 澶勭悊鍙戝竷 + handlePublish() { + this.$refs.formRef.validate(valid => { + if (valid && this.canPublish) { + this.loading = true; + this.formData.fileInfo = this.videoInfo; + console.log(this.formData); + publish(this.formData).then(res => { + uni.showToast({ + title: '瑙嗛宸叉彁浜ゅ鏍竳', + icon: 'success' + }); + this.loading = false + // 閲嶇疆琛ㄥ崟 + this.videoInfo = { + url: '', + fileKey: '', + fileType: '', + fileSize: 0, + originalFileName: '', + cover: '' + }; + this.formData = { + id: '', + title: '', + videoFileKey: '', + cover: '', + videoFit: 'cover', + videoDuration: 0, + goodsId: '', + tags: [], + fileInfo: {} + }; + this.selectedGoods = null; + this.tagInput = ''; + this.recommendedTags = []; + + // TODO 鍏堣烦棣栭〉,鍚庨潰璺虫垜鐨勮棰戦〉闈� + setTimeout(() => { + uni.switchTab({ + url: '/pages/tabbar/index/home' + }); + }, 1500); + }) + } else { + uni.showToast({ + title: '璇峰畬鍠勮棰戜俊鎭瘇', + icon: 'none' + }); + } + }); + } + } +}; +</script> + +<style scoped> +.publish-container { + padding: 20rpx; + padding-bottom: 120rpx; +} + +.upload-section { + background-color: #f8f8f8; + border-radius: 16rpx; + padding: 40rpx; + margin-bottom: 30rpx; + display: flex; + justify-content: center; + align-items: center; + min-height: 400rpx; +} + +.upload-btn { + display: flex; + flex-direction: column; + align-items: center; + color: #999; +} + +.upload-text { + font-size: 32rpx; + margin: 20rpx 0 10rpx; +} + +.upload-tips { + font-size: 24rpx; + color: #ccc; +} + +.video-preview { + width: 100%; + display: flex; + flex-direction: column; + align-items: center; +} + +.video-player { + width: 100%; + height: 400rpx; + border-radius: 12rpx; + background-color: #000; +} + +.video-actions { + margin-top: 20rpx; + display: flex; + justify-content: center; + gap: 20rpx; +} + +.form-section { + background-color: #fff; + border-radius: 16rpx; + padding: 0 20rpx; +} + +.goods-link-container { + width: 100%; +} + +.goods-preview { + display: flex; + align-items: center; + padding: 15rpx; + background-color: #f9f9f9; + border-radius: 8rpx; + margin-top: 15rpx; +} + +.goods-preview .goods-image { + width: 80rpx; + height: 80rpx; + border-radius: 8rpx; + margin-right: 15rpx; +} + +.goods-preview .goods-info { + flex: 1; + display: flex; + flex-direction: column; +} + +.goods-preview .goods-info .goods-name { + font-size: 26rpx; + color: #333; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.goods-preview .goods-info .goods-price { + font-size: 28rpx; + color: #f44; + font-weight: bold; +} + +.topic-list { + display: flex; + flex-direction: row; + flex-wrap: wrap; + line-height: 22px; +} + +.tags-input-container { + width: 100%; +} + +.tags-display { + display: flex; + flex-wrap: wrap; + margin-top: 15rpx; + line-height: 22px; +} + +.hot-topics { + display: flex; + flex-direction: column; + margin-top: 15rpx; + margin-bottom: 15rpx; +} + +.section-title { + font-size: 12px; + color: #999; + line-height: 12px; + margin-bottom: 6rpx; +} + +.tags-count { + display: block; + font-size: 12px; + line-height: 12px; + color: #999; + margin-top: 10rpx; + text-align: right; +} + +.publish-btn { + position: fixed; + bottom: 100rpx; + left: 20rpx; + right: 20rpx; +} + +.goods-picker { + padding: 30rpx; + height: 100%; + display: flex; + flex-direction: column; +} + +.goods-picker .picker-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 30rpx; +} + +.goods-picker .picker-header .picker-title { + font-size: 36rpx; + font-weight: bold; +} + +.goods-picker .search-bar { + margin-bottom: 20rpx; +} + +.goods-picker .goods-list { + flex: 1; + overflow: hidden; +} + +.goods-picker .goods-list .goods-item { + display: flex; + align-items: center; + padding: 20rpx 0; + border-bottom: 1rpx solid #f5f5f5; +} + +.goods-picker .goods-list .goods-item .goods-image { + width: 100rpx; + height: 100rpx; + border-radius: 8rpx; + margin-right: 20rpx; +} + +.goods-picker .goods-list .goods-item .goods-info { + flex: 1; +} + +.goods-picker .goods-list .goods-item .goods-info .goods-name { + font-size: 28rpx; + color: #333; + margin-bottom: 10rpx; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; +} + +.goods-picker .goods-list .goods-item .goods-info .goods-price { + font-size: 28rpx; + color: #f44; + font-weight: bold; +} + +.progress-box { + width: 100%; + display: flex; + height: 25px; + margin-top: 10px; +} +</style> \ No newline at end of file -- Gitblit v1.8.0