初始化

This commit is contained in:
魏啾
2024-03-21 15:38:10 +08:00
parent e2f200ae7a
commit 81321b648f
479 changed files with 60060 additions and 1 deletions

673
pages/project/create.vue Normal file
View File

@@ -0,0 +1,673 @@
<template>
<view class="index">
<view class="title_text">
基本信息
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
项目图片
</view>
<view class="onecontent_itemright flex-start">
<view v-if="form.img" class="onecontent_itemrightimges flex-colum" @click="chooseImagelist()">
<image :src="form.img"></image>
</view>
<view v-else class="onecontent_itemrightimges flex-colum" @click="chooseImagelist()">
+
</view>
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
项目名称
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.title" type="text" placeholder="请输入项目名称">
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
原价
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.y_price" type="text" placeholder="给项目定个好价格">
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
现价
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.price" type="text" placeholder="给项目定个好价格">
</view>
</view>
<!-- <view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
标签
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" type="text" placeholder="热卖、新品、爆款等,不超过两个字">
</view>
</view> -->
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
简单描述
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.describe" type="text"
placeholder="显示项目列表的简单描述不超过30个字">
</view>
</view>
</view>
<view class="title_text">
项目设置
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
项目分类
</view>
<view class="onecontent_itemright flex-start" @click="clicksheetshow">
<text style="flex: 1; text-align: right;" class="onecontent_itemrighttext"
v-if="form.name">{{form.name}}</text>
<text style="flex: 1; text-align: right;" class="onecontent_itemrighttext" v-else>请选择</text>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
上架
</view>
<u-switch v-model="form.status" @change="changeswitch" size="20"></u-switch>
</view>
<!-- <view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
推荐
</view>
<u-switch v-model="form.is_re" @change="changeswitchs" size="20"></u-switch>
</view> -->
</view>
<view class="title_text">
项目描述
</view>
<view class="onecontent">
<!-- <view @click="demos" class="onecontent_item flex-between">
<view class="onecontent_itemleft">
项目详情
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view> -->
<view class="container">
<view class="page-body">
<view class='wrapper'>
<view class='toolbar' @tap="format">
<view :class="formats.bold ? 'ql-active' : ''" class="iconfont icon-zitijiacu"
data-name="bold">
</view>
<view :class="formats.italic ? 'ql-active' : ''" class="iconfont icon-zitixieti"
data-name="italic">
</view>
<view :class="formats.underline ? 'ql-active' : ''" class="iconfont icon-zitixiahuaxian"
data-name="underline"></view>
<view :class="formats.strike ? 'ql-active' : ''" class="iconfont icon-zitishanchuxian"
data-name="strike"></view>
<!-- #ifndef MP-BAIDU -->
<view :class="formats.align === 'left' ? 'ql-active' : ''" class="iconfont icon-zuoduiqi"
data-name="align" data-value="left"></view>
<!-- #endif -->
<view :class="formats.align === 'center' ? 'ql-active' : ''"
class="iconfont icon-juzhongduiqi" data-name="align" data-value="center"></view>
<view :class="formats.align === 'right' ? 'ql-active' : ''" class="iconfont icon-youduiqi"
data-name="align" data-value="right"></view>
<view :class="formats.align === 'justify' ? 'ql-active' : ''"
class="iconfont icon-zuoyouduiqi" data-name="align" data-value="justify"></view>
<!-- #ifndef MP-BAIDU -->
<view :class="formats.lineHeight ? 'ql-active' : ''" class="iconfont icon-line-height"
data-name="lineHeight" data-value="2"></view>
<view :class="formats.letterSpacing ? 'ql-active' : ''"
class="iconfont icon-Character-Spacing" data-name="letterSpacing" data-value="2em">
</view>
<view :class="formats.marginTop ? 'ql-active' : ''"
class="iconfont icon-722bianjiqi_duanqianju" data-name="marginTop" data-value="20px">
</view>
<view :class="formats.marginBottom ? 'ql-active' : ''"
class="iconfont icon-723bianjiqi_duanhouju" data-name="marginBottom" data-value="20px">
</view>
<!-- #endif -->
<view class="iconfont icon-clearedformat" @tap="removeFormat"></view>
<!-- #ifndef MP-BAIDU -->
<view :class="formats.fontFamily ? 'ql-active' : ''" class="iconfont icon-font"
data-name="fontFamily" data-value="Pacifico"></view>
<view :class="formats.fontSize === '24px' ? 'ql-active' : ''" class="iconfont icon-fontsize"
data-name="fontSize" data-value="24px"></view>
<!-- #endif -->
<view :class="formats.color === '#0000ff' ? 'ql-active' : ''"
class="iconfont icon-text_color" data-name="color" data-value="#0000ff"></view>
<view :class="formats.backgroundColor === '#00ff00' ? 'ql-active' : ''"
class="iconfont icon-fontbgcolor" data-name="backgroundColor" data-value="#00ff00">
</view>
<view class="iconfont icon-date" @tap="insertDate"></view>
<view class="iconfont icon--checklist" data-name="list" data-value="check"></view>
<view :class="formats.list === 'ordered' ? 'ql-active' : ''"
class="iconfont icon-youxupailie" data-name="list" data-value="ordered"></view>
<view :class="formats.list === 'bullet' ? 'ql-active' : ''" class="iconfont icon-wuxupailie"
data-name="list" data-value="bullet"></view>
<view class="iconfont icon-undo" @tap="undo"></view>
<view class="iconfont icon-redo" @tap="redo"></view>
<view class="iconfont icon-outdent" data-name="indent" data-value="-1"></view>
<view class="iconfont icon-indent" data-name="indent" data-value="+1"></view>
<view class="iconfont icon-fengexian" @tap="insertDivider"></view>
<view class="iconfont icon-charutupian" @tap="insertImage"></view>
<view :class="formats.header === 1 ? 'ql-active' : ''" class="iconfont icon-format-header-1"
data-name="header" :data-value="1"></view>
<view :class="formats.script === 'sub' ? 'ql-active' : ''" class="iconfont icon-zitixiabiao"
data-name="script" data-value="sub"></view>
<view :class="formats.script === 'super' ? 'ql-active' : ''"
class="iconfont icon-zitishangbiao" data-name="script" data-value="super"></view>
<view class="iconfont icon-shanchu" @tap="clear"></view>
<view :class="formats.direction === 'rtl' ? 'ql-active' : ''"
class="iconfont icon-direction-rtl" data-name="direction" data-value="rtl"></view>
</view>
<view class="editor-wrapper">
<editor id="editor" class="ql-container" placeholder="开始输入..." show-img-size
show-img-toolbar show-img-resize @statuschange="onStatusChange" @input="getText"
:read-only="readOnly" @ready="onEditorReady">
</editor>
</view>
</view>
</view>
</view>
</view>
<view class="baocun" @tap="$u.debounce(servicecreateitem,1000)">
保存
</view>
<view class="baocun" v-if="form.service_id!=''" @click="servicedelservice" style="background: red;">
删除
</view>
<u-action-sheet :actions="listsheet" :show="sheetshow" @select="selectClick"></u-action-sheet>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
listsheet: [],
sheetshow: false,
readOnly: false,
formats: {},
context: {},
form: {
service_type_id: '',
title: '',
y_price: '',
price: '',
describe: '',
status: true,
is_re: false,
details: '',
service_id: '',
name: "",
img: '',
}
}
},
async onLoad(e) {
try {
if (e.id) {
console.log(e)
this.form.service_id = e.id
let res = await this.api.servicedetail({
service_id: e.id
})
uni.setNavigationBarTitle({
title: '修改项目'
})
if (res.code = 1) {
this.form = res.data
var thisdatadescribe = res.data.details
uni.createSelectorQuery().select('#editor').context((res) => {
if (!res) return
res.context.setContents({
html: thisdatadescribe
})
}).exec()
console.log(this.form)
}
} else {
uni.setNavigationBarTitle({
title: '创建项目'
})
}
} catch (e) {
//TODO handle the exception
}
this.serviceitemclass()
},
onShow() {},
mounted() {
this.$bus.$on('editors', this.demo)
},
methods: {
clicksheetshow() {
if (this.listsheet.length == 0) {
uni.showToast({
title: '请先去添加分类',
icon: 'none'
});
} else {
this.sheetshow = true
}
},
demo(data) {
this.form.details = data
},
demos() {
uni.pro.navigateTo('project/editor/editor', {
id: this.form.service_id
})
},
selectClick(index) {
this.sheetshow = false
this.form.name = index.name
this.form.service_type_id = index.id
console.log(index)
},
changeswitch(e) {
this.form.status = e
},
changeswitchs(e) {
this.form.is_re = e
},
async serviceitemclass(e) { //项目分类
let data = await this.api.serviceitemclass({
page:1
});
this.listsheet = data.data
},
async servicecreateitem() {
if (this.form.service_type_id == null || this.form.service_type_id == '') {
uni.showToast({
title: '请选择项目分类',
icon: 'none'
});
return false;
}
if (this.form.title == null || this.form.title == '') {
uni.showToast({
title: '请填写项目名称',
icon: 'none'
});
return false;
}
if (this.form.price == null || this.form.price == '') {
uni.showToast({
title: '原价不能为空',
icon: 'none'
});
return false;
}
if (this.form.describe == null || this.form.describe == '') {
uni.showToast({
title: '项目详情不能为空',
icon: 'none'
});
return false;
}
if (this.form.details == null || this.form.details == '') {
uni.showToast({
title: '详情/规则不能为空',
icon: 'none'
});
return false;
}
if (this.form.img == null || this.form.img == '') {
uni.showToast({
title: '图片不能为空',
icon: 'none'
});
return false;
}
let res = await this.api.servicecreateitem({
service_type_id: this.form.service_type_id,
title: this.form.title,
y_price: this.form.y_price,
price: this.form.price,
describe: this.form.describe,
status: this.form.status,
is_re: this.form.is_re,
details: this.form.details,
img: this.form.img,
service_id: this.form.service_id
});
if (res.code == 1) {
uni.showToast({
title: this.form.service_id ? '修改成功' : '创建成功',
icon: 'none'
});
uni.navigateBack();
}
},
async servicedelservice() {
var this_ = this
console.log(this.form.service_id)
uni.showModal({
title: '提示',
content: '确认删除该项目吗?',
success: async (res) => {
if (res.confirm) {
let data = await this.api.servicedelservice({
service_id: this.form.service_id
});
if (data.code == 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
// 上传
chooseImagelist() {
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'refund/',
result => {
this.form.avatar = ''
this.form.img = result
uni.hideLoading()
}, result => {
console.log(result, '2222')
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
getText(e) {
this.context = e.detail.html
this.form.details = this.context
console.log(e.detail.html, this.context); //输出相应内容的html代码
},
readOnlyChange() {
this.readOnly = !this.readOnly
},
onEditorReady() {
// #ifdef MP-BAIDU
this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
// #endif
// #ifdef APP-PLUS || MP-WEIXIN || H5
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
// #endif
},
undo() {
this.editorCtx.undo()
},
redo() {
this.editorCtx.redo()
},
format(e) {
let {
name,
value
} = e.target.dataset
if (!name) return
// console.log('format', name, value)
this.editorCtx.format(name, value)
},
onStatusChange(e) {
const formats = e.detail
this.formats = formats
},
insertDivider() {
this.editorCtx.insertDivider({
success: function() {
console.log('insert divider success')
}
})
},
clear() {
uni.showModal({
title: '清空编辑器',
content: '确定清空编辑器全部内容?',
success: res => {
if (res.confirm) {
this.editorCtx.clear({
success: function(res) {
console.log("clear success")
}
})
}
}
})
},
removeFormat() {
this.editorCtx.removeFormat()
},
insertDate() {
const date = new Date()
const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
this.editorCtx.insertText({
text: formatDate
})
},
insertImage() {
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'wechat/',
result => {
this.editorCtx.insertImage({
src: result,
alt: '图像',
})
uni.hideLoading()
}, result => {
console.log(result)
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
}
}
}
</script>
<style lang="scss">
@import "./editor-icon.css";
page {
background: #F6F6F6;
}
.index {
.title_text {
padding: 12rpx 40rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #FFFFFF;
}
.baocun {
margin: 40rpx auto;
width: 90%;
padding: 18rpx 0;
background: #6699FF;
text-align: center;
border-radius: 16rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
.onecontent {
background: #ffffff;
.wrapper {
height: 100%;
.editor-wrapper {
background: #fff;
}
.iconfont {
display: inline-block;
padding: 8px 8px;
width: 24px;
height: 24px;
cursor: pointer;
font-size: 20px;
}
.toolbar {
box-sizing: border-box;
border-bottom: 0;
}
.ql-container {
box-sizing: border-box;
padding: 12px 15px;
width: 100%;
min-height: 30vh;
height: 100%;
font-size: 16px;
line-height: 1.5;
}
.ql-active {
color: #06c;
}
}
.onecontent_item {
width: 100%;
padding: 16rpx 46rpx;
border-bottom: 2rpx solid #E5E5E5;
.onecontent_itemleft {
flex: 1;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.onecontent_itemright {
flex: 3;
.onecontent_itemrighttext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.onecontent_itemrightimges {
width: 112rpx;
height: 112rpx;
background: #F5F5F5;
border-radius: 10rpx;
font-size: 40rpx;
color: #878787;
image {
width: 112rpx;
height: 112rpx;
}
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
.flex-start {
.fourcontent {
.fourcontent_item {
position: relative;
margin-top: 16rpx;
margin-left: 20rpx;
width: 112rpx;
height: 112rpx;
border-radius: 16rpx;
image {
width: 112rpx;
height: 112rpx;
border-radius: 16rpx;
}
.fourcontent_itemtext {
position: absolute;
top: 0rpx;
right: 0rpx;
}
}
}
}
}
}
}
</style>

197
pages/project/createcap.vue Normal file
View File

@@ -0,0 +1,197 @@
<template>
<view class="index">
<view class="title_text">
创建分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
项目分类
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="name" maxlength="8" type="text"
placeholder="请输入项目分类">
</view>
</view>
</view>
<view class="thereconse thereconses" @click="servicecreateitemclass">
确定
</view>
<view class="title_text">
管理分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between" v-for="(item,index) in list" :key="index"
@click="contentfixedclick(item)">
<view class="onecontent_itemleft">
{{item.name}}
</view>
<u-icon name="arrow-right" color="#333" size="20"></u-icon>
</view>
</view>
<view v-if="list.length==0 && is_end == true" style="margin-top: 100rpx;width: 100%;" class="flex-colum">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
</view>
</template>
<script>
export default {
data() {
return {
name: '',
list: [],
is_end: false,
form: {
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.init_fn()
},
methods: {
init_fn() {
this.list = []
this.is_end = false
this.form.page = 1
this.form.status = 'loadmore'
this.shoppinggooodstype()
},
async shoppinggooodstype() {
let res = await this.api.serviceitemclass({
page:1
});
if (res.code == 1) {
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
contentfixedclick(e) {
uni.navigateTo({
url: '/pages/project/createcapinfo?name=' + e.name +'&goods_type_id='+ e.id
});
},
async servicecreateitemclass() {
let res = await this.api.servicecreateitemclass({
name: this.name,
type:1
});
if (res.code == 1) {
uni.showToast({
title: '创建成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.index {
.title_text {
padding: 12rpx 40rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #FFFFFF;
}
.onecontent {
background: #ffffff;
.onecontent_item {
width: 100%;
padding: 16rpx 46rpx;
border-bottom: 2rpx solid #E5E5E5;
.onecontent_itemleft {
flex: 1;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.onecontent_itemright {
flex: 3;
.onecontent_itemrighttext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.onecontent_itemrightimges {
width: 112rpx;
height: 112rpx;
background: #F5F5F5;
border-radius: 10rpx;
font-size: 40rpx;
color: #878787;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 84rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
}
.thereconses {
background: linear-gradient(115deg, #7E81A5 0%, #4D4E64 100%);
}
}
</style>

View File

@@ -0,0 +1,161 @@
<template>
<view class="index">
<view class="title_text">
修改分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
商品分类
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.name" maxlength="8" type="text"
placeholder="请输入商品分类">
</view>
</view>
</view>
<view class="thereconse" @click="servicecreateitemclass">
确定
</view>
<view class="thereconse thereconsess" @click="shoppingdeletegoodstype">
刪除
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
name:'',
service_id:''
},
}
},
onLoad(e) {
this.form.name = e.name
this.form.service_id = e.goods_type_id
},
methods: {
async shoppingdeletegoodstype(){
let res = await this.api.servicedeleteitem({
id:this.form.service_id
});
if (res.code == 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
async servicecreateitemclass() {
let res = await this.api.servicecreateitemclass({
name: this.form.name,
type:2,
id:this.form.service_id
});
if (res.code == 1) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.index {
.title_text {
padding: 12rpx 40rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #FFFFFF;
}
.onecontent {
background: #ffffff;
.onecontent_item {
width: 100%;
padding: 16rpx 46rpx;
border-bottom: 2rpx solid #E5E5E5;
.onecontent_itemleft {
flex: 1;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.onecontent_itemright {
flex: 3;
.onecontent_itemrighttext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.onecontent_itemrightimges {
width: 112rpx;
height: 112rpx;
background: #F5F5F5;
border-radius: 10rpx;
font-size: 40rpx;
color: #878787;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 50rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
background: #6699FF;
border-radius: 16rpx;
}
.thereconsess{
background:#fc5f69;
}
}
</style>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,271 @@
<template>
<view class="container">
<view class="page-body">
<view class='wrapper'>
<view class='toolbar' @tap="format">
<view :class="formats.bold ? 'ql-active' : ''" class="iconfont icon-zitijiacu" data-name="bold">
</view>
<view :class="formats.italic ? 'ql-active' : ''" class="iconfont icon-zitixieti" data-name="italic">
</view>
<view :class="formats.underline ? 'ql-active' : ''" class="iconfont icon-zitixiahuaxian"
data-name="underline"></view>
<view :class="formats.strike ? 'ql-active' : ''" class="iconfont icon-zitishanchuxian"
data-name="strike"></view>
<!-- #ifndef MP-BAIDU -->
<view :class="formats.align === 'left' ? 'ql-active' : ''" class="iconfont icon-zuoduiqi"
data-name="align" data-value="left"></view>
<!-- #endif -->
<view :class="formats.align === 'center' ? 'ql-active' : ''" class="iconfont icon-juzhongduiqi"
data-name="align" data-value="center"></view>
<view :class="formats.align === 'right' ? 'ql-active' : ''" class="iconfont icon-youduiqi"
data-name="align" data-value="right"></view>
<view :class="formats.align === 'justify' ? 'ql-active' : ''" class="iconfont icon-zuoyouduiqi"
data-name="align" data-value="justify"></view>
<!-- #ifndef MP-BAIDU -->
<view :class="formats.lineHeight ? 'ql-active' : ''" class="iconfont icon-line-height"
data-name="lineHeight" data-value="2"></view>
<view :class="formats.letterSpacing ? 'ql-active' : ''" class="iconfont icon-Character-Spacing"
data-name="letterSpacing" data-value="2em"></view>
<view :class="formats.marginTop ? 'ql-active' : ''" class="iconfont icon-722bianjiqi_duanqianju"
data-name="marginTop" data-value="20px"></view>
<view :class="formats.marginBottom ? 'ql-active' : ''" class="iconfont icon-723bianjiqi_duanhouju"
data-name="marginBottom" data-value="20px"></view>
<!-- #endif -->
<view class="iconfont icon-clearedformat" @tap="removeFormat"></view>
<!-- #ifndef MP-BAIDU -->
<view :class="formats.fontFamily ? 'ql-active' : ''" class="iconfont icon-font"
data-name="fontFamily" data-value="Pacifico"></view>
<view :class="formats.fontSize === '24px' ? 'ql-active' : ''" class="iconfont icon-fontsize"
data-name="fontSize" data-value="24px"></view>
<!-- #endif -->
<view :class="formats.color === '#0000ff' ? 'ql-active' : ''" class="iconfont icon-text_color"
data-name="color" data-value="#0000ff"></view>
<view :class="formats.backgroundColor === '#00ff00' ? 'ql-active' : ''"
class="iconfont icon-fontbgcolor" data-name="backgroundColor" data-value="#00ff00"></view>
<view class="iconfont icon-date" @tap="insertDate"></view>
<view class="iconfont icon--checklist" data-name="list" data-value="check"></view>
<view :class="formats.list === 'ordered' ? 'ql-active' : ''" class="iconfont icon-youxupailie"
data-name="list" data-value="ordered"></view>
<view :class="formats.list === 'bullet' ? 'ql-active' : ''" class="iconfont icon-wuxupailie"
data-name="list" data-value="bullet"></view>
<view class="iconfont icon-undo" @tap="undo"></view>
<view class="iconfont icon-redo" @tap="redo"></view>
<view class="iconfont icon-outdent" data-name="indent" data-value="-1"></view>
<view class="iconfont icon-indent" data-name="indent" data-value="+1"></view>
<view class="iconfont icon-fengexian" @tap="insertDivider"></view>
<view class="iconfont icon-charutupian" @tap="insertImage"></view>
<view :class="formats.header === 1 ? 'ql-active' : ''" class="iconfont icon-format-header-1"
data-name="header" :data-value="1"></view>
<view :class="formats.script === 'sub' ? 'ql-active' : ''" class="iconfont icon-zitixiabiao"
data-name="script" data-value="sub"></view>
<view :class="formats.script === 'super' ? 'ql-active' : ''" class="iconfont icon-zitishangbiao"
data-name="script" data-value="super"></view>
<view class="iconfont icon-shanchu" @tap="clear"></view>
<view :class="formats.direction === 'rtl' ? 'ql-active' : ''" class="iconfont icon-direction-rtl"
data-name="direction" data-value="rtl"></view>
</view>
<view class="editor-wrapper">
<editor id="editor" class="ql-container" placeholder="开始输入..." show-img-size show-img-toolbar
show-img-resize @statuschange="onStatusChange" @input="getText" :read-only="readOnly"
@ready="onEditorReady">
</editor>
</view>
<view
style="display:block; width: 80%; padding: 18rpx 0; text-align: center; margin:20rpx auto 0 auto; color: #fff; background:#6699ff;border-radius:16rpx;"
@click="determine">
确定</view>
</view>
</view>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
readOnly: false,
formats: {},
context: {}
}
},
async onLoad(e) {
try {
if (e.id) {
let res = await this.api.servicedetail({
service_id: e.id
})
if (res.code = 1) {
var thisdatadescribe = res.data.details
uni.createSelectorQuery().select('#editor').context((res) => {
if (!res) return
res.context.setContents({
html: thisdatadescribe
})
}).exec()
}
}
} catch (e) {
//TODO handle the exception
}
// #ifndef MP-BAIDU
uni.loadFontFace({
family: 'Pacifico',
source: 'url("https://sungd.github.io/Pacifico.ttf")'
})
// #endif
},
methods: {
getText(e) {
this.context = e.detail.html
console.log(e.detail.html, this.context); //输出相应内容的html代码
},
readOnlyChange() {
this.readOnly = !this.readOnly
},
onEditorReady() {
// #ifdef MP-BAIDU
this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
// #endif
// #ifdef APP-PLUS || MP-WEIXIN || H5
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
// #endif
},
determine() {
this.$bus.$emit('editors', this.context)
uni.navigateBack()
},
undo() {
this.editorCtx.undo()
},
redo() {
this.editorCtx.redo()
},
format(e) {
let {
name,
value
} = e.target.dataset
if (!name) return
// console.log('format', name, value)
this.editorCtx.format(name, value)
},
onStatusChange(e) {
const formats = e.detail
this.formats = formats
},
insertDivider() {
this.editorCtx.insertDivider({
success: function() {
console.log('insert divider success')
}
})
},
clear() {
uni.showModal({
title: '清空编辑器',
content: '确定清空编辑器全部内容?',
success: res => {
if (res.confirm) {
this.editorCtx.clear({
success: function(res) {
console.log("clear success")
}
})
}
}
})
},
removeFormat() {
this.editorCtx.removeFormat()
},
insertDate() {
const date = new Date()
const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
this.editorCtx.insertText({
text: formatDate
})
},
insertImage() {
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'wechat/',
result => {
this.editorCtx.insertImage({
src: result,
alt: '图像',
})
uni.hideLoading()
}, result => {
console.log(result)
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
}
}
}
</script>
<style>
@import "./editor-icon.css";
.wrapper {
height: 100%;
}
.editor-wrapper {
background: #fff;
}
.iconfont {
display: inline-block;
padding: 8px 8px;
width: 24px;
height: 24px;
cursor: pointer;
font-size: 20px;
}
.toolbar {
box-sizing: border-box;
border-bottom: 0;
}
.ql-container {
box-sizing: border-box;
padding: 12px 15px;
width: 100%;
min-height: 30vh;
height: 100%;
font-size: 16px;
line-height: 1.5;
}
.ql-active {
color: #06c;
}
</style>

Binary file not shown.

230
pages/project/index.vue Normal file
View File

@@ -0,0 +1,230 @@
<template>
<view class="content">
<view class="onecontent flex-between">
<u-search shape="square" :clearabled="true" @blur='servicelists' :showAction="false" placeholder="输入关键字"
v-model="like"></u-search>
<view class="flex-start" style="padding-left:20rpx;" @click="contentfixedclick()">
<u-icon name="order" color="#666" size="22"></u-icon>
<text class="flex-starttext">新建项目</text>
</view>
<view class="flex-start" style="padding-left:20rpx;" @click="createcap()">
<u-icon name="order" color="#666" size="22"></u-icon>
<text class="flex-starttext">新建分类</text>
</view>
</view>
<view class="contenttow">
<view class="contenttowitem" v-for="(item,index) in list" :key="index" @click="contentfixedclick(item.service_id)">
<view class="contenttowitemone flex-between">
<text class="contenttowitemone_one"
:style="item.service_status == 0?'color: #ccc;':''">{{item.service_title}}</text>
<view class="contenttowitemone_tow flex-start" >
<text class="contenttowitemone_towtext">编辑项目</text>
<u-icon name="file-text" color="#999" size="20"></u-icon>
</view>
</view>
<view class="contenttowitemtow flex-between">
<image class="contenttowitemtowimage" :src="item.service_img" mode=""></image>
<view class="contenttowitemtow_item flex-colum-start">
<view class="contenttowitemtow_itemone" :style="item.service_status == 0?'color: #ccc;':''">
{{item.service_describe}}
</view>
<view class="contenttowitemtow_ittow flex-between">
<view class="contenttowitemtow_ittowone"
:style="item.service_status == 0?'color: #ccc;':''">
¥{{item.service_price}}<text
class="contenttowitemtow_ittowonetext">{{item.service_y_price}}</text>
</view>
<view class="contenttowitemtow_ittowtow">
<text v-if="item.service_status == 1" style="color: green;">已上架</text>
<text v-else style="color: red;">已下架</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view v-if="list.length==0 && form.is_end == true" class="flex-colum">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
</view>
</template>
<script>
export default {
data() {
return {
like: "",
list: [],
form: {
is_end: false,
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.form = {
is_end: false,
page: 1,
status: 'loadmore',
},
this.list = []
this.servicelist()
},
onReachBottom() {
this.servicelist()
},
methods: {
servicelists() {
this.list = []
this.form.page = 1
this.servicelist()
},
contentfixedclick(e) {
uni.pro.navigateTo('project/create', {
id: e
})
},
createcap() {
uni.pro.navigateTo('project/createcap')
},
async servicelist(e) { //项目列表
let res = await this.api.servicelist({
page: this.form.page,
like: this.like
});
if (res.data.length == 0) {
this.form.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.form.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
},
}
}
</script>
<style lang="scss">
page {
background: #fbfbfa;
}
.content {
.onecontent {
padding: 16rpx 20rpx;
width: 100%;
background: #FFFFFF;
.flex-start {
.flex-starttext {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
}
}
.contenttow {
padding: 0 28rpx;
.contenttowitem {
margin-top: 34rpx;
padding: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 24rpx;
.contenttowitemone {
width: 100%;
padding-bottom: 18rpx;
border-bottom: 1rpx solid #EAEAEA;
.contenttowitemone_one {
width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 28rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
font-weight: bold;
color: #333333;
}
.contenttowitemone_tow {
.contenttowitemone_towtext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
}
}
.contenttowitemtow {
width: 100%;
padding-top: 18rpx;
.contenttowitemtowimage {
width: 136rpx;
height: 136rpx;
border-radius: 10rpx;
}
.contenttowitemtow_item {
height: 136rpx;
width: 75%;
justify-content: space-between;
.contenttowitemtow_itemone {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
.contenttowitemtow_ittow {
width: 100%;
.contenttowitemtow_ittowone {
font-size: 32rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
font-weight: bold;
color: #333333;
.contenttowitemtow_ittowonetext {
text-decoration: line-through;
margin-left: 10rpx;
font-size: 22rpx;
font-weight: 400;
}
}
.contenttowitemtow_ittowtow {
font-size: 16rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
}
}
}
</style>