抖音小程序上线

master
yujialong 5 months ago
parent 3123e5f30b
commit 26d4d20643
  1. 10
      apis/modules/user.js
  2. 4
      components/notAuth/notAuth.vue
  3. 2
      libs/uma.js
  4. 7
      order/addCourse/addCourse.vue
  5. 2
      order/curClient/curClient.vue
  6. 22
      order/orderDetail/orderDetail.vue
  7. 2
      order/productDetail/productDetail.vue
  8. 2
      order/shopCart/shopCart.vue
  9. 81
      pages/login/login.vue
  10. 4
      pages/orders/orders.vue
  11. 3
      pages/person/person.vue
  12. 17
      pages/reg/reg.vue
  13. 6
      team/qrcode/qrcode.vue

@ -13,6 +13,10 @@ export const douYinLoginByOpenid = (data) => {
return post('users/users/user/douYinLoginByOpenid?openid=' + data) return post('users/users/user/douYinLoginByOpenid?openid=' + data)
} }
export const douYinUserBinding = (data) => {
return post('users/users/user/douYinUserBinding', data)
}
export const queryProvince = () => { export const queryProvince = () => {
return get('nakadai/nakadai/province/queryProvince') return get('nakadai/nakadai/province/queryProvince')
} }
@ -72,8 +76,8 @@ export const checkIfThePhoneNumberExists = phone => {
return post(`users/users/applets/mine/checkIfThePhoneNumberExists?phone=${phone}`) return post(`users/users/applets/mine/checkIfThePhoneNumberExists?phone=${phone}`)
} }
export const queryPartnerAccount = phone => { export const queryPartnerAccount = data => {
return post(`nakadai/nakadai/partnerAccount/queryPartnerAccount?phone=${phone}`) return post(`nakadai/nakadai/partnerAccount/queryPartnerAccount?phone=${data.phone}&openId=${data.openId}&douYinOpenId=${data.douYinOpenId}`)
} }
export const getSessionKey = data => { export const getSessionKey = data => {
@ -85,7 +89,7 @@ export const partnerAccountApplication = data => {
} }
export const loginByOpenid = openid => { export const loginByOpenid = openid => {
return post(`users/users/user/loginByOpenid?openid=` + openid) return post(`users/users/user/loginByOpenid?openid=${openid}`)
} }
export const checkWorkNumOrAccount = account => { export const checkWorkNumOrAccount = account => {

@ -3,7 +3,7 @@
<view class="mask"></view> <view class="mask"></view>
<view class="texts"> <view class="texts">
<view class="text">权限审核中可联系下方平台运营加快审核进度</view> <view class="text">权限审核中可联系下方平台运营加快审核进度</view>
<image class="qrcode" src="https://occupationlab.com/images/customer.png" mode="widthFix"></image> <image class="qrcode" :src="src" mode="widthFix"></image>
</view> </view>
</view> </view>
</template> </template>
@ -12,7 +12,7 @@
export default { export default {
data() { data() {
return { return {
src: uni.getSystemInfoSync().uniPlatform === 'mp-toutiao' ? 'https://occupationlab.com/images/dyQrcode.jpg' : 'https://occupationlab.com/images/customer.png'
} }
}, },
methods: { methods: {

@ -1,5 +1,4 @@
// #ifdef MP-WEIXIN
import uma from 'umtrack-wx'; import uma from 'umtrack-wx';
uma.init({ uma.init({
appKey: '64cc98d5a1a164591b62da3e', // 由友盟分配的APP_KEY appKey: '64cc98d5a1a164591b62da3e', // 由友盟分配的APP_KEY
@ -17,4 +16,3 @@ uma.install = function(Vue) {
Vue.prototype.$uma = uma; Vue.prototype.$uma = uma;
} }
export default uma; export default uma;
// #endif

@ -67,7 +67,8 @@
value: 1 value: 1
}], }],
checked: uni.getStorageSync('courses') || [], // checked: uni.getStorageSync('courses') || [], //
courses: uni.getStorageSync('courses') || [] courses: uni.getStorageSync('courses') || [],
submiting: false,
} }
}, },
watch: { watch: {
@ -259,6 +260,9 @@
submit() { submit() {
const list = this.checked // const list = this.checked //
if (list.length) { if (list.length) {
if (this.submiting) return false
this.submiting = true
const result = this.courses const result = this.courses
const list1 = [] // const list1 = [] //
const list0 = [] // const list0 = [] //
@ -317,6 +321,7 @@
this.handleRenew(4, customerId, list4, result, resolve, reject) this.handleRenew(4, customerId, list4, result, resolve, reject)
})) }))
Promise.all(promises).then(_ => { Promise.all(promises).then(_ => {
this.submiting = false
uni.setStorageSync('courses', result) // uni.setStorageSync('courses', result) //
uni.redirectTo({ uni.redirectTo({
url: `../editCourse/editCourse?customerId=${customerId}&orderType=${this.orderType}` url: `../editCourse/editCourse?customerId=${customerId}&orderType=${this.orderType}`

@ -216,8 +216,10 @@
margin-top: 20rpx; margin-top: 20rpx;
background-color: #fff; background-color: #fff;
.item { .item {
width: 100%;
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
border-bottom: 1px solid #f1f1f1; border-bottom: 1px solid #f1f1f1;
box-sizing: border-box;
} }
.c-name { .c-name {
font-size: 30rpx; font-size: 30rpx;

@ -41,11 +41,11 @@
<uni-data-picker v-else class="picker-input" placeholder="请选择订单类型" popup-title="请选择订单类型" preload :clear-icon="false" :localdata="orderTypes" v-model="form.orderType" @change="calcTotal(1)"></uni-data-picker> <uni-data-picker v-else class="picker-input" placeholder="请选择订单类型" popup-title="请选择订单类型" preload :clear-icon="false" :localdata="orderTypes" v-model="form.orderType" @change="calcTotal(1)"></uni-data-picker>
</view> --> </view> -->
<template v-if="edited"> <template v-if="edited">
<view class="line"> <view v-if="form.orderNumber" class="line">
<view class="name">订单编号</view> <view class="name">订单编号</view>
<view class="val">{{ form.orderNumber }}</view> <view class="val">{{ form.orderNumber }}</view>
</view> </view>
<view class="line"> <view v-if="form.createTime" class="line">
<view class="name">订单时间</view> <view class="name">订单时间</view>
<view class="val">{{ form.createTime }}</view> <view class="val">{{ form.createTime }}</view>
</view> </view>
@ -57,8 +57,9 @@
</view> </view>
</view> </view>
<view id="products">
<template v-for="c in courseList"> <template v-for="c in courseList">
<view v-if="c.list.length" class="block pro-wrap" id="products"> <view v-if="c.list.length" class="block pro-wrap">
<view class="l-title">{{ c.name }}</view> <view class="l-title">{{ c.name }}</view>
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons> <uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons>
<ul class="pro-list" v-show="!c.shrink"> <ul class="pro-list" v-show="!c.shrink">
@ -133,6 +134,7 @@
</ul> </ul>
</view> </view>
</template> </template>
</view>
<view class="bottom"> <view class="bottom">
<template v-if="!edited && !orderId"> <template v-if="!edited && !orderId">
@ -293,6 +295,9 @@
} }
this.courseList = store this.courseList = store
this.courses = list this.courses = list
uni.pageScrollTo({
selector: '#products'
})
try { try {
uni.removeStorageSync('courses') uni.removeStorageSync('courses')
} catch (e) {} } catch (e) {}
@ -759,7 +764,18 @@
this.delShopCart(courses) this.delShopCart(courses)
uni.hideLoading() uni.hideLoading()
this.$util.sucMsg('添加成功') this.$util.sucMsg('添加成功')
// #ifdef MP-WEIXIN
this.publicNotice() this.publicNotice()
// #endif
// #ifdef MP-TOUTIAO
setTimeout(() => {
uni.switchTab({
url: '/pages/orders/orders'
})
}, 1500)
// #endif
}).catch(res => { }).catch(res => {
uni.hideLoading() uni.hideLoading()
}) })

@ -414,7 +414,7 @@
white-space: nowrap; white-space: nowrap;
} }
.des-html { .des-html {
width: 100%;; width: calc(100% - 140rpx);
font-size: 28rpx !important; font-size: 28rpx !important;
} }
.rich-text-content span { .rich-text-content span {

@ -259,10 +259,12 @@
li { li {
display: flex; display: flex;
align-items: center; align-items: center;
width: 100%;
padding: 30rpx 24rpx; padding: 30rpx 24rpx;
margin: 16rpx 24rpx; margin: 16rpx 24rpx;
background-color: #fff; background-color: #fff;
border-radius: 16rpx; border-radius: 16rpx;
box-sizing: border-box;
} }
.name { .name {
margin-bottom: 10rpx; margin-bottom: 10rpx;

@ -26,7 +26,7 @@
</template> </template>
<script> <script>
import { login, userBinding, getSessionKey, queryPartnerAccount, douYinLogin, douYinLoginByOpenid } from '@/apis/modules/user.js' import { login, userBinding, getSessionKey, queryPartnerAccount, douYinLogin, douYinLoginByOpenid, douYinUserBinding } from '@/apis/modules/user.js'
import WXBizDataCrypt from '@/libs/WXBizDataCrypt' import WXBizDataCrypt from '@/libs/WXBizDataCrypt'
export default { export default {
data() { data() {
@ -75,40 +75,37 @@
if (code) { if (code) {
this.submiting = true this.submiting = true
let fn = login
let param = {
code,
avatarUrl: userInfo.avatarUrl
}
// //
if (this.isDy) { if (this.isDy) {
fn = douYinLogin try {
param = code const res = await douYinLogin(code)
const res1 = await douYinLoginByOpenid('_000P6jr9bt8gW0ySNSzGsNBnCB0er4KtN3M') const { data, status } = res
uni.setStorageSync('token', res1.data.token) this.submiting = false
this.toIndex() this.sessionKey = data.sessionKey
// fn(param).then(async res => { this.openid = data.openid
// const { data, status } = res this.unionid = data.unionid
// this.submiting = false uni.setStorageSync('sessionKey', data.sessionKey)
// this.sessionKey = data.sessionKey uni.setStorageSync('openid', data.openid)
// this.openid = data.openid
// this.unionid = data.unionid
// uni.setStorageSync('sessionKey', data.sessionKey)
// uni.setStorageSync('openid', data.openid)
// const res1 = await douYinLoginByOpenid('_000P6jr9bt8gW0ySNSzGsNBnCB0er4KtN3M') // const res1 = await douYinLoginByOpenid('_000P6jr9bt8gW0ySNSzGsNBnCB0er4KtN3M')
// // //
// // if (data.state === 'login') { if (data.state === 'login') {
// // this.toIndex() this.toIndex()
// // uni.setStorageSync('token', data.token) uni.setStorageSync('token', data.token)
// // } else {
// // this.isLogin = true
// // }
// }).catch(e => {
// this.submiting = false
// })
} else { } else {
fn(param).then((res) => { this.isLogin = true
// this.isReg = true
}
} catch (e) {
this.submiting = false
}
} else {
//
try {
const res = await login({
code,
avatarUrl: userInfo.avatarUrl
})
const { data, status } = res const { data, status } = res
this.submiting = false this.submiting = false
// //
@ -141,11 +138,10 @@
this.isLogin = true this.isLogin = true
} }
} }
}).catch(e => { } catch (e) {
this.submiting = false this.submiting = false
})
} }
}
} else { } else {
this.submiting = false this.submiting = false
that.$util.errMsg('登录失败!') that.$util.errMsg('登录失败!')
@ -162,14 +158,12 @@
} }
}, },
// //
onGetPhoneNumber(e){ async onGetPhoneNumber(e){
if (this.submiting) return false if (this.submiting) return false
const { encryptedData, iv } = e.detail const { encryptedData, iv } = e.detail
// 1.使js2.使 () // 1.使js2.使 ()
const appId = this.isDy ? 'tt2192572fbea04fe601' : uni.getAccountInfoSync().miniProgram.appId const appId = this.isDy ? 'tt2192572fbea04fe601' : uni.getAccountInfoSync().miniProgram.appId
console.log(1121, appId, this.sessionKey)
const pc = new WXBizDataCrypt(appId , this.sessionKey) const pc = new WXBizDataCrypt(appId , this.sessionKey)
console.log(22, pc, encryptedData, e)
const data = pc.decryptData(encryptedData , iv) const data = pc.decryptData(encryptedData , iv)
this.submiting = true this.submiting = true
const phone = data.phoneNumber const phone = data.phoneNumber
@ -177,12 +171,14 @@
this.submiting = false this.submiting = false
this.$util.to(`../reg/reg?openid=${this.openid}&phone=${phone}`) this.$util.to(`../reg/reg?openid=${this.openid}&phone=${phone}`)
} else { // } else { //
userBinding({ try {
const fn = this.isDy ? douYinUserBinding : userBinding
const res = await fn({
openid: this.openid, openid: this.openid,
phone, phone,
unionid: this.unionid, unionid: this.unionid,
platformId: 4 platformId: 4
}).then(res => { })
const { token, status } = res const { token, status } = res
if (status == 10014) { if (status == 10014) {
// unilogincode // unilogincode
@ -203,13 +199,13 @@
uni.setStorageSync('token', token) uni.setStorageSync('token', token)
this.toIndex() this.toIndex()
} }
}).catch(e => { } catch (e) {
this.submiting = false this.submiting = false
uni.showToast({ uni.showToast({
title: e.message, title: e.message,
icon: 'none' icon: 'none'
}) })
}) }
} }
}, },
// //
@ -221,7 +217,6 @@
lang: 'zh_CN', lang: 'zh_CN',
desc: '登录', desc: '登录',
success: ({ userInfo }) => { success: ({ userInfo }) => {
console.log(22, userInfo)
uni.setStorageSync('userName', userInfo.nickName) uni.setStorageSync('userName', userInfo.nickName)
uni.setStorageSync('avatar', userInfo.avatarUrl) uni.setStorageSync('avatar', userInfo.avatarUrl)
uni.login({ uni.login({
@ -231,12 +226,10 @@
getSessionKey({ getSessionKey({
code, code,
}).then(({ sessionKey }) => { }).then(({ sessionKey }) => {
console.log(11, sessionKey)
this.sessionKey = sessionKey.session_key this.sessionKey = sessionKey.session_key
this.openid = sessionKey.openid this.openid = sessionKey.openid
this.submiting = false this.submiting = false
this.isLogin = true this.isLogin = true
}).catch(e => { }).catch(e => {
this.submiting = false this.submiting = false
}) })
@ -256,7 +249,7 @@
} }
}, },
toAgreement(id) { toAgreement(id) {
this.$util.openFile(id) this.$util.to(id ? `/order/privacyAgreement/privacyAgreement` : `/order/serviceAgreement/serviceAgreement`)
}, },
// //
toIndex() { toIndex() {

@ -148,7 +148,6 @@
} }
}, },
onShow() { onShow() {
this.$uma.trackEvent('order') //
this.per = true this.per = true
// //
try { try {
@ -156,6 +155,7 @@
uni.removeStorageSync('courses') uni.removeStorageSync('courses')
} catch (e) {} } catch (e) {}
this.initRole() this.initRole()
this.$uma.trackEvent('order') //
}, },
methods: { methods: {
// //
@ -299,8 +299,10 @@
margin-top: 20rpx; margin-top: 20rpx;
background-color: #fff; background-color: #fff;
.item { .item {
width: 100%;
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
border-bottom: 1px solid #f1f1f1; border-bottom: 1px solid #f1f1f1;
box-sizing: border-box;
} }
.c-name { .c-name {
font-size: 30rpx; font-size: 30rpx;

@ -314,7 +314,10 @@
} }
.bg { .bg {
width: 100%; width: 100%;
height: calc(var(--status-bar-height) + 250rpx);
// #ifdef MP-WEIXIN
height: calc(var(--status-bar-height) + 317rpx); height: calc(var(--status-bar-height) + 317rpx);
// #endif
} }
.wrap { .wrap {
position: relative; position: relative;

@ -33,6 +33,7 @@
export default { export default {
data() { data() {
return { return {
isDy: uni.getSystemInfoSync().uniPlatform === 'mp-toutiao', //
openid: '', openid: '',
phone: '', phone: '',
my: false, my: false,
@ -60,7 +61,11 @@
// //
checkLogin() { checkLogin() {
// isTeam 10team // isTeam 10team
queryPartnerAccount(this.phone).then(({ team, username }) => { queryPartnerAccount({
phone: this.phone,
openId: this.isDy ? '' : this.openid,
douYinOpenId: this.isDy ? this.openid : '',
}).then(({ team, username }) => {
if (team) { if (team) {
team.teamId && uni.setStorageSync('teamId', team.teamId) team.teamId && uni.setStorageSync('teamId', team.teamId)
this.form.userName = team.userName this.form.userName = team.userName
@ -97,21 +102,20 @@
if (val) this.form.cityId = '' if (val) this.form.cityId = ''
}, },
// //
submit() { async submit() {
const { form } = this const { form } = this
if (!form.userName) return this.$util.errMsg('请输入姓名!') if (!form.userName) return this.$util.errMsg('请输入姓名!')
if (!form.provinceId) return this.$util.errMsg('请选择意向省份!') if (!form.provinceId) return this.$util.errMsg('请选择意向省份!')
if (!form.cityId) return this.$util.errMsg('请选择意向城市!') if (!form.cityId) return this.$util.errMsg('请选择意向城市!')
form.phone = this.phone form.phone = this.phone
form.appOpenId = this.openid form[this.isDy ? 'douYinOpenId' : 'appOpenId'] = this.openid
form.uniqueIdentification = Date.now() form.uniqueIdentification = Date.now()
if (form.isTeam) { // if (form.isTeam) { //
loginByOpenid(this.openid).then(({ data }) => { const { data } = await loginByOpenid(this.openid)
uni.setStorageSync('token', data.token) uni.setStorageSync('token', data.token)
this.toIndex() this.toIndex()
}).catch(res => {})
} else { // or } else { // or
partnerAccountApplication(form).then(({ token, teamId }) => { const { token, teamId } = await partnerAccountApplication(form)
this.$util.sucMsg(form.isTeam === 0 ? '创建成功' : '注册成功') this.$util.sucMsg(form.isTeam === 0 ? '创建成功' : '注册成功')
// tokenteamId // tokenteamId
if (token) { if (token) {
@ -127,7 +131,6 @@
}) })
}, 1500) }, 1500)
} }
}).catch(res => {})
} }
}, },
// //

@ -11,7 +11,7 @@
</view> </view>
</view> </view>
<view class="com">{{ team.partnerClassificationName }}</view> <view class="com">{{ team.partnerClassificationName }}</view>
<u-qrcode class="qrcode" ref="qrcode" canvas-id="qrcode" isQueueLoadImage :size="size" :value="link" @complete="qrcodeComplete"></u-qrcode> <u-qrcode v-if="link" class="qrcode" ref="qrcode" canvas-id="qrcode" isQueueLoadImage :size="size" :value="link" @complete="qrcodeComplete"></u-qrcode>
<image class="qrcode-img" :src="qrcodeImg" show-menu-by-longpress @click="previewImage"></image> <image class="qrcode-img" :src="qrcodeImg" show-menu-by-longpress @click="previewImage"></image>
<view class="tips" style="margin-top: 20rpx;">扫一扫加入我们吧</view> <view class="tips" style="margin-top: 20rpx;">扫一扫加入我们吧</view>
@ -69,9 +69,13 @@
}, },
// imageimage // imageimage
qrcodeComplete() { qrcodeComplete() {
console.log('complete', this.$refs.qrcode.toTempFilePath, this.link)
this.$refs.qrcode.toTempFilePath({ this.$refs.qrcode.toTempFilePath({
success: res => { success: res => {
this.qrcodeImg = res.tempFilePath this.qrcodeImg = res.tempFilePath
},
fail: res => {
console.log('fail', res)
} }
}); });
}, },

Loading…
Cancel
Save