editSpecialColumn.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <view class="container edit_Special_Column">
  3. <view class="set-up-info">
  4. <view class="info-name info-box">
  5. <text class="seting-txt">编辑专栏</text>
  6. <input v-model="columnName" placeholder="请输入专栏名称(最多12个字)" />
  7. <input v-model="columnNickname" placeholder="请输入昵称(最多12个字)" />
  8. </view>
  9. <view class="set-up-lable info-box">
  10. <view class="top-box">
  11. <view class="lable-txt">
  12. 专栏标签
  13. <text>(选填)</text>
  14. </view>
  15. <view v-if="columnLableList.length < 6" class="new-lable" @click="addlableShow = true">+ 新建标签</view>
  16. </view>
  17. <view class="column-lable">
  18. <view class="lable-item" v-for="(item, index) in columnLableList" :key="index">
  19. <text>{{ item }}</text>
  20. <van-icon name="cross" @click="deleteLablehandle(index)" />
  21. </view>
  22. </view>
  23. </view>
  24. <view class="set-up-info info-box" style="height: 480rpx">
  25. <view class="lable-txt"> 专栏介绍 </view>
  26. <u-input :maxlength="30" v-model="columnIntroduce" type="textarea" :clearable="false" placeholder="请输入专栏介绍 " height="300" class="ipt" />
  27. </view>
  28. <view class="my-btn" @click="infoDetermineHandler"> 保存</view>
  29. </view>
  30. <u-modal
  31. v-model="addlableShow"
  32. :show-title="false"
  33. show-cancel-button
  34. confirm-text="确定"
  35. cancel-text="取消"
  36. :content-style="{ fontSize: '32rpx' }"
  37. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  38. :confirm-style="{ fontWeight: '700' }"
  39. @confirm="confirmModal"
  40. @cancel="cancelModal"
  41. >
  42. <view class="slot-content slot-content-text">
  43. <text class="add-lable-txt">新建标签</text>
  44. <input v-model="addLableName" placeholder="请输入标签名称(最多8个字)" />
  45. </view>
  46. </u-modal>
  47. </view>
  48. </template>
  49. <script>
  50. import { purchaserApi, uploadurl } from "@/config/api";
  51. export default {
  52. data() {
  53. return {
  54. specialList: [], // 专栏列表
  55. mySpecialList: [], // 专栏列表
  56. isAuthor: false, // 是否是作者
  57. authorDetail: {}, // 作者的详情信息
  58. tabActive: "1",
  59. addlableShow: false,
  60. columnName: "",
  61. columnNickname: "",
  62. columnIntroduce: "",
  63. columnLableList: [],
  64. addLableName: "",
  65. isEditInfo: true,
  66. };
  67. },
  68. methods: {
  69. // 添加标签的确认事件
  70. confirmModal() {
  71. if (!this.addLableName) return this.$util.toast("未添加标签");
  72. this.columnLableList.push(this.addLableName.slice(0, 8));
  73. this.addLableName = "";
  74. },
  75. // 添加标签的取消事件
  76. cancelModal() {
  77. this.addLableName = "";
  78. },
  79. async getAuthorDetail() {
  80. const res = await purchaserApi.yanxuanSpecialAuthorDetail();
  81. if (res.Ret === 200) {
  82. this.authorDetail = res.Data || {};
  83. this.editColumnHandler();
  84. }
  85. },
  86. // 信息填写完成 进入我的专栏
  87. async infoDetermineHandler() {
  88. if (this.columnName && this.columnNickname && this.columnIntroduce) {
  89. const res = await purchaserApi.yanxuanSpecialAuthorSave({
  90. SpecialName: this.columnName.slice(0, 12),
  91. NickName: this.columnNickname.slice(0, 12),
  92. Introduction: this.columnIntroduce,
  93. Label: this.columnLableList.join(","),
  94. UserId: this.authorDetail.UserId,
  95. });
  96. if (res.Ret === 200) {
  97. uni.navigateBack();
  98. }
  99. } else {
  100. let str = !this.columnName ? "专栏名称" : !this.columnNickname ? "专栏昵称" : !this.columnIntroduce ? "专栏介绍" : "";
  101. this.$util.toast("请输入" + str);
  102. }
  103. },
  104. // 删除新建标签
  105. deleteLablehandle(index) {
  106. this.columnLableList.splice(index, 1);
  107. },
  108. // 编辑专栏
  109. editColumnHandler() {
  110. this.columnName = this.authorDetail.SpecialName;
  111. this.columnNickname = this.authorDetail.NickName;
  112. this.columnIntroduce = this.authorDetail.Introduction;
  113. this.columnLableList = this.authorDetail.Label ? this.authorDetail.Label.split(",") : [];
  114. this.isEditInfo = false;
  115. },
  116. },
  117. onLoad() {
  118. this.getAuthorDetail();
  119. },
  120. };
  121. </script>
  122. <style lang="scss" scoped>
  123. .edit_Special_Column {
  124. background-color: $uni-bg-color;
  125. input {
  126. height: 72rpx;
  127. background-color: #f0f1f3;
  128. padding-left: 24rpx;
  129. border-radius: 12rpx;
  130. }
  131. .tab-content {
  132. position: sticky;
  133. top: 0;
  134. left: 0;
  135. z-index: 99;
  136. margin-top: 1rpx;
  137. background-color: #fff;
  138. height: 96rpx;
  139. display: flex;
  140. view {
  141. flex: 1;
  142. text-align: center;
  143. line-height: 96rpx;
  144. border-bottom: 2rpx solid #e7e7e7;
  145. }
  146. .item {
  147. position: relative;
  148. .line-active {
  149. position: absolute;
  150. left: 50%;
  151. bottom: 0rpx;
  152. width: 32rpx;
  153. height: 6rpx;
  154. border-radius: 6rpx;
  155. background-color: #376cbb;
  156. transform: translateX(-50%);
  157. }
  158. }
  159. }
  160. .item-ul {
  161. padding: 30rpx;
  162. .item-li {
  163. padding: 0 30rpx 30rpx;
  164. background-color: white;
  165. border-radius: 16rpx;
  166. border-top: 10rpx solid #8fa4c4;
  167. margin-bottom: 20rpx;
  168. .item-title {
  169. margin-top: 20rpx;
  170. font-size: 34rpx;
  171. font-weight: 500;
  172. }
  173. .item-name-time {
  174. display: flex;
  175. justify-content: space-between;
  176. align-items: center;
  177. height: 80rpx;
  178. font-size: 28rpx;
  179. color: #999;
  180. .name {
  181. display: flex;
  182. align-items: center;
  183. image {
  184. width: 48rpx;
  185. height: 48rpx;
  186. border-radius: 50%;
  187. margin-right: 10rpx;
  188. }
  189. }
  190. }
  191. .item-content {
  192. text-overflow: -o-ellipsis-lastline;
  193. overflow: hidden;
  194. text-overflow: ellipsis;
  195. display: -webkit-box;
  196. -webkit-line-clamp: 4;
  197. line-clamp: 4;
  198. -webkit-box-orient: vertical;
  199. }
  200. }
  201. }
  202. .set-up-info {
  203. padding: 30rpx;
  204. overflow: hidden;
  205. .info-name {
  206. width: 100%;
  207. padding: 40rpx;
  208. border-radius: 16rpx;
  209. color: #333;
  210. background-color: #fff;
  211. .seting-txt {
  212. text-align: center;
  213. font-size: 36rpx;
  214. font-weight: 500;
  215. line-height: 50rpx;
  216. }
  217. .item-txt {
  218. margin-top: 40rpx;
  219. margin-bottom: 5rpx;
  220. font-size: 28rpx;
  221. font-weight: 500;
  222. line-height: 40rpx;
  223. }
  224. input {
  225. margin-top: 40rpx;
  226. }
  227. }
  228. .set-up-lable {
  229. .top-box {
  230. display: flex;
  231. background-color: #fff;
  232. justify-content: space-between;
  233. .new-lable {
  234. color: #376cbb;
  235. }
  236. }
  237. }
  238. .lable-txt {
  239. font-size: 28rpx;
  240. font-weight: 500;
  241. line-height: 40rpx;
  242. display: flex;
  243. text {
  244. color: #999;
  245. flex-wrap: 400;
  246. }
  247. }
  248. .info-box {
  249. padding: 40rpx;
  250. border-radius: 16rpx;
  251. color: #333;
  252. background-color: #fff;
  253. margin-bottom: 30rpx;
  254. }
  255. .ipt {
  256. height: 300rpx;
  257. }
  258. }
  259. .u-input {
  260. margin-top: 10rpx;
  261. background-color: #f0f1f3;
  262. }
  263. .u-input__textarea {
  264. padding: 20rpx !important;
  265. }
  266. .my-btn {
  267. margin: 50rpx 0;
  268. width: 100%;
  269. height: 72rpx;
  270. padding: 18rpx 30rpx 18rpx 30rpx;
  271. border-radius: 9rpx;
  272. background: #376cbb;
  273. color: #fff;
  274. display: flex;
  275. align-items: center;
  276. justify-content: center;
  277. }
  278. .add-lable-txt {
  279. color: #000;
  280. font-size: 36rpx;
  281. flex-wrap: 600;
  282. margin-bottom: 20rpx;
  283. width: 100%;
  284. text-align: center;
  285. }
  286. .column-lable {
  287. display: flex;
  288. flex-wrap: wrap;
  289. .lable-item {
  290. display: flex;
  291. color: #fff;
  292. font-size: 28rpx;
  293. padding: 10rpx 24rpx;
  294. background-color: #376cbb;
  295. border-radius: 153px;
  296. margin: 20rpx 20rpx 0 0;
  297. text {
  298. margin-right: 12rpx;
  299. }
  300. }
  301. }
  302. .slot-content-text {
  303. text-align: left;
  304. }
  305. .write-note-button {
  306. position: fixed;
  307. width: 100%;
  308. bottom: 10rpx;
  309. left: 0rpx;
  310. z-index: 99;
  311. display: flex;
  312. padding: 0 35rpx;
  313. padding-bottom: constant(safe-area-inset-bottom);
  314. padding-bottom: env(safe-area-inset-bottom);
  315. .draft {
  316. margin-right: 20rpx;
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. width: 216rpx;
  321. height: 72rpx;
  322. color: #376cbb;
  323. background-color: #e5efff;
  324. border-radius: 9rpx;
  325. }
  326. .release {
  327. flex: 1;
  328. display: flex;
  329. align-items: center;
  330. justify-content: center;
  331. height: 72rpx;
  332. border-radius: 9rpx;
  333. color: #ffff;
  334. background-color: #376cbb;
  335. }
  336. }
  337. .column-list-content {
  338. margin-top: 20rpx;
  339. }
  340. }
  341. </style>